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 { } class SamMaskRaster { } 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 SamMaskRaster --|> CategoricalRaster

Documentation

Data types, constants, and supporting functions for manipulating rasters in FarmVibes.AI.

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

Bases: Raster

Represent 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

Represent 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

Represent a DEM raster.

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

Bases: Raster, GNATSGOProduct

Represent 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

Represent a Landsat raster.

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

Bases: Raster

Represent a MODIS raster.

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

Bases: Raster, NaipProduct

Represent a NAIP raster.

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

Bases: DataVibe

Represent 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

Return the raster asset from the list of assets.

Returns:

The raster asset from the asset list.

Raises:

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

property visualization_asset: AssetVibe

Return the visualization asset from the asset list.

Returns:

The visualization asset from the asset list.

Raises:

ValueError – If the visualization asset cannot be found in 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

Represent 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

Represent 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

Represent a sequence of rasters.

add_item(item)

Add a raster to the sequence.

Parameters:

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

class vibe_core.data.rasters.SamMaskRaster(id, time_range, geometry, assets, bands, categories, mask_score, mask_bbox, chip_window)

Bases: CategoricalRaster

Represent a raster with Segment Anything Model (SAM) masks.

Each asset in the raster contains a mask obtained with SAM.

chip_window: ChipWindow

The chip window (col_offset, row_offset, width, height) covered by this raster.

mask_bbox: List[Tuple[float, float, float, float]]

The list of bounding boxes for each mask in the assets.

mask_score: List[float]

The list of SAM quality scores for each mask in the assets.

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]