GLM calibration involves adjusting physical parameters to minimize the difference between simulated and observed water temperatures. The goal is typically to achieve RMSE < 2.0°C.
ParameterSectionDescriptionDefaultRangeKw``&lightLight extinction coefficient (m⁻¹)0.30.1 - 0.5coef_mix_hyp``&mixingHypolimnetic mixing coefficient0.50.3 - 0.7wind_factor``&meteorologyWind speed scaling factor1.00.7 - 1.3lw_factor``&meteorologyLongwave radiation scaling1.00.7 - 1.3ch``&meteorologySensible heat transfer coefficient0.00130.0005 - 0.002
ParameterIncrease EffectDecrease EffectKwLess light penetration, cooler deep waterMore light penetration, warmer deep watercoef_mix_hypMore deep mixing, weaker stratificationLess mixing, stronger stratificationwind_factorMore surface mixingLess surface mixinglw_factorMore heat inputLess heat inputchMore sensible heat exchangeLess heat exchange
python
from scipy.optimize import minimize
def objective(x):
Kw, coef_mix_hyp, wind_factor, lw_factor, ch = x
# Modify parameters
params = {
'Kw': round(Kw, 4),
'coef_mix_hyp': round(coef_mix_hyp, 4),
'wind_factor': round(wind_factor, 4),
'lw_factor': round(lw_factor, 4),
'ch': round(ch, 6)
}
modify_nml('glm3.nml', params)
# Run GLM
subprocess.run(['glm'], capture_output=True)
# Calculate RMSE
rmse = calculate_rmse(sim_df, obs_df)
return rmse
# Initial values (defaults)
x0 = [0.3, 0.5, 1.0, 1.0, 0.0013]
# Run optimization
result = minimize(
objective,
x0,
method='Nelder-Mead',
options={'maxiter': 150}
)
wind_factorKwcoef_mix_hypIssueLikely CauseSolutionSurface too warmLow wind mixingIncrease wind_factorDeep water too warmToo much light penetrationIncrease KwWeak stratificationToo much mixingDecrease coef_mix_hypOverall warm biasHeat budget too highDecrease lw_factor or ch