|
| 1 | +# Tests |
| 2 | + |
| 3 | +This folder contains test cases for the openEO processes. |
| 4 | + |
| 5 | +## Assumptions |
| 6 | + |
| 7 | +The test cases assume a couple of things as they are an abstraction and not bound to specific implementations: |
| 8 | +- The JSON Schema type `number` explicitly includes the values `+Infinity`, `-Infinity` and `NaN`. |
| 9 | +- The input and output values for no-data values are `null` by default unless otherwise specified by a runner. |
| 10 | +- Input that is not valid according to the process schema must be rejected upfront, without any process evaluation attempt. Consequently, cases with schema mismatches are not covered in these tests. For example, the absolute process only tests against the data types `number` and `null`. There are no tests for a boolean or string input. |
| 11 | +- 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. |
| 12 | +- If not otherwise specified for numbers, a precision of 10 decimals is checked so return values should have at least 11 decimals. |
| 13 | + |
| 14 | +## Test Files |
| 15 | + |
| 16 | +To allow for more data types (e.g. infinity and nan for numbers), all the files are encoded in **JSON5** instead of JSON. |
| 17 | + |
| 18 | +The test files have the following schema: [schema/schema.json](./schema/schema.json) |
| 19 | + |
| 20 | +### No-data values |
| 21 | + |
| 22 | +No-data values have a special encoding in tests (see below). |
| 23 | +The encoding is replaced with `null` unless otherwise specified by the runners. |
| 24 | + |
| 25 | +```json5 |
| 26 | +{ |
| 27 | + "type": "nodata" |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | +### Datetimes |
| 32 | + |
| 33 | +Datetimes as strings have a varying precision, especially regarding the milliseconds. |
| 34 | +Also, sometimes timezones are differently handled. |
| 35 | + |
| 36 | +Datetimes in return values should be encoded in compliance with RFC 3339 so that the results can be compared better: |
| 37 | + |
| 38 | +```json5 |
| 39 | +{ |
| 40 | + "type": "datetime", |
| 41 | + "value": "2020-01-01T00:00:00Z" |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +### External references |
| 46 | + |
| 47 | +Arguments and return values can point to external files, e.g. |
| 48 | + |
| 49 | +```json5 |
| 50 | +{ |
| 51 | + "$ref": "https://host.example/datacube.json" |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +The test suite can currently only load JSON and JSON5 files. |
| 56 | + |
| 57 | +### Labeled arrays |
| 58 | + |
| 59 | +Labeled arrays can't be represented in JSON5 and will be provided as an object instead. |
| 60 | + |
| 61 | +```json5 |
| 62 | +{ |
| 63 | + "type": "labeled-array", |
| 64 | + "data": [ |
| 65 | + { |
| 66 | + "key": "B01", |
| 67 | + "value": 1.23 |
| 68 | + }, |
| 69 | + { |
| 70 | + "key": "B02", |
| 71 | + "value": 0.98 |
| 72 | + } |
| 73 | + // ... |
| 74 | + ] |
| 75 | +} |
| 76 | +``` |
| 77 | + |
| 78 | +### Datacubes |
| 79 | + |
| 80 | +Datacubes can't be represented in JSON5 and will be provided as an object instead. |
| 81 | +Vector datacubes are currently not supported. |
| 82 | + |
| 83 | +```json5 |
| 84 | +{ |
| 85 | + "type": "datacube", |
| 86 | + "data": [ |
| 87 | + // multi-dimensional array |
| 88 | + // can be set to `null` if the data values are irrelevant for the test. |
| 89 | + ], |
| 90 | + "nodata": [ |
| 91 | + NaN |
| 92 | + ], |
| 93 | + "order": ["bands", "t", "y", "x"], |
| 94 | + "dimensions": { |
| 95 | + // similar to the STAC datacube extension |
| 96 | + // properties: type, axis (if type = spatial), values, and reference_system (optional) |
| 97 | + "bands": { |
| 98 | + "type": "bands", |
| 99 | + "values": ["blue","green","red","nir"] |
| 100 | + }, |
| 101 | + "t": { |
| 102 | + "type": "temporal", |
| 103 | + "values": ["2020-06-01T00:00:00Z","2020-06-03T00:00:00Z","2020-06-06T00:00:00Z"] |
| 104 | + }, |
| 105 | + "y": { |
| 106 | + "type": "spatial", |
| 107 | + "axis": "y", |
| 108 | + "values": [5757495.0,5757485.0,5757475.0,5757465.0], |
| 109 | + "reference_system": "EPSG:25832" |
| 110 | + }, |
| 111 | + "x": { |
| 112 | + "type": "spatial", |
| 113 | + "axis": "x", |
| 114 | + "values": [404835.0,404845.0,404855.0,404865.0,404875.0], |
| 115 | + "reference_system": "EPSG:25832" |
| 116 | + } |
| 117 | + } |
| 118 | +} |
| 119 | +``` |
0 commit comments