-
-
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
fix upstream dev issues #9953
fix upstream dev issues #9953
Conversation
@@ -579,20 +579,23 @@ def _numbers_to_timedelta( | |||
) -> np.ndarray: | |||
"""Transform numbers to np.timedelta64.""" | |||
# keep NaT/nan mask | |||
nan = np.isnan(flat_num) | (flat_num == np.iinfo(np.int64).min) | |||
if flat_num.dtype.kind == "f": |
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.
That's a bit more explicit. The asarray-wrapping is needed for upstream-dev to keep 0d-arrays an array.
|
||
# in case we need to change the unit, we fix the numbers here | ||
# this should be safe, as errors would have been raised above | ||
ns_time_unit = _NS_PER_TIME_DELTA[time_unit] | ||
ns_ref_date_unit = _NS_PER_TIME_DELTA[ref_unit] | ||
if ns_time_unit > ns_ref_date_unit: | ||
flat_num *= np.int64(ns_time_unit / ns_ref_date_unit) | ||
flat_num = np.asarray(flat_num * np.int64(ns_time_unit / ns_ref_date_unit)) |
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.
For pandas 3.0 CoW (copy on write) this array might be flagged readonly. So creating a copy here. The asarray-wrapping is needed for upstream-dev to keep 0d-arrays an array.
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.
Very nice @kmuehlbauer, thanks—great that pandas 3 will convert datetime.datetime
objects to microsecond-resolution np.datetime64
values.
The upstream build failure with the latest commit looks to be unrelated—a hopefully transient issue installing NumPy—and it passed with the commit prior.
Thanks for checking @spencerkclark. I'll merge later today, if no one beats me to it. |
@pydata/xarray There is something strange going on wrt to the failing test (linux/macos py 3.12): ERROR xarray/tests/test_distributed.py::test_dask_distributed_zarr_integration_test[True-True]
- Failed: 5 thread(s) were leaked from test This surfaced some days ago, first only on linux then also on macos. Since many things have changed in the recent days (ubuntu-latest 22.04-> 24.04, zarr 2 -> zarr 3 with dependency change) this is very difficult to debug. As everything works well for our upstream-dev, it really looks like an upstream issue which was already fixed in the dev versions. Another reason might be some inconsistent conda dependencies which would equally painful to debug. |
Going to merge now, to unblock the upstream-dev runs again (and nightly run). |
whats-new.rst