Description Usage Arguments Value Examples
Performs particle swarm optimization of the HBV hydrological model by wrapping hydroPSO and TUWmodel.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
prec |
Precipitation input (mm/day) as zoo, matrix or numerical. If multivariate, each variable is the input for one zone. |
airt |
Air Temperature input (degC/day) as zoo, matrix or numerical. If multivariate, each variable is the input for one zone. |
ep |
Potential Evapotranspiration (mm/day) as zoo, matrix or numerical. If multivariate, each variable is the input for one zone. |
area |
If input data is distributed into zones (multivariate zoo/matrix), a vector of the decimal proportion of area for each zone. |
obs |
Observed Discharge (mm/day) as zoo or numerical |
from |
Start of the modelling period (including warmup) as Date or string in standard date format. Requires input datasets to be zoo objects. |
to |
End of the modelling period as Date or string in standard date format. Requires input datasets to be zoo objects. |
warmup |
Warmup phase which is removed before calculating goodness of fit. Can be given as numeric (days removed from the model start date) or date (as Date object or string in default format which can be cast to Date by as.Date). If given as date, it marks the start of the simulation period after warmup. |
incon |
vector/matrix of initial conditions for the model ( |
outpath |
Path to the directory storing the output files as string. If not NULL, the following is set in in hydroPSO's control list: |
hydroPSO_args |
Arguments passed on to hydroPSO |
FUN_gof |
The function used to calculate goodness of fit. Must take sim and obs as first arguments. |
FUN_gof_args |
Further arguments passed on to |
plotting |
Toggles plotting of the results (with plot_results if optimization is performed, otherwise with plot_out). As alternative to |
A list of the following items:
sim
simulated runoff (mm/day) of the best model run
obs
observed runoff (mm/day)
gof
goodness of fit of the best model run
pso_out
hydroPSO output
hbv_out
TUWmodel output from the best model run
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
# loading the example data from TUWmodel
data(example_TUWmodel, package="TUWmodel")
# extracting the input data for the lumped case (see TUWmodel examples):
# 1.) apply weighted means
prec <- apply(P_Vils, 1, weighted.mean, w=areas_Vils)
airt <- apply(T_Vils, 1, weighted.mean, w=areas_Vils)
ep <- apply(PET_Vils, 1, weighted.mean, w=areas_Vils)
# 2.) casting from named numeric vector to zoo
prec <- zoo(prec, order.by=as.Date(names(prec)))
airt <- zoo(airt, order.by=as.Date(names(airt)))
ep <- zoo(ep, order.by=as.Date(names(ep)))
obs <- zoo(Q_Vils, order.by=as.Date(names(Q_Vils)))
# setting up date range and warmup, limit max iterations to 500
control <- list(maxit=500)
from <- "1976-01-01"
to <- "1996-12-31"
warmup <- "1977-01-01"
# running hbv_PSO with default options, without plotting or parallel processing
res <- hbv_pso(prec=prec, airt=airt, ep=ep, obs=obs,hydroPSO_args = list(control=control))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.