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

Ouranosinc / xclim / 12875104937 / 3
92%
main: 92%

Build:
DEFAULT BRANCH: main
Ran 20 Jan 2025 08:26PM UTC
Files 72
Run time 4s
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

20 Jan 2025 08:15PM UTC coverage: 82.16% (+0.007%) from 82.153%
12875104937.3

push

github

web-flow
Clean and export the units registry (#2040)

### What kind of change does this PR introduce?
* Remove support for non-CF aliases : "cms" (m3 s-1), "mmday" (mm d-1)
and "pct" (%). These are not supported by `udunits2` and thus I don't
see why we should support them ? @huard, @RondeauG what do you think ?
I'm not strongly opinionated on this.

* Set the unit registry as pint's "application registry" to make it
usable by non-xclim aware applications. To be obtained with `ureg =
pint.get_application_registry()`.

* Units of quantities printed in indicator attributes are now formatted
using the CF syntax (ex: "mm d-1" instead of "mm/d"). Not sure how I
missed that earlier...

* Clean up in the code of the registry declaration and addition of
comments to explain what is happening.

* A small change in `dataflags` that was actually unneeded at the end,
but it felt cleaner to me, so I kept it.

### Does this PR introduce a breaking change?
Some units are not supported anymore (`cms`, `pct` and `mmday`).
Some attributes will be different as the units are printed differently
(for fractions mostly).

### Other information:
The registry export allows an application/module that is units-agnostic
in itself, to be used with xclim. For those applications / usages, the
import order might be significant though : `xclim` has to be the last
`set_application_registry` done. Specifically in the climate case, as
`xclim.core.units` imports `cf_xarray.units` (which also sets the app
registry), a subsequent `import cf_xarray.units` is not problematic as
python will _not_ actually execute it.

8695 of 10583 relevant lines covered (82.16%)

0.82 hits per line

Source Files on job run-3.10-windows-latest-py310-coverage-prefetch - 12875104937.3
  • Tree
  • List 72
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 12875104937
  • 2bf86068 on github
  • Prev Job for on main (#12872165263.1)
  • Next Job for on main (#12952387084.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