use `"positive"` attribute in `differentiate` and `integrate`

Open
#190 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Start at the differentiate and integrate accessor entry points and trace how the coordinate is passed to xarray. Review how the positive attribute is represented, then determine the opt-in argument name, sign-handling behavior, and error case for missing metadata. Done means both operations consistently account for positive when enabled and reject enabled use without that attribute.

Written by the indexing model from the issue text.

Description

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

Dominant language
Python
Stars
181
Forks
49
Avg merge
43m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xarray-contrib/cf-xarray

All issues in xarray-contrib/cf-xarray

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.