You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am computing the MD5 hashes of files created using to_netcdf to verify that their contents is as expected. However, I am running into an issue where identical arrays can give different hashes each time they are generated.
This only seems to occur when using non-dimensional coordinates, and I think it is related to the order in which the non-dimensional coordinates are listed in the saved file.
will sometimes be saved with the non-dimensional coordinates listed as "a b" and sometimes as "b a" - which causes the file hash to be unpredictable (well, not a single value at least).
I can enforce the order by setting ds.encoding["coordinates"] = "a b", which gives consistent hashes.
Is this the only way to approach it (I find it easy to forget to include and to keep updated) or is the inconsistent ordering a bug to report? It also seems related to some of the behaviour described in #4738. I have tried looking through the code, but I can't find where this inconsistent ordering would be occurring.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am computing the MD5 hashes of files created using
to_netcdf
to verify that their contents is as expected. However, I am running into an issue where identical arrays can give different hashes each time they are generated.This only seems to occur when using non-dimensional coordinates, and I think it is related to the order in which the non-dimensional coordinates are listed in the saved file.
For example, the following array
will sometimes be saved with the non-dimensional coordinates listed as
"a b"
and sometimes as"b a"
- which causes the file hash to be unpredictable (well, not a single value at least).I can enforce the order by setting
ds.encoding["coordinates"] = "a b"
, which gives consistent hashes.Is this the only way to approach it (I find it easy to forget to include and to keep updated) or is the inconsistent ordering a bug to report? It also seems related to some of the behaviour described in #4738. I have tried looking through the code, but I can't find where this inconsistent ordering would be occurring.
This is with
xarray==2022.3.0
.Thanks for any assistance!
Beta Was this translation helpful? Give feedback.
All reactions