-
Notifications
You must be signed in to change notification settings - Fork 4
Bump xarray from 2024.3.0 to 2025.1.2 #378
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
Changes from all commits
bc3a0c9
72ab4f6
26bfb17
a4d819d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,11 +258,11 @@ def test_weitzman_min(menu_instance): | |
| diff = censored_values_slower[0:index] - censored_values[0:index] | ||
| assert all(x > 0 for x in diff) | ||
| as_share = menu_instance.weitzman_min( | ||
| [20, 50, 100], [5, 30, 60], as_share | ||
| np.array([20, 50, 100]), np.array([5, 30, 60]), as_share | ||
| ) # the first value only should be censored | ||
| assert as_share[0] != 5 and [as_share[1], as_share[2]] == [30, 60] | ||
| all_cons = menu_instance.weitzman_min( | ||
| [20, 50, 100], [5, 30, 60], all_cons | ||
| np.array([20, 50, 100]), np.array([5, 30, 60]), all_cons | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A test was failing because of the default python lists. Nowhere in the code do we pass the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems good enough, especially if that's how this is documented. A more involved workaround may be another issue/PR. What was it erroring on? Do you have a copy of the error anywhere?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the error:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool. Thanks. I think the original fix is fine. The other aggressive approach might be to cast no_cc_consumption and cc_consumption to xr.DataArray at the start of the function like: no_cc_consumption = xr.DataArray(no_cc_consumption)
cc_consumption = xr.DataArray(cc_consumption)That might have side-effects for edge cases and it feels kinda magical for an internal-ish function. Could be a solution if this PR's fix accidentally breaks things. |
||
| ) # all values should be changed | ||
| assert all([x != 0 for x in all_cons - [5, 30, 60]]) | ||
|
|
||
|
|
||
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.
It seems like the xarray previously automatically updated the datatype when appending additional GCMs. With the update to xarray 2025.1.2 this broke and the code was throwing an error when trying to append a GCM with shorter name. This change ensures that all GCMs use the same datatype.
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.
astype("unicode")is pretty old (like, python 2) way of handling this because python strings at the time were not natively unicode. Would swapping all these over toastype("str")fix this and hopefully not create trouble elsewhere? I think this would use a variable-length string representation -- meaning you don't need all this manual checking for max string length in a GCM name.