support for units with pint
See original GitHub issuepint
’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
,Dataset
and top-level functions (#3238, #3447, #3493) - add tests for
Variable
as discussed in #3493 (#3654) - clean up the current tests (#3600)
- use the standard
assert_identical
andassert_allclose
functions (#3611, #3643, #3654, #3706, #3975) - clean up the
TestVariable.test_pad
tests
- implement integration tests for
- actually get xarray to support units:
- top-level functions (#3611)
-
Variable
(#3706)rolling_window
andidentical
need larger modifications
-
DataArray
(#3643) -
Dataset
- silence all the
UnitStrippedWarnings
in the testsuite (#4163) - try to get
nanprod
to work with quantities - add support for per variable fill values (#4165)
-
repr
with 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
:rolling
numpy.vectorize
:interpolate_na
- ~update the install instructions (we can use standard
conda
/pip
now)~ this should be done bypint-xarray
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Pint: makes units easy — pint 0.20.1 documentation
New to Pint? Check out the getting started guides. They contain an introduction to Pint's main concepts and links to additional tutorials. ......
Read more >Pint - Operate and manipulate physical quantities in Python
Pint is a Python package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement....
Read more >Unit Conversion with Python and the Pint Package
Learn how to convert between different units of measurement with Pint, a Python package designed for working with various quantities.
Read more >Pint: a Python units library (with NumPy support) - Reddit
50 votes, 31 comments. 1.1M subscribers in the Python community. News about the programming language Python. If you have something to teach others…...
Read more >19. Using pints for units in python - YouTube
It's critical to keep track of units in scientific computing. Fortunately, python has a few options for tracking and converting units.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@keewis Shall we close this? It seems the only outstanding one is
nanprod
with quantities. Which sort of indicates that we’ve made the necessary big changes.yes, we had that discussion from https://github.com/pydata/xarray/issues/525#issuecomment-514452182 on. Short version:
pd.Index
converts usingnp.asarray
and support for units probably requires #1603.