Skip to content

Commit

Permalink
Add multidate handling to DEA Intertidal using raw band data (#1275)
Browse files Browse the repository at this point in the history
* Add multidate handling

* Update utils_intertidal.py

* Fix code

* Update terria-cube-v8.json
  • Loading branch information
robbibt authored Jul 16, 2024
1 parent 21e430a commit 15624e5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,33 @@
"hot": "ta_hot",
},
},
"multi_date": [
{
"allowed_count_range": [2, 2],
"animate": False,
"preserve_user_date_order": True,
"pass_raw_data": True,
"aggregator_function": {
"function": "ows_refactored.sea_ocean_coast.intertidal_c3.utils_intertidal.multi_date_raw_elevation",
"mapped_bands": True,
"kwargs": {
"band": "elevation",
}
},
"mpl_ramp": "RdBu",
"range": [-0.5, 0.5],
"legend": {
"begin": "-0.5",
"end": "0.5",
"ticks": [
"-0.5",
"0.0",
"0.5",
]
},
"feature_info_label": "elevation_difference",
},
],
"include_in_feature_info": False,
"needed_bands": ["elevation", "ta_lot", "ta_hot"],
"mpl_ramp": "viridis",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,15 @@ def uncertainty_adaptive(data, band, lot, hot, band_mapper=None):
proportion_array = data[band] / otr

return proportion_array


def multi_date_raw_elevation(data, band, band_mapper=None):
"""
Compares two elevation layers and calculates difference in elevation.
"""
if band_mapper is not None:
band = band_mapper(band)

data1, data2 = (data.sel(time=dt) for dt in data.coords["time"].values)

return data2[band] - data1[band]
1 change: 1 addition & 0 deletions dev/terria/terria-cube-v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@
"linkedWcsUrl": "https://ows.dea.ga.gov.au/",
"linkedWcsCoverage": "ga_s2ls_intertidal_cyear_3",
"dateFormat": "'Year: 'yyyy",
"availableDiffStyles": ["intertidal_elevation_adaptive"],
"leafletUpdateInterval": 750,
"tileErrorHandlingOptions": {
"ignoreUnknownTileErrors": true
Expand Down

0 comments on commit 15624e5

Please sign in to comment.