Skip to content

refactor(conventions): source convention identity & validation from zarr-cm#20

Open
d-v-b wants to merge 1 commit into
zarr-developers:mainfrom
d-v-b:use-zarr-cm-types
Open

refactor(conventions): source convention identity & validation from zarr-cm#20
d-v-b wants to merge 1 commit into
zarr-developers:mainfrom
d-v-b:use-zarr-cm-types

Conversation

@d-v-b

@d-v-b d-v-b commented Jun 24, 2026

Copy link
Copy Markdown

Closes #19.

zarr-cm is the shared, minimal-dependency Python implementation of the Zarr
conventions metadata. This de-duplicates functionality by depending on it as
the single source of truth, while keeping geozarr-toolkit's richer Pydantic
models and geospatial value-adds.

  • Add zarr-cm>=0.4.1 dependency.
  • Source each convention's identity (UUID, schema_url, spec_url, description)
    from zarr-cm instead of hardcoding it. The spatial/proj schema/spec URLs now
    point at zarr-cm's commit-pinned snapshots (the old refs/tags/v0.1 URLs for
    those two conventions 404 upstream).
  • Delegate structural validation rules to zarr-cm where the behavior matches:
    • ZarrConventionMetadata: the "at least one identifier" rule.
    • Proj: the "at least one CRS" rule (the stricter ^[A-Z]+:[0-9]+$ code
      pattern and the pyproj resolution check remain geozarr-specific additions).
    • Multiscales: full layout validation, which adds enforcement of the
      spec rule that a derived_from level must also carry a transform.
    • validate_zarr_conventions helper: the per-CMO identifier rule.

Spatial validation is intentionally NOT delegated: zarr-cm's shipped spatial
revisions are strict-2D, whereas geozarr-toolkit supports N-D dimensions.

A test that constructed a derived_from level without a transform (invalid
per the spec) is fixed, and a test for the newly enforced rule is added.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

…arr-cm

Closes zarr-developers#19.

zarr-cm is the shared, minimal-dependency Python implementation of the Zarr
conventions metadata. This de-duplicates functionality by depending on it as
the single source of truth, while keeping geozarr-toolkit's richer Pydantic
models and geospatial value-adds.

- Add `zarr-cm>=0.4.1` dependency.
- Source each convention's identity (UUID, schema_url, spec_url, description)
  from zarr-cm instead of hardcoding it. The spatial/proj schema/spec URLs now
  point at zarr-cm's commit-pinned snapshots (the old `refs/tags/v0.1` URLs for
  those two conventions 404 upstream).
- Delegate structural validation rules to zarr-cm where the behavior matches:
  - `ZarrConventionMetadata`: the "at least one identifier" rule.
  - `Proj`: the "at least one CRS" rule (the stricter `^[A-Z]+:[0-9]+$` code
    pattern and the pyproj resolution check remain geozarr-specific additions).
  - `Multiscales`: full layout validation, which adds enforcement of the
    spec rule that a `derived_from` level must also carry a `transform`.
  - `validate_zarr_conventions` helper: the per-CMO identifier rule.

Spatial validation is intentionally NOT delegated: zarr-cm's shipped spatial
revisions are strict-2D, whereas geozarr-toolkit supports N-D dimensions.

A test that constructed a `derived_from` level without a `transform` (invalid
per the spec) is fixed, and a test for the newly enforced rule is added.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 24, 2026

Copy link
Copy Markdown

Deploy Preview for geozarrdemonstration4e8c9 canceled.

Name Link
🔨 Latest commit 3a0e8ca
🔍 Latest deploy log https://app.netlify.com/projects/geozarrdemonstration4e8c9/deploys/6a3c36c7e38f7b0008df83d5

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@maxrjones

Copy link
Copy Markdown
Member

Thanks, @d-v-b. Does zarr-cm provide anything for the attributes defined by the convention, or is it just for the convention metadata object itself?

@d-v-b

d-v-b commented Jun 26, 2026

Copy link
Copy Markdown
Author

It aims to provide both -- see https://zarr-cm.readthedocs.io/en/latest/api/#zarr_cm.spatial.SpatialAttrs and https://zarr-cm.readthedocs.io/en/latest/api/#zarr_cm.spatial.SpatialConventionAttrs. The former is the core convention attributes, and the latter includes the convention attributes + the CMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use zarr-cm for types?

2 participants