Skip to content

FIX: Keep the column datetime unit when re-binning gauge accumulations - #44

Merged
rcjackson merged 1 commit into
ARM-Development:mainfrom
rcjackson:accumulation_dtype_fix
Sep 14, 2026
Merged

rcjackson merged 1 commit into
ARM-Development:mainfrom
rcjackson:accumulation_dtype_fix

Conversation

@rcjackson

Copy link
Copy Markdown
Collaborator

Fixing an issue where the column datetime unit was dropped when re-binning gauge accumulations, to ensure compatibility for older xarray. Co-written by Claude Opus 5.

_apply_match raised IndexError: dimension coordinate 'time' conflicts
between indexed and indexing objects, taking five tests in
test_radclss.py down on every platform since ARM-Development#42 merged. The scheduled
run hours before that merge was green.

A column time coordinate is built from base_time, which carries second
resolution. _accumulate_to_grid subtracted a pandas Timedelta from it to
form the leading interpolation edge, and to_timedelta64 carries
sub-second precision, so the subtraction promoted the whole edges array
to nanoseconds. interp handed that unit to the result, and _apply_match
then tried to write a nanosecond-stamped result into a second-resolution
column. The timestamps were identical; only the unit differed.

Whether that is fatal depends on the xarray version, which is why it
never reproduced locally. xarray 2025.6.1, which CI pins, compares
coordinates by dtype as well as by value and rejects the write. Newer
xarray compares by value and accepts it.

The existing tests could not catch this: they build column grids with
pd.date_range, which is always nanoseconds, so the promotion is
invisible. The new test uses a second-resolution grid like the real
pipeline and asserts on dtype directly, so it holds on any xarray
version rather than relying on one to raise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rcjackson
rcjackson merged commit fee4507 into ARM-Development:main Sep 14, 2026
11 of 13 checks passed
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

Successfully merging this pull request may close these issues.

1 participant