diff --git a/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/style_intertidal_cfg.py b/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/style_intertidal_cfg.py index bc00d6299..0c282ec22 100644 --- a/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/style_intertidal_cfg.py +++ b/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/style_intertidal_cfg.py @@ -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", diff --git a/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/utils_intertidal.py b/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/utils_intertidal.py index c75adf353..fcd46b3cb 100644 --- a/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/utils_intertidal.py +++ b/dev/services/wms/ows_refactored/sea_ocean_coast/intertidal_c3/utils_intertidal.py @@ -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] diff --git a/dev/terria/terria-cube-v8.json b/dev/terria/terria-cube-v8.json index da1d482f3..45683a4a9 100644 --- a/dev/terria/terria-cube-v8.json +++ b/dev/terria/terria-cube-v8.json @@ -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