-
-
Notifications
You must be signed in to change notification settings - Fork 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
.to_zarr with datetime64[ns] #2265
Comments
When writing datetime objects to disk, xarray encodes them following CF conventions (converting them to numerical values quantifying some units of time since a given reference date). This is to support other backends which do not support writing For accurate roundtripping of Datasets, xarray also includes logic to automatically decode datetimes stored following CF conventions. For that reason, instead of loading in the raw zarr store using zarr's See the following example:
Note if we open the zarr store directly, we'll find that the date was encoded with the integer
Unlike xarray, zarr does not include logic for automatically decoding CF-encoded datetimes. I hope that helps. |
@spencerkclark yes that helps very much and a great example of how to answer a question! I'm learning so much from this group. Is there a way of appending an xarray dataset onto an existing zarr array? That's why I've been accessing direct through zarr, what I'm trying to do is build a zarr file of all the Argo float profiles and add new ones as they arrive. |
@NickMortimer - No, not yet. It has been proposed already though in #2022. |
@jhamman thanks I'll add to the discussion there and close this issue. |
Hi I've noticed a possible inconsistency with datetime storing.
if I try this
There also seems to be a problem with the actual values stored are different using the two methods
I think it is to do with the reference date time not being applied?
I hope this makes sense
The text was updated successfully, but these errors were encountered: