marbl-ecosys / MARBL

Marine Biogeochemistry Library
https://marbl-ecosys.github.io
Other
14 stars 25 forks source link

MARBL_settings_class assumes units in input_file match YAML, not unit_system #444

Open mnlevy1981 opened 11 months ago

mnlevy1981 commented 11 months ago

If I am running CESM+MOM6, I can use user_nl_marbl to change variable values in marbl_in. Since MOM6 is in mks, I want to use mks values in user_nl_marbl, but the python script that generates marbl_in will assume user_nl_marbl will provide values in the units defined in the settings YAML file (which is cgs for the most part).

Here's a concrete example -- parm_POC_diss is defined in the YAML as

   parm_POC_diss :
      defined_if : base_bio_on
      longname : Base POC dissolution length scale
      subcategory : 5. general parameters (dissolution)
      units : cm
      datatype : real
      default_value : 100e2

In MOM6, this default value is correctly appears in marbl_in as parm_POC_diss = 1.0000000000000000e+02 because we convert the default value to mks. However, if I set

parm_POC_diss = 150

in user_nl_marbl, then marbl_in contains parm_POC_diss = 1.5000000000000000e+00 rather than the desired parm_POC_diss = 1.5000000000000000e+02. The fix is to return a scale factor of 1. to _translate_JSON_value() if the variable came from an input file.