Skip to content

Commit

Permalink
fixup! Remove legacy ImageCollection from DataCube class hierarchy (#…
Browse files Browse the repository at this point in the history
…100/#278 related)
  • Loading branch information
soxofaan committed Mar 11, 2022
1 parent 4efab2c commit a97c1ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
4 changes: 2 additions & 2 deletions tests/rest/datacube/test_datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ def test_filter_bands_index(s2cube, api_version):
assert im.flat_graph() == expected


def test_pipe(con040, api_version):
def test_pipe(con040):
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))
assert im.flat_graph() == load_json_resource('data/0.4.0/pipe.json')


def test_filter_bbox_minimal(s2cube):
Expand Down
19 changes: 0 additions & 19 deletions tests/rest/datacube/test_datacube100.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,25 +1424,6 @@ def validation(request, context):
assert m.call_count == 1


def test_pipe_with_args(con100):
def ndvi_scaled(cube, in_max=2, out_max=3):
return cube.ndvi().linear_scale_range(0, in_max, 0, out_max)

s2cube = con100.load_collection("S2")
im = s2cube.pipe(ndvi_scaled)
assert im.flat_graph()["apply1"]["arguments"]["process"]["process_graph"]["linearscalerange1"]["arguments"] == {
'inputMax': 2, 'inputMin': 0, 'outputMax': 3, 'outputMin': 0, 'x': {'from_parameter': 'x'}
}
im = s2cube.pipe(ndvi_scaled, 4, 5)
assert im.flat_graph()["apply1"]["arguments"]["process"]["process_graph"]["linearscalerange1"]["arguments"] == {
'inputMax': 4, 'inputMin': 0, 'outputMax': 5, 'outputMin': 0, 'x': {'from_parameter': 'x'}
}
im = s2cube.pipe(ndvi_scaled, out_max=7)
assert im.flat_graph()["apply1"]["arguments"]["process"]["process_graph"]["linearscalerange1"]["arguments"] == {
'inputMax': 2, 'inputMin': 0, 'outputMax': 7, 'outputMin': 0, 'x': {'from_parameter': 'x'}
}


def test_flatten_dimensions(con100):
s2 = con100.load_collection("S2")
cube = s2.flatten_dimensions(dimensions=["t", "bands"], target_dimension="features")
Expand Down

0 comments on commit a97c1ac

Please sign in to comment.