-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Raise exception in to_dataset if resulting variable is also the name of a coordinate #8433
Conversation
This looks great, thanks @mgunyho . I'll merge in the next day or so unless anyone has feedback. Test failures are unrelated I think, will check they fal on main too |
I think we need to adjust the error message tests for the tests to pass |
Ah of course, I missed that! Fixed now. |
Thanks @mgunyho ! Unfortunately we also have a break in the docs — would you care to take a look? https://readthedocs.org/projects/xray/builds/22540466/ (This also likely means the docs were bad, so it's good news your code found it!) |
Huh, at a quick glance this seems like a problem with the error raising logic/my code rather than with the docs. I'll look into it tomorrow. |
0d1e86e
to
2042ef9
Compare
Yeah, the issue was indeed with my code, it didn't show up in the tests because |
I can't tell if the tests fail because of my code or something else. I changed the logic from |
To respond quickly though not fully — does the previous approach work? It may well require a specific order. If the former works well then that's fine... Thanks for adding more tests, really good we caught the issue prior |
I was also confused because I couldn't reproduce the error locally. But I changed it back to the original |
variables = variables_from_split | { | ||
k: v for k, v in self._coords.items() if k != dim | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this too weird, should I try to think of another way to express this?
Hm, at least the failures in https://github.com/pydata/xarray/actions/runs/6869006192/job/18680869980?pr=8433 and https://github.com/pydata/xarray/actions/runs/6860572749/job/18654637893?pr=8433 seem to be the same for both implementations, so maybe it's not my code but something else. |
Yep, here's the same failure from another PR: https://github.com/pydata/xarray/actions/runs/6865796013/job/18670620776?pr=8450 |
Super, thanks @mgunyho ! (Sorry for the test failures, hopefully those will resolve shortly...) |
* main: [skip-ci] dev whats-new (pydata#8467) 2023.11.0 Whats-new (pydata#8461) migrate the other CI to python 3.11 (pydata#8416) preserve vlen string dtypes, allow vlen string fill_values (pydata#7869) Pin mypy < 1.7 (pydata#8458) Fix typos found by codespell (pydata#8457) [skip-ci] Small updates to IO docs. (pydata#8452) Deprecate certain cftime frequency strings following pandas (pydata#8415) Added driver parameter for h5netcdf (pydata#8360) Raise exception in to_dataset if resulting variable is also the name of a coordinate (pydata#8433) Automatic region detection and transpose for `to_zarr()` (pydata#8434) remove `cdms2` (pydata#8441) Remove PseudoNetCDF (pydata#8446) Pin pint to >=0.22 (pydata#8445) Remove keep_attrs from resample signature (pydata#8444) Rename `to_array` to `to_dataarray` (pydata#8438) Add missing DataArray.dt.total_seconds() method (pydata#8435) Declare Dataset, DataArray, Variable, GroupBy unhashable (pydata#8392)
Let me know if you think the error message is unclear or too verbose or too fancy or something.
whats-new.rst