-
Notifications
You must be signed in to change notification settings - Fork 55
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
Unpin Xarray: dataArray -> dataArray.variable #492
Conversation
Test errors appear to arise in most recent xarray (2023.10.1) interaction with existing tests
Calls:
Throws: If dims are omitted from xarray arguments Issue appears to be arising from |
Current test failure: Throws the error
ValueError originates in xarray
It throws an invalid ValueError. As an invalid Timedelta string, the error can be replicated as
The current issue appears to arise as a result of xarray not entirely deprecating loffset (as of version 2023.10.1 with pydata/xarray#7444) so invalid arguments are internally passed to pandas (as of version 2.1.2) which has deprecated loffset |
Looks like handling of the time offset arithmetic (as needed for pydata/xarray#7596) is different for cftime. Probably why |
I think this is a little more nuanced. The xarray fix to postpone the deprecation of the loffset argument should still work for most cases, but a later PR introduced a line that converts the loffset argument to a pandas timedelta (via pd.to_timedelta) and that fails since "MS" is invalid input. Unfortunately, this means that the xarray resample/loffset fix no longer works for us and as mentioned above and shown in the CI failures the time offset arithmetic is a little more complicated in this case. I'm not sure the nuance here really changes a lot, but I might go log an issue on xarray in case someone else runs into this. |
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.
Don't forget the pin in setup.cfg
!
EDIT: also, why are there changes to interpolation.py
here? Are those intentional?
Having missed some version pins myself recently... I think this version pin is also in some additional *.yml files and the requirements.txt in addition to the setup.cfg |
The changes to
|
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.
The changes here all look reasonable to me (introducing more private API from xarray is non-ideal, but should be less of a risk with expanded upstream testing and hopefully we do something different in the long run).
I do think we should better document the change in interpolation.py and the loffset change. At least including them in the PR description and changing the title and release notes blurb to something more inclusive of the changes here.
Probably a good idea to open another issue about Xarray private API as well since we'll be introducing more rather than removing it.
Will be nice to see this get merged though!
Added an issue to the backlog (#508) to come back to these changes in the future |
docs/release-notes.rst
Outdated
@@ -23,12 +23,14 @@ Documentation | |||
Bug Fixes | |||
^^^^^^^^^ | |||
* Fix Python version in upstream CI by `Philip Chmielowiec`_ in (:pr:`436`) | |||
* Unpin xarray in enviroment builds with changes to interpolation.py (specify dims in xr.DataArray) and climatologies.py (replace loffset with to_offset) by `Cora Schneck`_ in (:pr:`381`) |
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.
I think this still needs to get bumped up to a v2023.11.0 (unreleased) section.
Otherwise, things look good to me!
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.
Seconded, I'll approve after this, too!
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.
Looks good!
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.
Sorry, I missed the re-review request, this looks good!
PR Summary
Closes #381
PR Checklist
General
closes #XXX
to the PR description where XXX is the number of the issue.docs/release-notes.rst
in a relevant section for the next unreleased release. Possible sections include: Documentation, New Features, Bug Fixes, Internal Changes, Breaking Changes/Deprecatedprecommit
. To set up on your local, runpre-commit install
from the top level of the repository. To manually run pre-commits, usepre-commit run --all-files
and re-add any changed files before committing again and pushing.