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 step_func to exp_hydro docs #3

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/src/implements/build_exphydro_model_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]),
Expand Down Expand Up @@ -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])
```

Expand Down
4 changes: 4 additions & 0 deletions docs/src/implements/build_exphydro_model_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]),
Expand Down Expand Up @@ -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])
```

Expand Down