Skip to content

Readers

module

rio_tiler_pds.sentinel.aws.sentinel1

AWS Sentinel 1 reader.

Classes
  • S1L1CReader AWS Public Dataset Sentinel 1 reader.
Functions
  • get_bounds(geom) (float, float, float, float) Get Bounds from GeoJSON geometry and handle multi polygon crossing the antimeridian line.
function

rio_tiler_pds.sentinel.aws.sentinel1.get_bounds(geom) → (float, float, float, float)

Get Bounds from GeoJSON geometry and handle multi polygon crossing the antimeridian line.

ref: cogeotiff/rio-tiler-pds#77

Parameters
  • geom (dict)
class

rio_tiler_pds.sentinel.aws.sentinel1.S1L1CReader(input, tms=<TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, minzoom=8, maxzoom=14, reader=<class 'rio_tiler.io.rasterio.Reader'>, reader_options=NOTHING, bucket='sentinel-s1-l1c', prefix_pattern='{product}/{acquisitionYear}/{_month}/{_day}/{beam}/{polarisation}/{scene}')

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

AWS Public Dataset Sentinel 1 reader.

Parameters
  • input (str) Sentinel-1 sceneid.
  • tms (TileMatrixSet, optional)
  • minzoom (int, optional)
  • maxzoom (int, optional)
  • reader (type of Reader, optional)
  • reader_options (dict, optional)
  • bucket (str, optional)
  • prefix_pattern (str, optional)
Attributes
  • bands (tuple) list of available bands (default is ('vv', 'vh')).
  • bounds
  • crs
  • datageom (dict) sentinel 1 data geometry.
  • geographic_bounds (float, float, float, float) Return dataset bounds in geographic_crs.
  • maxzoom (int) Dataset's Max Zoom level (default is 14).
  • minzoom (int) Dataset's Min Zoom level (default is 8).
  • productInfo (dict) sentinel 1 productInfo.json content.
  • scene_params
Examples
>>> with S1L1CReader('S1A_IW_GRDH_1SDV_20180716T004042_20180716T004107_022812_02792A_FD5B') as scene:
        print(scene.bounds)
Methods
  • __attrs_post_init__() Fetch productInfo and get 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)
  • kwargs (optional) Options to forward to the self.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.tile method.
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)
  • kwargs (optional) Options to forward to the 'self.reader.part' method.
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)
  • kwargs (optional) Options to forward to the self.reader.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.point method.
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)
  • kwargs (optional) Options to forward to the self.reader.feature method.
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method
__attrs_post_init__()

Fetch productInfo and get bounds.

module

rio_tiler_pds.sentinel.aws.sentinel2

AWS Sentinel 2 readers.

Attributes
  • SENTINEL_L2_BANDS
  • SENTINEL_L2_PRODUCTS
  • default_l1c_bands
  • default_l2a_bands
  • sentinel_l2a_band_map
Classes
  • S2L1CReader AWS Public Dataset Sentinel 2 L1C reader.
  • S2L2AReader AWS Public Dataset Sentinel 2 L2A reader.
  • S2L2ACOGReader AWS Public Dataset Sentinel 2 L2A COGS reader.
Functions
  • S2COGReader(sceneid, **kwargs) (S2L2ACOGReader) Sentinel-2 COG readers.
  • S2JP2Reader(sceneid, **kwargs) (S2L2AReader or S2L1CReader) Sentinel-2 JPEG2000 readers.
class

rio_tiler_pds.sentinel.aws.sentinel2.S2L1CReader(input, tms=<TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, minzoom=8, maxzoom=14, reader=<class 'rio_tiler.io.rasterio.Reader'>, reader_options={'options': {'nodata': 0}}, bucket='sentinel-s2-l1c', prefix_pattern='tiles/{_utm}/{lat}/{sq}/{acquisitionYear}/{_month}/{_day}/{num}')

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

AWS Public Dataset Sentinel 2 L1C reader.

Parameters
  • input (str) Sentinel-2 L1C sceneid.
  • tms (TileMatrixSet, optional)
  • minzoom (int, optional)
  • maxzoom (int, optional)
  • reader (type of Reader, optional)
  • reader_options (dict, optional)
  • bucket (str, optional)
  • prefix_pattern (str, optional)
Attributes
  • bands (tuple) list of available bands (default is ('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B09', 'B11', 'B12', 'B8A')).
  • bounds
  • crs
  • datageom (dict) sentinel 2 data geometry.
  • geographic_bounds (float, float, float, float) Return dataset bounds in geographic_crs.
  • maxzoom (int) Dataset's Max Zoom level (default is 14).
  • minzoom (int) Dataset's Min Zoom level (default is 8).
  • scene_params (dict) scene id parameters.
  • tileInfo (dict) sentinel 2 tileInfo.json content.
Examples
>>> with S2L1CReader('S2A_L1C_20170729_19UDP_0') as scene:
        print(scene.bounds)
Methods
  • __attrs_post_init__() Fetch productInfo and get 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)
  • kwargs (optional) Options to forward to the self.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.tile method.
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)
  • kwargs (optional) Options to forward to the 'self.reader.part' method.
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)
  • kwargs (optional) Options to forward to the self.reader.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.point method.
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)
  • kwargs (optional) Options to forward to the self.reader.feature method.
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method
__attrs_post_init__()

Fetch productInfo and get bounds.

class

rio_tiler_pds.sentinel.aws.sentinel2.S2L2AReader(input, tms=<TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, minzoom=8, maxzoom=14, reader=<class 'rio_tiler.io.rasterio.Reader'>, reader_options={'options': {'nodata': 0}}, bucket='sentinel-s2-l2a', prefix_pattern='tiles/{_utm}/{lat}/{sq}/{acquisitionYear}/{_month}/{_day}/{num}')

Bases
rio_tiler_pds.sentinel.aws.sentinel2.S2L1CReader rio_tiler.io.base.MultiBandReader rio_tiler.io.base.SpatialMixin

AWS Public Dataset Sentinel 2 L2A reader.

Parameters
  • input (str) Sentinel-2 L2A sceneid.
  • tms (TileMatrixSet, optional)
  • minzoom (int, optional)
  • maxzoom (int, optional)
  • reader (type of Reader, optional)
  • reader_options (dict, optional)
  • bucket (str, optional)
  • prefix_pattern (str, optional)
Attributes
  • bands (tuple) list of available bands (default is ('B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B09', 'B11', 'B12', 'B8A')).
  • geographic_bounds (float, float, float, float) Return dataset bounds in geographic_crs.
Examples
>>> with S2L1CReader('S2A_L1C_20170729_19UDP_0') as scene:
        print(scene.bounds)
Methods
  • __attrs_post_init__() Fetch productInfo and get 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)
  • kwargs (optional) Options to forward to the self.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.tile method.
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)
  • kwargs (optional) Options to forward to the 'self.reader.part' method.
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)
  • kwargs (optional) Options to forward to the self.reader.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.point method.
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)
  • kwargs (optional) Options to forward to the self.reader.feature method.
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method
__attrs_post_init__()

Fetch productInfo and get bounds.

class

rio_tiler_pds.sentinel.aws.sentinel2.S2L2ACOGReader(input, tms=<TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, minzoom=8, maxzoom=14, reader=<class 'rio_tiler.io.rasterio.Reader'>, reader_options=NOTHING, bucket='sentinel-cogs', prefix_pattern='sentinel-s2-{_levelLow}-cogs/{_utm}/{lat}/{sq}/{acquisitionYear}/{_month}/S{sensor}{satellite}_{_utm}{lat}{sq}_{acquisitionYear}{acquisitionMonth}{acquisitionDay}_{num}_{processingLevel}')

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

AWS Public Dataset Sentinel 2 L2A COGS reader.

Parameters
  • input (str) Sentinel-2 sceneid.
  • tms (TileMatrixSet, optional)
  • minzoom (int, optional)
  • maxzoom (int, optional)
  • reader (type of Reader, optional)
  • reader_options (dict, optional)
  • bucket (str, optional)
  • prefix_pattern (str, optional)
Attributes
  • bands (tuple) list of available bands (defined by the STAC item.json).
  • bounds
  • crs
  • geographic_bounds (float, float, float, float) Return dataset bounds in geographic_crs.
  • maxzoom (int) Dataset's Max Zoom level (default is 14).
  • minzoom (int) Dataset's Min Zoom level (default is 8).
  • scene_params (dict) scene id parameters.
  • stac_item (dict) sentinel 2 COG STAC item content.
Examples
>>> with S2L2ACOGReader('S2A_29RKH_20200219_0_L2A') as scene:
        print(scene.bounds)
Methods
  • __attrs_post_init__() Fetch item.json and get bounds and bands.
  • __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)
  • kwargs (optional) Options to forward to the self.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.tile method.
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)
  • kwargs (optional) Options to forward to the 'self.reader.part' method.
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)
  • kwargs (optional) Options to forward to the self.reader.preview method.
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)
  • kwargs (optional) Options to forward to the self.reader.point method.
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)
  • kwargs (optional) Options to forward to the self.reader.feature method.
Returns (rio_tiler.models.ImageData)

ImageData instance with data, mask and tile spatial info.

method
__attrs_post_init__()

Fetch item.json and get bounds and bands.

function

rio_tiler_pds.sentinel.aws.sentinel2.S2COGReader(sceneid, **kwargs) → S2L2ACOGReader

Sentinel-2 COG readers.

Parameters
  • sceneid (str)
  • **kwargs (any)
function

rio_tiler_pds.sentinel.aws.sentinel2.S2JP2Reader(sceneid, **kwargs) → S2L2AReader or S2L1CReader

Sentinel-2 JPEG2000 readers.

Parameters
  • sceneid (str)
  • **kwargs (any)

Utils

function

rio_tiler_pds.sentinel.utils.s2_sceneid_parser(sceneid)

Parse Sentinel 2 scene id.

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

dictionary with metadata constructed from the sceneid.

Raises
  • InvalidSentinelSceneId If sceneid doesn't match the regex schema.
Examples
>>> s2_sceneid_parser('S2A_L1C_20170729_19UDP_0')
>>> s2_sceneid_parser('S2A_L2A_20170729_19UDP_0')
>>> s2_sceneid_parser('S2A_29RKH_20200219_0_L2A')
>>> s2_sceneid_parse('S2B_MSIL2A_20190730T190919_N0212_R056_T10UEU_20201005T200819')
function

rio_tiler_pds.sentinel.utils.s1_sceneid_parser(sceneid)

Parse Sentinel 1 scene id.

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

dictionary with metadata constructed from the sceneid.

Raises
  • InvalidSentinelSceneId If sceneid doesn't match the regex schema.
Examples
>>> s1_sceneid_parser('S1A_IW_GRDH_1SDV_20180716T004042_20180716T004107_022812_02792A_FD5B')