question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support for units with pint

See original GitHub issue

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, 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 and assert_allclose functions (#3611, #3643, #3654, #3706, #3975)
    • clean up the TestVariable.test_pad tests
  • actually get xarray to support units:
    • top-level functions (#3611)
    • Variable (#3706)
      • rolling_window and identical 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) vs np.maximum(quantity, data_array)) (#3950)
  • update the documentation

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:14
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dcheriancommented, Jul 20, 2022

@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.

1reaction
keewiscommented, Dec 4, 2019

What does this mean? You can’t have units in a IndexVariable?

yes, we had that discussion from https://github.com/pydata/xarray/issues/525#issuecomment-514452182 on. Short version: pd.Index converts using np.asarray and support for units probably requires #1603.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found