Rasters

The classes and methods defined by vibe_core.data.rasters module handle raster data related to remote sensing products and other geospatial data types. The base class in the module is Raster, which provides properties and methods for working with raster data, such as accessing raster and visualization assets. The module also includes specialized classes for different derived types, such as DemRaster, NaipRaster, LandsatRaster, and GNATSGORaster, which inherit from both the Raster class and their respective product metadata classes from vibe_core.data.products.

Additionally, the module provides classes for handling raster sequences (RasterSequence), raster chunks (RasterChunk), categorical rasters (CategoricalRaster), among others.

Hierarchy

classDiagram class BaseVibe { } class DataSequence { } class DataVibe { } class DemProduct { } class GNATSGOProduct { } class LandsatProduct { } class NaipProduct { } class CategoricalRaster { } class CloudRaster { } class DemRaster { } class GNATSGORaster { } class LandsatRaster { } class ModisRaster { } class NaipRaster { } class Raster { } class RasterChunk { } class RasterIlluminance { } class RasterSequence { } DataSequence --|> DataVibe DataVibe --|> BaseVibe DemProduct --|> DataVibe GNATSGOProduct --|> DataVibe LandsatProduct --|> DataVibe NaipProduct --|> DataVibe CategoricalRaster --|> Raster CloudRaster --|> Raster DemRaster --|> DemProduct DemRaster --|> Raster GNATSGORaster --|> GNATSGOProduct GNATSGORaster --|> Raster LandsatRaster --|> LandsatProduct LandsatRaster --|> Raster ModisRaster --|> Raster NaipRaster --|> NaipProduct NaipRaster --|> Raster Raster --|> DataVibe RasterChunk --|> Raster RasterIlluminance --|> DataVibe RasterSequence --|> DataSequence RasterSequence --|> Raster

Documentation

class vibe_core.data.rasters.CategoricalRaster(id, time_range, geometry, assets, bands, categories)

Bases: Raster

Represents a categorical raster.

categories: List[str]

The list of categories in the raster.

class vibe_core.data.rasters.CloudRaster(id, time_range, geometry, assets)

Bases: Raster

Represents a cloud raster.

bands: Dict[str, int]

A dictionary with the name of each band and its index in the raster data.

class vibe_core.data.rasters.DemRaster(id, time_range, geometry, assets, tile_id, resolution, provider, bands)

Bases: Raster, DemProduct

Represents a DEM raster.

bands: Dict[str, int]

A dictionary with the name of each band and its index in the raster data.

class vibe_core.data.rasters.GNATSGORaster(id, time_range, geometry, assets, bands, variable)

Bases: Raster, GNATSGOProduct

Represents a gNATSGO raster of a specific variable.

variable: str

The variable represented in the raster.

class vibe_core.data.rasters.LandsatRaster(id, time_range, geometry, assets, bands, tile_id='', asset_map=<factory>)

Bases: LandsatProduct, Raster

Represents a Landsat raster.

asset_map: Dict[str, str]

A dictionary mapping band names to asset IDs.

assets: List[AssetVibe]

A list of AssetVibe objects of the assets associated with the data object.

bbox: BBox

A BBox representing the bounding box of the data object. This field is calculated from the geometry property using the shapely.geometry library.

geometry: Dict[str, Any]

A dictionary representing the geometry of the data object.

id: str

A string representing the unique identifier of the data object.

time_range: TimeRange

A TimeRange representing the timestamps of to the beginning and end of sample.

class vibe_core.data.rasters.ModisRaster(id, time_range, geometry, assets, bands)

Bases: Raster

Represents a MODIS raster.

bands: Dict[str, int]

A dictionary with the name of each band and its index in the raster data.

class vibe_core.data.rasters.NaipRaster(id, time_range, geometry, assets, tile_id, year, resolution, bands)

Bases: Raster, NaipProduct

Represents a NAIP raster.

bands: Dict[str, int]

A dictionary with the name of each band and its index in the raster data.

class vibe_core.data.rasters.Raster(id, time_range, geometry, assets, bands)

Bases: DataVibe

Represents raster data in FarmVibes.AI.

bands: Dict[str, int]

A dictionary with the name of each band and its index in the raster data.

property raster_asset: AssetVibe

Returns the raster asset from the list of assets.

Raises:

ValueError – If the raster asset cannot be found in the asset list.

Returns:

The raster asset from the asset list.

property visualization_asset: AssetVibe

Returns the visualization asset from the asset list.

Raises:

ValueError – If the visualization asset cannot be found in the asset list.

Returns:

The visualization asset from the asset list.

class vibe_core.data.rasters.RasterChunk(id, time_range, geometry, assets, bands, chunk_pos, num_chunks, limits, write_rel_limits)

Bases: Raster

Represents a chunk of a raster.

chunk_pos: Tuple[int, int]

The position of the chunk in the raster data, as a tuple of (column, row) indices.

limits: Tuple[int, int, int, int]

The limits of the chunk in the raster data, as a ChunkLimits object. These are indices, not coordinates.

num_chunks: Tuple[int, int]

The total number of chunks in the raster data, as a tuple of (number of columns, number of rows).

write_rel_limits: Tuple[int, int, int, int]

The relative limits of the chunk in the raster data asset. These are non-overlapping indices that are used to write the chunk to the asset.

class vibe_core.data.rasters.RasterIlluminance(id, time_range, geometry, assets, illuminance)

Bases: DataVibe

Represents illuminance values for bands of a raster.

illuminance: List[float]

The list of illuminance values for each band.

class vibe_core.data.rasters.RasterSequence(id, time_range, geometry, assets, bands, asset_order=<factory>, asset_time_range=<factory>, asset_geometry=<factory>)

Bases: DataSequence, Raster

Represents a sequence of rasters

add_item(item)

Adds a raster to the sequence

Parameters:

item (Raster) – The raster to add to the sequence

asset_geometry: Dict[str, BaseGeometry]

A dictionary mapping asset IDs to their geometry.

asset_order: Dict[str, int]

A dictionary mapping asset IDs to their order in the sequence.

asset_time_range: Dict[str, Tuple[datetime, datetime]]

A dictionary mapping asset IDs to their time range.

assets: List[AssetVibe]

A list of AssetVibe objects of the assets associated with the data object.

bbox: BBox

A BBox representing the bounding box of the data object. This field is calculated from the geometry property using the shapely.geometry library.

geometry: Dict[str, Any]

A dictionary representing the geometry of the data object.

id: str

A string representing the unique identifier of the data object.

idx: int

Number of data objects in the sequence.

time_range: TimeRange

A TimeRange representing the timestamps of to the beginning and end of sample.

vibe_core.data.rasters.ChunkLimits

Type alias for chunk limits. Tuple of col_offset, row_offset, width, height.

alias of Tuple[int, int, int, int]