Skip to content

Commit

Permalink
Added support for labels to processes.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jan 21, 2020
1 parent 8060aac commit b2141a0
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 36 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `all`
- `any`
- `array_apply`
- `array_contains`
- `array_filter`
- `array_find`
- `array_labels`
Expand All @@ -24,7 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `reduce_dimension`
- `reduce_dimension_binary`
- `rename_labels`
- Added further examples
- Support for labeled arrays. [API#245](https://github.com/Open-EO/openeo-api/issues/245)
- Added further examples.

### Changed
- The JSON Schema keyword `format` has been replaced with the custom keyword `subtype`.
Expand All @@ -35,9 +37,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Processes supporting multiple data types in parameters or return values with `anyOf` are now listing the data types directly as array. `anyOf` is discouraged.
- Comparison processes `eq`, `gt`, `gte`, `lt`, `lte`, `neq` and `between` accept all data types as input for the operands.
- `add_dimension`: Parameter `value` renamed to `label`.
- `apply_dimension`: Replaced with a completely new definition. [#73](https://github.com/Open-EO/openeo-processes/issues/73)
- `aggregate_polygon`, `aggregate_polygon`, `apply_dimension`, `array_element` and `resample_cube_temporal`: Support labeled arrays. [API#245](https://github.com/Open-EO/openeo-api/issues/245)
- `aggregate_polygon`: The data cube implicitly gets restricted to the bounds of the polygons as if `filter_polygon` would have been used beforehand. [#101](https://github.com/Open-EO/openeo-processes/issues/101)
- `aggregate_temporal`: Parameter `labels` is optional. [#19](https://github.com/Open-EO/openeo-processes/issues/19)
- `apply_dimension`: Replaced with a completely new definition. [#73](https://github.com/Open-EO/openeo-processes/issues/73)
- `apply_kernel`: Only supported 2D kernels on the horizontal spatial dimensions. [#69](https://github.com/Open-EO/openeo-processes/issues/69)
- `clip`: Works on a single value instead on arrays (replaced parameter `data` with `x`). [#75](https://github.com/Open-EO/openeo-processes/issues/75)
- `count`: Renamed parameter `expression` to `condition`.
Expand Down
3 changes: 2 additions & 1 deletion aggregate_polygon.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
"parameters": [
{
"name": "data",
"description": "An array with elements of any type.",
"description": "A labeled array with values of any type.",
"required": true,
"schema": {
"type": "array",
"subtype": "labeled-array",
"items": {
"description": "Any data type."
}
Expand Down
3 changes: 2 additions & 1 deletion aggregate_temporal.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@
"parameters": [
{
"name": "data",
"description": "An array with elements of any type.",
"description": "A labeled array with elements of any type.",
"required": true,
"schema": {
"type": "array",
"subtype": "labeled-array",
"items": {
"description": "Any data type."
}
Expand Down
3 changes: 2 additions & 1 deletion apply_dimension.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
"parameters": [
{
"name": "data",
"description": "An array with elements of any type.",
"description": "A labeled array with elements of any type.",
"required": true,
"schema": {
"type": "array",
"subtype": "labeled-array",
"items": {
"description": "Any data type."
}
Expand Down
13 changes: 9 additions & 4 deletions array_apply.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@
},
{
"name": "index",
"description": "The zero-based index of the current element being processed.",
"description": "The zero-based index or the label of the current element being processed.",
"required": true,
"schema": {
"type": "integer"
}
"schema": [
{
"type": "number"
},
{
"type": "string"
}
]
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion array_contains.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_contains",
"summary": "Check whether the array contains a given value",
"description": "Checks whether the array specified for `data` contains the value specified in `value`. Returns `true` if there's a match, otherwise `false`.\n\n**Remarks:**\n\n* To get the index of the value found, use ``array_find()``.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. This includes that data types MUST be checked strictly, for example a string with the content *1* is not equal to the number *1*.\n* An integer *1* is equal to a floating point number *1.0* as `integer` is a sub-type of `number`. Still, this process may return unexpectedly `false` when comparing floating point numbers due to floating point inaccuracy in machine-based computation.\n* Temporal strings are treated as normal strings and MUST NOT be interpreted.",
"description": "Checks whether the array specified for `data` contains the value specified in `value`. Returns `true` if there's a match, otherwise `false`.\n\n**Remarks:**\n\n* To get the index or the label of the value found, use ``array_find()``.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. This includes that data types MUST be checked strictly, for example a string with the content *1* is not equal to the number *1*.\n* An integer *1* is equal to a floating point number *1.0* as `integer` is a sub-type of `number`. Still, this process may return unexpectedly `false` when comparing floating point numbers due to floating point inaccuracy in machine-based computation.\n* Temporal strings are treated as normal strings and MUST NOT be interpreted.",
"categories": [
"arrays",
"comparison"
Expand Down
21 changes: 13 additions & 8 deletions array_element.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_element",
"summary": "Get an element from an array",
"description": "Returns the element at the specified zero-based index from the array.",
"description": "Returns the element with the specified index or label from the array.",
"categories": [
"arrays"
],
Expand All @@ -19,15 +19,20 @@
},
{
"name": "index",
"description": "The zero-based index of the element to retrieve.",
"schema": {
"type": "integer"
},
"description": "The zero-based index or the label of the element to retrieve.",
"schema": [
{
"type": "number"
},
{
"type": "string"
}
],
"required": true
},
{
"name": "return_nodata",
"description": "By default this process throws an `IndexOutOfBounds` exception if the index is invalid. If you want to return `null` instead, set this flag to `true`.",
"description": "By default this process throws an `ArrayElementNotAvailable` exception if the index or label is invalid. If you want to return `null` instead, set this flag to `true`.",
"schema": {
"type": "boolean"
},
Expand All @@ -41,8 +46,8 @@
}
},
"exceptions": {
"IndexOutOfBounds": {
"message": "The array has no element with the specified index."
"ArrayElementNotAvailable": {
"message": "The array has no element with the specified index or label."
}
},
"examples": [
Expand Down
13 changes: 9 additions & 4 deletions array_filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@
},
{
"name": "index",
"description": "The zero-based index of the current element being processed.",
"description": "The zero-based index or the label of the current element being processed.",
"required": true,
"schema": {
"type": "integer"
}
"schema": [
{
"type": "number"
},
{
"type": "string"
}
]
}
]
},
Expand Down
31 changes: 19 additions & 12 deletions array_find.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_find",
"summary": "Get the index for a value in an array",
"description": "Checks whether the array specified for `data` contains the value specified in `value` and returns the zero-based index for the first match. If there's no match, `-1` is returned.\n\n**Remarks:**\n\n* To get a boolean value returned use ``array_contains()``.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. This includes that data types MUST be checked strictly, for example a string with the content *1* is not equal to the number *1*.\n* An integer *1* is equal to a floating point number *1.0* as `integer` is a sub-type of `number`. Still, this process may return unexpectedly `false` when comparing floating point numbers due to floating point inaccuracy in machine-based computation.\n* Temporal strings are treated as normal strings and MUST NOT be interpreted.",
"summary": "Get the index/label for a value in an array",
"description": "Checks whether the array specified for `data` contains the value specified in `value` and returns the zero-based index or the label for the first match. If there's no match, `-1` is returned.\n\n**Remarks:**\n\n* To get a boolean value returned use ``array_contains()``.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. This includes that data types MUST be checked strictly, for example a string with the content *1* is not equal to the number *1*.\n* An integer *1* is equal to a floating point number *1.0* as `integer` is a sub-type of `number`. Still, this process may return unexpectedly `false` when comparing floating point numbers due to floating point inaccuracy in machine-based computation.\n* Temporal strings are treated as normal strings and MUST NOT be interpreted.",
"categories": [
"arrays"
],
Expand All @@ -27,11 +27,18 @@
}
],
"returns": {
"description": "Returns the index of the first element with the specified value. If no element was found, `-1` is returned.",
"schema": {
"type": "integer",
"minimum": -1
}
"description": "Returns the index or the label of the first element with the specified value. If no element was found, `null` is returned.",
"schema": [
{
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
]
},
"examples": [
{
Expand All @@ -54,7 +61,7 @@
],
"value": "b"
},
"returns": -1
"returns": null
},
{
"arguments": {
Expand All @@ -65,7 +72,7 @@
],
"value": "2"
},
"returns": -1
"returns": null
},
{
"arguments": {
Expand Down Expand Up @@ -96,7 +103,7 @@
2
]
},
"returns": -1
"returns": null
},
{
"arguments": {
Expand All @@ -112,7 +119,7 @@
],
"value": 2
},
"returns": -1
"returns": null
},
{
"arguments": {
Expand All @@ -128,7 +135,7 @@
"a": "b"
}
},
"returns": -1
"returns": null
}
]
}
3 changes: 2 additions & 1 deletion reduce_dimension.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
"parameters": [
{
"name": "data",
"description": "An array with elements of any type.",
"description": "A labeled array with elements of any type.",
"required": true,
"schema": {
"type": "array",
"subtype": "labeled-array",
"items": {
"description": "Any data type."
}
Expand Down
3 changes: 2 additions & 1 deletion resample_cube_temporal.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
"parameters": [
{
"name": "data",
"description": "An array with elements of any type.",
"description": "A labeled array with elements of any type.",
"required": true,
"schema": {
"type": "array",
"subtype": "labeled-array",
"items": {
"description": "Any data type."
}
Expand Down

0 comments on commit b2141a0

Please sign in to comment.