-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Regression/#1840: decoding to float64
instead of float32
#9041
Comments
The relevant change was made to |
float64
instead of float32
Thanks @yt87, yes this is correct. Xarray is following CF Conventions as declared in https://docs.xarray.dev/en/stable/user-guide/io.html#reading-encoded-data. Here the CF Conventions for packed data apply https://cfconventions.org/cf-conventions/cf-conventions.html#packed-data:
Would it make sense to add a sentence in the above linked doc section about handling packed data which links to the CF Conventions on packed data? |
It would be helpful to have a link. The CF conventions document is quite long. |
OK, my above comment referenced the reading section only. There is also a writing section, which also has some mention of packed data handling: https://docs.xarray.dev/en/stable/user-guide/io.html#scaling-and-type-conversions I think we could just add a reference to the CF Conventions on packed data somewhere in that section. |
@yt87 Do you think the additional link to CF Conventions will help to better understand behaviour? https://xray--9045.org.readthedocs.build/en/9045/user-guide/io.html#scaling-and-type-conversions |
I would add a note that the |
@yt87 I've added an explanatory sentence: https://xray--9045.org.readthedocs.build/en/9045/user-guide/io.html#scaling-and-type-conversions per your suggestion. I've marked the PR as plan-to-merge. So this might be in for the next version. |
What happened?
xr.open_dataset
unnecessarily promotes small integers to float64. This was an issue #1840 (fixed) back in 2018. If I am not mistaken, it was reversed with release 2024.3.0.What did you expect to happen?
I expected float32 in the output below.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment
The text was updated successfully, but these errors were encountered: