Enforce single-source rule for spatial: properties#31
Draft
wietzesuijker wants to merge 1 commit into
Draft
Conversation
This was referenced May 20, 2026
- schema.json: four new allOf branches that make the placement rules
enforceable without tolerance arithmetic.
A. affine arrays MUST NOT carry spatial:bbox (derivable from
spatial:transform + spatial:shape via the four transformed corners).
B. non-affine arrays (transform_type != 'affine') MUST carry spatial:bbox
(no closed-form derivation).
C. groups MUST NOT carry per-array spatial properties (spatial:transform,
spatial:transform_type, spatial:shape, spatial:registration).
D. multiscales.layout[] entries MUST NOT carry spatial:bbox (derivable
per resolution level from spatial:transform + spatial:shape).
- test-rules.js: 12-case suite covering both directions of each branch,
plus an antimeridian carve-out case (xmin > xmax) for geographic CRSes.
- package.json: npm test now runs both the example validator and the rule
suite.
- README.md: new "Property placement" section documenting the rules,
the four-corner derivation, and the antimeridian carve-out.
- examples/proj.json: remove the array-level spatial:bbox (it duplicates the
extent already encoded by spatial:transform); add spatial:shape so the
example is self-describing.
- notes/single-source-rule-rationale.md: prior art, rejected alternatives,
per-issue cross-references, and out-of-scope reasoning. Non-normative
companion to the README section.
Resolves zarr-conventions#6, zarr-conventions#8, zarr-conventions#12, zarr-conventions#23. Composes with zarr-conventions#19.
d889920 to
af11820
Compare
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One slot per
spatial:fact, per level. Affine arrays dropspatial:bbox(derivable fromtransform+shape); non-affine arrays must declare it; groups carry onlyspatial:bbox, no per-array properties.Companion to the RFC at #32.
What's in this PR
schema.json: fourallOfif/then branches enforcing the rules at array, group, andmultiscales.layout[]levels.README.md: new## Property placementsection with the rules, four-corner derivation snippet, antimeridian carve-out (xmin > xmaxallowed for geographic CRSes), and updated examples that no longer carry the forbidden array-level pair.test-rules.js: 12-case test suite. 7 forbidden shapes returnvalid=false; 5 positive shapes (including the antimeridian and multiscales-layout cases) returnvalid=true.examples/proj.json: drops array-levelspatial:bbox(now derivable); addsspatial:shapeso the example is self-describing.notes/single-source-rule-rationale.md: prior art, rejected alternatives, per-issue cross-references, out-of-scope reasoning. For reviewers who want the receipts; not normative.Test plan
npm test, existing example validator: 2/2 PASS (multiscales.json, patchedproj.json).npm test, new rule suite: 12/12 PASS.npm run lint: clean.npx prettier --check schema.json examples/proj.json test-rules.js: clean.npm install && npm testlocally.Migration footprint