From c6dcc621501014122f8a8ed9891103d7b3415ce5 Mon Sep 17 00:00:00 2001 From: tebadi Date: Tue, 21 Jun 2022 17:37:19 +1000 Subject: [PATCH 1/2] Ensure GeoMAD band names match the band name of C3 Landsat data. --- odc/stats/plugins/gm.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/odc/stats/plugins/gm.py b/odc/stats/plugins/gm.py index 8e95825f..63a2f677 100644 --- a/odc/stats/plugins/gm.py +++ b/odc/stats/plugins/gm.py @@ -47,7 +47,19 @@ def __init__( self.cloud_filters = cloud_filters self._renames = aux_names self.aux_bands = tuple( - self._renames.get(k, k) for k in ("smad", "emad", "bcmad", "count") + self._renames.get(k, k) + for k in ( + "smad", + "emad", + "bcmad", + "count", + "red", + "green", + "blue", + "nir", + "swir1", + "swir2", + ) ) self._work_chunks = work_chunks @@ -164,7 +176,18 @@ def __init__( mask_band: str = "fmask", nodata_classes: Optional[Tuple[str, ...]] = ("nodata",), cloud_filters: Dict[str, Iterable[Tuple[str, int]]] = None, - aux_names=dict(smad="sdev", emad="edev", bcmad="bcdev", count="count"), + aux_names=dict( + smad="sdev", + emad="edev", + bcmad="bcdev", + count="count", + red="nbart_red", + green="nbart_green", + blue="nbart_blue", + nir="nbart_nir", + swir1="nbart_swir_1", + swir2="nbart_swir_2", + ), rgb_bands=None, **kwargs, ): From 7ed06af5bbefe1782dda26f023df0181ef63f6a5 Mon Sep 17 00:00:00 2001 From: tebadi Date: Wed, 22 Jun 2022 14:45:24 +1000 Subject: [PATCH 2/2] Fix input spectral band names to the expected output band names. --- odc/stats/plugins/gm.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/odc/stats/plugins/gm.py b/odc/stats/plugins/gm.py index 63a2f677..6a9e62ab 100644 --- a/odc/stats/plugins/gm.py +++ b/odc/stats/plugins/gm.py @@ -53,12 +53,6 @@ def __init__( "emad", "bcmad", "count", - "red", - "green", - "blue", - "nir", - "swir1", - "swir2", ) ) @@ -181,28 +175,22 @@ def __init__( emad="edev", bcmad="bcdev", count="count", - red="nbart_red", - green="nbart_green", - blue="nbart_blue", - nir="nbart_nir", - swir1="nbart_swir_1", - swir2="nbart_swir_2", ), rgb_bands=None, **kwargs, ): if bands is None: bands = ( - "red", - "green", - "blue", - "nir", - "swir1", - "swir2", + "nbart_red", + "nbart_red", + "nbart_blue", + "nbart_nir", + "nbart_swir_1", + "nbart_swir_2", "nbart_contiguity", ) if rgb_bands is None: - rgb_bands = ("red", "green", "blue") + rgb_bands = ("nbart_red", "nbart_red", "nbart_blue") super().__init__( bands=bands,