Skip to content

CBERS

Readers

class

rio_tiler_pds.cbers.aws.cbers4.CBERSReader(input, tms=<TileMatrixSet title='Google Maps Compatible for the World' id='WebMercatorQuad' crs='http://www.opengis.net/def/crs/EPSG/0/3857>, minzoom=None, maxzoom=None, reader=<class 'rio_tiler.io.rasterio.Reader'>, reader_options=NOTHING, bucket='cbers-pds', prefix_pattern='CBERS{mission}/{instrument}/{path}/{row}/{scene}')

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

AWS Public Dataset CBERS 4 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 CBERSReader('CBERS_4_AWFI_20170420_146_129_L2') as scene:
        print(scene.bounds)
Methods
  • __attrs_post_init__() Fetch Reference band to get the 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.

Fetch Reference band to get the bounds.

Utils

function

rio_tiler_pds.cbers.utils.sceneid_parser(sceneid)

Parse CBERS 4/4A scene id.

Parameters
  • sceneid (str) CBERS 4/4A sceneid.
Returns (dict)

dictionary with metadata constructed from the sceneid.

Raises
  • InvalidCBERSSceneId If sceneid doesn't match the regex schema.
Examples
>>> sceneid_parser('CBERS_4_MUX_20171121_057_094_L2')