Readers¶
SatPy supports reading and loading data from many input file formats and
schemes. The Scene
object provides a simple interface
around all the complexity of these various formats through its load
method. The following sections describe the different way data can be loaded,
requested, or added to a Scene object.
Available Readers¶
To get a list of available readers use the available_readers function:
>>> from satpy import available_readers
>>> available_readers()
Filter loaded files¶
Coming soon…
Load data¶
Datasets in SatPy are identified by certain pieces of metadata set during
data loading. These include name, wavelength, calibration,
resolution, polarization, and modifiers. Normally, once a Scene
is created requesting datasets by name or wavelength is all that is
needed:
>>> from satpy import Scene
>>> scn = Scene(reader="seviri_l1b_hrit", filenames=filenames)
>>> scn.load([0.6, 0.8, 10.8])
>>> scn.load(['IR_120', 'IR_134'])
However, in many cases datasets are available in multiple spatial resolutions,
multiple calibrations (brightness_temperature
, reflectance
,
radiance
, etc),
multiple polarizations, or have corrections or other modifiers already applied
to them. By default SatPy will provide the version of the dataset with the
highest resolution and the highest level of calibration (brightness
temperature or reflectance over radiance). It is also possible to request one
of these exact versions of a dataset by using the
DatasetID
class:
>>> from satpy import DatasetID
>>> my_channel_id = DatasetID(name='IR_016', calibration='radiance')
>>> scn.load([my_channel_id])
>>> print(scn['IR_016'])
Or request multiple datasets at a specific calibration, resolution, or polarization:
>>> scn.load([0.6, 0.8], resolution=1000)
Or multiple calibrations:
>>> scn.load([0.6, 10.8], calibrations=['brightness_temperature', 'radiance'])
In the above case SatPy will load whatever dataset is available and matches
the specified parameters. So the above load
call would load the 0.6
(a visible/reflectance band) radiance data and 10.8
(an IR band)
brightness temperature data.
Note
If a dataset could not be loaded there is no exception raised. You must
check the
scn.missing_datasets
property for any DatasetID
that could not be loaded.
To find out what datasets are available from a reader from the files that were
provided to the Scene
use
available_dataset_ids()
:
>>> scn.available_dataset_ids()
Or available_dataset_names()
for just the string
names of Datasets:
>>> scn.available_dataset_names()
Search for local files¶
SatPy provides a utility
find_files_and_readers()
for searching for files in
a base directory matching various search parameters. This function discovers
files based on filename patterns. It returns a dictionary mapping reader name
to a list of filenames supported. This dictionary can be passed directly to
the Scene
initialization.
>>> from satpy import find_files_and_readers, Scene
>>> from datetime import datetime
>>> my_files = find_files_and_readers(base_dir='/data/viirs_sdrs',
... reader='viirs_sdr',
... start_time=datetime(2017, 5, 1, 18, 1, 0),
... end_time=datetime(2017, 5, 1, 18, 30, 0))
>>> scn = Scene(filenames=my_files)
See the find_files_and_readers()
documentation for
more information on the possible parameters.
Adding a Reader to SatPy¶
This is described in the developer guide, see Adding a Custom Reader to SatPy.
Implemented readers¶
xRIT-based readers¶
HRIT/LRIT format reader¶
This module is the base module for all HRIT-based formats. Here, you will find the common building blocks for hrit reading.
One of the features here is the on-the-fly decompression of hrit files. It needs a path to the xRITDecompress binary to be provided through the environment variable called XRIT_DECOMPRESS_PATH. When compressed hrit files are then encountered (files finishing with .C_), they are decompressed to the system’s temporary directory for reading.
SEVIRI HRIT format reader¶
References
- MSG Level 1.5 Image Data Format Description
- Radiometric Calibration of MSG SEVIRI Level 1.5 Image Data in Equivalent Spectral Blackbody Radiance
HRIT format reader for JMA data¶
References
JMA HRIT - Mission Specific Implementation http://www.jma.go.jp/jma/jma-eng/satellite/introduction/4_2HRIT.pdf
GOES HRIT format reader¶
References
LRIT/HRIT Mission Specific Implementation, February 2012 GVARRDL98.pdf 05057_SPE_MSG_LRIT_HRI
HRIT format reader¶
References
- ELECTRO-L GROUND SEGMENT MSU-GS INSTRUMENT,
- LRIT/HRIT Mission Specific Implementation, February 2012