NCAR / ccpp-framework

Common Community Physics Package (CCPP)
http://www.dtcenter.org/community-code/common-community-physics-package-ccpp/
Other
26 stars 63 forks source link

Fix unit converter problem with units = 1 #460

Closed gold2718 closed 1 year ago

gold2718 commented 1 year ago

Fix unit converter problem with units = 1

In order for the unit converter to be able to attempt a unit conversion where one variable has units = 1, a special case has been added where the digit, 1, is converted to the string one (a valid Python identifier).

User interface changes?: No

Fixes: #458, Unit converter does not handle a variable with units = 1

Testing: unit tests: run with a new test added to test this functionality. system tests: ./test/runtests.sh (is that unit, system, or both?)_ manual testing: NA Note that var_action_test is a known fail for this PR.

gold2718 commented 1 year ago

Replaces #459

gold2718 commented 1 year ago

Note that I did no add any conversion between 1 and any other unit (including None) but at least now you get the intended error from the unit converter.

ligiabernardet commented 1 year ago

Yes. Perhaps @mkavulich can implement it once re returns from leave.