Skip to content

Commit

Permalink
Migrate to general data cube definition (#382)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Weidenholzer <17790923+LukeWeidenwalker@users.noreply.github.com>
  • Loading branch information
m-mohr and LukeWeidenwalker authored Jan 30, 2023
1 parent cc3ac84 commit a5764ed
Show file tree
Hide file tree
Showing 56 changed files with 1,038 additions and 239 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- New processes in proposal state:
- `filter_vector`
- `fit_class_random_forest`
- `fit_regr_random_forest`
- `flatten_dimensions`
Expand All @@ -19,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `vector_buffer`
- `vector_to_random_points`
- `vector_to_regular_points`
- `add_dimension`: Added new dimension type `geometries`. [#68](https://github.com/Open-EO/openeo-processes/issues/68)

### Changed

Expand All @@ -34,15 +36,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a `NoDataAvailable` exception
- `inspect`: The parameter `message` has been moved to be the second argument. [#369](https://github.com/Open-EO/openeo-processes/issues/369)
- `save_result`: Added a more concrete `DataCubeEmpty` exception.
- New definition for `aggregate_spatial`:
- Allows more than 3 input dimensions [#126](https://github.com/Open-EO/openeo-processes/issues/126)
- Allow to not export statistics by changing the parameter `target_dimension` [#366](https://github.com/Open-EO/openeo-processes/issues/366)
- Clarify how the resulting vector data cube looks like [#356](https://github.com/Open-EO/openeo-processes/issues/356)
- Renamed `create_raster_cube` to `create_data_cube`. [#68](https://github.com/Open-EO/openeo-processes/issues/68)
- Updated the processes based on the subtypes `raster-cube` or `vector-cube` to work with the subtype `datacube` instead. [#68](https://github.com/Open-EO/openeo-processes/issues/68)

### Removed

- The `examples` folder has been migrated to the [openEO Community Examples](https://github.com/Open-EO/openeo-community-examples/tree/main/processes) repository.
- Deprecated `GeometryCollections` are not supported any longer. [#389](https://github.com/Open-EO/openeo-processes/issues/389)

### Fixed

- `aggregate_spatial`:
- Clarified that vector properties are preserved for vector data cubes and all GeoJSON Features. [#270](https://github.com/Open-EO/openeo-processes/issues/270)
- Clarified that feature properties are preserved for vector data cubes and all GeoJSON Features. [#270](https://github.com/Open-EO/openeo-processes/issues/270)
- Clarified that a `TargetDimensionExists` exception is thrown if the target dimension exists.
- `apply` and `array_apply`: Fixed broken references to the `absolute` process
- `apply_neighborhood`: Parameter `overlap` was optional but had no default value and no schena for the default value defined.
Expand Down
9 changes: 5 additions & 4 deletions add_dimension.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"description": "A data cube to add the dimension to.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube"
}
},
{
Expand Down Expand Up @@ -39,9 +39,10 @@
"schema": {
"type": "string",
"enum": [
"bands",
"geometries",
"spatial",
"temporal",
"bands",
"other"
]
},
Expand All @@ -53,12 +54,12 @@
"description": "The data cube with a newly added dimension. The new dimension has exactly one dimension label. All other dimensions remain unchanged.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube"
}
},
"exceptions": {
"DimensionExists": {
"message": "A dimension with the specified name already exists."
}
}
}
}
58 changes: 42 additions & 16 deletions aggregate_spatial.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
{
"id": "aggregate_spatial",
"summary": "Zonal statistics for geometries",
"description": "Aggregates statistics for one or more geometries (e.g. zonal statistics for polygons) over the spatial dimensions. The number of total and valid pixels is returned together with the calculated values.\n\nAn 'unbounded' aggregation over the full extent of the horizontal spatial dimensions can be computed with the process ``reduce_spatial()``.\n\nThis process passes a list of values to the reducer. The list of values has an undefined order, therefore processes such as ``last()`` and ``first()`` that depend on the order of the values will lead to unpredictable results.",
"description": "Aggregates statistics for one or more geometries (e.g. zonal statistics for polygons) over the spatial dimensions. The given data cube can have multiple additional dimensions and for all these dimensions results will be computed individually.\n\nAn 'unbounded' aggregation over the full extent of the horizontal spatial dimensions can be computed with the process ``reduce_spatial()``.\n\nThis process passes a list of values to the reducer. The list of values has an undefined order, therefore processes such as ``last()`` and ``first()`` that depend on the order of the values will lead to unpredictable results.",
"categories": [
"cubes",
"aggregate & resample"
],
"parameters": [
{
"name": "data",
"description": "A raster data cube.\n\nThe data cube must have been reduced to only contain two spatial dimensions and a third dimension the values are aggregated for, for example the temporal dimension to get a time series. Otherwise, this process fails with the `TooManyDimensions` exception.\n\nThe data cube implicitly gets restricted to the bounds of the geometries as if ``filter_spatial()`` would have been used with the same values for the corresponding parameters immediately before this process.",
"description": "A raster data cube with at least two spatial dimensions.\n\nThe data cube implicitly gets restricted to the bounds of the geometries as if ``filter_spatial()`` would have been used with the same values for the corresponding parameters immediately before this process.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "spatial",
"axis": [
"x",
"y"
]
}
]
}
},
{
"name": "geometries",
"description": "Geometries as GeoJSON on which the aggregation will be based. Vector properties are preserved for vector data cubes and all GeoJSON Features.\n\nOne value will be computed per GeoJSON `Feature`, `Geometry` or `GeometryCollection`. For a `FeatureCollection` multiple values will be computed, one value per contained `Feature`. For example, a single value will be computed for a `MultiPolygon`, but two values will be computed for a `FeatureCollection` containing two polygons.\n\n- For **polygons**, the process considers all pixels for which the point at the pixel center intersects with the corresponding polygon (as defined in the Simple Features standard by the OGC).\n- For **points**, the process considers the closest pixel center.\n- For **lines** (line strings), the process considers all the pixels whose centers are closest to at least one point on the line.\n\nThus, pixels may be part of multiple geometries and be part of multiple aggregations.\n\nTo maximize interoperability, a nested `GeometryCollection` should be avoided. Furthermore, a `GeometryCollection` composed of a single type of geometries should be avoided in favour of the corresponding multi-part type (e.g. `MultiPolygon`).",
"schema": {
"type": "object",
"subtype": "geojson"
}
"description": "Geometries for which the aggregation will be computed. Feature properties are preserved for vector data cubes and all GeoJSON Features.\n\nOne value will be computed per label in the dimension of type `geometries`, GeoJSON `Feature` or `Geometry`. For a `FeatureCollection` multiple values will be computed, one value per contained `Feature`. For example, a single value will be computed for a `MultiPolygon`, but two values will be computed for a `FeatureCollection` containing two polygons.\n\n- For **polygons**, the process considers all pixels for which the point at the pixel center intersects with the corresponding polygon (as defined in the Simple Features standard by the OGC).\n- For **points**, the process considers the closest pixel center.\n- For **lines** (line strings), the process considers all the pixels whose centers are closest to at least one point on the line.\n\nThus, pixels may be part of multiple geometries and be part of multiple aggregations. No operation is applied to geometries that are outside of the bounds of the data.",
"schema": [
{
"type": "object",
"subtype": "geojson",
"description": "The GeoJSON type `GeometryCollection` is not supported."
},
{
"type": "object",
"subtype": "datacube",
"dimensions": [
{
"type": "geometries"
}
]
}
]
},
{
"name": "reducer",
Expand Down Expand Up @@ -60,11 +81,14 @@
},
{
"name": "target_dimension",
"description": "The name of a new dimensions that is used to store the results. A new dimension will be created with the given name and type `other` (see ``add_dimension()``). Defaults to the dimension name `result`. Fails with a `TargetDimensionExists` exception if a dimension with the specified name exists.",
"description": "By default (which is `null`), the process only computes the results and doesn't add a new dimension.\n\nIf this parameter contains a new dimension name, the computation also stores information about the total count of pixels (valid + invalid pixels) and the number of valid pixels (see ``is_valid()``) for each computed value. These values are added as a new dimension. The new dimension of type `other` has the dimension labels `value`, `total_count` and `valid_count`.\n\nFails with a `TargetDimensionExists` exception if a dimension with the specified name exists.",
"schema": {
"type": "string"
"type": [
"string",
"null"
]
},
"default": "result",
"default": null,
"optional": true
},
{
Expand All @@ -78,16 +102,18 @@
}
],
"returns": {
"description": "A vector data cube with the computed results and restricted to the bounds of the geometries.\n\nThe computed value is used for the dimension with the name that was specified in the parameter `target_dimension`.\n\nThe computation also stores information about the total count of pixels (valid + invalid pixels) and the number of valid pixels (see ``is_valid()``) for each geometry. These values are added as a new dimension with a dimension name derived from `target_dimension` by adding the suffix `_meta`. The new dimension has the dimension labels `total_count` and `valid_count`.",
"description": "A vector data cube with the computed results and restricted to the bounds of the geometries. The spatial dimensions is replaced by a geometries dimension and if `target_dimension` is not `null`, a new dimension is added.",
"schema": {
"type": "object",
"subtype": "vector-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "geometries"
}
]
}
},
"exceptions": {
"TooManyDimensions": {
"message": "The number of dimensions must be reduced to three for `aggregate_spatial`."
},
"TargetDimensionExists": {
"message": "A dimension with the specified target dimension name already exists."
}
Expand Down
16 changes: 13 additions & 3 deletions aggregate_temporal.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
"description": "A data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "temporal"
}
]
}
},
{
Expand Down Expand Up @@ -162,7 +167,12 @@
"description": "A new data cube with the same dimensions. The dimension properties (name, type, labels, reference system and resolution) remain unchanged, except for the resolution and dimension labels of the given temporal dimension.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "temporal"
}
]
}
},
"examples": [
Expand Down Expand Up @@ -234,4 +244,4 @@
"title": "Aggregation explained in the openEO documentation"
}
]
}
}
16 changes: 13 additions & 3 deletions aggregate_temporal_period.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
"description": "The source data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "temporal"
}
]
}
},
{
Expand Down Expand Up @@ -97,7 +102,12 @@
"description": "A new data cube with the same dimensions. The dimension properties (name, type, labels, reference system and resolution) remain unchanged, except for the resolution and dimension labels of the given temporal dimension. The specified temporal dimension has the following dimension labels (`YYYY` = four-digit year, `MM` = two-digit month, `DD` two-digit day of month):\n\n* `hour`: `YYYY-MM-DD-00` - `YYYY-MM-DD-23`\n* `day`: `YYYY-001` - `YYYY-365`\n* `week`: `YYYY-01` - `YYYY-52`\n* `dekad`: `YYYY-00` - `YYYY-36`\n* `month`: `YYYY-01` - `YYYY-12`\n* `season`: `YYYY-djf` (December - February), `YYYY-mam` (March - May), `YYYY-jja` (June - August), `YYYY-son` (September - November).\n* `tropical-season`: `YYYY-ndjfma` (November - April), `YYYY-mjjaso` (May - October).\n* `year`: `YYYY`\n* `decade`: `YYY0`\n* `decade-ad`: `YYY1`\n\nThe dimension labels in the new data cube are complete for the whole extent of the source data cube. For example, if `period` is set to `day` and the source data cube has two dimension labels at the beginning of the year (`2020-01-01`) and the end of a year (`2020-12-31`), the process returns a data cube with 365 dimension labels (`2020-001`, `2020-002`, ..., `2020-365`). In contrast, if `period` is set to `day` and the source data cube has just one dimension label `2020-01-05`, the process returns a data cube with just a single dimension label (`2020-005`).",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "temporal"
}
]
}
},
"exceptions": {
Expand All @@ -118,4 +128,4 @@
"title": "Aggregation explained in the openEO documentation"
}
]
}
}
21 changes: 18 additions & 3 deletions anomaly.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,25 @@
"description": "A data cube with exactly one temporal dimension and the following dimension labels for the given period (`YYYY` = four-digit year, `MM` = two-digit month, `DD` two-digit day of month):\n\n* `hour`: `YYYY-MM-DD-00` - `YYYY-MM-DD-23`\n* `day`: `YYYY-001` - `YYYY-365`\n* `week`: `YYYY-01` - `YYYY-52`\n* `dekad`: `YYYY-00` - `YYYY-36`\n* `month`: `YYYY-01` - `YYYY-12`\n* `season`: `YYYY-djf` (December - February), `YYYY-mam` (March - May), `YYYY-jja` (June - August), `YYYY-son` (September - November).\n* `tropical-season`: `YYYY-ndjfma` (November - April), `YYYY-mjjaso` (May - October).\n* `year`: `YYYY`\n* `decade`: `YYY0`\n* `decade-ad`: `YYY1`\n* `single-period` / `climatology-period`: Any\n\n``aggregate_temporal_period()`` can compute such a data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "temporal"
}
]
}
},
{
"name": "normals",
"description": "A data cube with normals, e.g. daily, monthly or yearly values computed from a process such as ``climatological_normal()``. Must contain exactly one temporal dimension with the following dimension labels for the given period:\n\n* `hour`: `00` - `23`\n* `day`: `001` - `365`\n* `week`: `01` - `52`\n* `dekad`: `00` - `36`\n* `month`: `01` - `12`\n* `season`: `djf` (December - February), `mam` (March - May), `jja` (June - August), `son` (September - November)\n* `tropical-season`: `ndjfma` (November - April), `mjjaso` (May - October)\n* `year`: Four-digit year numbers\n* `decade`: Four-digit year numbers, the last digit being a `0`\n* `decade-ad`: Four-digit year numbers, the last digit being a `1`\n* `single-period` / `climatology-period`: A single dimension label with any name is expected.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "temporal"
}
]
}
},
{
Expand Down Expand Up @@ -50,7 +60,12 @@
"description": "A data cube with the same dimensions. The dimension properties (name, type, labels, reference system and resolution) remain unchanged.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube",
"dimensions": [
{
"type": "temporal"
}
]
}
}
}
8 changes: 4 additions & 4 deletions apply.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "apply",
"summary": "Apply a process to each pixel",
"description": "Applies a process to each pixel value in the data cube (i.e. a local operation). In contrast, the process ``apply_dimension()`` applies a process to all pixel values along a particular dimension.",
"summary": "Apply a process to each value",
"description": "Applies a process to each value in the data cube (i.e. a local operation). In contrast, the process ``apply_dimension()`` applies a process to all values along a particular dimension.",
"categories": [
"cubes"
],
Expand All @@ -11,7 +11,7 @@
"description": "A data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube"
}
},
{
Expand Down Expand Up @@ -60,7 +60,7 @@
"description": "A data cube with the newly computed values and the same dimensions. The dimension properties (name, type, labels, reference system and resolution) remain unchanged.",
"schema": {
"type": "object",
"subtype": "raster-cube"
"subtype": "datacube"
}
},
"links": [
Expand Down
Loading

0 comments on commit a5764ed

Please sign in to comment.