diff --git a/.editorconfig b/.editorconfig index 1ef045c7..131ae68a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,11 @@ indent_style = spaces indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true + +[*.json5] +charset = utf-8 +end_of_line = crlf +indent_style = spaces +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a301787..a4f88de2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,23 +6,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased / Draft +### Added + +- Unit Tests (see folder `tests`, moved specification tests and CI tools to `dev`) + ### Changed -- `clip`: Throw an exception if min > max [#472](https://github.com/Open-EO/openeo-processes/issues/472) +- Clarified for various mathematical functions the defined input and output ranges. + Mention that `NaN` is returned outside of the defined input range where possible. +- Clarified for several comparison processes how `NaN` values have to be handled. +- Clarified for various processes the handling of no-data values and `null`, see also the [implementation guide](meta/implementation.md#no-data-value). [#480](https://github.com/Open-EO/openeo-processes/issues/480) +- Added a [section about character encodings to the implementation guide](meta/implementation.md#character-encoding). + Removed any character encoding related wording from the process specifications itself. - Added a uniqueness contraint to various array-typed parameters (e.g. lists of dimension names or labels) +- `array_interpolate_linear`: Apply interpolation to NaN and no-data values. +- `clip`: Throw an exception if min > max. [#472](https://github.com/Open-EO/openeo-processes/issues/472) ### Fixed -- Clarified for various mathematical functions the defined input and output ranges. Mention that `NaN` is returned outside of the defined input range where possible. - `aggregate_temporal` and `aggregate_temporal_period`: Clarified that the process throws a `DimensionNotAvailable` exception when no temporal dimension exists. -- `aggregate_temporal_period`: Removed unused exception `DistinctDimensionLabelsRequired` -- `aggregate_temporal_period`: Clarified that the definition of weeks follows ISO 8601 -- `divide`: Clarified behavior for division by 0 +- `aggregate_temporal_period`: Removed unused exception `DistinctDimensionLabelsRequired`. +- `aggregate_temporal_period`: Clarified that the definition of weeks follows ISO 8601. +- `divide`: Clarified behavior for division by 0. - `between`: Clarify that `null` is passed through. - `eq` and `neq`: Explicitly set the minimum value for the `delta` parameter. - `filter_bbox`, `load_collection`, `load_stac`: Clarified that the bounding box is reprojected to the CRS of the spatial data cube dimensions if required. - `filter_spatial`: Clarified that masking is applied using the given geometries. [#469](https://github.com/Open-EO/openeo-processes/issues/469) -- `mod`: Clarified behavior for y = 0 +- `mod`: Clarified behavior for y = 0. - `sqrt`: Clarified that NaN is returned for negative numbers. ## [2.0.0-rc.1] - 2023-05-25 diff --git a/absolute.json b/absolute.json index c6a3713d..ee8d6098 100644 --- a/absolute.json +++ b/absolute.json @@ -1,7 +1,7 @@ { "id": "absolute", "summary": "Absolute value", - "description": "Computes the absolute value of a real number `x`, which is the \"unsigned\" portion of `x` and often denoted as *|x|*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the absolute value of a real number `x`, which is the \"unsigned\" portion of `x` and often denoted as *|x|*.\n\nNo-data values are passed through.", "categories": [ "math" ], @@ -28,12 +28,6 @@ } }, "examples": [ - { - "arguments": { - "x": 0 - }, - "returns": 0 - }, { "arguments": { "x": 3.5 @@ -45,12 +39,6 @@ "x": -0.4 }, "returns": 0.4 - }, - { - "arguments": { - "x": -3.5 - }, - "returns": 3.5 } ], "links": [ diff --git a/add.json b/add.json index ac65541c..434e6ba5 100644 --- a/add.json +++ b/add.json @@ -1,7 +1,7 @@ { "id": "add", "summary": "Addition of two numbers", - "description": "Sums up the two numbers `x` and `y` (*`x + y`*) and returns the computed sum.\n\nNo-data values are taken into account so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", + "description": "Sums up the two numbers `x` and `y` (*`x + y`*) and returns the computed sum.\n\nNo-data values are taken into account so that the no-data value is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", "categories": [ "math" ], @@ -88,4 +88,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/aggregate_temporal.json b/aggregate_temporal.json index 2c66e0f2..5576a7e4 100644 --- a/aggregate_temporal.json +++ b/aggregate_temporal.json @@ -89,7 +89,7 @@ }, { "name": "reducer", - "description": "A reducer to be applied for the values contained in each interval. 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. Intervals may not contain any values, which for most reducers leads to no-data (`null`) values by default.", + "description": "A reducer to be applied for the values contained in each interval. 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. Intervals may not contain any values, which leads to a no-data value for most reducers by default.", "schema": { "type": "object", "subtype": "process-graph", diff --git a/aggregate_temporal_period.json b/aggregate_temporal_period.json index 446afa8d..cc0c4161 100644 --- a/aggregate_temporal_period.json +++ b/aggregate_temporal_period.json @@ -42,7 +42,7 @@ }, { "name": "reducer", - "description": "A reducer to be applied for the values contained in each period. 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. Periods may not contain any values, which for most reducers leads to no-data (`null`) values by default.", + "description": "A reducer to be applied for the values contained in each period. 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. Periods may not contain any values, which leads to a no-data value for most reducers by default.", "schema": { "type": "object", "subtype": "process-graph", diff --git a/all.json b/all.json index b12059de..dbf751a4 100644 --- a/all.json +++ b/all.json @@ -1,7 +1,7 @@ { "id": "all", "summary": "Are all of the values true?", - "description": "Checks if **all** of the values in `data` are true. If no value is given (i.e. the array is empty) the process returns `null`.\n\nBy default all no-data values are ignored so that the process returns `null` if all values are no-data, `true` if all values are true and `false` otherwise. Setting the `ignore_nodata` flag to `false` takes no-data values into account and the array values are reduced pairwise according to the following truth table:\n\n```\n || null | false | true\n----- || ----- | ----- | -----\nnull || null | false | null\nfalse || false | false | false\ntrue || null | false | true\n```\n\n**Remark:** The process evaluates all values from the first to the last element and stops once the outcome is unambiguous. A result is ambiguous unless a value is `false` or all values have been taken into account.", + "description": "Checks if **all** of the values in `data` are true. If no value is given (i.e. the array is empty) the process returns the no-data value (or `null`).\n\nBy default all no-data values are ignored so that the process returns the no-data value (or `null`) if all values are no-data, `true` if all values are true and `false` otherwise. Setting the `ignore_nodata` flag to `false` takes no-data values into account and the array values are reduced pairwise according to the following truth table:\n\n```\n || no-data | false | true\n------- || ------- | ----- | -------\nno-data || no-data | false | no-data\nfalse || false | false | false\ntrue || no-data | false | true\n```\n\n**Remark:** The process evaluates all values from the first to the last element and stops once the outcome is unambiguous. A result is ambiguous unless a value is `false` or all values have been taken into account.", "categories": [ "logic", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not and ignores them by default.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default.", "schema": { "type": "boolean" }, @@ -131,4 +131,4 @@ "returns": null } ] -} \ No newline at end of file +} diff --git a/and.json b/and.json index 3b28c8ef..87c21f01 100644 --- a/and.json +++ b/and.json @@ -1,7 +1,7 @@ { "id": "and", "summary": "Logical AND", - "description": "Checks if **both** values are true.\n\nEvaluates parameter `x` before `y` and stops once the outcome is unambiguous. If any argument is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || null | false | true\n----- || ----- | ----- | -----\nnull || null | false | null\nfalse || false | false | false\ntrue || null | false | true\n```", + "description": "Checks if **both** values are true.\n\nEvaluates parameter `x` before `y` and stops once the outcome is unambiguous. If any argument is a no-data value, the result will be the no-data value whenever the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || no-data | false | true\n------- || ------- | ----- | -------\nno-data || no-data | false | no-data\nfalse || false | false | false\ntrue || no-data | false | true\n```", "categories": [ "logic" ], diff --git a/any.json b/any.json index 545c1669..4cdce32d 100644 --- a/any.json +++ b/any.json @@ -1,7 +1,7 @@ { "id": "any", "summary": "Is at least one value true?", - "description": "Checks if **any** (i.e. at least one) value in `data` is `true`. If no value is given (i.e. the array is empty) the process returns `null`.\n\nBy default all no-data values are ignored so that the process returns `null` if all values are no-data, `true` if at least one value is true and `false` otherwise. Setting the `ignore_nodata` flag to `false` takes no-data values into account and the array values are reduced pairwise according to the following truth table:\n\n```\n || null | false | true\n----- || ---- | ----- | ----\nnull || null | null | true\nfalse || null | false | true\ntrue || true | true | true\n```\n\n**Remark:** The process evaluates all values from the first to the last element and stops once the outcome is unambiguous. A result is ambiguous unless a value is `true`.", + "description": "Checks if **any** (i.e. at least one) value in `data` is `true`. If no value is given (i.e. the array is empty) the process returns the no-data value (or `null`).\n\nBy default all no-data values are ignored so that the process returns the no-data value (or `null`) if all values are no-data, `true` if at least one value is true and `false` otherwise. Setting the `ignore_nodata` flag to `false` takes no-data values into account and the array values are reduced pairwise according to the following truth table:\n\n```\n || no-data | false | true\n------- || ------- | ------- | ----\nno-data || no-data | no-data | true\nfalse || no-data | false | true\ntrue || true | true | true\n```\n\n**Remark:** The process evaluates all values from the first to the last element and stops once the outcome is unambiguous. A result is ambiguous unless a value is `true`.", "categories": [ "logic", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not and ignores them by default.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default.", "schema": { "type": "boolean" }, @@ -131,4 +131,4 @@ "returns": null } ] -} \ No newline at end of file +} diff --git a/apply_kernel.json b/apply_kernel.json index cf16dc78..49fb8f82 100644 --- a/apply_kernel.json +++ b/apply_kernel.json @@ -1,7 +1,7 @@ { "id": "apply_kernel", "summary": "Apply a spatial convolution with a kernel", - "description": "Applies a 2D convolution (i.e. a focal operation with a weighted kernel) on the horizontal spatial dimensions (axes `x` and `y`) of a raster data cube.\n\nEach value in the kernel is multiplied with the corresponding pixel value and all products are summed up afterwards. The sum is then multiplied with the factor.\n\nThe process can't handle non-numerical or infinite numerical values in the data cube. Boolean values are converted to integers (`false` = 0, `true` = 1), but all other non-numerical or infinite values are replaced with zeroes by default (see parameter `replace_invalid`).\n\nFor cases requiring more generic focal operations or non-numerical values, see ``apply_neighborhood()``.", + "description": "Applies a 2D convolution (i.e. a focal operation with a weighted kernel) on the horizontal spatial dimensions (axes `x` and `y`) of a raster data cube.\n\nEach value in the kernel is multiplied with the corresponding pixel value and all products are summed up afterwards. The sum is then multiplied with the factor.\n\nThe process can't handle non-numerical or infinite numerical values in the data cube. Boolean values are converted to integers (`false` = 0, `true` = 1), but all other non-numerical, NaN, no-data, or infinite values are replaced with zeroes by default (see parameter `replace_invalid`).\n\nFor cases requiring more generic focal operations or non-numerical values, see ``apply_neighborhood()``.", "categories": [ "cubes", "math > image filter" @@ -70,7 +70,7 @@ }, { "name": "replace_invalid", - "description": "This parameter specifies the value to replace non-numerical or infinite numerical values with. By default, those values are replaced with zeroes.", + "description": "This parameter specifies the value to replace non-numerical, NaN, no-data, or infinite numerical values with. By default, those values are replaced with zeroes.", "schema": { "type": "number" }, diff --git a/apply_neighborhood.json b/apply_neighborhood.json index 87f2b1dd..dd7a89d9 100644 --- a/apply_neighborhood.json +++ b/apply_neighborhood.json @@ -1,7 +1,7 @@ { "id": "apply_neighborhood", "summary": "Apply a process to pixels in a n-dimensional neighborhood", - "description": "Applies a focal process to a data cube.\n\nA focal process is a process that works on a 'neighborhood' of pixels. The neighborhood can extend into multiple dimensions, this extent is specified by the `size` argument. It is not only (part of) the size of the input window, but also the size of the output for a given position of the sliding window. The sliding window moves with multiples of `size`.\n\nAn overlap can be specified so that neighborhoods can have overlapping boundaries. This allows for continuity of the output. The overlap region must be included in the data cube or array returned by `process`, but any changed values will be ignored. The missing overlap at the borders of the original data cube is made available as no-data (`null`) in the sub-data cubes.\n\nThe neighborhood size should be kept small enough, to avoid running beyond computational resources, but a too-small size will result in a larger number of process invocations, which may slow down processing. Window sizes for spatial dimensions typically range from 64 to 512 pixels, while overlaps of 8 to 32 pixels are common.\n\nFor the special case of 2D convolution, it is recommended to use ``apply_kernel()``.", + "description": "Applies a focal process to a data cube.\n\nA focal process is a process that works on a 'neighborhood' of pixels. The neighborhood can extend into multiple dimensions, this extent is specified by the `size` argument. It is not only (part of) the size of the input window, but also the size of the output for a given position of the sliding window. The sliding window moves with multiples of `size`.\n\nAn overlap can be specified so that neighborhoods can have overlapping boundaries. This allows for continuity of the output. The overlap region must be included in the data cube or array returned by `process`, but any changed values will be ignored. The missing overlap at the borders of the original data cube is made available as no-data values in the sub-data cubes.\n\nThe neighborhood size should be kept small enough, to avoid running beyond computational resources, but a too-small size will result in a larger number of process invocations, which may slow down processing. Window sizes for spatial dimensions typically range from 64 to 512 pixels, while overlaps of 8 to 32 pixels are common.\n\nFor the special case of 2D convolution, it is recommended to use ``apply_kernel()``.", "categories": [ "cubes" ], diff --git a/arccos.json b/arccos.json index 4cd498a7..91e19977 100644 --- a/arccos.json +++ b/arccos.json @@ -1,7 +1,7 @@ { "id": "arccos", "summary": "Inverse cosine", - "description": "Computes the arc cosine of `x`. The arc cosine is the inverse function of the cosine so that *`arccos(cos(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", + "description": "Computes the arc cosine of `x`. The arc cosine is the inverse function of the cosine so that *`arccos(cos(x)) = x`*.\n\nWorks on radians only.\nNo-data values are passed through. `NaN` is returned for values < -1 and > 1.", "categories": [ "math > trigonometric" ], diff --git a/arcosh.json b/arcosh.json index 820b8cd4..9222a122 100644 --- a/arcosh.json +++ b/arcosh.json @@ -1,7 +1,7 @@ { "id": "arcosh", "summary": "Inverse hyperbolic cosine", - "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", + "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nNo-data values are passed through. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > trigonometric" ], diff --git a/arcsin.json b/arcsin.json index 2c772a00..b927813d 100644 --- a/arcsin.json +++ b/arcsin.json @@ -1,7 +1,7 @@ { "id": "arcsin", "summary": "Inverse sine", - "description": "Computes the arc sine of `x`. The arc sine is the inverse function of the sine so that *`arcsin(sin(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values < -1 and > 1.", + "description": "Computes the arc sine of `x`. The arc sine is the inverse function of the sine so that *`arcsin(sin(x)) = x`*.\n\nWorks on radians only.\nNo-data values are passed through. `NaN` is returned for values < -1 and > 1.", "categories": [ "math > trigonometric" ], diff --git a/arctan.json b/arctan.json index 9461eba3..c091218b 100644 --- a/arctan.json +++ b/arctan.json @@ -1,7 +1,7 @@ { "id": "arctan", "summary": "Inverse tangent", - "description": "Computes the arc tangent of `x`. The arc tangent is the inverse function of the tangent so that *`arctan(tan(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the arc tangent of `x`. The arc tangent is the inverse function of the tangent so that *`arctan(tan(x)) = x`*.\n\nWorks on radians only.\nNo-data values are passed through.", "categories": [ "math > trigonometric" ], diff --git a/arctan2.json b/arctan2.json index ca7d507f..17bd38e6 100644 --- a/arctan2.json +++ b/arctan2.json @@ -1,7 +1,7 @@ { "id": "arctan2", "summary": "Inverse tangent of two numbers", - "description": "Computes the arc tangent of two numbers `x` and `y`. It is similar to calculating the arc tangent of *`y / x`*, except that the signs of both arguments are used to determine the quadrant of the result.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`.", + "description": "Computes the arc tangent of two numbers `x` and `y`. It is similar to calculating the arc tangent of *`y / x`*, except that the signs of both arguments are used to determine the quadrant of the result.\n\nWorks on radians only.\nIf any argument is a no-data value, the result will be the no-data value (or `null`).", "categories": [ "math > trigonometric" ], @@ -59,4 +59,4 @@ "title": "Two-argument inverse tangent explained by Wikipedia" } ] -} \ No newline at end of file +} diff --git a/array_contains.json b/array_contains.json index 37ced980..cd1586ac 100644 --- a/array_contains.json +++ b/array_contains.json @@ -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 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. A `null` return value from ``eq()`` is handled exactly as `false` (no match).\n* 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. A no-data return value from ``eq()`` is handled as `false` (no match).\n* 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.\n\nSee the examples to check for no-data values.", "categories": [ "arrays", "comparison", @@ -20,7 +20,7 @@ }, { "name": "value", - "description": "Value to find in `data`. If the value is `null`, this process returns always `false`.", + "description": "Value to find in `data`. If the value is no-data value (or `null`), this process returns always `false`.", "schema": { "type": [ "number", diff --git a/array_element.json b/array_element.json index 8b70a2e5..f0763793 100644 --- a/array_element.json +++ b/array_element.json @@ -41,7 +41,7 @@ }, { "name": "return_nodata", - "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`.", + "description": "By default this process throws an `ArrayElementNotAvailable` exception if the index or label is invalid. If you want to return the no-data value (or `null`) instead, set this flag to `true`.", "schema": { "type": "boolean" }, @@ -103,4 +103,4 @@ "returns": null } ] -} \ No newline at end of file +} diff --git a/array_find.json b/array_find.json index 7b0e6317..58eb5ea7 100644 --- a/array_find.json +++ b/array_find.json @@ -1,7 +1,7 @@ { "id": "array_find", "summary": "Get the index for a value in an array", - "description": "Returns the zero-based index of the first (or last) occurrence of the value specified by `value` in the array specified by `data` or `null` if there is no match. Use the parameter `reverse` to switch from the first to the last match.\n\n**Remarks:**\n\n* Use ``array_contains()`` to check if an array contains a value regardless of the position.\n* Use ``array_find_label()`` to find the index for a label.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. A `null` return value from ``eq()`` is handled exactly as `false` (no match).\n* 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.\n* If the specified value is an array, object or null, the process always returns `null`. See the examples for one to find `null` values.", + "description": "Returns the zero-based index of the first (or last) occurrence of the value specified by `value` in the array specified by `data` or the no-data value (or `null`) if there is no match. Use the parameter `reverse` to switch from the first to the last match.\n\n**Remarks:**\n\n* Use ``array_contains()`` to check if an array contains a value regardless of the position.\n* Use ``array_find_label()`` to find the index for a label.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. A no-data return value from ``eq()`` is handled as `false` (no match).\n* 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.\n* If the specified value is an array, object or null, the process always returns the no-data value (or `null`). See the examples to find no-data values.", "categories": [ "arrays", "reducer" @@ -19,7 +19,7 @@ }, { "name": "value", - "description": "Value to find in `data`. If the value is `null`, this process returns always `null`.", + "description": "Value to find in `data`. If the value is a no-data value (or `null`), this process returns the no-data value (or `null`).", "schema": { "description": "Any data type is allowed." } @@ -35,7 +35,7 @@ } ], "returns": { - "description": "The index of the first element with the specified value. If no element was found, `null` is returned.", + "description": "The index of the first element with the specified value. If no element was found, the no-data value (or `null`) is returned.", "schema": [ { "type": "null" @@ -96,18 +96,6 @@ }, "returns": null }, - { - "arguments": { - "data": [ - 1, - null, - 2, - null - ], - "value": null - }, - "returns": null - }, { "arguments": { "data": [ diff --git a/array_interpolate_linear.json b/array_interpolate_linear.json index 021522b0..57188e8f 100644 --- a/array_interpolate_linear.json +++ b/array_interpolate_linear.json @@ -1,7 +1,7 @@ { "id": "array_interpolate_linear", "summary": "One-dimensional linear interpolation for arrays", - "description": "Performs a linear interpolation for each of the no-data values (`null`) in the array given, except for leading and trailing no-data values.\n\nThe linear interpolants are defined by the array indices or labels (x) and the values in the array (y).", + "description": "Performs a linear interpolation for each of the NaN and no-data values in the array given, except for leading and trailing NaN and no-data values.\n\nThe linear interpolants are defined by the array indices or labels (x axis) and the values in the array (y axis).", "categories": [ "arrays", "math", @@ -10,7 +10,7 @@ "parameters": [ { "name": "data", - "description": "An array of numbers and no-data values.\n\nIf the given array is a labeled array, the labels must have a natural/inherent label order and the process expects the labels to be sorted accordingly. This is the default behavior in openEO for spatial and temporal dimensions.", + "description": "An array of numbers, which may include NaN, ±infinity, and no-data values.\n\nIf the given array is a labeled array, the labels must have a natural/inherent label order and the process expects the labels to be sorted accordingly. This is the default behavior in openEO for spatial and temporal dimensions.", "schema": { "type": "array", "items": { @@ -23,7 +23,7 @@ } ], "returns": { - "description": "An array with no-data values being replaced with interpolated values. If not at least 2 numerical values are available in the array, the array stays the same.", + "description": "An array with NaN and no-data values being replaced with interpolated values. If not at least 2 numerical values are available in the array, the array stays the same.", "schema": { "type": "array", "items": { diff --git a/arsinh.json b/arsinh.json index 2b7942dd..31e6bf56 100644 --- a/arsinh.json +++ b/arsinh.json @@ -1,7 +1,7 @@ { "id": "arsinh", "summary": "Inverse hyperbolic sine", - "description": "Computes the inverse hyperbolic sine of `x`. It is the inverse function of the hyperbolic sine so that *`arsinh(sinh(x)) = x`*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the inverse hyperbolic sine of `x`. It is the inverse function of the hyperbolic sine so that *`arsinh(sinh(x)) = x`*.\n\nNo-data values are passed through.", "categories": [ "math > trigonometric" ], diff --git a/artanh.json b/artanh.json index 6308290d..a61956c1 100644 --- a/artanh.json +++ b/artanh.json @@ -1,7 +1,7 @@ { "id": "artanh", "summary": "Inverse hyperbolic tangent", - "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range. The computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, `x` = 1 results in +infinity and `x` = 0 results in -infinity. Otherwise, an exception is thrown.", + "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nNo-data values are passed through. `NaN` is returned for values outside of the allowed range. The computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, `x` = 1 results in +infinity and `x` = 0 results in -infinity. Otherwise, an exception is thrown.", "categories": [ "math > trigonometric" ], diff --git a/between.json b/between.json index 12e37693..a362776c 100644 --- a/between.json +++ b/between.json @@ -8,7 +8,7 @@ "parameters": [ { "name": "x", - "description": "The value to check.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "The value to check.\n\nNo-data values are passed through.", "schema": { "description": "Any data type is allowed." } @@ -38,7 +38,7 @@ } ], "returns": { - "description": "`true` if `x` is between the specified bounds, `null` if `x` is a no-data value, `false` otherwise.", + "description": "`true` if `x` is between the specified bounds, the no-data value (or `null`) if `x` is a no-data value, `false` otherwise.", "schema": { "type": [ "boolean", diff --git a/ceil.json b/ceil.json index 7c01cf45..f98dccdc 100644 --- a/ceil.json +++ b/ceil.json @@ -1,7 +1,7 @@ { "id": "ceil", "summary": "Round fractions up", - "description": "The least integer greater than or equal to the number `x`.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "The least integer greater than or equal to the number `x`.\n\nNo-data values are passed through.", "categories": [ "math > rounding" ], @@ -59,4 +59,4 @@ "title": "Ceiling explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/clip.json b/clip.json index de2a4d1a..a34a191e 100644 --- a/clip.json +++ b/clip.json @@ -1,7 +1,7 @@ { "id": "clip", "summary": "Clip a value between a minimum and a maximum", - "description": "Clips a number between specified minimum and maximum values. A value larger than the maximum value is set to the maximum value, a value lower than the minimum value is set to the minimum value. If the maximum value is smaller than the minimum number, the process throws a `MinMaxSwapped` exception.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Clips a number between specified minimum and maximum values. A value larger than the maximum value is set to the maximum value, a value lower than the minimum value is set to the minimum value. If the maximum value is smaller than the minimum number, the process throws a `MinMaxSwapped` exception.\n\nNo-data values are passed through.", "categories": [ "math" ], diff --git a/cos.json b/cos.json index 0d6229a8..b1e0b98c 100644 --- a/cos.json +++ b/cos.json @@ -1,7 +1,7 @@ { "id": "cos", "summary": "Cosine", - "description": "Computes the cosine of `x`.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the cosine of `x`.\n\nWorks on radians only.\nNo-data values are passed through.", "categories": [ "math > trigonometric" ], diff --git a/cosh.json b/cosh.json index 8b56a222..64fbd88d 100644 --- a/cosh.json +++ b/cosh.json @@ -1,7 +1,7 @@ { "id": "cosh", "summary": "Hyperbolic cosine", - "description": "Computes the hyperbolic cosine of `x`.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the hyperbolic cosine of `x`.\n\nNo-data values are passed through.", "categories": [ "math > trigonometric" ], diff --git a/divide.json b/divide.json index 0c6c254a..2c41bd3d 100644 --- a/divide.json +++ b/divide.json @@ -1,7 +1,7 @@ { "id": "divide", "summary": "Division of two numbers", - "description": "Divides argument `x` by the argument `y` (*`x / y`*) and returns the computed result.\n\nNo-data values are taken into account so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. A division by zero results in:\n\n- +infinity for `x` > 0,\n- -infinity for `x` < 0,\n- `NaN` for `x` = 0,\n- or otherwise, throws a `DivisionByZero` exception if the other options are not supported by the processing environment.", + "description": "Divides argument `x` by the argument `y` (*`x / y`*) and returns the computed result.\n\nNo-data values are taken into account so that the no-data value is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. A division by zero results in:\n\n- +infinity for `x` > 0,\n- -infinity for `x` < 0,\n- `NaN` for `x` = 0,\n- or otherwise, throws a `DivisionByZero` exception if the other options are not supported by the processing environment.", "categories": [ "math" ], diff --git a/eq.json b/eq.json index 0c62b42c..73ffaaa4 100644 --- a/eq.json +++ b/eq.json @@ -1,7 +1,7 @@ { "id": "eq", "summary": "Equal to comparison", - "description": "Compares whether `x` is strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is `null`, the return value is `null`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", + "description": "Compares whether `x` is strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is a no-data value, the result will be the no-data value (or `null`).\n* The comparison of `NaN` (not a number) follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229).\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", "categories": [ "texts", "comparison" @@ -55,7 +55,7 @@ } ], "returns": { - "description": "`true` if `x` is equal to `y`, `null` if any operand is `null`, otherwise `false`.", + "description": "`true` if `x` is equal to `y`, the no-data value (or `null`) if any operand is a no-data value, otherwise `false`.", "schema": { "type": [ "boolean", @@ -71,13 +71,6 @@ }, "returns": null }, - { - "arguments": { - "x": null, - "y": null - }, - "returns": null - }, { "arguments": { "x": 1, @@ -152,13 +145,13 @@ "y": "2018-01-01T00:00:00+00:00" }, "returns": false - }, + } + ], + "links": [ { - "arguments": { - "x": null, - "y": null - }, - "returns": null + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ] } diff --git a/exp.json b/exp.json index 2d551390..a7bb1746 100644 --- a/exp.json +++ b/exp.json @@ -1,7 +1,7 @@ { "id": "exp", "summary": "Exponentiation to the base e", - "description": "Exponential function to the base *e* raised to the power of `p`.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Exponential function to the base *e* raised to the power of `p`.\n\nNo-data values are passed through.", "categories": [ "math > exponential & logarithmic" ], diff --git a/extrema.json b/extrema.json index 6f6075de..7028a420 100644 --- a/extrema.json +++ b/extrema.json @@ -21,7 +21,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that an array with two `null` values is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in an array with two no-data (or `null`) values.", "schema": { "type": "boolean" }, @@ -30,7 +30,7 @@ } ], "returns": { - "description": "An array containing the minimum and maximum values for the specified numbers. The first element is the minimum, the second element is the maximum. If the input array is empty both elements are set to `null`.", + "description": "An array containing the minimum and maximum values for the specified numbers. The first element is the minimum, the second element is the maximum. If the input array is empty both elements are set to the no-data value (or `null`).", "schema": [ { "type": "array", @@ -94,16 +94,6 @@ null, null ] - }, - { - "description": "The input array is empty: return two `null` values.", - "arguments": { - "data": [] - }, - "returns": [ - null, - null - ] } ] -} \ No newline at end of file +} diff --git a/filter_spatial.json b/filter_spatial.json index ed4f7c3f..f1b5f8b8 100644 --- a/filter_spatial.json +++ b/filter_spatial.json @@ -1,7 +1,7 @@ { "id": "filter_spatial", "summary": "Spatial filter raster data cubes using geometries", - "description": "Limits the raster data cube over the spatial dimensions to the specified geometries.\n\n- For **polygons**, the filter retains a pixel in the data cube if the point at the pixel center intersects with at least one of the polygons (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\nMore specifically, pixels outside of the bounding box of the given geometries will not be available after filtering. All pixels inside the bounding box that are not retained will be set to `null` (no data).\n\n Alternatively, use ``filter_bbox()`` to filter with a bounding box or ``filter_vector()`` to filter a vector data cube based on geometries. Use ``mask_polygon()`` to mask without changing the spatial extent of your data cube.", + "description": "Limits the raster data cube over the spatial dimensions to the specified geometries.\n\n- For **polygons**, the filter retains a pixel in the data cube if the point at the pixel center intersects with at least one of the polygons (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\nMore specifically, pixels outside of the bounding box of the given geometries will not be available after filtering. All pixels inside the bounding box that are not retained will be set to no-data values.\n\n Alternatively, use ``filter_bbox()`` to filter with a bounding box or ``filter_vector()`` to filter a vector data cube based on geometries. Use ``mask_polygon()`` to mask without changing the spatial extent of your data cube.", "categories": [ "cubes", "filter" diff --git a/first.json b/first.json index 1afa9624..59fe4f77 100644 --- a/first.json +++ b/first.json @@ -1,7 +1,7 @@ { "id": "first", "summary": "First element", - "description": "Gives the first element of an array.\n\nAn array without non-`null` elements resolves always with `null`.", + "description": "Gives the first element of an array.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "arrays", "reducer" @@ -19,7 +19,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if the first value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, the first value of the array is returned regardless of whether it is a no-data value or not. For the default value `true`, the first non-no-data value is returned.", "schema": { "type": "boolean" }, @@ -65,13 +65,6 @@ "ignore_nodata": false }, "returns": null - }, - { - "description": "The input array is empty: return `null`.", - "arguments": { - "data": [] - }, - "returns": null } ] -} \ No newline at end of file +} diff --git a/floor.json b/floor.json index d0eb5a94..621513af 100644 --- a/floor.json +++ b/floor.json @@ -1,7 +1,7 @@ { "id": "floor", "summary": "Round fractions down", - "description": "The greatest integer less than or equal to the number `x`.\n\nThis process is *not* an alias for the ``int()`` process as defined by some mathematicians, see the examples for negative numbers in both processes for differences.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "The greatest integer less than or equal to the number `x`.\n\nThis process is *not* an alias for the ``int()`` process as defined by some mathematicians, see the examples for negative numbers in both processes for differences.\n\nNo-data values are passed through.", "categories": [ "math > rounding" ], @@ -59,4 +59,4 @@ "title": "Floor explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/gt.json b/gt.json index ae2cf151..dbb33296 100644 --- a/gt.json +++ b/gt.json @@ -1,7 +1,7 @@ { "id": "gt", "summary": "Greater than comparison", - "description": "Compares whether `x` is strictly greater than `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If any operand is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", + "description": "Compares whether `x` is strictly greater than `y`.\n\n**Remarks:**\n\n* If any operand is a no-data value, the result will be the no-data value (or `null`).\n* The comparison of `NaN` (not a number) follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229).\n* If any operand is not the data type `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", "categories": [ "comparison" ], @@ -32,7 +32,7 @@ } ], "returns": { - "description": "`true` if `x` is strictly greater than `y` or `null` if any operand is `null`, otherwise `false`.", + "description": "`true` if `x` is strictly greater than `y`, the no-data value (or `null`) if any operand is a no-data value, otherwise `false`.", "schema": { "type": [ "boolean", @@ -89,13 +89,13 @@ "y": false }, "returns": false - }, + } + ], + "links": [ { - "arguments": { - "x": null, - "y": null - }, - "returns": null + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ] } diff --git a/gte.json b/gte.json index a32816c4..3c054ba8 100644 --- a/gte.json +++ b/gte.json @@ -1,7 +1,7 @@ { "id": "gte", "summary": "Greater than or equal to comparison", - "description": "Compares whether `x` is greater than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If the operands are not equal (see process ``eq()``) and any of them is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", + "description": "Compares whether `x` is greater than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is a no-data value, the result will be the no-data value (or `null`).\n* The comparison of `NaN` (not a number) follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229).\n* If the operands are not equal (see process ``eq()``) and any of them is not the data type `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", "categories": [ "comparison" ], @@ -32,7 +32,7 @@ } ], "returns": { - "description": "`true` if `x` is greater than or equal to `y`, `null` if any operand is `null`, otherwise `false`.", + "description": "`true` if `x` is greater than or equal to `y`, the no-data value (or `null`) if any operand is a no-data value, otherwise `false`.", "schema": { "type": [ "boolean", @@ -82,13 +82,13 @@ "y": false }, "returns": false - }, + } + ], + "links": [ { - "arguments": { - "x": null, - "y": null - }, - "returns": null + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ], "process_graph": { diff --git a/if.json b/if.json index 43e6fcdc..aae6db8e 100644 --- a/if.json +++ b/if.json @@ -27,7 +27,7 @@ }, { "name": "reject", - "description": "A value that is returned if the boolean value is **not** `true`. Defaults to `null`.", + "description": "A value that is returned if the boolean value is **not** `true`. Defaults to the no-data value (or `null`).", "schema": { "description": "Any data type is allowed." }, @@ -93,4 +93,4 @@ "returns": null } ] -} \ No newline at end of file +} diff --git a/int.json b/int.json index 8fca1655..20ede2df 100644 --- a/int.json +++ b/int.json @@ -1,7 +1,7 @@ { "id": "int", "summary": "Integer part of a number", - "description": "The integer part of the real number `x`.\n\nThis process is *not* an alias for the ``floor()`` process as defined by some mathematicians, see the examples for negative numbers in both processes for differences.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "The integer part of the real number `x`.\n\nThis process is *not* an alias for the ``floor()`` process as defined by some mathematicians, see the examples for negative numbers in both processes for differences.\n\nNo-data values are passed through.", "categories": [ "math", "math > rounding" @@ -60,4 +60,4 @@ "title": "Integer Part explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/is_nodata.json b/is_nodata.json index a1b7c08b..f7d696b9 100644 --- a/is_nodata.json +++ b/is_nodata.json @@ -1,7 +1,7 @@ { "id": "is_nodata", "summary": "Value is a no-data value", - "description": "Checks whether the specified data is missing data, i.e. equals to `null` or any of the no-data values specified in the metadata.\n\nThe special numerical value `NaN` (not a number) as defined by the [IEEE Standard 754](https://ieeexplore.ieee.org/document/4610935) is only considered as no-data value if specified as no-data value in the metadata.", + "description": "Checks whether the specified data is no-data value, i.e. equals to any of the no-data values of the data cube (or `null`). The specific no-data values are usually provided through the collection or STAC metadata.\n\nThe special numerical value `NaN` (not a number) as defined by the [IEEE Standard 754](https://ieeexplore.ieee.org/document/4610935) is only considered as no-data value if explicitly specified as no-data value for the data cube.", "categories": [ "comparison" ], diff --git a/last.json b/last.json index 1a35e6ac..f523c488 100644 --- a/last.json +++ b/last.json @@ -1,7 +1,7 @@ { "id": "last", "summary": "Last element", - "description": "Gives the last element of an array.\n\nAn array without non-`null` elements resolves always with `null`.", + "description": "Gives the last element of an array.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "arrays", "reducer" @@ -19,7 +19,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if the last value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, the last value of the array is returned regardless of whether it is a no-data value or not. For the default value `true`, the last non-no-data value is returned.", "schema": { "type": "boolean" }, @@ -65,13 +65,6 @@ "ignore_nodata": false }, "returns": null - }, - { - "description": "The input array is empty: return `null`.", - "arguments": { - "data": [] - }, - "returns": null } ] -} \ No newline at end of file +} diff --git a/linear_scale_range.json b/linear_scale_range.json index 01f09857..9346d8ba 100644 --- a/linear_scale_range.json +++ b/linear_scale_range.json @@ -1,7 +1,7 @@ { "id": "linear_scale_range", "summary": "Linear transformation between two ranges", - "description": "Performs a linear transformation between the input and output range.\n\nThe given number in `x` is clipped to the bounds specified in `inputMin` and `inputMax` so that the underlying formula *`((x - inputMin) / (inputMax - inputMin)) * (outputMax - outputMin) + outputMin`* never returns a value outside of the range defined by `outputMin` and `outputMax`.\n\nPotential use case include\n\n* scaling values to the 8-bit range (0 - 255) often used for numeric representation of values in one of the channels of the [RGB colour model](https://en.wikipedia.org/wiki/RGB_color_model#Numeric_representations) or\n* calculating percentages (0 - 100).\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Performs a linear transformation between the input and output range.\n\nThe given number in `x` is clipped to the bounds specified in `inputMin` and `inputMax` so that the underlying formula *`((x - inputMin) / (inputMax - inputMin)) * (outputMax - outputMin) + outputMin`* never returns a value outside of the range defined by `outputMin` and `outputMax`.\n\nPotential use case include\n\n* scaling values to the 8-bit range (0 - 255) often used for numeric representation of values in one of the channels of the [RGB colour model](https://en.wikipedia.org/wiki/RGB_color_model#Numeric_representations) or\n* calculating percentages (0 - 100).\n\nNo-data values are passed through.", "categories": [ "math" ], diff --git a/ln.json b/ln.json index 1663771b..54729115 100644 --- a/ln.json +++ b/ln.json @@ -1,7 +1,7 @@ { "id": "ln", "summary": "Natural logarithm", - "description": "The natural logarithm is the logarithm to the base *e* of the number `x`, which equals to using the *log* process with the base set to *e*. The natural logarithm is the inverse function of taking *e* to the power x.\n\nThe no-data value `null` is passed through.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`ln(0)`* results in -infinity if the processing environment supports it or otherwise an exception is thrown. `NaN` is returned for values outside of the allowed range.", + "description": "The natural logarithm is the logarithm to the base *e* of the number `x`, which equals to using the *log* process with the base set to *e*. The natural logarithm is the inverse function of taking *e* to the power x.\n\nNo-data values are passed through.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`ln(0)`* results in -infinity if the processing environment supports it or otherwise an exception is thrown. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > exponential & logarithmic" ], diff --git a/load_collection.json b/load_collection.json index a6701cc3..aeb9269e 100644 --- a/load_collection.json +++ b/load_collection.json @@ -87,14 +87,14 @@ }, { "title": "GeoJSON", - "description": "Deprecated in favor of ``load_geojson()``. Limits the data cube to the bounding box of the given geometries. For raster data, all pixels inside the bounding box that do not intersect with any of the polygons will be set to no data (`null`).\n\nThe GeoJSON type `GeometryCollection` is not supported. Empty geometries are ignored.", + "description": "Deprecated in favor of ``load_geojson()``. Limits the data cube to the bounding box of the given geometries. For raster data, all pixels inside the bounding box that do not intersect with any of the polygons will be set to the no-data value of the data cube.\n\nThe GeoJSON type `GeometryCollection` is not supported. Empty geometries are ignored.", "type": "object", "subtype": "geojson", "deprecated": true }, { "title": "Vector data cube", - "description": "Limits the data cube to the bounding box of the given geometries in the vector data cube. For raster data, all pixels inside the bounding box that do not intersect with any of the polygons will be set to no data (`null`). Empty geometries are ignored.", + "description": "Limits the data cube to the bounding box of the given geometries in the vector data cube. For raster data, all pixels inside the bounding box that do not intersect with any of the polygons will be set to the no-data value of the data cube. Empty geometries are ignored.", "type": "object", "subtype": "datacube", "dimensions": [ diff --git a/log.json b/log.json index 67a19ba2..9b8866ca 100644 --- a/log.json +++ b/log.json @@ -1,7 +1,7 @@ { "id": "log", "summary": "Logarithm to a base", - "description": "Logarithm to the base `base` of the number `x` is defined to be the inverse function of taking b to the power of x.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, having `x` set to `0` with any base results in -infinity if the processing environment supports it or otherwise an exception is thrown. `NaN` is returned for values outside of the allowed range.", + "description": "Logarithm to the base `base` of the number `x` is defined to be the inverse function of taking b to the power of x.\n\nIf any argument is a no-data value, the result will be the no-data value (or `null`).\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, having `x` set to `0` with any base results in -infinity if the processing environment supports it or otherwise an exception is thrown. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > exponential & logarithmic" ], diff --git a/lt.json b/lt.json index 0cc45f87..bcb167b1 100644 --- a/lt.json +++ b/lt.json @@ -1,7 +1,7 @@ { "id": "lt", "summary": "Less than comparison", - "description": "Compares whether `x` is strictly less than `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If any operand is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", + "description": "Compares whether `x` is strictly less than `y`.\n\n**Remarks:**\n\n* If any operand is a no-data value, the result will be the no-data value (or `null`).\n* The comparison of `NaN` (not a number) follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229).\n* If any operand is not the data type `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", "categories": [ "comparison" ], @@ -32,7 +32,7 @@ } ], "returns": { - "description": "`true` if `x` is strictly less than `y`, `null` if any operand is `null`, otherwise `false`.", + "description": "`true` if `x` is strictly less than `y`, the no-data value (or `null`) if any operand is a no-data value, otherwise `false`.", "schema": { "type": [ "boolean", @@ -89,13 +89,13 @@ "y": true }, "returns": false - }, + } + ], + "links": [ { - "arguments": { - "x": null, - "y": null - }, - "returns": null + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ] } diff --git a/lte.json b/lte.json index 9f936915..0968dfa1 100644 --- a/lte.json +++ b/lte.json @@ -1,7 +1,7 @@ { "id": "lte", "summary": "Less than or equal to comparison", - "description": "Compares whether `x` is less than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If the operands are not equal (see process ``eq()``) and any of them is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", + "description": "Compares whether `x` is less than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is a no-data value, the result will be the no-data value (or `null`).\n* The comparison of `NaN` (not a number) follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229).\n* If the operands are not equal (see process ``eq()``) and any of them is not the data type `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", "categories": [ "comparison" ], @@ -32,7 +32,7 @@ } ], "returns": { - "description": "`true` if `x` is less than or equal to `y`, `null` if any operand is `null`, otherwise `false`.", + "description": "`true` if `x` is less than or equal to `y`, the no-data value (or `null`) if any operand is a no-data value, otherwise `false`.", "schema": { "type": [ "boolean", @@ -82,13 +82,13 @@ "y": true }, "returns": false - }, + } + ], + "links": [ { - "arguments": { - "x": null, - "y": null - }, - "returns": null + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ], "process_graph": { diff --git a/mask.json b/mask.json index 0381d220..02b394bc 100644 --- a/mask.json +++ b/mask.json @@ -1,7 +1,7 @@ { "id": "mask", "summary": "Apply a raster mask", - "description": "Applies a mask to a raster data cube. To apply a polygon as a mask, use ``mask_polygon()``.\n\nA mask is a raster data cube for which corresponding pixels among `data` and `mask` are compared and those pixels in `data` are replaced whose pixels in `mask` are non-zero (for numbers) or `true` (for boolean values). The pixel values are replaced with the value specified for `replacement`, which defaults to `null` (no data).\n\nThe data cubes have to be compatible except that the horizontal spatial dimensions (axes `x` and `y`) will be aligned implicitly by ``resample_cube_spatial()``. `data` is the target data cube for resampling and the default parameters of ``resample_cube_spatial()`` apply. All other dimensions in the mask must also be available in the raster data cube with the same name, type, reference system, resolution and labels. Dimensions can be missing in the mask with the result that the mask is applied to each label of the dimension in `data` that is missing in the data cube of the mask. The process fails if there's an incompatibility found between the raster data cube and the mask.", + "description": "Applies a mask to a raster data cube. To apply a polygon as a mask, use ``mask_polygon()``.\n\nA mask is a raster data cube for which corresponding pixels among `data` and `mask` are compared and those pixels in `data` are replaced whose pixels in `mask` are non-zero (for numbers) or `true` (for boolean values). The pixel values are replaced with the value specified for `replacement`, which defaults to the no-data value of the raster data cube.\n\nThe data cubes have to be compatible except that the horizontal spatial dimensions (axes `x` and `y`) will be aligned implicitly by ``resample_cube_spatial()``. `data` is the target data cube for resampling and the default parameters of ``resample_cube_spatial()`` apply. All other dimensions in the mask must also be available in the raster data cube with the same name, type, reference system, resolution and labels. Dimensions can be missing in the mask with the result that the mask is applied to each label of the dimension in `data` that is missing in the data cube of the mask. The process fails if there's an incompatibility found between the raster data cube and the mask.", "categories": [ "cubes", "masks" @@ -43,7 +43,7 @@ }, { "name": "replacement", - "description": "The value used to replace masked values with.", + "description": "The value used to replace masked values with. `null` refers to the no-data value of the data cube provided for `data`.", "schema": { "type": [ "number", diff --git a/mask_polygon.json b/mask_polygon.json index f04d3750..acf2ee6a 100644 --- a/mask_polygon.json +++ b/mask_polygon.json @@ -1,7 +1,7 @@ { "id": "mask_polygon", "summary": "Apply a polygon mask", - "description": "Applies a (multi) polygon mask to a raster data cube. To apply a raster mask use ``mask()``.\n\nAll pixels for which the point at the pixel center **does not** intersect with any polygon (as defined in the Simple Features standard by the OGC) are replaced. This behavior can be inverted by setting the parameter `inside` to `true`. The pixel values are replaced with the value specified for `replacement`, which defaults to `null` (no data). No data values in `data` will be left untouched by the masking operation.", + "description": "Applies a (multi) polygon mask to a raster data cube. To apply a raster mask use ``mask()``.\n\nAll pixels for which the point at the pixel center **does not** intersect with any polygon (as defined in the Simple Features standard by the OGC) are replaced. This behavior can be inverted by setting the parameter `inside` to `true`. The pixel values are replaced with the value specified for `replacement`, which defaults to the no-data value of the raster data cube. No data values in `data` will be left untouched by the masking operation.", "categories": [ "cubes", "masks" @@ -53,7 +53,7 @@ }, { "name": "replacement", - "description": "The value used to replace masked values with.", + "description": "The value used to replace masked values with. `null` refers to the no-data value of the data cube provided for `data`.", "schema": [ { "type": "number" diff --git a/max.json b/max.json index d8903df0..6a931780 100644 --- a/max.json +++ b/max.json @@ -1,7 +1,7 @@ { "id": "max", "summary": "Maximum value", - "description": "Computes the largest value of an array of numbers, which is equal to the first element of a sorted (i.e., ordered) version of the array.\n\nAn array without non-`null` elements resolves always with `null`.", + "description": "Computes the largest value of an array of numbers, which is equal to the first element of a sorted (i.e., ordered) version of the array.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "math", "math > statistics", @@ -23,7 +23,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -75,13 +75,6 @@ "ignore_nodata": false }, "returns": null - }, - { - "description": "The input array is empty: return `null`.", - "arguments": { - "data": [] - }, - "returns": null } ], "links": [ @@ -91,4 +84,4 @@ "title": "Maximum explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/mean.json b/mean.json index cb45faa4..31f1c9ec 100644 --- a/mean.json +++ b/mean.json @@ -1,7 +1,7 @@ { "id": "mean", "summary": "Arithmetic mean (average)", - "description": "The arithmetic mean of an array of numbers is the quantity commonly called the average. It is defined as the sum of all elements divided by the number of elements.\n\nAn array without non-`null` elements resolves always with `null`.", + "description": "The arithmetic mean of an array of numbers is the quantity commonly called the average. It is defined as the sum of all elements divided by the number of elements.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "math > statistics", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -71,23 +71,6 @@ "ignore_nodata": false }, "returns": null - }, - { - "description": "The input array is empty: return `null`.", - "arguments": { - "data": [] - }, - "returns": null - }, - { - "description": "The input array has only `null` elements: return `null`.", - "arguments": { - "data": [ - null, - null - ] - }, - "returns": null } ], "links": [ @@ -163,4 +146,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/median.json b/median.json index e54deb84..fb1f31c1 100644 --- a/median.json +++ b/median.json @@ -1,7 +1,7 @@ { "id": "median", "summary": "Statistical median", - "description": "The statistical median of an array of numbers is the value separating the higher half from the lower half of the data.\n\nAn array without non-`null` elements resolves always with `null`.\n\n**Remarks:**\n\n* For symmetric arrays, the result is equal to the ``mean()``.\n* The median can also be calculated by computing the ``quantiles()`` with a probability of *0.5*.", + "description": "The statistical median of an array of numbers is the value separating the higher half from the lower half of the data.\n\nAn array with solely no-data values returns the no-data value (or `null`).\n\n**Remarks:**\n\n* For symmetric arrays, the result is equal to the ``mean()``.\n* The median can also be calculated by computing the ``quantiles()`` with a probability of *0.5*.", "categories": [ "math > statistics", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -91,23 +91,6 @@ "ignore_nodata": false }, "returns": null - }, - { - "description": "The input array is empty: return `null`.", - "arguments": { - "data": [] - }, - "returns": null - }, - { - "description": "The input array has only `null` elements: return `null`.", - "arguments": { - "data": [ - null, - null - ] - }, - "returns": null } ], "links": [ @@ -144,4 +127,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/merge_cubes.json b/merge_cubes.json index c22421c2..8b3595b7 100644 --- a/merge_cubes.json +++ b/merge_cubes.json @@ -24,7 +24,7 @@ }, { "name": "overlap_resolver", - "description": "A reduction operator that resolves the conflict if the data overlaps. The reducer must return a value of the same data type as the input values are. The reduction operator may be a single process such as ``multiply()`` or consist of multiple sub-processes. `null` (the default) can be specified if no overlap resolver is required.", + "description": "A reduction operator that resolves the conflict if the data overlaps. The reducer must return a value of the same data type as the input values are. The reduction operator may be a single process such as ``multiply()`` or consist of multiple sub-processes. The default value `null` can be specified if no overlap resolver is required.", "schema": { "type": "object", "subtype": "process-graph", diff --git a/meta/implementation.md b/meta/implementation.md index 65a24430..10137a06 100644 --- a/meta/implementation.md +++ b/meta/implementation.md @@ -2,11 +2,48 @@ This file is meant to provide some additional implementation details for back-ends. +## No-data value + +A data cube shall always keep reference of the applicable no-data value(s). +The no-data values can be chosen by the back-end implementation, e.g. depending on the data type of the data. +No-data values should be exposed for each pre-defined Collection in its metadata. +For all data generated through openEO (e.g. through synchronous or batch jobs), the metadata and/or data +shall expose the no-data values. + +The openEO process specifications generally uses `null` as a generic value to express no-data values. +This is primarily meant for the JSON encoding, this means: +1. in the process specification (data type `null` in the schema), and +2. in the process graph (if the no-data value exposed through the metadata can't be used in JSON, e.g. `NaN`). + +Back-ends may or may not use `null` as a no-data value internally. + +**NaN**: If `NaN` is the no-data value for floating-point numbers, be aware that the behavior of +no-data values in openEO and `NaN` (IEEE 754) sometimes differs. + +**Array processes:** Some array processes (e.g. `array_find` or `any`) use `null` as a return value. +In the context of data cube operations (e.g. in `reduce_dimension`), `null` values returned +by the array processes shall be replaced with the no-data value of the data cube. +As the processes may be used outside of data cubes where the no-data values are undefined, +most processes fall back to `null` in this case (reflected through the mention of "(or `null`)" in the process description). +This effectively means that `null` is the default value for an undefined no-data value in openEO. + ## Optimizations for conditions (e.g. `if`) None of the openEO processes per se is "special" and thus all are treated the same way by default. Nevertheless, there are some cases where a special treatment can make a huge difference. +## Character encoding + +String-related processes previously mentioned that strings have to be "encoded in UTF-8 by default". +This was removed and we clarify the behavior here: + +For data transfer through the API, the character encoding of strings is specified using HTTP headers. +This means all strings provided in the process graph have the same encoding as specified in the HTTP headers. +Back-ends can internally use any character encoding and as such may need to convert the character encoding +upon receipt of the process graph. +It is recommended to use a [Unicode](https://en.wikipedia.org/wiki/Unicode) character encoding such as UTF-8. +In case of doubt, clients and server should assume UTF-8 as character encoding. + ### Branching behavior The `if` process (and any process that is working on some kind of condition) are usually diff --git a/min.json b/min.json index 26c60882..b59336ba 100644 --- a/min.json +++ b/min.json @@ -1,7 +1,7 @@ { "id": "min", "summary": "Minimum value", - "description": "Computes the smallest value of an array of numbers, which is equal to the last element of a sorted (i.e., ordered) version of the array.\n\nAn array without non-`null` elements resolves always with `null`.", + "description": "Computes the smallest value of an array of numbers, which is equal to the last element of a sorted (i.e., ordered) version of the array.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "math", "math > statistics", @@ -23,7 +23,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -90,4 +90,4 @@ "title": "Minimum explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/mod.json b/mod.json index 0c8a6ea9..9a2a648c 100644 --- a/mod.json +++ b/mod.json @@ -1,7 +1,7 @@ { "id": "mod", "summary": "Modulo", - "description": "Remainder after a division of `x` by `y` for both integers and floating-point numbers.\n\nThe result of a modulo operation has the sign of the divisor. The handling regarding the sign of the result [differs between programming languages](https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages) and needs careful consideration to avoid unexpected results.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`. If `y` is set to 0 this results in:\n\n- +infinity for `x` > 0,\n- -infinity for `x` < 0,\n- `NaN` for `x` = 0,\n- or otherwise, throws a `DivisionByZero` exception if the other options are not supported by the processing environment.", + "description": "Remainder after a division of `x` by `y` for both integers and floating-point numbers.\n\nThe result of a modulo operation has the sign of the divisor. The handling regarding the sign of the result [differs between programming languages](https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages) and needs careful consideration to avoid unexpected results.\n\nIf any argument is a no-data value, the result will be the no-data value (or `null`). If `y` is set to 0 this results in:\n\n- +infinity for `x` > 0,\n- -infinity for `x` < 0,\n- `NaN` for `x` = 0,\n- or otherwise, throws a `DivisionByZero` exception if the other options are not supported by the processing environment.", "categories": [ "math" ], diff --git a/multiply.json b/multiply.json index afa88daa..5ad94da3 100644 --- a/multiply.json +++ b/multiply.json @@ -1,7 +1,7 @@ { "id": "multiply", "summary": "Multiplication of two numbers", - "description": "Multiplies the two numbers `x` and `y` (*`x * y`*) and returns the computed product.\n\nNo-data values are taken into account so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", + "description": "Multiplies the two numbers `x` and `y` (*`x * y`*) and returns the computed product.\n\nNo-data values are taken into account so that the no-data value is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", "categories": [ "math" ], @@ -93,4 +93,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/neq.json b/neq.json index 0e22b347..383d6b8b 100644 --- a/neq.json +++ b/neq.json @@ -1,7 +1,7 @@ { "id": "neq", "summary": "Not equal to comparison", - "description": "Compares whether `x` is **not** strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is `null`, the return value is `null`.\n* Strings are expected to be encoded in UTF-8 by default.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", + "description": "Compares whether `x` is **not** strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is a no-data value, the result will be the no-data value (or `null`).\n* The comparison of `NaN` (not a number) follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229).\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.", "categories": [ "texts", "comparison" @@ -55,7 +55,7 @@ } ], "returns": { - "description": "`true` if `x` is *not* equal to `y`, `null` if any operand is `null`, otherwise `false`.", + "description": "`true` if `x` is *not* equal to `y`, the no-data value (or `null`) if any operand is a no-data value, otherwise `false`.", "schema": { "type": [ "boolean", @@ -145,13 +145,13 @@ "y": "2018-01-01T00:00:00+00:00" }, "returns": true - }, + } + ], + "links": [ { - "arguments": { - "x": null, - "y": null - }, - "returns": null + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ], "process_graph": { diff --git a/not.json b/not.json index 523cb4a0..8701a4e3 100644 --- a/not.json +++ b/not.json @@ -1,7 +1,7 @@ { "id": "not", "summary": "Inverting a boolean", - "description": "Inverts a single boolean so that `true` gets `false` and `false` gets `true`.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Inverts a single boolean so that `true` gets `false` and `false` gets `true`.\n\nNo-data values are passed through.", "categories": [ "logic" ], @@ -46,4 +46,4 @@ "returns": false } ] -} \ No newline at end of file +} diff --git a/or.json b/or.json index 4a83a63e..c2ce931a 100644 --- a/or.json +++ b/or.json @@ -1,7 +1,7 @@ { "id": "or", "summary": "Logical OR", - "description": "Checks if **at least one** of the values is true. Evaluates parameter `x` before `y` and stops once the outcome is unambiguous. If a component is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || null | false | true\n----- || ---- | ----- | ----\nnull || null | null | true\nfalse || null | false | true\ntrue || true | true | true\n```", + "description": "Checks if **at least one** of the values is true. Evaluates parameter `x` before `y` and stops once the outcome is unambiguous. If any argument is a no-data value, the result will be the no-data value whenever the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || no-data | false | true\n------- || ------- | ------- | ----\nno-data || no-data | no-data | true\nfalse || no-data | false | true\ntrue || true | true | true\n```", "categories": [ "logic" ], diff --git a/order.json b/order.json index 9b67f52d..6480fc44 100644 --- a/order.json +++ b/order.json @@ -45,7 +45,7 @@ }, { "name": "nodata", - "description": "Controls the handling of no-data values (`null`). By default, they are removed. If set to `true`, missing values in the data are put last; if set to `false`, they are put first.", + "description": "Controls the handling of no-data values. For the default value `null`, all no-data values get removed. If set to `true`, no-data values in the data are moved to the end of the array. If set to `false`, they are moved to the start of the array.", "schema": { "type": [ "boolean", diff --git a/power.json b/power.json index d01912a0..94cf7106 100644 --- a/power.json +++ b/power.json @@ -1,7 +1,7 @@ { "id": "power", "summary": "Exponentiation", - "description": "Computes the exponentiation for the base `base` raised to the power of `p`.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`.", + "description": "Computes the exponentiation for the base `base` raised to the power of `p`.\n\nIf any argument is a no-data value, the result will be the no-data value (or `null`).", "categories": [ "math", "math > exponential & logarithmic" @@ -95,4 +95,4 @@ "title": "Power explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/product.json b/product.json index 6bb8428d..8e5a64b9 100644 --- a/product.json +++ b/product.json @@ -1,7 +1,7 @@ { "id": "product", "summary": "Compute the product by multiplying numbers", - "description": "Multiplies all elements in a sequential array of numbers and returns the computed product.\n\nBy default no-data values are ignored. Setting `ignore_nodata` to `false` considers no-data values so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", + "description": "Multiplies all elements in a sequential array of numbers and returns the computed product.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "math", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -105,4 +105,4 @@ "title": "IEEE Standard 754-2019 for Floating-Point Arithmetic" } ] -} \ No newline at end of file +} diff --git a/proposals/aggregate_spatial_window.json b/proposals/aggregate_spatial_window.json index 9e5dce4a..7b0d198f 100644 --- a/proposals/aggregate_spatial_window.json +++ b/proposals/aggregate_spatial_window.json @@ -75,7 +75,7 @@ }, { "name": "boundary", - "description": "Behavior to apply if the number of values for the axes `x` and `y` is not a multiple of the corresponding value in the `size` parameter. Options are:\n\n- `pad` (default): pad the data cube with the no-data value `null` to fit the required window size.\n\n- `trim`: trim the data cube to fit the required window size.\n\nUse the parameter `align` to align the data to the desired corner.", + "description": "Behavior to apply if the number of values for the axes `x` and `y` is not a multiple of the corresponding value in the `size` parameter. Options are:\n\n- `pad` (default): pad the data cube with the no-data value to fit the required window size.\n\n- `trim`: trim the data cube to fit the required window size.\n\nUse the parameter `align` to align the data to the desired corner.", "schema": { "type": "string", "enum": [ diff --git a/proposals/apply_polygon.json b/proposals/apply_polygon.json index 735226a1..fe48ab5f 100644 --- a/proposals/apply_polygon.json +++ b/proposals/apply_polygon.json @@ -71,7 +71,7 @@ }, { "name": "mask_value", - "description": "All pixels for which the point at the pixel center **does not** intersect with the polygon are replaced with the given value, which defaults to `null` (no data).\n\nIt can provide a distinction between no data values within the polygon and masked pixels outside of it.", + "description": "All pixels for which the point at the pixel center **does not** intersect with the polygon are replaced with the given value. The default value is `null`, which uses the no-data value of the data cube.\n\nThis parameter can provide a distinction between no-data values within the polygon and masked pixels outside of it.", "schema": [ { "type": "number" diff --git a/proposals/ard_normalized_radar_backscatter.json b/proposals/ard_normalized_radar_backscatter.json index ec60de44..7a9204ec 100644 --- a/proposals/ard_normalized_radar_backscatter.json +++ b/proposals/ard_normalized_radar_backscatter.json @@ -31,7 +31,7 @@ }, { "name": "elevation_model", - "description": "The digital elevation model to use. Set to `null` (the default) to allow the back-end to choose, which will improve portability, but reduce reproducibility.", + "description": "The digital elevation model to use. The default value `null` allows the back-end to choose, which will improve portability, but reduce reproducibility.", "optional": true, "default": null, "schema": [ @@ -83,7 +83,7 @@ } ], "returns": { - "description": "Backscatter values expressed as gamma0 in linear scale.\n\nIn addition to the bands `contributing_area` and `ellipsoid_incidence_angle` that can optionally be added with corresponding parameters, the following bands are always added to the data cube:\n\n- `mask`: A data mask that indicates which values are valid (1), invalid (0) or contain no-data (null).\n- `local_incidence_angle`: A band with DEM-based local incidence angles in degrees.\n\nThe data returned is CARD4L compliant with corresponding metadata.", + "description": "Backscatter values expressed as gamma0 in linear scale.\n\nIn addition to the bands `contributing_area` and `ellipsoid_incidence_angle` that can optionally be added with corresponding parameters, the following bands are always added to the data cube:\n\n- `mask`: A data mask that indicates which values are valid (1), invalid (0), or contain a no-data value.\n- `local_incidence_angle`: A band with DEM-based local incidence angles in degrees.\n\nThe data returned is CARD4L compliant with corresponding metadata.", "schema": { "type": "object", "subtype": "datacube", diff --git a/proposals/ard_surface_reflectance.json b/proposals/ard_surface_reflectance.json index 01328f10..74f3347f 100644 --- a/proposals/ard_surface_reflectance.json +++ b/proposals/ard_surface_reflectance.json @@ -57,7 +57,7 @@ } }, { - "description": "The digital elevation model to use. Set to `null` (the default) to allow the back-end to choose, which will improve portability, but reduce reproducibility.", + "description": "The digital elevation model to use. The default value `null` allows the back-end to choose, which will improve portability, but reduce reproducibility.", "name": "elevation_model", "optional": true, "default": null, @@ -93,7 +93,7 @@ } ], "returns": { - "description": "Data cube containing bottom of atmosphere reflectances for each spectral band in the source data cube, with atmospheric disturbances like clouds and cloud shadows removed. No-data values (null) are directly set in the bands. Depending on the methods used, several additional bands will be added to the data cube:\n\nData cube containing bottom of atmosphere reflectances for each spectral band in the source data cube, with atmospheric disturbances like clouds and cloud shadows removed. Depending on the methods used, several additional bands will be added to the data cube:\n\n- `date` (optional): Specifies per-pixel acquisition timestamps.\n- `incomplete-testing` (required): Identifies pixels with a value of 1 for which the per-pixel tests (at least saturation, cloud and cloud shadows, see CARD4L specification for details) have not all been successfully completed. Otherwise, the value is 0.\n- `saturation` (required) / `saturation_{band}` (optional): Indicates where pixels in the input spectral bands are saturated (1) or not (0). If the saturation is given per band, the band names are `saturation_{band}` with `{band}` being the band name from the source data cube.\n- `cloud`, `shadow` (both required),`aerosol`, `haze`, `ozone`, `water_vapor` (all optional): Indicates the probability of pixels being an atmospheric disturbance such as clouds. All bands have values between 0 (clear) and 1, which describes the probability that it is an atmospheric disturbance.\n- `snow-ice` (optional): Points to a file that indicates whether a pixel is assessed as being snow/ice (1) or not (0). All values describe the probability and must be between 0 and 1.\n- `land-water` (optional): Indicates whether a pixel is assessed as being land (1) or water (0). All values describe the probability and must be between 0 and 1.\n- `incidence-angle` (optional): Specifies per-pixel incidence angles in degrees.\n- `azimuth` (optional): Specifies per-pixel azimuth angles in degrees.\n- `sun-azimuth:` (optional): Specifies per-pixel sun azimuth angles in degrees.\n- `sun-elevation` (optional): Specifies per-pixel sun elevation angles in degrees.\n- `terrain-shadow` (optional): Indicates with a value of 1 whether a pixel is not directly illuminated due to terrain shadowing. Otherwise, the value is 0.\n- `terrain-occlusion` (optional): Indicates with a value of 1 whether a pixel is not visible to the sensor due to terrain occlusion during off-nadir viewing. Otherwise, the value is 0.\n- `terrain-illumination` (optional): Contains coefficients used for terrain illumination correction are provided for each pixel.\n\nThe data returned is CARD4L compliant with corresponding metadata.", + "description": "Data cube containing bottom of atmosphere reflectances for each spectral band in the source data cube, with atmospheric disturbances like clouds and cloud shadows removed. No-data values are directly set in the bands. Depending on the methods used, several additional bands will be added to the data cube:\n\nData cube containing bottom of atmosphere reflectances for each spectral band in the source data cube, with atmospheric disturbances like clouds and cloud shadows removed. Depending on the methods used, several additional bands will be added to the data cube:\n\n- `date` (optional): Specifies per-pixel acquisition timestamps.\n- `incomplete-testing` (required): Identifies pixels with a value of 1 for which the per-pixel tests (at least saturation, cloud and cloud shadows, see CARD4L specification for details) have not all been successfully completed. Otherwise, the value is 0.\n- `saturation` (required) / `saturation_{band}` (optional): Indicates where pixels in the input spectral bands are saturated (1) or not (0). If the saturation is given per band, the band names are `saturation_{band}` with `{band}` being the band name from the source data cube.\n- `cloud`, `shadow` (both required),`aerosol`, `haze`, `ozone`, `water_vapor` (all optional): Indicates the probability of pixels being an atmospheric disturbance such as clouds. All bands have values between 0 (clear) and 1, which describes the probability that it is an atmospheric disturbance.\n- `snow-ice` (optional): Points to a file that indicates whether a pixel is assessed as being snow/ice (1) or not (0). All values describe the probability and must be between 0 and 1.\n- `land-water` (optional): Indicates whether a pixel is assessed as being land (1) or water (0). All values describe the probability and must be between 0 and 1.\n- `incidence-angle` (optional): Specifies per-pixel incidence angles in degrees.\n- `azimuth` (optional): Specifies per-pixel azimuth angles in degrees.\n- `sun-azimuth:` (optional): Specifies per-pixel sun azimuth angles in degrees.\n- `sun-elevation` (optional): Specifies per-pixel sun elevation angles in degrees.\n- `terrain-shadow` (optional): Indicates with a value of 1 whether a pixel is not directly illuminated due to terrain shadowing. Otherwise, the value is 0.\n- `terrain-occlusion` (optional): Indicates with a value of 1 whether a pixel is not visible to the sensor due to terrain occlusion during off-nadir viewing. Otherwise, the value is 0.\n- `terrain-illumination` (optional): Contains coefficients used for terrain illumination correction are provided for each pixel.\n\nThe data returned is CARD4L compliant with corresponding metadata.", "schema": { "type": "object", "subtype": "datacube", diff --git a/proposals/array_find_label.json b/proposals/array_find_label.json index 98371cb5..fb8c24fd 100644 --- a/proposals/array_find_label.json +++ b/proposals/array_find_label.json @@ -1,7 +1,7 @@ { "id": "array_find_label", "summary": "Get the index for a label in a labeled array", - "description": "Checks whether the labeled array specified for `data` has the label specified in `label` and returns the zero-based index for it. If there's no match as either the label doesn't exist or the array is not labeled, `null` is returned.\n\nUse ``array_find()`` to find the index for a given value in the array.", + "description": "Checks whether the labeled array specified for `data` has the label specified in `label` and returns the zero-based index for it. If there's no match as either the label doesn't exist or the array is not labeled, the no-data value (or `null`) is returned.\n\nUse ``array_find()`` to find the index for a given value in the array.", "categories": [ "arrays", "reducer" @@ -32,7 +32,7 @@ } ], "returns": { - "description": "The index of the element with the specified label assigned. If no such label was found, `null` is returned.", + "description": "The index of the element with the specified label assigned. If no such label was found, the no-data value (or `null`) is returned.", "schema": [ { "type": "null" @@ -43,4 +43,4 @@ } ] } -} \ No newline at end of file +} diff --git a/proposals/atmospheric_correction.json b/proposals/atmospheric_correction.json index d366f1ed..57575f78 100644 --- a/proposals/atmospheric_correction.json +++ b/proposals/atmospheric_correction.json @@ -47,7 +47,7 @@ ] }, { - "description": "The digital elevation model to use. Set to `null` (the default) to allow the back-end to choose, which will improve portability, but reduce reproducibility.", + "description": "The digital elevation model to use. The default value `null` allows the back-end to choose, which will improve portability, but reduce reproducibility.", "name": "elevation_model", "optional": true, "default": null, diff --git a/proposals/cummax.json b/proposals/cummax.json index 69580459..95532334 100644 --- a/proposals/cummax.json +++ b/proposals/cummax.json @@ -1,7 +1,7 @@ { "id": "cummax", "summary": "Cumulative maxima", - "description": "Finds cumulative maxima of an array of numbers. Every computed element is equal to the bigger one between the current element and the previously computed element. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value (`null`) is reached all following elements are set to `null` in the result.", + "description": "Finds cumulative maxima of an array of numbers. Every computed element is equal to the bigger one between the current element and the previously computed element. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value is reached all following elements are set to the no-data value in the result.", "categories": [ "math > cumulative" ], @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not and ignores them by default. Setting this flag to `false` considers no-data values so that `null` is set for all the following elements.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, the first no-data value makes all following values also no-data values.", "schema": { "type": "boolean" }, @@ -99,4 +99,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/proposals/cummin.json b/proposals/cummin.json index d84612e3..50cd3b00 100644 --- a/proposals/cummin.json +++ b/proposals/cummin.json @@ -1,7 +1,7 @@ { "id": "cummin", "summary": "Cumulative minima", - "description": "Finds cumulative minima of an array of numbers. Every computed element is equal to the smaller one between the current element and the previously computed element. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value (`null`) is reached all following elements are set to `null` in the result.", + "description": "Finds cumulative minima of an array of numbers. Every computed element is equal to the smaller one between the current element and the previously computed element. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value is reached all following elements are set to the no-data value in the result.", "categories": [ "math > cumulative" ], @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not and ignores them by default. Setting this flag to `false` considers no-data values so that `null` is set for all the following elements.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, the first no-data value makes all following values also no-data values.", "schema": { "type": "boolean" }, @@ -99,4 +99,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/proposals/cumproduct.json b/proposals/cumproduct.json index f5e6ae1b..3c7b455e 100644 --- a/proposals/cumproduct.json +++ b/proposals/cumproduct.json @@ -1,7 +1,7 @@ { "id": "cumproduct", "summary": "Cumulative products", - "description": "Computes cumulative products of an array of numbers. Every computed element is equal to the product of the current and all previous values. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value (`null`) is reached all following elements are set to `null` in the result.", + "description": "Computes cumulative products of an array of numbers. Every computed element is equal to the product of the current and all previous values. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value is reached all following elements are set to the no-data value in the result.", "categories": [ "math > cumulative" ], @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not and ignores them by default. Setting this flag to `false` considers no-data values so that `null` is set for all the following elements.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, the first no-data value makes all following values also no-data values.", "schema": { "type": "boolean" }, @@ -103,4 +103,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/proposals/cumsum.json b/proposals/cumsum.json index 717999e5..abd0e2c3 100644 --- a/proposals/cumsum.json +++ b/proposals/cumsum.json @@ -1,7 +1,7 @@ { "id": "cumsum", "summary": "Cumulative sums", - "description": "Computes cumulative sums of an array of numbers. Every computed element is equal to the sum of current and all previous values. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value (`null`) is reached all following elements are set to `null` in the result.", + "description": "Computes cumulative sums of an array of numbers. Every computed element is equal to the sum of current and all previous values. The returned array and the input array have always the same length.\n\nBy default, no-data values are skipped, but stay in the result. Setting the `ignore_nodata` flag to `true` makes that once a no-data value is reached all following elements are set to the no-data value in the result.", "categories": [ "math > cumulative" ], @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not and ignores them by default. Setting this flag to `false` considers no-data values so that `null` is set for all the following elements.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, the first no-data value makes all following values also no-data values.", "schema": { "type": "boolean" }, @@ -99,4 +99,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/proposals/fit_curve.json b/proposals/fit_curve.json index aafb917e..407e9547 100644 --- a/proposals/fit_curve.json +++ b/proposals/fit_curve.json @@ -69,7 +69,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is passed to the model function.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that no-data values are passed to the model function.", "schema": { "type": "boolean" }, diff --git a/proposals/is_infinite.json b/proposals/is_infinite.json index b6a5acca..da0d165f 100644 --- a/proposals/is_infinite.json +++ b/proposals/is_infinite.json @@ -1,7 +1,7 @@ { "id": "is_infinite", "summary": "Value is an infinite number", - "description": "Checks whether the specified value `x` is an infinite number. The definition of infinite numbers follows the [IEEE Standard 754](https://ieeexplore.ieee.org/document/4610935). The special numerical value `NaN` (not a number) as defined by the [IEEE Standard 754](https://ieeexplore.ieee.org/document/4610935) is not an infinite number and must return `false`.", + "description": "Checks whether the specified value `x` is an infinite number. The definition of infinite numbers (and `NaN`) follows the [IEEE Standard 754](https://ieeexplore.ieee.org/document/4610935). `NaN` (not a number) is not an infinite number and must return `false`.", "categories": [ "comparison" ], @@ -28,4 +28,4 @@ "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ] -} \ No newline at end of file +} diff --git a/proposals/load_geojson.json b/proposals/load_geojson.json index 70566a56..89e8440b 100644 --- a/proposals/load_geojson.json +++ b/proposals/load_geojson.json @@ -18,7 +18,7 @@ }, { "name": "properties", - "description": "A list of properties from the GeoJSON file to construct an additional dimension from. A new dimension with the name `properties` and type `other` is created if at least one property is provided. Only applies for GeoJSON Features and FeatureCollections. Missing values are generally set to no-data (`null`).\n\nDepending on the number of properties provided, the process creates the dimension differently:\n\n- Single property with scalar values: A single dimension label with the name of the property and a single value per geometry.\n- Single property of type array: The dimension labels correspond to the array indices. There are as many values and labels per geometry as there are for the largest array.\n- Multiple properties with scalar values: The dimension labels correspond to the property names. There are as many values and labels per geometry as there are properties provided here.", + "description": "A list of properties from the GeoJSON file to construct an additional dimension from. A new dimension with the name `properties` and type `other` is created if at least one property is provided. Only applies for GeoJSON Features and FeatureCollections. Missing values are generally set to the no-data value in the data cube.\n\nDepending on the number of properties provided, the process creates the dimension differently:\n\n- Single property with scalar values: A single dimension label with the name of the property and a single value per geometry.\n- Single property of type array: The dimension labels correspond to the array indices. There are as many values and labels per geometry as there are for the largest array.\n- Multiple properties with scalar values: The dimension labels correspond to the property names. There are as many values and labels per geometry as there are properties provided here.", "schema": { "type": "array", "uniqueItems": true, diff --git a/proposals/load_stac.json b/proposals/load_stac.json index 262745fc..318edc67 100644 --- a/proposals/load_stac.json +++ b/proposals/load_stac.json @@ -90,13 +90,13 @@ }, { "title": "GeoJSON", - "description": "Limits the data cube to the bounding box of the given geometries. For raster data, all pixels inside the bounding box that do not intersect with any of the polygons will be set to no data (`null`).\n\nThe GeoJSON type `GeometryCollection` is not supported. Empty geometries are ignored.", + "description": "Limits the data cube to the bounding box of the given geometries. For raster data, all pixels inside the bounding box that do not intersect with any of the polygons will be set to the no-data value of the data cube.\n\nThe GeoJSON type `GeometryCollection` is not supported. Empty geometries are ignored.", "type": "object", "subtype": "geojson" }, { "title": "Vector data cube", - "description": "Limits the data cube to the bounding box of the given geometries in the vector data cube. All pixels inside the bounding box that do not intersect with any of the polygons will be set to no data (`null`). Empty geometries are ignored.", + "description": "Limits the data cube to the bounding box of the given geometries in the vector data cube. All pixels inside the bounding box that do not intersect with any of the polygons will be set to the no-data value of the data cube. Empty geometries are ignored.", "type": "object", "subtype": "datacube", "dimensions": [ diff --git a/proposals/predict_curve.json b/proposals/predict_curve.json index ef3e9596..204cbb3f 100644 --- a/proposals/predict_curve.json +++ b/proposals/predict_curve.json @@ -59,7 +59,7 @@ }, { "name": "labels", - "description": "The labels to predict values for. If no labels are given, predicts values only for no-data (`null`) values in the data cube.", + "description": "The labels to predict values for. If no labels are given, predicts values only for no-data values in the data cube.", "optional": true, "default": null, "schema": [ diff --git a/proposals/sar_backscatter.json b/proposals/sar_backscatter.json index 03d13d29..6fb2503a 100644 --- a/proposals/sar_backscatter.json +++ b/proposals/sar_backscatter.json @@ -52,7 +52,7 @@ }, { "name": "elevation_model", - "description": "The digital elevation model to use. Set to `null` (the default) to allow the back-end to choose, which will improve portability, but reduce reproducibility.", + "description": "The digital elevation model to use. The default value `null` allows the back-end to choose, which will improve portability, but reduce reproducibility.", "optional": true, "default": null, "schema": [ @@ -67,7 +67,7 @@ }, { "name": "mask", - "description": "If set to `true`, a data mask is added to the bands with the name `mask`. It indicates which values are valid (1), invalid (0) or contain no-data (null).", + "description": "If set to `true`, a data mask is added to the bands with the name `mask`. It indicates which values are valid (1), invalid (0), or contain a no-data value.", "optional": true, "default": false, "schema": { diff --git a/proposals/vector_to_random_points.json b/proposals/vector_to_random_points.json index b568b54c..6eda87ad 100644 --- a/proposals/vector_to_random_points.json +++ b/proposals/vector_to_random_points.json @@ -1,7 +1,7 @@ { "id": "vector_to_random_points", "summary": "Sample random points from geometries", - "description": "Generate a vector data cube of points by sampling random points from input geometries. At least one point is sampled per input geometry. Empty geometries are passed through without any points assigned. Feature properties are preserved.\n\nIf `geometry_count` and `total_count` are both unrestricted (i.e. set to `null`, which is the default), one sample per geometry is used.", + "description": "Generate a vector data cube of points by sampling random points from input geometries. At least one point is sampled per input geometry. Empty geometries are passed through without any points assigned. Feature properties are preserved.\n\nIf `geometry_count` and `total_count` are both unrestricted (i.e. set to the default value `null`), one sample per geometry is used.", "categories": [ "cubes", "vector" diff --git a/quantiles.json b/quantiles.json index 033a4d89..f47fc5a9 100644 --- a/quantiles.json +++ b/quantiles.json @@ -53,7 +53,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that an array with `null` values is returned if any element is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in an array with solely no-data (or `null`) values.", "schema": { "type": "boolean" }, diff --git a/resample_cube_temporal.json b/resample_cube_temporal.json index 260954d0..e8308a01 100644 --- a/resample_cube_temporal.json +++ b/resample_cube_temporal.json @@ -1,7 +1,7 @@ { "id": "resample_cube_temporal", "summary": "Resample temporal dimensions to match a target data cube", - "description": "Resamples one or more given temporal dimensions from a source data cube to align with the corresponding dimensions of the given target data cube using the nearest neighbor method. Returns a new data cube with the resampled dimensions.\n\nBy default, this process simply takes the nearest neighbor independent of the value (including values such as no-data / `null`). Depending on the data cubes this may lead to values being assigned to two target timestamps. To only consider valid values in a specific range around the target timestamps, use the parameter `valid_within`.\n\nThe rare case of ties is resolved by choosing the earlier timestamps.", + "description": "Resamples one or more given temporal dimensions from a source data cube to align with the corresponding dimensions of the given target data cube using the nearest neighbor method. Returns a new data cube with the resampled dimensions.\n\nBy default, this process simply takes the nearest neighbor independent of the value (including no-data values). Depending on the data cubes this may lead to values being assigned to two target timestamps. To only consider valid values in a specific range around the target timestamps, use the parameter `valid_within`.\n\nThe rare case of ties is resolved by choosing the earlier timestamps.", "categories": [ "cubes", "reproject" @@ -47,7 +47,7 @@ }, { "name": "valid_within", - "description": "Setting this parameter to a numerical value enables that the process searches for valid values within the given period of days before and after the target timestamps. Valid values are determined based on the function ``is_valid()``. For example, the limit of `7` for the target timestamps `2020-01-15 12:00:00` looks for a nearest neighbor after `2020-01-08 12:00:00` and before `2020-01-22 12:00:00`. If no valid value is found within the given period, the value will be set to no-data (`null`).", + "description": "Setting this parameter to a numerical value enables that the process searches for valid values within the given period of days before and after the target timestamps. Valid values are determined based on the function ``is_valid()``. For example, the limit of `7` for the target timestamps `2020-01-15 12:00:00` looks for a nearest neighbor after `2020-01-08 12:00:00` and before `2020-01-22 12:00:00`. If no valid value is found within the given period, the value will be set to the no-data value of the data cube given for the parameter `data`.", "schema": { "type": [ "number", diff --git a/resample_spatial.json b/resample_spatial.json index fb34f194..418f13ec 100644 --- a/resample_spatial.json +++ b/resample_spatial.json @@ -49,7 +49,7 @@ }, { "name": "projection", - "description": "Warps the data cube to the target projection, specified as as [EPSG code](http://www.epsg-registry.org/) or [WKT2 CRS string](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html). By default (`null`), the projection is not changed.", + "description": "Warps the data cube to the target projection, specified as as [EPSG code](http://www.epsg-registry.org/) or [WKT2 CRS string](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html). For the default value `null`, the projection is not changed.", "schema": [ { "title": "EPSG Code", diff --git a/round.json b/round.json index cb1ff9e0..8f61b8a0 100644 --- a/round.json +++ b/round.json @@ -1,7 +1,7 @@ { "id": "round", "summary": "Round to a specified precision", - "description": "Rounds a real number `x` to specified precision `p`.\n\nIf `x` is halfway between closest numbers of precision `p`, it is rounded to the closest even number of precision `p`.\nThis behavior follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) and is often called \"round to nearest (even)\" or \"banker's rounding\". It minimizes rounding errors that result from consistently rounding a midpoint value in a single direction.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Rounds a real number `x` to specified precision `p`.\n\nIf `x` is halfway between closest numbers of precision `p`, it is rounded to the closest even number of precision `p`.\nThis behavior follows [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) and is often called \"round to nearest (even)\" or \"banker's rounding\". It minimizes rounding errors that result from consistently rounding a midpoint value in a single direction.\n\nNo-data values are passed through.", "categories": [ "math > rounding" ], diff --git a/sd.json b/sd.json index 156e4b38..4616756b 100644 --- a/sd.json +++ b/sd.json @@ -1,7 +1,7 @@ { "id": "sd", "summary": "Standard deviation", - "description": "Computes the sample standard deviation, which quantifies the amount of variation of an array of numbers. It is defined to be the square root of the corresponding variance (see ``variance()``).\n\nA low standard deviation indicates that the values tend to be close to the expected value, while a high standard deviation indicates that the values are spread out over a wider range.\n\nAn array without non-`null` elements resolves always with `null`.", + "description": "Computes the sample standard deviation, which quantifies the amount of variation of an array of numbers. It is defined to be the square root of the corresponding variance (see ``variance()``).\n\nA low standard deviation indicates that the values tend to be close to the expected value, while a high standard deviation indicates that the values are spread out over a wider range.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "math > statistics", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -62,13 +62,6 @@ "ignore_nodata": false }, "returns": null - }, - { - "description": "The input array is empty: return `null`.", - "arguments": { - "data": [] - }, - "returns": null } ], "links": [ @@ -101,4 +94,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/sgn.json b/sgn.json index ecdbd9d1..98772952 100644 --- a/sgn.json +++ b/sgn.json @@ -1,7 +1,7 @@ { "id": "sgn", "summary": "Signum", - "description": "The signum (also known as *sign*) of `x` is defined as:\n\n* *1* if *x > 0*\n* *0* if *x = 0*\n* *-1* if *x < 0*\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "The signum (also known as *sign*) of `x` is defined as:\n\n* *1* if *x > 0*\n* *0* if *x = 0*\n* *-1* if *x < 0*\n\nNo-data values are passed through.", "categories": [ "math" ], diff --git a/sin.json b/sin.json index 15285979..989be23d 100644 --- a/sin.json +++ b/sin.json @@ -1,7 +1,7 @@ { "id": "sin", "summary": "Sine", - "description": "Computes the sine of `x`.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the sine of `x`.\n\nWorks on radians only.\nNo-data values are passed through.", "categories": [ "math > trigonometric" ], diff --git a/sinh.json b/sinh.json index 6eced19c..4bfa4975 100644 --- a/sinh.json +++ b/sinh.json @@ -1,7 +1,7 @@ { "id": "sinh", "summary": "Hyperbolic sine", - "description": "Computes the hyperbolic sine of `x`.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the hyperbolic sine of `x`.\n\nNo-data values are passed through.", "categories": [ "math > trigonometric" ], diff --git a/sort.json b/sort.json index 422f8d53..a375e386 100644 --- a/sort.json +++ b/sort.json @@ -45,7 +45,7 @@ }, { "name": "nodata", - "description": "Controls the handling of no-data values (`null`). By default, they are removed. If set to `true`, missing values in the data are put last; if set to `false`, they are put first.", + "description": "Controls the handling of no-data values. For the default value `null`, all no-data values get removed. If set to `true`, no-data values in the data are moved to the end of the array. If set to `false`, they are moved to the start of the array.", "schema": { "type": [ "boolean", diff --git a/sqrt.json b/sqrt.json index b85caf94..446ded3c 100644 --- a/sqrt.json +++ b/sqrt.json @@ -1,7 +1,7 @@ { "id": "sqrt", "summary": "Square root", - "description": "Computes the square root of a real number `x`, which is equal to calculating `x` to the power of *0.5*. For negative `x`, the process returns `NaN`.\n\nA square root of x is a number a such that *`a² = x`*. Therefore, the square root is the inverse function of a to the power of 2, but only for *a >= 0*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the square root of a real number `x`, which is equal to calculating `x` to the power of *0.5*. For negative `x`, the process returns `NaN`.\n\nA square root of x is a number a such that *`a² = x`*. Therefore, the square root is the inverse function of a to the power of 2, but only for *a >= 0*.\n\nNo-data values are passed through.", "categories": [ "math", "math > exponential & logarithmic" diff --git a/subtract.json b/subtract.json index 2cf8aba7..feb24c06 100644 --- a/subtract.json +++ b/subtract.json @@ -1,7 +1,7 @@ { "id": "subtract", "summary": "Subtraction of two numbers", - "description": "Subtracts argument `y` from the argument `x` (*`x - y`*) and returns the computed result.\n\nNo-data values are taken into account so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", + "description": "Subtracts argument `y` from the argument `x` (*`x - y`*) and returns the computed result.\n\nNo-data values are taken into account so that the no-data value is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", "categories": [ "math" ], @@ -71,4 +71,4 @@ "title": "IEEE Standard 754-2019 for Floating-Point Arithmetic" } ] -} \ No newline at end of file +} diff --git a/sum.json b/sum.json index 17af5bfe..912ba47a 100644 --- a/sum.json +++ b/sum.json @@ -1,7 +1,7 @@ { "id": "sum", "summary": "Compute the sum by adding up numbers", - "description": "Sums up all elements in a sequential array of numbers and returns the computed sum.\n\nBy default no-data values are ignored. Setting `ignore_nodata` to `false` considers no-data values so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.", + "description": "Sums up all elements in a sequential array of numbers and returns the computed sum.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "math", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -105,4 +105,4 @@ "title": "IEEE Standard 754-2019 for Floating-Point Arithmetic" } ] -} \ No newline at end of file +} diff --git a/tan.json b/tan.json index 6e927ffc..372e3188 100644 --- a/tan.json +++ b/tan.json @@ -1,7 +1,7 @@ { "id": "tan", "summary": "Tangent", - "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`tan(pi()/2 + multipliy(pi(), n))`* with `n` being any integer results in ±infinity. -infinity for negative values passed to `tan`, +infinity otherwise. If the processing environment does not supports it, an exception is thrown.", + "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nNo-data values are passed through.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`tan(pi()/2 + multipliy(pi(), n))`* with `n` being any integer results in ±infinity. -infinity for negative values passed to `tan`, +infinity otherwise. If the processing environment does not supports it, an exception is thrown.", "categories": [ "math > trigonometric" ], diff --git a/tanh.json b/tanh.json index a38462c9..41eab735 100644 --- a/tanh.json +++ b/tanh.json @@ -1,7 +1,7 @@ { "id": "tanh", "summary": "Hyperbolic tangent", - "description": "Computes the hyperbolic tangent of `x`. The tangent is defined to be the hyperbolic sine of x divided by the hyperbolic cosine of x.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the hyperbolic tangent of `x`. The tangent is defined to be the hyperbolic sine of x divided by the hyperbolic cosine of x.\n\nNo-data values are passed through.", "categories": [ "math > trigonometric" ], diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..1353fe36 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,366 @@ +# Tests + +This folder contains test cases for the openEO processes. + +## Processes + +- [x] absolute +- [x] add +- [x] add_dimension +- [x] aggregate_temporal +- [x] aggregate_temporal_period +- [x] all +- [x] and +- [x] any +- [x] apply* +- [x] apply_dimension* +- [x] apply_kernel +- [x] arccos +- [x] arcosh +- [x] arcsin +- [x] arctan +- [x] arctan2 +- [x] array_append +- [x] array_apply +- [x] array_concat +- [x] array_contains +- [x] array_create +- [x] array_create_labeled (experimental) +- [x] array_element +- [x] array_filter +- [x] array_find +- [x] array_find_label (experimental) +- [x] array_interpolate_linear +- [x] array_labels +- [x] array_modify* (experimental) +- [x] arsinh +- [x] artanh +- [x] between +- [x] ceil +- [x] clip +- [x] constant +- [x] cos +- [x] cosh +- [x] count* +- [x] cummax* (experimental) +- [x] cummin* (experimental) +- [x] cumproduct* (experimental) +- [x] cumsum* (experimental) +- [x] create_data_cube +- [x] date_between* (experimental) +- [x] date_difference* (experimental) +- [x] date_shift* (experimental) +- [x] dimension_labels +- [x] divide +- [x] drop_dimension* +- [x] e +- [x] eq +- [x] exp +- [x] extrema +- [x] filter_bands* +- [x] filter_bbox* +- [x] filter_spatial* +- [x] filter_temporal* +- [x] first +- [x] floor +- [x] gt +- [x] gte +- [x] if +- [x] int +- [x] is_infinite (experimental) +- [x] is_nan +- [x] is_nodata* +- [x] last +- [x] linear_scale_range +- [x] ln +- [x] log +- [x] lt +- [x] lte +- [x] mask* +- [x] mask_polygon* +- [x] max +- [x] mean +- [x] median +- [x] merge_cubes* +- [x] min +- [x] mod +- [x] multiply +- [x] nan (experimental) +- [x] neq +- [x] normalized_difference +- [x] not +- [x] or +- [x] order* +- [x] pi +- [x] power +- [x] product +- [x] quantiles +- [x] rearrange* +- [x] reduce_dimension* +- [x] rename_dimension +- [x] rename_labels +- [x] round +- [x] sd +- [x] sgn +- [x] sin +- [x] sinh +- [x] sort* +- [x] sqrt +- [x] subtract +- [x] sum +- [x] tan +- [x] tanh +- [x] text_begins +- [x] text_concat +- [x] text_contains +- [x] text_ends +- [x] variance +- [x] xor + +\* = could use some more tests + +**Important:** The differentiation of null and NaN is to be discussed and reflected in the tests. +See for details. + +## Missing processes + +The following processes have no test cases as the results heavily depend on the underlying implementation +or need an external services to be available for testing (e.g. loading files from the user workspace or a UDF server). +We don't expect that we can provide meaningful test cases for these processes. + +- ard_normalized_radar_backscatter (experimental) +- ard_surface_reflectance (experimental) +- atmospheric_correction (experimental) +- cloud_detection (experimental) +- fit_curve (experimental) +- inspect (experimental) +- load_collection +- load_stac (experimental) +- load_uploaded_files (experimental) +- load_url (experimental) +- predict_curve (experimental) +- resample_spatial +- run_udf +- run_udf_externally (experimental) +- sar_backscatter (experimental) +- save_result +- vector_to_random_points (experimental) +- vector_to_regular_points (experimental) + +The following processes are experimental, part of a higher profile (L3+), or use vector data cube, so the tests will hopefully evolve over time: + +- aggregate_spatial +- aggregate_spatial_window (experimental) +- anomaly +- apply_neighborhood +- apply_polygon (experimental) +- climatological_normal +- filter_labels (experimental) +- filter_vector (experimental) +- flatten_dimensions (experimental) +- load_geojson (experimental) +- ndvi +- reduce_spatial (experimental) +- resample_cube_spatial +- resample_cube_temporal +- trim_cube +- unflatten_dimension (experimental) +- vector_buffer (experimental) +- vector_reproject (experimental) + +## Assumptions + +The test cases assume a couple of things as they are an abstraction and not bound to specific implementations: +- The JSON Schema type `number` explicitly includes the values `+Infinity`, `-Infinity` and `NaN`. +- The input and output values for no-data values are `null` by default unless otherwise specified by a runner. +- Input that is not valid according to the schemas, will be rejected upfront and will not be checked on. For example, the absolute process only tests against the data types `number` and `null`. There are no tests for a boolean or string input. +- Numerical data types such as uint8 don't matter, i.e. tests don't check for overflows etc. This suite can't provide such tests as the underlying data type is not known. +- If not otherwise specified for numbers, a precision of 10 decimals is checked so return values should have at least 11 decimals. + +## Test Files + +To allow for more data types (e.g. infinity and nan for numbers), all the files are encoded in **JSON5** instead of JSON. + +The test files have the following schema: + +```yaml +description: A document with test cases for a specific openEO process +type: object +required: + - id + - experimental + - tests +properties: + id: + type: string + description: The identifier for the process. + pattern: '^\w+$' + experimental: + type: boolean + description: Declares that the process is experimental, tests may fail. + default: false + level: + type: string + description: openEO process profile the process is assigned to. + default: L4 + pattern: 'L\d([\w-])?' + tests: + description: A list of test cases without a specific order + type: array + items: + description: |- + A test case with a set of arguments and a specific return value or exception + + If both `returns` and `throws` are provided, it means that either of it should be true. + So either the process retuens as specified or throws the specified error. + type: object + required: + - arguments + oneOf: + - required: + - returns + - required: + - throws + properties: + arguments: + description: A key-value pair for an argument. Key = Parameter name, Value = Argument value + type: object + additionalProperties: + description: An argument, can be of any type + returns: + description: The return value, can be of any type + required: + description: >- + A list of processes that is required for this test (except for the process provided in `id`). + This is usually required for processes that run a sub-process (callback) so that the test suite can skip tests for processes that are not supported. + type: array + items: + type: string + description: The identifier for the sub-process. + pattern: '^\w+$' + delta: + description: If set to a positive number the equality of the actual return value and the expected return value is checked against a delta value to circumvent problems with floating-point inaccuracy. + type: number + default: 0.0000000001 + throws: + description: >- + Specifies whether the execution is meant to throw an exception. + If used in combination with a return value, it makes the test effectively optional. + oneOf: + - description: Specify an exception name from the process specification + type: string + minLength: 1 + - description: Use true if the type of exception is unknown + type: boolean + const: true + level: + type: + - string + - null + description: >- + openEO process profile the test is assigned to. + Defaults to the level of the process. + default: null + pattern: 'L\d([\w-])?' +``` + +### No-data values + +No-data values have a special encoding in tests (see below). +The encoding is replaced with `null` unless otherwise specified by the runners. + +```json +{ + "type": "nodata" +} +``` + +### Datetimes + +Datetimes as strings have a varying precision, especially regarding the milliseconds. +Also, sometimes timezones are differently handled. + +Datetimes in return values should be encoded as follows so that the results can be compared better: + +```json +{ + "type": "datetime", + "value": "2020-01-01T00:00:00Z" +} +``` + +### External references + +Arguments and return values can point to external files, e.g. + +```json +{ + "$ref": "https://host.example/datacube.json" +} +``` + +The test suite can currently only load JSON and JSON5 files. + +### Labeled arrays + +Labeled arrays can't be represented in JSON5 and will be provided as an object instead. + +```json +{ + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + // ... + ] +} +``` + +### Datacubes + +Datacubes can't be represented in JSON5 and will be provided as an object instead. +Vector datacubes are currently not supported. + +```json +{ + "type": "datacube", + "data": [ + // multi-dimensional array + // can be set to `null` if the data values are irrelevant for the test. + ], + "nodata": [ + NaN + ], + "order": ["bands", "t", "y", "x"], + "dimensions": { + // similar to the STAC datacube extension + // properties: type, axis (if type = spatial), values, and reference_system (optional) + "bands": { + "type": "bands", + "values": ["blue","green","red","nir"] + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z","2020-06-03T00:00:00Z","2020-06-06T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0,5757485.0,5757475.0,5757465.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0,404845.0,404855.0,404865.0,404875.0], + "reference_system": "EPSG:25832" + } + } +} +``` diff --git a/tests/absolute.json5 b/tests/absolute.json5 new file mode 100644 index 00000000..a495c763 --- /dev/null +++ b/tests/absolute.json5 @@ -0,0 +1,60 @@ +{ + "id": "absolute", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1 + }, + "returns": 1 + }, + { + "arguments": { + "x": 2.5 + }, + "returns": 2.5 + }, + { + "arguments": { + "x": -2.5 + }, + "returns": 2.5 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/add.json5 b/tests/add.json5 new file mode 100644 index 00000000..f0f7f8c1 --- /dev/null +++ b/tests/add.json5 @@ -0,0 +1,160 @@ +{ + "id": "add", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1, + "y": 2 + }, + "returns": 3 + }, + { + "arguments": { + "x": -1, + "y": 2 + }, + "returns": 1 + }, + { + "arguments": { + "x": 2.5, + "y": 3.5 + }, + "returns": 6 + }, + { + "arguments": { + "x": -2.5, + "y": 3.5 + }, + "returns": 1 + }, + { + "arguments": { + "x": 250, + "y": 10 + }, + "returns": 260 + }, + { + "arguments": { + "x": NaN, + "y": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": 1, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -1, + "y": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": Infinity, + "y": 1 + }, + "returns": Infinity + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": 1 + }, + "returns": -Infinity + }, + { + "arguments": { + "x": 1, + "y": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": Infinity + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": 1 + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/add_dimension.json5 b/tests/add_dimension.json5 new file mode 100644 index 00000000..71bbe266 --- /dev/null +++ b/tests/add_dimension.json5 @@ -0,0 +1,170 @@ +{ + "id": "add_dimension", + "level": "L2", + "tests": [ + { + // add bands dimension + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "name": "b", + "label": "B1", + "type": "bands" + }, + "returns": { + "type": "datacube", + "order": ["b", "t", "y", "x"], + "dimensions": { + "b": { + "type": "bands", + "values": ["B1"] + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + // add temporal dimension + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "name": "t", + "label": "2020-01-01T00:00:00Z", + "type": "temporal" + }, + "returns": { + "type": "datacube", + "order": ["t", "bands", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-01-01T00:00:00Z"] + }, + "bands": { + "type": "bands", + "values": ["red", "green", "blue"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + // add second temporal dimension + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "name": "t2", + "label": "2010-01-01T00:00:00.0Z", + "type": "temporal" + }, + "returns": { + "type": "datacube", + "order": ["t2", "t", "y", "x"], + "dimensions": { + "t2": { + "type": "temporal", + "values": ["2010-01-01T00:00:00.0Z"] + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + // add other dimension + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "name": "var", + "label": 1, + "type": "other" + }, + "returns": { + "type": "datacube", + "order": ["var", "t", "y", "x"], + "dimensions": { + "var": { + "type": "other", + "values": [1] + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + // throw for existing dimension + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "name": "t", + "label": "2020-01-01", + "type": "temporal" + }, + "throws": "DimensionExists" + } + ] +} diff --git a/tests/aggregate_spatial.json5 b/tests/aggregate_spatial.json5 new file mode 100644 index 00000000..ff65d6c6 --- /dev/null +++ b/tests/aggregate_spatial.json5 @@ -0,0 +1,5 @@ +{ + "id": "aggregate_spatial", + "level": "L2A", + "tests": [] +} diff --git a/tests/aggregate_spatial_window.json5 b/tests/aggregate_spatial_window.json5 new file mode 100644 index 00000000..3b96030d --- /dev/null +++ b/tests/aggregate_spatial_window.json5 @@ -0,0 +1,6 @@ +{ + "id": "aggregate_spatial_window", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/aggregate_temporal.json5 b/tests/aggregate_temporal.json5 new file mode 100644 index 00000000..a2c2e511 --- /dev/null +++ b/tests/aggregate_temporal.json5 @@ -0,0 +1,576 @@ +{ + "id": "aggregate_temporal", + "level": "L2", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xytt-no-data.json5" + }, + "intervals": [ + ["2015-01-01", "2016-01-01"], + ["2016-01-01", "2017-01-01"], + ["2017-01-01", "2018-01-01"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "throws": "TooManyDimensions" + }, + { + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "intervals": [ + ["2015-01-01", "2016-01-01"], + ["2016-01-01", "2017-01-01"], + ["2017-01-01", "2018-01-01"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "throws": "DimensionNotAvailable" + }, + { + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "intervals": [ + ["2015-01-01", "2016-01-01"], + ["2016-01-01", "2017-01-01"], + ["2017-01-01", "2018-01-01"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + }, + "dimension": "time" + }, + "throws": "DimensionNotAvailable" + }, + { + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "intervals": [ + ["2015-01-01", "2016-01-01"], + ["2017-01-01", "2016-01-01"], + ["2017-01-01", "2018-01-01"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "throws": "TemporalExtentEmpty" + }, + { + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "intervals": [ + ["2015-01-01", "2016-01-01"], + ["2015-01-01", "2017-01-01"], + ["2015-01-01", "2018-01-01"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "throws": "DistinctDimensionLabelsRequired" + }, + { + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "intervals": [ + ["2020-01-01", "2020-01-07"], + ["2020-01-07", "2020-01-14"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-01-01", + "2020-01-07" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-19.85, 32.94, -17.25, 0.82], + [20.99, 6.25, 56.07, 2.31], + [9.29, -0.70, 13.21, -10.06] + ], + [ + [29.78, 61.46, 49.70, -80.62], + [3.40, 48.45, -62.93, 61.37], + [8.78, -50.03, 78.05, 65.77] + ] + ] + } + }, + { + "required": [ + "absolute", + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "intervals": [ + ["2020-01-01T00:00:00Z", "2020-01-07T00:00:00Z"], + ["2020-01-07T00:00:00Z", "2020-01-14T00:00:00Z"], + ["2020-01-14T00:00:00Z", "2020-01-21T00:00:00Z"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + } + }, + "absolute": { + "process_id": "absolute", + "arguments": { + "x": { + "from_node": "mean" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-01-01T00:00:00Z", + "2020-01-07T00:00:00Z", + "2020-01-14T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [19.85, 32.94, 17.25, 0.82], + [20.99, 6.25, 56.07, 2.31], + [9.29, 0.70, 13.21, 10.06] + ], + [ + [29.78, 61.46, 49.70, 80.62], + [3.40, 48.45, 62.93, 61.37], + [8.78, 50.03, 78.05, 65.77] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ] + ] + } + }, + { + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "intervals": [ + ["2020-01-01T00:00:00Z", "2020-01-07T00:00:00Z"], + ["2020-01-07T00:00:00Z", "2020-01-14T00:00:00Z"], + ["2020-01-14T00:00:00Z", "2020-01-21T00:00:00Z"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + }, + "labels": [ + "W01", + "W02", + "W03" + ] + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "W01", + "W02", + "W03" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-19.85, 32.94, -17.25, 0.82], + [20.99, 6.25, 56.07, 2.31], + [9.29, -0.70, 13.21, -10.06] + ], + [ + [29.78, 61.46, 49.70, -80.62], + [3.40, 48.45, -62.93, 61.37], + [8.78, -50.03, 78.05, 65.77] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ] + ] + } + }, + { + "level": "L3", + "required": [ + "sum" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "intervals": [ + ["2020-01-01T00:00:00Z", "2020-01-07T00:00:00Z"], + ["2020-01-07T00:00:00Z", "2020-01-14T00:00:00Z"] + ], + "reducer": { + "process_graph": { + "sum": { + "process_id": "sum", + "arguments": { + "data": { + "from_parameter": "data" + }, + "ignore_nodata": { + "from_parameter": "context" + } + }, + "result": true + } + } + }, + "context": false + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-01-01T00:00:00Z", + "2020-01-07T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-59.55, 98.82, -51.74, 2.47], + [62.97, 18.75, 168.22, 6.93], + [27.86, -2.09, NaN, -30.17] + ], + [ + [59.56, NaN, 99.39, -161.24], + [6.81, NaN, -125.85, 122.74], + [17.56, -100.05, NaN, 131.53] + ] + ] + } + }, + { + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "intervals": [ + [null, "2020-01-04"], + ["2020-01-04", null] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + }, + "labels": [ + "before", + "after" + ] + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "before", + "after" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [15.387, 48.765, 47.757, -28.84], + [28.91, 61.275, -9.19, 33.04], + [-17.613, -43.36, 39.655, 45.603] + ] + ] + } + }, + { + "required": [ + "median" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "intervals": [ + ["06:00:00", "18:00:00"], + ["18:00:00", "06:00:00"] + ], + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "06:00:00", + "18:00:00" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [-12.23, 44.91, 2.38, -64.25], + [1.05, 28.45, -3.11, 51.05], + [29.5, -30.03, 25.16, 46.15] + ] + ] + } + } + ] +} diff --git a/tests/aggregate_temporal_period.json5 b/tests/aggregate_temporal_period.json5 new file mode 100644 index 00000000..3658cea2 --- /dev/null +++ b/tests/aggregate_temporal_period.json5 @@ -0,0 +1,1349 @@ +{ + "id": "aggregate_temporal_period", + "level": "L2", + "tests": [ + { + // TooManyDimensions + "arguments": { + "data": { + "$ref": "assets/xytt-no-data.json5" + }, + "period": "day", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "throws": "TooManyDimensions" + }, + { + // DimensionNotAvailable + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "period": "day", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "throws": "DimensionNotAvailable" + }, + { + // DimensionNotAvailable + "required": [ + "mean" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "period": "day", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + }, + "dimension": "time" + }, + "throws": "DimensionNotAvailable" + }, + { + // hour + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-01T00:00:00Z", + "2020-06-01T00:59:59Z", + "2020-06-01T01:00:00Z", + "2020-06-01T01:30:00Z", + "2020-06-01T04:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "hour", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-01-00", + "2020-06-02-00", + "2020-06-03-00", + "2020-06-04-00" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + // day + multiple processes + "required": [ + "mean", + "absolute" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-01T00:00:00Z", + "2020-06-01T12:00:59Z", + "2020-06-02T00:00:00Z", + "2020-06-02T12:00:00Z", + "2020-06-04T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "day", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + } + }, + "abs": { + "process_id": "absolute", + "arguments": { + "x": { + "from_node": "mean" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-01-00", + "2020-06-02-00", + "2020-06-03-00", + "2020-06-04-00" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [23.075, 31.375, 47.81, 36.125], + [8.475, 27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, 17.725] + ], + [ + [29.195, 36.07, 70.445, 0.88], + [29.185, 74.1, 19.14, 16.61], + [41.17, 42.13, 1.26, 39.27] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [12.23, 61.46, 2.38, 84.76], + [28.36, 48.45, 65.85, 65.90], + [29.50, 45.82, 78.05, 58.27] + ] + ] + } + }, + { + // week + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2022-12-06T12:00:00Z", + "2022-12-07T12:00:00Z", + "2022-12-12T00:00:00Z", + "2022-12-18T23:59:59Z", + "2023-01-01T12:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "week", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2022-49", + "2022-50", + "2022-51", + "2022-52" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + // dekad + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2024-01-28T00:00:00Z", + "2024-01-31T00:00:00Z", + "2024-02-01T00:00:00Z", + "2024-02-10T00:00:00Z", + "2024-02-29T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "dekad", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2024-03", + "2024-04", + "2024-05", + "2024-06" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + // month + different dimension name auto-detected + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t2", "y", "x"], + "dimensions": { + "t2": { + "type": "temporal", + "values": [ + "2024-01-28T00:00:00Z", + "2024-01-31T00:00:00Z", + "2024-02-01T00:00:00Z", + "2024-02-10T00:00:00Z", + "2024-04-15T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "month", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t2", "y", "x"], + "dimensions": { + "t2": { + "type": "temporal", + "values": [ + "2024-01", + "2024-02", + "2024-03", + "2024-04" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + // season + dimension = t2 + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t2", "y", "x"], + "dimensions": { + "t2": { + "type": "temporal", + "values": [ + "2023-12-28T00:00:00Z", + "2024-02-29T00:00:00Z", + "2024-03-01T00:00:00Z", + "2024-04-10T00:00:00Z", + "2024-11-30T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "season", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + }, + "dimension": "t2" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2023-djf", + "2024-mam", + "2024-jja", + "2024-son" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + // tropical-season + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t2", "y", "x"], + "dimensions": { + "t2": { + "type": "temporal", + "values": [ + "2023-11-01T00:00:00Z", + "2024-04-30T00:00:00Z", + "2024-05-01T00:00:00Z", + "2024-10-10T00:00:00Z", + "2024-11-30T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "tropical-season", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + }, + "dimension": "t2" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2023-ndjfma", + "2024-mjjaso", + "2024-ndjfma" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + // year + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-01-01T00:00:00Z", + "2020-06-01T00:00:00Z", + "2022-01-01T00:00:00Z", + "2022-12-31T00:00:00Z", + "2023-06-28T12:55:12Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + }, + "period": "year", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020", + "2021", + "2022", + "2023" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + // decade + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-01-01T00:00:00Z", + "2029-12-31T23:48:59Z", + "2030-01-01T00:00:00Z", + "2039-12-31T23:59:59Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ] + ] + }, + "period": "decade", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020", + "2030" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ] + ] + } + }, + { + // decade-ad + "required": [ + "mean" + ], + "arguments": { + "data": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-01-01T00:00:00Z", + "2021-01-01T00:00:00Z", + "2030-12-31T23:48:59Z", + "2041-01-01T00:00:00Z", + "2050-12-31T23:59:59Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ] + ] + }, + "period": "decade-ad", + "reducer": { + "process_graph": { + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2011", + "2021", + "2031", + "2041" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [-23.075, 31.375, -47.81, -36.125], + [-8.475, -27.675, 34.97, 15.275], + [49.13, 13.97, 25.16, -17.725] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [29.195, 36.07, 70.445, -0.88], + [29.185, 74.1, 19.14, 16.61], + [-41.17, -42.13, 1.26, 39.27] + ] + ] + } + } + ] +} diff --git a/tests/all.json5 b/tests/all.json5 new file mode 100644 index 00000000..4fa5bc0f --- /dev/null +++ b/tests/all.json5 @@ -0,0 +1,96 @@ +{ + "id": "all", + "level": "L2", + "tests": [ + { + "arguments": { + "data": [ + false, + {"type": "nodata"} + ] + }, + "returns": false + }, + { + "arguments": { + "data": [ + true, + {"type": "nodata"} + ] + }, + "returns": true + }, + { + "arguments": { + "data": [ + false, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": false + }, + { + "arguments": { + "data": [ + true, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + true, + false, + true, + false + ] + }, + "returns": false + }, + { + "arguments": { + "data": [ + true, + false + ] + }, + "returns": false + }, + { + "arguments": { + "data": [ + true, + true + ] + }, + "returns": true + }, + { + "arguments": { + "data": [ + true + ] + }, + "returns": true + }, + { + "arguments": { + "data": [ + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/and.json5 b/tests/and.json5 new file mode 100644 index 00000000..fe6380bf --- /dev/null +++ b/tests/and.json5 @@ -0,0 +1,69 @@ +{ + "id": "and", + "level": "L1", + "tests": [ + { + "arguments": { + "x": true, + "y": true + }, + "returns": true + }, + { + "arguments": { + "x": true, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": true, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": false, + "y": true + }, + "returns": false + }, + { + "arguments": { + "x": false, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": false, + "y": {"type": "nodata"} + }, + "returns": false + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": true + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/anomaly.json5 b/tests/anomaly.json5 new file mode 100644 index 00000000..c5ea7eb2 --- /dev/null +++ b/tests/anomaly.json5 @@ -0,0 +1,5 @@ +{ + "id": "anomaly", + "level": "L3-Clim", + "tests": [] +} diff --git a/tests/any.json5 b/tests/any.json5 new file mode 100644 index 00000000..ab480704 --- /dev/null +++ b/tests/any.json5 @@ -0,0 +1,96 @@ +{ + "id": "any", + "level": "L2", + "tests": [ + { + "arguments": { + "data": [ + false, + {"type": "nodata"} + ] + }, + "returns": false + }, + { + "arguments": { + "data": [ + true, + {"type": "nodata"} + ] + }, + "returns": true + }, + { + "arguments": { + "data": [ + false, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + true, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": true + }, + { + "arguments": { + "data": [ + true, + false, + true, + false + ] + }, + "returns": true + }, + { + "arguments": { + "data": [ + true, + false + ] + }, + "returns": true + }, + { + "arguments": { + "data": [ + false, + false + ] + }, + "returns": false + }, + { + "arguments": { + "data": [ + true + ] + }, + "returns": true + }, + { + "arguments": { + "data": [ + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/apply.json5 b/tests/apply.json5 new file mode 100644 index 00000000..f6fb3ff1 --- /dev/null +++ b/tests/apply.json5 @@ -0,0 +1,215 @@ +{ + "id": "apply", + "level": "L1", + "tests": [ + { + // single math process + "required": [ + "add" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "process": { + "process_graph": { + "add": { + "process_id": "add", + "arguments": { + "x": { + "from_parameter": "x" + }, + "y": 1 + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [18.5, 54.75, -26.1, -63.25], + [-17.0, 9.45, -2.11, -19.5], + [51.4, 50.24, 26.16, -80.6] + ], + [ + [-62.65, 10.0, -67.52, -7.0], + [2.05, -62.8, 74.05, 52.05], + [48.86, -20.30, NaN, 47.15] + ] + ] + } + }, + { + // multiple processes with a data type change + "required": [ + "lt", + "gt", + "or" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "process": { + "process_graph": { + "lt": { + "process_id": "lt", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": -50 + } + }, + "gt": { + "process_id": "gt", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": 50 + } + }, + "or": { + "process_id": "or", + "arguments": { + "x": { + "from_node": "lt" + }, + "y": { + "from_node": "gt" + } + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [false, true, false, true], + [false, false, false, false], + [true, false, false, true] + ], + [ + [true, false, true, false], + [false, true, true, true], + [false, false, NaN, false] + ] + ] + } + }, + { + // math on integers with context parameter + "level": "L3", + "required": [ + "multiply" + ], + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "process": { + "process_graph": { + "add": { + "process_id": "multiply", + "arguments": { + "x": { + "from_parameter": "x" + }, + "y": { + "from_parameter": "context" + } + }, + "result": true + } + } + }, + "context": 10 + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "green", "blue"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [1720, 470, 1170, 1920], + [670, 2510, 1950, 1030], + [90, 2110, 255, 2420] + ], + [ + [360, 870, 700, 2160], + [880, 1400, 580, 1930], + [2300, 390, 255, 870] + ], + [ + [1740, 880, 810, 1650], + [250, 770, 720, 90], + [1480, 1150, 255, 2080] + ] + ] + } + } + ] +} diff --git a/tests/apply_dimension.json5 b/tests/apply_dimension.json5 new file mode 100644 index 00000000..45c8e5bb --- /dev/null +++ b/tests/apply_dimension.json5 @@ -0,0 +1,231 @@ +{ + "id": "apply_dimension", + "level": "L1", + "tests": [ + { + "required": [ + "extrema" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "process": { + "process_graph": { + "extrema": { + "process_id": "extrema", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + }, + "dimension": "t" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-63.65, 9.0 , -68.52, -64.25], + [-18.0 , -63.8 , -3.11, -20.5 ], + [ 47.86, -21.3 , 25.16, -81.6 ] + ], + [ + [ 17.5 , 53.75, -27.1 , -8.0 ], + [ 1.05, 8.45, 73.05, 51.05], + [ 50.4 , 49.24, 25.16, 46.15] + ] + ] + } + }, + { + "required": [ + "quantiles" + ], + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "process": { + "process_graph": { + "quantiles": { + "process_id": "quantiles", + "arguments": { + "data": { + "from_parameter": "data" + }, + "probabilities": [0.5, 0.75, 0.9] + }, + "result": true + } + } + }, + "dimension": "bands", + "target_dimension": "quantiles", + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["quantiles", "y", "x"], + "dimensions": { + "quantiles": { + "type": "other", + "values": [0, 1, 2] + }, + "y": { + "type": "spatial", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [172.0, 87.0, 81.0, 192.0], + [67.0, 140.0, 72.0, 103.0], + [148.0, 115.0, NaN, 208.0] + ], + [ + [173.0, 87.5, 99.0, 204.0], + [77.5, 195.5, 133.5, 148.0], + [189.0, 163.0, NaN, 225.0] + ], + [ + [173.6, 87.8, 109.8, 211.2], + [83.8, 228.8, 170.4, 175.0], + [213.6, 191.8, NaN, 235.2] + ] + ] + } + }, + { + "required": [ + "array_create", + "max", + "mean", + "min" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "process": { + "process_graph": { + "max": { + "process_id": "max", + "arguments": { + "data": { + "from_parameter": "data" + } + } + }, + "mean": { + "process_id": "mean", + "arguments": { + "data": { + "from_parameter": "data" + } + } + }, + "min": { + "process_id": "min", + "arguments": { + "data": { + "from_parameter": "data" + } + } + }, + "array": { + "process_id": "array_create", + "arguments": { + "data": [ + { + "from_node": "min" + }, + { + "from_node": "mean" + }, + { + "from_node": "max" + } + ] + }, + "result": true + }, + } + }, + "dimension": "bands", + "target_dimension": "stats", + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "dimensions": [ + { + "name": "stats", + "type": "other", + "values": [0,1,2] + }, + { + "name": "y", + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + { + "name": "x", + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + ], + "data": [ + [ + [-63.65, 9.0, -68.52, -84.76], + [-21.55, -63.8, -65.85, -23.62], + [-70.4, -54.23, 1.26, -81.6] + ], + [ + [0.002, 40.07, 9.53, -31.754], + [13.956, 16.8, 8.474, 25.934], + [9.084, -20.428, 34.82333333333, 20.272] + ], + [ + [71.79, 61.46, 97.01, 74.72], + [79.92, 74.1, 98.28, 65.9], + [50.4 , 49.24, 78.05, 73.26] + ] + ] + } + } + ] +} diff --git a/tests/apply_kernel.json5 b/tests/apply_kernel.json5 new file mode 100644 index 00000000..fa94ee25 --- /dev/null +++ b/tests/apply_kernel.json5 @@ -0,0 +1,314 @@ +{ + "id": "apply_kernel", + "level": "L2A", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "kernel": [ + [1, 2], + [2, 4], + ] + }, + "throws": "KernelDimensionsUneven" + }, + { + // all default values + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "kernel": [ + [1, 2, 1], + [2, 4, 2], + [1, 2, 1] + ] + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [149.95, 191.59, -147.67, -355.31], + [183.69, 263.52, -83.28, -381.86], + [272.53, 343.87, 17.65, -320.19] + ], + [ + [-298.3, -281.84, -138.73, 6.11], + [-167.28, -215.91, 155.51, 358.08], + [87.14, -42.98, 183.05, 359.75] + ] + ] + } + }, + { + // border = replicate + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "kernel": [ + [1, 2, 1], + [2, 4, 2], + [1, 2, 1] + ], + "border": "replicate" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [273.2, 289.49, -212.37, -724.16], + [215.59, 263.52, -83.28, -568.71], + [555.77, 517.91, 35.61, -723.53] + ], + [ + [-606.5, -396.01, -274.77, -51.36], + [-180.97, -215.91, 155.51, 498.33], + [306.19, -37.72, 207.9, 641.55] + ] + ] + } + }, + { + // border = reflect_pixel + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "kernel": [ + [1, 2, 1], + [2, 4, 2], + [1, 2, 1] + ], + "border": "reflect_pixel" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [246.8, 187.38, -165.94, -459.84], + [303.58, 263.52, -83.28, -390.02], + [360.36, 339.66, -0.62, -320.2] + ], + [ + [-469.6, -335.34, -5.38, 190.32], + [-307.18, -215.91, 155.51, 435.66], + [-144.76, -96.48, 316.4, 681.0] + ] + ] + } + }, + { + // border = wrap + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "kernel": [ + [1, 2, 1], + [2, 4, 2], + [1, 2, 1] + ], + "border": "wrap" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [69.39, 365.63, -129.71, -425.95], + [-3.16, 263.52, -83.28, -349.96], + [113.33, 441.77, -47.05, -375.49] + ], + [ + [-142.68, -276.58, -113.88, 20.02], + [-27.03, -215.91, 155.51, 344.39], + [104.19, -157.15, 47.01, 308.35] + ] + ] + } + }, + { + // border = 1, replace_invalid = 1 + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "kernel": [ + [1, 2, 1], + [2, 4, 2], + [1, 2, 1] + ], + "border": 1, + "replace_invalid": 1 + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [156.95, 195.59, -143.67, -348.31], + [187.69, 263.52, -83.28, -377.86], + [279.53, 347.87, 21.65, -313.19] + ], + [ + [-291.3, -277.84, -134.73, 13.11], + [-163.28, -214.91, 157.51, 363.08], + [94.14, -36.98, 191.05, 368.75] + ] + ] + } + }, + { + // border = -1, replace_invalid = -1, factor = 0.11111111111 + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "kernel": [ + [1, 2, 1], + [2, 4, 2], + [1, 2, 1] + ], + "border": -1, + "replace_invalid": -1, + "factor": 0.11111111111 + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [15.88333333317, 20.84333333312, -16.85222222205, -40.25666666626], + [19.96555555536, 29.27999999971, -9.25333333324, -42.8733333329], + [29.50333333304, 37.76333333296, 1.51666666665, -36.35444444408] + ], + [ + [-33.92222222188, -31.75999999968, -15.85888888873, -0.09888888889], + [-19.03111111092, -24.10111111087, 17.0566666665, 39.23111111072], + [8.90444444436, -5.44222222217, 19.44999999981, 38.97222222183] + ] + ] + } + } + ] +} diff --git a/tests/apply_neighborhood.json5 b/tests/apply_neighborhood.json5 new file mode 100644 index 00000000..b40b12d7 --- /dev/null +++ b/tests/apply_neighborhood.json5 @@ -0,0 +1,60 @@ +{ + "id": "apply_neighborhood", + "level": "L3", + "tests": [ + { + "arguments": { + "data": { + "from_parameter": "data" + }, + "process": { + "process_graph": { + "udf": { + "process_id": "run_udf", + "arguments": { + "data": { + "from_parameter": "data" + }, + "udf": "ml.py", + "runtime": "Python" + }, + "result": true + } + } + }, + "size": [ + { + "dimension": "x", + "value": 128, + "unit": "px" + }, + { + "dimension": "y", + "value": 128, + "unit": "px" + }, + { + "dimension": "t", + "value": "P5D" + } + ], + "overlap": [ + { + "dimension": "x", + "value": 16, + "unit": "px" + }, + { + "dimension": "y", + "value": 16, + "unit": "px" + }, + { + "dimension": "t", + "value": "P3D" + } + ] + } + } + ] +} diff --git a/tests/apply_polygon.json5 b/tests/apply_polygon.json5 new file mode 100644 index 00000000..0c2f5441 --- /dev/null +++ b/tests/apply_polygon.json5 @@ -0,0 +1,6 @@ +{ + "id": "apply_polygon", + "experimental": true, + "level": "L3", + "tests": [] +} diff --git a/tests/arccos.json5 b/tests/arccos.json5 new file mode 100644 index 00000000..824352a4 --- /dev/null +++ b/tests/arccos.json5 @@ -0,0 +1,72 @@ +{ + "id": "arccos", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 1 + }, + "returns": 0 + }, + { + "arguments": { + "x": 0 + }, + "returns": 1.57079632679 + }, + { + "arguments": { + "x": -1 + }, + "returns": 3.14159265359 + }, + { + "arguments": { + "x": 0.5 + }, + "returns": 1.0471975512 + }, + { + "arguments": { + "x": -0.5 + }, + "returns": 2.09439510239 + }, + { + "arguments": { + "x": 2 + }, + "returns": NaN + }, + { + "arguments": { + "x": -2 + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/arcosh.json5 b/tests/arcosh.json5 new file mode 100644 index 00000000..3e5ecca3 --- /dev/null +++ b/tests/arcosh.json5 @@ -0,0 +1,60 @@ +{ + "id": "arcosh", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 1 + }, + "returns": 0 + }, + { + "arguments": { + "x": 2 + }, + "returns": 1.31695789692 + }, + { + "arguments": { + "x": 10 + }, + "returns": 2.99322284613 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": 0.5 + }, + "returns": NaN + }, + { + "arguments": { + "x": -1 + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/arcsin.json5 b/tests/arcsin.json5 new file mode 100644 index 00000000..2dbdced6 --- /dev/null +++ b/tests/arcsin.json5 @@ -0,0 +1,72 @@ +{ + "id": "arcsin", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1.57079632679 + }, + { + "arguments": { + "x": -1 + }, + "returns": -1.57079632679 + }, + { + "arguments": { + "x": 0.5 + }, + "returns": 0.52359877559 + }, + { + "arguments": { + "x": -0.5 + }, + "returns": -0.52359877559 + }, + { + "arguments": { + "x": 2 + }, + "returns": NaN + }, + { + "arguments": { + "x": -2 + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/arctan.json5 b/tests/arctan.json5 new file mode 100644 index 00000000..cc193566 --- /dev/null +++ b/tests/arctan.json5 @@ -0,0 +1,72 @@ +{ + "id": "arctan", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 0.7853981634 + }, + { + "arguments": { + "x": -1 + }, + "returns": -0.7853981634 + }, + { + "arguments": { + "x": 0.5 + }, + "returns": 0.463647609 + }, + { + "arguments": { + "x": -0.5 + }, + "returns": -0.463647609 + }, + { + "arguments": { + "x": 2 + }, + "returns": 1.1071487178 + }, + { + "arguments": { + "x": -2 + }, + "returns": -1.1071487178 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": 1.57079632679 + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -1.57079632679 + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/arctan2.json5 b/tests/arctan2.json5 new file mode 100644 index 00000000..e733d8bf --- /dev/null +++ b/tests/arctan2.json5 @@ -0,0 +1,153 @@ +{ + "id": "arctan2", + "level": "L2", + "tests": [ + { + "arguments": { + "y": 0, + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "y": 1, + "x": 1 + }, + "returns": 0.7853981634 + }, + { + "arguments": { + "y": 1, + "x": -1 + }, + "returns": 2.3561944902 + }, + { + "arguments": { + "y": -1, + "x": 1 + }, + "returns": -0.7853981634 + }, + { + "arguments": { + "y": -1, + "x": -1 + }, + "returns": -2.3561944902 + }, + { + "arguments": { + "y": 0, + "x": 1 + }, + "returns": 0 + }, + { + "arguments": { + "y": 0, + "x": -1 + }, + "returns": 3.1415926536 + }, + { + "arguments": { + "y": 1, + "x": 0 + }, + "returns": 1.5707963268 + }, + { + "arguments": { + "y": -1, + "x": 0 + }, + "returns": -1.5707963268 + }, + { + "arguments": { + "y": NaN, + "x": 1 + }, + "returns": NaN + }, + { + "arguments": { + "y": 1, + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "y": NaN, + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "y": Infinity, + "x": 1 + }, + "returns": 1.5707963268 + }, + { + "arguments": { + "y": 1, + "x": Infinity + }, + "returns": 0 + }, + { + "arguments": { + "y": Infinity, + "x": Infinity + }, + "returns": 0.7853981634 + }, + { + "arguments": { + "y": -Infinity, + "x": 1 + }, + "returns": -1.5707963268 + }, + { + "arguments": { + "y": 1, + "x": -Infinity + }, + "returns": 3.1415926536 + }, + { + "arguments": { + "y": -Infinity, + "x": -Infinity + }, + "returns": -2.3561944902 + }, + { + "arguments": { + "y": {"type": "nodata"}, + "x": 1 + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "y": 1, + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "y": {"type": "nodata"}, + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/array_append.json5 b/tests/array_append.json5 new file mode 100644 index 00000000..c926d5a6 --- /dev/null +++ b/tests/array_append.json5 @@ -0,0 +1,232 @@ +{ + "id": "array_append", + "level": "L3", + "tests": [ + { + "arguments": { + "data": [], + "value": 0 + }, + "returns": [ + 1 + ] + }, + { + "arguments": { + "data": [ + 1, + 2 + ], + "value": null + }, + "returns": [ + 1, + 2, + null + ] + }, + { + "arguments": { + "data": [ + 1, + 2 + ], + "value": 3 + }, + "returns": [ + 1, + 2, + 3 + ] + }, + { + "arguments": { + "data": [ + true, + false + ], + "value": true + }, + "returns": [ + true, + false, + true + ] + }, + { + "arguments": { + "data": [ + true, + false + ], + "value": null + }, + "returns": [ + true, + false, + null + ] + }, + { + "arguments": { + "data": [ + "a", + "b" + ], + "value": "c" + }, + "returns": [ + "a", + "b", + "c" + ] + }, + { + "arguments": { + "data": [ + null, + 2 + ], + "value": "3" + }, + "returns": [ + null, + 2, + "3" + ], + // mixing data types is optional + "throws": true + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "value": 4.56, + "label": "B03" + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + }, + { + "key": "B03", + "value": 4.56 + } + ] + } + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": 2, + "value": 1.23 + }, + { + "key": 3, + "value": 0.98 + } + ] + }, + "value": 4.56, + "label": 5 + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": 2, + "value": 1.23 + }, + { + "key": 3, + "value": 0.98 + }, + { + "key": 5, + "value": 4.56 + } + ] + } + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + } + ] + }, + "value": 4.56 + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": 1, + "value": 4.56 + } + ] + } + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "value": 4.56, + "label": "B01" + }, + "throws": "LabelExists" + }, + { + "arguments": { + "data": [ + 1, + 2, + 3 + ], + "value": 4, + "label": "B01" + }, + "throws": "ArrayNotLabeled" + } + ] +} diff --git a/tests/array_apply.json5 b/tests/array_apply.json5 new file mode 100644 index 00000000..827e2189 --- /dev/null +++ b/tests/array_apply.json5 @@ -0,0 +1,339 @@ +{ + "id": "array_apply", + "level": "L3", + "tests": [ + { + // empty array + "required": [ + "absolute" + ], + "arguments": { + "data": [], + "process": { + "process_graph": { + "absolute": { + "process_id": "absolute", + "arguments": { + "x": { + "from_argument": "x" + } + }, + "result": true + } + } + } + }, + "returns": [] + }, + { + // single math process applied to a normal array + "required": [ + "absolute" + ], + "arguments": { + "data": [ + 1, + -2, + 3.5, + -4.725, + NaN + ], + "process": { + "process_graph": { + "absolute": { + "process_id": "absolute", + "arguments": { + "x": { + "from_argument": "x" + } + }, + "result": true + } + } + } + }, + "returns": [ + 1, + 2, + 3.5, + 4.725, + NaN + ] + }, + { + // single math process applied to a normal array, with context parameter + "required": [ + "multiply" + ], + "arguments": { + "data": [ + 1, + 2.5 + ], + "process": { + "process_graph": { + "multiply": { + "process_id": "multiply", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": { + "from_argument": "context" + } + }, + "result": true + } + } + }, + "context": 2.5 + }, + "returns": [ + 2.5, + 6.25 + ] + }, + { + // single comparison process with datatype change applied to a normal array + "required": [ + "gt" + ], + "arguments": { + "data": [ + 1, + -2, + 3.5, + -4.725, + NaN + ], + "process": { + "process_graph": { + "gt": { + "process_id": "gt", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": 1 + }, + "result": true + } + } + } + }, + "returns": [ + false, + false, + true, + false, + false + ] + }, + { + // handle index from a normal array + "required": [ + "constant" + ], + "arguments": { + "data": [ + 1, + 2, + 3, + 4 + ], + "process": { + "process_graph": { + "const": { + "process_id": "constant", + "arguments": { + "x": { + "from_argument": "index" + } + }, + "result": true + } + } + } + }, + "returns": [ + 0, + 1, + 2, + 3 + ] + }, + { + // handle label from a labeled array + "required": [ + "constant" + ], + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "process": { + "process_graph": { + "const": { + "process_id": "constant", + "arguments": { + "x": { + "from_argument": "label" + } + }, + "result": true + } + } + } + }, + "returns": [ + "B01", + "B02" + ] + }, + { + // handle index and value from a labeled array + "required": [ + "add" + ], + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "process": { + "process_graph": { + "add": { + "process_id": "add", + "arguments": { + "x": { + "from_argument": "index" + }, + "y": { + "from_argument": "x" + } + }, + "result": true + } + } + } + }, + "returns": [ + 1.23, + 1.98 + ] + }, + { + // single math process applied to a labeled array + "required": [ + "subtract" + ], + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "process": { + "process_graph": { + "subtract": { + "process_id": "subtract", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": 1 + }, + "result": true + } + } + } + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 0.23 + }, + { + "key": "B02", + "value": -0.02 + } + ] + } + }, + { + // apply multiple math process to a labeled array + "required": [ + "add", + "multiply" + ], + "arguments": { + "data": [ + 1, + -2, + 3.5, + -4.725, + NaN + ], + "process": { + "process_graph": { + "add": { + "process_id": "add", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": 1.5 + } + }, + "mulitply": { + "process_id": "mulitply", + "arguments": { + "x": { + "from_node": "add" + }, + "y": 2 + }, + "result": true + } + } + } + }, + "returns": [ + 5, + -1, + 10, + 6.45, + NaN + ] + } + ] +} diff --git a/tests/array_concat.json5 b/tests/array_concat.json5 new file mode 100644 index 00000000..b045b185 --- /dev/null +++ b/tests/array_concat.json5 @@ -0,0 +1,150 @@ +{ + "id": "array_concat", + "level": "L1", + "tests": [ + { + // Adds an empty array + "arguments": { + "array1": [ + 1 + ], + "array2": [] + }, + "returns": [ + 1 + ] + }, + { + // Adds to an empty array + "arguments": { + "array1": [], + "array2": [ + 1 + ] + }, + "returns": [ + 1 + ] + }, + { + // Concatenates two numerical arrays. + "arguments": { + "array1": [ + 1.5, + 2.5 + ], + "array2": [ + 5 + ] + }, + "returns": [ + 1.5, + 2.5, + 5 + ] + }, + { + // Concatenates two arrays containing different data type + "arguments": { + "array1": [ + "a", + "b" + ], + "array2": [ + 1, + 2 + ] + }, + "returns": [ + "a", + "b", + 1, + 2 + ], + // May not always be supported + "throws": true + }, + { + // Check that a normal array and a labeled array lead to a normal array (labels get dropped) + "level": "L3", + "arguments": { + "array1": [ + 1, + 2 + ], + "array2": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 3 + }, + { + "key": "B02", + "value": 4 + } + ] + } + }, + "returns": [ + 1, + 2, + 3, + 4 + ] + }, + { + // Check that a labeled arrays are supported + "level": "L3", + "arguments": { + "array1": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1 + }, + { + "key": "B02", + "value": 2 + } + ] + }, + "array2": { + "type": "labeled-array", + "data": [ + { + "key": "B03", + "value": 3 + }, + { + "key": "B04", + "value": 4 + } + ] + } + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1 + }, + { + "key": "B02", + "value": 2 + }, + { + "key": "B03", + "value": 3 + }, + { + "key": "B04", + "value": 4 + } + ] + } + } + ] +} diff --git a/tests/array_contains.json5 b/tests/array_contains.json5 new file mode 100644 index 00000000..d454f019 --- /dev/null +++ b/tests/array_contains.json5 @@ -0,0 +1,86 @@ +{ + "id": "array_contains", + "level": "L3", + "tests": [ + { + "arguments": { + "data": [ + 1, + 2, + 3 + ], + "value": 2 + }, + "returns": true + }, + { + "arguments": { + "data": [ + "A", + "B", + "C" + ], + "value": "b" + }, + "returns": false + }, + { + "arguments": { + "data": [ + false, + false + ], + "value": false + }, + "returns": true + }, + { + "arguments": { + "data": [ + true, + true + ], + "value": false + }, + "returns": false + }, + { + "arguments": { + "data": [ + 1, + 2, + 3 + ], + "value": "2" + }, + "returns": false + }, + { + "arguments": { + "data": [ + 1, + 2, + null + ], + "value": null + }, + "returns": false + }, + { + "arguments": { + "data": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "value": 2 + }, + "returns": false + } + ] +} diff --git a/tests/array_create.json5 b/tests/array_create.json5 new file mode 100644 index 00000000..1e29f80e --- /dev/null +++ b/tests/array_create.json5 @@ -0,0 +1,57 @@ +{ + "id": "array_create", + "level": "L1", + "tests": [ + { + "arguments": {}, + "returns": [] + }, + { + "arguments": { + "data": [ + "this", + "is", + "a", + "test" + ] + }, + "returns": [ + "this", + "is", + "a", + "test" + ] + }, + { + "arguments": { + "data": [ + null + ], + "repeat": 3 + }, + "returns": [ + null, + null, + null + ] + }, + { + "arguments": { + "data": [ + 1, + 2, + 3 + ], + "repeat": 2 + }, + "returns": [ + 1, + 2, + 3, + 1, + 2, + 3 + ] + } + ] +} diff --git a/tests/array_create_labeled.json5 b/tests/array_create_labeled.json5 new file mode 100644 index 00000000..1b9a0d42 --- /dev/null +++ b/tests/array_create_labeled.json5 @@ -0,0 +1,91 @@ +{ + "id": "array_create_labeled", + "level": "L3", + "experimental": true, + "tests": [ + // empty array + { + "arguments": { + "data": [], + "labels": [] + }, + "returns": { + "type": "labeled-array", + "data": [] + } + }, + { + "arguments": { + "data": [1.23, 0.98], + "labels": ["B01", "B02"] + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + } + }, + { + "arguments": { + "data": [5,6,7,NaN], + "labels": [8,7,5,4] + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": 8, + "value": 5 + }, + { + "key": 7, + "value": 6 + }, + { + "key": 5, + "value": 7 + }, + { + "key": 4, + "value": NaN + }, + ] + } + }, + { + "arguments": { + "data": [true, false], + "labels": [1, "2"] + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": 1, + "value": true + }, + { + "key": "2", + "value": false + } + ] + } + }, + { + // mismatch of array lengths + "arguments": { + "data": [1], + "labels": [1,2], + }, + "throws": "ArrayLengthMismatch" + } + ] +} diff --git a/tests/array_element.json5 b/tests/array_element.json5 new file mode 100644 index 00000000..b084d0d2 --- /dev/null +++ b/tests/array_element.json5 @@ -0,0 +1,185 @@ +{ + "id": "array_element", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 9, + 8, + 7, + 6, + 5 + ], + "index": 2 + }, + "returns": 7 + }, + { + "arguments": { + "data": [ + "A", + "B", + "C" + ], + "index": 0 + }, + "returns": "A" + }, + { + "arguments": { + "data": [], + "index": 0, + "return_nodata": true + }, + "returns": {"type": "nodata"} + }, + { + "level": "L2", + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 4 + }, + { + "key": "B02", + "value": 5 + }, + { + "key": "B03", + "value": 6 + } + ] + }, + "label": "BO2" + }, + "returns": 5 + }, + { + "arguments": { + "data": [ + 1 + ] + }, + "throws": "ArrayElementParameterMissing" + }, + { + "level": "L2", + "arguments": { + "data": [ + 1 + ], + "index": 0, + "label": 0 + }, + "throws": "ArrayElementParameterConflict" + }, + { + "arguments": { + "data": [ + 1, + 2 + ], + "index": 2 + }, + "throws": "ArrayElementNotAvailable" + }, + { + "arguments": { + "data": [ + 1, + 2 + ], + "index": -1 + }, + "throws": "ArrayElementNotAvailable" + }, + { + "level": "L2", + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 4 + }, + { + "key": "B02", + "value": 5 + }, + { + "key": "B03", + "value": 6 + } + ] + }, + "label": "BO4" + }, + "throws": "ArrayElementNotAvailable" + }, + { + "arguments": { + "data": [ + 1, + 2 + ], + "index": 2, + "return_nodata": true + }, + "returns": {"type": "nodata"} + }, + { + "level": "L2", + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 4 + }, + { + "key": "B02", + "value": 5 + }, + { + "key": "B03", + "value": 6 + } + ] + }, + "label": "BO4", + "return_nodata": true + }, + "returns": {"type": "nodata"} + }, + { + "level": "L2", + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": 1, + "value": 4 + }, + { + "key": 2, + "value": 5 + }, + { + "key": 3, + "value": 6 + } + ] + }, + "label": 1 + }, + "returns": 4 + } + ] +} diff --git a/tests/array_filter.json5 b/tests/array_filter.json5 new file mode 100644 index 00000000..46e6d23e --- /dev/null +++ b/tests/array_filter.json5 @@ -0,0 +1,276 @@ +{ + "id": "array_filter", + "level": "L3", + "tests": [ + { + // empty array + "required": [ + "gt" + ], + "arguments": { + "data": [], + "process": { + "process_graph": { + "gt": { + "process_id": "gt", + "arguments": { + "x": { + "from_argument": "x" + }, + "x": 3 + }, + "result": true + } + } + } + }, + "returns": [] + }, + { + // single comparison process applied to a normal array + "required": [ + "gt" + ], + "arguments": { + "data": [ + 1, + -2, + 3.5, + -4.725, + NaN + ], + "process": { + "process_graph": { + "gt": { + "process_id": "gt", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": 1 + }, + "result": true + } + } + } + }, + "returns": [ + 3.5 + ] + }, + { + // handle index from a normal array + "required": [ + "lt" + ], + "arguments": { + "data": [ + 1, + 2, + 3, + 4 + ], + "process": { + "process_graph": { + "lt": { + "process_id": "lte", + "arguments": { + "x": { + "from_argument": "index" + }, + "y": 2 + }, + "result": true + } + } + } + }, + "returns": [ + 1, + 2, + 3 + ] + }, + { + // handle label from a labeled array + "required": [ + "eq" + ], + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "process": { + "process_graph": { + "eq": { + "process_id": "eq", + "arguments": { + "x": { + "from_argument": "label" + }, + "y": "B02" + }, + "result": true + } + } + } + }, + "returns": [ + { + "key": "B02", + "value": 0.98 + } + ] + }, + { + // handle index from a labeled array + "required": [ + "eq" + ], + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "process": { + "process_graph": { + "eq": { + "process_id": "eq", + "arguments": { + "x": { + "from_argument": "index" + }, + "y": 0 + }, + "result": true + } + } + } + }, + "returns": [ + { + "key": "B01", + "value": 1.23 + } + ] + }, + { + // single math process applied to a labeled array + "required": [ + "gt" + ], + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "process": { + "process_graph": { + "const": { + "process_id": "subtract", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": 1 + }, + "result": true + } + } + } + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + } + ] + } + }, + { + // apply multiple math process to a labeled array + "required": [ + "lt", + "gt", + "or" + ], + "arguments": { + "data": [ + 1, + -2, + 3.5, + -4.725, + NaN + ], + "process": { + "process_graph": { + "lt": { + "process_id": "lt", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": -2 + } + }, + "gt": { + "process_id": "gt", + "arguments": { + "x": { + "from_argument": "x" + }, + "y": 2 + } + }, + "or": { + "process_id": "or", + "arguments": { + "x": { + "from_node": "lt" + }, + "y": { + "from_node": "gt" + } + }, + "result": true + } + } + } + }, + "returns": [ + 3.5, + -4.725 + ] + } + ] +} diff --git a/tests/array_find.json5 b/tests/array_find.json5 new file mode 100644 index 00000000..0d7ebf08 --- /dev/null +++ b/tests/array_find.json5 @@ -0,0 +1,168 @@ +{ + "id": "array_find", + "level": "L2", + "tests": [ + { + "arguments": { + "data": [ + 1, + 2, + 3, + 2, + 3 + ], + "value": 2 + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + 1, + 2, + 3, + 2, + 3 + ], + "value": 2, + "reverse": true + }, + "returns": 3 + }, + { + "arguments": { + "data": [ + "A", + "B", + "C" + ], + "value": "b" + }, + "returns": null + }, + { + "arguments": { + "data": [ + false, + false + ], + "value": false + }, + "returns": 0 + }, + { + "arguments": { + "data": [ + false, + false + ], + "value": false, + "reverse": true + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + true, + true + ], + "value": false + }, + "returns": null + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B03", + "value": 3 + }, + { + "key": "B04", + "value": 4 + } + ] + }, + "value": 3 + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + 1, + 2, + 3 + ], + "value": "2" + }, + "returns": null + }, + { + "arguments": { + "data": [ + 1, + {"type": "nodata"}, + 2, + {"type": "nodata"} + ], + "value": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "value": [ + 1, + 2 + ] + }, + "returns": null + }, + { + "arguments": { + "data": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "value": 2 + }, + "returns": null + }, + { + "arguments": { + "data": [ + { + "a": "b" + }, + { + "c": "d" + } + ], + "value": { + "a": "b" + } + }, + "returns": null + } + ] +} diff --git a/tests/array_find_label.json5 b/tests/array_find_label.json5 new file mode 100644 index 00000000..aff40f08 --- /dev/null +++ b/tests/array_find_label.json5 @@ -0,0 +1,101 @@ +{ + "id": "array_find_label", + "level": "L3", + "experimental": true, + "tests": [ + { + "arguments": { + "data": [ + 1, + 2 + ], + "label": 1 + }, + "returns": null + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "label": "B01" + }, + "returns": 0 + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + ] + }, + "label": "B02" + }, + "returns": 1 + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": 2, + "value": 1.23 + }, + { + "key": 3, + "value": 0.98 + }, + { + "key": 4, + "value": 2.75 + } + ] + }, + "label": 4 + }, + "returns": 2 + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": 2, + "value": 1.23 + }, + { + "key": 3, + "value": 0.98 + }, + { + "key": 4, + "value": 2.75 + } + ] + }, + "label": 1 + }, + "returns": null + } + ] +} diff --git a/tests/array_interpolate_linear.json5 b/tests/array_interpolate_linear.json5 new file mode 100644 index 00000000..84e37d07 --- /dev/null +++ b/tests/array_interpolate_linear.json5 @@ -0,0 +1,174 @@ +{ + "id": "array_interpolate_linear", + "level": "L3", + "tests": [ + { + "arguments": { + "data": [ + {"type": "nodata"}, + 1, + {"type": "nodata"}, + 6, + {"type": "nodata"}, + -8, + ] + }, + "returns": [ + {"type": "nodata"}, + 1, + 3.5, + 6, + -1, + -8 + ] + }, + { + "arguments": { + "data": [ + 1, + NaN, + 6, + NaN, + -8, + NaN, + ] + }, + "returns": [ + 1, + 3.5, + 6, + -1, + -8, + NaN + ] + }, + { + "arguments": { + "data": [ + -Infinity, + NaN, + 0.1, + NaN, + 0.2, + NaN, + Infinity + ] + }, + "returns": [ + -Infinity, + -Infinity, + 0.1, + 0.15, + 0.2, + Infinity, + Infinity + ] + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + 1, + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": [ + {"type": "nodata"}, + 1, + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": [ + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "a", + "value": 1.0 + }, + { + "key": "b", + "value": NaN + }, + { + "key": "c", + "value": 2.0 + } + ] + } + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": "a", + "value": 1.0 + }, + { + "key": "b", + "value": 1.5 + }, + { + "key": "c", + "value": 2.0 + } + ] + } + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": 1, + "value": 1.0 + }, + { + "key": 3, + "value": {"type": "nodata"} + }, + { + "key": 4, + "value": 4.0 + } + ] + } + }, + "returns": { + "type": "labeled-array", + "data": [ + { + "key": 1, + "value": 1.0 + }, + { + "key": 3, + "value": 3.0 + }, + { + "key": 4, + "value": 4.0 + } + ] + } + } + ] +} diff --git a/tests/array_labels.json5 b/tests/array_labels.json5 new file mode 100644 index 00000000..e8da177e --- /dev/null +++ b/tests/array_labels.json5 @@ -0,0 +1,70 @@ +{ + "id": "array_labels", + "level": "L3", + "tests": [ + { + "arguments": { + "data": [] + }, + "returns": [] + }, + { + "arguments": { + "data": [ + 1, + 2, + 3, + null + ] + }, + "returns": [ + 0, + 1, + 2, + 3 + ] + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 3 + }, + { + "key": "B02", + "value": 4 + } + ] + } + }, + "returns": [ + "B01", + "B02" + ] + }, + { + "arguments": { + "data": { + "type": "labeled-array", + "data": [ + { + "key": 1, + "value": 3 + }, + { + "key": 2, + "value": 4 + } + ] + } + }, + "returns": [ + 1, + 2 + ] + } + ] +} diff --git a/tests/array_modify.json5 b/tests/array_modify.json5 new file mode 100644 index 00000000..adf1c579 --- /dev/null +++ b/tests/array_modify.json5 @@ -0,0 +1,124 @@ +{ + "id": "array_modify", + "level": "L3", + "experimental": true, + "tests": [ + { + // Replace a single value in the array. + "arguments": { + "data": [ + "a", + "d", + "c" + ], + "values": [ + "b" + ], + "index": 1, + "length": 1 + }, + "returns": [ + "a", + "b", + "c" + ] + }, + { + // Replace multiple values in the array. + "arguments": { + "data": [ + "a", + "b", + 4, + 5 + ], + "values": [ + 1, + 2, + 3 + ], + "index": 0, + "length": 2 + }, + "returns": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + { + // Insert a value to the array at a given position. + "arguments": { + "data": [ + "a", + "c" + ], + "values": [ + "b" + ], + "index": 1 + }, + "returns": [ + "a", + "b", + "c" + ] + }, + { + // Remove a single value from the array. + "arguments": { + "data": [ + "a", + "b", + null, + "c" + ], + "values": [], + "index": 2 + }, + "returns": [ + "a", + "b", + "c" + ] + }, + { + // Remove multiple values from the array. + "arguments": { + "data": [ + null, + null, + "a", + "b", + "c" + ], + "values": [], + "index": 0, + "length": 2 + }, + "returns": [ + "a", + "b", + "c" + ] + }, + { + // Remove multiple values from the end of the array and ignore that the given length is exceeding the size of the array. + "arguments": { + "data": [ + "a", + "b", + "c" + ], + "values": [], + "index": 1, + "length": 10 + }, + "returns": [ + "a" + ] + } + ] +} diff --git a/tests/arsinh.json5 b/tests/arsinh.json5 new file mode 100644 index 00000000..0a169969 --- /dev/null +++ b/tests/arsinh.json5 @@ -0,0 +1,60 @@ +{ + "id": "arsinh", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 0.88137358702 + }, + { + "arguments": { + "x": -1 + }, + "returns": -0.88137358702 + }, + { + "arguments": { + "x": 2 + }, + "returns": 1.44363547518 + }, + { + "arguments": { + "x": -2 + }, + "returns": -1.44363547518 + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/artanh.json5 b/tests/artanh.json5 new file mode 100644 index 00000000..43fa89b2 --- /dev/null +++ b/tests/artanh.json5 @@ -0,0 +1,72 @@ +{ + "id": "artanh", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 0.5 + }, + "returns": 0.54930614433 + }, + { + "arguments": { + "x": -0.5 + }, + "returns": -0.54930614433 + }, + { + "arguments": { + "x": 1 + }, + "returns": Infinity + }, + { + "arguments": { + "x": -1 + }, + "returns": -Infinity + }, + { + "arguments": { + "x": 2 + }, + "returns": NaN + }, + { + "arguments": { + "x": -2 + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/assets/epsg25832.wkt2 b/tests/assets/epsg25832.wkt2 new file mode 100644 index 00000000..fd907a46 --- /dev/null +++ b/tests/assets/epsg25832.wkt2 @@ -0,0 +1,50 @@ +PROJCRS["ETRS89 / UTM zone 32N", + BASEGEOGCRS["ETRS89", + ENSEMBLE["European Terrestrial Reference System 1989 ensemble", + MEMBER["European Terrestrial Reference Frame 1989"], + MEMBER["European Terrestrial Reference Frame 1990"], + MEMBER["European Terrestrial Reference Frame 1991"], + MEMBER["European Terrestrial Reference Frame 1992"], + MEMBER["European Terrestrial Reference Frame 1993"], + MEMBER["European Terrestrial Reference Frame 1994"], + MEMBER["European Terrestrial Reference Frame 1996"], + MEMBER["European Terrestrial Reference Frame 1997"], + MEMBER["European Terrestrial Reference Frame 2000"], + MEMBER["European Terrestrial Reference Frame 2005"], + MEMBER["European Terrestrial Reference Frame 2014"], + ELLIPSOID["GRS 1980",6378137,298.257222101, + LENGTHUNIT["metre",1]], + ENSEMBLEACCURACY[0.1]], + PRIMEM["Greenwich",0, + ANGLEUNIT["degree",0.0174532925199433]], + ID["EPSG",4258]], + CONVERSION["UTM zone 32N", + METHOD["Transverse Mercator", + ID["EPSG",9807]], + PARAMETER["Latitude of natural origin",0, + ANGLEUNIT["degree",0.0174532925199433], + ID["EPSG",8801]], + PARAMETER["Longitude of natural origin",9, + ANGLEUNIT["degree",0.0174532925199433], + ID["EPSG",8802]], + PARAMETER["Scale factor at natural origin",0.9996, + SCALEUNIT["unity",1], + ID["EPSG",8805]], + PARAMETER["False easting",500000, + LENGTHUNIT["metre",1], + ID["EPSG",8806]], + PARAMETER["False northing",0, + LENGTHUNIT["metre",1], + ID["EPSG",8807]]], + CS[Cartesian,2], + AXIS["(E)",east, + ORDER[1], + LENGTHUNIT["metre",1]], + AXIS["(N)",north, + ORDER[2], + LENGTHUNIT["metre",1]], + USAGE[ + SCOPE["Engineering survey, topographic mapping."], + AREA["Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore."], + BBOX[38.76,6,84.33,12.01]], + ID["EPSG",25832]] \ No newline at end of file diff --git a/tests/assets/xyb-enumerated-bands.json5 b/tests/assets/xyb-enumerated-bands.json5 new file mode 100644 index 00000000..ec3b4d08 --- /dev/null +++ b/tests/assets/xyb-enumerated-bands.json5 @@ -0,0 +1,41 @@ +{ + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": [0, 1, 2] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "order": ["bands", "y", "x"], + "data": [ + [ + [172, 47, 117, 192], + [67, 251, 195, 103], + [9, 211, 255, 242] + ], + [ + [36, 87, 70, 216], + [88, 140, 58, 193], + [230, 39, 255, 87] + ], + [ + [174, 88, 81, 165], + [25, 77, 72, 9], + [148, 115, 255, 208] + ] + ] +} diff --git a/tests/assets/xyb-mask-one-band.json5 b/tests/assets/xyb-mask-one-band.json5 new file mode 100644 index 00000000..26049736 --- /dev/null +++ b/tests/assets/xyb-mask-one-band.json5 @@ -0,0 +1,29 @@ +{ + "type": "datacube", + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["mask"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [1, 1, 1, 1], + [1, 0, 0, 1], + [0, 0, 1, 0] + ] + ] +} diff --git a/tests/assets/xyb-mask.json5 b/tests/assets/xyb-mask.json5 new file mode 100644 index 00000000..a067b55e --- /dev/null +++ b/tests/assets/xyb-mask.json5 @@ -0,0 +1,23 @@ +{ + "type": "datacube", + "order": ["y", "x"], + "dimensions": { + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [1, 1, 1, 1], + [1, 0, 0, 1], + [0, 0, 1, 0] + ] +} diff --git a/tests/assets/xyb-minimal-int.json5 b/tests/assets/xyb-minimal-int.json5 new file mode 100644 index 00000000..63e17194 --- /dev/null +++ b/tests/assets/xyb-minimal-int.json5 @@ -0,0 +1,40 @@ +{ + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "green", "blue"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [172, 47, 117, 192], + [67, 251, 195, 103], + [9, 211, 255, 242] + ], + [ + [36, 87, 70, 216], + [88, 140, 58, 193], + [230, 39, 255, 87] + ], + [ + [174, 88, 81, 255], + [25, 77, 72, 9], + [148, 115, 255, 208] + ] + ] +} diff --git a/tests/assets/xyt-minimal-float.json5 b/tests/assets/xyt-minimal-float.json5 new file mode 100644 index 00000000..0b2a27bc --- /dev/null +++ b/tests/assets/xyt-minimal-float.json5 @@ -0,0 +1,35 @@ +{ + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ] + ] +} diff --git a/tests/assets/xyt-more-timestamps.json5 b/tests/assets/xyt-more-timestamps.json5 new file mode 100644 index 00000000..02d08c5e --- /dev/null +++ b/tests/assets/xyt-more-timestamps.json5 @@ -0,0 +1,56 @@ +{ + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-01T00:00:00Z", + "2020-06-03T00:00:00Z", + "2020-06-05T00:00:00Z", + "2020-06-07T00:00:00Z", + "2020-06-09T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] +} diff --git a/tests/assets/xytb-s2-small-filtered.json5 b/tests/assets/xytb-s2-small-filtered.json5 new file mode 100644 index 00000000..45ef6711 --- /dev/null +++ b/tests/assets/xytb-s2-small-filtered.json5 @@ -0,0 +1,157 @@ +{ + "type": "datacube", + "nodata": NaN, + "order": ["bands", "t", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["blue", "green", "red", "nir"], + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z", "2020-06-06T00:00:00Z", "2020-06-08T00:00:00Z", "2020-06-11T00:00:00Z", "2020-06-13T00:00:00Z"], + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404865.0, 404875.0, 404885.0, 404895.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [ + [1037.0, 1087.0, 1124.0, 1197.0], + [921.0, 1030.0, 1051.0, 1138.0], + [793.0, 796.0, 795.0, 905.0] + ], + [ + [2006.0, 2005.0, 2000.0, 2015.0], + [1969.0, 1965.0, 1979.0, 2025.0], + [1950.0, 1963.0, 1988.0, 2021.0] + ], + [ + [6379.0, 6360.0, 6253.0, 6205.0], + [6261.0, 5995.0, 5545.0, 5389.0], + [6016.0, 5738.0, 5521.0, 5135.0] + ], + [ + [7246.0, 7317.0, 7301.0, 7279.0], + [7303.0, 7281.0, 7292.0, 7320.0], + [7288.0, 7258.0, 7270.0, 7282.0] + ], + [ + [1714.0, 1785.0, 1908.0, 1998.0], + [1561.0, 1690.0, 1840.0, 1930.0], + [1523.0, 1646.0, 1757.0, 1789.0] + ], + [ + [1083.0, 1250.0, 1207.0, 1302.0], + [1006.0, 1114.0, 1102.0, 1227.0], + [962.0, 958.0, 950.0, 1054.0] + ] + ], + [ + [ + [971.0, 983.0, 1030.0, 1071.0], + [806.0, 886.0, 850.0, 962.0], + [636.0, 627.0, 591.0, 795.0] + ], + [ + [1905.0, 1914.0, 1900.0, 1891.0], + [1778.0, 1801.0, 1816.0, 1834.0], + [1772.0, 1764.0, 1765.0, 1811.0] + ], + [ + [6301.0, 6300.0, 6244.0, 6295.0], + [6162.0, 6154.0, 6128.0, 6053.0], + [5847.0, 5532.0, 5515.0, 5408.0] + ], + [ + [6802.0, 6809.0, 6799.0, 6767.0], + [6844.0, 6853.0, 6837.0, 6820.0], + [6871.0, 6876.0, 6867.0, 6839.0] + ], + [ + [1703.0, 1729.0, 1795.0, 1793.0], + [1435.0, 1508.0, 1638.0, 1746.0], + [1329.0, 1466.0, 1576.0, 1645.0] + ], + [ + [997.0, 1091.0, 1079.0, 1120.0], + [847.0, 935.0, 927.0, 1025.0], + [796.0, 765.0, 765.0, 851.0] + ] + ], + [ + [ + [789.0, 911.0, 943.0, 974.0], + [560.0, 726.0, 714.0, 877.0], + [407.0, 452.0, 439.0, 568.0] + ], + [ + [1947.0, 1890.0, 1848.0, 1828.0], + [1916.0, 1877.0, 1838.0, 1814.0], + [1867.0, 1822.0, 1788.0, 1791.0] + ], + [ + [6921.0, 7022.0, 7121.0, 7217.0], + [6845.0, 6790.0, 6874.0, 6936.0], + [6706.0, 6719.0, 6627.0, 6561.0] + ], + [ + [7125.0, 7102.0, 7102.0, 7058.0], + [7113.0, 7099.0, 7116.0, 7092.0], + [7176.0, 7158.0, 7156.0, 7119.0] + ], + [ + [1759.0, 1888.0, 1824.0, 1704.0], + [1336.0, 1417.0, 1541.0, 1647.0], + [1205.0, 1313.0, 1464.0, 1555.0] + ], + [ + [727.0, 948.0, 960.0, 1034.0], + [573.0, 726.0, 698.0, 851.0], + [523.0, 513.0, 516.0, 643.0] + ] + ], + [ + [ + [2705.0, 2019.0, 1872.0, 1629.0], + [2523.0, 1632.0, 1478.0, 1443.0], + [2458.0, 1504.0, 1206.0, 1287.0] + ], + [ + [2868.0, 2787.0, 2729.0, 2676.0], + [2908.0, 2782.0, 2691.0, 2662.0], + [2955.0, 2808.0, 2771.0, 2785.0] + ], + [ + [7451.0, 7567.0, 7565.0, 7595.0], + [7338.0, 7169.0, 7027.0, 6983.0], + [7022.0, 6554.0, 6165.0, 6084.0] + ], + [ + [7470.0, 7410.0, 7424.0, 7407.0], + [7474.0, 7467.0, 7456.0, 7470.0], + [7487.0, 7485.0, 7487.0, 7515.0] + ], + [ + [2862.0, 2772.0, 2746.0, 2716.0], + [2788.0, 2613.0, 2631.0, 2723.0], + [2916.0, 2607.0, 2618.0, 2641.0] + ], + [ + [3151.0, 2241.0, 2058.0, 1645.0], + [2592.0, 1917.0, 1577.0, 1408.0], + [2851.0, 2079.0, 1787.0, 1753.0] + ] + ] + ] +} diff --git a/tests/assets/xytb-s2-small-masked-inside.json5 b/tests/assets/xytb-s2-small-masked-inside.json5 new file mode 100644 index 00000000..fd4c1857 --- /dev/null +++ b/tests/assets/xytb-s2-small-masked-inside.json5 @@ -0,0 +1,257 @@ +{ + "type": "datacube", + "nodata": NaN, + "order": ["bands", "t", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["blue", "green", "red", "nir"] + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z", "2020-06-06T00:00:00Z", "2020-06-08T00:00:00Z", "2020-06-11T00:00:00Z", "2020-06-13T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0, 5757465.0, 5757455.0, 5757445.0, 5757435.0, 5757425.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0, 404875.0, 404885.0, 404895.0, 404905.0, 404915.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [ + [770.0, 780.0, 838.0, NaN, NaN, NaN, NaN, 1182.0, 1014.0], + [860.0, 799.0, 778.0, NaN, NaN, NaN, NaN, 1059.0, 1044.0], + [1007.0, 815.0, 775.0, NaN, NaN, NaN, NaN, 1043.0, 1098.0], + [956.0, 898.0, 782.0, 774.0, 774.0, 804.0, 831.0, 995.0, 1023.0], + [882.0, 1105.0, 946.0, 760.0, 805.0, 839.0, 870.0, 951.0, 1010.0], + [816.0, 964.0, 1132.0, 849.0, 798.0, 835.0, 980.0, 1012.0, 1015.0], + [844.0, 864.0, 1079.0, 929.0, 804.0, 817.0, 1004.0, 1074.0, 1144.0], + [832.0, 816.0, 893.0, 956.0, 807.0, 793.0, 875.0, 1106.0, 1200.0] + ],[ + [2049.0, 2006.0, 1990.0, NaN, NaN, NaN, NaN, 2015.0, 2027.0], + [2041.0, 2013.0, 1979.0, NaN, NaN, NaN, NaN, 2032.0, 2012.0], + [2005.0, 2009.0, 1979.0, NaN, NaN, NaN, NaN, 2049.0, 2051.0], + [1997.0, 1999.0, 1996.0, 1976.0, 2021.0, 2026.0, 2055.0, 2087.0, 2088.0], + [1970.0, 1990.0, 2025.0, 2027.0, 2039.0, 2057.0, 2090.0, 2094.0, 2115.0], + [1964.0, 1971.0, 2044.0, 2107.0, 2094.0, 2099.0, 2135.0, 2155.0, 2159.0], + [1963.0, 1977.0, 2059.0, 2132.0, 2137.0, 2146.0, 2181.0, 2203.0, 2182.0], + [1980.0, 2029.0, 2067.0, 2156.0, 2175.0, 2183.0, 2189.0, 2196.0, 2187.0] + ],[ + [5465.0, 5864.0, 6180.0, NaN, NaN, NaN, NaN, 6092.0, 5834.0], + [5736.0, 6040.0, 6264.0, NaN, NaN, NaN, NaN, 5386.0, 5362.0], + [6038.0, 6265.0, 6324.0, NaN, NaN, NaN, NaN, 5033.0, 5271.0], + [6145.0, 6245.0, 6098.0, 5732.0, 5519.0, 5519.0, 5318.0, 5147.0, 5228.0], + [6038.0, 6009.0, 5828.0, 5558.0, 5466.0, 5475.0, 5387.0, 5290.0, 5325.0], + [5941.0, 5853.0, 5749.0, 5564.0, 5459.0, 5419.0, 5371.0, 5397.0, 5483.0], + [6133.0, 6008.0, 5841.0, 5643.0, 5475.0, 5368.0, 5388.0, 5503.0, 5623.0], + [6117.0, 6058.0, 5913.0, 5668.0, 5476.0, 5480.0, 5644.0, 5799.0, 5815.0] + ],[ + [7200.0, 7226.0, 7254.0, NaN, NaN, NaN, NaN, 7274.0, 7232.0], + [7258.0, 7253.0, 7294.0, NaN, NaN, NaN, NaN, 7246.0, 7258.0], + [7227.0, 7228.0, 7319.0, NaN, NaN, NaN, NaN, 7253.0, 7285.0], + [7199.0, 7212.0, 7227.0, 7206.0, 7194.0, 7154.0, 7185.0, 7166.0, 7191.0], + [7115.0, 7170.0, 7170.0, 7128.0, 7115.0, 7085.0, 7013.0, 7027.0, 6978.0], + [6976.0, 7094.0, 7109.0, 7097.0, 7080.0, 7002.0, 6936.0, 6909.0, 6806.0], + [6944.0, 7036.0, 7025.0, 7033.0, 7036.0, 6967.0, 6905.0, 6821.0, 6726.0], + [6994.0, 6988.0, 6988.0, 6923.0, 6923.0, 6926.0, 6907.0, 6836.0, 6702.0] + ],[ + [1787.0, 1764.0, 1717.0, NaN, NaN, NaN, NaN, 2100.0, 2609.0], + [1798.0, 1602.0, 1560.0, NaN, NaN, NaN, NaN, 2128.0, 2702.0], + [1697.0, 1560.0, 1484.0, NaN, NaN, NaN, NaN, 2045.0, 2553.0], + [1440.0, 1509.0, 1504.0, 1615.0, 1655.0, 1698.0, 1730.0, 1998.0, 2444.0], + [1287.0, 1428.0, 1596.0, 1645.0, 1576.0, 1587.0, 1761.0, 2310.0, 2563.0], + [1310.0, 1376.0, 1586.0, 1594.0, 1516.0, 1414.0, 1719.0, 2359.0, 2543.0], + [1371.0, 1439.0, 1505.0, 1435.0, 1335.0, 1305.0, 1827.0, 2532.0, 2633.0], + [1324.0, 1459.0, 1385.0, 1285.0, 1176.0, 1264.0, 1809.0, 2724.0, 2918.0] + ],[ + [964.0, 961.0, 977.0, NaN, NaN, NaN, NaN, 1278.0, 1162.0], + [1099.0, 1052.0, 961.0, NaN, NaN, NaN, NaN, 1185.0, 1275.0], + [1129.0, 1085.0, 937.0, NaN, NaN, NaN, NaN, 1202.0, 1235.0], + [993.0, 1116.0, 1020.0, 977.0, 969.0, 983.0, 1012.0, 1104.0, 1179.0], + [983.0, 1106.0, 1215.0, 980.0, 983.0, 1006.0, 1049.0, 1126.0, 1186.0], + [979.0, 998.0, 1188.0, 1128.0, 967.0, 986.0, 1090.0, 1187.0, 1177.0], + [994.0, 974.0, 1064.0, 1170.0, 1003.0, 965.0, 1064.0, 1191.0, 1261.0], + [956.0, 959.0, 989.0, 1083.0, 1033.0, 981.0, 980.0, 1118.0, 1246.0] + ] + ], + [ + [ + [620.0, 687.0, 774.0, NaN, NaN, NaN, NaN, 1023.0, 985.0], + [817.0, 677.0, 687.0, NaN, NaN, NaN, NaN, 935.0, 924.0], + [958.0, 705.0, 650.0, NaN, NaN, NaN, NaN, 885.0, 906.0], + [791.0, 929.0, 736.0, 659.0, 635.0, 675.0, 797.0, 837.0, 835.0], + [758.0, 1101.0, 877.0, 686.0, 704.0, 823.0, 915.0, 830.0, 808.0], + [689.0, 956.0, 1064.0, 710.0, 739.0, 773.0, 898.0, 937.0, 840.0], + [753.0, 807.0, 1065.0, 921.0, 709.0, 687.0, 895.0, 1049.0, 954.0], + [697.0, 703.0, 814.0, 911.0, 716.0, 696.0, 749.0, 1007.0, 1070.0] + ],[ + [1979.0, 1940.0, 1900.0, NaN, NaN, NaN, NaN, 1903.0, 1906.0], + [1900.0, 1833.0, 1772.0, NaN, NaN, NaN, NaN, 1836.0, 1876.0], + [1847.0, 1800.0, 1763.0, NaN, NaN, NaN, NaN, 1839.0, 1848.0], + [1819.0, 1813.0, 1793.0, 1742.0, 1748.0, 1765.0, 1791.0, 1814.0, 1810.0], + [1793.0, 1809.0, 1800.0, 1745.0, 1755.0, 1788.0, 1792.0, 1764.0, 1790.0], + [1798.0, 1767.0, 1773.0, 1772.0, 1756.0, 1789.0, 1799.0, 1768.0, 1765.0], + [1780.0, 1761.0, 1804.0, 1815.0, 1797.0, 1822.0, 1826.0, 1821.0, 1802.0], + [1766.0, 1809.0, 1838.0, 1852.0, 1848.0, 1863.0, 1874.0, 1864.0, 1836.0] + ],[ + [5573.0, 5880.0, 6129.0, NaN, NaN, NaN, NaN, 6313.0, 6303.0], + [5619.0, 5899.0, 6097.0, NaN, NaN, NaN, NaN, 5872.0, 5898.0], + [5673.0, 5945.0, 6069.0, NaN, NaN, NaN, NaN, 5229.0, 5216.0], + [5882.0, 6026.0, 5857.0, 5499.0, 5058.0, 4818.0, 4802.0, 5005.0, 5011.0], + [6008.0, 5919.0, 5500.0, 5321.0, 5173.0, 4918.0, 4792.0, 4987.0, 5016.0], + [5809.0, 5635.0, 5313.0, 5206.0, 5181.0, 4998.0, 4925.0, 4943.0, 5052.0], + [5557.0, 5435.0, 5231.0, 5168.0, 5154.0, 5020.0, 5025.0, 5077.0, 5176.0], + [5514.0, 5427.0, 5291.0, 5196.0, 5100.0, 5011.0, 5130.0, 5221.0, 5352.0] + ],[ + [6820.0, 6828.0, 6823.0, NaN, NaN, NaN, NaN, 6719.0, 6707.0], + [6765.0, 6812.0, 6831.0, NaN, NaN, NaN, NaN, 6771.0, 6726.0], + [6835.0, 6845.0, 6859.0, NaN, NaN, NaN, NaN, 6778.0, 6756.0], + [6883.0, 6871.0, 6874.0, 6865.0, 6855.0, 6859.0, 6865.0, 6810.0, 6826.0], + [6813.0, 6841.0, 6862.0, 6851.0, 6799.0, 6800.0, 6821.0, 6785.0, 6747.0], + [6809.0, 6829.0, 6770.0, 6763.0, 6735.0, 6704.0, 6687.0, 6660.0, 6651.0], + [6686.0, 6752.0, 6735.0, 6726.0, 6681.0, 6584.0, 6551.0, 6515.0, 6485.0], + [6571.0, 6670.0, 6691.0, 6669.0, 6621.0, 6505.0, 6505.0, 6422.0, 6356.0] + ],[ + [1644.0, 1672.0, 1653.0, NaN, NaN, NaN, NaN, 1843.0, 2309.0], + [1702.0, 1547.0, 1469.0, NaN, NaN, NaN, NaN, 1944.0, 2458.0], + [1667.0, 1484.0, 1353.0, NaN, NaN, NaN, NaN, 1839.0, 2423.0], + [1431.0, 1419.0, 1366.0, 1416.0, 1471.0, 1511.0, 1562.0, 1774.0, 2349.0], + [1203.0, 1307.0, 1476.0, 1493.0, 1433.0, 1446.0, 1597.0, 1955.0, 2346.0], + [1184.0, 1248.0, 1484.0, 1481.0, 1369.0, 1321.0, 1526.0, 2136.0, 2468.0], + [1215.0, 1286.0, 1405.0, 1368.0, 1229.0, 1197.0, 1507.0, 2294.0, 2460.0], + [1219.0, 1329.0, 1307.0, 1186.0, 1080.0, 1090.0, 1571.0, 2488.0, 2620.0] + ],[ + [821.0, 833.0, 857.0, NaN, NaN, NaN, NaN, 1113.0, 1097.0], + [987.0, 909.0, 821.0, NaN, NaN, NaN, NaN, 1083.0, 1105.0], + [1032.0, 991.0, 798.0, NaN, NaN, NaN, NaN, 1031.0, 1028.0], + [871.0, 1077.0, 969.0, 799.0, 819.0, 907.0, 935.0, 978.0, 921.0], + [846.0, 1028.0, 1091.0, 880.0, 853.0, 927.0, 1000.0, 967.0, 928.0], + [807.0, 888.0, 1138.0, 1015.0, 862.0, 872.0, 967.0, 1027.0, 961.0], + [874.0, 817.0, 1012.0, 1074.0, 877.0, 829.0, 892.0, 1097.0, 1105.0], + [841.0, 798.0, 874.0, 966.0, 953.0, 843.0, 847.0, 1004.0, 1120.0] + ] + ], + [ + [ + [384.0, 378.0, 455.0, NaN, NaN, NaN, NaN, 975.0, 850.0], + [512.0, 413.0, 380.0, NaN, NaN, NaN, NaN, 852.0, 772.0], + [781.0, 452.0, 356.0, NaN, NaN, NaN, NaN, 750.0, 802.0], + [621.0, 686.0, 452.0, 398.0, 402.0, 400.0, 487.0, 699.0, 721.0], + [517.0, 876.0, 655.0, 380.0, 414.0, 445.0, 529.0, 680.0, 688.0], + [448.0, 769.0, 924.0, 490.0, 386.0, 469.0, 706.0, 819.0, 730.0], + [455.0, 469.0, 889.0, 691.0, 403.0, 441.0, 738.0, 971.0, 927.0], + [429.0, 413.0, 569.0, 663.0, 427.0, 406.0, 553.0, 957.0, 1039.0] + ],[ + [2022.0, 2013.0, 1994.0, NaN, NaN, NaN, NaN, 1826.0, 1813.0], + [1998.0, 1980.0, 1947.0, NaN, NaN, NaN, NaN, 1819.0, 1819.0], + [1933.0, 1897.0, 1886.0, NaN, NaN, NaN, NaN, 1812.0, 1834.0], + [1824.0, 1803.0, 1803.0, 1781.0, 1748.0, 1736.0, 1771.0, 1799.0, 1807.0], + [1693.0, 1690.0, 1742.0, 1707.0, 1686.0, 1683.0, 1717.0, 1771.0, 1777.0], + [1681.0, 1674.0, 1703.0, 1670.0, 1654.0, 1676.0, 1690.0, 1759.0, 1776.0], + [1665.0, 1642.0, 1677.0, 1692.0, 1645.0, 1643.0, 1672.0, 1731.0, 1774.0], + [1651.0, 1646.0, 1637.0, 1668.0, 1660.0, 1631.0, 1643.0, 1683.0, 1754.0] + ],[ + [6446.0, 6649.0, 6776.0, NaN, NaN, NaN, NaN, 7214.0, 7195.0], + [6381.0, 6639.0, 6834.0, NaN, NaN, NaN, NaN, 6876.0, 6869.0], + [6374.0, 6639.0, 6708.0, NaN, NaN, NaN, NaN, 6573.0, 6555.0], + [6392.0, 6543.0, 6400.0, 6178.0, 6112.0, 5961.0, 5751.0, 5711.0, 5812.0], + [6442.0, 6360.0, 5966.0, 5448.0, 5243.0, 5261.0, 5322.0, 5314.0, 5245.0], + [6406.0, 6037.0, 5704.0, 5446.0, 5119.0, 5051.0, 5286.0, 5335.0, 5180.0], + [6068.0, 5691.0, 5545.0, 5488.0, 5273.0, 5159.0, 5261.0, 5318.0, 5294.0], + [5802.0, 5541.0, 5457.0, 5450.0, 5305.0, 5297.0, 5326.0, 5452.0, 5570.0] + ],[ + [7168.0, 7178.0, 7176.0, NaN, NaN, NaN, NaN, 7047.0, 7050.0], + [7162.0, 7168.0, 7148.0, NaN, NaN, NaN, NaN, 7031.0, 7014.0], + [7136.0, 7135.0, 7127.0, NaN, NaN, NaN, NaN, 7047.0, 7048.0], + [7169.0, 7189.0, 7186.0, 7189.0, 7174.0, 7208.0, 7173.0, 7118.0, 7064.0], + [7208.0, 7233.0, 7248.0, 7212.0, 7206.0, 7219.0, 7183.0, 7155.0, 7083.0], + [7176.0, 7181.0, 7223.0, 7228.0, 7190.0, 7177.0, 7167.0, 7152.0, 7098.0], + [7174.0, 7207.0, 7198.0, 7141.0, 7118.0, 7095.0, 7065.0, 7052.0, 6986.0], + [7117.0, 7128.0, 7116.0, 7066.0, 7000.0, 6950.0, 6941.0, 6885.0, 6820.0] + ],[ + [1563.0, 1631.0, 1629.0, NaN, NaN, NaN, NaN, 1735.0, 2190.0], + [1621.0, 1490.0, 1404.0, NaN, NaN, NaN, NaN, 1791.0, 2374.0], + [1580.0, 1332.0, 1201.0, NaN, NaN, NaN, NaN, 1742.0, 2490.0], + [1287.0, 1282.0, 1177.0, 1208.0, 1289.0, 1378.0, 1423.0, 1699.0, 2363.0], + [993.0, 1200.0, 1277.0, 1279.0, 1309.0, 1317.0, 1379.0, 1741.0, 2291.0], + [874.0, 1047.0, 1333.0, 1301.0, 1230.0, 1186.0, 1374.0, 2044.0, 2398.0], + [952.0, 1005.0, 1258.0, 1211.0, 1041.0, 967.0, 1342.0, 2194.0, 2399.0], + [950.0, 1057.0, 1127.0, 999.0, 835.0, 817.0, 1400.0, 2354.0, 2531.0] + ],[ + [503.0, 510.0, 550.0, NaN, NaN, NaN, NaN, 1016.0, 934.0], + [735.0, 674.0, 490.0, NaN, NaN, NaN, NaN, 930.0, 981.0], + [740.0, 690.0, 502.0, NaN, NaN, NaN, NaN, 875.0, 898.0], + [587.0, 787.0, 667.0, 536.0, 502.0, 507.0, 590.0, 724.0, 800.0], + [540.0, 829.0, 940.0, 558.0, 521.0, 541.0, 680.0, 798.0, 813.0], + [512.0, 628.0, 907.0, 783.0, 530.0, 553.0, 724.0, 903.0, 840.0], + [528.0, 533.0, 698.0, 861.0, 639.0, 520.0, 679.0, 968.0, 1001.0], + [519.0, 516.0, 540.0, 703.0, 630.0, 524.0, 558.0, 816.0, 999.0] + ] + ], + [ + [ + [2811.0, 3581.0, 3633.0, NaN, NaN, NaN, NaN, 1588.0, 2416.0], + [3713.0, 3539.0, 3377.0, NaN, NaN, NaN, NaN, 1875.0, 1823.0], + [3276.0, 3569.0, 3249.0, NaN, NaN, NaN, NaN, 1471.0, 1147.0], + [3193.0, 3955.0, 3440.0, 3145.0, 2475.0, 2488.0, 2451.0, 1620.0, 1001.0], + [2191.0, 3473.0, 3411.0, 3577.0, 3529.0, 3481.0, 3447.0, 1894.0, 1009.0], + [1323.0, 2638.0, 3324.0, 3763.0, 3841.0, 3121.0, 2606.0, 1833.0, 1058.0], + [1687.0, 2001.0, 3160.0, 3933.0, 3937.0, 3285.0, 2383.0, 2352.0, 1648.0], + [2015.0, 1318.0, 2582.0, 3281.0, 3511.0, 3432.0, 2620.0, 2382.0, 2100.0] + ],[ + [3074.0, 3067.0, 3034.0, NaN, NaN, NaN, NaN, 2704.0, 2759.0], + [3032.0, 3045.0, 2984.0, NaN, NaN, NaN, NaN, 2680.0, 2703.0], + [2956.0, 3035.0, 2994.0, NaN, NaN, NaN, NaN, 2660.0, 2553.0], + [2860.0, 2985.0, 2967.0, 2978.0, 2932.0, 2947.0, 2970.0, 2746.0, 2526.0], + [2712.0, 2831.0, 2918.0, 3021.0, 3050.0, 3033.0, 3013.0, 2777.0, 2585.0], + [2723.0, 2767.0, 2971.0, 3099.0, 3110.0, 3017.0, 2928.0, 2828.0, 2708.0], + [2883.0, 2685.0, 2935.0, 3073.0, 3119.0, 3113.0, 3040.0, 2950.0, 2837.0], + [2943.0, 2786.0, 2911.0, 3046.0, 3102.0, 3173.0, 3112.0, 3038.0, 2944.0] + ],[ + [6470.0, 6929.0, 7344.0, NaN, NaN, NaN, NaN, 7504.0, 7452.0], + [6567.0, 6995.0, 7336.0, NaN, NaN, NaN, NaN, 6812.0, 6587.0], + [6839.0, 7139.0, 7222.0, NaN, NaN, NaN, NaN, 6126.0, 6195.0], + [7090.0, 7208.0, 7034.0, 6701.0, 6425.0, 6119.0, 5872.0, 5943.0, 6125.0], + [7016.0, 6994.0, 6733.0, 6360.0, 6282.0, 6212.0, 5950.0, 5894.0, 6025.0], + [6769.0, 6684.0, 6448.0, 6194.0, 6200.0, 6145.0, 5975.0, 6006.0, 6088.0], + [6698.0, 6575.0, 6414.0, 6237.0, 6177.0, 6061.0, 6036.0, 6143.0, 6179.0], + [6909.0, 6700.0, 6464.0, 6248.0, 6130.0, 6056.0, 6086.0, 6228.0, 6338.0] + ],[ + [7435.0, 7468.0, 7447.0, NaN, NaN, NaN, NaN, 7364.0, 7321.0], + [7463.0, 7486.0, 7493.0, NaN, NaN, NaN, NaN, 7398.0, 7343.0], + [7483.0, 7535.0, 7533.0, NaN, NaN, NaN, NaN, 7441.0, 7363.0], + [7470.0, 7493.0, 7535.0, 7473.0, 7471.0, 7472.0, 7451.0, 7426.0, 7375.0], + [7415.0, 7430.0, 7472.0, 7405.0, 7417.0, 7361.0, 7321.0, 7280.0, 7294.0], + [7360.0, 7390.0, 7362.0, 7338.0, 7343.0, 7223.0, 7168.0, 7162.0, 7124.0], + [7204.0, 7293.0, 7319.0, 7291.0, 7280.0, 7171.0, 7088.0, 7067.0, 6935.0], + [7192.0, 7254.0, 7241.0, 7227.0, 7219.0, 7123.0, 7026.0, 6938.0, 6810.0] + ],[ + [3460.0, 3527.0, 3254.0, NaN, NaN, NaN, NaN, 2840.0, 3317.0], + [3586.0, 3577.0, 3211.0, NaN, NaN, NaN, NaN, 2881.0, 3455.0], + [3601.0, 3620.0, 3265.0, NaN, NaN, NaN, NaN, 2795.0, 3393.0], + [3540.0, 3675.0, 3424.0, 3103.0, 2776.0, 2743.0, 2792.0, 2908.0, 3299.0], + [2684.0, 3140.0, 3349.0, 3253.0, 2958.0, 2900.0, 2928.0, 3101.0, 3394.0], + [2135.0, 2828.0, 3434.0, 3456.0, 3341.0, 3037.0, 2805.0, 3286.0, 3493.0], + [2714.0, 2572.0, 3349.0, 3563.0, 3708.0, 3324.0, 3028.0, 3459.0, 3502.0], + [2973.0, 2404.0, 3002.0, 3211.0, 3823.0, 3821.0, 3472.0, 3662.0, 3764.0] + ],[ + [3436.0, 3488.0, 3577.0, NaN, NaN, NaN, NaN, 1562.0, 2067.0], + [3624.0, 3787.0, 3280.0, NaN, NaN, NaN, NaN, 1799.0, 1795.0], + [3096.0, 3680.0, 3402.0, 2851.0, 2079.0, 1787.0, 1753.0, 1523.0, 1226.0], + [2661.0, 3689.0, 3683.0, 3481.0, 3170.0, 3283.0, 3128.0, 1934.0, 1161.0], + [1605.0, 2656.0, 3303.0, 3755.0, 3861.0, 3747.0, 3401.0, 1993.0, 1152.0], + [1477.0, 2018.0, 3058.0, 3842.0, 3970.0, 3166.0, 2343.0, 1908.0, 1342.0], + [2413.0, 1424.0, 2631.0, 3646.0, 3820.0, 3413.0, 2653.0, 2211.0, 1808.0], + [2581.0, 1579.0, 1912.0, 2861.0, 3406.0, 3499.0, 2904.0, 2388.0, 2066.0] + ] + ] + ] +} diff --git a/tests/assets/xytb-s2-small-masked-outside.json5 b/tests/assets/xytb-s2-small-masked-outside.json5 new file mode 100644 index 00000000..1b7160c5 --- /dev/null +++ b/tests/assets/xytb-s2-small-masked-outside.json5 @@ -0,0 +1,257 @@ +{ + "type": "datacube", + "nodata": NaN, + "order": ["bands", "t", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["blue", "green", "red", "nir"] + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z", "2020-06-06T00:00:00Z", "2020-06-08T00:00:00Z", "2020-06-11T00:00:00Z", "2020-06-13T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0, 5757465.0, 5757455.0, 5757445.0, 5757435.0, 5757425.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0, 404875.0, 404885.0, 404895.0, 404905.0, 404915.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [ + [NaN, NaN, NaN, 1037.0, 1087.0, 1124.0, 1197.0, NaN, NaN], + [NaN, NaN, NaN, 921.0, 1030.0, 1051.0, 1138.0, NaN, NaN], + [NaN, NaN, NaN, 793.0, 796.0, 795.0, 905.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 2006.0, 2005.0, 2000.0, 2015.0, NaN, NaN], + [NaN, NaN, NaN, 1969.0, 1965.0, 1979.0, 2025.0, NaN, NaN], + [NaN, NaN, NaN, 1950.0, 1963.0, 1988.0, 2021.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 6379.0, 6360.0, 6253.0, 6205.0, NaN, NaN], + [NaN, NaN, NaN, 6261.0, 5995.0, 5545.0, 5389.0, NaN, NaN], + [NaN, NaN, NaN, 6016.0, 5738.0, 5521.0, 5135.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 7246.0, 7317.0, 7301.0, 7279.0, NaN, NaN], + [NaN, NaN, NaN, 7303.0, 7281.0, 7292.0, 7320.0, NaN, NaN], + [NaN, NaN, NaN, 7288.0, 7258.0, 7270.0, 7282.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 1714.0, 1785.0, 1908.0, 1998.0, NaN, NaN], + [NaN, NaN, NaN, 1561.0, 1690.0, 1840.0, 1930.0, NaN, NaN], + [NaN, NaN, NaN, 1523.0, 1646.0, 1757.0, 1789.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 1083.0, 1250.0, 1207.0, 1302.0, NaN, NaN], + [NaN, NaN, NaN, 1006.0, 1114.0, 1102.0, 1227.0, NaN, NaN], + [NaN, NaN, NaN, 962.0, 958.0, 950.0, 1054.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ] + ], + [ + [ + [NaN, NaN, NaN, 971.0, 983.0, 1030.0, 1071.0, NaN, NaN], + [NaN, NaN, NaN, 806.0, 886.0, 850.0, 962.0, NaN, NaN], + [NaN, NaN, NaN, 636.0, 627.0, 591.0, 795.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 1905.0, 1914.0, 1900.0, 1891.0, NaN, NaN], + [NaN, NaN, NaN, 1778.0, 1801.0, 1816.0, 1834.0, NaN, NaN], + [NaN, NaN, NaN, 1772.0, 1764.0, 1765.0, 1811.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 6301.0, 6300.0, 6244.0, 6295.0, NaN, NaN], + [NaN, NaN, NaN, 6162.0, 6154.0, 6128.0, 6053.0, NaN, NaN], + [NaN, NaN, NaN, 5847.0, 5532.0, 5515.0, 5408.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 6802.0, 6809.0, 6799.0, 6767.0, NaN, NaN], + [NaN, NaN, NaN, 6844.0, 6853.0, 6837.0, 6820.0, NaN, NaN], + [NaN, NaN, NaN, 6871.0, 6876.0, 6867.0, 6839.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 1703.0, 1729.0, 1795.0, 1793.0, NaN, NaN], + [NaN, NaN, NaN, 1435.0, 1508.0, 1638.0, 1746.0, NaN, NaN], + [NaN, NaN, NaN, 1329.0, 1466.0, 1576.0, 1645.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 997.0, 1091.0, 1079.0, 1120.0, NaN, NaN], + [NaN, NaN, NaN, 847.0, 935.0, 927.0, 1025.0, NaN, NaN], + [NaN, NaN, NaN, 796.0, 765.0, 765.0, 851.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ] + ], + [ + [ + [NaN, NaN, NaN, 789.0, 911.0, 943.0, 974.0, NaN, NaN], + [NaN, NaN, NaN, 560.0, 726.0, 714.0, 877.0, NaN, NaN], + [NaN, NaN, NaN, 407.0, 452.0, 439.0, 568.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 1947.0, 1890.0, 1848.0, 1828.0, NaN, NaN], + [NaN, NaN, NaN, 1916.0, 1877.0, 1838.0, 1814.0, NaN, NaN], + [NaN, NaN, NaN, 1867.0, 1822.0, 1788.0, 1791.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 6921.0, 7022.0, 7121.0, 7217.0, NaN, NaN], + [NaN, NaN, NaN, 6845.0, 6790.0, 6874.0, 6936.0, NaN, NaN], + [NaN, NaN, NaN, 6706.0, 6719.0, 6627.0, 6561.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 7125.0, 7102.0, 7102.0, 7058.0, NaN, NaN], + [NaN, NaN, NaN, 7113.0, 7099.0, 7116.0, 7092.0, NaN, NaN], + [NaN, NaN, NaN, 7176.0, 7158.0, 7156.0, 7119.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 1759.0, 1888.0, 1824.0, 1704.0, NaN, NaN], + [NaN, NaN, NaN, 1336.0, 1417.0, 1541.0, 1647.0, NaN, NaN], + [NaN, NaN, NaN, 1205.0, 1313.0, 1464.0, 1555.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 727.0, 948.0, 960.0, 1034.0, NaN, NaN], + [NaN, NaN, NaN, 573.0, 726.0, 698.0, 851.0, NaN, NaN], + [NaN, NaN, NaN, 523.0, 513.0, 516.0, 643.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ] + ], + [ + [ + [NaN, NaN, NaN, 2705.0, 2019.0, 1872.0, 1629.0, NaN, NaN], + [NaN, NaN, NaN, 2523.0, 1632.0, 1478.0, 1443.0, NaN, NaN], + [NaN, NaN, NaN, 2458.0, 1504.0, 1206.0, 1287.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 2868.0, 2787.0, 2729.0, 2676.0, NaN, NaN], + [NaN, NaN, NaN, 2908.0, 2782.0, 2691.0, 2662.0, NaN, NaN], + [NaN, NaN, NaN, 2955.0, 2808.0, 2771.0, 2785.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 7451.0, 7567.0, 7565.0, 7595.0, NaN, NaN], + [NaN, NaN, NaN, 7338.0, 7169.0, 7027.0, 6983.0, NaN, NaN], + [NaN, NaN, NaN, 7022.0, 6554.0, 6165.0, 6084.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 7470.0, 7410.0, 7424.0, 7407.0, NaN, NaN], + [NaN, NaN, NaN, 7474.0, 7467.0, 7456.0, 7470.0, NaN, NaN], + [NaN, NaN, NaN, 7487.0, 7485.0, 7487.0, 7515.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 2862.0, 2772.0, 2746.0, 2716.0, NaN, NaN], + [NaN, NaN, NaN, 2788.0, 2613.0, 2631.0, 2723.0, NaN, NaN], + [NaN, NaN, NaN, 2916.0, 2607.0, 2618.0, 2641.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ],[ + [NaN, NaN, NaN, 3151.0, 2241.0, 2058.0, 1645.0, NaN, NaN], + [NaN, NaN, NaN, 2592.0, 1917.0, 1577.0, 1408.0, NaN, NaN], + [NaN, NaN, NaN, 2851.0, 2079.0, 1787.0, 1753.0, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + ] + ] + ] +} diff --git a/tests/assets/xytb-s2-small.json5 b/tests/assets/xytb-s2-small.json5 new file mode 100644 index 00000000..bc07c1e8 --- /dev/null +++ b/tests/assets/xytb-s2-small.json5 @@ -0,0 +1,257 @@ +{ + "type": "datacube", + "nodata": NaN, + "order": ["bands", "t", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["blue", "green", "red", "nir"] + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z", "2020-06-06T00:00:00Z", "2020-06-08T00:00:00Z", "2020-06-11T00:00:00Z", "2020-06-13T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0, 5757465.0, 5757455.0, 5757445.0, 5757435.0, 5757425.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0, 404875.0, 404885.0, 404895.0, 404905.0, 404915.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [ + [770.0, 780.0, 838.0, 1037.0, 1087.0, 1124.0, 1197.0, 1182.0, 1014.0], + [860.0, 799.0, 778.0, 921.0, 1030.0, 1051.0, 1138.0, 1059.0, 1044.0], + [1007.0, 815.0, 775.0, 793.0, 796.0, 795.0, 905.0, 1043.0, 1098.0], + [956.0, 898.0, 782.0, 774.0, 774.0, 804.0, 831.0, 995.0, 1023.0], + [882.0, 1105.0, 946.0, 760.0, 805.0, 839.0, 870.0, 951.0, 1010.0], + [816.0, 964.0, 1132.0, 849.0, 798.0, 835.0, 980.0, 1012.0, 1015.0], + [844.0, 864.0, 1079.0, 929.0, 804.0, 817.0, 1004.0, 1074.0, 1144.0], + [832.0, 816.0, 893.0, 956.0, 807.0, 793.0, 875.0, 1106.0, 1200.0] + ],[ + [2049.0, 2006.0, 1990.0, 2006.0, 2005.0, 2000.0, 2015.0, 2015.0, 2027.0], + [2041.0, 2013.0, 1979.0, 1969.0, 1965.0, 1979.0, 2025.0, 2032.0, 2012.0], + [2005.0, 2009.0, 1979.0, 1950.0, 1963.0, 1988.0, 2021.0, 2049.0, 2051.0], + [1997.0, 1999.0, 1996.0, 1976.0, 2021.0, 2026.0, 2055.0, 2087.0, 2088.0], + [1970.0, 1990.0, 2025.0, 2027.0, 2039.0, 2057.0, 2090.0, 2094.0, 2115.0], + [1964.0, 1971.0, 2044.0, 2107.0, 2094.0, 2099.0, 2135.0, 2155.0, 2159.0], + [1963.0, 1977.0, 2059.0, 2132.0, 2137.0, 2146.0, 2181.0, 2203.0, 2182.0], + [1980.0, 2029.0, 2067.0, 2156.0, 2175.0, 2183.0, 2189.0, 2196.0, 2187.0] + ],[ + [5465.0, 5864.0, 6180.0, 6379.0, 6360.0, 6253.0, 6205.0, 6092.0, 5834.0], + [5736.0, 6040.0, 6264.0, 6261.0, 5995.0, 5545.0, 5389.0, 5386.0, 5362.0], + [6038.0, 6265.0, 6324.0, 6016.0, 5738.0, 5521.0, 5135.0, 5033.0, 5271.0], + [6145.0, 6245.0, 6098.0, 5732.0, 5519.0, 5519.0, 5318.0, 5147.0, 5228.0], + [6038.0, 6009.0, 5828.0, 5558.0, 5466.0, 5475.0, 5387.0, 5290.0, 5325.0], + [5941.0, 5853.0, 5749.0, 5564.0, 5459.0, 5419.0, 5371.0, 5397.0, 5483.0], + [6133.0, 6008.0, 5841.0, 5643.0, 5475.0, 5368.0, 5388.0, 5503.0, 5623.0], + [6117.0, 6058.0, 5913.0, 5668.0, 5476.0, 5480.0, 5644.0, 5799.0, 5815.0] + ],[ + [7200.0, 7226.0, 7254.0, 7246.0, 7317.0, 7301.0, 7279.0, 7274.0, 7232.0], + [7258.0, 7253.0, 7294.0, 7303.0, 7281.0, 7292.0, 7320.0, 7246.0, 7258.0], + [7227.0, 7228.0, 7319.0, 7288.0, 7258.0, 7270.0, 7282.0, 7253.0, 7285.0], + [7199.0, 7212.0, 7227.0, 7206.0, 7194.0, 7154.0, 7185.0, 7166.0, 7191.0], + [7115.0, 7170.0, 7170.0, 7128.0, 7115.0, 7085.0, 7013.0, 7027.0, 6978.0], + [6976.0, 7094.0, 7109.0, 7097.0, 7080.0, 7002.0, 6936.0, 6909.0, 6806.0], + [6944.0, 7036.0, 7025.0, 7033.0, 7036.0, 6967.0, 6905.0, 6821.0, 6726.0], + [6994.0, 6988.0, 6988.0, 6923.0, 6923.0, 6926.0, 6907.0, 6836.0, 6702.0] + ],[ + [1787.0, 1764.0, 1717.0, 1714.0, 1785.0, 1908.0, 1998.0, 2100.0, 2609.0], + [1798.0, 1602.0, 1560.0, 1561.0, 1690.0, 1840.0, 1930.0, 2128.0, 2702.0], + [1697.0, 1560.0, 1484.0, 1523.0, 1646.0, 1757.0, 1789.0, 2045.0, 2553.0], + [1440.0, 1509.0, 1504.0, 1615.0, 1655.0, 1698.0, 1730.0, 1998.0, 2444.0], + [1287.0, 1428.0, 1596.0, 1645.0, 1576.0, 1587.0, 1761.0, 2310.0, 2563.0], + [1310.0, 1376.0, 1586.0, 1594.0, 1516.0, 1414.0, 1719.0, 2359.0, 2543.0], + [1371.0, 1439.0, 1505.0, 1435.0, 1335.0, 1305.0, 1827.0, 2532.0, 2633.0], + [1324.0, 1459.0, 1385.0, 1285.0, 1176.0, 1264.0, 1809.0, 2724.0, 2918.0] + ],[ + [964.0, 961.0, 977.0, 1083.0, 1250.0, 1207.0, 1302.0, 1278.0, 1162.0], + [1099.0, 1052.0, 961.0, 1006.0, 1114.0, 1102.0, 1227.0, 1185.0, 1275.0], + [1129.0, 1085.0, 937.0, 962.0, 958.0, 950.0, 1054.0, 1202.0, 1235.0], + [993.0, 1116.0, 1020.0, 977.0, 969.0, 983.0, 1012.0, 1104.0, 1179.0], + [983.0, 1106.0, 1215.0, 980.0, 983.0, 1006.0, 1049.0, 1126.0, 1186.0], + [979.0, 998.0, 1188.0, 1128.0, 967.0, 986.0, 1090.0, 1187.0, 1177.0], + [994.0, 974.0, 1064.0, 1170.0, 1003.0, 965.0, 1064.0, 1191.0, 1261.0], + [956.0, 959.0, 989.0, 1083.0, 1033.0, 981.0, 980.0, 1118.0, 1246.0] + ] + ], + [ + [ + [620.0, 687.0, 774.0, 971.0, 983.0, 1030.0, 1071.0, 1023.0, 985.0], + [817.0, 677.0, 687.0, 806.0, 886.0, 850.0, 962.0, 935.0, 924.0], + [958.0, 705.0, 650.0, 636.0, 627.0, 591.0, 795.0, 885.0, 906.0], + [791.0, 929.0, 736.0, 659.0, 635.0, 675.0, 797.0, 837.0, 835.0], + [758.0, 1101.0, 877.0, 686.0, 704.0, 823.0, 915.0, 830.0, 808.0], + [689.0, 956.0, 1064.0, 710.0, 739.0, 773.0, 898.0, 937.0, 840.0], + [753.0, 807.0, 1065.0, 921.0, 709.0, 687.0, 895.0, 1049.0, 954.0], + [697.0, 703.0, 814.0, 911.0, 716.0, 696.0, 749.0, 1007.0, 1070.0] + ],[ + [1979.0, 1940.0, 1900.0, 1905.0, 1914.0, 1900.0, 1891.0, 1903.0, 1906.0], + [1900.0, 1833.0, 1772.0, 1778.0, 1801.0, 1816.0, 1834.0, 1836.0, 1876.0], + [1847.0, 1800.0, 1763.0, 1772.0, 1764.0, 1765.0, 1811.0, 1839.0, 1848.0], + [1819.0, 1813.0, 1793.0, 1742.0, 1748.0, 1765.0, 1791.0, 1814.0, 1810.0], + [1793.0, 1809.0, 1800.0, 1745.0, 1755.0, 1788.0, 1792.0, 1764.0, 1790.0], + [1798.0, 1767.0, 1773.0, 1772.0, 1756.0, 1789.0, 1799.0, 1768.0, 1765.0], + [1780.0, 1761.0, 1804.0, 1815.0, 1797.0, 1822.0, 1826.0, 1821.0, 1802.0], + [1766.0, 1809.0, 1838.0, 1852.0, 1848.0, 1863.0, 1874.0, 1864.0, 1836.0] + ],[ + [5573.0, 5880.0, 6129.0, 6301.0, 6300.0, 6244.0, 6295.0, 6313.0, 6303.0], + [5619.0, 5899.0, 6097.0, 6162.0, 6154.0, 6128.0, 6053.0, 5872.0, 5898.0], + [5673.0, 5945.0, 6069.0, 5847.0, 5532.0, 5515.0, 5408.0, 5229.0, 5216.0], + [5882.0, 6026.0, 5857.0, 5499.0, 5058.0, 4818.0, 4802.0, 5005.0, 5011.0], + [6008.0, 5919.0, 5500.0, 5321.0, 5173.0, 4918.0, 4792.0, 4987.0, 5016.0], + [5809.0, 5635.0, 5313.0, 5206.0, 5181.0, 4998.0, 4925.0, 4943.0, 5052.0], + [5557.0, 5435.0, 5231.0, 5168.0, 5154.0, 5020.0, 5025.0, 5077.0, 5176.0], + [5514.0, 5427.0, 5291.0, 5196.0, 5100.0, 5011.0, 5130.0, 5221.0, 5352.0] + ],[ + [6820.0, 6828.0, 6823.0, 6802.0, 6809.0, 6799.0, 6767.0, 6719.0, 6707.0], + [6765.0, 6812.0, 6831.0, 6844.0, 6853.0, 6837.0, 6820.0, 6771.0, 6726.0], + [6835.0, 6845.0, 6859.0, 6871.0, 6876.0, 6867.0, 6839.0, 6778.0, 6756.0], + [6883.0, 6871.0, 6874.0, 6865.0, 6855.0, 6859.0, 6865.0, 6810.0, 6826.0], + [6813.0, 6841.0, 6862.0, 6851.0, 6799.0, 6800.0, 6821.0, 6785.0, 6747.0], + [6809.0, 6829.0, 6770.0, 6763.0, 6735.0, 6704.0, 6687.0, 6660.0, 6651.0], + [6686.0, 6752.0, 6735.0, 6726.0, 6681.0, 6584.0, 6551.0, 6515.0, 6485.0], + [6571.0, 6670.0, 6691.0, 6669.0, 6621.0, 6505.0, 6505.0, 6422.0, 6356.0] + ],[ + [1644.0, 1672.0, 1653.0, 1703.0, 1729.0, 1795.0, 1793.0, 1843.0, 2309.0], + [1702.0, 1547.0, 1469.0, 1435.0, 1508.0, 1638.0, 1746.0, 1944.0, 2458.0], + [1667.0, 1484.0, 1353.0, 1329.0, 1466.0, 1576.0, 1645.0, 1839.0, 2423.0], + [1431.0, 1419.0, 1366.0, 1416.0, 1471.0, 1511.0, 1562.0, 1774.0, 2349.0], + [1203.0, 1307.0, 1476.0, 1493.0, 1433.0, 1446.0, 1597.0, 1955.0, 2346.0], + [1184.0, 1248.0, 1484.0, 1481.0, 1369.0, 1321.0, 1526.0, 2136.0, 2468.0], + [1215.0, 1286.0, 1405.0, 1368.0, 1229.0, 1197.0, 1507.0, 2294.0, 2460.0], + [1219.0, 1329.0, 1307.0, 1186.0, 1080.0, 1090.0, 1571.0, 2488.0, 2620.0] + ],[ + [821.0, 833.0, 857.0, 997.0, 1091.0, 1079.0, 1120.0, 1113.0, 1097.0], + [987.0, 909.0, 821.0, 847.0, 935.0, 927.0, 1025.0, 1083.0, 1105.0], + [1032.0, 991.0, 798.0, 796.0, 765.0, 765.0, 851.0, 1031.0, 1028.0], + [871.0, 1077.0, 969.0, 799.0, 819.0, 907.0, 935.0, 978.0, 921.0], + [846.0, 1028.0, 1091.0, 880.0, 853.0, 927.0, 1000.0, 967.0, 928.0], + [807.0, 888.0, 1138.0, 1015.0, 862.0, 872.0, 967.0, 1027.0, 961.0], + [874.0, 817.0, 1012.0, 1074.0, 877.0, 829.0, 892.0, 1097.0, 1105.0], + [841.0, 798.0, 874.0, 966.0, 953.0, 843.0, 847.0, 1004.0, 1120.0] + ] + ], + [ + [ + [384.0, 378.0, 455.0, 789.0, 911.0, 943.0, 974.0, 975.0, 850.0], + [512.0, 413.0, 380.0, 560.0, 726.0, 714.0, 877.0, 852.0, 772.0], + [781.0, 452.0, 356.0, 407.0, 452.0, 439.0, 568.0, 750.0, 802.0], + [621.0, 686.0, 452.0, 398.0, 402.0, 400.0, 487.0, 699.0, 721.0], + [517.0, 876.0, 655.0, 380.0, 414.0, 445.0, 529.0, 680.0, 688.0], + [448.0, 769.0, 924.0, 490.0, 386.0, 469.0, 706.0, 819.0, 730.0], + [455.0, 469.0, 889.0, 691.0, 403.0, 441.0, 738.0, 971.0, 927.0], + [429.0, 413.0, 569.0, 663.0, 427.0, 406.0, 553.0, 957.0, 1039.0] + ],[ + [2022.0, 2013.0, 1994.0, 1947.0, 1890.0, 1848.0, 1828.0, 1826.0, 1813.0], + [1998.0, 1980.0, 1947.0, 1916.0, 1877.0, 1838.0, 1814.0, 1819.0, 1819.0], + [1933.0, 1897.0, 1886.0, 1867.0, 1822.0, 1788.0, 1791.0, 1812.0, 1834.0], + [1824.0, 1803.0, 1803.0, 1781.0, 1748.0, 1736.0, 1771.0, 1799.0, 1807.0], + [1693.0, 1690.0, 1742.0, 1707.0, 1686.0, 1683.0, 1717.0, 1771.0, 1777.0], + [1681.0, 1674.0, 1703.0, 1670.0, 1654.0, 1676.0, 1690.0, 1759.0, 1776.0], + [1665.0, 1642.0, 1677.0, 1692.0, 1645.0, 1643.0, 1672.0, 1731.0, 1774.0], + [1651.0, 1646.0, 1637.0, 1668.0, 1660.0, 1631.0, 1643.0, 1683.0, 1754.0] + ],[ + [6446.0, 6649.0, 6776.0, 6921.0, 7022.0, 7121.0, 7217.0, 7214.0, 7195.0], + [6381.0, 6639.0, 6834.0, 6845.0, 6790.0, 6874.0, 6936.0, 6876.0, 6869.0], + [6374.0, 6639.0, 6708.0, 6706.0, 6719.0, 6627.0, 6561.0, 6573.0, 6555.0], + [6392.0, 6543.0, 6400.0, 6178.0, 6112.0, 5961.0, 5751.0, 5711.0, 5812.0], + [6442.0, 6360.0, 5966.0, 5448.0, 5243.0, 5261.0, 5322.0, 5314.0, 5245.0], + [6406.0, 6037.0, 5704.0, 5446.0, 5119.0, 5051.0, 5286.0, 5335.0, 5180.0], + [6068.0, 5691.0, 5545.0, 5488.0, 5273.0, 5159.0, 5261.0, 5318.0, 5294.0], + [5802.0, 5541.0, 5457.0, 5450.0, 5305.0, 5297.0, 5326.0, 5452.0, 5570.0] + ],[ + [7168.0, 7178.0, 7176.0, 7125.0, 7102.0, 7102.0, 7058.0, 7047.0, 7050.0], + [7162.0, 7168.0, 7148.0, 7113.0, 7099.0, 7116.0, 7092.0, 7031.0, 7014.0], + [7136.0, 7135.0, 7127.0, 7176.0, 7158.0, 7156.0, 7119.0, 7047.0, 7048.0], + [7169.0, 7189.0, 7186.0, 7189.0, 7174.0, 7208.0, 7173.0, 7118.0, 7064.0], + [7208.0, 7233.0, 7248.0, 7212.0, 7206.0, 7219.0, 7183.0, 7155.0, 7083.0], + [7176.0, 7181.0, 7223.0, 7228.0, 7190.0, 7177.0, 7167.0, 7152.0, 7098.0], + [7174.0, 7207.0, 7198.0, 7141.0, 7118.0, 7095.0, 7065.0, 7052.0, 6986.0], + [7117.0, 7128.0, 7116.0, 7066.0, 7000.0, 6950.0, 6941.0, 6885.0, 6820.0] + ],[ + [1563.0, 1631.0, 1629.0, 1759.0, 1888.0, 1824.0, 1704.0, 1735.0, 2190.0], + [1621.0, 1490.0, 1404.0, 1336.0, 1417.0, 1541.0, 1647.0, 1791.0, 2374.0], + [1580.0, 1332.0, 1201.0, 1205.0, 1313.0, 1464.0, 1555.0, 1742.0, 2490.0], + [1287.0, 1282.0, 1177.0, 1208.0, 1289.0, 1378.0, 1423.0, 1699.0, 2363.0], + [993.0, 1200.0, 1277.0, 1279.0, 1309.0, 1317.0, 1379.0, 1741.0, 2291.0], + [874.0, 1047.0, 1333.0, 1301.0, 1230.0, 1186.0, 1374.0, 2044.0, 2398.0], + [952.0, 1005.0, 1258.0, 1211.0, 1041.0, 967.0, 1342.0, 2194.0, 2399.0], + [950.0, 1057.0, 1127.0, 999.0, 835.0, 817.0, 1400.0, 2354.0, 2531.0] + ],[ + [503.0, 510.0, 550.0, 727.0, 948.0, 960.0, 1034.0, 1016.0, 934.0], + [735.0, 674.0, 490.0, 573.0, 726.0, 698.0, 851.0, 930.0, 981.0], + [740.0, 690.0, 502.0, 523.0, 513.0, 516.0, 643.0, 875.0, 898.0], + [587.0, 787.0, 667.0, 536.0, 502.0, 507.0, 590.0, 724.0, 800.0], + [540.0, 829.0, 940.0, 558.0, 521.0, 541.0, 680.0, 798.0, 813.0], + [512.0, 628.0, 907.0, 783.0, 530.0, 553.0, 724.0, 903.0, 840.0], + [528.0, 533.0, 698.0, 861.0, 639.0, 520.0, 679.0, 968.0, 1001.0], + [519.0, 516.0, 540.0, 703.0, 630.0, 524.0, 558.0, 816.0, 999.0] + ] + ], + [ + [ + [2811.0, 3581.0, 3633.0, 2705.0, 2019.0, 1872.0, 1629.0, 1588.0, 2416.0], + [3713.0, 3539.0, 3377.0, 2523.0, 1632.0, 1478.0, 1443.0, 1875.0, 1823.0], + [3276.0, 3569.0, 3249.0, 2458.0, 1504.0, 1206.0, 1287.0, 1471.0, 1147.0], + [3193.0, 3955.0, 3440.0, 3145.0, 2475.0, 2488.0, 2451.0, 1620.0, 1001.0], + [2191.0, 3473.0, 3411.0, 3577.0, 3529.0, 3481.0, 3447.0, 1894.0, 1009.0], + [1323.0, 2638.0, 3324.0, 3763.0, 3841.0, 3121.0, 2606.0, 1833.0, 1058.0], + [1687.0, 2001.0, 3160.0, 3933.0, 3937.0, 3285.0, 2383.0, 2352.0, 1648.0], + [2015.0, 1318.0, 2582.0, 3281.0, 3511.0, 3432.0, 2620.0, 2382.0, 2100.0] + ],[ + [3074.0, 3067.0, 3034.0, 2868.0, 2787.0, 2729.0, 2676.0, 2704.0, 2759.0], + [3032.0, 3045.0, 2984.0, 2908.0, 2782.0, 2691.0, 2662.0, 2680.0, 2703.0], + [2956.0, 3035.0, 2994.0, 2955.0, 2808.0, 2771.0, 2785.0, 2660.0, 2553.0], + [2860.0, 2985.0, 2967.0, 2978.0, 2932.0, 2947.0, 2970.0, 2746.0, 2526.0], + [2712.0, 2831.0, 2918.0, 3021.0, 3050.0, 3033.0, 3013.0, 2777.0, 2585.0], + [2723.0, 2767.0, 2971.0, 3099.0, 3110.0, 3017.0, 2928.0, 2828.0, 2708.0], + [2883.0, 2685.0, 2935.0, 3073.0, 3119.0, 3113.0, 3040.0, 2950.0, 2837.0], + [2943.0, 2786.0, 2911.0, 3046.0, 3102.0, 3173.0, 3112.0, 3038.0, 2944.0] + ],[ + [6470.0, 6929.0, 7344.0, 7451.0, 7567.0, 7565.0, 7595.0, 7504.0, 7452.0], + [6567.0, 6995.0, 7336.0, 7338.0, 7169.0, 7027.0, 6983.0, 6812.0, 6587.0], + [6839.0, 7139.0, 7222.0, 7022.0, 6554.0, 6165.0, 6084.0, 6126.0, 6195.0], + [7090.0, 7208.0, 7034.0, 6701.0, 6425.0, 6119.0, 5872.0, 5943.0, 6125.0], + [7016.0, 6994.0, 6733.0, 6360.0, 6282.0, 6212.0, 5950.0, 5894.0, 6025.0], + [6769.0, 6684.0, 6448.0, 6194.0, 6200.0, 6145.0, 5975.0, 6006.0, 6088.0], + [6698.0, 6575.0, 6414.0, 6237.0, 6177.0, 6061.0, 6036.0, 6143.0, 6179.0], + [6909.0, 6700.0, 6464.0, 6248.0, 6130.0, 6056.0, 6086.0, 6228.0, 6338.0] + ],[ + [7435.0, 7468.0, 7447.0, 7470.0, 7410.0, 7424.0, 7407.0, 7364.0, 7321.0], + [7463.0, 7486.0, 7493.0, 7474.0, 7467.0, 7456.0, 7470.0, 7398.0, 7343.0], + [7483.0, 7535.0, 7533.0, 7487.0, 7485.0, 7487.0, 7515.0, 7441.0, 7363.0], + [7470.0, 7493.0, 7535.0, 7473.0, 7471.0, 7472.0, 7451.0, 7426.0, 7375.0], + [7415.0, 7430.0, 7472.0, 7405.0, 7417.0, 7361.0, 7321.0, 7280.0, 7294.0], + [7360.0, 7390.0, 7362.0, 7338.0, 7343.0, 7223.0, 7168.0, 7162.0, 7124.0], + [7204.0, 7293.0, 7319.0, 7291.0, 7280.0, 7171.0, 7088.0, 7067.0, 6935.0], + [7192.0, 7254.0, 7241.0, 7227.0, 7219.0, 7123.0, 7026.0, 6938.0, 6810.0] + ],[ + [3460.0, 3527.0, 3254.0, 2862.0, 2772.0, 2746.0, 2716.0, 2840.0, 3317.0], + [3586.0, 3577.0, 3211.0, 2788.0, 2613.0, 2631.0, 2723.0, 2881.0, 3455.0], + [3601.0, 3620.0, 3265.0, 2916.0, 2607.0, 2618.0, 2641.0, 2795.0, 3393.0], + [3540.0, 3675.0, 3424.0, 3103.0, 2776.0, 2743.0, 2792.0, 2908.0, 3299.0], + [2684.0, 3140.0, 3349.0, 3253.0, 2958.0, 2900.0, 2928.0, 3101.0, 3394.0], + [2135.0, 2828.0, 3434.0, 3456.0, 3341.0, 3037.0, 2805.0, 3286.0, 3493.0], + [2714.0, 2572.0, 3349.0, 3563.0, 3708.0, 3324.0, 3028.0, 3459.0, 3502.0], + [2973.0, 2404.0, 3002.0, 3211.0, 3823.0, 3821.0, 3472.0, 3662.0, 3764.0] + ],[ + [3436.0, 3488.0, 3577.0, 3151.0, 2241.0, 2058.0, 1645.0, 1562.0, 2067.0], + [3624.0, 3787.0, 3280.0, 2592.0, 1917.0, 1577.0, 1408.0, 1799.0, 1795.0], + [3096.0, 3680.0, 3402.0, 2851.0, 2079.0, 1787.0, 1753.0, 1523.0, 1226.0], + [2661.0, 3689.0, 3683.0, 3481.0, 3170.0, 3283.0, 3128.0, 1934.0, 1161.0], + [1605.0, 2656.0, 3303.0, 3755.0, 3861.0, 3747.0, 3401.0, 1993.0, 1152.0], + [1477.0, 2018.0, 3058.0, 3842.0, 3970.0, 3166.0, 2343.0, 1908.0, 1342.0], + [2413.0, 1424.0, 2631.0, 3646.0, 3820.0, 3413.0, 2653.0, 2211.0, 1808.0], + [2581.0, 1579.0, 1912.0, 2861.0, 3406.0, 3499.0, 2904.0, 2388.0, 2066.0] + ] + ] + ] +} diff --git a/tests/assets/xytt-no-data.json5 b/tests/assets/xytt-no-data.json5 new file mode 100644 index 00000000..71ddcde8 --- /dev/null +++ b/tests/assets/xytt-no-data.json5 @@ -0,0 +1,27 @@ +{ + "type": "datacube", + "order": ["t2", "t", "y", "x"], + "dimensions": { + "t2": { + "type": "temporal", + "values": ["2019-01-01T00:00:00Z", "2020-01-01T00:00:00Z"] + }, + "t": { + "type": "temporal", + "values": ["2020-01-01T00:00:00Z", "2021-01-01T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null +} diff --git a/tests/between.json5 b/tests/between.json5 new file mode 100644 index 00000000..fd8e5c02 --- /dev/null +++ b/tests/between.json5 @@ -0,0 +1,122 @@ +{ + "id": "between", + "level": "L1", + "tests": [ + { + "arguments": { + "x": {"type": "nodata"}, + "min": 0, + "max": 1 + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": "0.5", + "min": 0, + "max": 1 + }, + "returns": false + }, + { + "arguments": { + "x": true, + "min": 0, + "max": 1 + }, + "returns": false + }, + { + "arguments": { + "x": false, + "min": 0, + "max": 1 + }, + "returns": false + }, + { + "arguments": { + "x": 1.0, + "min": 0.0, + "max": 1.0 + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "min": 0, + "max": 1 + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "min": 0, + "max": 1, + "exclude_max": true + }, + "returns": false + }, + { + "arguments": { + "x": 0, + "min": 0, + "max": 1, + "exclude_max": true + }, + "returns": true + }, + { + "arguments": { + "x": 0.99999999999, + "min": 0.0, + "max": 1.0, + "exclude_max": true + }, + "returns": true + }, + { + "arguments": { + "x": 1.234567891, + "min": 1.234567890, + "max": 1.234567892 + }, + "returns": true + }, + { + "arguments": { + "x": 1.23456789, + "min": 1.23456789, + "max": 1.23456789 + }, + "returns": true + }, + { + // Swapped bounds (min is greater than max) MUST always return `false` + "arguments": { + "x": 0.5, + "min": 1, + "max": 0 + }, + "returns": false + }, + { + "arguments": { + "x": -0.5, + "min": -1, + "max": 0 + }, + "returns": true + }, + { + "arguments": { + "x": [1, 2, 3], + "min": 0, + "max": 4 + }, + "returns": false + }, + ] +} diff --git a/tests/ceil.json5 b/tests/ceil.json5 new file mode 100644 index 00000000..5f8d4013 --- /dev/null +++ b/tests/ceil.json5 @@ -0,0 +1,66 @@ +{ + "id": "ceil", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1 + }, + "returns": -1 + }, + { + "arguments": { + "x": 1.5 + }, + "returns": 2 + }, + { + "arguments": { + "x": -1.5 + }, + "returns": -1 + }, + { + "arguments": { + "x": -999.99999999999 + }, + "returns": -999 + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/climatological_normal.json5 b/tests/climatological_normal.json5 new file mode 100644 index 00000000..c280e27b --- /dev/null +++ b/tests/climatological_normal.json5 @@ -0,0 +1,5 @@ +{ + "id": "climatological_normal", + "level": "L3-Clim", + "tests": [] +} diff --git a/tests/clip.json5 b/tests/clip.json5 new file mode 100644 index 00000000..5e14903b --- /dev/null +++ b/tests/clip.json5 @@ -0,0 +1,150 @@ +{ + "id": "clip", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "min": -10, + "max": 10 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1, + "min": -10, + "max": 10 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1, + "min": -10, + "max": 10 + }, + "returns": -1 + }, + { + "arguments": { + "x": 20, + "min": -10, + "max": 10 + }, + "returns": 10 + }, + { + "arguments": { + "x": -20, + "min": -10, + "max": 10 + }, + "returns": -10 + }, + { + "arguments": { + "x": 1.5, + "min": 1, + "max": 2 + }, + "returns": 1.5 + }, + { + "arguments": { + "x": -2.5, + "min": 1, + "max": 2 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1.5, + "min": -2, + "max": -1 + }, + "returns": -1.5 + }, + { + "arguments": { + "x": -0.5, + "min": -2, + "max": -1 + }, + "returns": -1 + }, + { + "arguments": { + "x": -1.5, + "min": -1, + "max": -2 + }, + "throws": "MinMaxSwapped" + }, + { + "arguments": { + "x": Infinity, + "min": -1, + "max": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": -Infinity, + "min": -1, + "max": 1 + }, + "returns": -1 + }, + { + "arguments": { + "x": -2, + "min": -1, + "max": Infinity + }, + "returns": -1 + }, + { + "arguments": { + "x": 2, + "min": -Infinity, + "max": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": 2, + "min": NaN, + "max": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": 2, + "min": -1, + "max": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "min": -1, + "max": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"}, + "min": -1, + "max": 1 + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/cloud_detection.json5 b/tests/cloud_detection.json5 new file mode 100644 index 00000000..07245ab4 --- /dev/null +++ b/tests/cloud_detection.json5 @@ -0,0 +1,5 @@ +{ + "id": "cloud_detection", + "level": "L3", + "tests": [] +} diff --git a/tests/constant.json5 b/tests/constant.json5 new file mode 100644 index 00000000..b6021c26 --- /dev/null +++ b/tests/constant.json5 @@ -0,0 +1,104 @@ +{ + "id": "constant", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": -260 + }, + "returns": -260 + }, + { + "arguments": { + "x": 66666 + }, + "returns": 66666 + }, + { + "arguments": { + "x": 0.123456789 + }, + "returns": 0.123456789 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": true + }, + "returns": true + }, + { + "arguments": { + "x": false + }, + "returns": false + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": "test" + }, + "returns": "test" + }, + { + "arguments": { + "x": [] + }, + "returns": [] + }, + { + "arguments": { + "x": [1,2,3,-4] + }, + "returns": [1,2,3,-4] + }, + { + "arguments": { + "x": [0,false,""] + }, + "returns": [0,false,""] + }, + { + "arguments": { + "x": { + "a": "b", + "b": 123, + "c": [] + } + }, + "returns": { + "a": "b", + "b": 123, + "c": [] + } + } + ] +} diff --git a/tests/cos.json5 b/tests/cos.json5 new file mode 100644 index 00000000..af5f516e --- /dev/null +++ b/tests/cos.json5 @@ -0,0 +1,54 @@ +{ + "id": "cos", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 1 + }, + { + "arguments": { + "x": 1 + }, + "returns": 0.54030230586 + }, + { + "arguments": { + "x": 10 + }, + "returns": -0.83907152908 + }, + { + "arguments": { + "x": -1 + }, + "returns": 0.54030230586 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/cosh.json5 b/tests/cosh.json5 new file mode 100644 index 00000000..0bc945ad --- /dev/null +++ b/tests/cosh.json5 @@ -0,0 +1,60 @@ +{ + "id": "cosh", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 1 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1.54308063482 + }, + { + "arguments": { + "x": -1 + }, + "returns": 1.54308063482 + }, + { + "arguments": { + "x": 2 + }, + "returns": 3.76219569108 + }, + { + "arguments": { + "x": -2 + }, + "returns": 3.76219569108 + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/count.json5 b/tests/count.json5 new file mode 100644 index 00000000..01e5ea15 --- /dev/null +++ b/tests/count.json5 @@ -0,0 +1,98 @@ +{ + "id": "count", + "level": "L2", + "tests": [ + { + "arguments": { + "data": [] + }, + "returns": 0 + }, + { + "arguments": { + "data": [ + 1, + 0, + 3, + 2 + ] + }, + "returns": 4 + }, + { + "arguments": { + "data": [ + "ABC", + {"type": "nodata"} + ] + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + false, + {"type": "nodata"} + ], + "condition": true + }, + "returns": 2 + }, + { + "arguments": { + "data": [ + 0, + 1, + 2, + 3, + 4, + 5, + {"type": "nodata"} + ], + "condition": { + "gt": { + "process_id": "gt", + "arguments": { + "x": { + "from_parameter": "element" + }, + "y": 2 + }, + "result": true + } + } + }, + "returns": 3 + }, + { + "level": "L3", + "arguments": { + "data": [ + 0, + 1, + 2, + 3, + 4, + 5, + {"type": "nodata"} + ], + "condition": { + "gt": { + "process_id": "gt", + "arguments": { + "x": { + "from_parameter": "element" + }, + "y": { + "from_parameter": "context" + } + }, + "result": true + } + }, + "context": 2 + }, + "returns": 3 + } + ] +} diff --git a/tests/create_data_cube.json5 b/tests/create_data_cube.json5 new file mode 100644 index 00000000..a79e1792 --- /dev/null +++ b/tests/create_data_cube.json5 @@ -0,0 +1,15 @@ +{ + "id": "create_data_cube", + "level": "L3", + "tests": [ + { + "arguments": {}, + "returns": { + "type": "datacube", + "order": [], + "dimensions": {}, + "data": [] + } + } + ] +} diff --git a/tests/cummax.json5 b/tests/cummax.json5 new file mode 100644 index 00000000..d8498630 --- /dev/null +++ b/tests/cummax.json5 @@ -0,0 +1,62 @@ +{ + "id": "cummax", + "level": "L3", + "experimental": true, + "tests": [ + { + "arguments": { + "data": [ + 1, + 3, + 5, + 3, + 1 + ] + }, + "returns": [ + 1, + 3, + 5, + 5, + 5 + ] + }, + { + "arguments": { + "data": [ + 1, + 3, + {"type": "nodata"}, + 5, + 1 + ] + }, + "returns": [ + 1, + 3, + {"type": "nodata"}, + 5, + 5 + ] + }, + { + "arguments": { + "data": [ + 1, + 3, + {"type": "nodata"}, + 5, + 1 + ], + "ignore_nodata": false + }, + "returns": [ + 1, + 3, + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + } + ] +} diff --git a/tests/cummin.json5 b/tests/cummin.json5 new file mode 100644 index 00000000..2f571693 --- /dev/null +++ b/tests/cummin.json5 @@ -0,0 +1,62 @@ +{ + "id": "cummin", + "level": "L3", + "experimental": true, + "tests": [ + { + "arguments": { + "data": [ + 5, + 3, + 1, + 3, + 5 + ] + }, + "returns": [ + 5, + 3, + 1, + 1, + 1 + ] + }, + { + "arguments": { + "data": [ + 5, + 3, + {"type": "nodata"}, + 1, + 5 + ] + }, + "returns": [ + 5, + 3, + {"type": "nodata"}, + 1, + 1 + ] + }, + { + "arguments": { + "data": [ + 5, + 3, + {"type": "nodata"}, + 1, + 5 + ], + "ignore_nodata": false + }, + "returns": [ + 5, + 3, + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + } + ] +} diff --git a/tests/cumproduct.json5 b/tests/cumproduct.json5 new file mode 100644 index 00000000..7edcbafc --- /dev/null +++ b/tests/cumproduct.json5 @@ -0,0 +1,66 @@ +{ + "id": "cumproduct", + "level": "L3", + "experimental": true, + "tests": [ + { + "arguments": { + "data": [ + 1, + 3, + 5, + 3, + 1 + ] + }, + "returns": [ + 1, + 3, + 15, + 45, + 45 + ] + }, + { + "arguments": { + "data": [ + 1, + 2, + 3, + {"type": "nodata"}, + 3, + 1 + ] + }, + "returns": [ + 1, + 2, + 6, + {"type": "nodata"}, + 18, + 18 + ] + }, + { + "arguments": { + "data": [ + 1, + 2, + 3, + {"type": "nodata"}, + 3, + 1 + ], + "ignore_nodata": false + }, + "returns": [ + 1, + 2, + 6, + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + } + ] +} diff --git a/tests/cumsum.json5 b/tests/cumsum.json5 new file mode 100644 index 00000000..66aec224 --- /dev/null +++ b/tests/cumsum.json5 @@ -0,0 +1,62 @@ +{ + "id": "cumsum", + "level": "L3", + "experimental": true, + "tests": [ + { + "arguments": { + "data": [ + 1, + 3, + 5, + 3, + 1 + ] + }, + "returns": [ + 1, + 4, + 9, + 12, + 13 + ] + }, + { + "arguments": { + "data": [ + 1, + 3, + {"type": "nodata"}, + 3, + 1 + ] + }, + "returns": [ + 1, + 4, + {"type": "nodata"}, + 7, + 8 + ] + }, + { + "arguments": { + "data": [ + 1, + 3, + {"type": "nodata"}, + 3, + 1 + ], + "ignore_nodata": false + }, + "returns": [ + 1, + 4, + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + } + ] +} diff --git a/tests/date_between.json5 b/tests/date_between.json5 new file mode 100644 index 00000000..f971e2b6 --- /dev/null +++ b/tests/date_between.json5 @@ -0,0 +1,15 @@ +{ + "id": "date_between", + "level": "L2-Date", + "experimental": true, + "tests": [ + { + "arguments": { + "x": "2020-01-01", + "min": "2021-01-01", + "max": "2022-01-01" + }, + "returns": false + } + ] +} diff --git a/tests/date_difference.json5 b/tests/date_difference.json5 new file mode 100644 index 00000000..6417e4b5 --- /dev/null +++ b/tests/date_difference.json5 @@ -0,0 +1,36 @@ +{ + "id": "date_difference", + "level": "L2-Date", + "experimental": true, + "tests": [ + { + "arguments": { + "date1": "2020-01-01T00:00:00.0Z", + "date2": "2020-01-01T00:00:15.5Z" + }, + "returns": 15.5 + }, + { + "arguments": { + "date1": "2020-01-01T00:00:00Z", + "date2": "2020-01-01T01:00:00+01:00" + }, + "returns": 0 + }, + { + "arguments": { + "date1": "2020-01-02", + "date2": "2020-01-01" + }, + "returns": -86400 + }, + { + "arguments": { + "date1": "2020-01-02", + "date2": "2020-01-01", + "unit": "day" + }, + "returns": -1 + } + ] +} diff --git a/tests/date_shift.json5 b/tests/date_shift.json5 new file mode 100644 index 00000000..bab0e625 --- /dev/null +++ b/tests/date_shift.json5 @@ -0,0 +1,90 @@ +{ + "id": "date_shift", + "level": "L2-Date", + "experimental": true, + "tests": [ + { + "arguments": { + "date": "2020-02-01T17:22:45Z", + "value": 6, + "unit": "month" + }, + "returns": { + "type": "datetime", + "value": "2020-08-01T17:22:45Z" + } + }, + { + "arguments": { + "date": "2021-03-31T00:00:00+02:00", + "value": -7, + "unit": "day" + }, + "returns": { + "type": "datetime", + "value": "2021-03-24T00:00:00+02:00" + } + }, + { + // Adding a year to February 29th in a leap year will result in February 28th in the next (non-leap) year. + "arguments": { + "date": "2020-02-29T17:22:45Z", + "value": 1, + "unit": "year" + }, + "returns": { + "type": "datetime", + "value": "2021-02-28T17:22:45Z", + } + }, + { + // Adding a month to January 31th will result in February 29th in leap years. + "arguments": { + "date": "2020-01-31", + "value": 1, + "unit": "month" + }, + "returns": "2020-02-29" + }, + { + // The process skips over the leap second `2016-12-31T23:59:60Z`. + "arguments": { + "date": "2016-12-31T23:59:59Z", + "value": 1, + "unit": "second" + }, + "returns": { + "type": "datetime", + "value": "2017-01-01T00:00:00Z" + } + }, + { + // Milliseconds can be added or subtracted. If not given, the default value is `0`. + "arguments": { + "date": "2018-12-31T17:22:45Z", + "value": 1150, + "unit": "millisecond" + }, + "returns": { + "type": "datetime", + "value": "2018-12-31T17:22:46.150Z" + } + }, + { + "arguments": { + "date": "2018-01-01", + "value": 25, + "unit": "hour" + }, + "returns": "2018-01-02" + }, + { + "arguments": { + "date": "2018-01-01", + "value": -1, + "unit": "hour" + }, + "returns": "2017-12-31" + } + ] +} diff --git a/tests/dimension_labels.json5 b/tests/dimension_labels.json5 new file mode 100644 index 00000000..09d537b4 --- /dev/null +++ b/tests/dimension_labels.json5 @@ -0,0 +1,69 @@ +{ + "id": "dimension_labels", + "level": "L2", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "dimension": "foo" + }, + "throws": "DimensionNotAvailable" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "dimension": "x" + }, + "returns": [404835.0, 404845.0, 404855.0, 404865.0] + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "dimension": "x" + }, + "returns": [404835.0, 404845.0, 404855.0, 404865.0] + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "dimension": "y" + }, + "returns": [5757495.0, 5757485.0, 5757475.0] + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "dimension": "t" + }, + "returns": [ + { + "type": "datetime", + "value": "2020-06-01T00:00:00Z" + }, + { + "type": "datetime", + "value": "2020-06-03T00:00:00Z" + } + ] + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "dimension": "bands" + }, + "returns": ["red", "green", "blue"] + } + ] +} diff --git a/tests/divide.json5 b/tests/divide.json5 new file mode 100644 index 00000000..f1ccd261 --- /dev/null +++ b/tests/divide.json5 @@ -0,0 +1,100 @@ +{ + "id": "divide", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 1 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1, + "y": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1, + "y": 1 + }, + "returns": -1 + }, + { + "arguments": { + "x": 2, + "y": 1 + }, + "returns": 2 + }, + { + "arguments": { + "x": -2, + "y": 1 + }, + "returns": -2 + }, + { + "arguments": { + "x": 1, + "y": 0 + }, + "returns": Infinity, + "throws": "DivisionByZero" + }, + { + "arguments": { + "x": -1, + "y": 0 + }, + "returns": -Infinity, + "throws": "DivisionByZero" + }, + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": NaN, + "throws": "DivisionByZero" + }, + { + "arguments": { + "x": Infinity, + "y": 1 + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": 1 + }, + "returns": -Infinity + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": 1 + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/drop_dimension.json5 b/tests/drop_dimension.json5 new file mode 100644 index 00000000..e8360a2c --- /dev/null +++ b/tests/drop_dimension.json5 @@ -0,0 +1,35 @@ +{ + "id": "drop_dimension", + "level": "L2", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "name": "t" + }, + "throws": "DimensionLabelCountMismatch" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-mask-one-band.json5" + }, + "name": "foo" + }, + "throws": "DimensionNotAvailable" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-mask-one-band.json5" + }, + "name": "bands" + }, + "returns": { + "$ref": "assets/xyb-mask.json5" + } + }, + ] +} diff --git a/tests/e.json5 b/tests/e.json5 new file mode 100644 index 00000000..5921aa4a --- /dev/null +++ b/tests/e.json5 @@ -0,0 +1,10 @@ +{ + "id": "e", + "level": "L1", + "tests": [ + { + "arguments": {}, + "returns": 2.718281828459 + } + ] +} diff --git a/tests/eq.json5 b/tests/eq.json5 new file mode 100644 index 00000000..1e5a9b7c --- /dev/null +++ b/tests/eq.json5 @@ -0,0 +1,137 @@ +{ + "id": "eq", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 1, + "y": 1 + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "y": 1.0 + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "y": "1" + }, + "returns": false + }, + { + "arguments": { + "x": 0, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": 1.02, + "y": 1, + "delta": 0.01 + }, + "returns": false + }, + { + "arguments": { + "x": -1, + "y": -1.001, + "delta": 0.01 + }, + "returns": true + }, + { + "arguments": { + "x": 115, + "y": 110, + "delta": 10 + }, + "returns": true + }, + { + "arguments": { + "x": "Test", + "y": "test" + }, + "returns": false + }, + { + "arguments": { + "x": "Test", + "y": "test", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "x": "Ä", + "y": "ä", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "x": "2018-01-01T00:00:00Z", + "y": "2018-01-01T00:00:00+00:00" + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 5, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": 5 + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": true + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": false + } + ] +} diff --git a/tests/exp.json5 b/tests/exp.json5 new file mode 100644 index 00000000..6182b94d --- /dev/null +++ b/tests/exp.json5 @@ -0,0 +1,60 @@ +{ + "id": "exp", + "level": "L1", + "tests": [ + { + "arguments": { + "p": 0 + }, + "returns": 1 + }, + { + "arguments": { + "p": 1 + }, + "returns": 2.71828182846 + }, + { + "arguments": { + "p": -1 + }, + "returns": 0.36787944117 + }, + { + "arguments": { + "p": 2 + }, + "returns": 7.38905609893 + }, + { + "arguments": { + "p": -2 + }, + "returns": 0.13533528324 + }, + { + "arguments": { + "p": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "p": -Infinity + }, + "returns": 0 + }, + { + "arguments": { + "p": NaN + }, + "returns": NaN + }, + { + "arguments": { + "p": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/extrema.json5 b/tests/extrema.json5 new file mode 100644 index 00000000..6b068531 --- /dev/null +++ b/tests/extrema.json5 @@ -0,0 +1,115 @@ +{ + "id": "extrema", + "level": "L2", + "tests": [ + { + "arguments": { + "data": [ + 1, + 0, + 3, + 2 + ] + }, + "returns": [ + 0, + 3 + ] + }, + { + "arguments": { + "data": [ + 5, + 2.5, + {"type": "nodata"}, + -0.7 + ] + }, + "returns": [ + -0.7, + 5 + ] + }, + { + "arguments": { + "data": [ + 1, + 0, + 3, + {"type": "nodata"}, + 2 + ], + "ignore_nodata": false + }, + "returns": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + { + "arguments": { + "data": [ + NaN, + 1, + 2, + 3 + ] + }, + "returns": [ + NaN, + NaN + ] + }, + { + "arguments": { + "data": [ + 1, + 2, + Infinity, + 3 + ] + }, + "returns": [ + 1, + Infinity + ] + }, + { + "arguments": { + "data": [ + 1, + -Infinity, + 2, + 3 + ] + }, + "returns": [ + -Infinity, + 3 + ] + }, + { + "arguments": { + "data": [ + 1.12345678903, + 1.12345678901, + 1.12345678902 + ] + }, + "returns": [ + 1.12345678901, + 1.12345678903 + ] + }, + { + // The input array is empty: return two `{"type": "nodata"}` values. + "arguments": { + "data": [] + }, + "returns": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + } + ] +} diff --git a/tests/filter_bands.json5 b/tests/filter_bands.json5 new file mode 100644 index 00000000..f60eabff --- /dev/null +++ b/tests/filter_bands.json5 @@ -0,0 +1,149 @@ +{ + "id": "filter_bands", + "level": "L2A", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + } + }, + "throws": "BandFilterParameterMissing", + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "bands": [ + "test" + ] + }, + "throws": "DimensionMissing", + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "bands": [ + "foo" + ] + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": [] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "bands": [ + "red", + "blue" + ] + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "blue"] + }, + "y": { + "type": "spatial", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [172, 47, 117, 192], + [67, 251, 195, 103], + [9, 211, 255, 242] + ], + [ + [174, 88, 81, 255], + [25, 77, 72, 9], + [148, 115, 255, 208] + ] + ] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "bands": [ + "red", + "blue" + ] + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["blue", "green"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [174, 88, 81, 255], + [25, 77, 72, 9], + [148, 115, 255, 208] + ], + [ + [36, 87, 70, 216], + [88, 140, 58, 193], + [230, 39, 255, 87] + ] + ] + } + } + ] +} diff --git a/tests/filter_bbox.json5 b/tests/filter_bbox.json5 new file mode 100644 index 00000000..e4d75657 --- /dev/null +++ b/tests/filter_bbox.json5 @@ -0,0 +1,139 @@ +{ + // todo: tests missing for vector data cubes and the z dimension + "id": "filter_bbox", + "level": "L2", + "tests": [ + { + // bbox doesn't intersect with data, empty result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "extent": { + "west": 16.1, + "south": 48.1, + "east": 16.6, + "north": 48.6 + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["bands", "t", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["blue", "green", "red", "nir"], + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z", "2020-06-06T00:00:00Z", "2020-06-08T00:00:00Z", "2020-06-11T00:00:00Z", "2020-06-13T00:00:00Z"], + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + // bbox fully covers the data, no change result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "extent": { + "west": -16.1, + "south": 40.18, + "east": 32.88, + "north": 84.73 + } + }, + "returns": { + "$ref": "assets/xytb-s2-small.json5" + } + }, + { + // bbox (without crs) intersects partially with the data, clipped result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "extent": { + "east": 404900.0, + "south": 5757475.0, + "west": 404860.0, + "north": 5757500.0, + "crs": 25832 + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-filtered.json5" + } + }, + { + // bbox (without explicit crs) intersects partially with the data, clipped result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "extent": { + "east": 7.615929556794445, + "south": 51.95982196234872, + "west": 7.615340662408175, + "north": 51.96005351522534 + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-filtered.json5" + } + }, + { + // bbox (with EPSG code as crs) intersects partially with the data, clipped result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "extent": { + "east": 7.615929556794445, + "south": 51.95982196234872, + "west": 7.615340662408175, + "north": 51.96005351522534, + "crs": 4326 + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-filtered.json5" + } + }, + { + // bbox (with WKT2 code as crs) intersects partially with the data, clipped result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "extent": { + "east": 404900.0, + "south": 5757475.0, + "west": 404860.0, + "north": 5757500.0, + "crs": { + "$ref": "assets/epsg25832.wkt2" + } + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-filtered.json5" + } + } + ] +} diff --git a/tests/filter_labels.json5 b/tests/filter_labels.json5 new file mode 100644 index 00000000..5df9fa2c --- /dev/null +++ b/tests/filter_labels.json5 @@ -0,0 +1,6 @@ +{ + "id": "filter_labels", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/filter_spatial.json5 b/tests/filter_spatial.json5 new file mode 100644 index 00000000..05f95143 --- /dev/null +++ b/tests/filter_spatial.json5 @@ -0,0 +1,160 @@ +{ + // todo: GeoJSON as input for geometries is deprecated; migrate to Vector data cubes (missing the encoding yet) + "id": "filter_spatial", + "level": "L2A", + "tests": [ + { + // geometry doesn't intersect with data, empty result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "geometries": { + "type": "Polygon", + "coordinates": [ + [ + [16.1, 48.1], + [16.1, 48.6], + [16.6, 48.6], + [16.6, 48.1], + [16.1, 48.1] + ] + ] + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["bands", "t", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["blue", "green", "red", "nir"], + }, + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z", "2020-06-06T00:00:00Z", "2020-06-08T00:00:00Z", "2020-06-11T00:00:00Z", "2020-06-13T00:00:00Z"], + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + // geometry fully covers the data, no change result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "geometries": { + "type": "Polygon", + "coordinates": [ + [ + [-16.1, 40.18], + [-16.1, 84.73], + [32.88, 84.73], + [32.88, 40.18], + [-16.1, 40.18] + ] + ] + } + }, + "returns": { + "$ref": "assets/xytb-s2-small.json5" + } + }, + { + // Polygon intersects partially with the data, clipped result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "geometries": { + "type": "Polygon", + "coordinates": [ + [ + [7.615340662408175, 51.95982196234872], + [7.615340662408175, 51.96005351522534], + [7.615929556794445, 51.96005351522534], + [7.615929556794445, 51.95982196234872], + [7.615340662408175, 51.95982196234872] + ] + ] + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-filtered.json5" + } + }, + { + // Feature intersects partially with the data, clipped result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "geometries": { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [7.615340662408175, 51.95982196234872], + [7.615340662408175, 51.96005351522534], + [7.615929556794445, 51.96005351522534], + [7.615929556794445, 51.95982196234872], + [7.615340662408175, 51.95982196234872] + ] + ] + }, + "properties": {} + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-filtered.json5" + } + }, + { + // Feature Collection intersects partially with the data, clipped result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "geometries": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [7.615340662408175, 51.95982196234872], + [7.615340662408175, 51.96005351522534], + [7.615929556794445, 51.96005351522534], + [7.615929556794445, 51.95982196234872], + [7.615340662408175, 51.95982196234872] + ] + ] + }, + "properties": {} + } + ] + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-filtered.json5" + } + } + ] +} diff --git a/tests/filter_temporal.json5 b/tests/filter_temporal.json5 new file mode 100644 index 00000000..20b3fd1a --- /dev/null +++ b/tests/filter_temporal.json5 @@ -0,0 +1,196 @@ +{ + "id": "filter_temporal", + "level": "L2", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "extent": [ + "2016-01-01", + "2015-01-01", + ] + }, + "throws": "TemporalExtentEmpty" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "extent": [ + "2015-01-01", + "2016-01-01" + ], + "dimension": "time" + }, + "throws": "DimensionNotAvailable", + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "extent": [ + "2015-01-01", + "2016-01-01" + ] + }, + "throws": "DimensionNotAvailable", + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "extent": [ + "2020-06-01T00:00:00Z", + "2020-06-05T00:00:00Z", + ] + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-01T00:00:00Z", + "2020-06-03T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, 8.45, -3.11, -20.5], + [50.4, 49.24, 25.16, -81.6] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, -63.8, 73.05, 51.05], + [47.86, -21.30, NaN, 46.15] + ] + ] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "extent": [ + "2020-06-08", + null + ] + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-09T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "extent": [ + "2021-01-01", + null + ] + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "extent": [ + "2010-01-01T00:00:00Z", + "2030-01-01T00:00:00Z" + ] + }, + "returns": { + "$ref": "assets/xyt-more-timestamps.json5" + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "extent": [ + null, + "2022-01-01T00:00:00Z" + ] + }, + "returns": { + "$ref": "assets/xyt-more-timestamps.json5" + } + } + ] +} diff --git a/tests/filter_vector.json5 b/tests/filter_vector.json5 new file mode 100644 index 00000000..5dadfa1d --- /dev/null +++ b/tests/filter_vector.json5 @@ -0,0 +1,6 @@ +{ + "id": "filter_vector", + "level": "L2B", + "experimental": true, + "tests": [] +} diff --git a/tests/first.json5 b/tests/first.json5 new file mode 100644 index 00000000..0e2fb86e --- /dev/null +++ b/tests/first.json5 @@ -0,0 +1,76 @@ +{ + "id": "first", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 1, + 0, + 3, + 2 + ] + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + "A", + "B" + ] + }, + "returns": "A" + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + 2, + 3 + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"}, + -1 + ] + }, + "returns": -1 + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": {"type": "nodata"} + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + NaN, + 1, + 2, + 3 + ] + }, + "returns": NaN + } + ] +} diff --git a/tests/flatten_dimensions.json5 b/tests/flatten_dimensions.json5 new file mode 100644 index 00000000..7c237e03 --- /dev/null +++ b/tests/flatten_dimensions.json5 @@ -0,0 +1,6 @@ +{ + "id": "flatten_dimensions", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/floor.json5 b/tests/floor.json5 new file mode 100644 index 00000000..9ce88ea2 --- /dev/null +++ b/tests/floor.json5 @@ -0,0 +1,66 @@ +{ + "id": "floor", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1 + }, + "returns": -1 + }, + { + "arguments": { + "x": 1.5 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1.5 + }, + "returns": -2 + }, + { + "arguments": { + "x": 999.99999999999 + }, + "returns": 999 + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/gt.json5 b/tests/gt.json5 new file mode 100644 index 00000000..479fc061 --- /dev/null +++ b/tests/gt.json5 @@ -0,0 +1,118 @@ +{ + "id": "gt", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": false + }, + { + "arguments": { + "x": 2, + "y": 1 + }, + "returns": true + }, + { + "arguments": { + "x": 2, + "y": "1" + }, + "returns": false + }, + { + "arguments": { + "x": "b", + "y": "a" + }, + "returns": false + }, + { + "arguments": { + "x": -0.5, + "y": -0.6 + }, + "returns": true + }, + { + "arguments": { + "x": "2018-01-02T00:00:00Z", + "y": "2018-01-01T00:00:00Z" + }, + "returns": false + }, + { + "arguments": { + "x": true, + "y": 0 + }, + "returns": false + }, + { + "arguments": { + "x": true, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 5, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": 5 + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": -Infinity, + "y": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": true + } + ] +} diff --git a/tests/gte.json5 b/tests/gte.json5 new file mode 100644 index 00000000..32e22e50 --- /dev/null +++ b/tests/gte.json5 @@ -0,0 +1,132 @@ +{ + "id": "gte", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "y": 1.0 + }, + "returns": true + }, + { + "arguments": { + "x": 2, + "y": 1 + }, + "returns": true + }, + { + "arguments": { + "x": 2, + "y": "1" + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": "1" + }, + "returns": false + }, + { + "arguments": { + "x": "b", + "y": "a" + }, + "returns": false + }, + { + "arguments": { + "x": -0.5, + "y": -0.6 + }, + "returns": true + }, + { + "arguments": { + "x": "2018-01-02T00:00:00Z", + "y": "2018-01-01T00:00:00Z" + }, + "returns": false + }, + { + "arguments": { + "x": true, + "y": 0 + }, + "returns": false + }, + { + "arguments": { + "x": true, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 5, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": 5 + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": true + }, + { + "arguments": { + "x": -Infinity, + "y": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": true + } + ] +} diff --git a/tests/if.json5 b/tests/if.json5 new file mode 100644 index 00000000..122b7a17 --- /dev/null +++ b/tests/if.json5 @@ -0,0 +1,56 @@ +{ + "id": "if", + "level": "L2", + "tests": [ + { + "arguments": { + "value": true, + "accept": "A", + "reject": "B" + }, + "returns": "A" + }, + { + "arguments": { + "value": null, + "accept": "A", + "reject": "B" + }, + "returns": "B" + }, + { + "arguments": { + "value": false, + "accept": [ + 1, + 2, + 3 + ], + "reject": [ + 4, + 5, + 6 + ] + }, + "returns": [ + 4, + 5, + 6 + ] + }, + { + "arguments": { + "value": true, + "accept": 123 + }, + "returns": 123 + }, + { + "arguments": { + "value": false, + "accept": 1 + }, + "returns": null + } + ] +} diff --git a/tests/inspect.json5 b/tests/inspect.json5 new file mode 100644 index 00000000..8d2d388d --- /dev/null +++ b/tests/inspect.json5 @@ -0,0 +1,6 @@ +{ + "id": "inspect", + "level": "L2", + "experimental": true, + "tests": [] +} diff --git a/tests/int.json5 b/tests/int.json5 new file mode 100644 index 00000000..dd58effd --- /dev/null +++ b/tests/int.json5 @@ -0,0 +1,93 @@ +{ + "id": "int", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": -1 + }, + "returns": -1 + }, + { + "arguments": { + "x": 3.5 + }, + "returns": 3 + }, + { + "arguments": { + "x": -3.5 + }, + "returns": -3 + }, + { + "arguments": { + "x": -0.4 + }, + "returns": 0 + }, + { + "arguments": { + "x": 0.1234567890 + }, + "returns": 0 + }, + { + // Supports more than byte-sized unsigned integers + "arguments": { + "x": 256 + }, + "returns": 256 + }, + { + // Supports more than 2 byte-sized unsigned integers + "arguments": { + "x": 65536 + }, + "returns": 65536 + }, + { + // Supports more than 4 byte-sized unsigned integers + "arguments": { + "x": 4294967296 + }, + "returns": 4294967296 + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": NaN + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/is_infinite.json5 b/tests/is_infinite.json5 new file mode 100644 index 00000000..64955a22 --- /dev/null +++ b/tests/is_infinite.json5 @@ -0,0 +1,139 @@ +{ + "id": "is_infinite", + "level": "L3", + "experimental": true, + "tests": [ + { + "arguments": { + "x": Infinity + }, + "returns": true + }, + { + "arguments": { + "x": -Infinity + }, + "returns": true + }, + { + "arguments": { + "x": 1 + }, + "returns": false + }, + { + "arguments": { + "x": 4294967296 + }, + "returns": false + }, + { + "arguments": { + "x": -4294967296.0 + }, + "returns": false + }, + { + "arguments": { + "x": NaN + }, + "returns": false + }, + { + "arguments": { + "x": true + }, + "returns": false + }, + { + "arguments": { + "x": false + }, + "returns": false + }, + { + "arguments": { + "x": [Infinity] + }, + "returns": false + }, + { + "arguments": { + "x": [] + }, + "returns": false + }, + { + "arguments": { + "x": {} + }, + "returns": false + }, + { + "arguments": { + "x": {"inf": Infinity} + }, + "returns": false + }, + { + "arguments": { + "x": "-infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "-Infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "-inf" + }, + "returns": false + }, + { + "arguments": { + "x": "infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "Infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "inf" + }, + "returns": false + }, + { + "arguments": { + "x": "+infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "+Infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "+inf" + }, + "returns": false + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": false + } + ] +} diff --git a/tests/is_nan.json5 b/tests/is_nan.json5 new file mode 100644 index 00000000..7354fc02 --- /dev/null +++ b/tests/is_nan.json5 @@ -0,0 +1,90 @@ +{ + "id": "is_nan", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 1 + }, + "returns": false + }, + { + "arguments": { + "x": -123456789.0 + }, + "returns": false + }, + { + "arguments": { + "x": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": -Infinity + }, + "returns": false + }, + { + "arguments": { + "x": NaN + }, + "returns": true + }, + { + "arguments": { + "x": true + }, + "returns": true + }, + { + "arguments": { + "x": false + }, + "returns": true + }, + { + "arguments": { + "x": [NaN] + }, + "returns": true + }, + { + "arguments": { + "x": [] + }, + "returns": true + }, + { + "arguments": { + "x": {} + }, + "returns": true + }, + { + "arguments": { + "x": {"nan": NaN} + }, + "returns": true + }, + { + "arguments": { + "x": "NaN" + }, + "returns": true + }, + { + "arguments": { + "x": "nan" + }, + "returns": true + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": true + } + ] +} diff --git a/tests/is_nodata.json5 b/tests/is_nodata.json5 new file mode 100644 index 00000000..4f6987e3 --- /dev/null +++ b/tests/is_nodata.json5 @@ -0,0 +1,35 @@ +{ + "id": "is_nodata", + "level": "L2", + "tests": [ + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": true + }, + { + "arguments": { + "x": 1 + }, + "returns": false, + // Optional to avoid an error in case the no-data value is 1 + "throws": true + }, + { + "arguments": { + "x": "Test" + }, + "returns": false + }, + { + "arguments": { + "x": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": false + } + ] +} diff --git a/tests/is_valid.json5 b/tests/is_valid.json5 new file mode 100644 index 00000000..0c23fe71 --- /dev/null +++ b/tests/is_valid.json5 @@ -0,0 +1,33 @@ +{ + "id": "is_valid", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 1 + }, + "returns": true + }, + { + "arguments": { + "x": "Test" + }, + "returns": true + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": false + }, + { + "arguments": { + "x": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": true + } + ] +} diff --git a/tests/last.json5 b/tests/last.json5 new file mode 100644 index 00000000..0508afd1 --- /dev/null +++ b/tests/last.json5 @@ -0,0 +1,76 @@ +{ + "id": "last", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 1, + 0, + 3, + 2 + ] + }, + "returns": 2 + }, + { + "arguments": { + "data": [ + "A", + "B", + {"type": "nodata"} + ] + }, + "returns": "B" + }, + { + "arguments": { + "data": [ + 0, + 1, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + -1, + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": -1 + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": {"type": "nodata"} + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + 1, + 2, + 3, + NaN + ] + }, + "returns": NaN + } + ] +} diff --git a/tests/linear_scale_range.json5 b/tests/linear_scale_range.json5 new file mode 100644 index 00000000..95aabbc2 --- /dev/null +++ b/tests/linear_scale_range.json5 @@ -0,0 +1,178 @@ +{ + "id": "linear_scale_range", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 0.3, + "inputMin": -1, + "inputMax": 1, + "outputMin": 0, + "outputMax": 255 + }, + "returns": 165.75 + }, + { + "arguments": { + "x": 25.5, + "inputMin": 0, + "inputMax": 255 + }, + "returns": 0.1 + }, + { + "arguments": { + "x": 0.2, + "inputMin": 0.1, + "inputMax": 0.4, + "outputMin": -1.5, + "outputMax": 1.5 + }, + "returns": -0.5 + }, + { + "arguments": { + "x": 0.2, + "inputMin": 0.1, + "inputMax": 0.3, + "outputMin": -1.5, + "outputMax": 1.5 + }, + "returns": 0 + }, + { + // Shows that the input data is getting clipped. + "arguments": { + "x": 1.12, + "inputMin": 0, + "inputMax": 1, + "outputMin": 0, + "outputMax": 255 + }, + "returns": 255 + }, + { + // Minimum and maximum input value are swapped + "arguments": { + "x": 10, + "inputMin": 100, + "inputMax": 0 + }, + "returns": 0.9 + }, + { + // Minimum and maximum output value are swapped + "arguments": { + "x": 10, + "inputMin": 0, + "inputMax": 100, + "outputMin": 255, + "outputMax": 0 + }, + "returns": 229.5 + }, + { + // Both ranges are swapped + "arguments": { + "x": 10, + "inputMin": 100, + "inputMax": 0, + "outputMin": 255, + "outputMax": 0 + }, + "returns": 25.5 + }, + { + "arguments": { + "x": 1.12, + "inputMin": 0, + "inputMax": 1, + "outputMin": 0, + "outputMax": 255 + }, + "returns": 255 + }, + { + "arguments": { + "x": Infinity, + "inputMin": 0, + "inputMax": 100 + }, + "returns": 1 + }, + { + "arguments": { + "x": -Infinity, + "inputMin": 0, + "inputMax": 100 + }, + "returns": 0 + }, + { + "arguments": { + "x": 10, + "inputMin": 0, + "inputMax": Infinity, + "outputMin": 0, + "outputMax": 255 + }, + "returns": 0 + }, + { + "arguments": { + "x": 0, + "inputMin": -Infinity, + "inputMax": Infinity, + "outputMin": 0, + "outputMax": 255 + }, + "returns": NaN + }, + { + "arguments": { + "x": 0, + "inputMin": -Infinity, + "inputMax": 0, + "outputMin": 0, + "outputMax": 255 + }, + "returns": NaN + }, + { + "arguments": { + "x": 50, + "inputMin": 0, + "inputMax": 100, + "outputMin": 0, + "outputMax": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": 50, + "inputMin": 0, + "inputMax": 100, + "outputMin": -Infinity, + "outputMax": 0 + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "inputMin": 0, + "inputMax": 100 + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"}, + "inputMin": 0, + "inputMax": 100 + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/ln.json5 b/tests/ln.json5 new file mode 100644 index 00000000..5016b5fd --- /dev/null +++ b/tests/ln.json5 @@ -0,0 +1,67 @@ +{ + "id": "ln", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 1 + }, + "returns": 0 + }, + { + "arguments": { + "x": 2.71828182846 + }, + "returns": 1 + }, + { + "arguments": { + "x": 10 + }, + "returns": 2.30258509301 + }, + { + "arguments": { + "x": 0.5 + }, + "returns": -0.69314718056 + }, + { + "arguments": { + "x": 0 + }, + "returns": -Infinity, + "throws": true + }, + { + "arguments": { + "x": -1 + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/load_collection.json5 b/tests/load_collection.json5 new file mode 100644 index 00000000..642cfa4e --- /dev/null +++ b/tests/load_collection.json5 @@ -0,0 +1,5 @@ +{ + "id": "load_collection", + "level": "L1", + "tests": [] +} diff --git a/tests/load_geojson.json5 b/tests/load_geojson.json5 new file mode 100644 index 00000000..6c5ec3c4 --- /dev/null +++ b/tests/load_geojson.json5 @@ -0,0 +1,6 @@ +{ + "id": "load_geojson", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/load_stac.json5 b/tests/load_stac.json5 new file mode 100644 index 00000000..7eeeaed8 --- /dev/null +++ b/tests/load_stac.json5 @@ -0,0 +1,6 @@ +{ + "id": "load_stac", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/load_url.json5 b/tests/load_url.json5 new file mode 100644 index 00000000..d85aeaaf --- /dev/null +++ b/tests/load_url.json5 @@ -0,0 +1,6 @@ +{ + "id": "load_url", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/log.json5 b/tests/log.json5 new file mode 100644 index 00000000..3ac9a0a8 --- /dev/null +++ b/tests/log.json5 @@ -0,0 +1,126 @@ +{ + "id": "log", + "level": "L1", + "tests": [ + { + "arguments": { + "x": -1, + "base": 10 + }, + "returns": NaN + }, + { + "arguments": { + "x": 0, + "base": 10 + }, + "returns": -Infinity, + "throws": true + }, + { + "arguments": { + "x": 0.5, + "base": 10 + }, + "returns": -0.30102999566 + }, + { + "arguments": { + "x": 1, + "base": 10 + }, + "returns": 0 + }, + { + "arguments": { + "x": 2.71828182846, + "base": 10 + }, + "returns": 0.43429448190 + }, + { + "arguments": { + "x": 10, + "base": 10 + }, + "returns": 1 + }, + { + "arguments": { + "x": 100, + "base": 10 + }, + "returns": 2 + }, + { + "arguments": { + "x": 1000, + "base": 10 + }, + "returns": 3 + }, + { + "arguments": { + "x": 12345678990, + "base": 10 + }, + "returns": 10.09151498033 + }, + { + "arguments": { + "x": 2, + "base": 2 + }, + "returns": 1 + }, + { + "arguments": { + "x": 4, + "base": 2 + }, + "returns": 2 + }, + { + "arguments": { + "x": 1, + "base": 16 + }, + "returns": 0 + }, + { + "arguments": { + "x": 16, + "base": 16 + }, + "returns": 1 + }, + { + "arguments": { + "x": Infinity, + "base": 10 + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity, + "base": 10 + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "base": 10 + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"}, + "base": 10 + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/lt.json5 b/tests/lt.json5 new file mode 100644 index 00000000..a8803d93 --- /dev/null +++ b/tests/lt.json5 @@ -0,0 +1,118 @@ +{ + "id": "lt", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": 2 + }, + "returns": true + }, + { + "arguments": { + "x": "1", + "y": 2 + }, + "returns": false + }, + { + "arguments": { + "x": "a", + "y": "b" + }, + "returns": false + }, + { + "arguments": { + "x": -0.5, + "y": -0.6 + }, + "returns": false + }, + { + "arguments": { + "x": "2018-01-01T00:00:00Z", + "y": "2018-01-02T00:00:00Z" + }, + "returns": false + }, + { + "arguments": { + "x": 0, + "y": true + }, + "returns": false + }, + { + "arguments": { + "x": false, + "y": true + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 5, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": 5 + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": -Infinity, + "y": Infinity + }, + "returns": true + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": false + } + ] +} diff --git a/tests/lte.json5 b/tests/lte.json5 new file mode 100644 index 00000000..b68a3f3a --- /dev/null +++ b/tests/lte.json5 @@ -0,0 +1,132 @@ +{ + "id": "lte", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "y": 1.0 + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "y": 2 + }, + "returns": true + }, + { + "arguments": { + "x": "1", + "y": 2 + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": "1" + }, + "returns": false + }, + { + "arguments": { + "x": "a", + "y": "b" + }, + "returns": false + }, + { + "arguments": { + "x": -0.5, + "y": -0.6 + }, + "returns": false + }, + { + "arguments": { + "x": "2018-01-01T00:00:00Z", + "y": "2018-01-02T00:00:00Z" + }, + "returns": false + }, + { + "arguments": { + "x": "2018-01-01T00:00:00Z", + "y": "2018-01-01T00:00:00+00:00" + }, + "returns": false + }, + { + "arguments": { + "x": false, + "y": true + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 5, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": 5 + }, + "returns": false + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": -Infinity, + "y": Infinity + }, + "returns": true + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": false + } + ] +} diff --git a/tests/mask.json5 b/tests/mask.json5 new file mode 100644 index 00000000..6d33bf16 --- /dev/null +++ b/tests/mask.json5 @@ -0,0 +1,152 @@ +{ + "id": "mask", + "level": "L2A", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "mask": { + "$ref": "assets/xyb-mask.json5" + } + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "green", "blue"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [172, 47, 117, 192], + [67, 255, 255, 103], + [255, 255, 255, 255] + ], + [ + [36, 87, 70, 216], + [88, 255, 255, 193], + [255, 255, 255, 255] + ], + [ + [174, 88, 81, 255], + [25, 255, 255, 9], + [255, 255, 255, 255] + ] + ] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-float.json5" + }, + "mask": { + "$ref": "assets/xyb-mask.json5" + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [17.5, 53.75, -27.1, -64.25], + [-18.0, NaN, NaN, -20.5], + [NaN, NaN, 25.16, NaN] + ], + [ + [-63.65, 9.0, -68.52, -8.0], + [1.05, NaN, NaN, 51.05], + [NaN, NaN, NaN, NaN] + ] + ] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "mask": { + "$ref": "assets/xyb-mask.json5" + }, + "replacement": -1 + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "green", "blue"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [172, 47, 117, 192], + [67, -1, -1, 103], + [-1, -1, -1, -1] + ], + [ + [36, 87, 70, 216], + [88, -1, -1, 193], + [-1, -1, -1, -1] + ], + [ + [174, 88, 81, 255], + [25, -1, -1, 9], + [-1, -1, -1, -1] + ] + ] + } + } + ] +} diff --git a/tests/mask_polygon.json5 b/tests/mask_polygon.json5 new file mode 100644 index 00000000..fb3c9f2a --- /dev/null +++ b/tests/mask_polygon.json5 @@ -0,0 +1,209 @@ +{ + // todo: GeoJSON as input for mask is deprecated; migrate to Vector data cubes (missing the encoding yet) + "id": "mask_polygon", + "level": "L2A", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "mask": { + "type": "Polygon", + "coordinates": [ + [ + [16.1, 48.1], + [16.1, 48.6], + [16.6, 48.6], + [16.6, 48.1], + [16.1, 48.1] + ] + ] + }, + "inside": true + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ], + [ + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN], + [NaN, NaN, NaN, NaN] + ] + ] + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "mask": { + "type": "Polygon", + "coordinates": [ + [ + [16.1, 48.1], + [16.1, 48.6], + [16.6, 48.6], + [16.6, 48.1], + [16.1, 48.1] + ] + ] + }, + "inside": false + }, + "returns": { + "$ref": "assets/xyt-minimal-float.json5" + } + }, + { + // bbox fully covers the data, no change result + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "mask": { + "type": "Polygon", + "coordinates": [ + [ + [-16.1, 40.18], + [-16.1, 84.73], + [32.88, 84.73], + [32.88, 40.18], + [-16.1, 40.18] + ] + ] + } + }, + "returns": { + "$ref": "assets/xytb-s2-small.json5" + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "mask": { + "type": "Polygon", + "coordinates": [ + [ + [7.615340662408175, 51.95982196234872], + [7.615340662408175, 51.96005351522534], + [7.615929556794445, 51.96005351522534], + [7.615929556794445, 51.95982196234872], + [7.615340662408175, 51.95982196234872] + ] + ] + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-masked-outside.json5" + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "mask": { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [7.615340662408175, 51.95982196234872], + [7.615340662408175, 51.96005351522534], + [7.615929556794445, 51.96005351522534], + [7.615929556794445, 51.95982196234872], + [7.615340662408175, 51.95982196234872] + ] + ] + } + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-masked-outside.json5" + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "mask": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [7.615340662408175, 51.95982196234872], + [7.615340662408175, 51.96005351522534], + [7.615929556794445, 51.96005351522534], + [7.615929556794445, 51.95982196234872], + [7.615340662408175, 51.95982196234872] + ] + ] + }, + "properties": {} + } + ] + } + }, + "returns": { + "$ref": "assets/xytb-s2-small-masked-outside.json5" + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xytb-s2-small.json5" + }, + "mask": { + "type": "Polygon", + "coordinates": [ + [ + [7.615340662408175, 51.95982196234872], + [7.615340662408175, 51.96005351522534], + [7.615929556794445, 51.96005351522534], + [7.615929556794445, 51.95982196234872], + [7.615340662408175, 51.95982196234872] + ] + ] + }, + "inside": true + }, + "returns": { + "$ref": "assets/xytb-s2-small-masked-inside.json5" + } + } + ] +} diff --git a/tests/max.json5 b/tests/max.json5 new file mode 100644 index 00000000..b253e544 --- /dev/null +++ b/tests/max.json5 @@ -0,0 +1,91 @@ +{ + "id": "max", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 1, + 0, + 3, + 2 + ] + }, + "returns": 3 + }, + { + "arguments": { + "data": [ + 5, + 2.5, + {"type": "nodata"}, + -0.7 + ] + }, + "returns": 5 + }, + { + "arguments": { + "data": [ + 1, + 0, + 3, + {"type": "nodata"}, + 2 + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + NaN, + 1, + 2, + 3 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + 1, + 2, + Infinity, + 3 + ] + }, + "returns": Infinity + }, + { + "arguments": { + "data": [ + 1, + -Infinity, + 2, + 3 + ] + }, + "returns": 3 + }, + { + "arguments": { + "data": [ + 1.12345678901, + 1.12345678903, + 1.12345678902 + ] + }, + "returns": 1.12345678903 + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/mean.json5 b/tests/mean.json5 new file mode 100644 index 00000000..865f0431 --- /dev/null +++ b/tests/mean.json5 @@ -0,0 +1,120 @@ +{ + "id": "mean", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 1, + 0, + 3, + 2 + ] + }, + "returns": 1.5 + }, + { + "arguments": { + "data": [ + 9, + 2.5, + {"type": "nodata"}, + -2.5 + ] + }, + "returns": 3 + }, + { + "arguments": { + "data": [ + 1005.5, + -5.7, + -3.575, + ] + }, + "returns": 332.075 + }, + { + "arguments": { + "data": [ + -Infinity, + 3, + 5 + ] + }, + "returns": -Infinity + }, + { + "arguments": { + "data": [ + 3, + 5, + Infinity + ] + }, + "returns": Infinity + }, + { + "arguments": { + "data": [ + -Infinity, + 3, + 3, + 5, + Infinity + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + NaN, + 3, + 3, + NaN, + 5 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + 1, + 2, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + }, + { + // The input array has only `{"type": "nodata"}` elements: return `{"type": "nodata"}`. + "arguments": { + "data": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/median.json5 b/tests/median.json5 new file mode 100644 index 00000000..7b5260b7 --- /dev/null +++ b/tests/median.json5 @@ -0,0 +1,127 @@ +{ + "id": "median", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 1, + 3, + 3, + 6, + 7, + 8, + 9 + ] + }, + "returns": 6 + }, + { + "arguments": { + "data": [ + 1, + 2, + 3, + 4, + 5, + 6, + 8, + 9 + ] + }, + "returns": 4.5 + }, + { + "arguments": { + "data": [ + 8, + 2, + 5, + 9, + 3, + 6, + 1, + 4 + ] + }, + "returns": 4.5 + }, + { + "arguments": { + "data": [ + -0.1, + 0, + 0.56, + -0.76, + 0.87, + -0.237 + ] + }, + "returns": -0.05 + }, + { + "arguments": { + "data": [ + -Infinity, + 3, + 3, + 5, + Infinity + ] + }, + "returns": 3 + }, + { + "arguments": { + "data": [ + NaN, + 3, + 3, + NaN, + 5 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + -1, + -0.5, + {"type": "nodata"}, + 1 + ] + }, + "returns": -0.5 + }, + { + "arguments": { + "data": [ + -1, + 0, + {"type": "nodata"}, + 1 + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + }, + { + // The input array has only `{"type": "nodata"}` elements: return `{"type": "nodata"}`. + "arguments": { + "data": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/merge_cubes.json5 b/tests/merge_cubes.json5 new file mode 100644 index 00000000..24e1b3d3 --- /dev/null +++ b/tests/merge_cubes.json5 @@ -0,0 +1,211 @@ +{ + "id": "merge_cubes", + "level": "L3", + "tests": [ + { + "arguments": { + "cube1": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "cube2": { + "$ref": "assets/xyb-mask-one-band.json5" + } + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "green", "blue", "mask"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [172, 47, 117, 192], + [67, 251, 195, 103], + [9, 211, 255, 242] + ], + [ + [36, 87, 70, 216], + [88, 140, 58, 193], + [230, 39, 255, 87] + ], + [ + [174, 88, 81, 255], + [25, 77, 72, 9], + [148, 115, 255, 208] + ], + [ + [1, 1, 1, 1], + [1, 0, 0, 1], + [0, 0, 1, 0] + ] + ] + } + }, + { + "arguments": { + "cube1": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "cube2": { + "$ref": "assets/xyb-mask-one-band.json5" + } + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "green", "blue", "mask"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [172, 47, 117, 192], + [67, 251, 195, 103], + [9, 211, 255, 242] + ], + [ + [36, 87, 70, 216], + [88, 140, 58, 193], + [230, 39, 255, 87] + ], + [ + [174, 88, 81, 255], + [25, 77, 72, 9], + [148, 115, 255, 208] + ], + [ + [1, 1, 1, 1], + [1, 0, 0, 1], + [0, 0, 1, 0] + ] + ] + } + }, + { + "arguments": { + "cube1": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "cube2": { + "$ref": "assets/xyt-more-timestamps.json5" + } + }, + "throws": "OverlapResolverMissing" + }, + { + "arguments": { + "cube1": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "cube2": { + "$ref": "assets/xyt-more-timestamps.json5" + }, + "overlap_resolver": { + "process_graph": { + "sum": { + "process_id": "sum", + "arguments": { + "data": [ + { + "from_argument": "x" + }, + { + "from_argument": "y" + } + ] + }, + "result": true + } + } + } + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["t", "y", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": [ + "2020-06-01T00:00:00Z", + "2020-06-03T00:00:00Z", + "2020-06-05T00:00:00Z", + "2020-06-07T00:00:00Z", + "2020-06-09T00:00:00Z" + ] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [ + [35.0, 107.5, -54.2, -128.5], + [-36.0, 16.9, -6.22, -41.0], + [100.8, 98.48, 50.32, -163.2] + ], + [ + [-127.3, 18.0, -137.04, -16.0], + [2.1, -127.6, 146.1, 102.1], + [95.72, -42.6, NaN, 92.3] + ], + [ + [-13.40, 36.07, 43.88, 74.72], + [79.92, 74.10, 98.28, -23.62], + [-70.40, -30.03, 1.26, 5.28] + ], + [ + [71.79, NaN, 97.01, -76.48], + [-21.55, NaN, -60.00, 56.84], + [-11.94, -54.23, NaN, 73.26] + ], + [ + [-12.23, 61.46, 2.38, -84.76], + [ 28.36, 48.45, -65.85, 65.90], + [ 29.50, -45.82, 78.05, 58.27] + ] + ] + } + } + ] +} diff --git a/tests/min.json5 b/tests/min.json5 new file mode 100644 index 00000000..8d368d99 --- /dev/null +++ b/tests/min.json5 @@ -0,0 +1,91 @@ +{ + "id": "min", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 1, + 0, + 3, + 2 + ] + }, + "returns": 0 + }, + { + "arguments": { + "data": [ + 5, + 2.5, + {"type": "nodata"}, + -0.7 + ] + }, + "returns": -0.7 + }, + { + "arguments": { + "data": [ + 1, + 0, + 3, + {"type": "nodata"}, + 2 + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + NaN, + 1, + 2, + 3 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + 1, + 2, + Infinity, + 3 + ] + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + 1, + -Infinity, + 2, + 3 + ] + }, + "returns": -Infinity + }, + { + "arguments": { + "data": [ + 1.12345678903, + 1.12345678901, + 1.12345678902 + ] + }, + "returns": 1.12345678901 + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/mod.json5 b/tests/mod.json5 new file mode 100644 index 00000000..1b003c6a --- /dev/null +++ b/tests/mod.json5 @@ -0,0 +1,170 @@ +{ + "id": "mod", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 1 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1, + "y": 1 + }, + "returns": 0 + }, + { + "arguments": { + "x": 27, + "y": 5 + }, + "returns": 2 + }, + { + "arguments": { + "x": -27, + "y": 5 + }, + "returns": 3 + }, + { + "arguments": { + "x": 3.14, + "y": -2 + }, + "returns": -0.86 + }, + { + "arguments": { + "x": -27, + "y": -5 + }, + "returns": -2 + }, + { + "arguments": { + "x": 2, + "y": 0 + }, + "returns": Infinity, + "throws": "DivisionByZero" + }, + { + "arguments": { + "x": -2, + "y": 0 + }, + "returns": -Infinity, + "throws": "DivisionByZero" + }, + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": NaN, + "throws": "DivisionByZero" + }, + { + "arguments": { + "x": NaN, + "y": 2 + }, + "returns": NaN + }, + { + "arguments": { + "x": 2, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": 2 + }, + "returns": NaN + }, + { + "arguments": { + "x": 2, + "y": Infinity + }, + "returns": 2 + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity, + "y": 2 + }, + "returns": NaN + }, + { + "arguments": { + "x": 2, + "y": -Infinity + }, + "returns": 2 + }, + { + "arguments": { + "x": -Infinity, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": Infinity + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": 2 + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 2, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/multiply.json5 b/tests/multiply.json5 new file mode 100644 index 00000000..ac4505df --- /dev/null +++ b/tests/multiply.json5 @@ -0,0 +1,167 @@ +{ + "id": "multiply", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 100, + "y": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1, + "y": 2 + }, + "returns": 2 + }, + { + "arguments": { + "x": -1, + "y": 2 + }, + "returns": -2 + }, + { + "arguments": { + "x": 2.5, + "y": 3.5 + }, + "returns": 8.75 + }, + { + "arguments": { + "x": -2.5, + "y": 3.5 + }, + "returns": -8.75 + }, + { + "arguments": { + "x": -250, + "y": -10 + }, + "returns": 2500 + }, + { + "arguments": { + "x": NaN, + "y": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": 1, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -1, + "y": Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": Infinity, + "y": 1 + }, + "returns": Infinity + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": 1 + }, + "returns": -Infinity + }, + { + "arguments": { + "x": 1, + "y": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": -Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": Infinity + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": 1 + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/nan.json5 b/tests/nan.json5 new file mode 100644 index 00000000..bdaca0d0 --- /dev/null +++ b/tests/nan.json5 @@ -0,0 +1,11 @@ +{ + "id": "nan", + "level": "L2", + "experimental": true, + "tests": [ + { + "arguments": {}, + "returns": NaN + } + ] +} diff --git a/tests/ndvi.json5 b/tests/ndvi.json5 new file mode 100644 index 00000000..4e207686 --- /dev/null +++ b/tests/ndvi.json5 @@ -0,0 +1,5 @@ +{ + "id": "ndvi", + "level": "L3", + "tests": [] +} diff --git a/tests/neq.json5 b/tests/neq.json5 new file mode 100644 index 00000000..6a321fe2 --- /dev/null +++ b/tests/neq.json5 @@ -0,0 +1,137 @@ +{ + "id": "neq", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 1, + "y": 1 + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": 1.0 + }, + "returns": false + }, + { + "arguments": { + "x": 1, + "y": "1" + }, + "returns": true + }, + { + "arguments": { + "x": 0, + "y": false + }, + "returns": true + }, + { + "arguments": { + "x": 1.02, + "y": 1, + "delta": 0.01 + }, + "returns": true + }, + { + "arguments": { + "x": -1, + "y": -1.001, + "delta": 0.01 + }, + "returns": false + }, + { + "arguments": { + "x": 115, + "y": 110, + "delta": 10 + }, + "returns": false + }, + { + "arguments": { + "x": "Test", + "y": "test" + }, + "returns": true + }, + { + "arguments": { + "x": "Test", + "y": "test", + "case_sensitive": false + }, + "returns": false + }, + { + "arguments": { + "x": "Ä", + "y": "ä", + "case_sensitive": false + }, + "returns": false + }, + { + "arguments": { + "x": "2018-01-01T00:00:00Z", + "y": "2018-01-01T00:00:00+00:00" + }, + "returns": true + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 5, + "y": NaN + }, + "returns": true + }, + { + "arguments": { + "x": NaN, + "y": 5 + }, + "returns": true + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": true + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": true + } + ] +} diff --git a/tests/normalized_difference.json5 b/tests/normalized_difference.json5 new file mode 100644 index 00000000..308d039f --- /dev/null +++ b/tests/normalized_difference.json5 @@ -0,0 +1,62 @@ +{ + "id": "normalized_difference", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 1, + "y": 1 + }, + "returns": 0 + }, + { + "arguments": { + "x": 2, + "y": 1 + }, + "returns": 0.33333333333 + }, + { + "arguments": { + "x": 200.546, + "y": 56.873 + }, + "returns": 0.55812896483 + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": 1 + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": NaN, + "y": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity, + "y": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": 1.12345678901, + "y": 2.12345678901 + }, + "returns": -0.30798479108 + } + ] +} diff --git a/tests/not.json5 b/tests/not.json5 new file mode 100644 index 00000000..afa62535 --- /dev/null +++ b/tests/not.json5 @@ -0,0 +1,24 @@ +{ + "id": "not", + "level": "L1", + "tests": [ + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": false + }, + "returns": true + }, + { + "arguments": { + "x": true + }, + "returns": false + } + ] +} diff --git a/tests/or.json5 b/tests/or.json5 new file mode 100644 index 00000000..84c0760b --- /dev/null +++ b/tests/or.json5 @@ -0,0 +1,69 @@ +{ + "id": "or", + "level": "L1", + "tests": [ + { + "arguments": { + "x": true, + "y": true + }, + "returns": true + }, + { + "arguments": { + "x": true, + "y": false + }, + "returns": true + }, + { + "arguments": { + "x": true, + "y": {"type": "nodata"} + }, + "returns": true + }, + { + "arguments": { + "x": false, + "y": true + }, + "returns": true + }, + { + "arguments": { + "x": false, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": false, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": true + }, + "returns": true + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/order.json5 b/tests/order.json5 new file mode 100644 index 00000000..4009f223 --- /dev/null +++ b/tests/order.json5 @@ -0,0 +1,129 @@ +{ + "id": "order", + "level": "L3", + "tests": [ + { + "arguments": { + "data": [ + 6, + -1, + 2, + {"type": "nodata"}, + 7, + 4, + {"type": "nodata"}, + 8, + 3, + 9, + 9 + ] + }, + "returns": [ + 1, + 2, + 8, + 5, + 0, + 4, + 7, + 9, + 10 + ] + }, + { + "arguments": { + "data": [ + 6, + -1, + 2, + {"type": "nodata"}, + 7, + 4, + {"type": "nodata"}, + 8, + 3, + 9, + 9 + ], + "nodata": true + }, + "returns": [ + 1, + 2, + 8, + 5, + 0, + 4, + 7, + 9, + 10, + 3, + 6 + ] + }, + { + "arguments": { + "data": [ + 6, + -1, + 2, + {"type": "nodata"}, + 7, + 4, + {"type": "nodata"}, + 8, + 3, + 9, + 9 + ], + "asc": false, + "nodata": true + }, + "returns": [ + 9, + 10, + 7, + 4, + 0, + 5, + 8, + 2, + 1, + 3, + 6 + ] + }, + { + "arguments": { + "data": [ + 6, + -1, + 2, + {"type": "nodata"}, + 7, + 4, + {"type": "nodata"}, + 8, + 3, + 9, + 9 + ], + "asc": false, + "nodata": false + }, + "returns": [ + 3, + 6, + 9, + 10, + 7, + 4, + 0, + 5, + 8, + 2, + 1 + ] + } + ] +} diff --git a/tests/pi.json5 b/tests/pi.json5 new file mode 100644 index 00000000..c889691d --- /dev/null +++ b/tests/pi.json5 @@ -0,0 +1,10 @@ +{ + "id": "pi", + "level": "L1", + "tests": [ + { + "arguments": {}, + "returns": 3.14159265359 + } + ] +} diff --git a/tests/power.json5 b/tests/power.json5 new file mode 100644 index 00000000..65e1ac73 --- /dev/null +++ b/tests/power.json5 @@ -0,0 +1,125 @@ +{ + "id": "power", + "level": "L1", + "tests": [ + { + "arguments": { + "base": 0, + "p": 2 + }, + "returns": 0 + }, + { + "arguments": { + "base": 2.5, + "p": 0 + }, + "returns": 1 + }, + { + "arguments": { + "base": 3, + "p": 3 + }, + "returns": 27 + }, + { + "arguments": { + "base": -3.5, + "p": 5 + }, + "returns": -525.21875 + }, + { + "arguments": { + "base": 5, + "p": -1 + }, + "returns": 0.2 + }, + { + "arguments": { + "base": 1, + "p": 0.5 + }, + "returns": 1 + }, + { + "arguments": { + "base": 1, + "p": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "base": {"type": "nodata"}, + "p": 2 + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "base": NaN, + "p": 2 + }, + "returns": NaN + }, + { + "arguments": { + "base": 2, + "p": NaN + }, + "returns": NaN + }, + { + "arguments": { + "base": Infinity, + "p": 2 + }, + "returns": Infinity + }, + { + "arguments": { + "base": 2, + "p": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "base": Infinity, + "p": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "base": -Infinity, + "p": 2 + }, + "returns": Infinity + }, + { + "arguments": { + "base": -Infinity, + "p": 3 + }, + "returns": -Infinity + }, + { + "arguments": { + "base": 2, + "p": -Infinity + }, + "returns": 0 + }, + { + "arguments": { + "base": -Infinity, + "p": -Infinity + }, + "returns": 0 + } + ] +} diff --git a/tests/product.json5 b/tests/product.json5 new file mode 100644 index 00000000..1367013f --- /dev/null +++ b/tests/product.json5 @@ -0,0 +1,111 @@ +{ + "id": "product", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 5, + 0 + ] + }, + "returns": 0 + }, + { + "arguments": { + "data": [ + -2, + 4, + 2.5 + ] + }, + "returns": -20 + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + -2, + -2.0, + -2, + -2.0 + ] + }, + "returns": 16 + }, + { + "arguments": { + "data": [ + 1, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + -1 + ] + }, + "returns": -1 + }, + { + "arguments": { + "data": [ + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + 1, + NaN, + 3 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + 1, + Infinity, + 3 + ] + }, + "returns": Infinity + }, + { + "arguments": { + "data": [ + 1, + -Infinity, + 3 + ] + }, + "returns": -Infinity + }, + { + "arguments": { + "data": [ + 1, + -Infinity, + 3, + Infinity + ] + }, + "returns": NaN + } + ] +} diff --git a/tests/quantiles.json5 b/tests/quantiles.json5 new file mode 100644 index 00000000..dc13bab4 --- /dev/null +++ b/tests/quantiles.json5 @@ -0,0 +1,204 @@ +{ + "id": "quantiles", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 2, + 4, + 4, + 4, + 5, + 5, + 7, + 9 + ], + "probabilities": [ + 0.005, + 0.01, + 0.02, + 0.05, + 0.1, + 0.5 + ] + }, + "returns": [ + 2.07, + 2.14, + 2.28, + 2.7, + 3.4, + 4.5 + ] + }, + { + "arguments": { + "data": [ + 1.5, + 0, + 5.75, + -1.25 + ], + "probabilities": [ + 0, + 0.25, + 0.5, + 0.75, + 1 + ] + }, + "returns": [ + -1.25, + -0.3125, + 0.75, + 2.5625, + 5.75 + ] + }, + { + "arguments": { + "data": [ + 1.5, + Infinity, + 5.75, + -1.25 + ], + "probabilities": [ + 0, + 0.25, + 0.5, + 0.75, + 1 + ] + }, + "returns": [ + -1.25, + 0.8125, + 3.625, + Infinity, + Infinity + ] + }, + { + "arguments": { + "data": [ + 1.5, + -Infinity, + 5.75, + -1.25 + ], + "probabilities": [ + 0, + 0.25, + 0.5, + 0.75, + 1 + ] + }, + "returns": [ + -Infinity, + -Infinity, + 0.125, + 2.5625, + 5.75 + ] + }, + { + "arguments": { + "data": [ + 2, + 4, + 4, + 4, + 5, + 5, + 7, + 9 + ], + "probabilities": 4 + }, + "returns": [ + 4, + 4.5, + 5.5 + ] + }, + { + "arguments": { + "data": [ + -1, + -0.5, + {"type": "nodata"}, + 1 + ], + "probabilities": 2 + }, + "returns": [ + -0.5 + ] + }, + { + "arguments": { + "data": [ + -1, + -0.5, + {"type": "nodata"}, + 1 + ], + "probabilities": 4, + "ignore_nodata": false + }, + "returns": [ + {"type": "nodata"}, + {"type": "nodata"}, + {"type": "nodata"} + ] + }, + { + "arguments": { + "data": [ + -1, + -0.5, + NaN, + 1 + ], + "probabilities": 2 + }, + "returns": [ + NaN + ] + }, + { + "arguments": { + "data": [ + -1, + -0.5, + NaN, + 1 + ], + "probabilities": 4, + "ignore_nodata": false + }, + "returns": [ + NaN, + NaN, + NaN + ] + }, + { + // Empty array + "arguments": { + "data": [], + "probabilities": [ + 0.1, + 0.5 + ] + }, + "returns": [ + {"type": "nodata"}, + {"type": "nodata"} + ] + } + ] +} diff --git a/tests/rearrange.json5 b/tests/rearrange.json5 new file mode 100644 index 00000000..ba2b6f58 --- /dev/null +++ b/tests/rearrange.json5 @@ -0,0 +1,68 @@ +{ + "id": "rearrange", + "level": "L3", + "tests": [ + { + // Reverse a list + "arguments": { + "data": [ + 5, + 4, + 3 + ], + "order": [ + 2, + 1, + 0 + ] + }, + "returns": [ + 3, + 4, + 5 + ] + }, + { + // Remove two elements + "arguments": { + "data": [ + 5, + 4, + 3, + 2 + ], + "order": [ + 1, + 3 + ] + }, + "returns": [ + 4, + 2 + ] + }, + { + // Swap two elements + "arguments": { + "data": [ + 5, + 4, + 3, + 2 + ], + "order": [ + 0, + 2, + 1, + 3 + ] + }, + "returns": [ + 5, + 3, + 4, + 2 + ] + } + ] +} diff --git a/tests/reduce_dimension.json5 b/tests/reduce_dimension.json5 new file mode 100644 index 00000000..06ab6d3a --- /dev/null +++ b/tests/reduce_dimension.json5 @@ -0,0 +1,125 @@ +{ + "id": "reduce_dimension", + "level": "L1", + "tests": [ + { + // single process + "required": [ + "sum" + ], + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "reducer": { + "process_graph": { + "sum": { + "process_id": "sum", + "arguments": { + "data": { + "from_parameter": "data" + } + }, + "result": true + } + } + }, + "dimension": "t" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["y", "x"], + "dimensions": { + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [-46.15, 62.75, -95.62, -72.25], + [-16.95, -55.35, 69.94, 30.55], + [ 98.26, 27.94, 25.16, -35.45] + ] + } + }, + { + // multiple processes with labels + "level": "L2", + "required": [ + "array_element", + "divide" + ], + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "reducer": { + "process_graph": { + "red": { + "process_id": "array_element", + "arguments": { + "data": { + "from_parameter": "data" + }, + "label": "red" + } + }, + "blue": { + "process_id": "array_element", + "arguments": { + "data": { + "from_parameter": "data" + }, + "label": "blue" + } + }, + "divide": { + "process_id": "divide", + "arguments": { + "x": { + "from_argument": "red" + }, + "y": { + "from_argument": "blue" + } + }, + "result": true + } + } + }, + "dimension": "bands" + }, + "returns": { + "type": "datacube", + "nodata": NaN, + "order": ["y", "x"], + "dimensions": { + "y": { + "type": "spatial", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": [ + [0.98850574712, 0.53409090909, 1.44444444444, 1.16363636363], + [2.68, 3.2597402597, 2.708333333333, 11.44444444444], + [0.06081081081081, 1.834782608695, NaN, 1.163461538461] + ] + } + } + ] +} diff --git a/tests/reduce_spatial.json5 b/tests/reduce_spatial.json5 new file mode 100644 index 00000000..e42c6fef --- /dev/null +++ b/tests/reduce_spatial.json5 @@ -0,0 +1,6 @@ +{ + "id": "reduce_spatial", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/rename_dimension.json5 b/tests/rename_dimension.json5 new file mode 100644 index 00000000..7383ed23 --- /dev/null +++ b/tests/rename_dimension.json5 @@ -0,0 +1,154 @@ +{ + "id": "rename_dimension", + "level": "L2", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "source": "foo", + "target": "bar" + }, + "throws": "DimensionNotAvailable" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "source": "t", + "target": "x" + }, + "throws": "DimensionExists" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "source": "t", + "target": "time" + }, + "returns": { + "type": "datacube", + "order": ["time", "y", "x"], + "dimensions": { + "time": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "source": "x", + "target": "lon" + }, + "returns": { + "type": "datacube", + "order": ["t", "lon", "x"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "lon": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyt-minimal-float.json5" + }, + "source": "y", + "target": "lat" + }, + "returns": { + "type": "datacube", + "order": ["t", "y", "lat"], + "dimensions": { + "t": { + "type": "temporal", + "values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "lat": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "source": "bands", + "target": "b" + }, + "returns": { + "type": "datacube", + "order: ": ["b", "y", "x"], + "dimensions": { + "b": { + "type": "bands", + "values": ["red", "green", "blue"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + } + ] +} diff --git a/tests/rename_labels.json5 b/tests/rename_labels.json5 new file mode 100644 index 00000000..6f2ebe3c --- /dev/null +++ b/tests/rename_labels.json5 @@ -0,0 +1,218 @@ +{ + "id": "rename_labels", + "level": "L2", + "tests": [ + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "dimension": "bands", + "target": [ + "B1", + "B2", + "B3" + ] + }, + "throws": "LabelsNotEnumerated" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "dimension": "bands", + "target": [ + "B1" + ], + "source": [ + "red", + "green" + ] + }, + "throws": "LabelMismatch" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "dimension": "bands", + "target": [ + "bar" + ], + "source": [ + "foo" + ] + }, + "throws": "LabelNotAvailable" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "dimension": "bands", + "target": [ + "blue" + ], + "source": [ + "green" + ] + }, + "throws": "LabelExists" + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "dimension": "bands", + "source": [ + "red", + "green", + "blue" + ], + "target": [ + "B1", + "B2", + "B3" + ] + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["B1", "B2", "B3"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-enumerated-bands.json5" + }, + "dimension": "bands", + "source": [ + "red", + "green", + "blue" + ] + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "green", "blue"] + }, + "y": { + "type": "spatial", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-minimal-int.json5" + }, + "dimension": "bands", + "source": [ + "blue", + "green" + ], + "target": [ + "B3", + "B2" + ] + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", "B2", "B3"] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + }, + { + "arguments": { + "data": { + "$ref": "assets/xyb-enumerated-bands.json5" + }, + "dimension": "bands", + "source": [ + "red" + ] + }, + "returns": { + "type": "datacube", + "nodata": 255, + "order": ["bands", "y", "x"], + "dimensions": { + "bands": { + "type": "bands", + "values": ["red", 1, 2] + }, + "y": { + "type": "spatial", + "axis": "y", + "values": [5757495.0, 5757485.0, 5757475.0], + "reference_system": "EPSG:25832" + }, + "x": { + "type": "spatial", + "axis": "x", + "values": [404835.0, 404845.0, 404855.0, 404865.0], + "reference_system": "EPSG:25832" + } + }, + "data": null + } + } + ] +} diff --git a/tests/resample_cube_spatial.json5 b/tests/resample_cube_spatial.json5 new file mode 100644 index 00000000..739ab67f --- /dev/null +++ b/tests/resample_cube_spatial.json5 @@ -0,0 +1,5 @@ +{ + "id": "resample_cube_spatial", + "level": "L3", + "tests": [] +} diff --git a/tests/resample_cube_temporal.json5 b/tests/resample_cube_temporal.json5 new file mode 100644 index 00000000..ed824518 --- /dev/null +++ b/tests/resample_cube_temporal.json5 @@ -0,0 +1,5 @@ +{ + "id": "resample_cube_temporal", + "level": "L3", + "tests": [] +} diff --git a/tests/resample_spatial.json5 b/tests/resample_spatial.json5 new file mode 100644 index 00000000..d50a04cd --- /dev/null +++ b/tests/resample_spatial.json5 @@ -0,0 +1,5 @@ +{ + "id": "resample_spatial", + "level": "L2A", + "tests": [] +} diff --git a/tests/round.json5 b/tests/round.json5 new file mode 100644 index 00000000..97c62d17 --- /dev/null +++ b/tests/round.json5 @@ -0,0 +1,83 @@ +{ + "id": "round", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 3.56, + "p": 1 + }, + "returns": 3.6 + }, + { + "arguments": { + "x": -0.4444444, + "p": 2 + }, + "returns": -0.44 + }, + { + "arguments": { + "x": -2.5 + }, + "returns": -2 + }, + { + "arguments": { + "x": -3.5 + }, + "returns": -4 + }, + { + "arguments": { + "x": 0.25, + "p": 1 + }, + "returns": 0.2 + }, + { + "arguments": { + "x": 0.35, + "p": 1 + }, + "returns": 0.4 + }, + { + "arguments": { + "x": 1234.5, + "p": -2 + }, + "returns": 1200 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/save_result.json5 b/tests/save_result.json5 new file mode 100644 index 00000000..e312abaf --- /dev/null +++ b/tests/save_result.json5 @@ -0,0 +1,5 @@ +{ + "id": "save_result", + "level": "L1", + "tests": [] +} diff --git a/tests/sd.json5 b/tests/sd.json5 new file mode 100644 index 00000000..6288d0a4 --- /dev/null +++ b/tests/sd.json5 @@ -0,0 +1,84 @@ +{ + "id": "sd", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + -1, + 1, + 3, + {"type": "nodata"} + ] + }, + "returns": 2 + }, + { + "arguments": { + "data": [ + -1, + 1, + 3, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + -1, + 0, + 1 + ] + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + 2.5, + 2.5, + 2.5 + ] + }, + "returns": 0 + }, + { + "arguments": { + "data": [ + -1, + 0, + Infinity + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + -Infinity, + 5 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + NaN, + 5 + ] + }, + "returns": NaN + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/sgn.json5 b/tests/sgn.json5 new file mode 100644 index 00000000..d5fd5b41 --- /dev/null +++ b/tests/sgn.json5 @@ -0,0 +1,48 @@ +{ + "id": "sgn", + "level": "L1", + "tests": [ + { + "arguments": { + "x": -2 + }, + "returns": -1 + }, + { + "arguments": { + "x": 3.5 + }, + "returns": 1 + }, + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": 1 + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -1 + }, + ] +} diff --git a/tests/sin.json5 b/tests/sin.json5 new file mode 100644 index 00000000..391f710a --- /dev/null +++ b/tests/sin.json5 @@ -0,0 +1,54 @@ +{ + "id": "sin", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 0.8414709848 + }, + { + "arguments": { + "x": 10 + }, + "returns": -0.54402111089 + }, + { + "arguments": { + "x": -1 + }, + "returns": -0.8414709848 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/sinh.json5 b/tests/sinh.json5 new file mode 100644 index 00000000..4a56089e --- /dev/null +++ b/tests/sinh.json5 @@ -0,0 +1,60 @@ +{ + "id": "sinh", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1.17520119364 + }, + { + "arguments": { + "x": -1 + }, + "returns": -1.17520119364 + }, + { + "arguments": { + "x": 2 + }, + "returns": 3.62686040785 + }, + { + "arguments": { + "x": -2 + }, + "returns": -3.62686040785 + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/sort.json5 b/tests/sort.json5 new file mode 100644 index 00000000..b88c330c --- /dev/null +++ b/tests/sort.json5 @@ -0,0 +1,66 @@ +{ + "id": "sort", + "level": "L2", + "tests": [ + { + "arguments": { + "data": [ + 6, + -1, + 2, + {"type": "nodata"}, + 7, + 4, + {"type": "nodata"}, + 8, + 3, + 9, + 9 + ] + }, + "returns": [ + -1, + 2, + 3, + 4, + 6, + 7, + 8, + 9, + 9 + ] + }, + { + "arguments": { + "data": [ + 6, + -1, + 2, + {"type": "nodata"}, + 7, + 4, + {"type": "nodata"}, + 8, + 3, + 9, + 9 + ], + "asc": false, + "nodata": true + }, + "returns": [ + 9, + 9, + 8, + 7, + 6, + 4, + 3, + 2, + -1, + {"type": "nodata"}, + {"type": "nodata"} + ] + } + ] +} diff --git a/tests/sqrt.json5 b/tests/sqrt.json5 new file mode 100644 index 00000000..6601c6f6 --- /dev/null +++ b/tests/sqrt.json5 @@ -0,0 +1,54 @@ +{ + "id": "sqrt", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1 + }, + { + "arguments": { + "x": 9 + }, + "returns": 3 + }, + { + "arguments": { + "x": -1 + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + ] +} diff --git a/tests/subtract.json5 b/tests/subtract.json5 new file mode 100644 index 00000000..481d0c1f --- /dev/null +++ b/tests/subtract.json5 @@ -0,0 +1,139 @@ +{ + "id": "subtract", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0, + "y": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 5, + "y": 2.5 + }, + "returns": 2.5 + }, + { + "arguments": { + "x": -2, + "y": 4 + }, + "returns": -6 + }, + { + "arguments": { + "x": 5.25, + "y": 0 + }, + "returns": 5.25 + }, + { + "arguments": { + "x": -250, + "y": 10 + }, + "returns": -260 + }, + { + "arguments": { + "x": NaN, + "y": 1 + }, + "returns": NaN + }, + { + "arguments": { + "x": 1, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": -1 + }, + "returns": Infinity + }, + { + "arguments": { + "x": 1, + "y": -Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": -Infinity + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": 1, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": -1 + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/sum.json5 b/tests/sum.json5 new file mode 100644 index 00000000..b5e54054 --- /dev/null +++ b/tests/sum.json5 @@ -0,0 +1,110 @@ +{ + "id": "sum", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + 5, + 1 + ] + }, + "returns": 6 + }, + { + "arguments": { + "data": [ + -2, + 4, + 2.5 + ] + }, + "returns": 4.5 + }, + { + "arguments": { + "data": [ + {"type": "nodata"}, + -2, + -2, + 0 + ] + }, + "returns": -4 + }, + { + "arguments": { + "data": [ + 1, + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + 100 + ] + }, + "returns": 100 + }, + { + "arguments": { + "data": [ + {"type": "nodata"} + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + 1, + NaN, + 3 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + 1, + Infinity, + 3 + ] + }, + "returns": Infinity + }, + { + "arguments": { + "data": [ + 1, + -Infinity, + 3 + ] + }, + "returns": -Infinity + }, + { + "arguments": { + "data": [ + 1, + -Infinity, + 3, + Infinity + ] + }, + "returns": NaN + } + ] +} diff --git a/tests/tan.json5 b/tests/tan.json5 new file mode 100644 index 00000000..7aae6d87 --- /dev/null +++ b/tests/tan.json5 @@ -0,0 +1,54 @@ +{ + "id": "tan", + "level": "L1", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 1.55740772465 + }, + { + "arguments": { + "x": 10 + }, + "returns": 0.64836082746 + }, + { + "arguments": { + "x": -1 + }, + "returns": -1.55740772465 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/tanh.json5 b/tests/tanh.json5 new file mode 100644 index 00000000..e469c217 --- /dev/null +++ b/tests/tanh.json5 @@ -0,0 +1,54 @@ +{ + "id": "tanh", + "level": "L2", + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": 1 + }, + "returns": 0.76159415595 + }, + { + "arguments": { + "x": 10 + }, + "returns": 0.99999999587 + }, + { + "arguments": { + "x": -1 + }, + "returns": -0.76159415595 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": 1 + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -1 + }, + { + "arguments": { + "x": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/text_begins.json5 b/tests/text_begins.json5 new file mode 100644 index 00000000..e8b84243 --- /dev/null +++ b/tests/text_begins.json5 @@ -0,0 +1,50 @@ +{ + "id": "text_begins", + "level": "L2-Text", + "tests": [ + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "amet" + }, + "returns": false + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "Lorem" + }, + "returns": true + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "lorem" + }, + "returns": false + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "lorem", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "data": "Ä", + "pattern": "ä", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "data": {"type": "nodata"}, + "pattern": "null" + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/text_concat.json5 b/tests/text_concat.json5 new file mode 100644 index 00000000..456e4ff3 --- /dev/null +++ b/tests/text_concat.json5 @@ -0,0 +1,63 @@ +{ + "id": "text_concat", + "level": "L2-Text", + "tests": [ + { + "arguments": { + "data": [ + "Hello", + "World" + ], + "separator": " " + }, + "returns": "Hello World" + }, + { + "arguments": { + "data": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0 + ] + }, + "returns": "1234567890" + }, + { + "arguments": { + "data": [ + null, + true, + false, + 1, + -1.5, + "ß" + ], + "separator": "\n" + }, + "returns": "null\ntrue\nfalse\n1\n-1.5\nß" + }, + { + "arguments": { + "data": [ + 2, + 0 + ], + "separator": 1 + }, + "returns": "210" + }, + { + "arguments": { + "data": [] + }, + "returns": "" + } + ] +} diff --git a/tests/text_contains.json5 b/tests/text_contains.json5 new file mode 100644 index 00000000..e23ef6a3 --- /dev/null +++ b/tests/text_contains.json5 @@ -0,0 +1,50 @@ +{ + "id": "text_contains", + "level": "L2-Text", + "tests": [ + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "openEO" + }, + "returns": false + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "ipsum dolor" + }, + "returns": true + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "Ipsum Dolor" + }, + "returns": false + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "SIT", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "data": "ÄÖÜ", + "pattern": "ö", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "data": {"type": "nodata"}, + "pattern": "null" + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/text_ends.json5 b/tests/text_ends.json5 new file mode 100644 index 00000000..d79082f5 --- /dev/null +++ b/tests/text_ends.json5 @@ -0,0 +1,50 @@ +{ + "id": "text_ends", + "level": "L2-Text", + "tests": [ + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "amet" + }, + "returns": true + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "AMET" + }, + "returns": false + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "Lorem" + }, + "returns": false + }, + { + "arguments": { + "data": "Lorem ipsum dolor sit amet", + "pattern": "AMET", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "data": "Ä", + "pattern": "ä", + "case_sensitive": false + }, + "returns": true + }, + { + "arguments": { + "data": {"type": "nodata"}, + "pattern": "null" + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/trim_cube.json5 b/tests/trim_cube.json5 new file mode 100644 index 00000000..0bcc6627 --- /dev/null +++ b/tests/trim_cube.json5 @@ -0,0 +1,5 @@ +{ + "id": "trim_cube", + "level": "L3", + "tests": [] +} diff --git a/tests/unflatten_dimensions.json5 b/tests/unflatten_dimensions.json5 new file mode 100644 index 00000000..7bb570dd --- /dev/null +++ b/tests/unflatten_dimensions.json5 @@ -0,0 +1,6 @@ +{ + "id": "unflatten_dimensions", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/variance.json5 b/tests/variance.json5 new file mode 100644 index 00000000..f4c7c469 --- /dev/null +++ b/tests/variance.json5 @@ -0,0 +1,97 @@ +{ + "id": "variance", + "level": "L1", + "tests": [ + { + "arguments": { + "data": [ + -1, + 1, + 3 + ] + }, + "returns": 4 + }, + { + "arguments": { + "data": [ + 2, + 3, + 3, + {"type": "nodata"}, + 4, + 4, + 5 + ] + }, + "returns": 1.1 + }, + { + "arguments": { + "data": [ + -1, + 1, + {"type": "nodata"}, + 3 + ], + "ignore_nodata": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "data": [ + -1, + 0, + 1 + ] + }, + "returns": 1 + }, + { + "arguments": { + "data": [ + 2.5, + 2.5, + 2.5 + ] + }, + "returns": 0 + }, + { + "arguments": { + "data": [ + -1, + 0, + Infinity + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + -Infinity, + 5 + ] + }, + "returns": NaN + }, + { + "arguments": { + "data": [ + NaN, + 5 + ] + }, + "returns": NaN + }, + { + // The input array is empty: return `{"type": "nodata"}`. + "arguments": { + "data": [] + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/tests/vector_buffer.json5 b/tests/vector_buffer.json5 new file mode 100644 index 00000000..17ec84f2 --- /dev/null +++ b/tests/vector_buffer.json5 @@ -0,0 +1,6 @@ +{ + "id": "vector_buffer", + "level": "L2B", + "experimental": true, + "tests": [] +} diff --git a/tests/vector_reproject.json5 b/tests/vector_reproject.json5 new file mode 100644 index 00000000..d2eff4cf --- /dev/null +++ b/tests/vector_reproject.json5 @@ -0,0 +1,6 @@ +{ + "id": "vector_reproject", + "level": "L2B", + "experimental": true, + "tests": [] +} diff --git a/tests/vector_to_random_points.json5 b/tests/vector_to_random_points.json5 new file mode 100644 index 00000000..d6666fc1 --- /dev/null +++ b/tests/vector_to_random_points.json5 @@ -0,0 +1,6 @@ +{ + "id": "vector_to_random_points", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/vector_to_regular_points.json5 b/tests/vector_to_regular_points.json5 new file mode 100644 index 00000000..ca92156c --- /dev/null +++ b/tests/vector_to_regular_points.json5 @@ -0,0 +1,6 @@ +{ + "id": "vector_to_regular_points", + "level": "L3", + "experimental": true, + "tests": [] +} diff --git a/tests/xor.json5 b/tests/xor.json5 new file mode 100644 index 00000000..3cfa372d --- /dev/null +++ b/tests/xor.json5 @@ -0,0 +1,69 @@ +{ + "id": "xor", + "level": "L2", + "tests": [ + { + "arguments": { + "x": true, + "y": true + }, + "returns": false + }, + { + "arguments": { + "x": true, + "y": false + }, + "returns": true + }, + { + "arguments": { + "x": true, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": false, + "y": true + }, + "returns": true + }, + { + "arguments": { + "x": false, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": false, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": true + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": false + }, + "returns": {"type": "nodata"} + }, + { + "arguments": { + "x": {"type": "nodata"}, + "y": {"type": "nodata"} + }, + "returns": {"type": "nodata"} + } + ] +} diff --git a/text_begins.json b/text_begins.json index 766d5f0f..873fd649 100644 --- a/text_begins.json +++ b/text_begins.json @@ -1,7 +1,7 @@ { "id": "text_begins", "summary": "Text begins with another text", - "description": "Checks whether the text (also known as *string*) specified for `data` contains the text specified for `pattern` at the beginning. Both are expected to be encoded in UTF-8 by default. The no-data value `null` is passed through and therefore gets propagated.", + "description": "Checks whether the text (also known as *string*) specified for `data` contains the text specified for `pattern` at the beginning. No-data values are passed through.", "categories": [ "texts", "comparison" diff --git a/text_contains.json b/text_contains.json index 9b78318f..21d5ea9f 100644 --- a/text_contains.json +++ b/text_contains.json @@ -1,7 +1,7 @@ { "id": "text_contains", "summary": "Text contains another text", - "description": "Checks whether the text (also known as *string*) specified for `data` contains the text specified for `pattern`. Both are expected to be encoded in UTF-8 by default. The no-data value `null` is passed through and therefore gets propagated.", + "description": "Checks whether the text (also known as *string*) specified for `data` contains the text specified for `pattern`. No-data values are passed through.", "categories": [ "texts", "comparison" diff --git a/text_ends.json b/text_ends.json index f31e8e12..a63fc424 100644 --- a/text_ends.json +++ b/text_ends.json @@ -1,7 +1,7 @@ { "id": "text_ends", "summary": "Text ends with another text", - "description": "Checks whether the text (also known as *string*) specified for `data` contains the text specified for `pattern` at the end. Both are expected to be encoded in UTF-8 by default. The no-data value `null` is passed through and therefore gets propagated.", + "description": "Checks whether the text (also known as *string*) specified for `data` contains the text specified for `pattern` at the end. No-data values are passed through.", "categories": [ "texts", "comparison" diff --git a/variance.json b/variance.json index 78f76feb..0ab044d7 100644 --- a/variance.json +++ b/variance.json @@ -1,7 +1,7 @@ { "id": "variance", "summary": "Variance", - "description": "Computes the sample variance of an array of numbers by calculating the square of the standard deviation (see ``sd()``). It is defined to be the expectation of the squared deviation of a random variable from its expected value. Basically, it measures how far the numbers in the array are spread out from their average value.\n\nAn array without non-`null` elements resolves always with `null`.", + "description": "Computes the sample variance of an array of numbers by calculating the square of the standard deviation (see ``sd()``). It is defined to be the expectation of the squared deviation of a random variable from its expected value. Basically, it measures how far the numbers in the array are spread out from their average value.\n\nAn array with solely no-data values returns the no-data value (or `null`).", "categories": [ "math > statistics", "reducer" @@ -22,7 +22,7 @@ }, { "name": "ignore_nodata", - "description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is returned if any value is such a value.", + "description": "Indicates whether no-data values are ignored or not. Ignores them by default. If set to `false`, any no-data value in the array results in a no-data value (or `null`).", "schema": { "type": "boolean" }, @@ -75,13 +75,6 @@ "ignore_nodata": false }, "returns": null - }, - { - "description": "The input array is empty: return `null`.", - "arguments": { - "data": [] - }, - "returns": null } ], "links": [ @@ -149,4 +142,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/xor.json b/xor.json index 6af7ae5e..01b8efda 100644 --- a/xor.json +++ b/xor.json @@ -1,7 +1,7 @@ { "id": "xor", "summary": "Logical XOR (exclusive or)", - "description": "Checks if **exactly one** of the values is true. If a component is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || null | false | true\n----- || ---- | ----- | -----\nnull || null | null | null\nfalse || null | false | true\ntrue || null | true | false\n```", + "description": "Checks if **exactly one** of the values is true. If any argument is a no-data value, the result will be the no-data value whenever the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || no-data | false | true\n------- || ------- | ------- | -------\nno-data || no-data | no-data | no-data\nfalse || no-data | false | true\ntrue || no-data | true | false\n```", "categories": [ "logic" ],