cmaqsatproc.readers.modis package

Submodules

cmaqsatproc.readers.modis.modis_readers module

cmaqsatproc.readers.modis.modis_readers.gdal_to_xrdataarray(path)[source]
cmaqsatproc.readers.modis.modis_readers.gdalhdf4_to_xrdataset(path, unpack=False)[source]

Module contents

class cmaqsatproc.readers.modis.MOD04[source]

Bases: satellite

MOD04 (MOD04_3K or MOD04_L2) filters valid pixels and provides weights for destination polygon: * valid = Land_Ocean_Quality_Flag > 1 and value == value * pixel_area = corners from centroids +- delta * weight = intx_fracarea

classmethod open_dataset(path, bbox=None, **kwargs)[source]

Opens dataset and defines valid where the pixel is within bbox, flags are appropriate, and inteprolates pixel centers to corners.

Parameters:
  • path (str) – Path to a MOD04 OpenDAP-style file

  • bbox (iterable) – swlon, swlat, nelon, nelat in decimal degrees East and North

  • kwargs (mappable) – Passed to xarray.open_dataset

Returns:

sat – Satellite processing instance

Return type:

MOD04

classmethod shorten_name(key)[source]

Provide a short name for long keys. This is useful for renaming variables to fit IOAPI 16 character restrictions.

Parameters:

key (str) – Original variable name.

Returns:

shortkey – Shortened key

Return type:

str

class cmaqsatproc.readers.modis.MOD04_3K[source]

Bases: MOD04

MOD04_3K filters valid pixels and provides weights for destination polygon: * valid = Land_Ocean_Quality_Flag > 1 and value == value * pixel_area = corners from centroids +- delta * weight = intx_fracarea

Thin wrapper around satellite.cmr_links where concept_id is set to “C1443420430-LAADS”.

Parameters:

method (str) – ‘opendap’, ‘download’, or ‘s3’.

Returns:

links – List of links for download or OpenDAP

Return type:

list

class cmaqsatproc.readers.modis.MOD04_L2[source]

Bases: MOD04

MOD04_L2 filters valid pixels and provides weights for destination polygon: * valid = Land_Ocean_Quality_Flag > 1 and value == value * pixel_area = corners from centroids +- delta * weight = intx_fracarea

Thin wrapper around satellite.cmr_links where concept_id is set to “C1443533440-LAADS”.

Parameters:

method (str) – ‘opendap’, ‘download’, or ‘s3’.

Returns:

links – List of links for download or OpenDAP

Return type:

list

class cmaqsatproc.readers.modis.MODISL3[source]

Bases: satellite

MODISL3 filters valid pixels and provides weights for destination polygon: * valid = Land_Ocean_Quality_Flag > 1 and value == value * pixel_area = corners from centroids +- delta * weight = intx_fracarea

classmethod open_dataset(path, bbox=None, **kwargs)[source]

Opens dataset (remote or local). Defines valid as QualityLevel == 0. Interpolates pixel centers to corners. And adjusts valid to only include pixels in bbox.

Parameters:
  • path (str) – Path to a MOD04 OpenDAP-style file

  • bbox (iterable) – swlon, swlat, nelon, nelat in decimal degrees East and North of 0, 0

  • kwargs (mappable) – Passed to xarray.open_dataset

Returns:

sat – Satellite processing instance

Return type:

MODISL3

to_dataframe(*varkeys, valid=True, geo=False, default_keys=False)[source]
Parameters:
  • varkeys (iterable) – Keys to use in the dataframe. Defaults to class._defaultkeys that is class specific

  • valid (bool) – If true, only return valid pixels.

  • geo (bool) – Add geometry to output a geopandas.GeoDataFrame

Returns:

df

Return type:

pandas.DataFrame or geopandas.GeoDataFrame

to_level3(*varkeys, grid, griddims=None, weighting='equal', as_dataset=True, verbose=0)[source]
Parameters:
  • varkeys (iterable) – See to_dataframe

  • grid (geopandas.GeoDataFrame or xr.Dataset) – Defines the grid used as the L3 destination

  • griddims (iterable) – Defaults to grid.index.names

  • weighting (str) – Passed as option to self.add_weights

Returns:

outputs – Dictionary of outputs by output dimensions

Return type:

dict