Repository navigation
fix(geozarr): accept arbitrary spatial:dimensions names - #785
Open
kylebarron wants to merge 1 commit into
Open
kylebarron wants to merge 1 commit into
kylebarron wants to merge 1 commit into
Conversation
The spatial convention leaves the names in `spatial:dimensions` free and lists them in row-major order (`[y, x]` or `[z, y, x]`), so Y and X are the last two entries. `parseGeoZarrMetadata` only recognized the labels "y"/"latitude"/"lat" and "x"/"longitude"/"lon" and threw for any other names, such as `["northing", "easting"]`, so ZarrLayer could not load spec-compliant data that used them. Keep the label match when both a Y and an X label are present, so every dataset that parses today gets the same axes, including ones that list the labels in a non-spec order such as `["lon", "lat"]`. Otherwise take Y and X from the last two entries. The schema already requires at least two entries, so the positional indices are always valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
parseGeoZarrMetadatafound the Y and X axes only by the labelsy/latitude/latandx/longitude/lon, and threw for any other names. The spatial convention leaves the names inspatial:dimensionsfree and identifies the axes by position (row-major[y, x]or[z, y, x]), soZarrLayercouldn't load spec-compliant data such as["northing", "easting"]. The labels still decide when both a Y and an X label are present, so every dataset that parses today gets the same axes. Otherwise Y and X are now the last two entries.Changes
parseGeoZarrMetadatauses the last twospatial:dimensionsentries as Y and X, instead of throwing, when the names aren't recognized. The schema already requires at least 2 entries.ZarrLayerneeds no change: it matches the spatial dims against each array'sdimension_namesby name.Tests
packages/geozarr/tests/parse.test.ts:["northing", "easting"]and["depth", "northing", "easting"]resolve Y and X by position,["lon", "lat"]still resolves by label, and a 1-entry list is rejected.main. The other two guard existing behavior.Notes
["lon", "lat"]would mean Y =lon. Labels keep precedence here so data that parses today keeps the same axes.Closes #451
🤖 Written by Claude Code