rasteret.types¶
Data types and dataclasses used across Rasteret.
types
¶
Classes¶
CogMetadata
dataclass
¶
CogMetadata(
width: int,
height: int,
tile_width: int,
tile_height: int,
dtype: dtype | DataType,
crs: int | None,
predictor: int | None = None,
transform: list[float] | None = None,
compression: int | None = None,
tile_offsets: list[int] | None = None,
tile_byte_counts: list[int] | None = None,
pixel_scale: tuple[float, ...] | None = None,
tiepoint: tuple[float, ...] | None = None,
nodata: float | int | None = None,
samples_per_pixel: int = 1,
planar_configuration: int = 1,
photometric: int | None = None,
extra_samples: tuple[int, ...] | None = None,
)
Metadata for a tiled GeoTIFF (including COGs).
New fields added for correctness (nodata, samples_per_pixel, planar_configuration, photometric, extra_samples) have defaults so existing Parquet files missing them load without error.
Functions¶
from_dict
classmethod
¶
from_dict(
raw: dict[str, Any],
*,
crs: int | None = None,
transform_override: list[float] | None = None,
) -> CogMetadata
Build from a raw metadata dict (as stored in the Parquet table).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw
|
dict
|
The |
required |
crs
|
int
|
EPSG code to use (overrides any value in raw). |
None
|
transform_override
|
list[float]
|
Pre-normalized transform. When |
None
|
Source code in src/rasteret/types.py
RasterInfo
dataclass
¶
RasterInfo(
id: str,
datetime: datetime,
bbox: list[float],
footprint: Any,
crs: int | None,
cloud_cover: float,
assets: dict[str, Any],
band_metadata: dict[str, Any],
collection: str,
)
Metadata for a single raster record (Parquet row).
Each row in a Rasteret Collection Parquet becomes a RasterInfo
that is then used to construct a :class:~rasteret.core.raster_accessor.RasterAccessor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
Unique record identifier. |
required |
datetime
|
datetime
|
Acquisition / observation time. |
required |
bbox
|
list of float
|
Bounding box |
required |
footprint
|
object
|
Footprint geometry (Shapely Polygon or WKB bytes). |
required |
crs
|
int or None
|
EPSG code for the record's native CRS. |
required |
cloud_cover
|
float
|
Cloud cover percentage (0--100). |
required |
assets
|
dict
|
Mapping of band code to asset dict (href, raster:bands, etc.). |
required |
band_metadata
|
dict
|
Per-band COG metadata dicts keyed by |
required |
collection
|
str
|
Parent collection identifier. |
required |