diff --git a/odc/stats/plugins/lc_level3.py b/odc/stats/plugins/lc_level3.py index 0f7242e8..1a5c68c8 100644 --- a/odc/stats/plugins/lc_level3.py +++ b/odc/stats/plugins/lc_level3.py @@ -4,6 +4,7 @@ from typing import Tuple import xarray as xr +from odc.stats._algebra import expr_eval from ._registry import StatsPluginInterface, register NODATA = 255 @@ -22,30 +23,35 @@ def measurements(self) -> Tuple[str, ...]: def reduce(self, xx: xr.Dataset) -> xr.Dataset: - l34_dss = xx.classes_l3_l4 - urban_dss = xx.urban_classes - cultivated_dss = xx.cultivated_class - # Cultivated pipeline applies a mask which feeds only terrestrial veg (110) to the model # Just exclude no data (255) and apply the cultivated results - cultivated_mask = cultivated_dss != int(NODATA) - l34_cultivated_masked = xr.where(cultivated_mask, cultivated_dss, l34_dss) + res = expr_eval( + "where(a