Pydantic Models
Pydantic models for GeoZarr conventions.
Spatial¶
geozarr_toolkit.Spatial ¶
Bases: BaseModel
Spatial convention attributes for a Zarr group or array.
Attributes:
-
dimensions(list[str]) –Names of spatial dimensions, e.g., ["Y", "X"] for 2D or ["Z", "Y", "X"] for 3D. Required field.
-
bbox(list[float] | None) –Bounding box in coordinate space. For 2D: [xmin, ymin, xmax, ymax]. For 3D: [xmin, ymin, zmin, xmax, ymax, zmax].
-
transform_type(str) –Type of transformation. Currently only "affine" is defined. Default: "affine".
-
transform(list[float] | None) –Affine transformation coefficients [a, b, c, d, e, f] mapping array indices to coordinates: x = ai + bj + c, y = di + ej + f. Uses Rasterio/Affine library ordering.
-
shape(list[int] | None) –Shape of spatial dimensions [height, width] for 2D or [depth, height, width] for 3D.
-
registration(str) –Grid cell registration. "pixel" (default, PixelIsArea) means cell boundaries align with coordinates. "node" (PixelIsPoint) means cell centers align.
geozarr_toolkit.SpatialConventionMetadata ¶
Proj Convention¶
geozarr_toolkit.Proj ¶
Bases: BaseModel
Proj convention attributes for a Zarr group or array.
At least one of code, wkt2, or projjson must be provided.
Attributes:
geozarr_toolkit.ProjConventionMetadata ¶
Multiscales Convention¶
geozarr_toolkit.Multiscales ¶
Bases: BaseModel
Multiscales convention attributes for a Zarr group.
Note: This convention applies to groups only, not arrays.
Attributes:
-
layout(tuple[ScaleLevel, ...]) –Array of scale level objects, each representing a resolution level in the pyramid.
-
resampling_method(str | MISSING) –Default resampling method applied to all levels, e.g., "average". Can be overridden per-level.
validate_layout_not_empty
classmethod
¶
validate_layout_not_empty(
value: tuple[ScaleLevel, ...],
) -> tuple[ScaleLevel, ...]
Validate that layout has at least one level.
geozarr_toolkit.MultiscalesConventionMetadata ¶
geozarr_toolkit.ScaleLevel ¶
Bases: BaseModel
A single level in the multiscale pyramid.
Attributes:
-
asset(str) –Path to the Zarr group/array for this level, e.g., "0", "level1", or "0/data" for nested structures. Relative paths only.
-
derived_from(str | MISSING) –Path to the source level used to generate this level.
-
transform(Transform | MISSING) –Transformation from this level to the source level. Required if derived_from is specified.
-
resampling_method(str | MISSING) –Resampling method used for this level, e.g., "average", "nearest". Overrides the default resampling_method if specified.
geozarr_toolkit.Transform ¶
Bases: BaseModel
Transformation between resolution levels.
Describes the coordinate transformation from a derived level back to its source level during resampling.
Attributes:
-
scale(tuple[float, ...] | MISSING) –Scale factors per axis. Values > 1 indicate downsampling, values < 1 indicate upsampling.
-
translation(tuple[float, ...] | MISSING) –Translation offsets per axis in coordinate space.