support for units with pint
Open
Nobody has claimed this yet.
enhancement
topic-arrays
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
pint's implementation of NEP-18 (see hgrecco/pint#905) is close enough so we can finally start working on the pint support (i.e. make the integration tests pass). This would be the list of tasks to get there:
- integration tests:
- implement integration tests for
DataArray,Datasetand top-level functions (#3238, #3447, #3493) - add tests for
Variableas discussed in #3493 (#3654) - clean up the current tests (#3600)
- use the standard
assert_identicalandassert_allclosefunctions (#3611, #3643, #3654, #3706, #3975) - clean up the
TestVariable.test_padtests
- implement integration tests for
- actually get xarray to support units:
- top-level functions (#3611)
-
Variable(#3706)rolling_windowandidenticalneed larger modifications
-
DataArray(#3643) -
Dataset - silence all the
UnitStrippedWarningsin the testsuite (#4163) - try to get
nanprodto work with quantities - add support for per variable fill values (#4165)
-
reprwith units (#2773) - type hierarchy (e.g. for
np.maximum(data_array, quantity)vsnp.maximum(quantity, data_array)) (#3950)
- update the documentation
- point to pint-xarray (see #4530)
- mention the requirement for
UnitRegistry(force_ndarray=True)orUnitRegistry(force_ndarray_like=True)(see https://pint-xarray.readthedocs.io/en/stable/creation.html#attaching-units) - list the known issues (see https://github.com/pydata/xarray/pull/3643#issue-354872657 and https://github.com/pydata/xarray/pull/3643#issuecomment-602225731) (#4530):
pandas(indexing)bottleneck(bfill,ffill)scipy(interp)numbagg(rolling_exp)numpy.lib.stride_tricks.as_strided:rollingnumpy.vectorize:interpolate_na
-
update the install instructions (we can use standardthis should be done byconda/pipnow)pint-xarray
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the two unchecked tasks in the issue: making nanprod work with quantities and resolving the type hierarchy for mixed quantity operations. Start with the existing integration tests for DataArray, Dataset, Variable, and top-level functions, then run the relevant test suite. Done means both remaining behaviors work without regressions and the listed integration tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python
- Domain
- data, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100