Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue when using scale_factor and add_offset in zarr #422

Closed
gdkrmr opened this issue Dec 20, 2022 · 5 comments
Closed

issue when using scale_factor and add_offset in zarr #422

gdkrmr opened this issue Dec 20, 2022 · 5 comments

Comments

@gdkrmr
Copy link

gdkrmr commented Dec 20, 2022

Please correct me if this is not an issue:

However, if the scale_factor and add_offset attributes are of a different data type from the variable (containing the packed data) then the unpacked data should match the type of these attributes, which must both be of type float or both be of type double .

From the CFConventions 8.1 Packed Data.

This is an issue with Zarr specifically: Attributes are defined in JSON and JSON can only define 64 bit floats. scale_factor and add_offset should be the same data type as the unpacked data. This means, at least in a strict sense, that CF-compliant Zarr cannot define 32 bit floats when using scale_factor and/or add_offset.

@gdkrmr gdkrmr added the defect Conventions text meaning not as intended, misleading, unclear, has typos, format or language errors label Dec 20, 2022
@taylor13
Copy link

Are you saying that in producing a Zarr file one has no control over the datatype of attributes? If so, this would seem to be a general, unfortunate limitation, which Zarr might want to remedy. (And I see you have raised the issue with them, so let's wait to hear what they have to say.)

@ethanrd
Copy link
Member

ethanrd commented Dec 20, 2022

There are a number of places where the netCDF and Zarr data models don't match exactly, typed attributes is one example. The netCDF library developers have started and are working with the Zarr community on an NCZarr extension (see discussion #186) to improve the mapping between the two data models. There is also work on a Zarr version 3 specification that, as I understand it, will include some of the netCDF features that are missing in Zarr version 2.

@gdkrmr
Copy link
Author

gdkrmr commented Dec 21, 2022

which Zarr might want to remedy.

Agreed, this is a limitation of Zarr

(see discussion #zarr-developers/zarr-specs#186)

Seems like the Zarr developers are aware of the issue. Thanks for pointing me there.

Should the issue stay open, maybe with an "implementation" tag or similar?

@JonathanGregory JonathanGregory added question and removed defect Conventions text meaning not as intended, misleading, unclear, has typos, format or language errors labels Aug 29, 2023
@JonathanGregory
Copy link
Contributor

I have changed the label of this issue from defect to question because the discussion shows it's not an issue about the text of the CF convention.

@JonathanGregory
Copy link
Contributor

I'm closing this issue because I believe the question was answered and there is no action for CF. Thanks for asking the question, @gdkrmr.

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

No branches or pull requests

4 participants