issues: 958557945
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
958557945 | MDU6SXNzdWU5NTg1NTc5NDU= | 5666 | netCDF failing roundtrip with unicode chars | 22784297 | closed | 0 | 1 | 2021-08-02T22:32:14Z | 2023-03-12T20:20:37Z | 2023-03-12T20:20:27Z | NONE | ProblemWhen directories contain unicode chars, Code```python import numpy as np import xarray as xr from pathlib import Path da = xr.DataArray(np.random.rand(2,3,3), coords=[('x', range(2)), ('y', range(3)), ('z', range(3))]) ds = xr.Dataset({'foo': da}) p = Path('test_λ850') / 'data.nc' p.parent.mkdir() ds.to_netcdf(p) # Successful file creation ds.to_netcdf(str(p)) # also works just fine.dsl = xr.open_dataset(p) # ERROR: as shown below with xr.open_dataset(p) as dsl: # ERRORpassdsl = xr.open_dataset(str(p)) # ERROR``` Returning error:```
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\api.py", line 501, in open_dataset backend_ds = backend.open_dataset( File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\netCDF4_.py", line 547, in open_dataset store = NetCDF4DataStore.open( File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\netCDF4_.py", line 379, in open return cls(manager, group=group, mode=mode, lock=lock, autoclose=autoclose) File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\netCDF4_.py", line 327, in init self.format = self.ds.data_model File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\netCDF4_.py", line 388, in ds return self.acquire() File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\netCDF4.py", line 382, in acquire with self._manager.acquire_context(needs_lock) as root: File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\contextlib.py", line 117, in __enter__ return next(self.gen) File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\file_manager.py", line 187, in acquire_context file, cached = self._acquire_with_cache_info(needs_lock) File "C:\Users\<USER>\Miniconda3\envs\jupyter\lib\site-packages\xarray\backends\file_manager.py", line 205, in _acquire_with_cache_info file = self._opener(self._args, *kwargs) File "src\netCDF4_netCDF4.pyx", line 2307, in netCDF4._netCDF4.Dataset.init File "src\netCDF4_netCDF4.pyx", line 1925, in netCDF4._netCDF4._ensure_nc_success FileNotFoundError: [Errno 2] No such file or directory: b'C:\Users\<USER>\Documents\Projects\Jupyter\test\xce\xbb850\data.nc' ``` EnvironmentOutput of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.9.1 (default, Dec 11 2020, 09:29:25) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: English_United States.1252 libhdf5: 1.10.6 libnetcdf: 4.6.1 xarray: 0.18.0 pandas: 1.2.1 numpy: 1.20.2 scipy: 1.6.2 netCDF4: 1.5.7 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.5.0 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.3.2 cartopy: None seaborn: None numbagg: None pint: None setuptools: 52.0.0.post20210125 pip: 21.1.1 conda: None pytest: None IPython: 7.19.0 sphinx: None(One note is that I am using miniconda. The |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5666/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |