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.4.0.tar.gz (45.2 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.4.0-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zarr_cm-0.4.0.tar.gz
  • Upload date:
  • Size: 45.2 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.4.0.tar.gz
Algorithm Hash digest
SHA256 31916850c435d9ca774fd96886a783d687579f6ff6e6d9cd5a163f7484cd6c6d
MD5 ef875339fe6d239dc0079fc759710c0c
BLAKE2b-256 33c4004ff5a50f5f8d02f9d8ee8f07671caaefb758e28d67c0b676f69df6875f

See more details on using hashes here.

Provenance

The following attestation bundles were made for zarr_cm-0.4.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: zarr_cm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 33.0 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41f8e5ef74f3e7cb4e775b17adedbd902555c82a5973854b329b159ef6d0f80f
MD5 abe595928382431435526d26c64595c4
BLAKE2b-256 332e65112d9dd37a5e5012c976254746639c334b08320f363d5b1af8853274c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for zarr_cm-0.4.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