Skip to main content

Python implementation of Zarr Conventions Metadata

Project description

zarr-cm

Actions Status Documentation Status

PyPI version Conda-Forge PyPI platforms

GitHub Discussion

Coverage

Python types and utilities for Zarr Conventions Metadata.

Overview

zarr-cm provides typed Python support for the published Zarr conventions:

Convention Module Description
proj zarr_cm.proj (also zarr_cm.geo_proj) Coordinate reference system information
spatial zarr_cm.spatial Spatial coordinate metadata
multiscales zarr_cm.multiscales Multiscale pyramid layout
license zarr_cm.license License specifiers
uom zarr_cm.uom Units of measurement

Each module provides:

  • TypedDict types for convention-specific metadata
  • create — create convention metadata
  • insert — add convention metadata to a Zarr attributes dict
  • extract — remove and return convention metadata from an attributes dict
  • validate — check runtime invariants the type system cannot express

Installation

pip install zarr-cm

Usage

from zarr_cm import geo_proj

# Create convention metadata
data = geo_proj.create(code="EPSG:4326")
print(data)
#> {'proj:code': 'EPSG:4326'}

# Validate
print(geo_proj.validate({"proj:code": "EPSG:4326"}))
#> {'proj:code': 'EPSG:4326'}

# Insert into an attributes dict
attrs = {"foo": "bar"}
result = geo_proj.insert(attrs, data)
print(result)
"""
{
    'foo': 'bar',
    'proj:code': 'EPSG:4326',
    'zarr_conventions': [
        {
            'uuid': 'f17cb550-5864-4468-aeb7-f3180cfb622f',
            'schema_url': 'https://raw.githubusercontent.com/zarr-conventions/proj/5ca5b2f92e5c7245f957d9128b289ee535f0720d/schema.json',
            'spec_url': 'https://github.com/zarr-conventions/proj/blob/5ca5b2f92e5c7245f957d9128b289ee535f0720d/README.md',
            'name': 'proj:',
            'description': 'Coordinate reference system information for geospatial data',
        }
    ],
}
"""

# Extract it back out
remaining, extracted = geo_proj.extract(result)
print(remaining)
#> {'foo': 'bar'}
print(extracted)
#> {'proj:code': 'EPSG:4326'}

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

zarr_cm-0.3.0.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

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

zarr_cm-0.3.0-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file zarr_cm-0.3.0.tar.gz.

File metadata

  • Download URL: zarr_cm-0.3.0.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zarr_cm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6fbee90a196539d61ecc51fe8fdf7fee1f70d5733289fb03df639be229465c79
MD5 82c54f6ec9186413e6db45f233eca183
BLAKE2b-256 dcb6d920b941f5862dca32b1689316e15824e12393fa9b25598a58ba1823dc55

See more details on using hashes here.

Provenance

The following attestation bundles were made for zarr_cm-0.3.0.tar.gz:

Publisher: cd.yml on zarr-conventions/zarr-cm

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

File details

Details for the file zarr_cm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: zarr_cm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zarr_cm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 489b34666823d1ff0dfb9fe975f6cccbe94660a39fe0b4688970b2baf39b43fc
MD5 f5dcf41a1690789651bae1d7dc3a88b7
BLAKE2b-256 481ed308d5ee6cd728013e534de3522e726ea5a9ba5843e5a149a80b1e40c75f

See more details on using hashes here.

Provenance

The following attestation bundles were made for zarr_cm-0.3.0-py3-none-any.whl:

Publisher: cd.yml on zarr-conventions/zarr-cm

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