Open TomNicholas opened 2 years ago
I was wondering whether pint.wraps
should be able to handle any object that defines pint-like methods and attributes, a question that's related to https://github.com/hgrecco/pint/issues/1099. That seems like a lot of work though, so we should probably just define our own function in pint-xarray.
Looks like we forgot to ensure that
@ureg.wraps
works - see this example (inspired by this story):which returns
I would expect some kind of
DimensionalityError
instead.It does not surprise me that passing an
xarray.DataArray
toa pint function does not work, but what does make no sense to me is that this still doesn't work even if I pass apint.Quantity
:Am I using pint wrongly somehow? I can't see how what I am doing is different from the example in the docs.
Either way this definitely isn't going to work as is because the code for
pint.registry_helpers.wraps
always returns apint.Quantity
.(Also if we are going to make our own version of this checking decorator can we call it something more informative than
wraps
? It's like calling a classKlass
... I suggest something like@check
,@verify
, or@expects
.)