Skip to content

Commit

Permalink
changed stod -> stoi for num_soil_types, removed 25 that was added as…
Browse files Browse the repository at this point in the history
… an upper limit on num_soil_type as the default is already there.
  • Loading branch information
ajkhattak authored and hellkite500 committed Sep 12, 2024
1 parent 6aab346 commit d768ac3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A detailed description of the parameters for model configuration (i.e., initiali
| forcing_resolution | double (scalar)| - | sec/min/hr | temporal resolution | - | timestep of the forcing data. Recommended value of 3600 seconds. |
| endtime | double (scalar)| >0 | sec, min, hr, d | simulation duration | - | time at which model simulation ends |
| layer_soil_type | int (1D array) | - | - | state variable | - | layer soil type (read from the database file soil_params_file) |
| max_valid_soil_types | int | >= 1 and <= 25 | - | - | - | maximum number of valid soil types read from the file soil_params_file (default is set to 12; model not valid for soil_type = waterbody, lava, glacier, etc.) |
| max_valid_soil_types | int | >1 | - | - | - | maximum number of valid soil types read from the file soil_params_file (default is set to 12; model not valid for soil_type = waterbody, lava, glacier, etc.) |
| wilting_point_psi | double (scalar) | - | cm | state variable | - | wilting point (the amount of water not available for plants) used in computing AET. Suggested value is 15495.0 cm, corresponding to 15 atm. |
| field_capacity_psi | double (scalar) | - | cm | state variable | - | capillary head corresponding to volumetric water content at which gravity drainage becomes slower, used in computing AET. Suggested value is 340.9 cm for most soils, corresponding to 1/3 atm, and 103.3 cm for sands, corresponding to 1/10 atm. |
| use_closed_form_G | bool | true or false | - | - | - | determines whether the numeric integral or closed form for G is used; a value of true will use the closed form. This defaults to false. |
Expand Down
10 changes: 6 additions & 4 deletions src/lgar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ extern void InitFromConfigFile(string config_file, struct model_state *state)
continue;
}
else if (param_key == "max_valid_soil_types") {
state->lgar_bmi_params.num_soil_types = fmax(stod(param_value), 25.0);
state->lgar_bmi_params.num_soil_types = stoi(param_value);
is_max_valid_soil_types_set = true;
continue;
}
Expand Down Expand Up @@ -569,9 +569,11 @@ extern void InitFromConfigFile(string config_file, struct model_state *state)
//assert (state->lgar_bmi_params.layer_soil_type[layer] <= max_num_soil_in_file);
if (state->lgar_bmi_params.layer_soil_type[layer] > state->lgar_bmi_params.num_soil_types) {
state->lgar_bmi_params.is_invalid_soil_type = true;
std::cerr << "Invalid soil type: "
<< state->lgar_bmi_params.layer_soil_type[layer]
<<". Model returns input_precip = ouput_Qout. \n";
if (verbosity.compare("high") == 0) {
std::cerr << "Invalid soil type: "
<< state->lgar_bmi_params.layer_soil_type[layer]
<<". Model returns input_precip = ouput_Qout. \n";
}
break;
}
}
Expand Down

0 comments on commit d768ac3

Please sign in to comment.