Skip to content
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
6 changes: 3 additions & 3 deletions doc/source/examples/vii_l1b_nc.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
EPS-SG VII netCDF Example
EPS-SG METimage netCDF Example
===============================

Satpy includes a reader for the EPS-SG Visible and Infrared Imager (VII)
Satpy includes a reader for the EPS-SG METimage (VII)
Level 1b data. The following Python code snippet shows an example on how to use
Satpy to read a channel and resample and save the image over the European area.

Expand All @@ -20,7 +20,7 @@ Satpy to read a channel and resample and save the image over the European area.
filenames = glob.glob('/path/to/VII/data/W_xx-eumetsat-darmstadt,SAT,SGA1-VII-1B-RAD_C_EUMT_20191007055100*')

# create a VII scene from the selected granule(s)
scn = Scene(filenames=filenames, reader='vii_l1b_nc')
scn = Scene(filenames=filenames, reader='metimage_l1b_nc')

# print available dataset names for this scene
print(scn.available_dataset_names())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sensor_name: visir/vii
sensor_name: visir/metimage
modifiers:
nir_reflectance:
modifier: !!python/name:satpy.modifiers.NIRReflectance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
reader:
name: vii_l1b_nc
short_name: VII L1B RAD NetCDF4
long_name: EPS-SG Visual Infrafred Imager (VII) Level 1B Radiance data in netCDF4 format
name: metimage_l1b_nc
short_name: METimage (VII) L1B RAD NetCDF4
long_name: EPS-SG METimage (VII) Level 1B Radiance data in netCDF4 format
description: >
Reader for EUMETSAT EPS-SG Visual Infrared Imager Level 1B Radiance files in NetCDF4 format per FS V4A.
Reader for EUMETSAT EPS-SG METimage (former name VII) Level 1B Radiance files in NetCDF4 format.
status: Beta
supports_fsspec: false
sensors: [vii]
sensors: [metimage]
reader: !!python/name:satpy.readers.core.yaml_reader.FileYAMLReader

file_types:
# EUMETSAT EPSG-SG Visual Infrared Imager Level 1B Radiance files in NetCDF4 format
nc_vii_l1b_rad:
file_reader: !!python/name:satpy.readers.vii_l1b_nc.ViiL1bNCFileHandler
file_reader: !!python/name:satpy.readers.metimage_l1b_nc.METimageL1BNCFileHandler
file_patterns: ['W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-1B-RAD_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}_T__.nc',
'W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-1B-RAD_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}____.nc']
cached_longitude: data/measurement_data/longitude
cached_latitude: data/measurement_data/latitude

datasets:

# --- Coordinates ---
lon_tie_points:
name: lon_tie_points
Expand Down Expand Up @@ -109,7 +107,12 @@ datasets:
file_type: nc_vii_l1b_rad
file_key: data/measurement_data/vii_763
coordinates: [lat_pixels, lon_pixels]
calibration: [reflectance, radiance]
calibration:
reflectance:
standard_name: toa_bidirectional_reflectance
units: "%"
radiance:
standard_name: toa_outgoing_radiance_per_unit_wavelength
chan_solar_index: 4
wavelength: [0.75695, 0.7627, 0.76845]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,64 +1,63 @@
reader:
name: vii_l2_nc
short_name: VII L2 NetCDF4
long_name: EPS-SG Visual Infrared Imager (VII) Level 2 data in netCDF4 format
name: metimage_l2_nc
short_name: METimage (VII) L2 NetCDF4
long_name: EPS-SG METimage (VII) Level 2 data in netCDF4 format
description: >
Reader for EUMETSAT EPSG-SG Visual Infrared Imager Level 2 files in NetCDF4 format.
Reader for EUMETSAT EPS-SG METimage (former name VII) Level 2 files in NetCDF4 format.
status: Beta
supports_fsspec: false
sensors: [vii]
sensors: [metimage]
reader: !!python/name:satpy.readers.core.yaml_reader.FileYAMLReader

file_types:
# EUMETSAT EPSG-SG Visual Infrared Imager Level 2 Cloud Mask files in NetCDF4 format
# Cloud Mask files in NetCDF4 format
nc_vii_l2_cld:
file_reader: !!python/name:satpy.readers.vii_l2_nc.ViiL2NCFileHandler
file_reader: !!python/name:satpy.readers.metimage_l2_nc.METimageL2NCFileHandler
file_patterns: ['W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-02-CLD_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}____.nc']
cached_longitude: data/measurement_data/longitude
cached_latitude: data/measurement_data/latitude
orthorect: False

# EUMETSAT EPSG-SG Visual Infrared Imager Level 2 Cloud Top Pressure (using the Oxygen-A Band) files in NetCDF4 format
# Cloud Top Pressure (using the Oxygen-A Band) files in NetCDF4 format
nc_vii_l2_ctp:
file_reader: !!python/name:satpy.readers.vii_l2_nc.ViiL2NCFileHandler
file_reader: !!python/name:satpy.readers.metimage_l2_nc.METimageL2NCFileHandler
file_patterns: ['W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-02-CTP_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}____.nc']
cached_longitude: data/measurement_data/longitude
cached_latitude: data/measurement_data/latitude

# EUMETSAT EPSG-SG Visual Infrared Imager Level 2 Cloud Mask and First Guess Cloud Properties files in NetCDF4 format
# Cloud Mask and First Guess Cloud Properties files in NetCDF4 format
nc_vii_l2_icm:
file_reader: !!python/name:satpy.readers.vii_l2_nc.ViiL2NCFileHandler
file_reader: !!python/name:satpy.readers.metimage_l2_nc.METimageL2NCFileHandler
file_patterns: ['W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-02-ICM_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}____.nc']
cached_longitude: data/measurement_data/longitude
cached_latitude: data/measurement_data/latitude

# EUMETSAT EPSG-SG Visual Infrared Imager Level 2 Optimal Cloud Analysis files in NetCDF4 format
# Optimal Cloud Analysis files in NetCDF4 format
nc_vii_l2_oca:
file_reader: !!python/name:satpy.readers.vii_l2_nc.ViiL2NCFileHandler
file_reader: !!python/name:satpy.readers.metimage_l2_nc.METimageL2NCFileHandler
file_patterns: ['W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-02-OCA_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}____.nc']
cached_longitude: data/measurement_data/longitude
cached_latitude: data/measurement_data/latitude

# EUMETSAT EPSG-SG Visual Infrared Imager Level 2 Total Precipitable Water (from VII visible/near-infrared) files in NetCDF4 format
# Total Precipitable Water (from visible/near-infrared) files in NetCDF4 format
nc_vii_l2_wvv:
file_reader: !!python/name:satpy.readers.vii_l2_nc.ViiL2NCFileHandler
file_reader: !!python/name:satpy.readers.metimage_l2_nc.METimageL2NCFileHandler
file_patterns: ['W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-02-WVV_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}____.nc']
cached_longitude: data/measurement_data/longitude
cached_latitude: data/measurement_data/latitude
interpolate: False
orthorect: False

# EUMETSAT EPSG-SG Visual Infrared Imager Level 2 Total Precipitable Water (from VII thermal infra-red) files in NetCDF4 format
# Total Precipitable Water (from thermal infra-red) files in NetCDF4 format
nc_vii_l2_wvi:
file_reader: !!python/name:satpy.readers.vii_l2_nc.ViiL2NCFileHandler
file_reader: !!python/name:satpy.readers.metimage_l2_nc.METimageL2NCFileHandler
file_patterns: ['W_XX-EUMETSAT-Darmstadt,SAT,{spacecraft_name:s}-VII-02-WVI_C_EUMT_{creation_time:%Y%m%d%H%M%S}_{mission_type:s}_{environment:s}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode:s}_{processing_mode:s}____.nc']
cached_longitude: data/measurement_data/longitude
cached_latitude: data/measurement_data/latitude
interpolate: False
orthorect: False

datasets:

# --- Coordinates ---
# TODO Coordinates on tie points are kept for test purposes
lon_tie_points:
Expand Down
7 changes: 6 additions & 1 deletion satpy/readers/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
LOG = logging.getLogger(__name__)

# Old Name -> New Name
PENDING_OLD_READER_NAMES = {"fci_l1c_fdhsi": "fci_l1c_nc", "viirs_l2_cloud_mask_nc": "viirs_edr"}
PENDING_OLD_READER_NAMES = {
"fci_l1c_fdhsi": "fci_l1c_nc",
"viirs_l2_cloud_mask_nc": "viirs_edr",
"vii_l1b_nc": "metimage_l1b_nc",
"vii_l2_nc": "metimage_l2_nc",
}
OLD_READER_NAMES: dict[str, str] = {
"slstr_l2": "ghrsst_l2",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
# You should have received a copy of the GNU General Public License
# along with satpy. If not, see <http://www.gnu.org/licenses/>.

"""Utilities for the management of VII products."""
"""Utilities for the management of METimage (VII) products."""

PLATFORM_NAME_TRANSLATE = {
"SGA1": "Metop-SG-A1",
"SGA2": "Metop-SG-A2",
"SGA3": "Metop-SG-A3"
}

# PLANCK COEFFICIENTS FOR CALIBRATION AS DEFINED BY EUMETSAT
C1 = 1.191062e+8 # [W/m2·sr-1·µm4]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python

Check notice on line 1 in satpy/readers/core/metimage_nc.py

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

✅ No longer an issue: Complex Method

ViiNCBaseFileHandler.get_dataset is no longer above the threshold for cyclomatic complexity. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check notice on line 1 in satpy/readers/core/metimage_nc.py

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

✅ No longer an issue: Bumpy Road Ahead

ViiNCBaseFileHandler.get_dataset is no longer above the threshold for logical blocks with deeply nested code. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Satpy developers
Expand All @@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with satpy. If not, see <http://www.gnu.org/licenses/>.

"""EUMETSAT EPS-SG Visible/Infrared Imager (VII) readers base class."""
"""EUMETSAT EPS-SG METimage (VII) readers base class."""


import datetime as dt
Expand All @@ -25,14 +25,14 @@
import xarray as xr
from geotiepoints.viiinterpolator import tie_points_geo_interpolation, tie_points_interpolation

from satpy.readers.core.metimage import PLATFORM_NAME_TRANSLATE, SCAN_ALT_TIE_POINTS, TIE_POINTS_FACTOR
from satpy.readers.core.netcdf import NetCDF4FileHandler
from satpy.readers.core.vii import SCAN_ALT_TIE_POINTS, TIE_POINTS_FACTOR

logger = logging.getLogger(__name__)


class ViiNCBaseFileHandler(NetCDF4FileHandler):
"""Base reader class for VII products in netCDF format.
class METimageNCBaseFileHandler(NetCDF4FileHandler):
"""Base reader class for METimage (VII) products in netCDF format.

Args:
filename (str): File to read
Expand Down Expand Up @@ -113,6 +113,10 @@
if orthorect_data_name is not None:
variable = self._perform_orthorectification(variable, orthorect_data_name)

# wrapping longitude between -180 and 180 degrees
if variable.name == "longitude":
variable = self.wrap_longitude(variable)

Check warning on line 119 in satpy/readers/core/metimage_nc.py

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

METimageNCBaseFileHandler.get_dataset has a cyclomatic complexity of 13, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
# Manage the attributes of the dataset
variable.attrs.setdefault("units", None)

Expand All @@ -121,6 +125,12 @@
variable = self._standardize_dims(variable)
return variable

@staticmethod
def wrap_longitude(longitude_array):
"""Wrap longitude between -180 and 180 degrees."""
longitude_array = ((longitude_array + 180) % 360) - 180
return longitude_array

@staticmethod
def _perform_interpolation(variable) -> xr.DataArray:
"""Perform the interpolation from tie points to pixel points.
Expand Down Expand Up @@ -199,6 +209,7 @@
"filename_start_time": self.filename_info["sensing_start_time"],
"filename_end_time": self.filename_info["sensing_end_time"],
"platform_name": self.spacecraft_name,
"rows_per_scan": 24
}

# Add a "quality_group" item to the dictionary with all the variables and attributes
Expand Down Expand Up @@ -240,15 +251,15 @@
@property
def spacecraft_name(self):
"""Return spacecraft name."""
return self["/attr/spacecraft"]
return PLATFORM_NAME_TRANSLATE.get(self["/attr/spacecraft"], self["/attr/spacecraft"])

@property
def sensor(self):
"""Return sensor."""
return self["/attr/instrument"]
return "metimage"

@property
def ssp_lon(self):
"""Return subsatellite point longitude."""
# This parameter is not applicable to VII
# This parameter is not applicable to METimage
return None
21 changes: 11 additions & 10 deletions satpy/readers/vii_l1b_nc.py → satpy/readers/metimage_l1b_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
#
# You should have received a copy of the GNU General Public License
# along with satpy. If not, see <http://www.gnu.org/licenses/>.
"""EUMETSAT EPS-SG Visible/Infrared Imager (VII) Level 1B products reader.
"""EUMETSAT EPS-SG METimage (VII) Level 1B products reader.

The ``vii_l1b_nc`` reader reads and calibrates EPS-SG VII L1b image data in netCDF format. The format is explained
in the `EPS-SG VII Level 1B Product Format Specification V4A`_.
The ``metimage_l1b_nc`` reader reads and calibrates EPS-SG METimage L1b image data in netCDF format. The format is
explained in the `EPS-SG VII Level 1B Product Format Specification V4A`_.
Note that METimage is the official name of the instrument, while VII is the old name used during the mission (design).
The name VII is currently still used in the filenames as well as in official system documentation
(e.g. the format specs).

This version is applicable for the vii test data V2 to be released in Jan 2022.

.. _EPS-SG VII Level 1B Product Format Specification V4A: https://www.eumetsat.int/media/44393
.. _EPS-SG VII Level 1B Product Format Specification V4A: https://user.eumetsat.int/s3/eup-strapi-media/EPS_SG_VII_Level_1_B_Product_Format_Specification_654c0b397a.pdf

"""

Expand All @@ -31,14 +32,14 @@
import numpy as np
import xarray as xr

from satpy.readers.core.vii import C1, C2, MEAN_EARTH_RADIUS
from satpy.readers.core.vii_nc import ViiNCBaseFileHandler
from satpy.readers.core.metimage import C1, C2, MEAN_EARTH_RADIUS
from satpy.readers.core.metimage_nc import METimageNCBaseFileHandler

logger = logging.getLogger(__name__)


class ViiL1bNCFileHandler(ViiNCBaseFileHandler):
"""Reader class for VII L1B products in netCDF format."""
class METimageL1BNCFileHandler(METimageNCBaseFileHandler):
"""Reader class for METimage (VII) L1B products in netCDF format."""

def __init__(self, filename, filename_info, filetype_info, **kwargs):
"""Read the calibration data and prepare the class for dataset reading."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

import xarray as xr

from satpy.readers.core.vii_nc import ViiNCBaseFileHandler
from satpy.readers.core.metimage_nc import METimageNCBaseFileHandler

logger = logging.getLogger(__name__)


class ViiL2NCFileHandler(ViiNCBaseFileHandler):
class METimageL2NCFileHandler(METimageNCBaseFileHandler):
"""Reader class for VII L2 products in netCDF format."""

def _perform_orthorectification(self, variable: xr.DataArray, orthorect_data_name: str) -> xr.DataArray:
Expand Down
29 changes: 0 additions & 29 deletions satpy/readers/vii_base_nc.py

This file was deleted.

29 changes: 0 additions & 29 deletions satpy/readers/vii_utils.py

This file was deleted.

Loading
Loading