From 946901cee994748c32cc134263e374a51cc0a4f8 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Wed, 25 Oct 2023 15:54:06 +0200 Subject: [PATCH] More tests, clean-up --- tests/README.md | 118 ++++++++++++++++++--------- tests/aggregate_spatial_window.json5 | 3 - tests/and.json5 | 30 ++++++- tests/apply_polygon.json5 | 3 - tests/array_create_labeled.json5 | 3 - tests/array_find_label.json5 | 3 - tests/clip.json5 | 8 ++ tests/filter_labels.json5 | 28 ------- tests/filter_vector.json5 | 3 - tests/flatten_dimensions.json5 | 3 - tests/is_infinite.json5 | 26 +++++- tests/is_nodata.json5 | 4 +- tests/load_geojson.json5 | 3 - tests/load_stac.json5 | 58 ------------- tests/load_uploaded_files.json5 | 3 - tests/load_url.json5 | 3 - tests/or.json5 | 34 +++++++- tests/reduce_spatial.json5 | 3 - tests/unflatten_dimension.json5 | 3 - tests/vector_buffer.json5 | 3 - tests/vector_reproject.json5 | 3 - tests/vector_to_regular_points.json5 | 3 - tests/xor.json5 | 38 +++++++-- 23 files changed, 208 insertions(+), 178 deletions(-) delete mode 100644 tests/aggregate_spatial_window.json5 delete mode 100644 tests/apply_polygon.json5 delete mode 100644 tests/array_create_labeled.json5 delete mode 100644 tests/array_find_label.json5 delete mode 100644 tests/filter_labels.json5 delete mode 100644 tests/filter_vector.json5 delete mode 100644 tests/flatten_dimensions.json5 delete mode 100644 tests/load_geojson.json5 delete mode 100644 tests/load_stac.json5 delete mode 100644 tests/load_uploaded_files.json5 delete mode 100644 tests/load_url.json5 delete mode 100644 tests/reduce_spatial.json5 delete mode 100644 tests/unflatten_dimension.json5 delete mode 100644 tests/vector_buffer.json5 delete mode 100644 tests/vector_reproject.json5 delete mode 100644 tests/vector_to_regular_points.json5 diff --git a/tests/README.md b/tests/README.md index 2d18fddc..5d166983 100644 --- a/tests/README.md +++ b/tests/README.md @@ -8,7 +8,6 @@ This folder contains test cases for the openEO processes. - [x] add - [ ] add_dimension - [ ] aggregate_spatial -- [ ] aggregate_spatial_window - [ ] aggregate_temporal - [ ] aggregate_temporal_period - [x] all @@ -19,7 +18,6 @@ This folder contains test cases for the openEO processes. - [ ] apply_dimension - [ ] apply_kernel - [ ] apply_neighborhood -- [ ] apply_polygon - [x] arccos - - [x] arcosh - - [x] arcsin - @@ -30,14 +28,12 @@ This folder contains test cases for the openEO processes. - [ ] array_concat - [ ] array_contains - [ ] array_create -- [ ] array_create_labeled - [ ] array_element - [ ] array_filter - [ ] array_find -- [ ] array_find_label - [ ] array_interpolate_linear - [ ] array_labels -- [ ] array_modify +- [x] array_modify (experimental) - could use some more tests - [x] arsinh - [x] artanh - - [ ] between @@ -48,14 +44,14 @@ This folder contains test cases for the openEO processes. - [x] cos - - [x] cosh - - [ ] count +- [x] cummax (experimental) - could use some more tests +- [x] cummin (experimental) - could use some more tests +- [x] cumproduct (experimental) - could use some more tests +- [x] cumsum (experimental) - could use some more tests - [ ] create_data_cube -- [ ] cummax -- [ ] cummin -- [ ] cumproduct -- [ ] cumsum -- [ ] date_between -- [ ] date_difference -- [ ] date_shift +- [ ] date_between (experimental) - could use some more tests +- [ ] date_difference (experimental) - could use some more tests +- [ ] date_shift (experimental) - could use some more tests - [ ] dimension_labels - [x] divide - - [ ] drop_dimension @@ -65,27 +61,19 @@ This folder contains test cases for the openEO processes. - [ ] extrema - [ ] filter_bands - [ ] filter_bbox -- [ ] filter_labels - [ ] filter_spatial - [ ] filter_temporal -- [ ] filter_vector - [ ] first -- [ ] flatten_dimensions - [x] floor - [ ] gt - [ ] gte -- [ ] if +- [x] if - [x] int -- [ ] is_infinite +- [x] is_infinite (experimental) - [x] is_nan -- [ ] is_valid - [ ] last - [ ] linear_scale_range - [x] ln - -- [ ] load_geojson -- [ ] load_stac -- [ ] load_uploaded_files -- [ ] load_url - [x] log - - [ ] lt - [ ] lte @@ -98,7 +86,7 @@ This folder contains test cases for the openEO processes. - [ ] min - [x] mod - - [ ] multiply -- [x] nan +- [x] nan (experimental) - [ ] ndvi - [ ] neq - [ ] normalized_difference @@ -111,7 +99,6 @@ This folder contains test cases for the openEO processes. - [ ] quantiles - [ ] rearrange - [ ] reduce_dimension -- [ ] reduce_spatial - [ ] rename_dimension - [ ] rename_labels - [ ] resample_cube_spatial @@ -133,11 +120,7 @@ This folder contains test cases for the openEO processes. - [x] text_contains - [x] text_ends - [ ] trim_cube -- [ ] unflatten_dimension - [ ] variance -- [ ] vector_buffer -- [ ] vector_reproject -- [ ] vector_to_regular_points - [x] xor ## Incomplete processes @@ -150,20 +133,38 @@ The following processes have no test cases as the results heavily depend on the 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 -- [ ] ard_surface_reflectance -- [ ] atmospheric_correction -- [ ] cloud_detection -- [ ] fit_curve -- [ ] inspect +- [ ] ard_normalized_radar_backscatter (experimental) +- [ ] ard_surface_reflectance (experimental) +- [ ] atmospheric_correction (experimental) +- [ ] cloud_detection (experimental) +- [ ] fit_curve (experimental) +- [ ] inspect (experimental) - [ ] load_collection -- [ ] load_uploaded_files -- [ ] predict_curve +- [ ] load_stac (experimental) +- [ ] load_uploaded_files (experimental) +- [ ] predict_curve (experimental) - [ ] run_udf -- [ ] run_udf_externally -- [ ] sar_backscatter +- [ ] run_udf_externally (experimental) +- [ ] sar_backscatter (experimental) - [ ] save_result -- [ ] vector_to_random_points +- [ ] vector_to_random_points (experimental) + +The following processes are in proposal state (i.e. experimental) and may be added later: + +- [ ] aggregate_spatial_window (experimental) +- [ ] apply_polygon (experimental) +- [ ] array_create_labeled (experimental) +- [ ] array_find_label (experimental) +- [ ] filter_labels (experimental) +- [ ] filter_vector (experimental) +- [ ] flatten_dimensions (experimental) +- [ ] load_geojson (experimental) +- [ ] load_url (experimental) +- [ ] reduce_spatial (experimental) +- [ ] unflatten_dimension (experimental) +- [ ] vector_buffer (experimental) +- [ ] vector_reproject (experimental) +- [ ] vector_to_regular_points (experimental) ## Assumptions @@ -235,6 +236,45 @@ Arguments and return values can point to external files, e.g. } ``` +There are a couple of data types that can't be represented in JSON5 and will be provided as an object instead. + +**Labeled arrays:** +```json +{ + "type": "labeled-array", + "data": [ + { + "key": "B01", + "value": 1.23 + }, + { + "key": "B02", + "value": 0.98 + } + // ... + ] +} +``` + +**Data Cube Metadata:** +```json +{ + "type": "datacube", + "data": { + // uses the STAC datacube extension + "bands": { + "type": "bands", + "values": [ + "B01", + "B02", + "Bo3" + ] + } + // ... + } +} +``` + ### Assets Additional assets will be provided for the test cases. diff --git a/tests/aggregate_spatial_window.json5 b/tests/aggregate_spatial_window.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/aggregate_spatial_window.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/and.json5 b/tests/and.json5 index 6e2c8eb8..738239f1 100644 --- a/tests/and.json5 +++ b/tests/and.json5 @@ -14,6 +14,20 @@ }, "returns": false }, + { + "arguments": { + "x": true, + "y": null + }, + "returns": null + }, + { + "arguments": { + "x": false, + "y": true + }, + "returns": false + }, { "arguments": { "x": false, @@ -30,7 +44,21 @@ }, { "arguments": { - "x": true, + "x": null, + "y": true + }, + "returns": null + }, + { + "arguments": { + "x": null, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": null, "y": null }, "returns": null diff --git a/tests/apply_polygon.json5 b/tests/apply_polygon.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/apply_polygon.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/array_create_labeled.json5 b/tests/array_create_labeled.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/array_create_labeled.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/array_find_label.json5 b/tests/array_find_label.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/array_find_label.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/clip.json5 b/tests/clip.json5 index 29c19688..30422f19 100644 --- a/tests/clip.json5 +++ b/tests/clip.json5 @@ -72,6 +72,14 @@ }, "returns": -1 }, + { + "arguments": { + "x": -1.5, + "min": -1, + "max": -2 + }, + "throws": "MinMaxSwapped" + }, { "arguments": { "x": Infinity, diff --git a/tests/filter_labels.json5 b/tests/filter_labels.json5 deleted file mode 100644 index f0460bb1..00000000 --- a/tests/filter_labels.json5 +++ /dev/null @@ -1,28 +0,0 @@ -{ - "tests": [ - { - // Filters the data cube to only contain data from platform Sentinel-2A. This example assumes that the data cube has a dimension `platform` so that computations can distinguish between Sentinel-2A and Sentinel-2B data. - "arguments": { - "data": { - "from_parameter": "sentinel2_data" - }, - "condition": { - "process_graph": { - "eq": { - "process_id": "eq", - "arguments": { - "x": { - "from_parameter": "value" - }, - "y": "Sentinel-2A", - "case_sensitive": false - }, - "result": true - } - } - }, - "dimension": "platform" - } - } - ] -} \ No newline at end of file diff --git a/tests/filter_vector.json5 b/tests/filter_vector.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/filter_vector.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/flatten_dimensions.json5 b/tests/flatten_dimensions.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/flatten_dimensions.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/is_infinite.json5 b/tests/is_infinite.json5 index 2c6ac1cf..881f0f34 100644 --- a/tests/is_infinite.json5 +++ b/tests/is_infinite.json5 @@ -20,7 +20,13 @@ }, { "arguments": { - "x": -123456789.0 + "x": 4294967296 + }, + "returns": false + }, + { + "arguments": { + "x": -4294967296.0 }, "returns": false }, @@ -102,6 +108,24 @@ }, "returns": false }, + { + "arguments": { + "x": "+infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "+Infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "+inf" + }, + "returns": false + }, { "arguments": { "x": null diff --git a/tests/is_nodata.json5 b/tests/is_nodata.json5 index dd81695c..6ba64844 100644 --- a/tests/is_nodata.json5 +++ b/tests/is_nodata.json5 @@ -12,7 +12,9 @@ "arguments": { "x": 1 }, - "returns": false + "returns": false, + // Optional to avoid an error in case the no-data value is 1 + "optional": true }, { "arguments": { diff --git a/tests/load_geojson.json5 b/tests/load_geojson.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/load_geojson.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/load_stac.json5 b/tests/load_stac.json5 deleted file mode 100644 index 0e44535d..00000000 --- a/tests/load_stac.json5 +++ /dev/null @@ -1,58 +0,0 @@ -{ - "tests": [ - { - "title": "Load from a static STAC / batch job result", - "arguments": { - "url": "https://example.com/api/v1.0/jobs/123/results" - } - }, - { - "title": "Load from a STAC API", - "arguments": { - "url": "https://example.com/collections/SENTINEL2", - "spatial_extent": { - "west": 16.1, - "east": 16.6, - "north": 48.6, - "south": 47.2 - }, - "temporal_extent": [ - "2018-01-01", - "2019-01-01" - ], - "properties": { - "eo:cloud_cover": { - "process_graph": { - "cc": { - "process_id": "between", - "arguments": { - "x": { - "from_parameter": "value" - }, - "min": 0, - "max": 50 - }, - "result": true - } - } - }, - "platform": { - "process_graph": { - "pf": { - "process_id": "eq", - "arguments": { - "x": { - "from_parameter": "value" - }, - "y": "Sentinel-2B", - "case_sensitive": false - }, - "result": true - } - } - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/load_uploaded_files.json5 b/tests/load_uploaded_files.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/load_uploaded_files.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/load_url.json5 b/tests/load_url.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/load_url.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/or.json5 b/tests/or.json5 index 4a51e098..2622a868 100644 --- a/tests/or.json5 +++ b/tests/or.json5 @@ -9,10 +9,10 @@ }, { "arguments": { - "x": false, + "x": true, "y": false }, - "returns": false + "returns": true }, { "arguments": { @@ -23,7 +23,7 @@ }, { "arguments": { - "x": null, + "x": false, "y": true }, "returns": true @@ -31,6 +31,34 @@ { "arguments": { "x": false, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": false, + "y": null + }, + "returns": null + }, + { + "arguments": { + "x": null, + "y": true + }, + "returns": true + }, + { + "arguments": { + "x": null, + "y": false + }, + "returns": null + }, + { + "arguments": { + "x": null, "y": null }, "returns": null diff --git a/tests/reduce_spatial.json5 b/tests/reduce_spatial.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/reduce_spatial.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/unflatten_dimension.json5 b/tests/unflatten_dimension.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/unflatten_dimension.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/vector_buffer.json5 b/tests/vector_buffer.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/vector_buffer.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/vector_reproject.json5 b/tests/vector_reproject.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/vector_reproject.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/vector_to_regular_points.json5 b/tests/vector_to_regular_points.json5 deleted file mode 100644 index 308e1aa1..00000000 --- a/tests/vector_to_regular_points.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests": [] -} \ No newline at end of file diff --git a/tests/xor.json5 b/tests/xor.json5 index 0cb12326..88788b40 100644 --- a/tests/xor.json5 +++ b/tests/xor.json5 @@ -9,28 +9,56 @@ }, { "arguments": { - "x": false, + "x": true, "y": false }, - "returns": false + "returns": true }, { "arguments": { "x": true, - "y": false + "y": null + }, + "returns": null + }, + { + "arguments": { + "x": false, + "y": true }, "returns": true }, { "arguments": { - "x": true, + "x": false, + "y": false + }, + "returns": false + }, + { + "arguments": { + "x": false, "y": null }, "returns": null }, { "arguments": { - "x": false, + "x": null, + "y": true + }, + "returns": null + }, + { + "arguments": { + "x": null, + "y": false + }, + "returns": null + }, + { + "arguments": { + "x": null, "y": null }, "returns": null