- Title: Datacube
- Identifier: https://stac-extensions.github.io/datacube/v2.3.0/schema.json
- Field Name Prefix: cube
- Scope: Item, Collection
- Extension Maturity Classification: Candidate
- Owner: @m-mohr
This document explains the Datacube Extension to the SpatioTemporal Asset Catalog (STAC) specification. It specifies datacube related metadata, especially their dimensions and potentially more in the future.
- Examples:
- Item example: Shows the basic usage of the extension in a STAC Item
- Collection example: Shows the basic usage of the extension in a STAC Collection
- JSON Schema
- Changelog
This document uses the following terms:
- Dimension: A named axis of the datacube, described by a Dimension Object.
Not to be confused with the
axisfield, which specifies the direction of a spatial dimension. - Dimension label (short: label): A single position along a dimension,
e.g. a timestamp, a band name, a coordinate, a geometry or a zone identifier.
Dimension labels are listed in
values, bounded byextent, spaced bystepand counted bycountof a Dimension Object. - Cell: A single element of the datacube, addressed by one dimension label per dimension. A cell holds one data value per variable.
- Variable: A named multi-dimensional array of the datacube, described by a Variable Object.
- Data value (short: value): The content of a cell for a variable.
Data values are listed in
valuesand bounded byextentof a Variable Object. Cells without data contain thenodatavalue.valuesandextentonly describe valid data values, i.e. they exclude thenodatavalue.
Please note that the field values contains dimension labels in Dimension Objects, but data values in Variable Objects.
For a mapping of these terms to openEO, OGC CIS, CF Conventions, xarray and OLAP, see Mapping to other terminologies.
The following fields can be used in the following parts of a STAC document:
- Catalogs
- Collections
- Item Properties (incl. Summaries in Collections)
- Assets (both Collections and Items, incl. Item Asset Definitions in Collections)
- Links
| Field Name | Type | Description |
|---|---|---|
| cube:dimensions | Map<string, Dimension Object> | REQUIRED. Uniquely named dimensions of the datacube. |
| cube:variables | Map<string, Variable Object> | Uniquely named variables of the datacube. |
The keys of cube:dimensions and cube:variables should be unique together; a key like lat should not be both a dimension and a variable.
A Dimension Object comes in different flavors, each of them is defined below. The fields define mostly very similar fields,
but they differ slightly depending on their use case. All objects share the fields type, description, and count with the same definition,
but type may be restricted to certain values. The definition of axis is shared between the spatial dimensions, but restricted to
certain values, too. extent, values and step share the same definition, but differ in the supported data types (number or string)
depending on the type of dimension. Whenever it's useful to specify these fields, the objects add the additional fields reference_system
and unit with very similar definitions across the objects.
The optional count field specifies the exact total number of dimension labels along the dimension.
When values and count are provided, count MUST equal the length of values.
It is especially useful to indicate count when values cannot be provided, e.g. for large or irregularly spaced dimensions.
The optional sampling field specifies whether the dimension labels represent cells or points,
which defines how extent relates to the dimension labels:
area: Each dimension label represents a cell, e.g. a pixel or a time interval such as a monthly composite.extentgives the outer bounds of the first and last cell, consistent withbbox,proj:bboxandstart_datetime/end_datetime. For spatial dimensions,valuesSHOULD be the cell centers.point: Each dimension label represents a point, e.g. a pixel-is-point sample or an instant in time.extentgives the first and last dimension label.
If sampling is not provided, it is undefined whether extent gives the outer cell bounds or the first and last dimension label.
sampling is defined per dimension, as opposed to raster:sampling, which describes the data values of a raster.
For example, "extent": [0, 10] with "step": 1 has 10 dimension labels (0.5, 1.5, ..., 9.5) with "sampling": "area",
and 11 dimension labels (0, 1, ..., 10) with "sampling": "point".
With sampling and a regular step, count can be derived from extent and step:
It is the number of steps between the bounds of extent for area, and that number plus one for point.
Otherwise, count can't be derived reliably and SHOULD be provided, e.g. if sampling is not provided or step is null.
values is meant for dimensions with a small number of dimension labels, e.g. bands.
For large dimensions, it is RECOMMENDED to provide extent (and step and count if applicable) instead of listing all dimension labels.
A spatial raster dimension in one of the horizontal (x or y) directions.
| Field Name | Type | Description |
|---|---|---|
| type | string | REQUIRED. Type of the dimension, always spatial. |
| axis | string | REQUIRED. Axis of the spatial raster dimension (x, y). |
| description | string | Detailed multi-line description to explain the dimension. CommonMark 0.29 syntax MAY be used for rich text representation. |
| extent | [number] | REQUIRED. Extent (lower and upper bounds) of the dimension as two-element array. Open intervals with null are not allowed. |
| values | [number] | Optionally, an ordered list of all dimension labels. |
| count | integer | Total number of dimension labels along the dimension (>= 0). |
| step | number|null | The space between consecutive dimension labels. Use null for irregularly spaced dimension labels. |
| sampling | string | Whether the dimension labels represent cells (area) or points (point), see Dimension Object. |
| unit | string | The unit of measurement for the dimension labels, preferably compliant to UCUM (unit code) or UDUNITS-2 (unit symbol or alternatively singular unit name). |
| reference_system | string|number|object | The spatial reference system for the data and the dimension labels (extent, values and step), specified as numerical EPSG code, WKT2 (ISO 19162) string or PROJJSON object. Defaults to EPSG code 4326. |
A spatial dimension in vertical (z) direction.
| Field Name | Type | Description |
|---|---|---|
| type | string | REQUIRED. Type of the dimension, always spatial. |
| axis | string | REQUIRED. Axis of the spatial dimension, always z. |
| description | string | Detailed multi-line description to explain the dimension. CommonMark 0.29 syntax MAY be used for rich text representation. |
| extent | [number|null] | If the dimension labels are ordinal, the extent (lower and upper bounds) of the dimension labels as two-element array. Use null for open intervals. |
| values | [number|string] | An ordered list of all dimension labels, especially useful for nominal dimension labels. |
| count | integer | Total number of dimension labels along the dimension (>= 0). |
| step | number|null | If the dimension labels are interval values, the space between consecutive dimension labels. Use null for irregularly spaced dimension labels. |
| sampling | string | Whether the dimension labels represent cells (area) or points (point), see Dimension Object. |
| unit | string | The unit of measurement for the dimension labels, preferably compliant to UCUM (unit code) or UDUNITS-2 (unit symbol or alternatively singular unit name). |
| reference_system | string|number|object | The spatial reference system for the data and the dimension labels (extent, values and step), specified as numerical EPSG code, WKT2 (ISO 19162) string or PROJJSON object. Defaults to EPSG code 4326. |
A Vertical Spatial Dimension Object MUST specify an extent or values. It MAY specify both.
A temporal dimension based on the ISO 8601 standard. The temporal reference system for the data is expected to be ISO 8601 compliant
(Gregorian calendar / UTC). Data not compliant with ISO 8601 can be represented as an Additional Dimension Object with type set to temporal.
| Field Name | Type | Description |
|---|---|---|
| type | string | REQUIRED. Type of the dimension, always temporal. |
| description | string | Detailed multi-line description to explain the dimension. CommonMark 0.29 syntax MAY be used for rich text representation. |
| extent | [string|null] | REQUIRED. Extent (lower and upper bounds) of the dimension as two-element array. The dates and/or times must be strings compliant to ISO 8601. null is allowed for open date ranges. |
| values | [string] | An ordered list of all dimension labels. The dates and/or times must be strings compliant to ISO 8601. |
| count | integer | Total number of dimension labels along the dimension (>= 0). |
| step | string|null | The space between consecutive dimension labels as ISO 8601 duration, e.g. P1D. Use null for irregularly spaced dimension labels. |
| sampling | string | Whether the dimension labels represent cells (area) or points (point), see Dimension Object. |
| unit | string | The unit of measurement for the dimension labels, preferably compliant to UCUM (unit code) or UDUNITS-2 (unit symbol or alternatively singular unit name). |
A vector dimension that defines a spatial dimension based on geometries.
| Field Name | Type | Description |
|---|---|---|
| type | string | REQUIRED. Type of the dimension, always geometry. |
| axes | [string] | Axes of the vector dimension as an ordered set of x, y and z. Defaults to x and y. |
| description | string | Detailed multi-line description to explain the dimension. CommonMark 0.29 syntax MAY be used for rich text representation. |
| bbox | [number] | REQUIRED. A single bounding box of the geometries as defined for STAC Collections, but not nested. |
| values | [string] | Optionally, an ordered list of dimension labels representing the geometries. This could be a list of WKT strings or other identifiers. |
| count | integer | Total number of dimension labels (i.e. geometries) along the dimension (>= 0). |
| geometry_types | [GeoJSON Types] | A set of geometry types. If not present, mixed geometry types must be assumed. |
| reference_system | string|number|object | The spatial reference system for the data, the bbox and the dimension labels (values), specified as numerical EPSG code, WKT2 (ISO 19162) string or PROJJSON object. Defaults to EPSG code 4326. |
For a general explanation what a vector datacube and a vector dimension is, please read the article "Vector Data Cubes".
An additional dimension that is not spatial, but may be temporal if the data is not compliant with ISO 8601 (see below).
| Field Name | Type | Description |
|---|---|---|
| type | string | REQUIRED. Custom type of the dimension, never spatial or geometry. |
| description | string | Detailed multi-line description to explain the dimension. CommonMark 0.29 syntax MAY be used for rich text representation. |
| extent | [number|null] | If the dimension labels are ordinal, the extent (lower and upper bounds) of the dimension labels as two-element array. Use null for open intervals. |
| values | [number|string] | An ordered list of all dimension labels, especially useful for nominal dimension labels. |
| count | integer | Total number of dimension labels along the dimension (>= 0). |
| step | number|null | If the dimension labels are interval values, the space between consecutive dimension labels. Use null for irregularly spaced dimension labels. |
| sampling | string | Whether the dimension labels represent cells (area) or points (point), see Dimension Object. |
| unit | string | The unit of measurement for the dimension labels, preferably compliant to UCUM (unit code) or UDUNITS-2 (unit symbol or alternatively singular unit name). |
| reference_system | string | The reference system for the data and the dimension labels (extent, values and step). |
An Additional Dimension Object MUST specify an extent or values. It MAY specify both.
Note on "Additional Dimension" with type temporal:
You can distinguish the "Temporal Dimension" from an "Additional Dimension" by checking whether the extent exists and contains strings.
So if the type equals temporal and extent is an array of strings/null, then you have a "Temporal Dimension",
otherwise you have an "Additional Dimension".
A Variable Object defines a variable (or a multi-dimensional array). The variable may have dimensions, which are described by Dimension Objects.
| Field Name | Type | Description |
|---|---|---|
| dimensions | [string] | REQUIRED. The dimensions of the variable. This should refer to keys in the cube:dimensions object or be an empty list if the variable has no dimensions. |
| type | string | REQUIRED. Type of the variable, either data or auxiliary. |
| description | string | Detailed multi-line description to explain the variable. CommonMark 0.29 syntax MAY be used for rich text representation. |
| extent | [number|string|null] | If the data values are ordinal, the extent (lower and upper bounds) of the data values as two-element array. Use null for open intervals. |
| values | [number|string] | An (ordered) list of all data values, especially useful for nominal data values. |
| unit | string | The unit of measurement for the data values, preferably compliant to UCUM (unit code) or UDUNITS-2 (unit symbol or alternatively singular unit name). |
| nodata | number|string | Data value used to identify cells without data, see common metadata for more details. |
| data_type | string | The data type of the data values, see common metadata for more details. |
type: The Variable type indicates whether what kind of variable is being described. It has two allowed values:
data: a variable containing measured or derived data values, for example "precipitation", "temperature", etc.auxiliary: a variable that contains coordinate data, but isn't a dimension incube:dimensions. For example, the dimension labels of the spatial dimensions might be provided in a projected coordinate reference system, but the datacube could have a variablelonwith dimensions(y, x), giving the longitude for each cell.
One-dimensional variables that only contain the dimension labels of a dimension (e.g. time(time), called coordinate variables in CF)
are described by the corresponding Dimension Object and SHOULD NOT be listed in cube:variables.
See the CF Conventions for more on auxiliary coordinates.
The following table maps the terms to related standards and tools. The concepts are similar, but don't always match exactly.
| This extension | openEO | OGC CIS 1.1 / ISO 19123 | CF Conventions | xarray | OLAP |
|---|---|---|---|---|---|
| Dimension | dimension | axis | dimension | dimension | dimension |
| Dimension label | dimension label | coordinate | coordinate value | coordinate label | member |
| Cell | - | grid point / grid cell | cell | element | cell |
| Dimension labels of a dimension | dimension labels | coordinates of an axis | coordinate variable | dimension coordinate | members of a dimension |
Variable (data) |
label of a bands dimension | range component | data variable | data variable | measure |
Variable (auxiliary) |
- | - | auxiliary coordinate variable | non-dimension coordinate | - |
| Data value | value | range value | data value | value (.values) |
cell value |
step |
resolution | resolution | - | - | - |
count |
- | - | dimension length | size (.sizes) |
- |
All contributions are subject to the STAC Specification Code of Conduct. For contributions, please follow the STAC specification contributing guide Instructions for running tests are copied here for convenience.
The same checks that run as checks on PR's are part of the repository and can be run locally to verify that changes are valid.
To run tests locally, you'll need npm, which is a standard part of any node.js installation.
First you'll need to install everything with npm once. Just navigate to the root of this repository and on your command line run:
npm install
Then to check markdown formatting and test the examples against the JSON schema, you can run:
npm testThis will spit out the same texts that you see online, and you can then go and fix your markdown or examples.
If the tests reveal formatting problems with the examples, you can fix them with:
npm run format-examples