Skip to content
Snippets Groups Projects
Commit 2c2ee381 authored by Paolo Veglio's avatar Paolo Veglio
Browse files

fixed issue in read_data where reflective/emissive bands were identified using long_name

parent 50e6e580
No related branches found
No related tags found
No related merge requests found
"""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"
)
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment