NCAR / ccpp-framework

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

Edge case for "none" unit conversions #567

Open peverwhee opened 1 month ago

peverwhee commented 1 month ago

Description

If a unit conversion involves "none", we get an error because "none" is a python keyword.

Steps to Reproduce

Using head of main, change the units for one instance of errmsg in one of the tests from "none" to "None"

Additional Context

We should have logic that can handle this, meaning:

  1. For "none" unit only, convert to lower case before comparing (to handle case differences)
  2. An exception to the "no python keywords allowed" rule for "none"? - so that if a user tries to convert "1" to "none" or something, they'll get a more helpful error.

Output

Error:

Invalid units entry, 'None', Python identifier, at...

Source of error: scripts/var_props.py", line 1172, in _get_unit_convstrs