Closed DWesl closed 2 weeks ago
Attention: Patch coverage is 78.94737%
with 4 lines
in your changes missing coverage. Please review.
Project coverage is 85.51%. Comparing base (
a9cebee
) to head (4c3ce70
). Report is 12 commits behind head on main.:exclamation: Current head 4c3ce70 differs from pull request most recent head 354b0ea
Please upload reports for the commit 354b0ea to get more accurate results.
Files | Patch % | Lines |
---|---|---|
cf_xarray/accessor.py | 78.94% | 3 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks for the PR.
However, I don't think I will merge this. I'd prefer that pint
handle these unit transformations instead. Is there a reason pint
doesn't work for you?
I suppose I could make my own function to wrap the ds.differentiate()
call and use pint to update the units
attribute afterwards, but I've gotten used to using the xarray method, and the accessors aren't all that different.
If you'd prefer I move this to pint-xarray rather than cf-xarray, I can do that.
I guess the problem here is that units on indexed coordinates are not supported yet, which would require movement on https://github.com/xarray-contrib/pint-xarray/pull/163. In any case, I think this should be solved with the pint/xarray integration not cf-xarray. If you have units not recognized by pint, then I'm happy to merge a change to fix that.
Differentiating a field results in a field whose units are the quotient of those of the original field with the units of the field with respect to which the derivative was taken. This PR adds code to update the units of the derivative to reflect that.
The helper function should simplify adding similar functionality for integrate and cumulative_integrate.
Should I add validation that neither unit is the empty string, since that breaks parsing?