Write an initial conditions (rvc) format file for Raven, with the calculated reservoir stages written in.

rvn_rvc_res(ff, initial_percent = 0, output = "initial_res_conditions.rvc")

Arguments

ff

full file path to the reservoir information file

initial_percent

an optional double for percentage of maximum stage to use as initial condition; default 0.0

output

file rvc lines are written to (default: initial_res_conditions.rvc)

Value

TRUE

return TRUE if the function is executed properly

Details

Writes an initial conditions format file for Raven with the relevant initial reservoir stages. This file can be used directly as the model rvc file, or one may copy and paste the information into a separate rvc file for use (i.e. if there is other information to be included in the model rvc file).

The supplied file in ff should be a csv file consistent with the format from the Raven-generated ReservoirStages.csv file. External observations of reservoirs may be used given that the csv file follows the same format.

The initial_percent must be between 0 and 1, so that the initial stage is not less than the dry stage or greater than the maximum.

See also

rvn_res_read for reading in the ReservoirStages.csv file

Examples

ff <- system.file("extdata","ReservoirStages.csv", package="RavenR")

# set initial conditions at 40% capacity, view file
tf <- file.path(tempdir(), "modelname.rvc")
rvn_rvc_res(ff, initial_percent=0.4, output=tf)
#> [1] TRUE
readLines(tf)
#> [1] "# Initial conditions for reservoirs in a Raven model"
#> [2] "# Copy + Paste these lines into the rvc file"        
#> [3] "#"                                                   
#> [4] ":InitialReservoirStage  36  209.97"                  
#> [5] ":InitialReservoirStage  43  193.06"