satpy.readers package

Submodules

satpy.readers.aapp_l1b module

Reader for aapp level 1b data.

Options for loading:

  • pre_launch_coeffs (False): use pre-launch coefficients if True, operational otherwise (if available).

https://nwp-saf.eumetsat.int/site/download/documentation/aapp/NWPSAF-MF-UD-003_Formats_v8.0.pdf

class satpy.readers.aapp_l1b.AVHRRAAPPL1BFile(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Reader for AVHRR L1B files created from the AAPP software.

Initialize object information by reading the input file.

available_datasets(configured_datasets=None)[source]

Get the available datasets.

calibrate(dataset_id, pre_launch_coeffs=False, calib_coeffs=None)[source]

Calibrate the data.

property end_time

Get the time of the final observation.

get_angles(angle_id)[source]

Get sun-satellite viewing angles.

get_dataset(key, info)[source]

Get a dataset from the file.

navigate(coordinate_id)[source]

Get the longitudes and latitudes of the scene.

read()[source]

Read the data.

property start_time

Get the time of the first observation.

satpy.readers.aapp_l1b.create_xarray(arr)[source]

Create an xarray.DataArray.

satpy.readers.abi_base module

Advance Baseline Imager reader base class for the Level 1b and l2+ reader.

class satpy.readers.abi_base.NC_ABI_BASE(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Base reader for ABI L1B L2+ NetCDF4 files.

Open the NetCDF file with xarray and prepare the Dataset for reading.

property end_time

End time of the current file’s observations.

get_area_def(key)[source]

Get the area definition of the data at hand.

get_dataset(key, info)[source]

Load a dataset.

property nc

Get the xarray dataset for this file.

property sensor

Get sensor name for current file handler.

spatial_resolution_to_number()[source]

Convert the ‘spatial_resolution’ global attribute to meters.

property start_time

Start time of the current file’s observations.

satpy.readers.abi_l1b module

Advance Baseline Imager reader for the Level 1b format.

The files read by this reader are described in the official PUG document:

class satpy.readers.abi_l1b.NC_ABI_L1B(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.abi_base.NC_ABI_BASE

File reader for individual ABI L1B NetCDF4 files.

Open the NetCDF file with xarray and prepare the Dataset for reading.

get_dataset(key, info)[source]

Load a dataset.

satpy.readers.abi_l2_nc module

Advance Baseline Imager NOAA Level 2+ products reader.

The files read by this reader are described in the official PUG document:

https://www.goes-r.gov/products/docs/PUG-L2+-vol5.pdf

class satpy.readers.abi_l2_nc.NC_ABI_L2(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.abi_base.NC_ABI_BASE

Reader class for NOAA ABI l2+ products in netCDF format.

Open the NetCDF file with xarray and prepare the Dataset for reading.

available_datasets(configured_datasets=None)[source]

Add resolution to configured datasets.

get_dataset(key, info)[source]

Load a dataset.

satpy.readers.acspo module

ACSPO SST Reader.

See the following page for more information:

https://podaac.jpl.nasa.gov/dataset/VIIRS_NPP-OSPO-L2P-v2.3

class satpy.readers.acspo.ACSPOFileHandler(filename, filename_info, filetype_info, auto_maskandscale=False, xarray_kwargs=None, cache_var_size=0, cache_handle=False)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

ACSPO L2P SST File Reader.

Initialize object.

property end_time

Get final observation time of data.

get_dataset(dataset_id, ds_info)[source]

Load data array and metadata from file on disk.

get_metadata(dataset_id, ds_info)[source]

Collect various metadata about the specified dataset.

get_shape(ds_id, ds_info)[source]

Get numpy array shape for the specified dataset.

Parameters
  • ds_id (DataID) – ID of dataset that will be loaded

  • ds_info (dict) – Dictionary of dataset information from config file

Returns

(rows, cols)

Return type

tuple

property platform_name

Get satellite name for this file’s data.

property sensor_name

Get instrument name for this file’s data.

property start_time

Get first observation time of data.

satpy.readers.agri_l1 module

Advanced Geostationary Radiation Imager reader for the Level_1 HDF format.

The files read by this reader are described in the official Real Time Data Service:

class satpy.readers.agri_l1.HDF_AGRI_L1(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

AGRI l1 file handler.

Init filehandler.

calibrate(data, lut)[source]

Calibrate digital number (DN) to brightness_temperature.

Parameters
  • dn – Raw detector digital number

  • lut – the look up table

Returns

brightness_temperature [K]

dn2(dn, calibration, slope, offset)[source]

Convert digital number (DN) to reflectance or radiance.

Parameters
  • dn – Raw detector digital number

  • slope – Slope

  • offset – Offset

Returns

Reflectance [%] or Radiance [mW/ (m2 cm-1 sr)]

property end_time

Get the end time.

get_area_def(key)[source]

Get the area definition.

get_dataset(dataset_id, ds_info)[source]

Load a dataset.

property start_time

Get the start time.

satpy.readers.ahi_hsd module

Advanced Himawari Imager (AHI) standard format data reader.

References

Time Information

AHI observations use the idea of a “scheduled” time and an “observation time. The “scheduled” time is when the instrument was told to record the data, usually at a specific and consistent interval. The “observation” time is when the data was actually observed. Scheduled time can be accessed from the scheduled_time metadata key and observation time from the start_time key.

class satpy.readers.ahi_hsd.AHIHSDFileHandler(filename, filename_info, filetype_info, mask_space=True, calib_mode='nominal', user_calibration=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

AHI standard format reader.

The AHI sensor produces data for some pixels outside the Earth disk (i,e: atmospheric limb or deep space pixels). By default, these pixels are masked out as they contain data of limited or no value, but some applications do require these pixels. It is therefore possible to override the default behaviour and perform no masking of non-Earth pixels.

In order to change the default behaviour, use the ‘mask_space’ variable as part of reader_kwargs upon Scene creation:

import satpy
import glob

filenames = glob.glob('*FLDK*.dat')
scene = satpy.Scene(filenames,
                    reader='ahi_hsd',
                    reader_kwargs={'mask_space': False})
scene.load([0.6])

The AHI HSD data files contain multiple VIS channel calibration coefficients. By default, the standard coefficients in header block 5 are used. If the user prefers the updated calibration coefficients then they can pass calib_mode=’update’ when creating a scene:

import satpy
import glob

filenames = glob.glob('*FLDK*.dat')
scene = satpy.Scene(filenames,
                    reader='ahi_hsd',
                    reader_kwargs={'calib_mode': 'update'})
scene.load([0.6])

Alternative AHI calibrations are also available, such as GSICS coefficients. As such, you can supply custom per-channel correction by setting calib_mode=’custom’ and passing correction factors via:

user_calibration={‘chan’: [‘slope’: slope, ‘offset’: offset]}

Where slo and off are per-channel slope and offset coefficients defined by::

rad_leo = (rad_geo - off) / slo

If you do not have coefficients for a particular band, then by default the slope will be set to 1 .and the offset to 0.:

import satpy
import glob

# Load bands 7, 14 and 15, but we only have coefs for 7+14
calib_dict = {'B07': {'slope': 0.99, 'offset': 0.002},
              'B14': {'slope': 1.02, 'offset': -0.18}}

filenames = glob.glob('*FLDK*.dat')
scene = satpy.Scene(filenames,
                    reader='ahi_hsd',
                    reader_kwargs={'user_calibration': calib_dict)
# B15 will not have custom radiance correction applied.
scene.load(['B07', 'B14', 'B15'])

By default, user-supplied calibrations / corrections are applied to the radiance data in accordance with the GSICS standard defined in the equation above. However, user-supplied gain and offset values for converting digital number into radiance via Rad = DN * gain + offset are also possible. To supply your own factors, supply a user calibration dict using type: ‘DN’ as follows:

calib_dict = {'B07': {'slope': 0.0037, 'offset': 18.5},
              'B14': {'slope': -0.002, 'offset': 22.8},
              'type': 'DN'}

You can also explicitly select radiance correction with ‘type’: ‘RAD’ but this is not necessary as it is the default option if you supply your own correction coefficients.

Initialize the reader.

calibrate(data, calibration)[source]

Calibrate the data.

convert_to_radiance(data)[source]

Calibrate to radiance.

property end_time

Get the end time.

get_area_def(dsid)[source]

Get the area definition.

get_dataset(key, info)[source]

Get the dataset.

read_band(key, info)[source]

Read the data.

property scheduled_time

Time this band was scheduled to be recorded.

property start_time

Get the start time.

satpy.readers.ahi_l1b_gridded_bin module

satpy.readers.ami_l1b module

Advanced Meteorological Imager reader for the Level 1b NetCDF4 format.

class satpy.readers.ami_l1b.AMIL1bNetCDF(filename, filename_info, filetype_info, calib_mode='PYSPECTRAL', allow_conditional_pixels=False, user_calibration=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Base reader for AMI L1B NetCDF4 files.

AMI data contains GSICS adjustment factors for the IR bands. By default, these are not applied. If you wish to apply them then you must set the calibration mode appropriately:

import satpy import glob

filenames = glob.glob(‘FLDK.dat’) scene = satpy.Scene(filenames,

reader=’ahi_hsd’, reader_kwargs={‘calib_mode’: ‘gsics’})

scene.load([‘B13’])

In addition, the GSICS website (and other sources) also supply radiance correction coefficients like so: radiance_corr = (radiance_orig - corr_offset) / corr_slope

If you wish to supply such coefficients, pass ‘user_calibration’ and a dictionary containing per-channel slopes and offsets as a reader_kwarg:

user_calibration={'chan': {'slope': slope, 'offset': offset}}

If you do not have coefficients for a particular band, then by default the slope will be set to 1 .and the offset to 0.:

import satpy
import glob

# Load bands 7, 14 and 15, but we only have coefs for 7+14
calib_dict = {'WV063': {'slope': 0.99, 'offset': 0.002},
              'IR087': {'slope': 1.02, 'offset': -0.18}}

filenames = glob.glob('*.nc')
scene = satpy.Scene(filenames,
                    reader='ami_l1b',
                    reader_kwargs={'user_calibration': calib_dict,
                                   'calib_mode': 'file')
# IR133 will not have radiance correction applied.
scene.load(['WV063', 'IR087', 'IR133'])

By default these updated coefficients are not used. In most cases, setting calib_mode to file is required in order to use external coefficients.

Open the NetCDF file with xarray and prepare the Dataset for reading.

property end_time

Get observation end time.

get_area_def(dsid)[source]

Get area definition for this file.

get_dataset(dataset_id, ds_info)[source]

Load a dataset as a xarray DataArray.

get_orbital_parameters()[source]

Collect orbital parameters for this file.

property start_time

Get observation start time.

satpy.readers.amsr2_l1b module

Reader for AMSR2 L1B files in HDF5 format.

class satpy.readers.amsr2_l1b.AMSR2L1BFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

File handler for AMSR2 l1b.

Initialize file handler.

get_dataset(ds_id, ds_info)[source]

Get output data and metadata of specified dataset.

get_metadata(ds_id, ds_info)[source]

Get the metadata.

get_shape(ds_id, ds_info)[source]

Get output shape of specified dataset.

satpy.readers.amsr2_l2 module

Reader for AMSR2 L2 files in HDF5 format.

class satpy.readers.amsr2_l2.AMSR2L2FileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.amsr2_l1b.AMSR2L1BFileHandler

AMSR2 level 2 file handler.

Initialize file handler.

get_dataset(ds_id, ds_info)[source]

Get output data and metadata of specified dataset.

mask_dataset(ds_info, data)[source]

Mask data with the fill value.

scale_dataset(var_path, data)[source]

Scale data with the scale factor attribute.

satpy.readers.avhrr_l1b_gaclac module

Reading and calibrating GAC and LAC AVHRR data.

class satpy.readers.avhrr_l1b_gaclac.GACLACFile(filename, filename_info, filetype_info, start_line=None, end_line=None, strip_invalid_coords=True, interpolate_coords=True, **reader_kwargs)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Reader for GAC and LAC data.

Init the file handler.

Parameters
  • start_line – User defined start scanline

  • end_line – User defined end scanline

  • strip_invalid_coords – Strip scanlines with invalid coordinates in the beginning/end of the orbit

  • interpolate_coords – Interpolate coordinates from every eighth pixel to all pixels.

  • reader_kwargs – More keyword arguments to be passed to pygac.Reader. See the pygac documentation for available options.

property end_time

Get the end time.

get_dataset(key, info)[source]

Get the dataset.

read_raw_data()[source]

Create a pygac reader and read raw data from the file.

slice(data, times)[source]

Select user-defined scanlines and/or strip invalid coordinates.

Furthermore, update scanline timestamps.

Parameters
  • data – Data to be sliced

  • times – Scanline timestamps

Returns

Sliced data and timestamps

property start_time

Get the start time.

satpy.readers.caliop_l2_cloud module

satpy.readers.clavrx module

Interface to CLAVR-X HDF4 products.

class satpy.readers.clavrx.CLAVRXFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf4_utils.HDF4FileHandler

A file handler for CLAVRx files.

Open file and collect information.

available_datasets(configured_datasets=None)[source]

Automatically determine datasets provided by this file.

property end_time

Get the end time.

get_area_def(key)[source]

Get the area definition of the data at hand.

get_dataset(dataset_id, ds_info)[source]

Get a dataset.

get_metadata(data_arr, ds_info)[source]

Get metadata.

get_nadir_resolution(sensor)[source]

Get nadir resolution.

get_platform(platform)[source]

Get the platform.

get_rows_per_scan(sensor)[source]

Get number of rows per scan.

get_sensor(sensor)[source]

Get the sensor.

get_shape(dataset_id, ds_info)[source]

Get the shape.

nadir_resolution = {'ahi': 2000, 'avhrr': 1050, 'modis': 1000, 'viirs': 742}
platforms = {'H08': 'himawari8', 'H09': 'himawari9', 'HIM8': 'himawari8', 'HIM9': 'himawari9', 'SNPP': 'npp'}
rows_per_scan = {'modis': 10, 'viirs': 16}
sensors = {'AHI': 'ahi', 'AVHRR': 'avhrr', 'MODIS': 'modis', 'VIIRS': 'viirs'}
property start_time

Get the start time.

satpy.readers.cmsaf_claas2 module

Module containing CMSAF CLAAS v2 FileHandler.

class satpy.readers.cmsaf_claas2.CLAAS2(*args, **kwargs)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

Handle CMSAF CLAAS-2 files.

Initialise class.

available_datasets(configured_datasets=None)[source]

Yield a collection of available datasets.

Return a generator that will yield the datasets available in the loaded files. See docstring in parent class for specification details.

property end_time

Get end time from file.

get_area_def(dataset_id)[source]

Get the area definition.

get_dataset(dataset_id, info)[source]

Get the dataset.

property start_time

Get start time from file.

satpy.readers.electrol_hrit module

HRIT format reader.

References

ELECTRO-L GROUND SEGMENT MSU-GS INSTRUMENT,

LRIT/HRIT Mission Specific Implementation, February 2012

class satpy.readers.electrol_hrit.HRITGOMSEpilogueFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

GOMS HRIT format reader.

Initialize the reader.

read_epilogue()[source]

Read the prologue metadata.

class satpy.readers.electrol_hrit.HRITGOMSFileHandler(filename, filename_info, filetype_info, prologue, epilogue)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

GOMS HRIT format reader.

Initialize the reader.

calibrate(data, calibration)[source]

Calibrate the data.

get_area_def(dsid)[source]

Get the area definition of the band.

get_dataset(key, info)[source]

Get the data from the files.

class satpy.readers.electrol_hrit.HRITGOMSPrologueFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

GOMS HRIT format reader.

Initialize the reader.

process_prologue()[source]

Reprocess prologue to correct types.

read_prologue()[source]

Read the prologue metadata.

satpy.readers.electrol_hrit.recarray2dict(arr)[source]

Change record array to a dictionary.

satpy.readers.eps_l1b module

Reader for eps level 1b data. Uses xml files as a format description.

class satpy.readers.eps_l1b.EPSAVHRRFile(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Eps level 1b reader for AVHRR data.

Initialize FileHandler.

property end_time

Get end time.

get_bounding_box()[source]

Get bounding box.

get_dataset(key, info)[source]

Get calibrated channel data.

get_full_angles()[source]

Get the interpolated angles.

get_full_lonlats()[source]

Get the interpolated longitudes and latitudes.

get_lonlats()[source]

Get lonlats.

keys()[source]

List of reader’s keys.

property platform_name

Get platform name.

property sensor_name

Get sensor name.

sensors = {'AVHR': 'avhrr-3'}
spacecrafts = {'M01': 'Metop-B', 'M02': 'Metop-A', 'M03': 'Metop-C'}
property start_time

Get start time.

satpy.readers.eps_l1b.create_xarray(arr)[source]

Create xarray with correct dimensions.

satpy.readers.eps_l1b.radiance_to_bt(arr, wc_, a__, b__)[source]

Convert to BT.

satpy.readers.eps_l1b.radiance_to_refl(arr, solar_flux)[source]

Convert to reflectances.

satpy.readers.eps_l1b.read_records(filename)[source]

Read filename without scaling it afterwards.

satpy.readers.eum_base module

Utilities for EUMETSAT satellite data.

satpy.readers.eum_base.get_service_mode(instrument_name, ssp_lon)[source]

Get information about service mode for a given instrument and subsatellite longitude.

satpy.readers.eum_base.recarray2dict(arr)[source]

Convert numpy record array to a dictionary.

satpy.readers.eum_base.timecds2datetime(tcds)[source]

Convert time_cds-variables to datetime-object.

Works both with a dictionary and a numpy record_array.

satpy.readers.fci_l1c_fdhsi module

Interface to MTG-FCI-FDHSI L1C NetCDF files.

This module defines the FCIFDHSIFileHandler file handler, to be used for reading Meteosat Third Generation (MTG) Flexible Combined Imager (FCI) Full Disk High Spectral Imagery (FDHSI) data. FCI will fly on the MTG Imager (MTG-I) series of satellites, scheduled to be launched in 2022 by the earliest. For more information about FCI, see EUMETSAT.

For simulated test data to be used with this reader, see test data release. For the Product User Guide (PUG) of the FCI L1c data, see PUG.

Geolocation is based on information from the data files. It uses:

  • From the shape of the data variable data/<channel>/measured/effective_radiance, start and end line columns of current swath.

  • From the data variable data/<channel>/measured/x, the x-coordinates for the grid, in radians (azimuth angle positive towards West).

  • From the data variable data/<channel>/measured/y, the y-coordinates for the grid, in radians (elevation angle positive towards North).

  • From the attribute semi_major_axis on the data variable data/mtg_geos_projection, the Earth equatorial radius

  • From the attribute inverse_flattening on the same data variable, the (inverse) flattening of the ellipsoid

  • From the attribute perspective_point_height on the same data variable, the geostationary altitude in the normalised geostationary projection

  • From the attribute longitude_of_projection_origin on the same data variable, the longitude of the projection origin

  • From the attribute sweep_angle_axis on the same, the sweep angle axis, see https://proj.org/operations/projections/geos.html

From the pixel centre angles in radians and the geostationary altitude, the extremities of the lower left and upper right corners are calculated in units of arc length in m. This extent along with the number of columns and rows, the sweep angle axis, and a dictionary with equatorial radius, polar radius, geostationary altitude, and longitude of projection origin, are passed on to pyresample.geometry.AreaDefinition, which then uses proj4 for the actual geolocation calculations.

The brightness temperature and reflectance calculation is based on the formulas indicated in PUG.

The reading routine supports channel data in counts, radiances, and (depending on channel) brightness temperatures or reflectances. For each channel, it also supports the pixel quality, obtained by prepending the channel name such as "vis_04_pixel_quality".

Warning

The API for the direct reading of pixel quality is temporary and likely to change. Currently, for each channel, the pixel quality is available by <chan>_pixel_quality. In the future, they will likely all be called pixel_quality and disambiguated by a to-be-decided property in the DataID.

class satpy.readers.fci_l1c_fdhsi.FCIFDHSIFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

Class implementing the MTG FCI FDHSI File .

This class implements the Meteosat Third Generation (MTG) Flexible Combined Imager (FCI) Full Disk High Spectral Imagery (FDHSI) reader. It is designed to be used through the Scene class using the load method with the reader "fci_l1c_fdhsi".

Initialize file handler.

calc_area_extent(key)[source]

Calculate area extent for a dataset.

calibrate(data, key)[source]

Calibrate data.

calibrate_counts_to_physical_quantity(data, key)[source]

Calibrate counts to radiances, brightness temperatures, or reflectances.

calibrate_counts_to_rad(data, key)[source]

Calibrate counts to radiances.

calibrate_rad_to_bt(radiance, key)[source]

IR channel calibration.

calibrate_rad_to_refl(radiance, key)[source]

VIS channel calibration.

property end_time

Get end time.

get_area_def(key, info=None)[source]

Calculate on-fly area definition for 0 degree geos-projection for a dataset.

get_channel_measured_group_path(channel)[source]

Get the channel’s measured group path.

get_dataset(key, info=None)[source]

Load a dataset.

property start_time

Get start time.

satpy.readers.fci_l2_nc module

Reader for the FCI L2 products in NetCDF4 format.

class satpy.readers.fci_l2_nc.FciL2CommonFunctions[source]

Bases: object

class satpy.readers.fci_l2_nc.FciL2NCFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler, satpy.readers.fci_l2_nc.FciL2CommonFunctions

Reader class for FCI L2 products in NetCDF4 format.

Open the NetCDF file with xarray and prepare for dataset reading.

get_area_def(key)[source]

Return the area definition (common to all data in product).

get_dataset(dataset_id, dataset_info)[source]

Get dataset using the file_key in dataset_info.

property ssp_lon

Return subsatellite point longitude.

class satpy.readers.fci_l2_nc.FciL2NCSegmentFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler, satpy.readers.fci_l2_nc.FciL2CommonFunctions

Reader class for FCI L2 Segmented products in NetCDF4 format.

Open the NetCDF file with xarray and prepare for dataset reading.

get_dataset(dataset_id, dataset_info)[source]

Get dataset using the file_key in dataset_info.

satpy.readers.file_handlers module

Interface for BaseFileHandlers.

class satpy.readers.file_handlers.BaseFileHandler(filename, filename_info, filetype_info)[source]

Bases: object

Base file handler.

Initialize file handler.

available_datasets(configured_datasets=None)[source]

Get information of available datasets in this file.

This is used for dynamically specifying what datasets are available from a file in addition to what’s configured in a YAML configuration file. Note that this method is called for each file handler for each file type; care should be taken when possible to reduce the amount of redundant datasets produced.

This method should not update values of the dataset information dictionary unless this file handler has a matching file type (the data could be loaded from this object in the future) and at least one satpy.dataset.DataID key is also modified. Otherwise, this file type may override the information provided by a more preferred file type (as specified in the YAML file). It is recommended that any non-ID metadata be updated during the BaseFileHandler.get_dataset() part of loading. This method is not guaranteed that it will be called before any other file type’s handler. The availability “boolean” not being None does not mean that a file handler called later can’t provide an additional dataset, but it must provide more identifying (DataID) information to do so and should yield its new dataset in addition to the previous one.

Parameters

configured_datasets (list) – Series of (bool or None, dict) in the same way as is returned by this method (see below). The bool is whether or not the dataset is available from at least one of the current file handlers. It can also be None if no file handler knows before us knows how to handle it. The dictionary is existing dataset metadata. The dictionaries are typically provided from a YAML configuration file and may be modified, updated, or used as a “template” for additional available datasets. This argument could be the result of a previous file handler’s implementation of this method.

Returns: Iterator of (bool or None, dict) pairs where dict is the

dataset’s metadata. If the dataset is available in the current file type then the boolean value should be True, False if we know about the dataset but it is unavailable, or None if this file object is not responsible for it.

Example 1 - Supplement existing configured information:

def available_datasets(self, configured_datasets=None):
    "Add information to configured datasets."
    # we know the actual resolution
    res = self.resolution

    # update previously configured datasets
    for is_avail, ds_info in (configured_datasets or []):
        # some other file handler knows how to load this
        # don't override what they've done
        if is_avail is not None:
            yield is_avail, ds_info

        matches = self.file_type_matches(ds_info['file_type'])
        if matches and ds_info.get('resolution') != res:
            # we are meant to handle this dataset (file type matches)
            # and the information we can provide isn't available yet
            new_info = ds_info.copy()
            new_info['resolution'] = res
            yield True, new_info
        elif is_avail is None:
            # we don't know what to do with this
            # see if another future file handler does
            yield is_avail, ds_info

Example 2 - Add dynamic datasets from the file:

def available_datasets(self, configured_datasets=None):
    "Add information to configured datasets."
    # pass along existing datasets
    for is_avail, ds_info in (configured_datasets or []):
        yield is_avail, ds_info

    # get dynamic variables known to this file (that we created)
    for var_name, val in self.dynamic_variables.items():
        ds_info = {
            'file_type': self.filetype_info['file_type'],
            'resolution': 1000,
            'name': var_name,
        }
        yield True, ds_info
combine_info(all_infos)[source]

Combine metadata for multiple datasets.

When loading data from multiple files it can be non-trivial to combine things like start_time, end_time, start_orbit, end_orbit, etc.

By default this method will produce a dictionary containing all values that were equal across all provided info dictionaries.

Additionally it performs the logical comparisons to produce the following if they exist:

  • start_time

  • end_time

  • start_orbit

  • end_orbit

  • satellite_altitude

  • satellite_latitude

  • satellite_longitude

  • orbital_parameters

Also, concatenate the areas.

property end_time

Get end time.

file_type_matches(ds_ftype)[source]

Match file handler’s type to this dataset’s file type.

Parameters

ds_ftype (str or list) – File type or list of file types that a dataset is configured to be loaded from.

Returns: True if this file handler object’s type matches the

dataset’s file type(s), False otherwise.

get_area_def(dsid)[source]

Get area definition.

get_bounding_box()[source]

Get the bounding box of the files, as a (lons, lats) tuple.

The tuple return should a lons and lats list of coordinates traveling clockwise around the points available in the file.

get_dataset(dataset_id, ds_info)[source]

Get dataset.

property sensor_names

List of sensors represented in this file.

property start_time

Get start time.

satpy.readers.generic_image module

Reader for generic image (e.g. gif, png, jpg, tif, geotiff, …).

Returns a dataset without calibration. Includes coordinates if available in the file (eg. geotiff).

class satpy.readers.generic_image.GenericImageFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Handle reading of generic image files.

Initialize filehandler.

property end_time

Return end time.

get_area_def(dsid)[source]

Get area definition of the image.

get_dataset(key, info)[source]

Get a dataset from the file.

read()[source]

Read the image.

property start_time

Return start time.

satpy.readers.generic_image.mask_image_data(data)[source]

Mask image data if alpha channel is present.

satpy.readers.geocat module

Interface to GEOCAT HDF4 or NetCDF4 products.

Note: GEOCAT files do not currently have projection information or precise pixel resolution information. Additionally the longitude and latitude arrays are stored as 16-bit integers which causes loss of precision. For this reason the lon/lats can’t be used as a reliable coordinate system to calculate the projection X/Y coordinates.

Until GEOCAT adds projection information and X/Y coordinate arrays, this reader will estimate the geostationary area the best it can. It currently takes a single lon/lat point as reference and uses hardcoded resolution and projection information to calculate the area extents.

class satpy.readers.geocat.GEOCATFileHandler(filename, filename_info, filetype_info, auto_maskandscale=False, xarray_kwargs=None, cache_var_size=0, cache_handle=False)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

GEOCAT netCDF4 file handler.

Initialize object.

available_datasets(configured_datasets=None)[source]

Update information for or add datasets provided by this file.

If this file handler can load a dataset then it will supplement the dataset info with the resolution and possibly coordinate datasets needed to load it. Otherwise it will continue passing the dataset information down the chain.

See satpy.readers.file_handlers.BaseFileHandler.available_datasets() for details.

property end_time

Get end time.

get_area_def(dsid)[source]

Get area definition.

get_dataset(dataset_id, ds_info)[source]

Get dataset.

get_metadata(dataset_id, ds_info)[source]

Get metadata.

get_platform(platform)[source]

Get platform.

get_sensor(sensor)[source]

Get sensor.

get_shape(dataset_id, ds_info)[source]

Get shape.

property is_geo

Check platform.

platforms = {}
property resolution

Get resolution.

resolutions = {'abi': {1: 1002.0086577437705, 2: 2004.017315487541}, 'ahi': {1: 999.9999820317674, 2: 1999.999964063535, 4: 3999.99992812707}}
property sensor_names

Get sensor names.

sensors = {'goes': 'goes_imager', 'goes16': 'abi', 'goesr': 'abi', 'himawari8': 'ahi'}
property start_time

Get start time.

satpy.readers.ghrsst_l3c_sst module

satpy.readers.glm_l2 module

Geostationary Lightning Mapper reader for the Level 2 format from glmtools.

More information about glmtools and the files it produces can be found on the project’s GitHub repository:

class satpy.readers.glm_l2.NCGriddedGLML2(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.abi_base.NC_ABI_BASE

File reader for individual GLM L2 NetCDF4 files.

Open the NetCDF file with xarray and prepare the Dataset for reading.

available_datasets(configured_datasets=None)[source]

Discover new datasets and add information from file.

property end_time

End time of the current file’s observations.

get_dataset(key, info)[source]

Load a dataset.

property sensor

Get sensor name for current file handler.

property start_time

Start time of the current file’s observations.

satpy.readers.goes_imager_hrit module

GOES HRIT format reader.

References

LRIT/HRIT Mission Specific Implementation, February 2012 GVARRDL98.pdf 05057_SPE_MSG_LRIT_HRI

exception satpy.readers.goes_imager_hrit.CalibrationError[source]

Bases: Exception

Dummy error-class.

class satpy.readers.goes_imager_hrit.HRITGOESFileHandler(filename, filename_info, filetype_info, prologue)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

GOES HRIT format reader.

Initialize the reader.

calibrate(data, calibration)[source]

Calibrate the data.

get_area_def(dsid)[source]

Get the area definition of the band.

get_dataset(key, info)[source]

Get the data from the files.

class satpy.readers.goes_imager_hrit.HRITGOESPrologueFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

GOES HRIT format reader.

Initialize the reader.

process_prologue()[source]

Reprocess prologue to correct types.

read_prologue()[source]

Read the prologue metadata.

satpy.readers.goes_imager_hrit.make_gvar_float(float_val)[source]

Make gvar float.

satpy.readers.goes_imager_hrit.make_sgs_time(sgs_time_array)[source]

Make sgs time.

satpy.readers.goes_imager_nc module

Reader for GOES 8-15 imager data in netCDF format from NOAA CLASS. Also handles GOES 15 data in netCDF format reformated by Eumetsat

GOES Imager netCDF files contain geolocated detector counts. If ordering via NOAA CLASS, select 16 bits/pixel. The instrument oversamples the viewed scene in E-W direction by a factor of 1.75: IR/VIS pixels are 112/28 urad on a side, but the instrument samples every 64/16 urad in E-W direction (see [BOOK-I] and [BOOK-N]).

Important note: Some essential information are missing in the netCDF files, which might render them inappropriate for certain applications. The unknowns are:

  1. Subsatellite point

  2. Calibration coefficients

  3. Detector-scanline assignment, i.e. information about which scanline was recorded by which detector

Items 1. and 2. are not critical because the images are geo-located and NOAA provides static calibration coefficients ([VIS], [IR]). The detector-scanline assignment however cannot be reconstructed properly. This is where an approximation has to be applied (see below).

Calibration

Calibration is performed according to [VIS] and [IR], but with an average calibration coefficient applied to all detectors in a certain channel. The reason for and impact of this approximation is described below.

The GOES imager simultaneously records multiple scanlines per sweep using multiple detectors per channel. The VIS channel has 8 detectors, the IR channels have 1-2 detectors (see e.g. Figures 3-5a/b, 3-6a/b and 3-7/a-b in [BOOK-N]). Each detector has its own calibration coefficients, so in order to perform an accurate calibration, the detector-scanline assignment is needed.

In theory it is known which scanline was recorded by which detector (VIS: 5,6,7,8,1,2,3,4; IR: 1,2). However, the plate on which the detectors are mounted flexes due to thermal gradients in the instrument which leads to a N-S shift of +/- 8 visible or +/- 2 IR pixels. This shift is compensated in the GVAR scan formation process, but in a way which is hard to reconstruct properly afterwards. See [GVAR], section 3.2.1. for details.

Since the calibration coefficients of the detectors in a certain channel only differ slightly, a workaround is to calibrate each scanline with the average calibration coefficients. A worst case estimate of the introduced error can be obtained by calibrating all possible counts with both the minimum and the maximum calibration coefficients and computing the difference. The maximum differences are:

GOES-8

Channel

Diff

Unit

00_7

0.0

% # Counts are normalized

03_9

0.187

K

06_8

0.0

K # only one detector

10_7

0.106

K

12_0

0.036

K

GOES-9

Channel

Diff

Unit

00_7

0.0

% # Counts are normalized

03_9

0.0

K # coefs identical

06_8

0.0

K # only one detector

10_7

0.021

K

12_0

0.006

K

GOES-10

Channel

Diff

Unit

00_7

1.05

%

03_9

0.0

K # coefs identical

06_8

0.0

K # only one detector

10_7

0.013

K

12_0

0.004

K

GOES-11

Channel

Diff

Unit

00_7

1.25

%

03_9

0.0

K # coefs identical

06_8

0.0

K # only one detector

10_7

0.0

K # coefs identical

12_0

0.065

K

GOES-12

Channel

Diff

Unit

00_7

0.8

%

03_9

0.0

K # coefs identical

06_5

0.044

K

10_7

0.0

K # coefs identical

13_3

0.0

K # only one detector

GOES-13

Channel

Diff

Unit

00_7

1.31

%

03_9

0.0

K # coefs identical

06_5

0.085

K

10_7

0.008

K

13_3

0.0

K # only one detector

GOES-14

Channel

Diff

Unit

00_7

0.66

%

03_9

0.0

K # coefs identical

06_5

0.043

K

10_7

0.006

K

13_3

0.003

K

GOES-15

Channel

Diff

Unit

00_7

0.86

%

03_9

0.0

K # coefs identical

06_5

0.02

K

10_7

0.009

K

13_3

0.008

K

References:

Eumetsat formated netCDF data:

The main differences are:

  1. The geolocation is in a separate file, used for all bands

  2. VIS data is calibrated to Albedo (or reflectance)

  3. IR data is calibrated to radiance.

  4. VIS data is downsampled to IR resolution (4km)

  5. File name differs also slightly

  6. Data is received via EumetCast

class satpy.readers.goes_imager_nc.GOESCoefficientReader(ir_url, vis_url)[source]

Bases: object

Read GOES Imager calibration coefficients from NOAA reference HTMLs.

Init the coef reader.

get_coefs(platform, channel)[source]

Get the coefs.

gvar_channels = {'GOES-10': {'00_7': 1, '03_9': 2, '06_8': 3, '10_7': 4, '12_0': 5}, 'GOES-11': {'00_7': 1, '03_9': 2, '06_8': 3, '10_7': 4, '12_0': 5}, 'GOES-12': {'00_7': 1, '03_9': 2, '06_5': 3, '10_7': 4, '13_3': 6}, 'GOES-13': {'00_7': 1, '03_9': 2, '06_5': 3, '10_7': 4, '13_3': 6}, 'GOES-14': {'00_7': 1, '03_9': 2, '06_5': 3, '10_7': 4, '13_3': 6}, 'GOES-15': {'00_7': 1, '03_9': 2, '06_5': 3, '10_7': 4, '13_3': 6}, 'GOES-8': {'00_7': 1, '03_9': 2, '06_8': 3, '10_7': 4, '12_0': 5}, 'GOES-9': {'00_7': 1, '03_9': 2, '06_8': 3, '10_7': 4, '12_0': 5}}
ir_tables = {'GOES-10': '2-3', 'GOES-11': '2-4', 'GOES-12': '2-5a', 'GOES-13': '2-6', 'GOES-14': '2-7c', 'GOES-15': '2-8b', 'GOES-8': '2-1', 'GOES-9': '2-2'}
vis_tables = {'GOES-10': 'Table 2.', 'GOES-11': 'Table 3.', 'GOES-12': 'Table 4.', 'GOES-13': 'Table 5.', 'GOES-14': 'Table 6.', 'GOES-15': 'Table 7.', 'GOES-8': 'Table 1.', 'GOES-9': 'Table 1.'}
class satpy.readers.goes_imager_nc.GOESEUMGEONCFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for GOES Geolocation data in EUM netCDF format.

Initialize the reader.

get_dataset(key, info)[source]

Load dataset designated by the given key from file.

property resolution

Specify the spatial resolution of the dataset.

In the EUMETSAT format VIS data is downsampled to IR resolution (4km).

class satpy.readers.goes_imager_nc.GOESEUMNCFileHandler(filename, filename_info, filetype_info, geo_data)[source]

Bases: satpy.readers.goes_imager_nc.GOESNCBaseFileHandler

File handler for GOES Imager data in EUM netCDF format.

TODO: Remove datasets which are not available in the file (counts, VIS radiance) via available_datasets() -> See #434

Initialize the reader.

calibrate(data, calibration, channel)[source]

Perform calibration.

get_dataset(key, info)[source]

Load dataset designated by the given key from file.

ir_sectors = {(566, 3464): 'Southern Hemisphere (GOES-East)', (1062, 2760): 'Southern Hemisphere (GOES-West)', (1354, 3312): 'Northern Hemisphere (GOES-West)', (1826, 3464): 'Northern Hemisphere (GOES-East)', (2704, 5208): 'Full Disc'}
vis_sectors = {(566, 3464): 'Southern Hemisphere (GOES-East)', (1062, 2760): 'Southern Hemisphere (GOES-West)', (1354, 3312): 'Northern Hemisphere (GOES-West)', (1826, 3464): 'Northern Hemisphere (GOES-East)', (2704, 5208): 'Full Disc'}
class satpy.readers.goes_imager_nc.GOESNCBaseFileHandler(filename, filename_info, filetype_info, geo_data=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for GOES Imager data in netCDF format.

Initialize the reader.

available_datasets(configured_datasets=None)[source]

Update information for or add datasets provided by this file.

If this file handler can load a dataset then it will supplement the dataset info with the resolution and possibly coordinate datasets needed to load it. Otherwise it will continue passing the dataset information down the chain.

See satpy.readers.file_handlers.BaseFileHandler.available_datasets() for details.

abstract calibrate(data, calibration, channel)[source]

Perform calibration.

property end_time

End timestamp of the dataset.

abstract get_dataset(key, info)[source]

Load dataset designated by the given key from file.

get_shape(key, info)[source]

Get the shape of the data.

Returns

Number of lines, number of columns

abstract property ir_sectors

Get the ir sectors.

property meta

Derive metadata from the coordinates.

property resolution

Specify the spatial resolution of the dataset.

Channel 13_3’s spatial resolution changes from one platform to another while the wavelength and file format remain the same. In order to avoid multiple YAML reader definitions for the same file format, read the channel’s resolution from the file instead of defining it in the YAML dataset. This information will then be used by the YAML reader to complement the YAML definition of the dataset.

Returns

Spatial resolution in kilometers

property start_time

Start timestamp of the dataset.

abstract property vis_sectors

Get the vis sectors.

class satpy.readers.goes_imager_nc.GOESNCFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.goes_imager_nc.GOESNCBaseFileHandler

File handler for GOES Imager data in netCDF format.

Initialize the reader.

calibrate(counts, calibration, channel)[source]

Perform calibration.

get_dataset(key, info)[source]

Load dataset designated by the given key from file.

ir_sectors = {(566, 3464): 'Southern Hemisphere (GOES-East)', (1062, 2760): 'Southern Hemisphere (GOES-West)', (1354, 3312): 'Northern Hemisphere (GOES-West)', (1826, 3464): 'Northern Hemisphere (GOES-East)', (2704, 5208): 'Full Disc'}
vis_sectors = {(2267, 13852): 'Southern Hemisphere (GOES-East)', (4251, 11044): 'Southern Hemisphere (GOES-West)', (5419, 13244): 'Northern Hemisphere (GOES-West)', (7307, 13852): 'Northern Hemisphere (GOES-East)', (10819, 20800): 'Full Disc'}
satpy.readers.goes_imager_nc.test_coefs(ir_url, vis_url)[source]

Test calibration coefficients against NOAA reference pages.

Currently the reference pages are:

ir_url = https://www.ospo.noaa.gov/Operations/GOES/calibration/gvar-conversion.html vis_url = https://www.ospo.noaa.gov/Operations/GOES/calibration/goes-vis-ch-calibration.html

Parameters
  • ir_url – Path or URL to HTML page with IR coefficients

  • vis_url – Path or URL to HTML page with VIS coefficients

Raises

ValueError if coefficients don't match the reference

satpy.readers.gpm_imerg module

Reader for GPM imerg data on half-hourly timesteps.

References

class satpy.readers.gpm_imerg.Hdf5IMERG(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

IMERG hdf5 reader.

Init method.

property end_time

Find the end time from filename info.

get_area_def(dsid)[source]

Create area definition from the gridded lat/lon values.

get_dataset(dataset_id, ds_info)[source]

Load a dataset.

property start_time

Find the start time from filename info.

satpy.readers.grib module

Generic Reader for GRIB2 files.

Currently this reader depends on the pygrib python package. The eccodes package from ECMWF is preferred, but does not support python 3 at the time of writing.

class satpy.readers.grib.GRIBFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Generic GRIB file handler.

Open grib file and do initial message parsing.

available_datasets(configured_datasets=None)[source]

Automatically determine datasets provided by this file.

property end_time

Get end time of this entire file.

Assumes the last message is the latest message.

get_area_def(dsid)[source]

Get area definition for message.

If latlong grid then convert to valid eqc grid.

get_dataset(dataset_id, ds_info)[source]

Read a GRIB message into an xarray DataArray.

get_metadata(msg, ds_info)[source]

Get metadata.

property start_time

Get start time of this entire file.

Assumes the first message is the earliest message.

satpy.readers.hdf4_utils module

Helpers for reading hdf4-based files.

class satpy.readers.hdf4_utils.HDF4FileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Base class for common HDF4 operations.

Open file and collect information.

collect_metadata(name, obj)[source]

Collect all metadata about file content.

get(item, default=None)[source]

Get variable as DataArray or return the default.

satpy.readers.hdf4_utils.from_sds(var, *args, **kwargs)[source]

Create a dask array from a SD dataset.

satpy.readers.hdf5_utils module

Helpers for reading hdf5-based files.

class satpy.readers.hdf5_utils.HDF5FileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Small class for inspecting a HDF5 file and retrieve its metadata/header data.

Initialize file handler.

collect_metadata(name, obj)[source]

Collect metadata.

get(item, default=None)[source]

Get item.

get_reference(name, key)[source]

Get reference.

satpy.readers.hdfeos_base module

Base HDF-EOS reader.

class satpy.readers.hdfeos_base.HDFEOSBaseFileReader(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Base file handler for HDF EOS data for both L1b and L2 products.

Initialize the base reader.

property end_time

Get the end time of the dataset.

load_dataset(dataset_name)[source]

Load the dataset from HDF EOS file.

static read_mda(attribute)[source]

Read the EOS metadata.

property start_time

Get the start time of the dataset.

class satpy.readers.hdfeos_base.HDFEOSGeoReader(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdfeos_base.HDFEOSBaseFileReader

Handler for the geographical datasets.

Initialize the geographical reader.

DATASET_NAMES = {'latitude': 'Latitude', 'longitude': 'Longitude', 'satellite_azimuth_angle': ('SensorAzimuth', 'Sensor_Azimuth'), 'satellite_zenith_angle': ('SensorZenith', 'Sensor_Zenith'), 'solar_azimuth_angle': ('SolarAzimuth', 'SolarAzimuth'), 'solar_zenith_angle': ('SolarZenith', 'Solar_Zenith')}
property geo_resolution

Resolution of the geographical data retrieved in the metadata.

get_dataset(dataset_keys, dataset_info)[source]

Get the geolocation dataset.

get_interpolated_dataset(name1, name2, resolution, sensor_zenith, offset=0)[source]

Load and interpolate datasets.

static read_geo_resolution(metadata)[source]

Parse metadata to find the geolocation resolution.

It is implemented as a staticmethod to match read_mda pattern.

satpy.readers.hdfeos_base.interpolate(clons, clats, csatz, src_resolution, dst_resolution)[source]

Interpolate two parallel datasets jointly.

satpy.readers.hrit_base module

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.

class satpy.readers.hrit_base.HRITFileHandler(filename, filename_info, filetype_info, hdr_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

HRIT standard format reader.

Initialize the reader.

property end_time

Get end time.

get_area_def(dsid)[source]

Get the area definition of the band.

get_area_extent(size, offsets, factors, platform_height)[source]

Get the area extent of the file.

get_dataset(key, info)[source]

Load a dataset.

get_shape(dsid, ds_info)[source]

Get shape.

get_xy_from_linecol(line, col, offsets, factors)[source]

Get the intermediate coordinates from line & col.

Intermediate coordinates are actually the instruments scanning angles.

read_band(key, info)[source]

Read the data.

property start_time

Get start time.

satpy.readers.hrit_base.decompress(infile, outdir='.')[source]

Decompress an XRIT data file and return the path to the decompressed file.

It expect to find Eumetsat’s xRITDecompress through the environment variable XRIT_DECOMPRESS_PATH.

satpy.readers.hrit_base.get_xritdecompress_cmd()[source]

Find a valid binary for the xRITDecompress command.

satpy.readers.hrit_base.get_xritdecompress_outfile(stdout)[source]

Analyse the output of the xRITDecompress command call and return the file.

satpy.readers.hrit_jma module

HRIT format reader for JMA data.

Introduction

The JMA HRIT format is described in the JMA HRIT - Mission Specific Implementation. There are three readers for this format in Satpy:

  • jami_hrit: For data from the JAMI instrument on MTSAT-1R

  • mtsat2-imager_hrit: For data from the Imager instrument on MTSAT-2

  • ahi_hrit: For data from the AHI instrument on Himawari-8/9

Although the data format is identical, the instruments have different characteristics, which is why there is a dedicated reader for each of them. Sample data is available here:

Example

Here is an example how to read Himwari-8 HRIT data with Satpy:

from satpy import Scene
import glob

filenames = glob.glob('data/IMG_DK01B14_2018011109*')
scn = Scene(filenames=filenames, reader='ahi_hrit')
scn.load(['B14'])
print(scn['B14'])

Output:

<xarray.DataArray (y: 5500, x: 5500)>
dask.array<concatenate, shape=(5500, 5500), dtype=float64, chunksize=(550, 4096), ...
Coordinates:
    acq_time  (y) datetime64[ns] 2018-01-11T09:00:20.995200 ... 2018-01-11T09:09:40.348800
    crs       object +proj=geos +lon_0=140.7 +h=35785831 +x_0=0 +y_0=0 +a=6378169 ...
  * y         (y) float64 5.5e+06 5.498e+06 5.496e+06 ... -5.496e+06 -5.498e+06
  * x         (x) float64 -5.498e+06 -5.496e+06 -5.494e+06 ... 5.498e+06 5.5e+06
Attributes:
    satellite_longitude:  140.7
    satellite_latitude:   0.0
    satellite_altitude:   35785831.0
    orbital_parameters:   {'projection_longitude': 140.7, 'projection_latitud...
    standard_name:        toa_brightness_temperature
    level:                None
    wavelength:           (11.0, 11.2, 11.4)
    units:                K
    calibration:          brightness_temperature
    file_type:            ['hrit_b14_seg', 'hrit_b14_fd']
    modifiers:            ()
    polarization:         None
    sensor:               ahi
    name:                 B14
    platform_name:        Himawari-8
    resolution:           4000
    start_time:           2018-01-11 09:00:20.995200
    end_time:             2018-01-11 09:09:40.348800
    area:                 Area ID: FLDK, Description: Full Disk, Projection I...
    ancillary_variables:  []

JMA HRIT data contain the scanline acquisition time for only a subset of scanlines. Timestamps of the remaining scanlines are computed using linear interpolation. This is what you’ll find in the acq_time coordinate of the dataset.

class satpy.readers.hrit_jma.HRITJMAFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

JMA HRIT format reader.

Initialize the reader.

calibrate(data, calibration)[source]

Calibrate the data.

property end_time

Get end time of the scan.

get_area_def(dsid)[source]

Get the area definition of the band.

get_dataset(key, info)[source]

Get the dataset designated by key.

property start_time

Get start time of the scan.

satpy.readers.hrit_jma.mjd2datetime64(mjd)[source]

Convert Modified Julian Day (MJD) to datetime64.

satpy.readers.hrpt module

satpy.readers.hsaf_grib module

A reader for files produced by the Hydrology SAF.

Currently this reader depends on the pygrib python package. The eccodes package from ECMWF is preferred, but does not support python 3 at the time of writing.

class satpy.readers.hsaf_grib.HSAFFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for HSAF grib files.

Init the file handler.

property analysis_time

Get validity time of this file.

get_area_def(dsid)[source]

Get area definition for message.

get_dataset(ds_id, ds_info)[source]

Read a GRIB message into an xarray DataArray.

get_metadata(msg)[source]

Get the metadata.

satpy.readers.hy2_scat_l2b_h5 module

HY-2B L2B Reader, distributed by Eumetsat in HDF5 format.

class satpy.readers.hy2_scat_l2b_h5.HY2SCATL2BH5FileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

File handler for HY2 scat.

Initialize file handler.

property end_time

Time for final observation.

get_dataset(key, info)[source]

Get the dataset.

get_metadata()[source]

Get the metadata.

get_variable_metadata()[source]

Get the variable metadata.

property platform_name

Get the Platform ShortName.

property start_time

Time for first observation.

satpy.readers.iasi_l2 module

IASI L2 HDF5 files.

class satpy.readers.iasi_l2.IASIL2HDF5(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for IASI L2 HDF5 files.

Init the file handler.

property end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Get the start time.

satpy.readers.iasi_l2.read_dataset(fid, key)[source]

Read dataset.

satpy.readers.iasi_l2.read_geo(fid, key)[source]

Read geolocation and related datasets.

satpy.readers.iasi_l2_so2_bufr module

satpy.readers.li_l2 module

satpy.readers.maia module

Reader for NWPSAF AAPP MAIA Cloud product.

https://nwpsaf.eu/site/software/aapp/

Documentation reference:

[NWPSAF-MF-UD-003] DATA Formats [NWPSAF-MF-UD-009] MAIA version 4 Scientific User Manual

class satpy.readers.maia.MAIAFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for Maia files.

Init the file handler.

property end_time

Get the end time.

get_dataset(key, info, out=None)[source]

Get a dataset from the file.

get_platform(platform)[source]

Get the platform.

read(filename)[source]

Read the file.

property start_time

Get the start time.

satpy.readers.mersi2_l1b module

Reader for the FY-3D MERSI-2 L1B file format.

The files for this reader are HDF5 and come in four varieties; band data and geolocation data, both at 250m and 1000m resolution.

This reader was tested on FY-3D MERSI-2 data, but should work on future platforms as well assuming no file format changes.

class satpy.readers.mersi2_l1b.MERSI2L1B(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

MERSI-2 L1B file reader.

Initialize file handler.

property end_time

Time for final observation.

get_dataset(dataset_id, ds_info)[source]

Load data variable and metadata and calibrate if needed.

property sensor_name

Map sensor name to Satpy ‘standard’ sensor names.

property start_time

Time for first observation.

satpy.readers.mimic_TPW2_nc module

Reader for Mimic TPW data in netCDF format from SSEC.

This module implements reader for MIMIC_TPW2 netcdf files. MIMIC-TPW2 is an experimental global product of total precipitable water (TPW), using morphological compositing of the MIRS retrieval from several available operational microwave-frequency sensors. Originally described in a 2010 paper by Wimmers and Velden. This Version 2 is developed from an older method that uses simpler, but more limited TPW retrievals and advection calculations.

More information, data and credits at http://tropic.ssec.wisc.edu/real-time/mtpw2/credits.html

class satpy.readers.mimic_TPW2_nc.MimicTPW2FileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

NetCDF4 reader for MIMC TPW.

Initialize the reader.

available_datasets(configured_datasets=None)[source]

Get datasets in file matching gelocation shape (lat/lon).

property end_time

End timestamp of the dataset same as start_time.

get_area_def(dsid)[source]

Flip data up/down and define equirectangular AreaDefintion.

get_dataset(ds_id, info)[source]

Load dataset designated by the given key from file.

get_metadata(data, info)[source]

Get general metadata for file.

property sensor_name

Sensor name.

property start_time

Start timestamp of the dataset determined from yaml.

satpy.readers.modis_l1b module

Modis level 1b hdf-eos format reader.

Introduction

The modis_l1b reader reads and calibrates Modis L1 image data in hdf-eos format. Files often have a pattern similar to the following one:

M[O/Y]D02[1/H/Q]KM.A[date].[time].[collection].[processing_time].hdf

Other patterns where “collection” and/or “proccessing_time” are missing might also work (see the readers yaml file for details). Geolocation files (MOD03) are also supported.

Geolocation files

For the 1km data (mod021km) geolocation files (mod03) are optional. If not given to the reader 1km geolocations will be interpolated from the 5km geolocation contained within the file.

For the 500m and 250m data geolocation files are needed.

References

class satpy.readers.modis_l1b.HDFEOSBandReader(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdfeos_base.HDFEOSBaseFileReader

Handler for the regular band channels.

Init the file handler.

get_dataset(key, info)[source]

Read data from file and return the corresponding projectables.

res = {'1': 1000, 'H': 500, 'Q': 250}
class satpy.readers.modis_l1b.MixedHDFEOSReader(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdfeos_base.HDFEOSGeoReader, satpy.readers.modis_l1b.HDFEOSBandReader

A file handler for the files that have both regular bands and geographical information in them.

Init the file handler.

get_dataset(key, info)[source]

Get the dataset.

satpy.readers.modis_l1b.calibrate_bt(array, attributes, index, band_name)[source]

Calibration for the emissive channels.

satpy.readers.modis_l1b.calibrate_counts(array, attributes, index)[source]

Calibration for counts channels.

satpy.readers.modis_l1b.calibrate_radiance(array, attributes, index)[source]

Calibration for radiance channels.

satpy.readers.modis_l1b.calibrate_refl(array, attributes, index)[source]

Calibration for reflective channels.

satpy.readers.modis_l2 module

Modis level 2 hdf-eos format reader.

Introduction

The modis_l2 reader reads and calibrates Modis L2 image data in hdf-eos format. Since there are a multitude of different level 2 datasets not all of theses are implemented (yet).

Currently the reader supports:
  • m[o/y]d35_l2: cloud_mask dataset

  • some datasets in m[o/y]d06 files

To get a list of the available datasets for a given file refer to the “Load data” section in Readers.

Geolocation files

Similar to the modis_l1b reader the geolocation files (mod03) for the 1km data are optional and if not given 1km geolocations will be interpolated from the 5km geolocation contained within the file.

For the 500m and 250m data geolocation files are needed.

References

class satpy.readers.modis_l2.ModisL2HDFFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdfeos_base.HDFEOSGeoReader

File handler for MODIS HDF-EOS Level 2 files.

Initialize the geographical reader.

get_dataset(dataset_id, dataset_info)[source]

Get DataArray for specified dataset.

satpy.readers.modis_l2.bits_strip(bit_start, bit_count, value)[source]

Extract specified bit from bit representation of integer value.

Parameters
  • bit_start (int) – Starting index of the bits to extract (first bit has index 0)

  • bit_count (int) – Number of bits starting from bit_start to extract

  • value (int) – Number from which to extract the bits

Returns

  • int

  • Value of the extracted bits

satpy.readers.msi_safe module

SAFE MSI L1C reader.

class satpy.readers.msi_safe.SAFEMSIL1C(filename, filename_info, filetype_info, mda)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for SAFE MSI files (jp2).

Init the reader.

property end_time

Get the end time.

get_area_def(dsid)[source]

Get the area def.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Get the start time.

class satpy.readers.msi_safe.SAFEMSIMDXML(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handle for sentinel 2 safe XML manifest.

Init the reader.

property end_time

Get end time.

get_area_def(dsid)[source]

Get the area definition of the dataset.

get_dataset(key, info)[source]

Get the dataset referred to by key.

interpolate_angles(angles, resolution)[source]

Interpolate the angles.

property start_time

Get start time.

satpy.readers.mviri_l1b_fiduceo_nc module

FIDUCEO MVIRI FCDR Reader.

Introduction

The FIDUCEO MVIRI FCDR is a Fundamental Climate Data Record (FCDR) of re-calibrated Level 1.5 Infrared, Water Vapour, and Visible radiances from the Meteosat Visible Infra-Red Imager (MVIRI) instrument onboard the Meteosat First Generation satellites. There are two variants of the dataset: The full FCDR and a simplified version called easy FCDR. Some datasets are only available in one of the two variants, see the corresponding YAML definition in satpy/etc/readers/.

Dataset Names

The FIDUCEO MVIRI readers use names VIS, WV and IR for the visible, water vapor and infrared channels, respectively. These are different from the original netCDF variable names for the following reasons:

  • VIS channel is named differently in full FCDR (counts_vis) and easy FCDR (toa_bidirectional_reflectance_vis)

  • netCDF variable names contain the calibration level (e.g. counts_...), which might be confusing for satpy users if a different calibration level is chosen.

Remaining datasets (such as quality flags and uncertainties) have the same name in the reader as in the netCDF file.

Example

This is how to read FIDUCEO MVIRI FCDR data in satpy:

from satpy import Scene

scn = Scene(filenames=['FIDUCEO_FCDR_L15_MVIRI_MET7-57.0...'],
            reader='mviri_l1b_fiduceo_nc')
scn.load(['VIS', 'WV', 'IR'])

Global netCDF attributes are available in the raw_metadata attribute of each loaded dataset.

Image Orientation

The images are stored in MVIRI scanning direction, that means South is up and East is right. This can be changed as follows:

scn.load(['VIS'], upper_right_corner='NE')

Geolocation

In addition to the image data, FIDUCEO also provides so called static FCDRs containing latitude and longitude coordinates. In order to simplify their usage, the FIDUCEO MVIRI readers do not make use of these static files, but instead provide an area definition that can be used to compute longitude and latitude coordinates on demand.

area = scn['VIS'].attrs['area']
lons, lats = area.get_lonlats()

Those were compared to the static FCDR and they agree very well, however there are small differences. The mean difference is < 1E3 degrees for all channels and projection longitudes.

Huge VIS Reflectances

You might encounter huge VIS reflectances (10^8 percent and greater) in situations where both radiance and solar zenith angle are small. The reader certainly needs some improvement in this regard. Maybe the corresponding uncertainties can be used to filter these cases before calculating reflectances.

VIS Channel Quality Flags

Quality flags are available for the VIS channel only. A simple approach for masking bad quality pixels is to set the mask_bad_quality keyword argument to True:

scn = Scene(filenames=['FIDUCEO_FCDR_L15_MVIRI_MET7-57.0...'],
            reader='mviri_l1b_fiduceo_nc',
            reader_kwargs={'mask_bad_quality': True})

See FiduceoMviriBase for an argument description. In some situations however the entire image can be flagged (look out for warnings). In that case check out the quality_pixel_bitmask and data_quality_bitmask datasets to find out why.

Angles

The FIDUCEO MVIRI FCDR provides satellite and solar angles on a coarse tiepoint grid. By default these datasets will be interpolated to the higher VIS resolution. This can be changed as follows:

scn.load(['solar_zenith_angle'], resolution=4500)

If you need the angles in both resolutions, use data queries:

from satpy import DataQuery

query_vis = DataQuery(
    name='solar_zenith_angle',
    resolution=2250
)
query_ir = DataQuery(
    name='solar_zenith_angle',
    resolution=4500
)
scn.load([query_vis, query_ir])

# Use the query objects to access the datasets as follows
sza_vis = scn[query_vis]

References

satpy.readers.mviri_l1b_fiduceo_nc.ALTITUDE = 35785860.0

[Handbook] section 5.2.1.

class satpy.readers.mviri_l1b_fiduceo_nc.DatasetWrapper(nc)[source]

Bases: object

Helper class for accessing the dataset.

Wrap the given dataset.

property attrs

Exposes dataset attributes.

get_image_size(resolution)[source]

Get image size for the given resolution.

get_time()[source]

Get time coordinate.

Variable is sometimes named “time” and sometimes “time_ir_wv”.

get_xy_coords(resolution)[source]

Get x and y coordinates for the given resolution.

class satpy.readers.mviri_l1b_fiduceo_nc.FiduceoMviriBase(filename, filename_info, filetype_info, mask_bad_quality=False)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Baseclass for FIDUCEO MVIRI file handlers.

Initialize the file handler.

Parameters

mask_bad_quality – Mask VIS pixels with bad quality, that means any quality flag except “ok”. If you need more control, use the quality_pixel_bitmask and data_quality_bitmask datasets.

get_area_def(dataset_id)[source]

Get area definition of the given dataset.

get_dataset(dataset_id, dataset_info)[source]

Get the dataset.

nc_keys = {'IR': 'count_ir', 'WV': 'count_wv'}
class satpy.readers.mviri_l1b_fiduceo_nc.FiduceoMviriEasyFcdrFileHandler(filename, filename_info, filetype_info, mask_bad_quality=False)[source]

Bases: satpy.readers.mviri_l1b_fiduceo_nc.FiduceoMviriBase

File handler for FIDUCEO MVIRI Easy FCDR.

Initialize the file handler.

Parameters

mask_bad_quality – Mask VIS pixels with bad quality, that means any quality flag except “ok”. If you need more control, use the quality_pixel_bitmask and data_quality_bitmask datasets.

nc_keys = {'IR': 'count_ir', 'VIS': 'toa_bidirectional_reflectance_vis', 'WV': 'count_wv'}
class satpy.readers.mviri_l1b_fiduceo_nc.FiduceoMviriFullFcdrFileHandler(filename, filename_info, filetype_info, mask_bad_quality=False)[source]

Bases: satpy.readers.mviri_l1b_fiduceo_nc.FiduceoMviriBase

File handler for FIDUCEO MVIRI Full FCDR.

Initialize the file handler.

Parameters

mask_bad_quality – Mask VIS pixels with bad quality, that means any quality flag except “ok”. If you need more control, use the quality_pixel_bitmask and data_quality_bitmask datasets.

nc_keys = {'IR': 'count_ir', 'VIS': 'count_vis', 'WV': 'count_wv'}
class satpy.readers.mviri_l1b_fiduceo_nc.IRWVCalibrator(coefs)[source]

Bases: object

Calibrate IR & WV channels.

Initialize the calibrator.

Parameters

coefs – Calibration coefficients.

calibrate(counts, calibration)[source]

Calibrate IR/WV counts to the given calibration.

class satpy.readers.mviri_l1b_fiduceo_nc.Interpolator[source]

Bases: object

Interpolate datasets to another resolution.

static interp_acq_time(time2d, target_y)[source]

Interpolate scanline acquisition time to the given coordinates.

The files provide timestamps per pixel for the low resolution channels (IR/WV) only.

  1. Average values in each line to obtain one timestamp per line.

  2. For the VIS channel duplicate values in y-direction (as advised by [PUG]).

Note that the timestamps do not increase monotonically with the line number in some cases.

Returns

Mean scanline acquisition timestamps

static interp_tiepoints(ds, target_x, target_y)[source]

Interpolate dataset between tiepoints.

Uses linear interpolation.

FUTURE: [PUG] recommends cubic spline interpolation.

Parameters
  • ds – Dataset to be interpolated

  • target_x – Target x coordinates

  • target_y – Target y coordinates

satpy.readers.mviri_l1b_fiduceo_nc.MVIRI_FIELD_OF_VIEW = 18.0

[Handbook] section 5.3.2.1.

class satpy.readers.mviri_l1b_fiduceo_nc.Navigator[source]

Bases: object

Navigate MVIRI images.

get_area_def(im_size, projection_longitude)[source]

Create MVIRI area definition.

class satpy.readers.mviri_l1b_fiduceo_nc.VISCalibrator(coefs, solar_zenith_angle=None)[source]

Bases: object

Calibrate VIS channel.

Initialize the calibrator.

Parameters
  • coefs – Calibration coefficients.

  • solar_zenith_angle (optional) – Solar zenith angle. Only required for calibration to reflectance.

calibrate(counts, calibration)[source]

Calibrate VIS counts.

static refl_factor_to_percent(refl)[source]

Convert reflectance factor to percent.

update_refl_attrs(refl)[source]

Update attributes of reflectance datasets.

class satpy.readers.mviri_l1b_fiduceo_nc.VisQualityControl(mask)[source]

Bases: object

Simple quality control for VIS channel.

Initialize the quality control.

check()[source]

Check VIS channel quality and issue a warning if it’s bad.

mask(ds)[source]

Mask VIS pixels with bad quality.

Pixels are considered bad quality if the “quality_pixel_bitmask” is everything else than 0 (no flag set).

satpy.readers.mviri_l1b_fiduceo_nc.is_high_resol(resolution)[source]

Identify high resolution channel.

satpy.readers.netcdf_utils module

Helpers for reading netcdf-based files.

class satpy.readers.netcdf_utils.NetCDF4FileHandler(filename, filename_info, filetype_info, auto_maskandscale=False, xarray_kwargs=None, cache_var_size=0, cache_handle=False)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Small class for inspecting a NetCDF4 file and retrieving its metadata/header data.

File information can be accessed using bracket notation. Variables are accessed by using:

wrapper[“var_name”]

Or:

wrapper[“group/subgroup/var_name”]

Attributes can be accessed by appending “/attr/attr_name” to the item string:

wrapper[“group/subgroup/var_name/attr/units”]

Or for global attributes:

wrapper[“/attr/platform_short_name”]

Note that loading datasets requires reopening the original file (unless those datasets are cached, see below), but to get just the shape of the dataset append “/shape” to the item string:

wrapper[“group/subgroup/var_name/shape”]

If your file has many small data variables that are frequently accessed, you may choose to cache some of them. You can do this by passing a number, any variable smaller than this number in bytes will be read into RAM. Warning, this part of the API is provisional and subject to change.

You may get an additional speedup by passing cache_handle=True. This will keep the netCDF4 dataset handles open throughout the lifetime of the object, and instead of using xarray.open_dataset to open every data variable, a dask array will be created “manually”. This may be useful if you have a dataset distributed over many files, such as for FCI. Note that the coordinates will be missing in this case. If you use this option, xarray_kwargs will have no effect.

Parameters
  • filename (str) – File to read

  • filename_info (dict) – Dictionary with filename information

  • filetype_info (dict) – Dictionary with filetype information

  • auto_maskandscale (bool) – Apply mask and scale factors

  • xarray_kwargs (dict) – Addition arguments to xarray.open_dataset

  • cache_var_size (int) – Cache variables smaller than this size.

  • cache_handle (bool) – Keep files open for lifetime of filehandler.

Initialize object.

collect_cache_vars(cache_vars, obj)[source]

Collect data variables for caching.

This method will collect some data variables and store them in RAM. This may be useful if some small variables are frequently accessed, to prevent needlessly frequently opening and closing the file, which in case of xarray is associated with some overhead.

Should be called later than collect_metadata.

Parameters
  • cache_vars (List[str]) – Names of data variables to be cached.

  • obj (netCDF4.Dataset) – Dataset object from which to read them.

collect_dimensions(name, obj)[source]

Collect dimensions.

collect_metadata(name, obj)[source]

Collect all file variables and attributes for the provided file object.

This method also iterates through subgroups of the provided object.

file_handle = None
get(item, default=None)[source]

Get item.

satpy.readers.nucaps module

Interface to NUCAPS Retrieval NetCDF files.

NUCAPS stands for NOAA Unique Combined Atmospheric Processing System. NUCAPS retrievals include temperature, moisture, trace gas, and cloud-cleared radiance profiles. Product details can be found at:

https://www.ospo.noaa.gov/Products/atmosphere/soundings/nucaps/

This reader supports both standard NOAA NUCAPS EDRs, and Science EDRs, which are essentially a subset of the standard EDRs with some additional parameters such as relative humidity and boundary layer temperature.

NUCAPS data is derived from Cross-track Infrared Sounder (CrIS) data, and from Advanced Technology Microwave Sounder (ATMS) data, instruments onboard Joint Polar Satellite System spacecraft.

class satpy.readers.nucaps.NUCAPSFileHandler(*args, **kwargs)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

File handler for NUCAPS netCDF4 format.

Initialize file handler.

property end_orbit_number

Return orbit number for the end of the swath.

property end_time

Get end time.

get_dataset(dataset_id, ds_info)[source]

Load data array and metadata for specified dataset.

get_metadata(dataset_id, ds_info)[source]

Get metadata.

get_shape(ds_id, ds_info)[source]

Return data array shape for item specified.

property platform_name

Return standard platform name for the file’s data.

property sensor_names

Return standard sensor or instrument name for the file’s data.

property start_orbit_number

Return orbit number for the beginning of the swath.

property start_time

Get start time.

class satpy.readers.nucaps.NUCAPSReader(config_files, mask_surface=True, mask_quality=True, **kwargs)[source]

Bases: satpy.readers.yaml_reader.FileYAMLReader

Reader for NUCAPS NetCDF4 files.

Configure reader behavior.

Parameters
  • mask_surface (boolean) – mask anything below the surface pressure

  • mask_quality (boolean) – mask anything where the Quality_Flag metadata is != 1.

load(dataset_keys, previous_datasets=None, pressure_levels=None)[source]

Load data from one or more set of files.

Parameters

pressure_levels – mask out certain pressure levels: True for all levels (min, max) for a range of pressure levels […] list of levels to include

load_ds_ids_from_config()[source]

Convert config dataset entries to DataIDs.

Special handling is done to provide level specific datasets for any pressured based datasets. For example, a dataset is added for each pressure level of ‘Temperature’ with each new dataset being named ‘Temperature_Xmb’ where X is the pressure level.

satpy.readers.nwcsaf_msg2013_hdf5 module

Reader for the old NWCSAF/Geo (v2013 and earlier) cloud product format.

References

class satpy.readers.nwcsaf_msg2013_hdf5.Hdf5NWCSAF(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

NWCSAF MSG hdf5 reader.

Init method.

get_area_def(dsid)[source]

Get the area definition of the datasets in the file.

get_dataset(dataset_id, ds_info)[source]

Load a dataset.

property start_time

Return the start time of the object.

satpy.readers.nwcsaf_msg2013_hdf5.get_area_extent(cfac, lfac, coff, loff, numcols, numlines)[source]

Get the area extent from msg parameters.

satpy.readers.nwcsaf_nc module

Nowcasting SAF common PPS&MSG NetCDF/CF format reader.

References

class satpy.readers.nwcsaf_nc.NcNWCSAF(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

NWCSAF PPS&MSG NetCDF reader.

Init method.

property end_time

Return the end time of the object.

get_area_def(dsid)[source]

Get the area definition of the datasets in the file.

Only applicable for MSG products!

get_dataset(dsid, info)[source]

Load a dataset.

remove_timedim(var)[source]

Remove time dimension from dataset.

scale_dataset(dsid, variable, info)[source]

Scale the data set, applying the attributes from the netCDF file.

The scale and offset attributes will then be removed from the resulting variable.

property sensor_names

List of sensors represented in this file.

set_platform_and_sensor(**kwargs)[source]

Set some metadata: platform_name, sensors, and pps (identifying PPS or Geo).

property start_time

Return the start time of the object.

upsample_geolocation(dsid, info)[source]

Upsample the geolocation (lon,lat) from the tiepoint grid.

satpy.readers.nwcsaf_nc.remove_empties(variable)[source]

Remove empty objects from the variable’s attrs.

satpy.readers.olci_nc module

Sentinel-3 OLCI reader.

This reader supports an optional argument to choose the ‘engine’ for reading OLCI netCDF4 files. By default, this reader uses the default xarray choice of engine, as defined in the xarray.open_dataset() documentation`.

As an alternative, the user may wish to use the ‘h5netcdf’ engine, but that is not default as it typically prints many non-fatal but confusing error messages to the terminal. To choose between engines the user can do as follows for the default:

scn = Scene(filenames=my_files, reader='olci_l1b')

or as follows for the h5netcdf engine:

scn = Scene(filenames=my_files,
            reader='olci_l1b', reader_kwargs={'engine': 'h5netcdf'})

References

class satpy.readers.olci_nc.BitFlags(value)[source]

Bases: object

Manipulate flags stored bitwise.

Init the flags.

flag_list = ['INVALID', 'WATER', 'LAND', 'CLOUD', 'SNOW_ICE', 'INLAND_WATER', 'TIDAL', 'COSMETIC', 'SUSPECT', 'HISOLZEN', 'SATURATED', 'MEGLINT', 'HIGHGLINT', 'WHITECAPS', 'ADJAC', 'WV_FAIL', 'PAR_FAIL', 'AC_FAIL', 'OC4ME_FAIL', 'OCNN_FAIL', 'Extra_1', 'KDM_FAIL', 'Extra_2', 'CLOUD_AMBIGUOUS', 'CLOUD_MARGIN', 'BPAC_ON', 'WHITE_SCATT', 'LOWRW', 'HIGHRW']
meaning = {'AC_FAIL': 17, 'ADJAC': 14, 'BPAC_ON': 25, 'CLOUD': 3, 'CLOUD_AMBIGUOUS': 23, 'CLOUD_MARGIN': 24, 'COSMETIC': 7, 'Extra_1': 20, 'Extra_2': 22, 'HIGHGLINT': 12, 'HIGHRW': 28, 'HISOLZEN': 9, 'INLAND_WATER': 5, 'INVALID': 0, 'KDM_FAIL': 21, 'LAND': 2, 'LOWRW': 27, 'MEGLINT': 11, 'OC4ME_FAIL': 18, 'OCNN_FAIL': 19, 'PAR_FAIL': 16, 'SATURATED': 10, 'SNOW_ICE': 4, 'SUSPECT': 8, 'TIDAL': 6, 'WATER': 1, 'WHITECAPS': 13, 'WHITE_SCATT': 26, 'WV_FAIL': 15}
class satpy.readers.olci_nc.NCOLCI1B(filename, filename_info, filetype_info, cal, engine=None)[source]

Bases: satpy.readers.olci_nc.NCOLCIChannelBase

File handler for OLCI l1b.

Init the file handler.

get_dataset(key, info)[source]

Load a dataset.

class satpy.readers.olci_nc.NCOLCI2(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.olci_nc.NCOLCIChannelBase

File handler for OLCI l2.

Init the file handler.

get_dataset(key, info)[source]

Load a dataset.

getbitmask(wqsf, items=None)[source]

Get the bitmask.

class satpy.readers.olci_nc.NCOLCIAngles(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.olci_nc.NCOLCILowResData

File handler for the OLCI angles.

Init the file handler.

datasets = {'satellite_azimuth_angle': 'OAA', 'satellite_zenith_angle': 'OZA', 'solar_azimuth_angle': 'SAA', 'solar_zenith_angle': 'SZA'}
get_dataset(key, info)[source]

Load a dataset.

class satpy.readers.olci_nc.NCOLCIBase(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

The OLCI reader base.

Init the olci reader base.

property end_time

End time property.

get_dataset(key, info)[source]

Load a dataset.

property nc

Get the nc xr dataset.

property start_time

Start time property.

class satpy.readers.olci_nc.NCOLCICal(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.olci_nc.NCOLCIBase

Dummy class for calibration.

Init the olci reader base.

class satpy.readers.olci_nc.NCOLCIChannelBase(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.olci_nc.NCOLCIBase

Base class for channel reading.

Init the file handler.

class satpy.readers.olci_nc.NCOLCIGeo(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.olci_nc.NCOLCIBase

Dummy class for navigation.

Init the olci reader base.

class satpy.readers.olci_nc.NCOLCILowResData(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Handler for low resolution data.

Init the file handler.

class satpy.readers.olci_nc.NCOLCIMeteo(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.olci_nc.NCOLCILowResData

File handler for the OLCI meteo data.

Init the file handler.

datasets = ['humidity', 'sea_level_pressure', 'total_columnar_water_vapour', 'total_ozone']
get_dataset(key, info)[source]

Load a dataset.

satpy.readers.omps_edr module

Interface to OMPS EDR format.

class satpy.readers.omps_edr.EDREOSFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.omps_edr.EDRFileHandler

EDR EOS file handler.

Initialize file handler.

class satpy.readers.omps_edr.EDRFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

EDR file handler.

Initialize file handler.

adjust_scaling_factors(factors, file_units, output_units)[source]

Adjust scaling factors.

property end_orbit_number

Get the end orbit number.

get_dataset(dataset_id, ds_info)[source]

Get the dataset.

get_metadata(dataset_id, ds_info)[source]

Get the metadata.

get_shape(ds_id, ds_info)[source]

Get the shape.

property platform_name

Get the platform name.

property sensor_name

Get the sensor name.

property start_orbit_number

Get the start orbit number.

satpy.readers.safe_sar_l2_ocn module

SAFE SAR L2 OCN format reader.

The OCN data contains various parameters, but mainly the wind speed and direction calculated from SAR data and input model data from ECMWF

Implemented in this reader is the OWI, Ocean Wind field.

See more at ESA webpage https://sentinel.esa.int/web/sentinel/ocean-wind-field-component

class satpy.readers.safe_sar_l2_ocn.SAFENC(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Measurement file reader.

Init the file reader.

property end_time

Product end_time, parsed from the measurement file name.

property fend_time

Product fend_time meaning the end time parsed from the SAFE directory.

property fstart_time

Product fstart_time meaning the start time parsed from the SAFE directory.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Product start_time, parsed from the measurement file name.

satpy.readers.sar_c_safe module

SAFE SAR-C reader.

This module implements a reader for Sentinel 1 SAR-C GRD (level1) SAFE format as provided by ESA. The format is comprised of a directory containing multiple files, most notably two measurement files in geotiff and a few xml files for calibration, noise and metadata.

References

class satpy.readers.sar_c_safe.SAFEGRD(filename, filename_info, filetype_info, calfh, noisefh)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Measurement file reader.

The measurement files are in geotiff format and read using rasterio. For performance reasons, the reading adapts the chunk size to match the file’s block size.

Init the grd filehandler.

property end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

get_gcps()[source]

Read GCP from the GDAL band.

Parameters
  • band (gdal band) – Measurement band which comes with GCP’s

  • coordinates (tuple) – A tuple with longitude and latitude arrays

Returns

Pixel and Line indices 1d arrays gcp_coords (tuple): longitude and latitude 1d arrays

Return type

points (tuple)

get_lonlatalts()[source]

Obtain GCPs and construct latitude and longitude arrays.

Parameters
  • band (gdal band) – Measurement band which comes with GCP’s

  • array_shape (tuple) – The size of the data array

Returns

A tuple with longitude and latitude arrays

Return type

coordinates (tuple)

property start_time

Get the start time.

class satpy.readers.sar_c_safe.SAFEXML(filename, filename_info, filetype_info, header_file=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

XML file reader for the SAFE format.

Init the xml filehandler.

property end_time

Get the end time.

get_calibration(calibration, shape, chunks=None)[source]

Get the calibration array.

get_calibration_constant()[source]

Load the calibration constant.

get_dataset(key, info)[source]

Load a dataset.

get_metadata()[source]

Convert the xml metadata to dict.

get_noise_correction(shape, chunks=None)[source]

Get the noise correction array.

static interpolate_xml_array(data, low_res_coords, shape, chunks)[source]

Interpolate arbitrary size dataset to a full sized grid.

static read_azimuth_noise_array(elts)[source]

Read the azimuth noise vectors.

The azimuth noise is normalized per swath to account for gain differences between the swaths in EW mode.

This is based on the this reference: J. Park, A. A. Korosov, M. Babiker, S. Sandven and J. Won, “Efficient Thermal Noise Removal for Sentinel-1 TOPSAR Cross-Polarization Channel,” in IEEE Transactions on Geoscience and Remote Sensing, vol. 56, no. 3, pp. 1555-1565, March 2018. doi: 10.1109/TGRS.2017.2765248

static read_xml_array(elts, variable_name)[source]

Read an array from an xml elements elts.

property start_time

Get the start time.

satpy.readers.sar_c_safe.dictify(r, root=True)[source]

Convert an ElementTree into a dict.

satpy.readers.sar_c_safe.interpolate_slice(slice_rows, slice_cols, interpolator)[source]

Interpolate the given slice of the larger array.

satpy.readers.sar_c_safe.interpolate_xarray(xpoints, ypoints, values, shape, kind='cubic', blocksize=4096)[source]

Interpolate, generating a dask array.

satpy.readers.sar_c_safe.interpolate_xarray_linear(xpoints, ypoints, values, shape, chunks=4096)[source]

Interpolate linearly, generating a dask array.

satpy.readers.sar_c_safe.intp(grid_x, grid_y, interpolator)[source]

Interpolate.

satpy.readers.satpy_cf_nc module

Reader for files produced with the cf netcdf writer in satpy.

Introduction

The satpy_cf_nc reader reads data written by the satpy cf_writer. Filenames for cf_writer are optional. There are several readers using the same satpy_cf_nc.py reader.

  • Generic reader satpy_cf_nc

  • EUMETSAT GAC FDR reader avhrr_l1c_eum_gac_fdr_nc

Generic reader

The generic satpy_cf_nc reader reads files of type:

'{platform_name}-{sensor}-{start_time:%Y%m%d%H%M%S}-{end_time:%Y%m%d%H%M%S}.nc'

Example

Here is an example how to read the data in satpy:

from satpy import Scene

filenames = ['data/npp-viirs-mband-20201007075915-20201007080744.nc']
scn = Scene(reader='satpy_cf_nc', filenames=filenames)
scn.load(['M05'])
scn['M05']

Output:

<xarray.DataArray 'M05' (y: 4592, x: 3200)>
dask.array<open_dataset-d91cfbf1bf4f14710d27446d91cdc6e4M05, shape=(4592, 3200),
    dtype=float32, chunksize=(4096, 3200), chunktype=numpy.ndarray>
Coordinates:
    longitude  (y, x) float32 dask.array<chunksize=(4096, 3200), meta=np.ndarray>
    latitude   (y, x) float32 dask.array<chunksize=(4096, 3200), meta=np.ndarray>
Dimensions without coordinates: y, x
Attributes:
    start_time:                   2020-10-07 07:59:15
    start_orbit:                  46350
    end_time:                     2020-10-07 08:07:44
    end_orbit:                    46350
    calibration:                  reflectance
    long_name:                    M05
    modifiers:                    ('sunz_corrected',)
    platform_name:                Suomi-NPP
    resolution:                   742
    sensor:                       viirs
    standard_name:                toa_bidirectional_reflectance
    units:                        %
    wavelength:                   0.672 µm (0.662-0.682 µm)
    date_created:                 2020-10-07T08:20:02Z
    instrument:                   VIIRS

Notes

Available datasets and attributes will depend on the data saved with the cf_writer.

EUMETSAT AVHRR GAC FDR L1C reader

The avhrr_l1c_eum_gac_fdr_nc reader reads files of type:

''AVHRR-GAC_FDR_1C_{platform}_{start_time:%Y%m%dT%H%M%SZ}_{end_time:%Y%m%dT%H%M%SZ}_{processing_mode}_{disposition_mode}_{creation_time}_{version_int:04d}.nc'

Example

Here is an example how to read the data in satpy:

from satpy import Scene

filenames = ['data/AVHRR-GAC_FDR_1C_N06_19810330T042358Z_19810330T060903Z_R_O_20200101T000000Z_0100.nc']
scn = Scene(reader='avhrr_l1c_eum_gac_fdr_nc', filenames=filenames)
scn.load(['brightness_temperature_channel_4'])
scn['brightness_temperature_channel_4']

Output:

<xarray.DataArray 'brightness_temperature_channel_4' (y: 11, x: 409)>
dask.array<open_dataset-55ffbf3623b32077c67897f4283640a5brightness_temperature_channel_4, shape=(11, 409),
    dtype=float32, chunksize=(11, 409), chunktype=numpy.ndarray>
Coordinates:
  * x          (x) int16 0 1 2 3 4 5 6 7 8 ... 401 402 403 404 405 406 407 408
  * y          (y) int64 0 1 2 3 4 5 6 7 8 9 10
    acq_time   (y) datetime64[ns] dask.array<chunksize=(11,), meta=np.ndarray>
    longitude  (y, x) float64 dask.array<chunksize=(11, 409), meta=np.ndarray>
    latitude   (y, x) float64 dask.array<chunksize=(11, 409), meta=np.ndarray>
Attributes:
    start_time:                            1981-03-30 04:23:58
    end_time:                              1981-03-30 06:09:03
    calibration:                           brightness_temperature
    modifiers:                             ()
    resolution:                            1050
    standard_name:                         toa_brightness_temperature
    units:                                 K
    wavelength:                            10.8 µm (10.3-11.3 µm)
    Conventions:                           CF-1.8 ACDD-1.3
    comment:                               Developed in cooperation with EUME...
    creator_email:                         ops@eumetsat.int
    creator_name:                          EUMETSAT
    creator_url:                           https://www.eumetsat.int/
    date_created:                          2020-09-14T10:50:51.073707
    disposition_mode:                      O
    gac_filename:                          NSS.GHRR.NA.D81089.S0423.E0609.B09...
    geospatial_lat_max:                    89.95386902434623
    geospatial_lat_min:                    -89.97581969005503
    geospatial_lat_resolution:             1050 meters
    geospatial_lat_units:                  degrees_north
    geospatial_lon_max:                    179.99952992568998
    geospatial_lon_min:                    -180.0
    geospatial_lon_resolution:             1050 meters
    geospatial_lon_units:                  degrees_east
    ground_station:                        GC
    id:                                    DOI:10.5676/EUM/AVHRR_GAC_L1C_FDR/...
    institution:                           EUMETSAT
    instrument:                            Earth Remote Sensing Instruments >...
    keywords:                              ATMOSPHERE > ATMOSPHERIC RADIATION...
    keywords_vocabulary:                   GCMD Science Keywords, Version 9.1
    licence:                               EUMETSAT data policy https://www.e...
    naming_authority:                      int.eumetsat
    orbit_number_end:                      9123
    orbit_number_start:                    9122
    orbital_parameters_tle:                ['1 11416U 79057A   81090.16350942...
    platform:                              Earth Observation Satellites > NOA...
    processing_level:                      1C
    processing_mode:                       R
    product_version:                       1.0.0
    references:                            Devasthale, A., M. Raspaud, C. Sch...
    source:                                AVHRR GAC Level 1 Data
    standard_name_vocabulary:              CF Standard Name Table v73
    summary:                               Fundamental Data Record (FDR) of m...
    sun_earth_distance_correction_factor:  0.9975244779999585
    time_coverage_end:                     19820803T003900Z
    time_coverage_start:                   19800101T000000Z
    title:                                 AVHRR GAC L1C FDR
    version_calib_coeffs:                  PATMOS-x, v2017r1
    version_pygac:                         1.4.0
    version_pygac_fdr:                     0.1.dev107+gceb7b26.d20200910
    version_satpy:                         0.21.1.dev894+g5cf76e6
    history:                               Created by pytroll/satpy on 2020-0...
    name:                                  brightness_temperature_channel_4
    _satpy_id:                             DataID(name='brightness_temperatur...
    ancillary_variables:                   []
class satpy.readers.satpy_cf_nc.SatpyCFFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for Satpy’s CF netCDF files.

Initialize file handler.

available_datasets(configured_datasets=None)[source]

Add information of available datasets.

property end_time

Get end time.

fix_modifier_attr(ds_info)[source]

Fix modifiers attribute.

get_dataset(ds_id, ds_info)[source]

Get dataset.

property sensor

Get sensor.

property sensor_names

Get sensor set.

property start_time

Get start time.

satpy.readers.scatsat1_l2b module

satpy.readers.scmi module

SCMI NetCDF4 Reader.

SCMI files are typically used for data for the ABI instrument onboard the GOES-16/17 satellites. It is the primary format used for providing ABI data to the AWIPS visualization clients used by the US National Weather Service forecasters. The python code for this reader may be reused by other readers as NetCDF schemes/metadata change for different products. The initial reader using this code is the “scmi_abi” reader (see abi_l1b_scmi.yaml for more information).

There are two forms of these files that this reader supports:

  1. Official SCMI format: NetCDF4 files where the main data variable is stored

    in a variable called “Sectorized_CMI”. This variable name can be configured in the YAML configuration file.

  2. Satpy/Polar2Grid SCMI format: NetCDF4 files based on the official SCMI

    format created for the Polar2Grid project. This format was migrated to Satpy as part of Polar2Grid’s adoption of Satpy for the majority of its features. This format is what is produced by Satpy’s scmi writer. This format can be identified by a single variable named “data” and a global attribute named "awips_id" that is set to a string starting with "AWIPS_".

class satpy.readers.scmi.SCMIFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Handle a single SCMI NetCDF4 file.

Set up the SCMI file handler.

property end_time

Get the end time.

get_area_def(key)[source]

Get the area definition of the data at hand.

get_dataset(key, info)[source]

Load a dataset.

get_shape(key, info)[source]

Get the shape of the data.

property sensor_names

Get the sensor names.

property start_time

Get the start time.

satpy.readers.seviri_base module

Common functionality for SEVIRI L1.5 data readers.

Introduction

The Spinning Enhanced Visible and InfraRed Imager (SEVIRI) is the primary instrument on Meteosat Second Generation (MSG) and has the capacity to observe the Earth in 12 spectral channels.

Level 1.5 corresponds to image data that has been corrected for all unwanted radiometric and geometric effects, has been geolocated using a standardised projection, and has been calibrated and radiance-linearised. (From the EUMETSAT documentation)

Satpy provides the following readers for SEVIRI L1.5 data in different formats:

Calibration

This section describes how to control the calibration of SEVIRI L1.5 data.

Calibration to radiance

The SEVIRI L1.5 data readers allow for choosing between two file-internal calibration coefficients to convert counts to radiances:

  • Nominal for all channels (default)

  • GSICS where available (IR currently) and nominal for the remaining channels (VIS & HRV currently)

In order to change the default behaviour, use the reader_kwargs keyword argument upon Scene creation:

import satpy
scene = satpy.Scene(filenames,
                    reader='seviri_l1b_...',
                    reader_kwargs={'calib_mode': 'GSICS'})
scene.load(['VIS006', 'IR_108'])

Furthermore, it is possible to specify external calibration coefficients for the conversion from counts to radiances. External coefficients take precedence over internal coefficients, but you can also mix internal and external coefficients: If external calibration coefficients are specified for only a subset of channels, the remaining channels will be calibrated using the chosen file-internal coefficients (nominal or GSICS).

Calibration coefficients must be specified in [mW m-2 sr-1 (cm-1)-1].

In the following example we use external calibration coefficients for the VIS006 & IR_108 channels, and nominal coefficients for the remaining channels:

coefs = {'VIS006': {'gain': 0.0236, 'offset': -1.20},
         'IR_108': {'gain': 0.2156, 'offset': -10.4}}
scene = satpy.Scene(filenames,
                    reader='seviri_l1b_...',
                    reader_kwargs={'ext_calib_coefs': coefs})
scene.load(['VIS006', 'VIS008', 'IR_108', 'IR_120'])

In the next example we use external calibration coefficients for the VIS006 & IR_108 channels, GSICS coefficients where available (other IR channels) and nominal coefficients for the rest:

coefs = {'VIS006': {'gain': 0.0236, 'offset': -1.20},
         'IR_108': {'gain': 0.2156, 'offset': -10.4}}
scene = satpy.Scene(filenames,
                    reader='seviri_l1b_...',
                    reader_kwargs={'calib_mode': 'GSICS',
                                   'ext_calib_coefs': coefs})
scene.load(['VIS006', 'VIS008', 'IR_108', 'IR_120'])

Calibration to reflectance

When loading solar channels, the SEVIRI L1.5 data readers apply a correction for the Sun-Earth distance variation throughout the year - as recommended by the EUMETSAT document Conversion from radiances to reflectances for SEVIRI warm channels. In the unlikely situation that this correction is not required, it can be removed on a per-channel basis using satpy.readers.utils.remove_earthsun_distance_correction().

References

class satpy.readers.seviri_base.MpefProductHeader[source]

Bases: object

MPEF product header class.

get()[source]

Return numpy record_array for MPEF product header.

property images_used

Return structure for images_used.

class satpy.readers.seviri_base.SEVIRICalibrationAlgorithm(platform_id, scan_time)[source]

Bases: object

SEVIRI calibration algorithms.

Initialize the calibration algorithm.

convert_to_radiance(data, gain, offset)[source]

Calibrate to radiance.

ir_calibrate(data, channel_name, cal_type)[source]

Calibrate to brightness temperature.

vis_calibrate(data, solar_irradiance)[source]

Calibrate to reflectance.

This uses the method described in Conversion from radiances to reflectances for SEVIRI warm channels: https://tinyurl.com/y67zhphm

class satpy.readers.seviri_base.SEVIRICalibrationHandler(platform_id, channel_name, coefs, calib_mode, scan_time)[source]

Bases: object

Calibration handler for SEVIRI HRIT-, native- and netCDF-formats.

Handles selection of calibration coefficients and calls the appropriate calibration algorithm.

Initialize the calibration handler.

calibrate(data, calibration)[source]

Calibrate the given data.

get_gain_offset()[source]

Get gain & offset for calibration from counts to radiance.

Choices for internal coefficients are nominal or GSICS. If no GSICS coefficients are available for a certain channel, fall back to nominal coefficients. External coefficients take precedence over internal coefficients.

satpy.readers.seviri_base.calculate_area_extent(area_dict)[source]

Calculate the area extent seen by a geostationary satellite.

Parameters

area_dict – A dictionary containing the required parameters center_point: Center point for the projection resolution: Pixel resulution in meters north: Northmost row number east: Eastmost column number west: Westmost column number south: Southmost row number [column_offset: Column offset, defaults to 0 if not given] [row_offset: Row offset, defaults to 0 if not given]

Returns

An area extent for the scene defined by the lower left and

upper right corners

Return type

tuple

satpy.readers.seviri_base.chebyshev(coefs, time, domain)[source]

Evaluate a Chebyshev Polynomial.

Parameters
  • coefs (list, np.array) – Coefficients defining the polynomial

  • time (int, float) – Time where to evaluate the polynomial

  • domain (list, tuple) – Domain (or time interval) for which the polynomial is defined: [left, right]

Reference: Appendix A in the MSG Level 1.5 Image Data Format Description.

satpy.readers.seviri_base.create_coef_dict(coefs_nominal, coefs_gsics, radiance_type, ext_coefs)[source]

Create coefficient dictionary expected by calibration class.

satpy.readers.seviri_base.dec10216(inbuf)[source]

Decode 10 bits data into 16 bits words.

/*
 * pack 4 10-bit words in 5 bytes into 4 16-bit words
 *
 * 0       1       2       3       4       5
 * 01234567890123456789012345678901234567890
 * 0         1         2         3         4
 */
ip = &in_buffer[i];
op = &out_buffer[j];
op[0] = ip[0]*4 + ip[1]/64;
op[1] = (ip[1] & 0x3F)*16 + ip[2]/16;
op[2] = (ip[2] & 0x0F)*64 + ip[3]/4;
op[3] = (ip[3] & 0x03)*256 +ip[4];
satpy.readers.seviri_base.get_cds_time(days, msecs)[source]

Compute timestamp given the days since epoch and milliseconds of the day.

1958-01-01 00:00 is interpreted as fill value and will be replaced by NaT (Not a Time).

Parameters
Returns

Timestamp(s)

Return type

numpy.datetime64

satpy.readers.seviri_base.get_padding_area(shape, dtype)[source]

Create a padding area filled with no data.

satpy.readers.seviri_base.pad_data_horizontally(data, final_size, east_bound, west_bound)[source]

Pad the data given east and west bounds and the desired size.

satpy.readers.seviri_base.pad_data_vertically(data, final_size, south_bound, north_bound)[source]

Pad the data given south and north bounds and the desired size.

satpy.readers.seviri_l1b_hrit module

SEVIRI HRIT format reader.

Introduction

The seviri_l1b_hrit reader reads and calibrates MSG-SEVIRI L1.5 image data in HRIT format. The format is explained in the MSG Level 1.5 Image Data Format Description. The files are usually named as follows:

H-000-MSG4__-MSG4________-_________-PRO______-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000001___-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000002___-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000003___-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000004___-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000005___-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000006___-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000007___-201903011200-__
H-000-MSG4__-MSG4________-IR_108___-000008___-201903011200-__
H-000-MSG4__-MSG4________-_________-EPI______-201903011200-__

Each image is decomposed into 24 segments (files) for the high-resolution-visible (HRV) channel and 8 segments for other visible (VIS) and infrared (IR) channels. Additionally there is one prologue and one epilogue file for the entire scan which contain global metadata valid for all channels.

Reader Arguments

Some arguments can be provided to the reader to change it’s behaviour. These are provided through the Scene instantiation, eg:

Scene(reader="seviri_l1b_hrit", filenames=fnames, reader_kwargs={'fill_hrv': False})

To see the full list of arguments that can be provided, look into the documentation of HRITMSGFileHandler.

Example

Here is an example how to read the data in satpy:

from satpy import Scene
import glob

filenames = glob.glob('data/H-000-MSG4__-MSG4________-*201903011200*')
scn = Scene(filenames=filenames, reader='seviri_l1b_hrit')
scn.load(['VIS006', 'IR_108'])
print(scn['IR_108'])

Output:

<xarray.DataArray (y: 3712, x: 3712)>
dask.array<shape=(3712, 3712), dtype=float32, chunksize=(464, 3712)>
Coordinates:
    acq_time  (y) datetime64[ns] NaT NaT NaT NaT NaT NaT ... NaT NaT NaT NaT NaT
  * x         (x) float64 5.566e+06 5.563e+06 5.56e+06 ... -5.566e+06 -5.569e+06
  * y         (y) float64 -5.566e+06 -5.563e+06 ... 5.566e+06 5.569e+06
Attributes:
    satellite_longitude:      0.0
    satellite_latitude:       0.0
    satellite_altitude:       35785831.0
    orbital_parameters:       {'projection_longitude': 0.0, 'projection_latit...
    platform_name:            Meteosat-11
    georef_offset_corrected:  True
    standard_name:            brightness_temperature
    raw_metadata:             {'file_type': 0, 'total_header_length': 6198, '...
    wavelength:               (9.8, 10.8, 11.8)
    units:                    K
    sensor:                   seviri
    platform_name:            Meteosat-11
    start_time:               2019-03-01 12:00:09.716000
    end_time:                 2019-03-01 12:12:42.946000
    area:                     Area ID: some_area_name\\nDescription: On-the-fl...
    name:                     IR_108
    resolution:               3000.403165817
    calibration:              brightness_temperature
    polarization:             None
    level:                    None
    modifiers:                ()
    ancillary_variables:      []
  • The orbital_parameters attribute provides the nominal and actual satellite position, as well as the projection centre.

  • You can choose between nominal and GSICS calibration coefficients or even specify your own coefficients, see satpy.readers.seviri_base.

  • The raw_metadata attribute provides raw metadata from the prologue, epilogue and segment header. By default, arrays with more than 100 elements are excluded in order to limit memory usage. This threshold can be adjusted, see HRITMSGFileHandler.

  • The acq_time coordinate provides the acquisition time for each scanline. Use a MultiIndex to enable selection by acquisition time:

    import pandas as pd
    mi = pd.MultiIndex.from_arrays([scn['IR_108']['y'].data, scn['IR_108']['acq_time'].data],
                                   names=('y_coord', 'time'))
    scn['IR_108']['y'] = mi
    scn['IR_108'].sel(time=np.datetime64('2019-03-01T12:06:13.052000000'))
    
class satpy.readers.seviri_l1b_hrit.HRITMSGEpilogueFileHandler(filename, filename_info, filetype_info, calib_mode='nominal', ext_calib_coefs=None, mda_max_array_size=None, fill_hrv=None)[source]

Bases: satpy.readers.seviri_l1b_hrit.HRITMSGPrologueEpilogueBase

SEVIRI HRIT epilogue reader.

Initialize the reader.

read_epilogue()[source]

Read the epilogue metadata.

reduce(max_size)[source]

Reduce the epilogue metadata.

class satpy.readers.seviri_l1b_hrit.HRITMSGFileHandler(filename, filename_info, filetype_info, prologue, epilogue, calib_mode='nominal', ext_calib_coefs=None, mda_max_array_size=100, fill_hrv=True)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

SEVIRI HRIT format reader.

Calibration

See satpy.readers.seviri_base.

Raw Metadata

By default, arrays with more than 100 elements are excluded from the raw reader metadata to limit memory usage. This threshold can be adjusted using the mda_max_array_size keyword argument:

scene = satpy.Scene(filenames,
                    reader='seviri_l1b_hrit',
                    reader_kwargs={'mda_max_array_size': 1000})

Padding of the HRV channel

By default, the HRV channel is loaded padded with no-data, that is it is returned as a full-disk dataset. If you want the original, unpadded, data, just provide the fill_hrv as False in the reader_kwargs:

scene = satpy.Scene(filenames,
                    reader='seviri_l1b_hrit',
                    reader_kwargs={'fill_hrv': False})

Initialize the reader.

calibrate(data, calibration)[source]

Calibrate the data.

property end_time

Get the end time.

get_area_def(dsid)[source]

Get the area definition of the band.

get_dataset(key, info)[source]

Get the dataset.

pad_hrv_data(res)[source]

Add empty pixels around the HRV.

property start_time

Get the start time.

class satpy.readers.seviri_l1b_hrit.HRITMSGPrologueEpilogueBase(filename, filename_info, filetype_info, hdr_info)[source]

Bases: satpy.readers.hrit_base.HRITFileHandler

Base reader for prologue and epilogue files.

Initialize the file handler for prologue and epilogue files.

reduce(max_size)[source]

Reduce the metadata (placeholder).

class satpy.readers.seviri_l1b_hrit.HRITMSGPrologueFileHandler(filename, filename_info, filetype_info, calib_mode='nominal', ext_calib_coefs=None, mda_max_array_size=None, fill_hrv=None)[source]

Bases: satpy.readers.seviri_l1b_hrit.HRITMSGPrologueEpilogueBase

SEVIRI HRIT prologue reader.

Initialize the reader.

get_earth_radii()[source]

Get earth radii from prologue.

Returns

Equatorial radius, polar radius [m]

get_satpos()[source]

Get actual satellite position in geodetic coordinates (WGS-84).

Returns: Longitude [deg east], Latitude [deg north] and Altitude [m]

read_prologue()[source]

Read the prologue metadata.

reduce(max_size)[source]

Reduce the prologue metadata.

exception satpy.readers.seviri_l1b_hrit.NoValidOrbitParams[source]

Bases: Exception

Exception when validOrbitParameters are missing.

satpy.readers.seviri_l1b_hrit.pad_data(data, final_size, east_bound, west_bound)[source]

Pad the data given east and west bounds and the desired size.

satpy.readers.seviri_l1b_icare module

Interface to SEVIRI L1B data from ICARE (Lille).

Introduction

The seviri_l1b_icare reader reads MSG-SEVIRI L1.5 image data in HDF format that has been produced by the ICARE Data and Services Center Data can be accessed via: http://www.icare.univ-lille1.fr

Each SEVIRI timeslot comes as 12 HDF files, one per band. Only those bands that are of interest need to be passed to the reader. Others can be ignored. Filenames follow the format: GEO_L1B-MSG1_YYYY-MM-DDTHH-MM-SS_G_CHANN_VX-XX.hdf Where: YYYY, MM, DD, HH, MM, SS specify the timeslot starting time. CHANN is the channel (i.e: HRV, IR016, WV073, etc) VX-XX is the processing version number

Example

Here is an example how to read the data in satpy:

from satpy import Scene
import glob

filenames = glob.glob('data/*2019-03-01T12-00-00*.hdf')
scn = Scene(filenames=filenames, reader='seviri_l1b_icare')
scn.load(['VIS006', 'IR_108'])
print(scn['IR_108'])

Output:

<xarray.DataArray 'array-a1d52b7e19ec5a875e2f038df5b60d7e' (y: 3712, x: 3712)>
dask.array<add, shape=(3712, 3712), dtype=float32, chunksize=(1024, 1024), chunktype=numpy.ndarray>
Coordinates:
    crs      object +proj=geos +a=6378169.0 +b=6356583.8 +lon_0=0.0 +h=35785831.0 +units=m +type=crs
  * y        (y) float64 5.566e+06 5.563e+06 5.56e+06 ... -5.566e+06 -5.569e+06
  * x        (x) float64 -5.566e+06 -5.563e+06 -5.56e+06 ... 5.566e+06 5.569e+06
Attributes:
    start_time:           2004-12-29 12:15:00
    end_time:             2004-12-29 12:27:44
    area:                 Area ID: geosmsg\nDescription: MSG/SEVIRI low resol...
    name:                 IR_108
    resolution:           3000.403165817
    calibration:          brightness_temperature
    polarization:         None
    level:                None
    modifiers:            ()
    ancillary_variables:  []
class satpy.readers.seviri_l1b_icare.SEVIRI_ICARE(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf4_utils.HDF4FileHandler

SEVIRI L1B handler for HDF4 files.

Init the file handler.

property alt

Get the altitude.

property end_time

Get the end time.

property geoloc

Get the geolocation.

get_area_def(ds_id)[source]

Get the area def.

get_dataset(ds_id, ds_info)[source]

Get the dataset.

get_metadata(data, ds_info)[source]

Get the metadata.

property projection

Get the projection.

property projlon

Get the projection longitude.

property res

Get the resolution.

property satlon

Get the satellite longitude.

property sensor_name

Get the sensor name.

property start_time

Get the start time.

property zone

Get the zone.

satpy.readers.seviri_l1b_native module

SEVIRI native format reader.

References

class satpy.readers.seviri_l1b_native.ImageBoundaries(header, trailer, mda)[source]

Bases: object

Collect image boundary information.

Initialize the class.

get_img_bounds(dataset_id, is_roi)[source]

Get image line and column boundaries.

Returns

Dictionary with the four keys ‘south_bound’, ‘north_bound’, ‘east_bound’ and ‘west_bound’, each containing a list of the respective line/column numbers of the image boundaries.

Lists (rather than scalars) are returned since the HRV data in FES mode contain data from two windows/areas.

class satpy.readers.seviri_l1b_native.NativeMSGFileHandler(filename, filename_info, filetype_info, calib_mode='nominal', fill_disk=False, ext_calib_coefs=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

SEVIRI native format reader.

Calibration

See satpy.readers.seviri_base.

Padding channel data to full disk

By providing the fill_disk as True in the reader_kwargs, the channel is loaded as full disk, padded with no-data where necessary. This is especially useful for the HRV channel, but can also be used for RSS and ROI data. By default the original, unpadded, data are loaded:

scene = satpy.Scene(filenames,
                    reader='seviri_l1b_native',
                    reader_kwargs={'fill_disk': False})

Initialize the reader.

calibrate(data, dataset_id)[source]

Calibrate the data.

property end_time

Read the repeat cycle end time from metadata.

get_area_def(dataset_id)[source]

Get the area definition of the band.

In general, image data from one window/area is available. For the HRV channel in FES mode, however, data from two windows (‘Lower’ and ‘Upper’) are available. Hence, we collect lists of area-extents and corresponding number of image lines/columns. In case of FES HRV data, two area definitions are computed, stacked and squeezed. For other cases, the lists will only have one entry each, from which a single area definition is computed.

Note that the AreaDefinition area extents returned by this function for Native data will be slightly different compared to the area extents returned by the SEVIRI HRIT reader. This is due to slightly different pixel size values when calculated using the data available in the files. E.g. for the 3 km grid:

Native: data15hd['ImageDescription']['ReferenceGridVIS_IR']['ColumnDirGridStep'] == 3000.4031658172607 HRIT:                            np.deg2rad(2.**16 / pdict['lfac']) * pdict['h'] == 3000.4032785810186

This results in the Native 3 km full-disk area extents being approx. 20 cm shorter in each direction.

The method for calculating the area extents used by the HRIT reader (CFAC/LFAC mechanism) keeps the highest level of numeric precision and is used as reference by EUM. For this reason, the standard area definitions defined in the areas.yaml file correspond to the HRIT ones.

get_area_extent(dataset_id)[source]

Get the area extent of the file.

Until December 2017, the data is shifted by 1.5km SSP North and West against the nominal GEOS projection. Since December 2017 this offset has been corrected. A flag in the data indicates if the correction has been applied. If no correction was applied, adjust the area extent to match the shifted data.

For more information see Section 3.1.4.2 in the MSG Level 1.5 Image Data Format Description. The correction of the area extent is documented in a developer’s memo.

get_dataset(dataset_id, dataset_info)[source]

Get the dataset.

is_roi()[source]

Check if data covers a selected region of interest (ROI).

Standard RSS data consists of 3712 columns and 1392 lines, covering the three northmost segements of the SEVIRI disk. Hence, if the data does not cover the full disk, nor the standard RSS region in RSS mode, it’s assumed to be ROI data.

property start_time

Read the repeat cycle start time from metadata.

class satpy.readers.seviri_l1b_native.Padder(dataset_id, img_bounds, is_full_disk)[source]

Bases: object

Padding of HRV, RSS and ROI data to full disk.

Initialize the padder.

pad_data(dataset)[source]

Pad data to full disk with empty pixels.

satpy.readers.seviri_l1b_native.get_available_channels(header)[source]

Get the available channels from the header information.

satpy.readers.seviri_l1b_native_hdr module

Header and trailer records of SEVIRI native format.

class satpy.readers.seviri_l1b_native_hdr.GSDTRecords[source]

Bases: object

MSG Ground Segment Data Type records.

Reference Document (EUM/MSG/SPE/055): MSG Ground Segment Design Specification (GSDS)

gp_cpu_address = [('Qualifier_1', <class 'numpy.uint8'>), ('Qualifier_2', <class 'numpy.uint8'>), ('Qualifier_3', <class 'numpy.uint8'>), ('Qualifier_4', <class 'numpy.uint8'>)]
gp_fac_env

alias of numpy.uint8

gp_fac_id

alias of numpy.uint8

gp_pk_header = [('HeaderVersionNo', <class 'numpy.uint8'>), ('PacketType', <class 'numpy.uint8'>), ('SubHeaderType', <class 'numpy.uint8'>), ('SourceFacilityId', <class 'numpy.uint8'>), ('SourceEnvId', <class 'numpy.uint8'>), ('SourceInstanceId', <class 'numpy.uint8'>), ('SourceSUId', <class 'numpy.uint32'>), ('SourceCPUId', [('Qualifier_1', <class 'numpy.uint8'>), ('Qualifier_2', <class 'numpy.uint8'>), ('Qualifier_3', <class 'numpy.uint8'>), ('Qualifier_4', <class 'numpy.uint8'>)]), ('DestFacilityId', <class 'numpy.uint8'>), ('DestEnvId', <class 'numpy.uint8'>), ('SequenceCount', <class 'numpy.uint16'>), ('PacketLength', <class 'numpy.int32'>)]
gp_pk_sh1 = [('SubHeaderVersionNo', <class 'numpy.uint8'>), ('ChecksumFlag', <class 'bool'>), ('Acknowledgement', (<class 'numpy.uint8'>, 4)), ('ServiceType', <class 'numpy.uint8'>), ('ServiceSubtype', <class 'numpy.uint8'>), ('PacketTime', [('Days', '>u2'), ('Milliseconds', '>u4')]), ('SpacecraftId', <class 'numpy.uint16'>)]
gp_sc_id

alias of numpy.uint16

gp_su_id

alias of numpy.uint32

gp_svce_type

alias of numpy.uint8

class satpy.readers.seviri_l1b_native_hdr.HritPrologue[source]

Bases: satpy.readers.seviri_l1b_native_hdr.L15DataHeaderRecord

get()[source]
class satpy.readers.seviri_l1b_native_hdr.L15DataHeaderRecord[source]

Bases: object

Reference Document (EUM/MSG/ICD/105): MSG Level 1.5 Image Data Format Description

property celestial_events
property geometric_processing
get()[source]
property image_acquisition
property image_description
property impf_configuration
property radiometric_processing
property satellite_status
class satpy.readers.seviri_l1b_native_hdr.L15MainProductHeaderRecord[source]

Bases: object

Reference Document: MSG Level 1.5 Native Format File Definition

get()[source]
class satpy.readers.seviri_l1b_native_hdr.L15PhData[source]

Bases: object

l15_ph_data = [('Name', 'S30'), ('Value', 'S50')]
class satpy.readers.seviri_l1b_native_hdr.L15SecondaryProductHeaderRecord[source]

Bases: object

Reference Document: MSG Level 1.5 Native Format File Definition

get()[source]
class satpy.readers.seviri_l1b_native_hdr.Msg15NativeHeaderRecord[source]

Bases: object

SEVIRI Level 1.5 header for native-format

get()[source]
class satpy.readers.seviri_l1b_native_hdr.Msg15NativeTrailerRecord[source]

Bases: object

SEVIRI Level 1.5 trailer for native-format

Reference Document (EUM/MSG/ICD/105): MSG Level 1.5 Image Data Format Description

property geometric_quality
get()[source]
property image_production_stats
property navigation_extraction_results
property radiometric_quality
property seviri_l15_trailer
property timeliness_and_completeness

satpy.readers.seviri_l1b_nc module

SEVIRI netcdf format reader.

class satpy.readers.seviri_l1b_nc.NCSEVIRIFileHandler(filename, filename_info, filetype_info, ext_calib_coefs=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for NC seviri files.

Calibration

See satpy.readers.seviri_base. Note that there is only one set of calibration coefficients available in the netCDF files and therefore there is no calib_mode argument.

Init the file handler.

calibrate(dataset, dataset_id)[source]

Calibrate the data.

property end_time

Get the end time.

get_area_def(dataset_id)[source]

Get the area def.

Note that the AreaDefinition area extents returned by this function for NetCDF data will be slightly different compared to the area extents returned by the SEVIRI HRIT reader. This is due to slightly different pixel size values when calculated using the data available in the files. E.g. for the 3 km grid:

NetCDF:  self.nc.attrs['vis_ir_column_dir_grid_step'] == 3000.4031658172607 HRIT: np.deg2rad(2.**16 / pdict['lfac']) * pdict['h'] == 3000.4032785810186

This results in the Native 3 km full-disk area extents being approx. 20 cm shorter in each direction.

The method for calculating the area extents used by the HRIT reader (CFAC/LFAC mechanism) keeps the highest level of numeric precision and is used as reference by EUM. For this reason, the standard area definitions defined in the areas.yaml file correspond to the HRIT ones.

get_area_extent(dsid)[source]

Get the area extent.

get_dataset(dataset_id, dataset_info)[source]

Get the dataset.

property start_time

Get the start time.

class satpy.readers.seviri_l1b_nc.NCSEVIRIHRVFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler, satpy.readers.seviri_base.SEVIRICalibrationHandler

HRV filehandler.

Initialize file handler.

satpy.readers.seviri_l2_bufr module

satpy.readers.seviri_l2_grib module

satpy.readers.slstr_l1b module

SLSTR L1b reader.

class satpy.readers.slstr_l1b.NCSLSTR1B(filename, filename_info, filetype_info, user_calibration=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Filehandler for l1 SLSTR data.

By default, the calibration factors recommended by EUMETSAT are applied. This is required as the SLSTR VIS channels are producing slightly incorrect radiances that require adjustment. Satpy uses the radiance corrections in S3.PN-SLSTR-L1.06, checked 26/10/2020. User-supplied coefficients can be passed via the user_calibration kwarg This should be a dict of channel names (such as S1_nadir, S8_oblique).

For example:: calib_dict = {‘S1_nadir’: 1.12} scene = satpy.Scene(filenames,

reader=’slstr-l1b’, reader_kwargs={‘user_calib’: calib_dict})

Will multiply S1 nadir radiances by 1.12.

Initialize the SLSTR l1 data filehandler.

property end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Get the start time.

class satpy.readers.slstr_l1b.NCSLSTRAngles(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Filehandler for angles.

Initialize the angles reader.

property end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Get the start time.

class satpy.readers.slstr_l1b.NCSLSTRFlag(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for flags.

Initialize the flag reader.

property end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Get the start time.

class satpy.readers.slstr_l1b.NCSLSTRGeo(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Filehandler for geo info.

Initialize the geo filehandler.

property end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

property start_time

Get the start time.

satpy.readers.slstr_l2 module

Reader for Sentinel-3 SLSTR SST data.

class satpy.readers.slstr_l2.SLSTRL2FileHandler(filename, filename_info, filetype_info, engine=None)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

File handler for Sentinel-3 SSL L2 netCDF files.

Initialize the file handler for Sentinel-3 SSL L2 netCDF data.

property end_time

Get end time.

get_dataset(key, info)[source]

Get any available dataset.

property start_time

Get start time.

satpy.readers.smos_l2_wind module

SMOS L2 wind Reader.

Data can be found here after register: https://www.smosstorm.org/Data2/SMOS-NRT-wind-Products-access Format documentation at the same site after register: SMOS_WIND_DS_PDD_20191107_signed.pdf

class satpy.readers.smos_l2_wind.SMOSL2WINDFileHandler(filename, filename_info, filetype_info, auto_maskandscale=False, xarray_kwargs=None, cache_var_size=0, cache_handle=False)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

File handler for SMOS L2 wind netCDF files.

Initialize object.

available_datasets(configured_datasets=None)[source]

Automatically determine datasets provided by this file.

property end_time

Get end time.

get_area_def(dsid)[source]

Define AreaDefintion.

get_dataset(ds_id, ds_info)[source]

Get dataset.

get_metadata(data, ds_info)[source]

Get metadata.

property platform_name

Get platform.

property platform_shortname

Get platform shortname.

property start_time

Get start time.

satpy.readers.tropomi_l2 module

Interface to TROPOMI L2 Reader.

The TROPOspheric Monitoring Instrument (TROPOMI) is the satellite instrument on board the Copernicus Sentinel-5 Precursor satellite. It measures key atmospheric trace gasses, such as ozone, nitrogen oxides, sulfur dioxide, carbon monoxide, methane, and formaldehyde.

Level 2 data products are available via the Copernicus Open Access Hub. For more information visit the following URL: http://www.tropomi.eu/data-products/level-2-products

class satpy.readers.tropomi_l2.TROPOMIL2FileHandler(filename, filename_info, filetype_info, auto_maskandscale=False, xarray_kwargs=None, cache_var_size=0, cache_handle=False)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

File handler for TROPOMI L2 netCDF files.

Initialize object.

available_datasets(configured_datasets=None)[source]

Automatically determine datasets provided by this file.

property end_time

Get end time.

get_dataset(ds_id, ds_info)[source]

Get dataset.

get_metadata(data, ds_info)[source]

Get metadata.

property platform_shortname

Get platform shortname.

prepare_geo(bounds_data)[source]

Prepare lat/lon bounds for pcolormesh.

lat/lon bounds are ordered in the following way:

3----2
|    |
0----1

Extend longitudes and latitudes with one element to support “pcolormesh”:

(X[i+1, j], Y[i+1, j])         (X[i+1, j+1], Y[i+1, j+1])
                      +--------+
                      | C[i,j] |
                      +--------+
     (X[i, j], Y[i, j])        (X[i, j+1], Y[i, j+1])
property sensor

Get sensor.

property sensor_names

Get sensor set.

property start_time

Get start time.

satpy.readers.utils module

Helper functions for satpy readers.

satpy.readers.utils.apply_earthsun_distance_correction(reflectance, utc_date=None)[source]

Correct reflectance data to account for changing Earth-Sun distance.

satpy.readers.utils.apply_rad_correction(data, slope, offset)[source]

Apply GSICS-like correction factors to radiance data.

satpy.readers.utils.bbox(img)[source]

Find the bounding box around nonzero elements in the given array.

Copied from https://stackoverflow.com/a/31402351/5703449 .

Returns

rowmin, rowmax, colmin, colmax

satpy.readers.utils.get_array_date(scn_data, utc_date=None)[source]

Get start time from a channel data array.

satpy.readers.utils.get_earth_radius(lon, lat, a, b)[source]

Compute radius of the earth ellipsoid at the given longitude and latitude.

Parameters
  • lon – Geodetic longitude (degrees)

  • lat – Geodetic latitude (degrees)

  • a – Semi-major axis of the ellipsoid (meters)

  • b – Semi-minor axis of the ellipsoid (meters)

Returns

Earth Radius (meters)

satpy.readers.utils.get_geostationary_angle_extent(geos_area)[source]

Get the max earth (vs space) viewing angles in x and y.

satpy.readers.utils.get_geostationary_bounding_box(geos_area, nb_points=50)[source]

Get the bbox in lon/lats of the valid pixels inside geos_area.

Parameters
  • geos_area – The geostationary area to analyse.

  • nb_points – Number of points on the polygon

satpy.readers.utils.get_geostationary_mask(area)[source]

Compute a mask of the earth’s shape as seen by a geostationary satellite.

Parameters

area (pyresample.geometry.AreaDefinition) – Corresponding area definition

Returns

Boolean mask, True inside the earth’s shape, False outside.

satpy.readers.utils.get_sub_area(area, xslice, yslice)[source]

Apply slices to the area_extent and size of the area.

satpy.readers.utils.get_user_calibration_factors(band_name, correction_dict)[source]

Retrieve radiance correction factors from user-supplied dict.

satpy.readers.utils.np2str(value)[source]

Convert an numpy.string_ to str.

Parameters

value (ndarray) – scalar or 1-element numpy array to convert

Raises

ValueError – if value is array larger than 1-element or it is not of type numpy.string_ or it is not a numpy array

satpy.readers.utils.reduce_mda(mda, max_size=100)[source]

Recursively remove arrays with more than max_size elements from the given metadata dictionary.

satpy.readers.utils.remove_earthsun_distance_correction(reflectance, utc_date=None)[source]

Remove the sun-earth distance correction.

satpy.readers.utils.unzip_file(filename)[source]

Unzip the file if file is bzipped = ending with ‘bz2’.

satpy.readers.vaisala_gld360 module

Vaisala Global Lightning Dataset 360 reader.

Vaisala Global Lightning Dataset GLD360 is data as a service that provides real-time lightning data for accurate and early detection and tracking of severe weather. The data provided is generated by a Vaisala owned and operated world-wide lightning detection sensor network.

References: - [GLD360] https://www.vaisala.com/en/products/data-subscriptions-and-reports/data-sets/gld360

class satpy.readers.vaisala_gld360.VaisalaGLD360TextFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

ASCII reader for Vaisala GDL360 data.

Initialize VaisalaGLD360TextFileHandler.

property end_time

Get end time.

get_dataset(dataset_id, dataset_info)[source]

Load a dataset.

property start_time

Get start time.

satpy.readers.vii_base_nc module

satpy.readers.vii_l1b_nc module

satpy.readers.vii_l2_nc module

satpy.readers.vii_utils module

Utilities for the management of VII products.

satpy.readers.viirs_compact module

Compact viirs format.

This is a reader for the Compact VIIRS format shipped on Eumetcast for the VIIRS SDR. The format is compressed in multiple ways, notably by shipping only tie-points for geographical data. The interpolation of this data is done using dask operations, so it should be relatively performant.

For more information on this format, the reader can refer to the Compact VIIRS SDR Product Format User Guide that can be found on this EARS page.

class satpy.readers.viirs_compact.VIIRSCompactFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

A file handler class for VIIRS compact format.

Initialize the reader.

angles(azi_name, zen_name)[source]

Generate the angle datasets.

property end_time

Get the end time.

expand(data, coefs)[source]

Perform the expansion in numpy domain.

expand_angle_and_nav(arrays)[source]

Expand angle and navigation datasets.

property expansion_coefs

Compute the expansion coefficients.

get_bounding_box()[source]

Get the bounding box of the data.

get_coefs(c_align, c_exp, tpz_size, nb_tpz, v_track)[source]

Compute the coeffs in numpy domain.

get_dataset(key, info)[source]

Load a dataset.

navigate()[source]

Generate the navigation datasets.

read_dataset(dataset_key, info)[source]

Read a dataset.

read_geo(key, info)[source]

Read angles.

property start_time

Get the start time.

satpy.readers.viirs_compact.convert_from_angles(azi, zen)[source]

Convert the angles to cartesian coordinates.

satpy.readers.viirs_compact.convert_to_angles(x, y, z)[source]

Convert the cartesian coordinates to angles.

satpy.readers.viirs_compact.expand_arrays(arrays, scans, c_align, c_exp, scan_size=16, tpz_size=16, nties=200, track_offset=0.5, scan_offset=0.5)[source]

Expand data according to alignment and expansion.

satpy.readers.viirs_edr_active_fires module

VIIRS Active Fires reader.

This module implements readers for VIIRS Active Fires NetCDF and ASCII files.

class satpy.readers.viirs_edr_active_fires.VIIRSActiveFiresFileHandler(filename, filename_info, filetype_info, auto_maskandscale=False, xarray_kwargs=None)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

NetCDF4 reader for VIIRS Active Fires.

Open and perform initial investigation of NetCDF file.

property end_time

Get last date/time when observations were recorded.

get_dataset(dsid, dsinfo)[source]

Get requested data as DataArray.

Parameters
  • dsid – Dataset ID

  • param2 – Dataset Information

Returns

Data

Return type

Dask DataArray

property platform_name

Name of platform/satellite for this file.

property sensor_name

Name of sensor for this file.

property start_time

Get first date/time when observations were recorded.

class satpy.readers.viirs_edr_active_fires.VIIRSActiveFiresTextFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

ASCII reader for VIIRS Active Fires.

Make sure filepath is valid and then reads data into a Dask DataFrame.

Parameters
  • filename – Filename

  • filename_info – Filename information

  • filetype_info – Filetype information

property end_time

Get last date/time when observations were recorded.

get_dataset(dsid, dsinfo)[source]

Get requested data as DataArray.

property start_time

Get first date/time when observations were recorded.

satpy.readers.viirs_edr_flood module

Interface to VIIRS flood product.

class satpy.readers.viirs_edr_flood.VIIRSEDRFlood(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf4_utils.HDF4FileHandler

VIIRS EDR Flood-product handler for HDF4 files.

Open file and collect information.

property end_time

Get end time.

get_area_def(ds_id)[source]

Get area definition.

get_dataset(ds_id, ds_info)[source]

Get dataset.

get_metadata(data, ds_info)[source]

Get metadata.

property platform_name

Get platform name.

property sensor_name

Get sensor name.

property start_time

Get start time.

satpy.readers.viirs_l1b module

Interface to VIIRS L1B format.

class satpy.readers.viirs_l1b.VIIRSL1BFileHandler(filename, filename_info, filetype_info, auto_maskandscale=False, xarray_kwargs=None, cache_var_size=0, cache_handle=False)[source]

Bases: satpy.readers.netcdf_utils.NetCDF4FileHandler

VIIRS L1B File Reader.

Initialize object.

adjust_scaling_factors(factors, file_units, output_units)[source]

Adjust scaling factors.

property end_orbit_number

Get end orbit number.

property end_time

Get end time.

get_dataset(dataset_id, ds_info)[source]

Get dataset.

get_metadata(dataset_id, ds_info)[source]

Get metadata.

get_shape(ds_id, ds_info)[source]

Get shape.

property platform_name

Get platform name.

property sensor_name

Get sensor name.

property start_orbit_number

Get start orbit number.

property start_time

Get start time.

satpy.readers.viirs_sdr module

Interface to VIIRS SDR format.

This reader implements the support of VIIRS SDR files as produced by CSPP and CLASS. It is comprised of two parts:

  • A subclass of the YAMLFileReader class to allow handling all the files

  • A filehandler class to implement the actual reading

Format documentation:

class satpy.readers.viirs_sdr.VIIRSSDRFileHandler(filename, filename_info, filetype_info, use_tc=None, **kwargs)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

VIIRS HDF5 File Reader.

Initialize file handler.

available_datasets(configured_datasets=None)[source]

Generate dataset info and their availablity.

See satpy.readers.file_handlers.BaseFileHandler.available_datasets() for details.

concatenate_dataset(dataset_group, var_path)[source]

Concatenate dataset.

property end_orbit_number

Get end orbit number.

property end_time

Get end time.

static expand_single_values(var, scans)[source]

Expand single valued variable to full scan lengths.

get_bounding_box()[source]

Get the bounding box of this file.

get_dataset(dataset_id, ds_info)[source]

Get the dataset corresponding to dataset_id.

The size of the return DataArray will be dependent on the number of scans actually sensed, and not necessarily the regular 768 scanlines that the file contains for each granule. To that end, the number of scans for each granule is read from: Data_Products/...Gran_x/N_Number_Of_Scans.

get_file_units(dataset_id, ds_info)[source]

Get file units from metadata.

mask_fill_values(data, ds_info)[source]

Mask fill values.

property platform_name

Get platform name.

scale_swath_data(data, scaling_factors)[source]

Scale swath data using scaling factors and offsets.

Multi-granule (a.k.a. aggregated) files will have more than the usual two values.

property sensor_name

Get sensor name.

property start_orbit_number

Get start orbit number.

property start_time

Get start time.

class satpy.readers.viirs_sdr.VIIRSSDRReader(config_files, use_tc=None, **kwargs)[source]

Bases: satpy.readers.yaml_reader.FileYAMLReader

Custom file reader for finding VIIRS SDR geolocation at runtime.

Initialize file reader and adjust geolocation preferences.

Parameters
  • config_files (iterable) – yaml config files passed to base class

  • use_tc (boolean) – If True use the terrain corrected files. If False, switch to non-TC files. If None (default), use TC if available, non-TC otherwise.

filter_filenames_by_info(filename_items)[source]

Filter out file using metadata from the filenames.

This sorts out the different lon and lat datasets depending on TC is desired or not.

get_right_geo_fhs(dsid, fhs)[source]

Find the right geographical file handlers for given dataset ID dsid.

satpy.readers.viirs_sdr.split_desired_other(fhs, req_geo, rem_geo)[source]

Split the provided filehandlers fhs into desired filehandlers and others.

satpy.readers.virr_l1b module

Interface to VIRR (Visible and Infra-Red Radiometer) level 1b format.

The file format is HDF5. Important attributes:

  • Latitude

  • Longitude

  • SolarZenith

  • EV_Emissive

  • EV_RefSB

  • Emissive_Radiance_Offsets

  • Emissive_Radiance_Scales

  • RefSB_Cal_Coefficients

  • RefSB_Effective_Wavelength

  • Emmisive_Centroid_Wave_Number

Supported satellites:

  • FY-3B and FY-3C.

For more information:

class satpy.readers.virr_l1b.VIRR_L1B(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.hdf5_utils.HDF5FileHandler

VIRR Level 1b reader.

Open file and perform initial setup.

property end_time

Get ending observation time.

get_dataset(dataset_id, ds_info)[source]

Create DataArray from file content for dataset_id.

property start_time

Get starting observation time.

satpy.readers.xmlformat module

Reads a format from an xml file to create dtypes and scaling factor arrays.

class satpy.readers.xmlformat.XMLFormat(filename)[source]

Bases: object

XMLFormat object.

Init the format reader.

apply_scales(array)[source]

Apply scales to array.

dtype(key)[source]

Get the dtype for the format object.

satpy.readers.xmlformat.parse_format(xml_file)[source]

Parse the xml file to create types, scaling factor types, and scales.

satpy.readers.xmlformat.process_array(elt, ascii=False)[source]

Process an ‘array’ tag.

satpy.readers.xmlformat.process_delimiter(elt, ascii=False)[source]

Process a ‘delimiter’ tag.

satpy.readers.xmlformat.process_field(elt, ascii=False)[source]

Process a ‘field’ tag.

satpy.readers.xmlformat.to_dtype(val)[source]

Parse val to return a dtype.

satpy.readers.xmlformat.to_scaled_dtype(val)[source]

Parse val to return a dtype.

satpy.readers.xmlformat.to_scales(val)[source]

Parse val to return an array of scale factors.

satpy.readers.yaml_reader module

Base classes and utilities for all readers configured by YAML files.

class satpy.readers.yaml_reader.AbstractYAMLReader(config_dict)[source]

Bases: object

Base class for all readers that use YAML configuration files.

This class should only be used in rare cases. Its child class FileYAMLReader should be used in most cases.

Load information from YAML configuration file about how to read data files.

property all_dataset_ids

Get DataIDs of all datasets known to this reader.

property all_dataset_names

Get names of all datasets known to this reader.

property available_dataset_ids

Get DataIDs that are loadable by this reader.

property available_dataset_names

Get names of datasets that are loadable by this reader.

abstract property end_time

End time of the reader.

abstract filter_selected_filenames(filenames)[source]

Filter provided filenames by parameters in reader configuration.

Returns: iterable of usable files

classmethod from_config_files(*config_files, **reader_kwargs)[source]

Create a reader instance from one or more YAML configuration files.

get_dataset_key(key, **kwargs)[source]

Get the fully qualified DataID matching key.

See satpy.readers.get_key for more information about kwargs.

abstract load(dataset_keys)[source]

Load dataset_keys.

load_ds_ids_from_config()[source]

Get the dataset ids from the config.

select_files_from_directory(directory=None, fs=None)[source]

Find files for this reader in directory.

If directory is None or ‘’, look in the current directory.

Searches the local file system by default. Can search on a remote filesystem by passing an instance of a suitable implementation of fsspec.spec.AbstractFileSystem.

Parameters
  • directory (Optional[str]) – Path to search.

  • fs (Optional[FileSystem]) – fsspec FileSystem implementation to use. Defaults to None, using local file system.

Returns

list of strings describing matching files

select_files_from_pathnames(filenames)[source]

Select the files from filenames this reader can handle.

property sensor_names

Names of sensors whose data is being loaded by this reader.

abstract property start_time

Start time of the reader.

supports_sensor(sensor)[source]

Check if sensor is supported.

Returns True is sensor is None.

class satpy.readers.yaml_reader.FileYAMLReader(config_dict, filter_parameters=None, filter_filenames=True, **kwargs)[source]

Bases: satpy.readers.yaml_reader.AbstractYAMLReader

Primary reader base class that is configured by a YAML file.

This class uses the idea of per-file “file handler” objects to read file contents and determine what is available in the file. This differs from the base AbstractYAMLReader which does not depend on individual file handler objects. In almost all cases this class should be used over its base class and can be used as a reader by itself and requires no subclassing.

Set up initial internal storage for loading file data.

property available_dataset_ids

Get DataIDs that are loadable by this reader.

static check_file_covers_area(file_handler, check_area)[source]

Check if the file covers the current area.

If the file doesn’t provide any bounding box information or ‘area’ was not provided in filter_parameters, the check returns True.

create_filehandlers(filenames, fh_kwargs=None)[source]

Organize the filenames into file types and create file handlers.

property end_time

End time of the latest file used by this reader.

static filename_items_for_filetype(filenames, filetype_info)[source]

Iterate over the filenames matching filetype_info.

filter_fh_by_metadata(filehandlers)[source]

Filter out filehandlers using provide filter parameters.

filter_filenames_by_info(filename_items)[source]

Filter out file using metadata from the filenames.

Currently only uses start and end time. If only start time is available from the filename, keep all the filename that have a start time before the requested end time.

filter_selected_filenames(filenames)[source]

Filter provided files based on metadata in the filename.

find_required_filehandlers(requirements, filename_info)[source]

Find the necessary file handlers for the given requirements.

We assume here requirements are available.

Raises
  • KeyError, if no handler for the given requirements is available.

  • RuntimeError, if there is a handler for the given requirements,

  • but it doesn't match the filename info.

get_dataset_key(key, available_only=False, **kwargs)[source]

Get the fully qualified DataID matching key.

This will first search through available DataIDs, datasets that should be possible to load, and fallback to “known” datasets, those that are configured but aren’t loadable from the provided files. Providing available_only=True will stop this fallback behavior and raise a KeyError exception if no available dataset is found.

Parameters
  • key (str, float, DataID, DataQuery) – Key to search for in this reader.

  • available_only (bool) – Search only loadable datasets for the provided key. Loadable datasets are always searched first, but if available_only=False (default) then all known datasets will be searched.

  • kwargs – See satpy.readers.get_key() for more information about kwargs.

Returns

Best matching DataID to the provided key.

Raises

KeyError – if no key match is found.

load(dataset_keys, previous_datasets=None, **kwargs)[source]

Load dataset_keys.

If previous_datasets is provided, do not reload those.

metadata_matches(sample_dict, file_handler=None)[source]

Check that file metadata matches filter_parameters of this reader.

property sensor_names

Names of sensors whose data is being loaded by this reader.

sorted_filetype_items()[source]

Sort the instance’s filetypes in using order.

property start_time

Start time of the earlier file used by this reader.

time_matches(fstart, fend)[source]

Check that a file’s start and end time mtach filter_parameters of this reader.

update_ds_ids_from_file_handlers()[source]

Add or modify available dataset information.

Each file handler is consulted on whether or not it can load the dataset with the provided information dictionary. See satpy.readers.file_handlers.BaseFileHandler.available_datasets() for more information.

class satpy.readers.yaml_reader.GEOFlippableFileYAMLReader(config_dict, filter_parameters=None, filter_filenames=True, **kwargs)[source]

Bases: satpy.readers.yaml_reader.FileYAMLReader

Reader for flippable geostationary data.

Set up initial internal storage for loading file data.

class satpy.readers.yaml_reader.GEOSegmentYAMLReader(config_dict, filter_parameters=None, filter_filenames=True, **kwargs)[source]

Bases: satpy.readers.yaml_reader.GEOFlippableFileYAMLReader

Reader for segmented geostationary data.

This reader pads the data to full geostationary disk if necessary.

This reader uses an optional pad_data keyword argument that can be passed to Scene.load() to control if padding is done (True by default). Passing pad_data=False will return data unpadded.

When using this class in a reader’s YAML configuration, segmented file types (files that may have multiple segments) should specify an extra expected_segments piece of file_type metadata. This tells this reader how many total segments it should expect when padding data. Alternatively, the file patterns for a file type can include a total_segments field which will be used if expected_segments is not defined. This will default to 1 segment.

Set up initial internal storage for loading file data.

create_filehandlers(filenames, fh_kwargs=None)[source]

Create file handler objects and determine expected segments for each.

satpy.readers.yaml_reader.listify_string(something)[source]

Take something and make it a list.

something is either a list of strings or a string, in which case the function returns a list containing the string. If something is None, an empty list is returned.

satpy.readers.yaml_reader.load_yaml_configs(*config_files, loader=<class 'yaml.loader.UnsafeLoader'>)[source]

Merge a series of YAML reader configuration files.

Parameters
  • *config_files (str) – One or more pathnames to YAML-based reader configuration files that will be merged to create a single configuration.

  • loader – Yaml loader object to load the YAML with. Defaults to UnsafeLoader.

Returns: dict

Dictionary representing the entire YAML configuration with the addition of config[‘reader’][‘config_files’] (the list of YAML pathnames that were merged).

Module contents

Shared objects of the various reader classes.

class satpy.readers.FSFile(file, fs=None)[source]

Bases: os.PathLike

Implementation of a PathLike file object, that can be opened.

This is made to be used in conjuction with fsspec or s3fs. For example:

from satpy import Scene

import fsspec
filename = 'noaa-goes16/ABI-L1b-RadC/2019/001/17/*_G16_s20190011702186*'

the_files = fsspec.open_files("simplecache::s3://" + filename, s3={'anon': True})

from satpy.readers import FSFile
fs_files = [FSFile(open_file) for open_file in the_files]

scn = Scene(filenames=fs_files, reader='abi_l1b')
scn.load(['true_color_raw'])

Initialise the FSFile instance.

file can be string or an fsspec.OpenFile instance. In the latter case, the follow argument fs has no effect. fs can be None or a fsspec filesystem instance.

open()[source]

Open the file.

This is read-only.

satpy.readers.available_readers(as_dict=False)[source]

Available readers based on current configuration.

Parameters

as_dict (bool) – Optionally return reader information as a dictionary. Default: False

Returns: List of available reader names. If as_dict is True then

a list of dictionaries including additionally reader information is returned.

satpy.readers.configs_for_reader(reader=None, ppp_config_dir=None)[source]

Generate reader configuration files for one or more readers.

Parameters
  • reader (Optional[str]) – Yield configs only for this reader

  • ppp_config_dir (Optional[str]) – Additional configuration directory to search for reader configuration files.

Returns: Generator of lists of configuration files

satpy.readers.find_files_and_readers(start_time=None, end_time=None, base_dir=None, reader=None, sensor=None, ppp_config_dir=None, filter_parameters=None, reader_kwargs=None, missing_ok=False, fs=None)[source]

Find files matching the provided parameters.

Use start_time and/or end_time to limit found filenames by the times in the filenames (not the internal file metadata). Files are matched if they fall anywhere within the range specified by these parameters.

Searching is NOT recursive.

Files may be either on-disk or on a remote file system. By default, files are searched for locally. Users can search on remote filesystems by passing an instance of an implementation of fsspec.spec.AbstractFileSystem (strictly speaking, any object of a class implementing a glob method works).

If locating files on a local file system, the returned dictionary can be passed directly to the Scene object through the filenames keyword argument. If it points to a remote file system, it is the responsibility of the user to download the files first (directly reading from cloud storage is not currently available in Satpy).

The behaviour of time-based filtering depends on whether or not the filename contains information about the end time of the data or not:

  • if the end time is not present in the filename, the start time of the filename is used and has to fall between (inclusive) the requested start and end times

  • otherwise, the timespan of the filename has to overlap the requested timespan

Example usage for querying a s3 filesystem using the s3fs module:

>>> import s3fs, satpy.readers, datetime
>>> satpy.readers.find_files_and_readers(
...     base_dir="s3://noaa-goes16/ABI-L1b-RadF/2019/321/14/",
...     fs=s3fs.S3FileSystem(anon=True),
...     reader="abi_l1b",
...     start_time=datetime.datetime(2019, 11, 17, 14, 40))
{'abi_l1b': [...]}
Parameters
  • start_time (datetime) – Limit used files by starting time.

  • end_time (datetime) – Limit used files by ending time.

  • base_dir (str) – The directory to search for files containing the data to load. Defaults to the current directory.

  • reader (str or list) – The name of the reader to use for loading the data or a list of names.

  • sensor (str or list) – Limit used files by provided sensors.

  • ppp_config_dir (str) – The directory containing the configuration files for Satpy.

  • filter_parameters (dict) – Filename pattern metadata to filter on. start_time and end_time are automatically added to this dictionary. Shortcut for reader_kwargs[‘filter_parameters’].

  • reader_kwargs (dict) – Keyword arguments to pass to specific reader instances to further configure file searching.

  • missing_ok (bool) – If False (default), raise ValueError if no files are found. If True, return empty dictionary if no files are found.

  • fs (FileSystem) – Optional, instance of implementation of fsspec.spec.AbstractFileSystem (strictly speaking, any object of a class implementing .glob is enough). Defaults to searching the local filesystem.

Returns: Dictionary mapping reader name string to list of filenames

satpy.readers.group_files(files_to_sort, reader=None, time_threshold=10, group_keys=None, ppp_config_dir=None, reader_kwargs=None)[source]

Group series of files by file pattern information.

By default this will group files by their filename start_time assuming it exists in the pattern. By passing the individual dictionaries returned by this function to the Scene classes’ filenames, a series Scene objects can be easily created.

New in version 0.12.

Parameters
  • files_to_sort (iterable) – File paths to sort in to group

  • reader (str or Collection[str]) – Reader or readers whose file patterns should be used to sort files. If not given, try all readers (slow, adding a list of readers is strongly recommended).

  • time_threshold (int) – Number of seconds used to consider time elements in a group as being equal. For example, if the ‘start_time’ item is used to group files then any time within time_threshold seconds of the first file’s ‘start_time’ will be seen as occurring at the same time.

  • group_keys (list or tuple) – File pattern information to use to group files. Keys are sorted in order and only the first key is used when comparing datetime elements with time_threshold (see above). This means it is recommended that datetime values should only come from the first key in group_keys. Otherwise, there is a good chance that files will not be grouped properly (datetimes being barely unequal). Defaults to a reader’s group_keys configuration (set in YAML), otherwise ('start_time',). When passing multiple readers, passing group_keys is strongly recommended as the behaviour without doing so is undefined.

  • ppp_config_dir (str) – Root usser configuration directory for Satpy. This will be deprecated in the future, but is here for consistency with other Satpy features.

  • reader_kwargs (dict) – Additional keyword arguments to pass to reader creation.

Returns

List of dictionaries mapping ‘reader’ to a list of filenames. Each of these dictionaries can be passed as filenames to a Scene object.

satpy.readers.load_reader(reader_configs, **reader_kwargs)[source]

Import and setup the reader from reader_info.

satpy.readers.load_readers(filenames=None, reader=None, reader_kwargs=None, ppp_config_dir=None)[source]

Create specified readers and assign files to them.

Parameters
  • filenames (iterable or dict) – A sequence of files that will be used to load data from. A dict object should map reader names to a list of filenames for that reader.

  • reader (str or list) – The name of the reader to use for loading the data or a list of names.

  • reader_kwargs (dict) – Keyword arguments to pass to specific reader instances. This can either be a single dictionary that will be passed to all reader instances, or a mapping of reader names to dictionaries. If the keys of reader_kwargs match exactly the list of strings in reader or the keys of filenames, each reader instance will get its own keyword arguments accordingly.

  • ppp_config_dir (str) – The directory containing the configuration files for satpy.

Returns: Dictionary mapping reader name to reader instance

satpy.readers.open_file_or_filename(unknown_file_thing)[source]

Try to open the unknown_file_thing, otherwise return the filename.

satpy.readers.read_reader_config(config_files, loader=<class 'yaml.loader.UnsafeLoader'>)[source]

Read the reader config_files and return the extracted reader metadata.