-
Notifications
You must be signed in to change notification settings - Fork 13
Description
For doing calibration, there are instances where you want to calibrate a parameter, but the parameter is a hard coded value. For example, in the current land calibration pipeline, there are parameters that we need to create a variable for, so that it can be overwritten.
ClimaLand.jl/experiments/calibration/forward_model_land.jl
Lines 51 to 75 in 631c69b
# Set up parameters | |
p_names = collect(keys(params)) | |
p_values = [params[name]["value"] for name in p_names] | |
params = (; zip(Symbol.(p_names), p_values)...) | |
(; | |
# pc, | |
# sc, | |
# K_sat_plant, | |
# a, | |
# h_leaf, | |
# α_snow, | |
# α_soil_dry_scaler, | |
# τ_leaf_scaler, | |
# α_leaf_scaler, | |
# α_soil_scaler, | |
α_0, | |
Δα, | |
k, | |
beta_snow, | |
x0_snow, | |
gamma_snow, | |
beta_0, | |
# beta_min, | |
z0_snow, | |
) = params |
This is not feasible in the long term and it would be better to transition to using ClimaParams for storing and loading parameters.
Proposed solution
Instead of hardcoding values in the code, we can instead hardcode the values in a TOML file. This would look something like this:
[beta_snow]
value = 0.7
description = "Snow parameter for ZenithAngleAlbedoModel from some paper" # optional
tag = "snow" # optional
Then, you can create a TOML dict from it using ClimaParams.create_toml_dict
and load the parameters from this instead. See ClimaParams documentation for more information.
For calibration, we can use ClimaParams.merge_toml_files
to merge the TOML file from ClimaCalibrate and the TOML for the land parameters. Furthermore, this can significantly reduces the amount of the code used for the model interface or forward model as one of the reason that it can't reuse snowy_land.jl
is because there is no functionality to override parameters.
Alternative solution
One other solution is to put all the parameters in ClimaParams. This might not be a good idea, because if any parameter ever need to be changed, then you need to go to ClimaParams, update it, make a new release, and update ClimaParams in ClimaLand.