Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: li missing platform name #2993

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions satpy/readers/fci_l1c_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ def _get_channel_name_from_dsname(dsname):

return channel_name

# Platform names according to the MTG FCI L1 Product User Guide,
# EUM/MTG/USR/13/719113 from 2019-06-27, pages 32 and 124, are MTI1, MTI2,
# MTI3, and MTI4, but we want to use names such as described in WMO OSCAR
# MTG-I1, MTG-I2, MTG-I3, and MTG-I4.
#
# Not sure how the numbering will be considering MTG-S1 and MTG-S2 will be launched
# in-between.
_platform_name_translate = {
"MTI1": "Meteosat-12",
"MTI2": "MTG-I2",
"MTI3": "MTG-I3",
"MTI4": "MTG-I4"}

class FCIL1cNCFileHandler(NetCDF4FsspecFileHandler):
"""Class implementing the MTG FCI L1c Filehandler.
Expand All @@ -193,21 +205,6 @@ class using the :mod:`~satpy.Scene.load` method with the reader
``"fci_l1c_nc"``.

"""

# Platform names according to the MTG FCI L1 Product User Guide,
# EUM/MTG/USR/13/719113 from 2019-06-27, pages 32 and 124, are MTI1, MTI2,
# MTI3, and MTI4, but we want to use names such as described in WMO OSCAR
# MTG-I1, MTG-I2, MTG-I3, and MTG-I4.
#
# After launch: translate to METEOSAT-xx instead? Not sure how the
# numbering will be considering MTG-S1 and MTG-S2 will be launched
# in-between.
_platform_name_translate = {
"MTI1": "MTG-I1",
"MTI2": "MTG-I2",
"MTI3": "MTG-I3",
"MTI4": "MTG-I4"}

def __init__(self, filename, filename_info, filetype_info):
"""Initialize file handler."""
super().__init__(filename, filename_info,
Expand Down Expand Up @@ -391,7 +388,7 @@ def _get_dataset_measurand(self, key, info=None):
res.attrs.update(info)
res.attrs.update(attrs)

res.attrs["platform_name"] = self._platform_name_translate.get(
res.attrs["platform_name"] = _platform_name_translate.get(
self["attr/platform"], self["attr/platform"])

# remove unpacking parameters for calibrated data
Expand Down
4 changes: 4 additions & 0 deletions satpy/readers/li_base_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
import xarray as xr
from pyproj import Proj

from satpy.readers.fci_l1c_nc import _platform_name_translate
from satpy.readers.netcdf_utils import NetCDF4FsspecFileHandler

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -516,10 +517,13 @@ def register_dataset(self, var_name, oc_name=None):

ds_name = var_name if oc_name is None else f"{var_name}_{oc_name}_sector"

platform = self.filename_info["mission_prefix"] + "I" + self.filename_info["spacecraft_id"]

ds_info = {
"name": ds_name,
"variable_name": var_name,
"sensor": "li",
"platform_name": _platform_name_translate[platform],
"file_type": self.filetype_info["file_type"]
}

Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/reader_tests/test_fci_l1c_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ def test_platform_name(self, reader_configs, fh_param):
"""
reader = _get_reader_with_filehandlers(fh_param["filenames"], reader_configs)
res = reader.load(["vis_06"], pad_data=False)
assert res["vis_06"].attrs["platform_name"] == "MTG-I1"
assert res["vis_06"].attrs["platform_name"] == "Meteosat-12"

@pytest.mark.parametrize(("fh_param", "compare_tuples"),
[(lazy_fixture("FakeFCIFileHandlerFDHSI_fixture"), (67, 10,
Expand Down
Loading
Loading