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

Ouranosinc / xclim / 25939345955
92%

Build:
DEFAULT BRANCH: main
Ran 15 May 2026 08:22PM UTC
Jobs 6
Files 60
Run time 1min
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.834% (+0.05%) from 91.788%
25939345955

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).

2 of 2 new or added lines in 1 file covered. (100.0%)

7940 of 8646 relevant lines covered (91.83%)

6.27 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-3.13-macos-latest- - 25939345955.1 15 May 2026 08:23PM UTC 60
91.04
GitHub Action Run
2 run-3.13-ubuntu-latest- - 25939345955.2 15 May 2026 08:23PM UTC 60
88.03
GitHub Action Run
3 run-3.14-ubuntu-latest- - 25939345955.3 15 May 2026 08:22PM UTC 60
88.03
GitHub Action Run
4 run-3.10-ubuntu-latest- - 25939345955.4 15 May 2026 08:23PM UTC 60
88.04
GitHub Action Run
5 run-{{ matrix.python-version }}-conda - 25939345955.5 15 May 2026 08:24PM UTC 60
91.42
GitHub Action Run
6 run-3.12-ubuntu-latest- - 25939345955.6 15 May 2026 08:24PM UTC 60
88.68
GitHub Action Run
Source Files on build 25939345955
  • Tree
  • List 60
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #25939345955
  • 20440f83 on github
  • Prev Build on main (#25683017529)
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