Skip to content

geozarr-toolkit

Python library for creating and validating GeoZarr-compliant metadata. Provides Pydantic models, helper functions, and a CLI for the modular Zarr conventions:

  • spatial: -- Coordinate transforms between array indices and spatial coordinates
  • proj: -- Coordinate Reference System (CRS) via EPSG codes, WKT2, or PROJJSON
  • multiscales -- Pyramid structures and resolution levels

Quick example

Create complete GeoZarr-compliant attributes in one call:

from geozarr_toolkit import create_geozarr_attrs
import json

attrs = create_geozarr_attrs(
    dimensions=["Y", "X"],
    crs="EPSG:32633",
    transform=[10.0, 0.0, 500000.0, 0.0, -10.0, 5000000.0],
    bbox=[500000.0, 4900000.0, 600000.0, 5000000.0],
    shape=[10000, 10000],
)

print(json.dumps(attrs, indent=2))
{
  "spatial:dimensions": [
    "Y",
    "X"
  ],
  "spatial:bbox": [
    500000.0,
    4900000.0,
    600000.0,
    5000000.0
  ],
  "spatial:transform_type": "affine",
  "spatial:transform": [
    10.0,
    0.0,
    500000.0,
    0.0,
    -10.0,
    5000000.0
  ],
  "spatial:shape": [
    10000,
    10000
  ],
  "spatial:registration": "pixel",
  "proj:code": "EPSG:32633",
  "zarr_conventions": [
    {
      "uuid": "689b58e2-cf7b-45e0-9fff-9cfc0883d6b4",
      "schema_url": "https://raw.githubusercontent.com/zarr-conventions/spatial/refs/tags/v1/schema.json",
      "spec_url": "https://github.com/zarr-conventions/spatial/blob/v1/README.md",
      "name": "spatial:",
      "description": "Spatial coordinate information"
    },
    {
      "uuid": "f17cb550-5864-4468-aeb7-f3180cfb622f",
      "schema_url": "https://raw.githubusercontent.com/zarr-experimental/geo-proj/refs/tags/v1/schema.json",
      "spec_url": "https://github.com/zarr-experimental/geo-proj/blob/v1/README.md",
      "name": "proj:",
      "description": "Coordinate reference system information for geospatial data"
    }
  ]
}

See the Getting Started guide for more details, or browse the API reference pages.

Installation

pip install "geozarr-toolkit"

Goals

  • Provide Python models and helpers for writing GeoZarr-compliant data, including CRS information, bounding boxes, and multiscale pyramids.
  • Validate existing Zarr stores against GeoZarr conventions, both programmatically and via CLI.
  • Support interoperability with rioxarray, GDAL GeoTransforms, and xarray workflows.

References

Specifications and Standards

Code Attribution

This library originated in geozarr-examples by Development Seed. The Python convention models (Spatial, Proj, Multiscales, etc.) follow patterns established in eopf-geozarr, part of the EOPF (Earth Observation Processing Framework) ecosystem.

License

MIT