Chunk-first zonal statistics for xarray mosaics and GeoPandas using Ray
Project description
rayzon
rayzon is a ray project to execute zonal statistics on zarr arrays.
It is designed for workflows where:
- Raster data is stored as chunked arrays with optional non-spatial dimensions e.g.
(time, band, y, x). - Vector features may overlap.
- Relevant raster chunks are read once, and statistics are computed in a distributed manner with Ray.
The project uses a chunk-first execution model:
- Read a raster chunk once.
- Find candidate features that intersect that chunk.
- Rasterize only the local polygon window (not the full chunk unless required).
- Emit pyarrow blocks of flattened pixel data per intersecting block and leverages Ray's
AggregateFnV2to group and reduce those blocks into final statistics.
This architecture keeps memory usage bounded, avoids repeated raster reads, and makes distributed execution with Ray straightforward.
Features
- Zarr as the storage contract: Zarr gives us chunked, cloud-friendly storage today, while preserving flexibility to plug in VirtualiZarr-backed datasets later without changing the core chunk-first pipeline.
- Ray
AggregateFnV2for extensible reductions: Chunk work emits PyArrow blocks for features intersecting each chunk, then Ray cangroupbyand reduce those blocks withAggregateFnV2. This keeps reduction logic composable and makes new statistics easy to add as new aggregate definitions. - GeoArrow-native geometry transport: GeoArrow lets us read and move geometry types directly in PyArrow form, reducing conversion overhead and keeping feature transport efficient across Ray tasks.
Current Scope
- Chunk/grid utilities for deterministic chunk addressing.
- Feature-to-chunk indexing.
- Windowed rasterization backend.
- Partial stats and reduction pipeline.
- End-to-end pipeline entry points and benchmark hooks.
Installation
Install the base package from PyPI:
pip install rayzon
Install optional extras as needed:
pip install "rayzon[xarray]"
pip install "rayzon[geopandas]"
pip install "rayzon[xarray,geopandas]"
Development
- Install dependencies:
uv sync --extra dev --extra geopandas --extra xarray - Run lint:
uv run ruff check . - Run format check:
uv run ruff format --check . - Run type check:
uv run mypy src - Run tests:
uv run pytest
Release
Releases are cut automatically from main after the CI workflow passes. Use Conventional
Commits for changes that should trigger a release, and semantic-release will:
- compute the next version
- update
pyproject.toml - create the version tag and GitHub release
- build and publish the package to PyPI via GitHub Actions trusted publishing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rayzon-0.1.0.tar.gz.
File metadata
- Download URL: rayzon-0.1.0.tar.gz
- Upload date:
- Size: 203.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3ae20f721b8e1a244f4677f7593e210c0d8bf28707525fd3fc5dd84fb167c2d
|
|
| MD5 |
ab67cec4235d876e803fef15262f49c5
|
|
| BLAKE2b-256 |
7f8fc3fe6d598d8915d908ad136d4b92db93f0ba4a095cf1feae5ed4087ef379
|
Provenance
The following attestation bundles were made for rayzon-0.1.0.tar.gz:
Publisher:
release.yml on ljstrnadiii/rayzon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayzon-0.1.0.tar.gz -
Subject digest:
d3ae20f721b8e1a244f4677f7593e210c0d8bf28707525fd3fc5dd84fb167c2d - Sigstore transparency entry: 1328333344
- Sigstore integration time:
-
Permalink:
ljstrnadiii/rayzon@56470762dbf5bec9d6cad79e2fba61c2eb67c542 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ljstrnadiii
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@56470762dbf5bec9d6cad79e2fba61c2eb67c542 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file rayzon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rayzon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ff1f71f35f18005baa0645831d9e3267779178ed46960d4b750c5cdfdadd1de
|
|
| MD5 |
9efbe15f47c7311cf366b35f53fb86bc
|
|
| BLAKE2b-256 |
51966a34c5d6ec9279c024f397873f76ff7eb4e0a4b2730ff24bc34704b2c55d
|
Provenance
The following attestation bundles were made for rayzon-0.1.0-py3-none-any.whl:
Publisher:
release.yml on ljstrnadiii/rayzon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayzon-0.1.0-py3-none-any.whl -
Subject digest:
1ff1f71f35f18005baa0645831d9e3267779178ed46960d4b750c5cdfdadd1de - Sigstore transparency entry: 1328333357
- Sigstore integration time:
-
Permalink:
ljstrnadiii/rayzon@56470762dbf5bec9d6cad79e2fba61c2eb67c542 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ljstrnadiii
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@56470762dbf5bec9d6cad79e2fba61c2eb67c542 -
Trigger Event:
workflow_run
-
Statement type: