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).

http://research.metoffice.gov.uk/research/interproj/nwpsaf/aapp/ NWPSAF-MF-UD-003_Formats.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.

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

Calibrate the data.

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()[source]

Get the longitudes and latitudes of the scene.

read()[source]

Read the data.

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.

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.

sensor

Get sensor name for current file handler.

spatial_resolution_to_number()[source]

Convert the ‘spatial_resolution’ global attribute to meters.

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.

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 (DatasetID) – ID of dataset that will be loaded
  • ds_info (dict) – Dictionary of dataset information from config file
Returns:

(rows, cols)

Return type:

tuple

platform_name

Get satellite name for this file’s data.

sensor_name

Get instrument name for this file’s data.

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

calibrate(data, lut)[source]

Calibrate digital number (DN) to brightness_temperature :param dn: Raw detector digital number :param 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)]

end_time

Get end time.

get_area_def(key)[source]

Get area definition.

get_dataset(dataset_id, ds_info)[source]

Load a dataset.

start_time

Get 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')[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])

By default these updated coefficients are not used.

Initialize the reader.

calibrate(data, calibration)[source]

Calibrate the data

convert_to_radiance(data)[source]

Calibrate to radiance.

end_time

Get end time.

get_area_def(dsid)[source]

Get area definition.

get_dataset(key, info)[source]

Get dataset.

read_band(key, info)[source]

Read the data.

scheduled_time

Time this band was scheduled to be recorded.

start_time

Get 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

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_shape(ds_id, ds_info)[source]

Get output shape of specified dataset.

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, adjust_clock_drift=True, tle_dir=None, tle_name=None, tle_thresh=7)[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.
  • adjust_clock_drift – Adjust the geolocation to compensate for the clock error (POD satellites only).
  • tle_dir – Directory holding Two-Line-Element (TLE) files
  • tle_name – Filename pattern of TLE files.
  • tle_thresh – Maximum number of days between observation and nearest TLE
end_time

Get the end time.

get_dataset(key, info)[source]

Get the dataset.

slice(data, times)[source]

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

Furthermore, update scanline timestamps and auxiliary information.

Parameters:
  • data – Data to be sliced
  • times – Scanline timestamps
Returns:

Sliced data and timestamps

start_time

Get the start time.

satpy.readers.caliop_l2_cloud module

Interface to CALIOP L2 HDF4 cloud products.

class satpy.readers.caliop_l2_cloud.HDF4BandReader(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

CALIOP v3 HDF4 reader.

Initialze file handler.

end_time

Get end time.

get_dataset(key, info)[source]

Read data from file and return the corresponding projectables.

get_end_time()[source]

Get observation end time from file metadata.

get_filehandle()[source]

Get HDF4 filehandle.

get_lonlats()[source]

Get longitude and latitude arrays from the file.

get_sds_variable(name)[source]

Read variable from the HDF4 file.

static parse_metadata_string(metadata_string)[source]

Grab end time with regular expression.

start_time

Get start time.

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

Open file and collect information.

available_datasets(configured_datasets=None)[source]

Automatically determine datasets provided by this file

end_time

Get end time.

get_area_def(key)[source]

Get the area definition of the data at hand.

get_dataset(dataset_id, ds_info)[source]

Get dataset.

get_metadata(data_arr, ds_info)[source]
get_nadir_resolution(sensor)[source]
get_platform(platform)[source]
get_rows_per_scan(sensor)[source]
get_sensor(sensor)[source]
get_shape(dataset_id, ds_info)[source]
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'}
start_time

Get start time.

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.

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 lons/lats.

get_full_lonlats()[source]

Get the interpolated lons/lats.

get_lonlats()[source]

Get lonlats.

keys()[source]

List of reader’s keys.

platform_name

Get platform name.

sensor_name

Get sensor name.

sensors = {'AVHR': 'avhrr-3'}
spacecrafts = {'M01': 'Metop-B', 'M02': 'Metop-A', 'M03': 'Metop-C'}
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.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 2021 by the earliest. For more information about FCI, see EUMETSAT.

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
  • From the data variable data/<channel>/measured/y, the y-coordinates for the grid, in radians
  • From the attribute semi_major_axis on the data variable data/mtg_geos_projection, the Earth equatorial radius
  • From the attribute semi_minor_axis on the same, the Earth polar radius
  • From the attribute perspective_point_height on the same data variable, the geostationary altitude in the normalised geostationary projection (see PUG §5.2)
  • From the attribute longitude_of_projection_origin on the same data variable, the longitude of the projection origin
  • From the attribute inverse_flattening on the same data variable, the (inverse) flattening of the ellipsoid
  • 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.

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, measured, root)[source]

Calibrate data.

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_dataset(channel)[source]

Get channel dataset.

get_dataset(key, info=None)[source]

Load a dataset.

start_time

Get start time.

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.DatasetID 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 (DatasetID) 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.

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.

sensor_names

List of sensors represented in this file.

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.

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.

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.

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.

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.

is_geo

Check platform.

platforms = {}
resolution

Get resolution.

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

Get sensor names.

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

Get start time.

satpy.readers.ghrsst_l3c_sst module

An OSISAF SST reader for the netCDF GHRSST format.

class satpy.readers.ghrsst_l3c_sst.GHRSST_OSISAFL2(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

Reader for the OSISAF SST GHRSST format.

end_time

Get end time.

get_area_def(area_id, area_info)[source]

Override abstract baseclass method.

get_dataset(dataset_id, ds_info, out=None)[source]

Load a dataset.

get_lonlats(navid, nav_info, lon_out=None, lat_out=None)[source]

Load an area.

start_time

Get start time.

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

get_coefs(platform, channel)[source]
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

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.

calibrate(data, calibration, channel)[source]

Perform calibration

end_time

End timestamp of the dataset

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
ir_sectors
meta

Derive metadata from the coordinates

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
start_time

Start timestamp of the dataset

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.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

available_datasets(configured_datasets=None)[source]

Automatically determine datasets provided by this file

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]
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.

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.

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')}
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.

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.

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.

References

JMA HRIT - Mission Specific Implementation http://www.jma.go.jp/jma/jma-eng/satellite/introduction/4_2HRIT.pdf

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.

get_area_def(dsid)[source]

Get the area definition of the band.

get_dataset(key, info)[source]

Get the dataset designated by key.

satpy.readers.hrpt module

Reading and calibrating hrpt avhrr data.

Todo: - AMSU - Compare output with AAPP

Reading: http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/c4/sec4-1.htm#t413-1

Calibration: http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/c7/sec7-1.htm

class satpy.readers.hrpt.HRPTFile(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

Reader for HRPT Minor Frame, 10 bits data expanded to 16 bits.

end_time

Get end time.

get_dataset(key, info)[source]

Get dataset.

get_lonlats()[source]
get_telemetry()[source]
read()[source]
start_time

Get start time.

satpy.readers.hrpt.bfield(array, bit)[source]

return the bit array.

satpy.readers.hrpt.geo_interpolate(lons32km, lats32km)[source]
satpy.readers.hrpt.time_seconds(tc_array, year)[source]

Return the time object from the timecodes

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

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]

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.

end_time

Get end time.

get_dataset(key, info)[source]

Load a dataset

start_time

Get 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.li_l2 module

Interface to MTG-LI L2 product NetCDF files

The reader is based on preliminary test data provided by EUMETSAT. The data description is described in the “LI L2 Product User Guide [LIL2PUG] Draft version” documentation.

class satpy.readers.li_l2.LIFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

MTG LI File Reader.

end_time

Get end time.

get_area_def(key, info=None)[source]

Create AreaDefinition for specified product.

Projection information are hard coded for 0 degree geos projection Test dataset doesn’t provide the values in the file container. Only fill values are inserted.

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

Load a dataset

start_time

Get start time.

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

end_time

Get end time.

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

Get a dataset from the file.

get_platform(platform)[source]
read(filename)[source]
start_time

Get 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.

end_time

Time for final observation.

get_dataset(dataset_id, ds_info)[source]

Load data variable and metadata and calibrate if needed.

sensor_name

Map sensor name to Satpy ‘standard’ sensor names.

start_time

Time for first observation.

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.

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.

get_dataset(key, info)[source]

Get the geolocation 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

end_time

Get end time.

get_area_def(dsid)[source]

Get area definition.

get_dataset(key, info)[source]

Load a dataset.

start_time

Get start time.

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

Bases: satpy.readers.file_handlers.BaseFileHandler

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 refered to by key.

interpolate_angles(angles, resolution)[source]
start_time

Get start time.

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.
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.

end_orbit_number

Return orbit number for the end of the swath.

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.

platform_name

Return standard platform name for the file’s data.

sensor_names

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

start_orbit_number

Return orbit number for the beginning of the swath.

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 DatasetIDs.

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_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.

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.

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).

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

  • xarray.open_dataset()
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.

end_time

End time property.

get_dataset(key, info)[source]

Load a dataset.

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.

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.

platform_name

Get the platform name.

sensor_name

Get the sensor name.

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.

end_time

Product end_time, parsed from the measurement file name.

fend_time

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

fstart_time

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

get_dataset(key, info)[source]

Load a dataset.

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.

end_time

Get 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)

read_band(blocksize=4096)[source]

Read the band in chunks.

read_band_blocks(blocksize=4096)[source]

Read the band in native blocks.

start_time

Get 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.

end_time

Get end time.

get_calibration(name, 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.

start_time

Get 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]

satpy.readers.scatsat1_l2b module

ScatSat-1 L2B Reader, distributed by Eumetsat in HDF5 format

class satpy.readers.scatsat1_l2b.SCATSAT1L2BFileHandler(filename, filename_info, filetype_info)[source]

Bases: satpy.readers.file_handlers.BaseFileHandler

get_dataset(key, info)[source]

Get dataset.

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.

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.

sensor_names

Get the sensor names.

start_time

Get the start time.

satpy.readers.seviri_base module

Utilities and helper classes for MSG HRIT/Native data reading.

References

MSG Level 1.5 Image Data Format Description https://www.eumetsat.int/website/wcm/idc/idcplg?IdcService=GET_FILE&dDocName=PDF_TEN_05105_MSG_IMG_DATA&RevisionSelectionMethod=LatestReleased&Rendition=Web

class satpy.readers.seviri_base.MpefProductHeader[source]

Bases: object

MPEF product header class.

get()[source]

Return numpy record_array for MPEF product header.

images_used

Return structure for images_used.

class satpy.readers.seviri_base.SEVIRICalibrationHandler[source]

Bases: object

Calibration handler for SEVIRI HRIT- and native-formats.

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.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:
  • days (int, either scalar or numpy.ndarray) – Days since 1958-01-01
  • msecs (int, either scalar or numpy.ndarray) – Milliseconds of the day
Returns:

Timestamp(s)

Return type:

numpy.datetime64

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 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 :class: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 HRITMSGFileHandler.

  • 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'))
    

References

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, satpy.readers.seviri_base.SEVIRICalibrationHandler

SEVIRI HRIT format reader.

Calibration

It is possible to choose between two file-internal calibration coefficients for the conversion from counts to radiances:

  • Nominal for all channels (default)
  • GSICS for IR channels and nominal for VIS channels

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

import satpy
import glob

filenames = glob.glob('H-000-MSG3*')
scene = satpy.Scene(filenames,
                    reader='seviri_l1b_hrit',
                    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. They must be specified in [mW m-2 sr-1 (cm-1)-1]. External coefficients take precedence over internal 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).

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_hrit',
                    reader_kwargs={'ext_calib_coefs': coefs})
scene.load(['VIS006', 'VIS008', 'IR_108', 'IR_120'])

In the next example we use we use external calibration coefficients for the VIS006 & IR_108 channels, nominal coefficients for the remaining VIS channels and GSICS coefficients for the remaining IR channels:

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

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.

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.

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_native module

SEVIRI native format reader.

References

MSG Level 1.5 Native Format File Definition https://www.eumetsat.int/website/wcm/idc/idcplg?IdcService=GET_FILE&dDocName=PDF_FG15_MSG-NATIVE-FORMAT-15&RevisionSelectionMethod=LatestReleased&Rendition=Web MSG Level 1.5 Image Data Format Description https://www.eumetsat.int/website/wcm/idc/idcplg?IdcService=GET_FILE&dDocName=PDF_TEN_05105_MSG_IMG_DATA&RevisionSelectionMethod=LatestReleased&Rendition=Web

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

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

SEVIRI native format reader.

The Level1.5 Image data calibration method can be changed by adding the required mode to the Scene object instantiation kwargs eg kwargs = {“calib_mode”: “gsics”,}

Initialize the reader.

calibrate(data, dataset_id)[source]

Calibrate the data.

end_time

Read the repeat cycle end time from metadata.

get_area_def(dataset_id)[source]

Get the area definition of the band.

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.

start_time

Read the repeat cycle start time from metadata.

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

celestial_events
geometric_processing
get()[source]
image_acquisition
image_description
impf_configuration
radiometric_processing
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

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

satpy.readers.seviri_l1b_nc module

SEVIRI netcdf format reader.

References

MSG Level 1.5 Image Data Format Description https://www.eumetsat.int/website/wcm/idc/idcplg?IdcService=GET_FILE&dDocName=PDF_TEN_05105_MSG_IMG_DATA&RevisionSelectionMethod=LatestReleased&Rendition=Web

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

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

end_time

Get end time.

get_area_def(dataset_id)[source]

Get area definition.

get_area_extent(dsid)[source]
get_dataset(dataset_id, dataset_info)[source]

Get dataset.

start_time

Get 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

Initialize file handler.

satpy.readers.slstr_l1b module

SLSTR L1b reader.

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

Bases: satpy.readers.file_handlers.BaseFileHandler

Filehandler for l1 SLSTR data.

Initialize the SLSTR l1 data filehandler.

end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

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.

end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

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.

end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

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.

end_time

Get the end time.

get_dataset(key, info)[source]

Load a dataset.

start_time

Get the 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.

available_datasets(configured_datasets=None)[source]

Automatically determine datasets provided by this file.

end_time

Get end time.

get_dataset(ds_id, ds_info)[source]

Get dataset.

get_metadata(data, ds_info)[source]

Get metadata.

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])
sensor

Get sensor.

start_time

Get start time.

satpy.readers.utils module

Helper functions for area extent calculations.

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_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: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.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.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.

end_time

Get end time.

get_dataset(dataset_id, dataset_info)[source]

Load a dataset.

start_time

Get start time.

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.

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.

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.

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.

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

platform_name

Name of platform/satellite for this file.

sensor_name

Name of sensor for this file.

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
end_time

Get last date/time when observations were recorded.

get_dataset(dsid, dsinfo)[source]

Get requested data as DataArray.

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.

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.

platform_name

Get platform name.

sensor_name

Get sensor name.

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.

adjust_scaling_factors(factors, file_units, output_units)[source]

Adjust scaling factors.

end_orbit_number

Get end orbit number.

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.

platform_name

Get platform name.

sensor_name

Get sensor name.

start_orbit_number

Get start orbit number.

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.

adjust_scaling_factors(factors, file_units, output_units)[source]

Adjust scaling factors.

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.

end_orbit_number

Get end orbit number.

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.

mask_fill_values(data, ds_info)[source]

Mask fill values.

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.

sensor_name

Get sensor name.

start_orbit_number

Get start orbit number.

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.

end_time

Get ending observation time.

get_dataset(dataset_id, ds_info)[source]

Create DataArray from file content for dataset_id.

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_files)[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.

all_dataset_ids

Get DatasetIDs of all datasets known to this reader.

all_dataset_names

Get names of all datasets known to this reader.

available_dataset_ids

Get DatasetIDs that are loadable by this reader.

available_dataset_names

Get names of datasets that are loadable by this reader.

end_time

End time of the reader.

filter_selected_filenames(filenames)[source]

Filter provided filenames by parameters in reader configuration.

Returns: iterable of usable files

get_dataset_key(key, **kwargs)[source]

Get the fully qualified DatasetID matching key.

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

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)[source]

Find files for this reader in directory.

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

select_files_from_pathnames(filenames)[source]

Select the files from filenames this reader can handle.

sensor_names

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

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_files, 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.

available_dataset_ids

Get DatasetIDs 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.

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 DatasetID matching key.

This will first search through available DatasetIDs, 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, DatasetID) – 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 DatasetID 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.

new_filehandler_instances(filetype_info, filename_items, fh_kwargs=None)[source]

Generate new filehandler instances.

new_filehandlers_for_filetype(filetype_info, filenames, fh_kwargs=None)[source]

Create filehandlers for a given filetype.

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.

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.GEOSegmentYAMLReader(config_files, filter_parameters=None, filter_filenames=True, **kwargs)[source]

Bases: satpy.readers.yaml_reader.FileYAMLReader

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.get_filebase(path, pattern)[source]

Get the end of path of same length as pattern.

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.match_filenames(filenames, pattern)[source]

Get the filenames matching pattern.

Module contents

Shared objects of the various reader classes.

class satpy.readers.DatasetDict[source]

Bases: dict

Special dictionary object that can handle dict operations based on dataset name, wavelength, or DatasetID.

Note: Internal dictionary keys are DatasetID objects.

contains(item)[source]

Check contains when we know the exact DatasetID.

get(key, default=None)[source]

Get value with optional default.

get_key(match_key, num_results=1, best=True, **dfilter)[source]

Get multiple fully-specified keys that match the provided query.

Parameters:
  • key (DatasetID) – DatasetID of query parameters to use for searching. Any parameter that is None is considered a wild card and any match is accepted. Can also be a string representing the dataset name or a number representing the dataset wavelength.
  • num_results (int) – Number of results to return. If 0 return all, if 1 return only that element, otherwise return a list of matching keys.
  • **dfilter (dict) – See get_key function for more information.
getitem(item)[source]

Get Node when we know the exact DatasetID.

keys(names=False, wavelengths=False)[source]

Give currently contained keys.

exception satpy.readers.TooManyResults[source]

Bases: KeyError

Special exception when one key maps to multiple items in the container.

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.filter_keys_by_dataset_id(did, key_container)[source]

Filer provided key iterable by the provided DatasetID.

Note: The modifiers attribute of did should be None to allow for
any modifier in the results.
Parameters:
  • did (DatasetID) – Query parameters to match in the key_container.
  • key_container (iterable) – Set, list, tuple, or dict of DatasetID keys.
Returns (list): List of keys matching the provided parameters in no
specific order.
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)[source]

Find on-disk 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.

The returned dictionary can be passed directly to the Scene object through the filenames keyword argument.

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
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.

Returns: Dictionary mapping reader name string to list of filenames

satpy.readers.get_best_dataset_key(key, choices)[source]

Choose the “best” DatasetID from choices based on key.

The best key is chosen based on the follow criteria:

  1. Central wavelength is nearest to the key wavelength if specified.
  2. Least modified dataset if modifiers is None in key. Otherwise, the modifiers are ignored.
  3. Highest calibration if calibration is None in key. Calibration priority is chosen by satpy.CALIBRATION_ORDER.
  4. Best resolution (smallest number) if resolution is None in key. Otherwise, the resolution is ignored.

This function assumes choices has already been filtered to only include datasets that match the provided key.

Parameters:
  • key (DatasetID) – Query parameters to sort choices by.
  • choices (iterable) – DatasetID objects to sort through to determine the best dataset.
Returns: List of best DatasetID`s from `choices. If there is more
than one element this function could not choose between the available datasets.
satpy.readers.get_key(key, key_container, num_results=1, best=True, resolution=None, calibration=None, polarization=None, level=None, modifiers=None)[source]

Get the fully-specified key best matching the provided key.

Only the best match is returned if best is True (default). See get_best_dataset_key for more information on how this is determined.

The resolution and other identifier keywords are provided as a convenience to filter by multiple parameters at once without having to filter by multiple key inputs.

Parameters:
  • key (DatasetID) – DatasetID of query parameters to use for searching. Any parameter that is None is considered a wild card and any match is accepted.
  • key_container (dict or set) – Container of DatasetID objects that uses hashing to quickly access items.
  • num_results (int) – Number of results to return. Use 0 for all matching results. If 1 then the single matching key is returned instead of a list of length 1. (default: 1)
  • best (bool) – Sort results to get “best” result first (default: True). See get_best_dataset_key for details.
  • resolution (float, int, or list) – Resolution of the dataset in dataset units (typically meters). This can also be a list of these numbers.
  • calibration (str or list) – Dataset calibration (ex.’reflectance’). This can also be a list of these strings.
  • polarization (str or list) – Dataset polarization (ex.’V’). This can also be a list of these strings.
  • level (number or list) – Dataset level (ex. 100). This can also be a list of these numbers.
  • modifiers (list) – Modifiers applied to the dataset. Unlike resolution and calibration this is the exact desired list of modifiers for one dataset, not a list of possible modifiers.

Returns (list or DatasetID): Matching key(s)

Raises: KeyError if no matching results or if more than one result is
found when num_results is 1.
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) – Reader whose file patterns should be used to sort files. This
  • 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',).
  • 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.
  • ppp_config_dir (str) – The directory containing the configuration files for satpy.

Returns: Dictionary mapping reader name to reader instance

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

Read the reader config_files and return the info extracted.