From 78002984a3777c39fe05b0e734cfc4be00065042 Mon Sep 17 00:00:00 2001 From: Olivier Bonte Date: Thu, 12 Dec 2024 17:56:41 +0100 Subject: [PATCH] Add step_func to exp_hydro docs --- docs/src/implements/build_exphydro_model_en.md | 4 ++++ docs/src/implements/build_exphydro_model_zh.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/src/implements/build_exphydro_model_en.md b/docs/src/implements/build_exphydro_model_en.md index cfd11e3..88910f6 100644 --- a/docs/src/implements/build_exphydro_model_en.md +++ b/docs/src/implements/build_exphydro_model_en.md @@ -37,6 +37,9 @@ using HydroModels @variables snowpack soilwater @parameters Tmin Tmax Df Smax Qmax f +# define step function +step_func(x) = (tanh(5.0 * x) + 1.0) * 0.5 + # define snowpack bucket fluxes_1 = [ HydroFlux([temp, lday] => [pet], exprs=[29.8 * lday * 24 * 0.611 * exp((17.3 * temp) / (temp + 237.3)) / (temp + 273.2)]), @@ -88,6 +91,7 @@ In this code segment, we define all variables used in the ExpHydro model, includ The definition of `HydroFlux` requires determining input/output variables and model parameters based on calculation formulas. For example, in the rain-snow partitioning formula, the input variables are `prcp` and `temp`, output variables are `snowfall` and `rainfall`, and the model parameter is `Tmin`. The formula translation to `HydroFlux` looks like this: ```julia +step_func(x) = (tanh(5.0 * x) + 1.0) * 0.5 split_flux = HydroFlux([prcp, temp] => [snowfall, rainfall], [Tmin], exprs=[step_func(Tmin - temp) * prcp, step_func(temp - Tmin) * prcp]) ``` diff --git a/docs/src/implements/build_exphydro_model_zh.md b/docs/src/implements/build_exphydro_model_zh.md index eeef4f8..6639790 100644 --- a/docs/src/implements/build_exphydro_model_zh.md +++ b/docs/src/implements/build_exphydro_model_zh.md @@ -42,6 +42,9 @@ using HydroModels @variables snowpack soilwater @parameters Tmin Tmax Df Smax Qmax f +# define step function +step_func(x) = (tanh(5.0 * x) + 1.0) * 0.5 + # define snowpack bucket fluxes_1 = [ HydroFlux([temp, lday] => [pet], exprs=[29.8 * lday * 24 * 0.611 * exp((17.3 * temp) / (temp + 237.3)) / (temp + 273.2)]), @@ -89,6 +92,7 @@ using HydroModels `HydroFlux`的定义需要根据计算公式确定模型的输入输出变量和模型参数,例如在模型的雨雪划分计算公式,该公式的输入变量为`prcp`和`temp`,输出变量为`snowfall`和`rainfall`,模型参数为`Tmin`, 公式转译为`HydroFlux`的结果如下所示: ```julia +step_func(x) = (tanh(5.0 * x) + 1.0) * 0.5 split_flux = HydroFlux([prcp, temp] => [snowfall, rainfall], [Tmin], exprs=[step_func(Tmin - temp) * prcp, step_func(temp - Tmin) * prcp]) ```