Input plugins: the mpop.satin package

Available plugins and their requirements

mipp_xrit

Reader for for hrit/lrit formats. Recommends numexpr and pyresample.

aapp1b

Reader for AAPP level 1b format. Requires numpy, recommends pyresample.

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 mpop.satin.aapp1b.AAPP1b(fname)

AAPP-level 1b data reader

calibrate(chns=('1', '2', '3A', '3B', '4', '5'), calibrate=1, pre_launch_coeffs=False, calib_coeffs=None)

Calibrate the data

navigate()

Return the longitudes and latitudes of the scene.

read()

Read the data.

mpop.satin.aapp1b.load(satscene, *args, **kwargs)

Read data from file and load it into satscene. A possible calibrate keyword argument is passed to the AAPP reader. Should be 0 for off (counts), 1 for default (brightness temperatures and reflectances), and 2 for radiances only.

If use_extern_calib keyword argument is set True, use external calibration data.

mpop.satin.aapp1b.load_avhrr(satscene, options)

Read avhrr data from file and load it into satscene.

mpop.satin.aapp1b.show(data, negate=False)

Show the stetched data.

eps_l1b

Reader for EPS level 1b format. Recommends pyresample.

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

class mpop.satin.eps_l1b.EpsAvhrrL1bReader(filename)

Eps level 1b reader for AVHRR data.

get_channels(channels, calib_type)

Get calibrated channel data. calib_type = 0: Counts calib_type = 1: Reflectances and brightness temperatures calib_type = 2: Radiances

get_full_lonlats()

Get the interpolated lons/lats.

get_lonlat(row, col)

Get lons/lats for given indices. WARNING: if the lon/lats were not expanded, this will refer to the tiepoint data.

keys()

List of reader’s keys.

mpop.satin.eps_l1b.get_corners(filename)

Get the corner lon/lats of the file.

mpop.satin.eps_l1b.get_filename(satscene, level)

Get the filename.

mpop.satin.eps_l1b.get_lonlat(scene, row, col)

Get the longitutes and latitudes for the give rows and cols.

mpop.satin.eps_l1b.load(scene, *args, **kwargs)

Loads the channels into the satellite scene. A possible calibrate keyword argument is passed to the AAPP reader Should be 0 for off, 1 for default, and 2 for radiances only. However, as the AAPP-lvl1b file contains radiances this reader cannot return counts, so calibrate=0 is not allowed/supported. The radiance to counts conversion is not possible.

mpop.satin.eps_l1b.norm255(a__)

normalize array to uint8.

mpop.satin.eps_l1b.read_raw(filename)

Read filename without scaling it afterwards.

mpop.satin.eps_l1b.show(a__)

show array.

mpop.satin.eps_l1b.to_bt(arr, wc_, a__, b__)

Convert to BT.

mpop.satin.eps_l1b.to_refl(arr, solar_flux)

Convert to reflectances.

viirs_sdr

Reader for the VIIRS SDR format. Requires h5py.

Interface to VIIRS SDR format

Format documentation: http://npp.gsfc.nasa.gov/science/sciencedocuments/082012/474-00001-03_CDFCBVolIII_RevC.pdf

class mpop.satin.viirs_sdr.GeolocationFlyweight(cls)
clear_cache()
class mpop.satin.viirs_sdr.HDF5MetaData(filename)

Small class for inspecting a HDF5 file and retrieve its metadata/header data. It is developed for JPSS/NPP data but is really generic and should work on most other hdf5 files.

Supports

collect_metadata(name, obj)
get_data_keys()
keys()
read()
class mpop.satin.viirs_sdr.NPPMetaData(filename)
get_band_description()
get_begin_orbit_number()
get_begin_time()
get_brightness_temperature_keys()
get_end_orbit_number()
get_end_time()
get_geofilname()
get_radiance_keys()
get_reflectance_keys()
get_ring_lonlats()
get_shape()
get_unit(calibrate=1)
class mpop.satin.viirs_sdr.ViirsBandData(filenames, calibrate=1)

Placeholder for the VIIRS M&I-band data. Reads the SDR data - one hdf5 file for each band. Not yet considering the Day-Night Band

read()
read_lonlat(geofilepaths=None, geodir=None)
class mpop.satin.viirs_sdr.ViirsSDRReader(*args, **kwargs)
load(satscene, calibrate=1, time_interval=None, area=None, filename=None, **kwargs)

Read viirs SDR reflectances and Tbs from file and load it into satscene.

pformat = 'viirs_sdr'
mpop.satin.viirs_sdr.get_lonlat_into(filename, out_lons, out_lats, out_mask)

Read lon,lat from hdf5 file

mpop.satin.viirs_sdr.globify(filename)

viirs_compact

Reader for the VIIRS compact format from EUMETSAT. Requires h5py.

hdfeos_l1b

Reader for Modis data format. Requires pyhdf.

msg_hdf

Reader for MSG cloud products. Requires h5py, recommends acpg.

Plugin for reading PPS’s cloud products hdf files.

class mpop.satin.msg_hdf.InfoObject

Simple data and info container.

class mpop.satin.msg_hdf.MsgCTTH(resolution=None)

CTTH channel.

convert2pps()

Convert the current CTTH channel to pps format.

is_loaded()

Tells if the channel contains loaded data.

oldconvert2pps()

Convert the current CTTH channel to pps format.

project(coverage)

Project the current CTTH channel along the coverage

read(filename, calibrate=True)
save(filename, **kwargs)

Save the current CTTH channel to HDF5 format.

class mpop.satin.msg_hdf.MsgCTTHData

CTTH data object.

class mpop.satin.msg_hdf.MsgCloudType

NWCSAF/MSG Cloud Type data structure as retrieved from HDF5 file. Resolution sets the nominal resolution of the data.

convert2nordrad()
convert2pps()
is_loaded()

Tells if the channel contains loaded data.

oldconvert2pps()

Converts the NWCSAF/MSG Cloud Type to the PPS format, in order to have consistency in output format between PPS and MSG.

project(coverage)

Remaps the NWCSAF/MSG Cloud Type to cartographic map-projection on area give by a pre-registered area-id. Faster version of msg_remap!

read(filename)

Reader for the NWCSAF/MSG cloudtype. Use filename to read data.

save(filename, **kwargs)

Save the current cloudtype object to hdf filename, in pps format.

class mpop.satin.msg_hdf.MsgCloudTypeData

NWCSAF/MSG Cloud Type data layer

class mpop.satin.msg_hdf.MsgPC

NWCSAF/MSG Precipitating Clouds data structure as retrieved from HDF5 file. Resolution sets the nominal resolution of the data.

is_loaded()

Tells if the channel contains loaded data.

read(filename, calibrate=True)

Reader for the NWCSAF/MSG precipitating clouds. Use filename to read data.

class mpop.satin.msg_hdf.MsgPCData

NWCSAF/MSG Precipitating Clouds data layer

class mpop.satin.msg_hdf.NordRadCType(ctype_instance)

Wrapper aroud the msg_ctype channel.

save(filename, **kwargs)

Save the current instance to nordrad hdf format.

exception mpop.satin.msg_hdf.UnknownChannelError
mpop.satin.msg_hdf.add_nullterm_attr(obj, key, val)
mpop.satin.msg_hdf.ctth_procflags2pps(data)

Convert ctth processing flags from MSG to PPS format.

mpop.satin.msg_hdf.ctype_procflags2pps(data)

Converting cloud type processing flags to the PPS format, in order to have consistency between PPS and MSG cloud type contents.

mpop.satin.msg_hdf.get_area_extent(filename)

Get the area extent of the data in filename.

mpop.satin.msg_hdf.get_area_from_file(filename)

Get the area from the h5 file.

mpop.satin.msg_hdf.get_best_product(filename, area_extent)

Get the best of the available products for the filename template.

mpop.satin.msg_hdf.get_best_products(filename, area_extent)

Get the best of the available products for the filename template.

mpop.satin.msg_hdf.get_bit_from_flags(arr, nbit)

I don’t know what this function does.

mpop.satin.msg_hdf.load(scene, **kwargs)

Load data into the channels. Channels is a list or a tuple containing channels we will load data into. If None, all channels are loaded.

mpop.satin.msg_hdf.pcs_def_from_region(region)

pps_hdf

Reader for PPS cloud products. Requires acpg.

Plugin for reading PPS’s cloud products hdf files.

class mpop.satin.pps_hdf.PpsCTTH
copy(other)
read(filename)
class mpop.satin.pps_hdf.PpsCloudType
copy(other)
is_loaded()
read(filename)
mpop.satin.pps_hdf.load(scene, **kwargs)

Load data into the channels. Channels is a list or a tuple containing channels we will load data into. If None, all channels are loaded.

hrpt

Reader for level 0 hrpt format. Requires AAPP and pynav.

eps1a

Reader for level 1a Metop segments. Requires AAPP, kai and eugene.

Interaction with reader plugins

The reader plugin instance used for a specific scene is accessible through a scene attribute named after the plugin format. For example, the attribute for the foo format would be called foo_reader.

This way the other methods present in the plugins are available through the scene object.

The plugin API

Changed in version 0.13.0: New plugin API

The mpop.plugin_base module defines the plugin API.

class mpop.plugin_base.Plugin

The base plugin class. It is not to be used as is, it has to be inherited by other classes.

class mpop.plugin_base.Reader(scene)

Reader plugins. They should have a pformat attribute, and implement the load method. This is an abstract class to be inherited.

load(channels_to_load)

Loads the channels_to_load into the scene object.

ptype = 'reader'
class mpop.plugin_base.Writer(scene)

Writer plugins. They must implement the save method. This is an abstract class to be inherited.

ptype = 'writer'
save(filename)

Saves the scene to a given filename.

Adding a new plugin

For now only reader and writer plugins base classes are defined.

To add one of those, just create a new class that subclasses the plugin.

The interface of any reader plugin must include the load() method.

Take a look at the existing readers for more insight.