Skip to content

Converters - #15

Merged
leroyvn merged 6 commits into
mainfrom
converters
Nov 2, 2025
Merged

Converters#15
leroyvn merged 6 commits into
mainfrom
converters

Conversation

@leroyvn

@leroyvn leroyvn commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

This PR polishes converters. Changes are as follows:

  • The ensure_units() converter is cleaned up and extended with a deferred version that allows using it as a functor. It is relocated to the converters module. The util.ensure_units() alias is kept for compatibility.
  • The to_units() converter is deprecated in favour of ensure_units().
  • A to_quantity() converter is added and allows converting dicts and DataArrays to Pint quantities.
  • Doctests embedded in docstrings are supported.

* Move again `ensure_units()` to the `converters` module
* Add a deferred version of `ensure_units()`
* Deprecate `to_units()` in favour of `ensure_units()`
* Deprecate `util.ensure_units()` in favour of `converters.ensure_units()`
* Add `to_quantity()` converter
@leroyvn
leroyvn force-pushed the converters branch 2 times, most recently from 9ed1343 to 7952295 Compare November 2, 2025 23:28
@leroyvn
leroyvn merged commit 394bfdd into main Nov 2, 2025
7 checks passed
@leroyvn
leroyvn deleted the converters branch November 2, 2025 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant