From 809cb29afb3cc10d1faf551d3a79ae265df01ef0 Mon Sep 17 00:00:00 2001 From: Thomas Rieutord Date: Fri, 22 Sep 2023 12:01:46 +0000 Subject: [PATCH] MAJOR[Fixes observed missing data over forest]: ESAWC transform changed (all labels+1) because the tree labels was at 0, thus seen as missing --- mmt/datasets/landcovers.py | 4 ++-- mmt/datasets/transforms.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mmt/datasets/landcovers.py b/mmt/datasets/landcovers.py index 85e387d..4d8f105 100644 --- a/mmt/datasets/landcovers.py +++ b/mmt/datasets/landcovers.py @@ -246,12 +246,12 @@ class EcoclimapSG(TorchgeoLandcover): class ESAWorldCover(TorchgeoLandcover): path = os.path.join(config.paths.data_dir, "tiff_data", "ESA-WorldCover-2021")#, "ESA_WorldCover_10m_2021_v200_60deg_macrotile_N30E000") labels = [ - "Tree cover", "Shrubland", "Grassland", "Cropland", "Built-up", + "No data", "Tree cover", "Shrubland", "Grassland", "Cropland", "Built-up", "Bare/sparse veg.", "Snow and ice", "Permanent water bodies", "Herbaceous wetland", "Mangroves", "Moss and lichen" ] cmap = [ - (0,100,0), (255, 187, 34), (255, 255, 76), (240, 150, 255), (250, 0, 0), (180, 180, 180), + (0,0,0), (0,100,0), (255, 187, 34), (255, 255, 76), (240, 150, 255), (250, 0, 0), (180, 180, 180), (240, 240, 240), (0, 100, 200), (0, 150, 160), (0, 207, 117), (250, 230, 160) ] crs = rasterio.crs.CRS.from_epsg(4326) diff --git a/mmt/datasets/transforms.py b/mmt/datasets/transforms.py index e0d6a4b..3d524a8 100644 --- a/mmt/datasets/transforms.py +++ b/mmt/datasets/transforms.py @@ -149,4 +149,4 @@ def __call__(self, x): x[x == self.missing_label] = self.sea_label return x -EsawcTransform = tvt.Compose([FloorDivMinus(10, 1), FillMissingWithSea(-1, 7)]) +EsawcTransform = tvt.Compose([FloorDivMinus(10, 0), FillMissingWithSea(0, 8)])