home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 922791001

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
922791001 MDU6SXNzdWU5MjI3OTEwMDE= 5473 Junk slice written to zarr with append_dim option 41342785 closed 0     2 2021-06-16T15:51:33Z 2021-10-19T18:51:18Z 2021-10-19T18:51:18Z CONTRIBUTOR      

I often write to zarr using the append_dim option. But I find that sometimes I get a junk slice in the first index of the zarr file along the dimenstion I am appending along. This seems to be related to the way coordinates are assigned along this dimension. Here's a minimal working example:

``` import xarray as xr import numpy as np

target='test_zarr.zarr' for i in range(0,10): test_slice = xr.DataArray(np.random.rand(10,20),dims=['j','k']) test_slice = test_slice.assign_coords({"time": i*10}) #this line is necessary for this example to fail test_slice = test_slice.expand_dims('time') test_ds = test_slice.to_dataset(name='u') test_ds.to_zarr(target, append_dim='time')

```

When I open the zarr file:

test_opened = xr.open_zarr('test_zarr.zarr') test_opened.time gives array([140624802912264, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90])

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.9.4 | packaged by conda-forge | (default, May 10 2021, 22:13:33) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.11.1.el7.centos.plus.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: None libnetcdf: None xarray: 0.18.2 pandas: 1.2.4 numpy: 1.20.3 scipy: 1.6.3 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: 2.8.1 cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2021.06.0 distributed: 2021.06.0 matplotlib: 3.4.2 cartopy: None seaborn: None numbagg: None pint: None setuptools: 49.6.0.post20210108 pip: 21.1.2 conda: None pytest: None IPython: 7.24.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5473/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.679ms · About: xarray-datasette