Skip to content

Commit

Permalink
Basic test.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpacemanPaul committed Jul 15, 2024
1 parent 47ded4b commit c48765a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions datacube_ows/band_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ def multi_date_delta(data, time_direction=-1):
def multi_date_pass(data):
return data

def multi_date_raw_example(data, band1, band2, band_mapper=None):
if band_mapper:
band1 = band_mapper(band1)
band2 = band_mapper(band2)
data1, data2 = (data.sel(time=dt) for dt in data.coords["time"].values)
return (
(data2[band1] - data1[band1]) - (data2[band2] - data1[band2])
) / (
data1[band1] + data1[band2] + data2[band1] + data2[band2]
)


@band_modulator
@scalable
Expand Down
8 changes: 7 additions & 1 deletion integration_tests/cfg/ows_test_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,14 @@
"allowed_count_range": [2, 2],
"animate": False,
"preserve_user_date_order": True,
"pass_raw_data": True,
"aggregator_function": {
"function": "datacube_ows.band_utils.multi_date_delta",
"function": "datacube_ows.band_utils.multi_date_raw_example",
"mapped_bands": True,
"kwargs": {
"band1": "nir",
"band2": "red",
}
},
"mpl_ramp": "RdYlBu",
"range": [-1.0, 1.0],
Expand Down

0 comments on commit c48765a

Please sign in to comment.