-
-
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
can't store zarr after open_zarr and isel #2278
Comments
Yes, this is definitely a bug. One workaround is to explicitly remove the broken |
thanks for the workaround suggestion.
Any idea about how serious this is and/or where it's coming from? |
The source of the bug is that encoding metadata
Idea 1 is easier but would mean discarding some relevant metadata about encoding. This would break round-tripping of the un-modified zarr dataset. |
With the same case, I have another error message which may reflect the same issue (or not), maybe you can tell me. The error message is different which is the reason I am posting this. Starting from the same dataset:
Case 1 works fine:
Case 2 breaks:
with the following error message:
|
Note that there is also a fix for case 2 that is simply |
Yes, this is the same underlying issue.
…On Thu, Jul 12, 2018 at 2:59 PM Aurélien Ponte ***@***.***> wrote:
Note that there is also a fix here that is simply del
ds['v'].encoding['chunks'] prior to data storage.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2278 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABJFJp-x0xW1Pe_zzEmnO41Ae3tYE541ks5uF0hAgaJpZM4VK7Q0>
.
|
We do Ryan's option 2 for netCDF files and it works pretty well.
On Thu, Jul 12, 2018 at 8:24 AM Ryan Abernathey <notifications@github.com>
wrote:
… Yes, this is the same underlying issue.
On Thu, Jul 12, 2018 at 2:59 PM Aurélien Ponte ***@***.***>
wrote:
> Note that there is also a fix here that is simply del
> ds['v'].encoding['chunks'] prior to data storage.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#2278 (comment)>,
or mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/ABJFJp-x0xW1Pe_zzEmnO41Ae3tYE541ks5uF0hAgaJpZM4VK7Q0
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2278 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABKS1tIqTavCwrLu9qcwDQtb98SG6G_Tks5uF04kgaJpZM4VK7Q0>
.
|
Could you please be more specific about where this is done for netCDF? |
xarray/xarray/backends/netCDF4_.py Lines 208 to 209 in 64a7d11
|
Hi, nx, ny, nt = 32, 32, 64
ds = xr.Dataset({}, coords={'x':np.arange(nx),'y':np.arange(ny), 't': np.arange(nt)})
ds = ds.assign(v=ds.t*np.cos(np.pi/180./100*ds.x)*np.cos(np.pi/180./50*ds.y))
ds = ds.chunk({'t': 1, 'x': nx/2, 'y': ny/2})
ds.to_zarr('data.zarr', mode='w')
Err message is following .
(if I add del ds.v.encoding['chunks'] as follows, it does not break) nx, ny, nt = 32, 32, 64
ds = xr.Dataset({}, coords={'x':np.arange(nx),'y':np.arange(ny), 't': np.arange(nt)})
ds = ds.assign(v=ds.t*np.cos(np.pi/180./100*ds.x)*np.cos(np.pi/180./50*ds.y))
ds = ds.chunk({'t': 1, 'x': nx/2, 'y': ny/2})
ds.to_zarr('data.zarr', mode='w')
ds = xr.open_zarr('data.zarr')
del ds.v.encoding['chunks']
ds = ds.chunk({'t': nt, 'x': nx/4, 'y': ny/4})
ds.to_zarr('data_rechunked.zarr', mode='w') |
Code Sample, a copy-pastable example if possible
This works fine:
But if I store, reload and select, I cannot store:
Error message ends with:
Output of
xr.show_versions()
xarray: 0.10.7
pandas: 0.23.1
numpy: 1.14.2
scipy: 1.1.0
netCDF4: 1.4.0
h5netcdf: 0.6.1
h5py: 2.8.0
Nio: None
zarr: 2.2.0
bottleneck: 1.2.1
cyordereddict: None
dask: 0.18.1
distributed: 1.22.0
matplotlib: 2.2.2
cartopy: 0.16.0
seaborn: None
setuptools: 39.2.0
pip: 10.0.1
conda: None
pytest: None
IPython: 6.4.0
sphinx: None
The text was updated successfully, but these errors were encountered: