Skip to main content

Chunk-first zonal statistics for xarray mosaics and GeoPandas using Ray

Project description

rayzon

CI Release

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:

  1. Read a raster chunk once.
  2. Find candidate features that intersect that chunk.
  3. Rasterize only the local polygon window (not the full chunk unless required).
  4. Emit pyarrow blocks of flattened pixel data per intersecting block and leverages Ray's AggregateFnV2 to 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 AggregateFnV2 for extensible reductions: Chunk work emits PyArrow blocks for features intersecting each chunk, then Ray can groupby and reduce those blocks with AggregateFnV2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rayzon-0.1.0.tar.gz (203.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rayzon-0.1.0-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

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

Hashes for rayzon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d3ae20f721b8e1a244f4677f7593e210c0d8bf28707525fd3fc5dd84fb167c2d
MD5 ab67cec4235d876e803fef15262f49c5
BLAKE2b-256 7f8fc3fe6d598d8915d908ad136d4b92db93f0ba4a095cf1feae5ed4087ef379

See more details on using hashes here.

Provenance

The following attestation bundles were made for rayzon-0.1.0.tar.gz:

Publisher: release.yml on ljstrnadiii/rayzon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for rayzon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ff1f71f35f18005baa0645831d9e3267779178ed46960d4b750c5cdfdadd1de
MD5 9efbe15f47c7311cf366b35f53fb86bc
BLAKE2b-256 51966a34c5d6ec9279c024f397873f76ff7eb4e0a4b2730ff24bc34704b2c55d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rayzon-0.1.0-py3-none-any.whl:

Publisher: release.yml on ljstrnadiii/rayzon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page