pystac.extensions.raster#

Implements the Raster Extension.

class pystac.extensions.raster.DataType(value)[source]#

Bases: pystac.utils.StringEnum

An enumeration.

CFLOAT32 = 'cfloat32'#
CFLOAT64 = 'cfloat64'#
CINT16 = 'cint16'#
CINT32 = 'cint32'#
FLOAT16 = 'float16'#
FLOAT32 = 'float32'#
FLOAT64 = 'float64'#
INT16 = 'int16'#
INT32 = 'int32'#
INT64 = 'int64'#
INT8 = 'int8'#
OTHER = 'other'#
UINT16 = 'uint16'#
UINT32 = 'uint32'#
UINT64 = 'uint64'#
UINT8 = 'uint8'#
class pystac.extensions.raster.Histogram(properties: Dict[str, Any])[source]#

Bases: object

Represents pixel distribution information attached to a band in the raster extension.

Use Band.create to create a new Band.

apply(count: int, min: float, max: float, buckets: List[int]) None[source]#

Sets the properties for this raster Band.

Parameters
  • count – number of buckets of the distribution.

  • min – minimum value of the distribution. Also the mean value of the first bucket.

  • max – maximum value of the distribution. Also the mean value of the last bucket.

  • buckets – Array of integer indicating the number of pixels included in the bucket.

property buckets: List[int]#

Get or sets the Array of integer indicating the number of pixels included in the bucket.

Returns

List[int]

property count: int#

Get or sets the number of buckets of the distribution.

Returns

int

classmethod create(count: int, min: float, max: float, buckets: List[int]) pystac.extensions.raster.Histogram[source]#

Creates a new band.

Parameters
  • count – number of buckets of the distribution.

  • min – minimum value of the distribution. Also the mean value of the first bucket.

  • max – maximum value of the distribution. Also the mean value of the last bucket.

  • buckets – Array of integer indicating the number of pixels included in the bucket.

static from_dict(d: Dict[str, Any]) pystac.extensions.raster.Histogram[source]#

Constructs an Histogram from a dict.

Returns

The Histogram deserialized from the JSON dict.

Return type

Histogram

property max: float#

Get or sets the maximum value of the distribution.

Returns

float

property min: float#

Get or sets the minimum value of the distribution.

Returns

float

properties: Dict[str, Any]#
to_dict() Dict[str, Any][source]#

Returns the dictionary representing the JSON of this histogram.

Returns

The wrapped dict of the Histogram that can be written out as JSON.

Return type

dict

class pystac.extensions.raster.NoDataStrings(value)[source]#

Bases: pystac.utils.StringEnum

An enumeration.

INF = 'inf'#
NAN = 'nan'#
NINF = '-inf'#
class pystac.extensions.raster.RasterBand(properties: Dict[str, Any])[source]#

Bases: object

Represents a Raster Band information attached to an Item that implements the raster extension.

Use Band.create to create a new Band.

apply(nodata: Optional[Union[float, pystac.extensions.raster.NoDataStrings]] = None, sampling: Optional[pystac.extensions.raster.Sampling] = None, data_type: Optional[pystac.extensions.raster.DataType] = None, bits_per_sample: Optional[float] = None, spatial_resolution: Optional[float] = None, statistics: Optional[pystac.extensions.raster.Statistics] = None, unit: Optional[str] = None, scale: Optional[float] = None, offset: Optional[float] = None, histogram: Optional[pystac.extensions.raster.Histogram] = None) None[source]#

Sets the properties for this raster Band.

Parameters
  • nodata – Pixel values used to identify pixels that are nodata in the assets.

  • sampling – One of area or point. Indicates whether a pixel value should be assumed to represent a sampling over the region of the pixel or a point sample at the center of the pixel.

  • data_type – The data type of the band. One of the data types as described in the Raster Data Types <raster/#data-types> docs extension.

  • bits_per_sample – The actual number of bits used for this band. Normally only present when the number of bits is non-standard for the datatype, such as when a 1 bit TIFF is represented as byte

  • spatial_resolution – Average spatial resolution (in meters) of the pixels in the band.

  • statistics – Statistics of all the pixels in the band

  • unit – unit denomination of the pixel value

  • scale – multiplicator factor of the pixel value to transform into the value (i.e. translate digital number to reflectance).

  • offset – number to be added to the pixel value (after scaling) to transform into the value (i.e. translate digital number to reflectance).

  • histogram – Histogram distribution information of the pixels values in the band

property bits_per_sample: Optional[float]#

Get or sets the actual number of bits used for this band.

Returns

float

classmethod create(nodata: Optional[Union[float, pystac.extensions.raster.NoDataStrings]] = None, sampling: Optional[pystac.extensions.raster.Sampling] = None, data_type: Optional[pystac.extensions.raster.DataType] = None, bits_per_sample: Optional[float] = None, spatial_resolution: Optional[float] = None, statistics: Optional[pystac.extensions.raster.Statistics] = None, unit: Optional[str] = None, scale: Optional[float] = None, offset: Optional[float] = None, histogram: Optional[pystac.extensions.raster.Histogram] = None) pystac.extensions.raster.RasterBand[source]#

Creates a new band.

Parameters
  • nodata – Pixel values used to identify pixels that are nodata in the assets.

  • sampling – One of area or point. Indicates whether a pixel value should be assumed to represent a sampling over the region of the pixel or a point sample at the center of the pixel.

  • data_type – The data type of the band. One of the data types as described in the Raster Data Types <raster/#data-types> docs extension.

  • bits_per_sample – The actual number of bits used for this band. Normally only present when the number of bits is non-standard for the datatype, such as when a 1 bit TIFF is represented as byte

  • spatial_resolution – Average spatial resolution (in meters) of the pixels in the band.

  • statistics – Statistics of all the pixels in the band

  • unit – unit denomination of the pixel value

  • scale – multiplicator factor of the pixel value to transform into the value (i.e. translate digital number to reflectance).

  • offset – number to be added to the pixel value (after scaling) to transform into the value (i.e. translate digital number to reflectance).

  • histogram – Histogram distribution information of the pixels values in the band

property data_type: Optional[pystac.extensions.raster.DataType]#

Get or sets the data type of the band.

Returns

Optional[DataType]

property histogram: Optional[pystac.extensions.raster.Histogram]#

Get or sets the histogram distribution information of the pixels values in the band

Returns

[Histogram]

property nodata: Optional[Union[float, pystac.extensions.raster.NoDataStrings]]#

Get or sets the nodata pixel value

Returns

Optional[float]

property offset: Optional[float]#

Get or sets the number to be added to the pixel value (after scaling) to transform into the value (i.e. translate digital number to reflectance).

Returns

[float]

properties: Dict[str, Any]#
property sampling: Optional[pystac.extensions.raster.Sampling]#

Get or sets the property indicating whether a pixel value should be assumed to represent a sampling over the region of the pixel or a point sample at the center of the pixel.

Returns

Optional[Sampling]

property scale: Optional[float]#

Get or sets the multiplicator factor of the pixel value to transform into the value (i.e. translate digital number to reflectance).

Returns

[float]

property spatial_resolution: Optional[float]#

Get or sets the average spatial resolution (in meters) of the pixels in the band.

Returns

[float]

property statistics: Optional[pystac.extensions.raster.Statistics]#

Get or sets the average spatial resolution (in meters) of the pixels in the band.

Returns

[Statistics]

to_dict() Dict[str, Any][source]#

Returns the dictionary representing the JSON of this Band.

Returns

The wrapped dict of the Band that can be written out as JSON.

Return type

dict

property unit: Optional[str]#

Get or sets the unit denomination of the pixel value

Returns

[str]

class pystac.extensions.raster.RasterExtension(asset: pystac.asset.Asset)[source]#

Bases: pystac.extensions.base.PropertiesExtension, pystac.extensions.base.ExtensionManagementMixin[Union[pystac.collection.Collection, pystac.item.Item]]

An abstract class that can be used to extend the properties of an Item or Asset with properties from the Raster Extension. This class is generic over the type of STAC Object to be extended (e.g. Item, Asset).

This class will generally not be used directly. Instead, use the concrete implementation associated with the STAC Object you want to extend (e.g. ItemRasterExtension to extend an Item).

additional_read_properties: Optional[Iterable[Dict[str, Any]]] = None#

If present, this will be a list containing 1 dictionary representing the properties of the owning Item.

apply(bands: List[pystac.extensions.raster.RasterBand]) None[source]#

Applies raster extension properties to the extended pystac.Item or pystac.Asset.

Parameters

bands – a list of RasterBand objects that represent the available raster bands.

asset_href: str#

The href value of the Asset being extended.

property bands: Optional[List[pystac.extensions.raster.RasterBand]]#

Gets or sets a list of available bands where each item is a RasterBand object (or None if no bands have been set). If not available the field should not be provided.

classmethod ext(obj: pystac.asset.Asset, add_if_missing: bool = False) pystac.extensions.raster.RasterExtension[source]#

Extends the given STAC Object with properties from the Raster Extension.

This extension can be applied to instances of Asset.

Raises

pystac.ExtensionTypeError – If an invalid object type is passed.

classmethod get_schema_uri() str[source]#

Gets the schema URI associated with this extension.

properties: Dict[str, Any]#

The Asset fields, including extension properties.

classmethod summaries(obj: pystac.collection.Collection, add_if_missing: bool = False) pystac.extensions.raster.SummariesRasterExtension[source]#
class pystac.extensions.raster.Sampling(value)[source]#

Bases: pystac.utils.StringEnum

An enumeration.

AREA = 'area'#
POINT = 'point'#
class pystac.extensions.raster.Statistics(properties: Dict[str, Optional[float]])[source]#

Bases: object

Represents statistics information attached to a band in the raster extension.

Use Statistics.create to create a new Statistics instance.

apply(minimum: Optional[float] = None, maximum: Optional[float] = None, mean: Optional[float] = None, stddev: Optional[float] = None, valid_percent: Optional[float] = None) None[source]#

Sets the properties for this raster Band.

Parameters
  • minimum – Minimum value of all the pixels in the band.

  • maximum – Maximum value of all the pixels in the band.

  • mean – Mean value of all the pixels in the band.

  • stddev – Standard Deviation value of all the pixels in the band.

  • valid_percent – Percentage of valid (not nodata) pixel.

classmethod create(minimum: Optional[float] = None, maximum: Optional[float] = None, mean: Optional[float] = None, stddev: Optional[float] = None, valid_percent: Optional[float] = None) pystac.extensions.raster.Statistics[source]#

Creates a new band.

Parameters
  • minimum – Minimum value of all the pixels in the band.

  • maximum – Maximum value of all the pixels in the band.

  • mean – Mean value of all the pixels in the band.

  • stddev – Standard Deviation value of all the pixels in the band.

  • valid_percent – Percentage of valid (not nodata) pixel.

static from_dict(d: Dict[str, Any]) pystac.extensions.raster.Statistics[source]#

Constructs an Statistics from a dict.

Returns

The Statistics deserialized from the JSON dict.

Return type

Statistics

property maximum: Optional[float]#

Get or sets the maximum pixel value

Returns

Optional[float]

property mean: Optional[float]#

Get or sets the mean pixel value

Returns

Optional[float]

property minimum: Optional[float]#

Get or sets the minimum pixel value

Returns

Optional[float]

properties: Dict[str, Any]#
property stddev: Optional[float]#

Get or sets the standard deviation pixel value

Returns

Optional[float]

to_dict() Dict[str, Any][source]#

Returns the dictionary representing the JSON of those Statistics.

Returns

The wrapped dict of the Statistics that can be written out as JSON.

Return type

dict

property valid_percent: Optional[float]#

Get or sets the Percentage of valid (not nodata) pixel

Returns

Optional[float]

class pystac.extensions.raster.SummariesRasterExtension(collection: pystac.collection.Collection)[source]#

Bases: pystac.extensions.base.SummariesExtension

A concrete implementation of SummariesExtension that extends the summaries field of a Collection to include properties defined in the Raster Extension.

property bands: Optional[List[pystac.extensions.raster.RasterBand]]#

Get or sets a list of Band objects that represent the available bands.

summaries: pystac.summaries.Summaries#

The summaries for the Collection being extended.