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

Ouranosinc / xclim / 21262906040
92%

Build:
DEFAULT BRANCH: main
Ran 22 Jan 2026 08:02PM UTC
Jobs 0
Files 0
Run time –
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

pending completion
21262906040

push

github

web-flow
Fix `time_bnds` and fix for Pandas 3 (#2310)

### What kind of change does this PR introduce?

#### `time_bnds`
While fixing a Pandas v3 error, I also revisited the `time_bnds`
function. I'm not sure what I had in mind when implementing it, but it
was not following the CF conventions.

Example:
```python3
import xclim as xc
import xarray as xr

time = xr.date_range('2000-01-01', freq='MS', periods=3)
xc.core.calendar.time_bnds(time, 'MS')
```
Before: the end is the last timestep (up to a precision) before the next
period
```
[['2000-01-01T00:00:00.000000000', '2000-01-31T23:59:59.999999999'],
 ['2000-02-01T00:00:00.000000000', '2000-02-29T23:59:59.999999999'],
 ['2000-03-01T00:00:00.000000000', '2000-03-31T23:59:59.999999999']]
```
After: the end is the same as the start of the next period
```
[['2000-01-01T00:00:00.000000000', '2000-02-01T00:00:00.000000000'],
 ['2000-02-01T00:00:00.000000000', '2000-03-01T00:00:00.000000000'],
 ['2000-03-01T00:00:00.000000000', '2000-04-01T00:00:00.000000000']]
```

The `precision` argument as thus been removed.


#### Pandas v3
We had two other Pandas v3 issues:

In `aggregate_between_dates` we were modifying an array in-place
(`days[days < 0] = np.nan`) and this seems not to be possible anymore.
However, it has always been discouraged by xarray, so I changed it to a
`days.where(days >=0)`.

In the partitioning functions of `xclim.ensembles` we were creating new
coordinate by passing a `pd.Index`, this seems to be broken now that
pandas has implemented a new String dtype with nan support. Numpy does
not recognize that. Xarray should probably fix this by having an
automated translation, but in the meantime it was easy to fix by
creating the coordinate with `xr.DataArray` instead.


### Does this PR introduce a breaking change?
Yes, the `time_bnds` result is now different, an argument has been
removed.
Source Files on build 21262906040
Detailed source file information is not available for this build.
  • Back to Repo
  • Github Actions Build #21262906040
  • 8c575c4b on github
  • Prev Build on main (#21260067299)
  • Next Build on main (#21268476211)
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