Skip to content

MODIS

MODIS PDS

class

rio_tiler_pds.modis.aws.modis_pds.MODISReader(input, tms=<TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, minzoom=4, maxzoom=9, reader=<class 'rio_tiler.io.rasterio.Reader'>, reader_options=NOTHING, bucket='modis-pds', prefix_pattern='{product}.{version}/{horizontal_grid}/{vertical_grid}/{date}')

Bases
rio_tiler.io.base.MultiBandReader rio_tiler.io.base.SpatialMixin

AWS Public Dataset MODIS reader.

Parameters
  • tms (TileMatrixSet, optional)
  • input (str)
  • minzoom (int, optional)
  • maxzoom (int, optional)
  • reader_options (dict, optional)
  • reader (type of Reader, optional)
  • bucket (str, optional)
  • prefix_pattern (str, optional)
Attributes
  • bands (tuple) list of available bands (default is defined for each sensor).
  • bounds
  • crs
  • geographic_bounds (float, float, float, float) Return dataset bounds in geographic_crs.
  • input (any) input data.
  • maxzoom (int, optional) Set dataset's maxzoom.
  • minzoom (int, optional) Set dataset's minzoom.
  • reader_options (dict, option) options to forward to the reader. Defaults to {}.
  • scene_params (dict) scene id parameters.
  • tms (morecantile.TileMatrixSet, optional) TileMatrixSet grid definition. Defaults to WebMercatorQuad.
Examples
>>> with MODISReader('MCD43A4.A2017006.h21v11.006.2017018074804') as scene:
        print(scene.bounds)
Methods
  • __attrs_post_init__() Parse Sceneid and get grid bounds.
  • __enter__() Support using with Context Managers.
  • __exit__(exc_type, exc_value, traceback) Support using with Context Managers.
  • feature(shape, bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge parts defined by geojson feature from multiple bands.
  • info(bands, *args, **kwargs) (dict) Return metadata from multiple bands.
  • parse_expression(expression) (tuple) Parse rio-tiler band math expression.
  • part(bbox, bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge parts from multiple bands.
  • point(lon, lat, bands, expression, **kwargs) (PointData) Read a pixel values from multiple bands.
  • preview(bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge previews from multiple bands.
  • statistics(bands, expression, categorical, categories, percentiles, hist_options, max_size, **kwargs) (dict) Return array statistics for multiple assets.
  • tile(tile_x, tile_y, tile_z, bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge Web Map tiles multiple bands.
  • tile_exists(tile_x, tile_y, tile_z) (bool) Check if a tile intersects the dataset bounds.
method

tile_exists(tile_x, tile_y, tile_z)

Check if a tile intersects the dataset bounds.

Parameters
  • tile_x (int) Tile's horizontal index.
  • tile_y (int) Tile's vertical index.
  • tile_z (int) Tile's zoom level index.
Returns (bool)

True if the tile intersects the dataset bounds.

method

__enter__()

Support using with Context Managers.

method

__exit__(exc_type, exc_value, traceback)

Support using with Context Managers.

Parameters
  • exc_type
  • exc_value
  • traceback
method

parse_expression(expression) → tuple

Parse rio-tiler band math expression.

Parameters
  • expression (str)
method

info(bands=None, *args, **kwargs)

Return metadata from multiple bands.

Parameters
  • bands (sequence of str or str, optional) band names to fetch info from. Required keyword argument.
  • *args
  • **kwargs (any)
Returns (dict)

Multiple bands info in form of {"band1": rio_tile.models.Info}.

method

statistics(bands=None, expression=None, categorical=False, categories=None, percentiles=None, hist_options=None, max_size=1024, **kwargs)

Return array statistics for multiple assets.

Parameters
  • bands (sequence of str or str) bands to fetch info from. Required keyword argument.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • categorical (bool) treat input data as categorical data. Defaults to False.
  • categories (list of numbers, optional) list of categories to return value for.
  • percentiles (list of numbers, optional) list of percentile values to calculate. Defaults to [2, 98].
  • hist_options (dict, optional) Options to forward to numpy.histogram function.
  • max_size (int, optional) Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024.
  • **kwargs (any)
Returns (dict)

Multiple assets statistics in form of {"{band}/{expression}": rio_tiler.models.BandStatistics, ...}.

method

tile(tile_x, tile_y, tile_z, bands=None, expression=None, **kwargs)

Read and merge Web Map tiles multiple bands.

Parameters
  • tile_x (int) Tile's horizontal index.
  • tile_y (int) Tile's vertical index.
  • tile_z (int) Tile's zoom level index.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method

part(bbox, bands=None, expression=None, **kwargs)

Read and merge parts from multiple bands.

Parameters
  • bbox (tuple) Output bounds (left, bottom, right, top) in target crs.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method

preview(bands=None, expression=None, **kwargs)

Read and merge previews from multiple bands.

Parameters
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method

point(lon, lat, bands=None, expression=None, **kwargs)

Read a pixel values from multiple bands.

Parameters
  • lon (float) Longitude.
  • lat (float) Latitude.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (PointData)

PointData

method

feature(shape, bands=None, expression=None, **kwargs)

Read and merge parts defined by geojson feature from multiple bands.

Parameters
  • shape (dict) Valid GeoJSON feature.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

Parse Sceneid and get grid bounds.

MODIS ASTRAEA

class

rio_tiler_pds.modis.aws.modis_astraea.MODISReader(input, tms=<TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, minzoom=4, maxzoom=9, reader=<class 'rio_tiler.io.rasterio.Reader'>, reader_options=NOTHING, bucket='astraea-opendata', prefix_pattern='{product}.{version}/{horizontal_grid}/{vertical_grid}/{date}')

Bases
rio_tiler.io.base.MultiBandReader rio_tiler.io.base.SpatialMixin

AWS Public Dataset MODIS reader.

Parameters
  • tms (TileMatrixSet, optional)
  • input (str)
  • minzoom (int, optional)
  • maxzoom (int, optional)
  • reader_options (dict, optional)
  • reader (type of Reader, optional)
  • bucket (str, optional)
  • prefix_pattern (str, optional)
Attributes
  • bands (tuple) list of available bands (default is defined for each sensor).
  • bounds
  • crs
  • geographic_bounds (float, float, float, float) Return dataset bounds in geographic_crs.
  • input (any) input data.
  • maxzoom (int, optional) Set dataset's maxzoom.
  • minzoom (int, optional) Set dataset's minzoom.
  • reader_options (dict, option) options to forward to the reader. Defaults to {}.
  • scene_params (dict) scene id parameters.
  • tms (morecantile.TileMatrixSet, optional) TileMatrixSet grid definition. Defaults to WebMercatorQuad.
Examples
>>> with MODISReader('MCD43A4.A2017006.h21v11.006.2017018074804') as scene:
        print(scene.bounds)
Methods
  • __attrs_post_init__() Parse Sceneid and get grid bounds.
  • __enter__() Support using with Context Managers.
  • __exit__(exc_type, exc_value, traceback) Support using with Context Managers.
  • feature(shape, bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge parts defined by geojson feature from multiple bands.
  • info(bands, *args, **kwargs) (dict) Return metadata from multiple bands.
  • parse_expression(expression) (tuple) Parse rio-tiler band math expression.
  • part(bbox, bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge parts from multiple bands.
  • point(lon, lat, bands, expression, **kwargs) (PointData) Read a pixel values from multiple bands.
  • preview(bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge previews from multiple bands.
  • statistics(bands, expression, categorical, categories, percentiles, hist_options, max_size, **kwargs) (dict) Return array statistics for multiple assets.
  • tile(tile_x, tile_y, tile_z, bands, expression, **kwargs) (rio_tiler.models.ImageData) Read and merge Web Map tiles multiple bands.
  • tile_exists(tile_x, tile_y, tile_z) (bool) Check if a tile intersects the dataset bounds.
method

tile_exists(tile_x, tile_y, tile_z)

Check if a tile intersects the dataset bounds.

Parameters
  • tile_x (int) Tile's horizontal index.
  • tile_y (int) Tile's vertical index.
  • tile_z (int) Tile's zoom level index.
Returns (bool)

True if the tile intersects the dataset bounds.

method

__enter__()

Support using with Context Managers.

method

__exit__(exc_type, exc_value, traceback)

Support using with Context Managers.

Parameters
  • exc_type
  • exc_value
  • traceback
method

parse_expression(expression) → tuple

Parse rio-tiler band math expression.

Parameters
  • expression (str)
method

info(bands=None, *args, **kwargs)

Return metadata from multiple bands.

Parameters
  • bands (sequence of str or str, optional) band names to fetch info from. Required keyword argument.
  • *args
  • **kwargs (any)
Returns (dict)

Multiple bands info in form of {"band1": rio_tile.models.Info}.

method

statistics(bands=None, expression=None, categorical=False, categories=None, percentiles=None, hist_options=None, max_size=1024, **kwargs)

Return array statistics for multiple assets.

Parameters
  • bands (sequence of str or str) bands to fetch info from. Required keyword argument.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • categorical (bool) treat input data as categorical data. Defaults to False.
  • categories (list of numbers, optional) list of categories to return value for.
  • percentiles (list of numbers, optional) list of percentile values to calculate. Defaults to [2, 98].
  • hist_options (dict, optional) Options to forward to numpy.histogram function.
  • max_size (int, optional) Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024.
  • **kwargs (any)
Returns (dict)

Multiple assets statistics in form of {"{band}/{expression}": rio_tiler.models.BandStatistics, ...}.

method

tile(tile_x, tile_y, tile_z, bands=None, expression=None, **kwargs)

Read and merge Web Map tiles multiple bands.

Parameters
  • tile_x (int) Tile's horizontal index.
  • tile_y (int) Tile's vertical index.
  • tile_z (int) Tile's zoom level index.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method

part(bbox, bands=None, expression=None, **kwargs)

Read and merge parts from multiple bands.

Parameters
  • bbox (tuple) Output bounds (left, bottom, right, top) in target crs.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method

preview(bands=None, expression=None, **kwargs)

Read and merge previews from multiple bands.

Parameters
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method

point(lon, lat, bands=None, expression=None, **kwargs)

Read a pixel values from multiple bands.

Parameters
  • lon (float) Longitude.
  • lat (float) Latitude.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (PointData)

PointData

method

feature(shape, bands=None, expression=None, **kwargs)

Read and merge parts defined by geojson feature from multiple bands.

Parameters
  • shape (dict) Valid GeoJSON feature.
  • bands (sequence of str or str, optional) bands to fetch info from.
  • expression (str, optional) rio-tiler expression for the band list (e.g. b1/b2+b3).
  • **kwargs (any)
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

Parse Sceneid and get grid bounds.

Utils

function

rio_tiler_pds.modis.utils.sceneid_parser(sceneid)

Parse MODIS scene id.

Parameters
  • sceneid (str) Sentinel-2 sceneid.
Returns (dict)

dictionary with metadata constructed from the sceneid.

Raises
  • InvalidMODISSceneId If sceneid doesn't match the regex schema.
Examples
>>> sceneid_parser('MCD43A4.A2017006.h21v11.006.2017018074804')