Skip to content

Commit

Permalink
Merge pull request #1236 from sjoro/vii_test
Browse files Browse the repository at this point in the history
Add documentation link to VII L1b-reader and a new file pattern.
  • Loading branch information
djhoese authored Jun 10, 2020
2 parents 7413392 + 77cbda9 commit 6ba4ab7
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
3 changes: 3 additions & 0 deletions doc/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -42,3 +43,5 @@ as explanations in the various sections of this documentation.
- Reading Level 2 MAIA cloud products
* - :doc:`Meteosat Third Generation FCI Natural Color RGB <fci_l1c_natural_color>`
- Generate Natural Color RGB from Meteosat Third Generation (MTG) FCI Level 1c data
* - :doc:`Reading EPS-SG Visible and Infrared Imager (VII) with Pytroll <vii_l1b_nc>`
- Read and visualize EPS-SG VII L1B test data and save it to an image
36 changes: 36 additions & 0 deletions doc/source/examples/vii_l1b_nc.rst
Original file line number Diff line number Diff line change
@@ -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')
3 changes: 2 additions & 1 deletion satpy/etc/readers/vii_l1b_nc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 10 additions & 2 deletions satpy/readers/vii_base_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 8 additions & 1 deletion satpy/readers/vii_l1b_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +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 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
Expand Down

0 comments on commit 6ba4ab7

Please sign in to comment.