Skip to content

fix: update OME-Zarr unit handling to match spec#907

Open
omdowley wants to merge 3 commits intogoogle:masterfrom
omdowley:master
Open

fix: update OME-Zarr unit handling to match spec#907
omdowley wants to merge 3 commits intogoogle:masterfrom
omdowley:master

Conversation

@omdowley
Copy link

@omdowley omdowley commented Mar 16, 2026

As discussed in #780, the relevant part of the OME Zarr v0.5 spec specifies that the units SHOULD be one of those that are currently allowed, not that they MUST be (which is what is currently enforced). This instead of erroring treats unsupported units as unitless and warns.

It seems possible to me that there are smarter things to do than this, but thought I'd get the ball rolling with it, because it feels like the absolute minimal change such that we're actually meeting the spec.

As discussed in google#780, the OME-Zarr v0.5 spec specifies that the units SHOULD be
one of those that are currently allowed, not MUST. This instead treats
unsupported units as unitless and warns.
@chrisj
Copy link
Contributor

chrisj commented Mar 16, 2026

I'm wondering if this should be visible in the UI as either a temporary status message or ideally as a message exactly where the error message currently shows but still allow creating the layer

@jbms
Copy link
Collaborator

jbms commented Mar 16, 2026

Yes, I'd agree, we just need to add a mechanism for data sources to propagate warnings --- probably by passing in a messages: MessageList object as part of the GetDataSourceOptionsBase interface.

The OME Zarr spec specifies the lists of units from which valid units SHOULD
come separately for `time` and `space` axes. This enforces that (with a warning).
@omdowley
Copy link
Author

omdowley commented Mar 18, 2026

I'm wondering if this should be visible in the UI as either a temporary status message or ideally as a message exactly where the error message currently shows but still allow creating the layer

This definitely makes a lot more sense than what I initially did.

Yes, I'd agree, we just need to add a mechanism for data sources to propagate warnings --- probably by passing in a messages: MessageList object as part of the GetDataSourceOptionsBase interface.

I've done this -- it ended up a bit messy because by default the warnings were removed pretty immediately by the refCounted disposer, so I had to persist them. Again there may be a neater way to do that, it just felt like it'd require bigger changes, open to feedback

I've also added logic checking the axis type and unit type make sense, and warning if there is either an axis type mismatch or if the axis type isn't one defined in the spec (both of these are SHOULD items in the spec)

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.

3 participants