Skip to content

open_dataset regression #5098

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

Closed
dcherian opened this issue Mar 31, 2021 · 2 comments · Fixed by #5135
Closed

open_dataset regression #5098

dcherian opened this issue Mar 31, 2021 · 2 comments · Fixed by #5135
Assignees

Comments

@dcherian
Copy link
Contributor

What happened:

open_dataset doesn't replace ~ any more

What you expected to happen:

should replace ~ for backward compatibility

Minimal Complete Verifiable Example:

import xarray as xr

da = xr.DataArray([1, 2, 3])
da.to_netcdf("~/bug_report.nc")

xr.open_dataarray("~/bug_report.nc")

Anything else we need to know?:
works on 0.17.0, fails on master

@aurghs
Copy link
Collaborator

aurghs commented Apr 1, 2021

I think that this is consequence of the refactor done by @alexamici when he has removed _normalize_path: #4701
We decided to demand the path interpretation to the backends.

I'll have a look to understand how to fix it.

@alexamici
Copy link
Collaborator

alexamici commented Apr 2, 2021

The reason to delegate all path normalisation to backends is that not all strings are paths, for example 'NETCDF:"~/sst.nc":tos' is a valid source string for GDAL / rasterio.

I would suggest to add path normalisation to the backends that needs them, in order to avoid any special case in the common code path.

@aurghs I suggest you add os.path.expanduser in the netCDF backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants