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. The IMAPP direct broadcast naming format is also supported with names like: a1.12226.1846.1000m.hdf.

Saturation Handling

Band 2 of the MODIS sensor is available in 250m, 500m, and 1km resolutions. The band data may include a special fill value to indicate when the detector was saturated in the 250m version of the data. When the data is aggregated to coarser resolutions this saturation fill value is converted to a “can’t aggregate” fill value. By default, Satpy will replace these fill values with NaN to indicate they are invalid. This is typically undesired when generating images for the data as they appear as “holes” in bright clouds. To control this the keyword argument mask_saturated can be passed and set to False to set these two fill values to the maximum valid value.

scene = satpy.Scene(filenames=filenames,
                    reader='modis_l1b',
                    reader_kwargs={'mask_saturated': False})
scene.load(['2'])

Note that the saturation fill value can appear in other bands (ex. bands 7-19) in addition to band 2. Also, the “can’t aggregate” fill value is a generic “catch all” for any problems encountered when aggregating high resolution bands to lower resolutions. Filling this with the max valid value could replace non-saturated invalid pixels with valid values.

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, mask_saturated=True, **kwargs)[source]

Bases: HDFEOSBaseFileReader

Handler for the regular band channels.

Init the file handler.

_calibrate_data(key, info, array, var_attrs, index)[source]
_fill_saturated(array, valid_max)[source]

Replace saturation-related values with max reflectance.

If the file handler was created with mask_saturated set to True then all invalid/fill values are set to NaN. If False then the fill values 65528 and 65533 are set to the maximum valid value. These values correspond to “can’t aggregate” and “saturation”.

Fill values:

  • 65535 Fill Value (includes reflective band data at night mode and completely missing L1A scans)

  • 65534 L1A DN is missing within a scan

  • 65533 Detector is saturated

  • 65532 Cannot compute zero point DN, e.g., SV is saturated

  • 65531 Detector is dead (see comments below)

  • 65530 RSB dn** below the minimum of the scaling range

  • 65529 TEB radiance or RSB dn exceeds the maximum of the scaling range

  • 65528 Aggregation algorithm failure

  • 65527 Rotation of Earth view Sector from nominal science collection position

  • 65526 Calibration coefficient b1 could not be computed

  • 65525 Subframe is dead

  • 65524 Both sides of the PCLW electronics on simultaneously

  • 65501 - 65523 (reserved for future use)

  • 65500 NAD closed upper limit

_get_band_index(var_attrs, band_name)[source]

Get the relative indices of the desired channel.

_get_band_variable_name_and_index(band_name)[source]
_mask_invalid(array, valid_min, valid_max)[source]

Replace fill values with NaN.

_mask_uncertain_pixels(array, uncertainty, band_index)[source]
get_dataset(key, info)[source]

Read data from file and return the corresponding projectables.

res = {'1': 1000, 'H': 500, 'Q': 250}
res_to_possible_variable_names = {250: ['EV_250_RefSB'], 500: ['EV_250_Aggr500_RefSB', 'EV_500_RefSB'], 1000: ['EV_250_Aggr1km_RefSB', 'EV_500_Aggr1km_RefSB', 'EV_1KM_RefSB', 'EV_1KM_Emissive']}
class satpy.readers.modis_l1b.MixedHDFEOSReader(filename, filename_info, filetype_info, **kwargs)[source]

Bases: HDFEOSGeoReader, HDFEOSBandReader

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

Init the file handler.

get_dataset(key, info)[source]

Get the dataset.

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

Calibration for the emissive channels.

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

Calibration for counts channels.

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

Calibration for radiance channels.

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

Calibration for reflective channels.