Skip to content

Commit

Permalink
accept short and long form of soil_params (#7)
Browse files Browse the repository at this point in the history
Currently, several NOAA-OWP maintained BMI modules share the convention of using `soil_params.<x>` where x is a parameter name in the config file. However, when soil_params parameters are exposed as calibratable, the convention is to drop `soil_params` and just use the parameter name. To avoid confusion and increase consistency, this change enables specifying soil_params in SoilMoistureProfile config files using just their name. Support for the existing soil_params names is maintained.
  • Loading branch information
aaraney authored Apr 1, 2024
1 parent 2d61b86 commit ea16ed3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/soil_moisture_profile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ InitFromConfigFile(string config_file, struct soil_profile_parameters* parameter
}
continue;
}
else if (param_key == "soil_params.smcmax") {
// NOTE: `soil_params.smcmax` may be deprecated in the future in favor of `smcmax`
else if (param_key == "smcmax" || param_key == "soil_params.smcmax") {
if (param_value == "bmi" || param_value == "BMI") {
parameters->smcmax_bmi = true;
}
Expand All @@ -164,13 +165,15 @@ InitFromConfigFile(string config_file, struct soil_profile_parameters* parameter

continue;
}
else if (param_key == "soil_params.b") {
// NOTE: `soil_params.b` may be deprecated in the future in favor of `b`
else if (param_key == "b" || param_key == "soil_params.b") {
parameters->b = stod(param_value);
assert (parameters->b > 0);
is_b_set = true;
continue;
}
else if (param_key == "soil_params.satpsi") {
// NOTE: `soil_params.satpsi` may be deprecated in the future in favor of `satpsi`
else if (param_key == "satpsi" || param_key == "soil_params.satpsi") {
parameters->satpsi = stod(param_value);
is_satpsi_set = true;
continue;
Expand Down

0 comments on commit ea16ed3

Please sign in to comment.