From 43827ccc908760760a0798c0f5d06a9bdca997c2 Mon Sep 17 00:00:00 2001 From: Sauli Joro Date: Tue, 9 Jun 2020 10:45:23 +0000 Subject: [PATCH 1/4] Add link to documentation and a new file pattern for test data. --- satpy/etc/readers/vii_l1b_nc.yaml | 3 ++- satpy/readers/vii_base_nc.py | 12 ++++++++++-- satpy/readers/vii_l1b_nc.py | 9 ++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/satpy/etc/readers/vii_l1b_nc.yaml b/satpy/etc/readers/vii_l1b_nc.yaml index 071954047a..edc5a1d54a 100644 --- a/satpy/etc/readers/vii_l1b_nc.yaml +++ b/satpy/etc/readers/vii_l1b_nc.yaml @@ -11,7 +11,8 @@ 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_patterns: ['W_xx-eumetsat-darmstadt,SAT,{spacecraft_name:s}-VII-1B-RAD_C_EUM_{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'] + file_patterns: ['W_xx-eumetsat-darmstadt,SAT,{spacecraft_name:s}-VII-1B-RAD_C_EUM_{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', + '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 diff --git a/satpy/readers/vii_base_nc.py b/satpy/readers/vii_base_nc.py index 986d7c1608..f2b035aae8 100644 --- a/satpy/readers/vii_base_nc.py +++ b/satpy/readers/vii_base_nc.py @@ -206,12 +206,20 @@ def _get_global_attributes(self): @property def start_time(self): """Get observation start time.""" - return datetime.strptime(self['/attr/sensing_start_time_utc'], '%Y%m%d%H%M%S.%f') + try: + start_time = datetime.strptime(self['/attr/sensing_start_time_utc'], '%Y%m%d%H%M%S.%f') + except ValueError: + start_time = datetime.strptime(self['/attr/sensing_start_time_utc'], '%Y-%m-%d %H:%M:%S.%f') + return start_time @property def end_time(self): """Get observation end time.""" - return datetime.strptime(self['/attr/sensing_end_time_utc'], '%Y%m%d%H%M%S.%f') + try: + end_time = datetime.strptime(self['/attr/sensing_end_time_utc'], '%Y%m%d%H%M%S.%f') + except ValueError: + end_time = datetime.strptime(self['/attr/sensing_end_time_utc'], '%Y-%m-%d %H:%M:%S.%f') + return end_time @property def spacecraft_name(self): diff --git a/satpy/readers/vii_l1b_nc.py b/satpy/readers/vii_l1b_nc.py index 8095119238..150739513d 100644 --- a/satpy/readers/vii_l1b_nc.py +++ b/satpy/readers/vii_l1b_nc.py @@ -15,8 +15,15 @@ # # You should have received a copy of the GNU General Public License # along with satpy. If not, see . +"""EUMETSAT EPS-SG Visible/Infrared Imager (VII) Level 1B products reader. -"""EUMETSAT EPS-SG Visible/Infrared Imager (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`_. +References: +.. _EPS-SG VII Level 1B Product Format Specification: https://www.eumetsat.int/website/wcm/idc/idcplg?IdcService + =GET_FILE&dDocName=PDF_EPSSG_VII_L1B_PFS&RevisionSelectionMethod=LatestReleased&Rendition=Web + +""" import logging import numpy as np From b4b9678aa403c834acc20c375472438b2ced413b Mon Sep 17 00:00:00 2001 From: Sauli Joro Date: Tue, 9 Jun 2020 12:07:13 +0000 Subject: [PATCH 2/4] Add VII L1b example to documentation. --- doc/source/examples/vii_l1b_nc.rst | 36 ++++++++++++++++++++++++++++++ satpy/etc/readers/vii_l1b_nc.yaml | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 doc/source/examples/vii_l1b_nc.rst diff --git a/doc/source/examples/vii_l1b_nc.rst b/doc/source/examples/vii_l1b_nc.rst new file mode 100644 index 0000000000..17e0b58c7b --- /dev/null +++ b/doc/source/examples/vii_l1b_nc.rst @@ -0,0 +1,36 @@ +EPS-SG VII netCDF Example +=============================== + +Satpy includes a reader for the EPS-SG Visible and Infrared Imager (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. + +.. warning:: + + This example is currently a work in progress. Some of the below code may + not work with the currently released version of Satpy. Additional updates + to this example will be coming soon. + +.. code-block:: python + + import glob + from satpy.scene import Scene + + # find the file/files to be read + 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') + + # print available dataset names for this scene + print(scn.available_dataset_names()) + + # load the datasets of interest + # NOTE: only radiances are supported for test data + scn.load(["vii_668"], calibration="radiance") + + # resample the scene to a specified area (e.g. "eurol1" for Europe in 1km resolution) + eur = scn.resample("eurol", resampler='nearest', radius_of_influence=5000) + + # save the resampled data to disk + eur.save_dataset("vii_668", filename='./vii_668_eur.png') diff --git a/satpy/etc/readers/vii_l1b_nc.yaml b/satpy/etc/readers/vii_l1b_nc.yaml index edc5a1d54a..48fe06570c 100644 --- a/satpy/etc/readers/vii_l1b_nc.yaml +++ b/satpy/etc/readers/vii_l1b_nc.yaml @@ -12,7 +12,7 @@ file_types: nc_vii_l1b_rad: file_reader: !!python/name:satpy.readers.vii_l1b_nc.ViiL1bNCFileHandler file_patterns: ['W_xx-eumetsat-darmstadt,SAT,{spacecraft_name:s}-VII-1B-RAD_C_EUM_{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', - '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'] + '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 From 53cf508d3e4e422894eb2dacaa8a755ce4a91fa1 Mon Sep 17 00:00:00 2001 From: Sauli Joro Date: Wed, 10 Jun 2020 13:50:10 +0000 Subject: [PATCH 3/4] Add VII L1b example to index.rst. --- doc/source/examples/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/source/examples/index.rst b/doc/source/examples/index.rst index b77d49ddb7..6b72b79034 100644 --- a/doc/source/examples/index.rst +++ b/doc/source/examples/index.rst @@ -42,3 +42,5 @@ as explanations in the various sections of this documentation. - Reading Level 2 MAIA cloud products * - :doc:`Meteosat Third Generation FCI Natural Color RGB ` - Generate Natural Color RGB from Meteosat Third Generation (MTG) FCI Level 1c data + * - :doc:`Reading EPS-SG Visible and Infrared Imager (VII) with Pytroll ` + - Read and visualize EPS-SG VII L1B test data and save it to an image \ No newline at end of file From 77cbda9815482009dc0d58150a9a27f0f66c167d Mon Sep 17 00:00:00 2001 From: Sauli Joro Date: Wed, 10 Jun 2020 14:14:54 +0000 Subject: [PATCH 4/4] Add VII L1b example to toc-tree. --- doc/source/examples/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/examples/index.rst b/doc/source/examples/index.rst index 6b72b79034..075d5d1541 100644 --- a/doc/source/examples/index.rst +++ b/doc/source/examples/index.rst @@ -14,6 +14,7 @@ as explanations in the various sections of this documentation. :maxdepth: 1 fci_l1c_natural_color + vii_l1b_nc .. list-table:: :header-rows: 1