Skip to content

Commit

Permalink
Remove legacy ImageCollection from DataCube class hierarchy (#100/#278
Browse files Browse the repository at this point in the history
 related)
  • Loading branch information
soxofaan committed Mar 11, 2022
1 parent 7a3d393 commit 4efab2c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Include openEO API error id automatically in exception message to simplify user support and post-mortem analysis.
- Use `Connection.default_timeout` (when set) also on version discovery request
- Drop `ImageCollection` from `DataCube`'s class hierarchy.
- This practically removes very old (pre-0.4.0) methods like `date_range_filter` and `bbox_filter` from `DataCube`.
([#100](https://github.com/Open-EO/openeo-python-client/issues/100), [#278](https://github.com/Open-EO/openeo-python-client/issues/278))

### Removed

Expand Down
2 changes: 1 addition & 1 deletion openeo/rest/datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
THIS = object()


class DataCube(ImageCollection, _FromNodeMixin):
class DataCube(_FromNodeMixin):
"""
Class representing a openEO Data Cube. Data loaded from the backend is returned as an object of this class.
Various processing methods can be invoked to build a complete workflow.
Expand Down
18 changes: 12 additions & 6 deletions tests/rest/datacube/test_datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ def _get_leaf_node(cube, force_flat=True) -> dict:
raise ValueError(repr(cube))


def test_date_range_filter(s2cube):
def test_date_range_filter(con040):
s2cube = con040.load_collection("S2")
im = s2cube.date_range_filter("2016-01-01", "2016-03-10")
graph = _get_leaf_node(im)
assert graph['process_id'] == 'filter_temporal'
assert graph['arguments']['extent'] == ["2016-01-01", "2016-03-10"]


def test_filter_daterange(s2cube):
def test_filter_daterange(con040):
s2cube = con040.load_collection("S2")
im = s2cube.filter_daterange(extent=("2016-01-01", "2016-03-10"))
graph = _get_leaf_node(im)
assert graph['process_id'] == 'filter_temporal'
Expand Down Expand Up @@ -190,10 +192,11 @@ def test_filter_bands_index(s2cube, api_version):
assert im.flat_graph() == expected


def test_pipe(s2cube, api_version):
def test_pipe(con040, api_version):
def ndvi_percent(cube):
return cube.ndvi().linear_scale_range(0, 1, 0, 100)

s2cube = con040.load_collection("S2")
im = s2cube.pipe(ndvi_percent)
assert im.flat_graph() == load_json_resource('data/{v}/pipe.json'.format(v=api_version))

Expand Down Expand Up @@ -255,8 +258,9 @@ def test_filter_bbox_default_handling(s2cube, kwargs, expected):
assert graph["arguments"]["extent"] == dict(west=3, east=4, south=8, north=9, **expected)


def test_bbox_filter_nsew(s2cube):
def test_bbox_filter_nsew(con040):
# TODO: remove this test for deprecated `bbox_filter`
s2cube = con040.load_collection("S2")
im = s2cube.bbox_filter(
west=652000, east=672000, north=5161000, south=5181000, crs=32632
)
Expand All @@ -267,8 +271,9 @@ def test_bbox_filter_nsew(s2cube):
}


def test_bbox_filter_tblr(s2cube):
def test_bbox_filter_tblr(con040):
# TODO: remove this test for deprecated `bbox_filter`
s2cube = con040.load_collection("S2")
im = s2cube.bbox_filter(
left=652000, right=672000, top=5161000, bottom=5181000, srs=32632
)
Expand All @@ -279,8 +284,9 @@ def test_bbox_filter_tblr(s2cube):
}


def test_bbox_filter_nsew_zero(s2cube):
def test_bbox_filter_nsew_zero(con040):
# TODO: remove this test for deprecated `bbox_filter`
s2cube = con040.load_collection("S2")
im = s2cube.bbox_filter(
west=0, east=0, north=0, south=0, crs=32632
)
Expand Down

0 comments on commit 4efab2c

Please sign in to comment.