pint-xarray icon indicating copy to clipboard operation
pint-xarray copied to clipboard

Relations between arguments in @expects decorator

Open TomNicholas opened this issue 3 years ago • 1 comments

#143 should ideally add functionality for relations between units of input arguments, in the same way that pint.ureg.wraps does. This seems quite complicated though, so I think we should leave it to a separate PR. I wonder if the neatest way to fix it would involve some upstream changes in pint?

TomNicholas avatar Jan 20 '22 17:01 TomNicholas

I didn't know about that, but this sounds useful!

If we use Signature.bind and BoundArguments.arguments, getting the names of the arguments shouldn't be too difficult. expects is a bit more complicated than wraps since we use dicts to represent xarray objects (and thus the syntax of the relationship needs to allow for something like arg.attribute), but that shouldn't be too much trouble either.

I definitely agree with you that we shouldn't hold back #143 even more than we already have, so this should be done in a different PR.

keewis avatar Feb 26 '22 18:02 keewis