Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for short and long soil_params names in config #100

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

aaraney
Copy link
Member

@aaraney aaraney commented Jan 2, 2024

Currently, several NOAA-OWP maintained BMI modules (see NOAA-OWP/SoilFreezeThaw#14 (comment)) share the convention of using soil_params.<x> where x is a parameter name in their config file format. 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 calibratable cfe soil_params in config files using just their name. Support for the existing soil_params names is maintained.

This PR adds support for specifying calibratable soil_params using their short form. The config readme is updated and clarifies what calibratable parameter names are used when passing to and from BMI.

Changes

  • The following parameters can be specified using either name in a config file:
    alpha_fc <=> soil_params.alpha_fc
    b <=> soil_params.b
    maxsmc <=> soil_params.maxsmc
    satdk <=> soil_params.satdk
    satpsi <=> soil_params.satpsi
    slope <=> soil_params.slope
    wltsmc <=> soil_params.wltsmc
    Klf <=> K_lf

@aaraney aaraney requested a review from ajkhattak January 2, 2024 15:41
configs/README.md Outdated Show resolved Hide resolved
configs/README.md Outdated Show resolved Hide resolved
> Note, calibratable parameters are passed via BMI using the _name next to the asterisk_.
>
> Slashes (/) in the variable column denote that a parameter can be specified using either name.
> For example, `soil_params.b` can equivalently be provided as `b`.

| Variable | Datatype | Limits | Units | Role | Process | Description |
| -------- | -------- | ------ | ----- | ---- | ------- | ----------- |
| forcing_file | *char* | 256 | | filename | | path to forcing inputs csv; set to `BMI` if passed via `bmi.set_value*()` |
| soil_params.depth | *double* | | meters [m]| state | | soil depth |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, we should follow the same style for soil_params.depth as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an ideal world, I would have added short forms of all of the soil_params, but I couldn't for soil_params.expon because expon already exists... so, I only added short forms for calibratable parameters. @ajkhattak, thoughts on how to get around this?

Copy link
Contributor

@ajkhattak ajkhattak Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I see what you mean... Let's discuss it with other folks. I would suggest something like

soil_param_name (e.g., soil_storage)
gw_param_name (e.g., gw_storage)

since the parameter expon is used in both soil and groundwater reservoirs, so following the above, we use
soil_expon and gw_expon.

we can update the names for calibratable parameters too, so they are consistent with their names in the config file.

@SnowHydrology @hellkite500

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if there is a need for this addition file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I am on the fence. I added it so you could run tests with a config that uses short form names. Also could serve as a reference for people who are setting up the module. Thoughts? Im happy to remove it if you are adamant.

@@ -583,7 +583,7 @@ int read_init_config_cfe(const char* config_file, cfe_state_struct* model)
}
continue;
}
if (strcmp(param_key, "soil_params.smcmax") == 0 || strcmp(param_key, "soil_params.maxsmc") == 0) {
if (strcmp(param_key, "maxsmc") == 0 || strcmp(param_key, "soil_params.smcmax") == 0 || strcmp(param_key, "soil_params.maxsmc") == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have maxsmc but not smcmax, they are used interchangeably, so better to add it as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I only added maxsmc because that is the name of the calibratable parameter. I thought including a short form name would be more confusing. I guess alternatively we could change the calibratable parameter name to smcmax?

src/bmi_cfe.c Outdated Show resolved Hide resolved
@aaraney
Copy link
Member Author

aaraney commented Jan 16, 2024

Thanks for the review, @ajkhattak! I'm AFK at the moment, but will get these resolved and pushed up today.

Currently, several NOAA-OWP maintained BMI modules
(see NOAA-OWP/SoilFreezeThaw#14 (comment))
share the convention of using `soil_params.<x>` where `x` is a parameter
name in their config file format. 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 _calibratable_ cfe
soil_params in config files using just their name. Support for the
existing soil_params names is maintained.

alpha_fc <=> soil_params.alpha_fc
b <=> soil_params.b
maxsmc <=> soil_params.maxsmc
satdk <=> soil_params.satdk
satpsi <=> soil_params.satpsi
slope <=> soil_params.slope
wltsmc <=> soil_params.wltsmc
Klf <=> K_lf
@aaraney aaraney force-pushed the support-short-and-long-soil-params-in-config branch from 962da98 to 77b6c8e Compare January 16, 2024 17:31
@aaraney
Copy link
Member Author

aaraney commented Jan 16, 2024

@ajkhattak, just pushed up some changes and responded to your comments.

@aaraney aaraney requested a review from ajkhattak January 16, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants