From 2c2ee381b84aa8d98c1eab27390fc4fc05ae0568 Mon Sep 17 00:00:00 2001 From: Paolo Veglio <paolo.veglio@ssec.wisc.edu> Date: Wed, 11 Oct 2023 14:40:43 +0000 Subject: [PATCH] fixed issue in read_data where reflective/emissive bands were identified using long_name --- entrypoint.py | 21 +++++++++++---------- mvcm/read_data.py | 29 +++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/entrypoint.py b/entrypoint.py index 2eb14df..6056712 100644 --- a/entrypoint.py +++ b/entrypoint.py @@ -1,10 +1,11 @@ """Main call for MVCM.""" import argparse -from pkg_resources import get_distribution - from mvcm.main import main +# from pkg_resources import get_distribution + + # #################################################################### # # TEST CASE # data: @@ -27,7 +28,7 @@ _eco_file = "goge1_2_img.v1" if __name__ == "__main__": - _VERSION = get_distribution("mvcm").version + # _VERSION = get_distribution("mvcm").version parser = argparse.ArgumentParser(prog="MVCM", description="") parser.add_argument( @@ -65,13 +66,13 @@ if __name__ == "__main__": parser.add_argument("--sst", help="Sea surface temperature file name") parser.add_argument("--eco", help="Ecosystem file") parser.add_argument("-o", "--out", help="output file name") - parser.add_argument( - "-V", - "--version", - action="version", - version=_VERSION, - help="print version and exit", - ) + # parser.add_argument( + # "-V", + # "--version", + # action="version", + # version=_VERSION, + # help="print version and exit", + # ) parser.add_argument( "-v", "--verbose", action="store_true", help="print verbose information" ) diff --git a/mvcm/read_data.py b/mvcm/read_data.py index a0686e0..ad41b75 100644 --- a/mvcm/read_data.py +++ b/mvcm/read_data.py @@ -58,6 +58,29 @@ _mod_bands = [ "M15", "M16", ] + +_reflectance_bands = [ + "M01", + "M02", + "M03", + "M04", + "M05", + "M06", + "M07", + "M08", + "M09", + "M10", + "M11", +] + +_emissive_bands = [ + "M12", + "M13", + "M14", + "M15", + "M16", +] + logger = logging.getLogger(__name__) # logging.basicConfig(level=logging.INFO, format='%(name)s - %(levelname)s - # %(message)s') @@ -248,7 +271,8 @@ class ReadData(CollectInputs): rad_data = xr.Dataset() for band in list(l1b_data.variables): - if "reflectance" in l1b_data[band].long_name: + # if "reflectance" in l1b_data[band].long_name: + if band in _reflectance_bands: if hasattr(l1b_data[band], "VCST_scale_factor"): scale_factor = ( l1b_data[band].VCST_scale_factor @@ -261,7 +285,8 @@ class ReadData(CollectInputs): l1b_data[band].values * scale_factor / np.cos(solar_zenith * _DTR), ) - elif "radiance" in l1b_data[band].long_name: + elif band in _emissive_bands: + # elif "radiance" in l1b_data[band].long_name: bt_lut = f"{band}_brightness_temperature_lut" rad_data[band] = ( self.dims, -- GitLab