Skip to content
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

If has both x/y and lat/lon, it fails #18

Open
ahuang11 opened this issue Jul 20, 2023 · 2 comments
Open

If has both x/y and lat/lon, it fails #18

ahuang11 opened this issue Jul 20, 2023 · 2 comments

Comments

@ahuang11
Copy link
Contributor

Example dataset: https://downloads.psl.noaa.gov/Datasets/NARR/Monthlies/monolevel/albedo.mon.mean.nc

  File "/Users/ahuang/repos/titiler-xarray/titiler/xarray/reader.py", line 52, in get_variable
    ds = ds.rename({"lat": "y", "lon": "x"})
  File "/Users/ahuang/miniconda3/lib/python3.10/site-packages/xarray/core/dataset.py", line 3647, in rename
    return self._rename(name_dict=name_dict, **names)
  File "/Users/ahuang/miniconda3/lib/python3.10/site-packages/xarray/core/dataset.py", line 3614, in _rename
    variables, coord_names, dims, indexes = self._rename_all(
  File "/Users/ahuang/miniconda3/lib/python3.10/site-packages/xarray/core/dataset.py", line 3569, in _rename_all
    variables, coord_names = self._rename_vars(name_dict, dims_dict)
  File "/Users/ahuang/miniconda3/lib/python3.10/site-packages/xarray/core/dataset.py", line 3529, in _rename_vars
    raise ValueError(f"the new name {name!r} conflicts")
ValueError: the new name 'x' conflicts
@abarciauskas-bgse
Copy link
Contributor

@ahuang11 apologies I'm just taking a look at this issue. Is it common for a dataset to have both x/y and lat/lon? I have not seen this before.

@ahuang11
Copy link
Contributor Author

Some datasets do. As an example if I'm not mistaken: xr.tutorial.open_dataset("rasm")

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

No branches or pull requests

2 participants