Skip to content

Commit

Permalink
Merge pull request #261 from Open-EO/reduce-spatial
Browse files Browse the repository at this point in the history
reduce_spatial #226 and clarifications #260
  • Loading branch information
m-mohr authored Jun 4, 2021
2 parents edbd6d8 + 5f76884 commit 09167a5
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `date_shift`
- `is_infinite`
- `nan`
- `reduce_spatial`
- Added return value details (property `returns`) for the schemas with the subtype `process-graph`. [API#350](https://github.com/Open-EO/openeo-api/issues/350)
- `apply_neighborhood`: Clarify behavior for data cubes returned by the child processes and for that add the exception `DataCubePropertiesImmutable`.

Expand All @@ -28,7 +29,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `run_udf` and `run_udf_externally`: Specify specific (extensible) protocols for UDF URIs.

### Deprecated

- `GeometryCollection`s are discouraged in all relevant processes.

### Removed
Expand All @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Clarified disallowed characters in subtype `file-path`.
- Clarified that UDF source code must contain a newline/line-break (affects `run_udf`).
- `aggregate_spatial`, `aggregate_spatial_binary`: Clarified that Features, Geometries and GeometryCollections are a single entity in computations. Only FeatureCollections are multiple entities. [#252](https://github.com/Open-EO/openeo-processes/issues/252)
- `aggregate_spatial`: Clarified that the values have no predefined order and reducers such as `first` and `last` return unpredictable results. [#260](https://github.com/Open-EO/openeo-processes/issues/260)
- `load_collection`, parameter `spatial_extent`: Clarified that all pixels that are inside the bounding box of the given polygons but do not intersect with any polygon have to be set to no-data (`null`). [#256](https://github.com/Open-EO/openeo-processes/issues/256)
- `load_collection`: Clarified that the parameters are recommended to be used in favor of `filter_*` processes.

Expand Down
4 changes: 2 additions & 2 deletions aggregate_spatial.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"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. This process passes a list of values to the reducer.\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 number of total and valid pixels is returned together with the calculated values.",
"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.",
"categories": [
"cubes",
"aggregate & resample"
],
"parameters": [
{
"name": "data",
"description": "A raster data cube. The 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.\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.",
"schema": {
"type": "object",
"subtype": "raster-cube"
Expand Down
4 changes: 2 additions & 2 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 *unary* process to each pixel value in the data cube (i.e. a local operation). A unary process takes a single value and returns a single value, for example ``abs()`` or ``linear_scale_range()``. In contrast, the process ``apply_dimension()`` applies a process to all pixel values along a particular dimension.",
"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.",
"categories": [
"cubes"
],
Expand All @@ -16,7 +16,7 @@
},
{
"name": "process",
"description": "A unary process to be applied on each value, may consist of multiple sub-processes.",
"description": "A process that accepts and returns a single value and is applied on each individual value in the data cube. The process may consist of multiple sub-processes and could, for example, consist of processes such as ``abs()`` or ``linear_scale_range()``.",
"schema": {
"type": "object",
"subtype": "process-graph",
Expand Down
6 changes: 3 additions & 3 deletions array_apply.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_apply",
"summary": "Apply a unary process to each array element",
"description": "Applies a **unary** process which takes a single value such as `abs` or `sqrt` to each value in the array. This is basically what other languages call either a `for each` loop or a `map` function.",
"summary": "Apply a process to each array element",
"description": "Applies a process to each individual value in the array. This is basically what other languages call either a `for each` loop or a `map` function.",
"categories": [
"arrays"
],
Expand All @@ -18,7 +18,7 @@
},
{
"name": "process",
"description": "A process to be applied on each value, may consist of multiple sub-processes. The specified process must be unary meaning that it must work on a single value.",
"description": "A process that accepts and returns a single value and is applied on each individual value in the array. The process may consist of multiple sub-processes and could, for example, consist of processes such as ``abs()`` or ``linear_scale_range()``.",
"schema": {
"type": "object",
"subtype": "process-graph",
Expand Down
79 changes: 79 additions & 0 deletions proposals/reduce_spatial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"id": "reduce_spatial",
"summary": "Reduce spatial dimensions 'x' and 'y'",
"description": "Applies a reducer to a data cube by collapsing all the pixel values along the horizontal spatial dimensions (i.e. axes `x` and `y`) into an output value computed by the reducer. The horizontal spatial dimensions are dropped.\n\nAn aggregation over certain spatial areas can be computed with the process ``aggregate_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": [
"aggregate & resample",
"cubes",
"reducer"
],
"experimental": true,
"parameters": [
{
"name": "data",
"description": "A data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
{
"name": "reducer",
"description": "A reducer to apply on the horizontal spatial dimensions. A reducer is a single process such as ``mean()`` or a set of processes, which computes a single value for a list of values, see the category 'reducer' for such processes.",
"schema": {
"type": "object",
"subtype": "process-graph",
"parameters": [
{
"name": "data",
"description": "An array with elements of any type.",
"schema": {
"type": "array",
"items": {
"description": "Any data type."
}
}
},
{
"name": "context",
"description": "Additional data passed by the user.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "The value to be set in the new data cube.",
"schema": {
"description": "Any data type."
}
}
}
},
{
"name": "context",
"description": "Additional data to be passed to the reducer.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "A data cube with the newly computed values. It is missing the horizontal spatial dimensions, the number of dimensions decreases by two. The dimension properties (name, type, labels, reference system and resolution) for all other dimensions remain unchanged.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
"links": [
{
"href": "https://openeo.org/documentation/1.0/datacubes.html#reduce",
"rel": "about",
"title": "Reducers explained in the openEO documentation"
}
]
}
2 changes: 1 addition & 1 deletion reduce_dimension.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "reduce_dimension",
"summary": "Reduce dimensions",
"description": "Applies a unary reducer to a data cube dimension by collapsing all the pixel values along the specified dimension into an output value computed by the reducer. The dimension is dropped. To avoid this, use ``apply_dimension()`` instead.",
"description": "Applies a reducer to a data cube dimension by collapsing all the pixel values along the specified dimension into an output value computed by the reducer.\n\nThe dimension is dropped. To avoid this, use ``apply_dimension()`` instead.",
"categories": [
"cubes",
"reducer"
Expand Down
3 changes: 1 addition & 2 deletions tests/.words
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ Sentinel-2B
signum
STAC
summand
UDFs
unary
UDFs

0 comments on commit 09167a5

Please sign in to comment.