cf-xarray
cf-xarray copied to clipboard
use `"positive"` attribute in `differentiate` and `integrate`
The 'positive': 'up'
or 'positive': 'down'
attribute should be taken into account when calculating derivatives.
I think we could add .cf.differentiate(..., fix_sign=True)
(default False) as an opt-in to this approach. In practice, I think we just fix the sign of the coordinate variable before passing it on to xarray.
Thoughts on adding this?
I think we could come up with a better kwarg name.
I think it should raise an error if fix_sign is True and "positive" not in attrs
Sounds good to me.
Just one thought about adding kwargs to xarray functions.
Maybe it's easier if we always use the same kwarg, either a bool (like use_cf
) or a dict (like cf_kwargs
)?
It might make more clear what is added by cf_xarray
and easier to switch on/off all cf_xarray
extra features.