diff --git a/ECOv002_granules/ECOv002_granules.py b/ECOv002_granules/ECOv002_granules.py index 2fae206..b045dc1 100644 --- a/ECOv002_granules/ECOv002_granules.py +++ b/ECOv002_granules/ECOv002_granules.py @@ -7,4 +7,5 @@ from .L3TSM import L3TSM from .L4TESI import L4TESI from .L4TWUE import L4TWUE +from .granule import ECOSTRESSGranule from .open_granule import open_granule diff --git a/ECOv002_granules/L1CTRAD.py b/ECOv002_granules/L1CTRAD.py index d413ff6..edcb408 100644 --- a/ECOv002_granules/L1CTRAD.py +++ b/ECOv002_granules/L1CTRAD.py @@ -11,15 +11,14 @@ from typing import Union, List, Any import numpy as np -import rasters as rt -import colored_logging as cl -from ECOv002_granules.tiled_granule import ECOSTRESSTiledGranule -import he5py +import rasters as rt import rasters from rasters import Raster, MultiRaster, RasterGeometry, RasterGrid, KDTree +import colored_logging as cl from .granule import ECOSTRESSGranule +from .tiled_granule import ECOSTRESSTiledGranule __author__ = "Gregory Halverson" diff --git a/ECOv002_granules/L2TSTARS.py b/ECOv002_granules/L2TSTARS.py index 429c553..59408e5 100644 --- a/ECOv002_granules/L2TSTARS.py +++ b/ECOv002_granules/L2TSTARS.py @@ -3,18 +3,27 @@ from dateutil import parser -from .colors import NDVI_COLORMAP +from .colors import * from .granule import ECOSTRESSGranule from .tiled_granule import ECOSTRESSTiledGranule PRIMARY_VARIABLE = "NDVI" PREVIEW_CMAP = NDVI_COLORMAP +VARIABLE_CMAPS = { + "NDVI": NDVI_COLORMAP, + "NDVI-UQ": "jet", + "albedo": ALBEDO_COLORMAP, + "albedo-UQ": "jet" +} + class L2STARSGranule(ECOSTRESSGranule): _PRODUCT_NAME = "L2T_STARS" _PRIMARY_VARIABLE = "NDVI" _GRANULE_PREVIEW_CMAP = PREVIEW_CMAP + VARIABLE_CMAPS = VARIABLE_CMAPS + def __init__(self, product_filename: str): super(L2STARSGranule, self).__init__(product_filename=product_filename) @@ -27,6 +36,7 @@ def __init__(self, product_filename: str): def NDVI(self): if self._NDVI is None: self._NDVI = self.variable("NDVI") + self._NDVI.cmap = NDVI_COLORMAP return self._NDVI @@ -41,6 +51,7 @@ def NDVI_UQ(self): def albedo(self): if self._albedo is None: self._albedo = self.variable("albedo") + self._albedo.cmap = ALBEDO_COLORMAP return self._albedo @@ -65,6 +76,8 @@ class L2TSTARS(ECOSTRESSTiledGranule, L2STARSGranule): _PRIMARY_VARIABLE = PRIMARY_VARIABLE _GRANULE_PREVIEW_CMAP = PREVIEW_CMAP + VARIABLE_CMAPS = VARIABLE_CMAPS + def __init__( self, product_location: str = None, diff --git a/ECOv002_granules/L3TJET.py b/ECOv002_granules/L3TJET.py index 517c85e..af855e6 100644 --- a/ECOv002_granules/L3TJET.py +++ b/ECOv002_granules/L3TJET.py @@ -46,6 +46,42 @@ def __repr__(self): return display_string + @property + def BESSinst(self) -> Raster: + return self.variable("BESSinst", cmap=ET_COLORMAP) + + @property + def ETdaily(self) -> Raster: + return self.variable("ETdaily", cmap=ET_COLORMAP) + + @property + def MOD16inst(self) -> Raster: + return self.variable("MOD16inst", cmap=ET_COLORMAP) + + @property + def PTJPLSMinst(self) -> Raster: + return self.variable("PTJPLSMinst", cmap=ET_COLORMAP) + + @property + def PTJPLSMcanopy(self) -> Raster: + return self.variable("PTJPLSMcanopy", cmap=ET_COLORMAP) + + @property + def PTJPLSMsoil(self) -> Raster: + return self.variable("PTJPLSMsoil", cmap=ET_COLORMAP) + + @property + def PTJPLSMinterception(self) -> Raster: + return self.variable("PTJPLSMinterception", cmap=ET_COLORMAP) + + @property + def STICinst(self) -> Raster: + return self.variable("STICinst", cmap=ET_COLORMAP) + + @property + def STICcanopy(self) -> Raster: + return self.variable("STICcanopy", cmap=ET_COLORMAP) + @property def ETinst(self) -> Raster: return self.variable("ETinst", cmap=ET_COLORMAP) diff --git a/ECOv002_granules/tiled_granule.py b/ECOv002_granules/tiled_granule.py index 9b3a22c..ca5e64d 100644 --- a/ECOv002_granules/tiled_granule.py +++ b/ECOv002_granules/tiled_granule.py @@ -38,6 +38,8 @@ class ECOSTRESSTiledGranule(ECOSTRESSGranule): _STANDARD_METADATA_GROUP = "StandardMetadata" _PRODUCT_METADATA_GROUP = "ProductMetadata" + VARIABLE_CMAPS = {} + def __init__( self, product_location: str = None, @@ -554,6 +556,9 @@ def variable(self, variable: str, geometry: RasterGeometry = None, cmap=None, ** duration = end_time - start_time logger.info(f"finished reading {self.product} {variable} ({duration:0.2f}s)") + if cmap is None and cmap in self.VARIABLE_CMAPS: + cmap = self.VARIABLE_CMAPS[variable] + if cmap is not None: print(f"assigning cmap: {cmap}") image.cmap = cmap