Open Xarthisius opened 4 years ago
Just a head’s up that I’m taking time off from code development, if you all need this fixed for yt then a PR implementing a fix would be probably the quickest way to get a fix merged.
Also from what I remember we did add h
to yt’s default unit symbol table. In yt are you importing units from yt.units or from unyt directly? Keep in mind that yt.units and unyt have different units defined in their default namespaces. If you are getting this error despite inporting things from yt.units that seems incorrect to me, and might be a hint towars the source of the real issue.
h
is just one example of many similar failures. Here https://github.com/yt-project/yt/pull/2487 it was code_pressure
. I'm pretty sure we're importing from yt.units
, but why does it matter if we can reproduce the behavior outside of yt?
Well the example you used was with h
...
Would the same issue not happen with yt.units on the current master branch, I would think that even before unyt both sides would need to have the dataset’s unit registry to know about code_pressure
.
The reason I’m pushing back on this a bit is because it might be expensive to first check if the unit exists in the registry (a PR and benchmarks proving otherwise would change me mind though) and I think we were happy to work around that with yt.units. Could be wrong though, haven’t explicitly checked.
Hey, glad you're taking some time off. This suggestion has given me something to look into, so I'm trying to take a crack at it here before asking for anything else -- the issue we are actually seeing is the code_pressure
symbol missing, and I'll either have a fix I issue a PR to yt or one that I issue here.
Enjoy your time away!
Description
Order of operations (addition or multiplication) on quantities using two different unit systems for user defined units works only if user defined unit is used first.
As an example:
yields