pystac.extensions.raster#
Implements the Raster Extension.
- class pystac.extensions.raster.AssetRasterExtension(asset: Asset)[source]#
- class pystac.extensions.raster.DataType(value)[source]#
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]#
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]
- classmethod create(count: int, min: float, max: float, buckets: List[int]) 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.
- class pystac.extensions.raster.ItemAssetsRasterExtension(item_asset: AssetDefinition)[source]#
- asset_definition: AssetDefinition#
A reference to the
AssetDefinition
being extended.
- properties: Dict[str, Any]#
The
AssetDefinition
fields, including extension properties.
- class pystac.extensions.raster.NoDataStrings(value)[source]#
An enumeration.
- INF = 'inf'#
- NAN = 'nan'#
- NINF = '-inf'#
- class pystac.extensions.raster.RasterBand(properties: Dict[str, Any])[source]#
Represents a Raster Band information attached to an Item that implements the raster extension.
Use Band.create to create a new Band.
- apply(nodata: float | NoDataStrings | None = None, sampling: Sampling | None = None, data_type: DataType | None = None, bits_per_sample: float | None = None, spatial_resolution: float | None = None, statistics: Statistics | None = None, unit: str | None = None, scale: float | None = None, offset: float | None = None, histogram: Histogram | None = 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: float | None#
Get or sets the actual number of bits used for this band.
- Returns:
float
- classmethod create(nodata: float | NoDataStrings | None = None, sampling: Sampling | None = None, data_type: DataType | None = None, bits_per_sample: float | None = None, spatial_resolution: float | None = None, statistics: Statistics | None = None, unit: str | None = None, scale: float | None = None, offset: float | None = None, histogram: Histogram | None = None) 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: DataType | None#
Get or sets the data type of the band.
- Returns:
Optional[DataType]
- property histogram: Histogram | None#
Get or sets the histogram distribution information of the pixels values in the band.
- Returns:
[Histogram]
- property nodata: float | NoDataStrings | None#
Get or sets the nodata pixel value
- Returns:
Optional[float]
- property offset: float | None#
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]
- property sampling: Sampling | None#
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: float | None#
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: float | None#
Get or sets the average spatial resolution (in meters) of the pixels in the band.
- Returns:
[float]
- property statistics: Statistics | None#
Get or sets the average spatial resolution (in meters) of the pixels in the band.
- Returns:
[Statistics]
- class pystac.extensions.raster.RasterExtension(*args, **kwds)[source]#
An abstract class that can be used to extend the properties of an
Item
,Asset
, orAssetDefinition
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 anItem
). You may prefer to use the ext class method of this class to construct the correct instance type for you.- apply(bands: List[RasterBand]) None [source]#
Applies raster extension properties to the extended
pystac.Item
orpystac.Asset
.- Parameters:
bands – a list of
RasterBand
objects that represent the available raster bands.
- property bands: List[RasterBand] | None#
Gets or sets a list of available bands where each item is a
RasterBand
object (orNone
if no bands have been set). If not available the field should not be provided.
- classmethod ext(obj: T, add_if_missing: bool = False) RasterExtension[T] [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_uris() List[str] [source]#
Gets a list of schema URIs associated with this extension.
- classmethod summaries(obj: Collection, add_if_missing: bool = False) SummariesRasterExtension [source]#
- class pystac.extensions.raster.RasterExtensionHooks[source]#
-
- stac_object_types = {STACObjectType.COLLECTION, STACObjectType.ITEM}#
- class pystac.extensions.raster.Sampling(value)[source]#
An enumeration.
- AREA = 'area'#
- POINT = 'point'#
- class pystac.extensions.raster.Statistics(properties: Dict[str, float | None])[source]#
Represents statistics information attached to a band in the raster extension.
Use Statistics.create to create a new Statistics instance.
- apply(minimum: float | None = None, maximum: float | None = None, mean: float | None = None, stddev: float | None = None, valid_percent: float | None = 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: float | None = None, maximum: float | None = None, mean: float | None = None, stddev: float | None = None, valid_percent: float | None = None) 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]) Statistics [source]#
Constructs an Statistics from a dict.
- Returns:
The Statistics deserialized from the JSON dict.
- Return type:
- property stddev: float | None#
Get or sets the standard deviation pixel value
- Returns:
Optional[float]
- class pystac.extensions.raster.SummariesRasterExtension(collection: Collection)[source]#
A concrete implementation of
SummariesExtension
that extends thesummaries
field of aCollection
to include properties defined in the Raster Extension.- property bands: List[RasterBand] | None#
Get or sets a list of
Band
objects that represent the available bands.
- summaries: Summaries#
The summaries for the
Collection
being extended.