Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: add wraps_ufunc decorator #203

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tbody-cfs
Copy link

  • Closes #xxxx
  • Tests added
  • Passes pre-commit run --all-files
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

@tbody-cfs tbody-cfs marked this pull request as draft January 31, 2023 19:32
@tbody-cfs
Copy link
Author

Hi,
Thanks for making a great project — I've always wanted xarray to support pint units. Dropping here in case it's useful — I often need to use functions written for float or numpy arrays. To handle units I'd use ureg.wraps and to handle xarrays I'd use apply_ufunc. I've looked at the inner workings of ureg.wraps and tried to approximate it, adding in apply_ufunc.

If this seems helpful, I could tidy it up. If you've got a better way of doing this, I'd be very happy to hear :)

@tbody-cfs
Copy link
Author

This might be a duplicate of #143.

@keewis
Copy link
Collaborator

keewis commented Feb 14, 2023

thanks for the PR and sorry for the delay, @tbody-cfs. This is definitely something on our roadmap, but unfortunately I didn't have too much time to work on this in the past few months.

Indeed, this PR is a duplicate of #143, which as an initial version should be very close. However, I fear we didn't try using too much, yet, so the API might not be as useful as we thought it would be (and of course there might be bugs). If you want to help moving that forward, I think it would be great to just experiment with expects and report your findings in #143 (and post any questions / feedback you might have).

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.

2 participants