Incubating
Incubating — Zarr raster stores¶
Status: Open — draft profile, awaiting implementations (#132).
Portolan intends to support Zarr as a raster format beside COG, in
formats.md. This profile stays in incubation until
more complete implementations exist. That means catalogs that follow every rule
here, and support for those rules in the validator, the CLI, and the browser.
Reports from those implementations can change any rule before the profile
graduates.
Nothing here is part of the conformance surface for the current Portolan
version. The requirements below carry PORTO-ZARR IDs in the
requirements manifest, marked
status: incubating, so that the validator can check a store against them.
Scope¶
A Zarr store is a hierarchy of groups and arrays under one root URL. The
requirements in this document apply to the store that the asset href points
to, as a standard Zarr v3 reader reads it over HTTP. The storage system behind
that URL is not constrained. An Icechunk repository served as plain Zarr v3
can conform. Virtual stores are out of scope for this version of
the profile.
This document uses these terms:
- A renderable array is a data variable that has both spatial dimensions. Coordinate arrays are not renderable arrays.
- A chunk of a sharded array is an inner chunk. A shard is the outer chunk that holds inner chunks.
- The spatial dimensions are the two dimensions that
spatial:dimensionsnames. - A band dimension is a non-spatial dimension that holds the bands of one image.
Store¶
A store MUST be Zarr v3. It MUST declare these conventions in
zarr_conventions and conform to them:
- spatial;
- proj; and
- multiscales, where Overviews requires a pyramid.
A convention is identified by its UUID.
Access¶
- The store MUST be served over
https, with anAccess-Control-Allow-Originheader that permits cross-origin reads. This rule applies to the store of everydataasset, on any host. The store of asourceasset is exempt. - The STAC asset MUST follow the
asset organization
rules of the STAC Zarr Best Practices, with media type
application/vnd.zarr; version=3. - An
s3://href MAY be given beside thehttpsone.
Grid¶
- Every renderable array MUST have an affine
spatial:transform. The transform is the authoritative grid. - The spatial axes MUST be the last two dimensions of every renderable array, Y before X.
- Arrays MUST be stored row-major (C order).
Coordinate reference system¶
These rules apply to the attributes of the Zarr store under the proj convention. They do not apply to the STAC Projection extension fields of the same names.
- The store SHOULD carry
proj:code. - A store without
proj:codeSHOULD carryproj:projjson.
Overviews¶
- A store whose finest level needs more than 4 chunks to cover its full extent
MUST provide a multiscale pyramid. Only the
layoutform of the multiscales convention declares a pyramid. - The coarsest level MUST fit in 4 chunks or fewer.
- Each
layoutentry MUST carryspatial:transformandspatial:shape, per the spatial convention's multiscales usage. - Levels SHOULD step by a factor of 2.
- An append to a pyramided store MUST target the level-0 group, not the store root.
Variables¶
A store with more than one data variable MUST declare cube:variables per
the datacube
extension.
Display range¶
Every renderable array MUST carry at least one of:
- a
statisticsobject withminimumandmaximum, on the entry of the asset'sbandsarray whosenameequals the variable name; or - a
rescalein arendersentry, per the render extension.
An 8-bit array with three or more bands is exempt. The bands are the entries
of bands or the positions of a band dimension.
Band statistics and band nodata describe the stored values, per the STAC
bands
definition. An authored display range or a display-only no-data value belongs
in renders.
No data¶
A renderable array SHOULD declare nodata on its bands entry. A store with
partial coverage SHOULD carry an alpha band instead. An alpha band is a band
named alpha, or the fourth band of a four-band variable. An array with an
alpha band is exempt from the nodata rule.
Chunking¶
- A store MUST NOT require a client to read more than 8 samples for every sample it draws, for one timestep at full resolution. The factor is the product of the chunk lengths along the non-spatial dimensions.
- Non-spatial dimensions SHOULD have a chunk length of 1. A band dimension is exempt.
- A store chunked for time-series access SHOULD be published beside a display-chunked copy.
- Chunks SHOULD be 256 to 1024 samples on X and Y. The lower bound does not apply to an axis shorter than 256 samples. A shard MAY be larger on X and Y.
- A shard MUST NOT span the non-spatial dimensions by a product of more than 8.
Size and checksum¶
The file:size of a Zarr store asset is the total size in bytes of all
objects in the store. The file:checksum recommendation of
core.md does not apply to a Zarr store asset.
Codecs¶
Every codec in the chain SHOULD have a JavaScript implementation. blosc,
lz4, zstd, gzip, zlib, numcodecs.shuffle, numcodecs.delta,
scale_offset, transpose, bytes, crc32c, and sharding_indexed
qualify.
Open questions¶
- The 4-chunk and 8-sample thresholds are provisional. Tests against real stores can move them.
- The render extension has no field that ties a
rendersentry to one variable of a cube. Until it has one, arescalein anyrendersentry meets the display range rule. - The STAC Zarr Best Practices recommend the STAC Projection extension on a Zarr asset. Portolan does not require it for COG or for Zarr. A change to that position needs to cover both formats.