Skip to content

Commit

Permalink
fixup! Open-EO#76: ImageCollectionClient.band(): support both band na…
Browse files Browse the repository at this point in the history
…mes and indices
  • Loading branch information
soxofaan committed Sep 5, 2019
1 parent 64a1f5b commit b92d541
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/data/band0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"loadcollection1": {
"arguments": {
"spatial_extent": null,
"id": "SENTINEL2_RADIOMETRY_10M",
"temporal_extent": null
},
"process_id": "load_collection",
"result": false
},
"reduce1": {
"arguments": {
"dimension": "spectral_bands",
"reducer": {
"callback": {
"r1": {
"arguments": {
"index": 0,
"data": {
"from_argument": "data"
}
},
"process_id": "array_element",
"result": true
}
}
},
"data": {
"from_node": "loadcollection1"
}
},
"process_id": "reduce",
"result": false
}
}
20 changes: 20 additions & 0 deletions tests/test_bandmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@
@requests_mock.mock()
class TestBandMath(TestCase):

def test_basic(self, m):
session = openeo.connect("http://localhost:8000/api")
session.post = MagicMock()
session.download = MagicMock()

m.get("http://localhost:8000/api/", json={"version": "0.4.0"})
m.get("http://localhost:8000/api/collections/SENTINEL2_RADIOMETRY_10M", json={"product_id": "sentinel2_subset",
"bands": [{'band_id': 'B02'},
{'band_id': 'B04'},
{'band_id': 'B08'},
],
'time': {'from': '2015-06-23',
'to': '2018-06-18'}})

cube = session.imagecollection("SENTINEL2_RADIOMETRY_10M")
expected_graph = load_json_resource('data/band0.json')

assert cube.band(0).graph == expected_graph
assert cube.band('B02').graph == expected_graph

def test_evi(self,m):
# configuration phase: define username, endpoint, parameters?
session = openeo.connect("http://localhost:8000/api")
Expand Down

0 comments on commit b92d541

Please sign in to comment.