Hi all,

I just put in a PR for unyt that if it's merged will be a big behavior change for unyt. We're planning to make yt.units use unyt under the hood, so eventually this would be a big behavior change for yt.units as well. I figured it would be worth pinging yt-dev about this in case people have concerns. If you'd like to weigh in on this please speak up over on the pull request.

The PR is here:

https://github.com/yt-project/unyt/pull/58

-Nathan

More details:

The PR adds a new simplify() method on Unit objects to automatically cancel units in unit expressions when possible. So far only canceling of terms with inverse dimensions has been implemented but in principle this could be elaborated upon.

Rather than hide this behind a function you have to call, I've also made it so that if you do e.g. something like this:

  >>> from unyt import Watt, minute, hour
  >>> power = [20, 40, 80] * erg / minute
  >>> elapsed_time = 3*hour

Then you get back something like this when you try to find the total energy expended:

  >>> print(power*elapsed_time)
  [ 3600.  7200. 14400.] erg

Before my pull request you would have gotten a result in erg * hour / minute.