Skip to main content

Lightweight multiscale zarr

Project description

topozarr - lightweight multiscale zarr pyramids

Python library to create multiscale zarr pyramids for usage with zarr-layer. Attempts to follow the WIP zarr-multiscales spec.

Warning: experimental

Usage

Installation

uv add topozarr
# or
pip install topozarr

Example

# !pip install netcdf4 pooch 
import xarray as xr
import xproj # for crs assignment
from topozarr.coarsen import create_pyramid

# Load the air_temp tutorial xarray dataset
ds = xr.tutorial.open_dataset('air_temperature', chunks={})
ds = ds.proj.assign_crs(spatial_ref_crs={"EPSG":4326})
print(ds)
pyramid = create_pyramid(
    ds, 
    levels=2, 
    x_dim="lon", 
    y_dim="lat")
print(pyramid.encoding)
print(pyramid.dt)
# Optional: Write to Zarr
# !pip install obstore zarr
from obstore.store import from_url
from zarr.storage import ObjectStore


store = from_url(url = "<add_your_bucket_url>", region="<add_your_region>")
zstore = ObjectStore(store) 
pyramid.dt.to_zarr(zstore, mode="w", encoding = pyramid.encoding, zarr_format=3)
# Optional: Write to Icechunk
# !pip install icechunk 
import icechunk

storage = icechunk.s3_storage(bucket="<add_your_bucket_name>", prefix="<add_your_prefix>", from_env=True)
repo = icechunk.Repository.create(storage)
session = repo.writable_session("main")

store = from_url(url = "<add_your_bucket_url>", region="<add_your_region>")
zstore = ObjectStore(store) 
pyramid.dt.to_zarr(session.store, mode="w", encoding = pyramid.encoding, consolidated=False)

Development

This project uses uv for dependency management, pytest and hypothesis for testing and ruff for linting.

Sync development environment

uv sync --all-extras

Run linter

uv run pre-commit run all-files

Run tests

uv run pytest tests/

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

topozarr-0.0.4.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

topozarr-0.0.4-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file topozarr-0.0.4.tar.gz.

File metadata

  • Download URL: topozarr-0.0.4.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for topozarr-0.0.4.tar.gz
Algorithm Hash digest
SHA256 05015b4a00ec38af61dade9437d8a8bcb4550e08de00cbee02b3dcbeb05c121b
MD5 02ce3965eab38005f2f3f35e48238af2
BLAKE2b-256 f01d2857a9bafba94cefd9e618e32b5930555b931a1b5a41f1aa2c5b054abe7e

See more details on using hashes here.

File details

Details for the file topozarr-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: topozarr-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for topozarr-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d7c70f993e4728dd857e57d2b17f8929a357cdd7d55355d115b359774e561f57
MD5 25660cc3830d845dc724cf228f07e1fc
BLAKE2b-256 6e897932939d5bbe0bb3baa7ab7aef99039d3935f067b35a1fd6744ef963acd5

See more details on using hashes here.

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