Skip to content

Commit

Permalink
Add mask, merge_cubes, refactor datacube object
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Dec 15, 2023
1 parent e83f2cc commit 51b2834
Show file tree
Hide file tree
Showing 20 changed files with 516 additions and 336 deletions.
23 changes: 10 additions & 13 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ This folder contains test cases for the openEO processes.
- [x] log
- [x] lt
- [x] lte
- [ ] mask
- [x] mask*
- [ ] mask_polygon
- [x] max
- [x] mean
- [x] median
- [ ] merge_cubes
- [x] merge_cubes*
- [x] min
- [x] mod
- [x] multiply
Expand Down Expand Up @@ -334,33 +334,30 @@ Vector datacubes are currently not supported.
"nodata": [
NaN
],
"dimensions": [
"order": ["bands", "t", "y", "x"],
"dimensions": {
// similar to the STAC datacube extension
// properties: name, type, axis (if type = spatial), values, and reference_system (optional)
{
"name": "bands",
// properties: type, axis (if type = spatial), values, and reference_system (optional)
"bands": {
"type": "bands",
"values": ["blue","green","red","nir"]
},
{
"name": "t",
"t": {
"type": "temporal",
"values": ["2020-06-01T00:00:00Z","2020-06-03T00:00:00Z","2020-06-06T00:00:00Z"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0,5757485.0,5757475.0,5757465.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"x": {
"type": "spatial",
"axis": "x",
"values": [404835.0,404845.0,404855.0,404865.0,404875.0],
"reference_system": "EPSG:25832"
}
]
}
}
```
68 changes: 28 additions & 40 deletions tests/add_dimension.json5
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,29 @@
},
"returns": {
"type": "datacube",
"dimensions": [
{
"name": "b",
"order": ["b", "t", "y", "x"],
"dimensions": {
"b": {
"type": "bands",
"values": ["B1"]
},
{
"name": "t",
"t": {
"type": "temporal",
"values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0, 5757485.0, 5757475.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"x": {
"type": "spatial",
"axis": "x",
"values": [404835.0, 404845.0, 404855.0, 404865.0],
"reference_system": "EPSG:25832"
}
],
},
"data": null
}
},
Expand All @@ -55,32 +52,29 @@
},
"returns": {
"type": "datacube",
"dimensions": [
{
"name": "t",
"order": ["t", "bands", "y", "x"],
"dimensions": {
"t": {
"type": "temporal",
"values": ["2020-01-01T00:00:00Z"]
},
{
"name": "bands",
"bands": {
"type": "bands",
"values": ["red", "green", "blue"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0, 5757485.0, 5757475.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"x": {
"type": "spatial",
"axis": "x",
"values": [404835.0, 404845.0, 404855.0, 404865.0],
"reference_system": "EPSG:25832"
}
],
},
"data": null
}
},
Expand All @@ -96,32 +90,29 @@
},
"returns": {
"type": "datacube",
"dimensions": [
{
"name": "t2",
"order": ["t2", "t", "y", "x"],
"dimensions": {
"t2": {
"type": "temporal",
"values": ["2010-01-01T00:00:00.0Z"]
},
{
"name": "t",
"t": {
"type": "temporal",
"values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0, 5757485.0, 5757475.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"x": {
"type": "spatial",
"axis": "x",
"values": [404835.0, 404845.0, 404855.0, 404865.0],
"reference_system": "EPSG:25832"
}
],
},
"data": null
}
},
Expand All @@ -137,32 +128,29 @@
},
"returns": {
"type": "datacube",
"dimensions": [
{
"name": "var",
"order": ["var", "t", "y", "x"],
"dimensions": {
"var": {
"type": "other",
"values": [1]
},
{
"name": "t",
"t": {
"type": "temporal",
"values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0, 5757485.0, 5757475.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"x": {
"type": "spatial",
"axis": "x",
"values": [404835.0, 404845.0, 404855.0, 404865.0],
"reference_system": "EPSG:25832"
}
],
},
"data": null
}
},
Expand Down
52 changes: 22 additions & 30 deletions tests/apply.json5
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,25 @@
"returns": {
"type": "datacube",
"nodata": NaN,
"dimensions": [
{
"name": "t",
"order": ["t", "y", "x"],
"dimensions": {
"t": {
"type": "temporal",
"values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0, 5757485.0, 5757475.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"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],
Expand Down Expand Up @@ -113,27 +111,23 @@
"returns": {
"type": "datacube",
"nodata": NaN,
"dimensions": [
{
"name": "t",
"order": ["t", "y", "x"],
"dimensions": {
"t": {
"type": "temporal",
"values": ["2020-06-01T00:00:00Z", "2020-06-03T00:00:00Z"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0, 5757485.0, 5757475.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"x": {
"type": "spatial",
"axis": "x",
"values": [404835.0, 404845.0, 404855.0, 404865.0],
"reference_system": "EPSG:25832"
}
],
},
"data": [
[
[false, true, false, true],
Expand Down Expand Up @@ -178,43 +172,41 @@
},
"returns": {
"type": "datacube",
"nodata": 0,
"dimensions": [
{
"name": "bands",
"nodata": 255,
"order": ["bands", "y", "x"],
"dimensions": {
"bands": {
"type": "bands",
"values": ["red", "green", "blue"]
},
{
"name": "y",
"y": {
"type": "spatial",
"axis": "y",
"values": [5757495.0, 5757485.0, 5757475.0],
"reference_system": "EPSG:25832"
},
{
"name": "x",
"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, 0, 2420]
[90, 2110, 255, 2420]
],
[
[360, 870, 700, 2160],
[880, 1400, 580, 1930],
[2300, 390, 0, 870]
[2300, 390, 255, 870]
],
[
[1740, 880, 810, 1650],
[250, 770, 720, 90],
[1480, 1150, 0, 2080]
[1480, 1150, 255, 2080]
]
]
}
Expand Down
Loading

0 comments on commit 51b2834

Please sign in to comment.