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

Ouranosinc / xclim / 6436235218 / 2
90%
main: 92%

Build:
Build:
LAST BUILD BRANCH: eco-ci-project
DEFAULT BRANCH: main
Ran 06 Oct 2023 08:47PM UTC
Files 70
Run time 1s
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

06 Oct 2023 08:33PM UTC coverage: 90.01% (-0.002%) from 90.012%
6436235218.2

push

github

web-flow
Optimize huglin and bedd for dask with flox (#1495)

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

Changes the use of `aggregate_between_dates` to a
`select_time(...).resample().sum()`. One of the "strength" of
`aggregate_between_dates` is the possibility to have those days change
from year to year. In `huglin_index` and
`biologically_effective_degree_days`, we are using fixed start and end
dates, so I was able to perform the same operation with a simpler
function.

This change makes xarray aware of our resampling-sum computation and
thus, performance optimizations implemented by `flox` are made
accessible!

In order to preserve the signature and functionality, I had to make
`select_time` a bit more flexible so that we can choose if the bounds
are inclusive or not. (`aggregate_between_dates` has a non-inclusive
end-bound, which `select_time` is inclusive by default).

The results are different, but with a relative error around 1e-7, my
guess is that this comes from the optimization itself (`dask`) and
should be considered noise.

I think calendar support is preserved. I have found issues with using
leap years, non-uniform calendars, etc. However, this change now allows
passing `02-30` as a start or end date if the input uses `360_day`.
Haha, pretty sure that's almost useless, but it's there anyway.

The biggest difference is that the `xclim.indices` versions do not mask
incomplete periods anymore. With `aggregate_between_dates`, if the
`end_date` did not exist in the period, the output would be NaN. This is
not the case with `select_time`. The indicator is unchanged since the
missing check will mask the incomplete period.

### Does this PR introduce a breaking change?
I don't think the last element in a breaking change because:
- Indicators should always be used (especially if missing data are an
issue)
- I prefer that the indice doesn't perform "checks" that the indicator
should be doing

### Other informat... (continued)

8352 of 9279 relevant lines covered (90.01%)

0.9 hits per line

Source Files on job run-{{ matrix.tox-env }}-opt-slow - 6436235218.2
  • Tree
  • List 0
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 6436235218
  • 0e12a27f on github
  • Prev Job for on master (#6434444708.2)
  • Next Job for on master (#6487159996.1)
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