A case is a directory holding all the data needed to run the model. Multiple cases may exist next to each other in separate directories. The model will only work with one case at the time. If no case is specified when starting the model a default case (default_sbm or default_hbv) is assumed. Within a case the model output (the results) are stored in a separate directory. This directory is called the run, indicated with a runId. This structure is indicated in the figure below:
If you want to save the results and not overwrite the results from a previous run a new runId must be specified.
In general the model is run from the dos/windows/linux command line. Based on the system settings you can call the wFlow_[sbm|hbv].py file directly or you need to call python with the script as the first argument e.g.:
python wflow_sbm.py -C myCase -R calib_run -T 365 -f
In the example above the wflow_sbm model is run using the information in case myCase storing the results in runId calib_run. A total to 365 timesteps is performed and the the model will overwrite existing output in the calib_run directory. The default .ini file wflow_sbm.ini located in the myCase directory is read at startup.
The command line options for wflow are summarized below, use wflow -h to view them at the command line:
wflow_sbm [-h][-v level][-F runinfofile][-L logfile][-C casename][-R runId]
[-c configfile][-T last_step][-S first_step][-s seconds][-W][-E][-N][-U discharge]
[-P parameter multiplication][-X][-f][-I][-i tbl_dir][-x subcatchId][-u updatecols]
[-p inputparameter multiplication]
-F: if set wflow is expected to be run by FEWS. It will determine
the timesteps from the runinfo.xml file and save the output initial
conditions to an alternate location. The runinfo.xml file should be located
in the inmaps directory of the case.
-X: save state at the end of the run over the initial conditions at the start
-f: Force overwrite of existing results
-T: Set last timestep
-S: Set the start timestep (default = 1)
-N: No lateral flow, use runoff response function to generate fast runoff
-s: Set the model timesteps in seconds
-I: re-initialize the initial model conditions with default
-i: Set input table directory (default is intbl)
-x: run for subcatchment only (e.g. -x 1)
-C: set the name of the case (directory) to run
-R: set the name runId within the current case
-L: set the logfile
-E: Switch on reinfiltration of overland flow
-c: name of wflow the configuration file (default: Cassename/wflow_sbm.ini).
-h: print usage information
-W: If set, this flag indicates that an ldd is created for the water level
for each timestep. If not the water is assumed to flow according to the
DEM. Wflow will run a lot slower with this option. Most of the time
(shallow soil, steep topography) you do not need this option. Also, if you
need it you migth actually need another model.
-U: The argument to this option should be a .tss file with measured discharge in
[m^3/s] which the program will use to update the internal state to match
the measured flow. The number of columns in this file should match the
number of gauges.
-u: list of gauges/columns to use in update. Format:
-u [1 , 4 ,13]
The above example uses column 1, 4 and 13
Note that this also sets the order in which the updating takes place! In
general specify downstream gauges first.
-P: set parameter multiply dictionary (e.g: -P 'self.FirstZoneDepth' : 1.2
to increase self.FirstZoneDepth by 20\%, multiply with 1.2)
-p: set input parameter (dynamic, e.g. precip) multiply dictionary
(e.g: -p 'Precipitation' : 1.2 to increase Precipitation
by 20%, multiply with 1.2)
-v: set verbosity level
The wflow_sbm|hbv.ini file holds a number of settings that determine how the model is operated. The files consists of sections that hold entries. A section is define using a keyword in square brackets (e.g. [model]). Variables can be set in each section using a keyword = value combination (e.g. ScalarInput = 1). The default settings for the ini file are given in the subsections below.
[model] Options for all models:
Specific options for wflow_sbm :
The options below should normally not be needed. Here you can change the location of some of the input maps.
[defaultfortbl]
[layout]
[outputmaps]
Outputmaps to save per timestep. Valid options for the keys in the wFlow_sbm model are all variables visible the dynamic section of the model (see the code). A few useful variables are listed below.
[outputmaps]
self.Runoff=run
self.SnowMelt=sno
self.FirstZoneFlux=fzf
self.FirstZoneDepth=fir
Tip
NB See the wflow.py code for all the available variables as this list is incomplete.
The values on the right side of the equal sign can be choosen freely.
Example content:
Self.Runoff=run
self.FirstZoneFlux=fzf
self.FirstZoneDepth=fir
[outputcsv_0-n] [outputtss_0-n]
Number of sections to define output timeseries in csv format. Each section should at lears contain one samplemap item and one or more variables to save. The samplemap is the map that determines how the timesries are averaged/sampled. All other items are variabale filename pairs. The filename is given relative to the case directory.
Example:
[outputcsv_0]
samplemap=staticmaps/wflow_subcatch.map
self.SurfaceRunoffMM=Qsubcatch_avg.csv
[outputcsv_1]
samplemap=staticmaps/wflow_gauges.map
self.SurfaceRunoffMM=Qgauge.csv
self.WaterLevel=Hgauge.csv
[outputtss_0]
samplemap=staticmaps/wflow_landuse.map
self.SurfaceRunoffMM=Qlu.tss
In the above example the discharge of this model (self.SurfaceRunoffMM) is saved as an average per subcatchment, a sample at the gauge locations and as an average per landuse.
[inputmapstacks]
This section can be used to overwrite the default names of the input mapstacks
Note
Updating is only supported in the wflow_sbm and wflow_hbv models.
If a file (in .tss format) with measured discharge is specified using the -U command-line option the model will try to update (match) the flow at the outlet to the measured discharge. In that case the -u option should also be specified to indicate which of the columns must be used. When updating is switched on the following steps are taken:
Please note the following points when using updating:
[defaultfortbl]
RunoffGeneratingGWPerc = 0.1
[layout]
sizeinmetres = 1
[fit]
areamap = staticmaps/wflow_subcatch.map
areacode = 1
Q = testing.tss
WarmUpSteps = 1
ColMeas = 0
parameter_1 = RootingDepth
parameter_0 = M
ColSim = 0
[misc]
[outputmaps]
self.SurfaceRunoff = run
[framework]
debug = 0
outputformat = 1
[inputmapstacks]
Inflow = /inmaps/IF
Precipitation = /inmaps/P
Temperature = /inmaps/TEMP
EvapoTranspiration = /inmaps/PET
[model]
wflow_river = staticmaps/wflow_river.map
InterpolationMethod = inv
reinit = 1
WIMaxScale = 0.6
wflow_riverlength_fact = staticmaps/wflow_riverlength_fact.map
OverWriteInit = 0
intbl = intbl
wflow_riverwidth = staticmaps/wflow_riverwidth.map
wflow_soil = staticmaps/wflow_soil.map
ExternalQbase = 0
updateFile = no_set
sCatch = 0
Alpha = 120
UpdMaxDist = 300000.0
wflow_subcatch = staticmaps/wflow_subcatch.map
wflow_mgauges = staticmaps/wflow_mgauges.map
timestepsecs = 86400
RunoffGeneratingGWPerc = 1.0
RunoffGenSigmaFunction = 1
ScalarInput = 0
reInfilt = 0
fewsrun = 0
wflow_dem = staticmaps/wflow_dem.map
ModelSnow = 0
AnnualDischarge = 2290
wflow_landuse = staticmaps/wflow_landuse.map
updating = 0
TemperatureCorrectionMap = staticmaps/wflow_tempcor.map
wflow_inflow = staticmaps/wflow_inflow.map
wflow_riverlength = staticmaps/wflow_riverlength.map
wflow_ldd = staticmaps/wflow_ldd.map
wflow_gauges = staticmaps/wflow_gauges.map
Tslice = 1
waterdem = 0