Skip to main content

zarrextract

zarrextract extracts points, time series and bounding boxes from Zarr stores into Apache Arrow tables. It is a lighter alternative to xarray.open_zarr(...).sel(...) for the common case where you only want a small piece of a large store, and it needs only zarr, pyarrow and numpy.

It requires Python 3.12 or newer.

pip install zarrextract

Usage

The examples assume a store with time, lat and lon coordinates and a variable t2m with those dimensions.

Describe a store

describe() lists the arrays in a store without reading any data.

from zarrextract import describe

description = describe("era5.zarr")
for array in description:
    print(array.name, array.dimensions, array.shape, array.dtype)

description["t2m"].chunks
description.coordinates  # the 1-D coordinate arrays
description.data_variables  # everything else

Extract data

extract(store, variable, **selections) returns a pyarrow.Table in long format: one column per dimension of the variable, then a column for the variable itself, with one row per value. Each keyword names a dimension:

  • a single value picks the nearest coordinate;
  • a (start, stop) pair picks every value from start to stop, inclusive;
  • a dimension without a keyword is kept whole.
from zarrextract import extract

# A point
point = extract("era5.zarr", "t2m", lat=51.5, lon=-0.1, time="2020-06-01")

# A time series at one location
series = extract(
    "era5.zarr", "t2m", lat=51.5, lon=-0.1, time=("2020-01-01", "2020-12-31")
)

# A bounding box at one time
box = extract("era5.zarr", "t2m", lat=(50, 52), lon=(-1, 1), time="2020-06-01")

Longitudes are converted to the store's convention (0 to 360 or -180 to 180). CF time coordinates become Arrow timestamps, scale_factor and add_offset are applied, and _FillValue and missing_value become nulls. Only the chunks that overlap the selection are read.

Write to Parquet

import pyarrow.parquet as pq

pq.write_table(series, "series.parquet")

Stores

Local paths work as they are. URLs need fsspec and the backend for their protocol, for example s3fs for s3:// or gcsfs for gs://.

pip install fsspec s3fs
table = extract("s3://bucket/era5.zarr", "t2m", lat=51.5, lon=-0.1)

The backend finds credentials in its usual way, for example from environment variables or a configuration file. Passing storage options to the backend, such as anonymous access to a public bucket, is not supported yet.

Limitations

  • A box that crosses the edge of the store's longitude axis raises AntimeridianError. This includes the prime meridian on a store that uses 0 to 360. Request the two parts and join them with pyarrow.concat_tables:

    import pyarrow as pa
    
    west = extract("era5.zarr", "t2m", lat=(50, 52), lon=(350, 359.75))
    east = extract("era5.zarr", "t2m", lat=(50, 52), lon=(0, 10))
    box = pa.concat_tables([west, east])
    

    This example is for a store that uses 0 to 360, where lon=(-10, 10) would raise the error.

  • Only the standard, gregorian and proleptic_gregorian calendars are supported, and standard or gregorian dates before 1582-10-15 are not.

  • Only arrays at the top level of the store are supported.

  • Dask is not supported.

Licence

BSD-3-Clause. See LICENSE.

Metadata

Release files for zarrextract 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zarrextract 0.1.1
File Size Uploaded Provenance Actions
zarrextract-0.1.1.tar.gz 13.8 kB With provenance Details for zarrextract-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zarrextract 0.1.1
File Interpreter ABI Platform Actions
zarrextract-0.1.1-py3-none-any.whl Python 3 none any Details for zarrextract-0.1.1-py3-none-any.whl

Total release size: 29.5 kB

Release files / zarrextract-0.1.1.tar.gz

Download URL zarrextract-0.1.1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5557257c036a6b84c1e95cd22c78fe13d059cddf57e6f70a131d26a06ecec7d9
BLAKE2b-256 checksum
How to use checksums
6ea8e33744bfac07e107a6b96e84815d73cc932334cafbb7ef40f308291259a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / zarrextract-0.1.1-py3-none-any.whl

Download URL zarrextract-0.1.1-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bbc7bc06c52592439e3d2b06b829fede4cb91d225ead6dc5aad4400bca181ec
BLAKE2b-256 checksum
How to use checksums
2068aba7536b39c52dd7ef3f9ea15c22af9df82dc62cb1f67df5019ec575fd0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Nov 24, 2026.

Transparency log

Security for zarrextract 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zarrextract-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page