issues: 1050082137
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1050082137 | I_kwDOAMm_X84-lvtZ | 5969 | `to_zarr(append_dim="time")` appends incorrect datetimes | 460756 | closed | 0 | 3 | 2021-11-10T17:00:53Z | 2024-05-03T17:09:31Z | 2024-05-03T17:09:30Z | NONE | DescriptionIf you create a Zarr with a single timestep and then append to the Minimal Complete Verifiable ExampleCreate a really simple
Write just the first timestep to a new Zarr store:
So far, so good! Now things get weird... let's append the remainder of
This throws a warning, which is probably relevant:
What happenedLet's load the Zarr and print the contents on the
(I've removed the seconds and milliseconds to make it a bit easier to read) The first and fifth time coords (2000-01-01T00:35 and 2000-01-02T00:35) are correct. None of the others are correct! The encoding is not appropriate (see #3942)... notice that the
What you expected to happenThe correct Anything else we need to know?There are three workarounds that I'm aware of: 1) When first creating the Zarr, write two or more timesteps into the Zarr. Then you can append any number of timesteps to the Zarr and everything works fine.
2) Convert the
Related issuesIt's possible that the root cause of this issue is #3942. And I think #3379 is another symptom of this issue. EnvironmentOutput of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:20:46) [GCC 9.4.0] python-bits: 64 OS: Linux OS-release: 5.13.0-21-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: ('en_GB', 'UTF-8') libhdf5: 1.12.1 libnetcdf: 4.8.1 xarray: 0.20.1 pandas: 1.3.4 numpy: 1.21.4 scipy: 1.7.2 netCDF4: 1.5.8 pydap: None h5netcdf: 0.11.0 h5py: 3.4.0 Nio: None zarr: 2.10.1 cftime: 1.5.1.1 nc_time_axis: None PseudoNetCDF: None rasterio: 1.2.8 cfgrib: 0.9.9.1 iris: None bottleneck: 1.3.2 dask: 2021.10.0 distributed: None matplotlib: 3.4.3 cartopy: None seaborn: None numbagg: None fsspec: 2021.11.0 cupy: None pint: None sparse: None setuptools: 58.5.3 pip: 21.3.1 conda: None pytest: 6.2.5 IPython: 7.29.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5969/reactions", "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |