• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Ouranosinc / xclim / 25939345955 / 1
92%
main: 92%

Build:
DEFAULT BRANCH: main
Ran 15 May 2026 08:30PM UTC
Files 60
Run time 3s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 May 2026 08:17PM UTC coverage: 91.036% (+0.05%) from 90.99%
25939345955.1

push

github

web-flow
Fix rate2amount error of 1000 when sampling inferred from cftime coord (#2357)

<!--Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the
AUTHORS.rst! -->
### Pull Request Checklist:
- [ ] This PR addresses an already opened issue (for bug fixes /
features)
    - This PR fixes #xyz
- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] (If applicable) Documentation has been added / updated (for bug
fixes / features)
- [x] CHANGELOG.rst has been updated (with summary of main changes)
- [x] Link to issue (:issue:`number`) and pull request (:pull:`number`)
has been added

### What kind of change does this PR introduce?
In `rate2amount` and `amount2rate`, when `sampling_rate_from_coord` is
True, which is implicit when the sampling freq is monthly or coarser, we
compute the length of the sampling period by taking the diff of the time
coordinate, we then convert the `timedelta` objects in seconds.

Previously, both time types (`numpy.datetime64` and `cftime`) yielded a
`timedelta64[ns]` dtype when subtracted. But, when pandas introduced
support for other units, xarray followed and now it will often return
`timedelta64[us]` in the cftime case.

This PR changes the conversion to be explicit, not simply assuming
nanoseconds.

### Does this PR introduce a breaking change?
No, it was broken before.

### Other information:
I'm afraid the changes in pandas and xarray are not so recent, so this
bug has been there for a while!!

@Zeitsperre I think this is a patch-release level seriousness (but
perhaps not urgent enough for releasing on a friday).

7871 of 8646 relevant lines covered (91.04%)

0.91 hits per line

Source Files on job run-3.13-macos-latest- - 25939345955.1
  • Tree
  • List 60
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 25939345955
  • 20440f83 on github
  • Prev Job for on main (#25683017529.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc