home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1104213904

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
1104213904 I_kwDOAMm_X85B0PeQ 6167 Xarray.to_netcdf encoding option not working for complevel and shuffle 11950284 closed 0     4 2022-01-14T23:38:47Z 2023-01-27T20:41:24Z 2023-01-27T20:41:24Z NONE      

What happened?

The complevel and shuffle do not work on outputting file after updating the variable encoding. I set the variable encoding through ds_test.net_heating.encoding.update({'complevel': 2, 'shuffle': True}) but the output nc file does not have _Shuffle and _DeflateLevel shown in the ncdump -hs test.nc.

I, then, read in the output test.nc and check the encoding of the same variable and find the complevel = 0 and shuffle = False.

What did you expect to happen?

  1. The output file.nc shows correct _Shuffle and _DeflateLevel through ncdump -hs file.nc.
  2. Read in the output file.nc through Xarray and check the encoding of the same variable should show complevel = 2 and shuffle = True.

Minimal Complete Verifiable Example

```python

ds_test.var.encoding {'zlib': False, 'shuffle': False, 'complevel': 0, 'fletcher32': False, 'contiguous': False, 'chunksizes': (1, 1500, 3600), 'source': 'file.nc', 'original_shape': (336, 1500, 3600), 'dtype': dtype('float32'), 'missing_value': -1e+20, '_FillValue': -1e+20} ds_test.var.encoding.update({'complevel': 2, 'shuffle': True}) ds_test.var.encoding {'zlib': False, 'shuffle': True, 'complevel': 2, 'fletcher32': False, 'contiguous': False, 'chunksizes': (1, 1500, 3600), 'source': 'file.nc', 'original_shape': (336, 1500, 3600), 'dtype': dtype('float32'), 'missing_value': -1e+20, '_FillValue': -1e+20} ds_test.to_netcdf('test.nc') ds_read = xr.open_dataset('test.nc') ds_read.var.encoding {'zlib': False, 'shuffle': False, 'complevel': 0, 'fletcher32': False, 'contiguous': False, 'chunksizes': (1, 1500, 3600), 'source': 'test.nc', 'original_shape': (336, 1500, 3600), 'dtype': dtype('float32'), 'missing_value': -1e+20, '_FillValue': -1e+20} ```

Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: None python: 3.9.7 (default, Sep 16 2021, 13:09:58) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 4.18.0-348.7.1.el8_5.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.1 libnetcdf: 4.8.1 xarray: 0.20.2 pandas: 1.3.5 numpy: 1.20.3 scipy: 1.7.3 netCDF4: 1.5.8 pydap: None bottleneck: 1.3.2 dask: 2021.12.0 distributed: 2021.12.0 matplotlib: 3.5.1 cartopy: 0.20.1 seaborn: None numbagg: None fsspec: 2021.11.1 cupy: None pint: None sparse: 0.13.0 setuptools: 58.0.4 pip: 21.2.4 conda: None pytest: None IPython: 7.31.0 sphinx: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.5.1.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6167/reactions",
    "total_count": 0,
    "+1": 0,
    "-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
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 0.95ms · About: xarray-datasette