home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 464315727

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
464315727 MDU6SXNzdWU0NjQzMTU3Mjc= 3080 Error in to_netcdf() 22454970 closed 0     2 2019-07-04T15:14:33Z 2023-09-16T08:28:12Z 2023-09-16T08:28:12Z NONE      

MCVE Code Sample

In order for the maintainers to efficiently understand and prioritize issues, we ask you post a "Minimal, Complete and Verifiable Example" (MCVE): http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports

```python import xarray as xr print(xr.version)

url = 'https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/dodsC/birdhouse/cccs_portal/indices/Final/BCCAQv2/tg_mean/YS/rcp26/simulations/BCCAQv2+ANUSPLIN300_bcc-csm1-1_historical+rcp26_r1i1p1_1950-2100_tg_mean_YS.nc' ds = xr.open_dataset(url, chunks={'time':50}) dsSel = ds.sel(lon= -80, lat= 50, method='nearest') outnc = 'tmp.nc' dsSel.to_netcdf(outnc)

```

Problem Description

This may be related to #2850 but I am unable to save to netcdf after performing a simple sel for certain .nc files (example file available via opendap link in the code) . Gives following error : Traceback (most recent call last): File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2961, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-492c82b08e81>", line 8, in <module> dsSel.to_netcdf(outnc) File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/xarray/core/dataset.py", line 1365, in to_netcdf compute=compute) File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/xarray/backends/api.py", line 886, in to_netcdf unlimited_dims=unlimited_dims) File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/xarray/backends/api.py", line 929, in dump_to_store unlimited_dims=unlimited_dims) File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/xarray/backends/common.py", line 269, in store self.set_attributes(attributes) File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/xarray/backends/common.py", line 285, in set_attributes self.set_attribute(k, v) File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/xarray/backends/netCDF4_.py", line 426, in set_attribute _set_nc_attribute(self.ds, key, value) File "/home/travis/.conda/envs/Xarray/lib/python3.6/site-packages/xarray/backends/netCDF4_.py", line 302, in _set_nc_attribute obj.setncattr(key, value) File "netCDF4/_netCDF4.pyx", line 2607, in netCDF4._netCDF4.Dataset.setncattr File "netCDF4/_netCDF4.pyx", line 1467, in netCDF4._netCDF4._set_att File "netCDF4/_netCDF4.pyx", line 1733, in netCDF4._netCDF4._ensure_nc_success AttributeError: NetCDF: String match to name in use

Expected Output

saved selection to .nc

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.15.0-54-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_CA.UTF-8 LOCALE: en_CA.UTF-8 libhdf5: 1.10.2 libnetcdf: 4.6.1 xarray: 0.12.2 pandas: 0.23.3 numpy: 1.15.4 scipy: 1.2.0 netCDF4: 1.4.0 pydap: None h5netcdf: 0.6.1 h5py: 2.8.0 Nio: None zarr: None cftime: 1.0.3.4 nc_time_axis: None PseudonetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.2.1 dask: 1.0.0 distributed: 1.25.2 matplotlib: 3.0.1 cartopy: None seaborn: None numbagg: None setuptools: 39.2.0 pip: 19.1.1 conda: None pytest: 3.8.1 IPython: 6.5.0 sphinx: 2.1.2
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3080/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

  • 1 row from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.584ms · About: xarray-datasette