The wflow_gr4 model¶
Warning
The documentation is incomplete
Introduction¶
An experimental implementation of the gr4 model. It is based on the hourly (gr4h) version
Dependencies¶
[PM]
Configuration¶
The model needs a number of settings in the ini file. The default name for the ini file is wflow_gr4.ini.
See below for an example:
[model]
Tslice=1
# Maximum upstream distance to update the flow in metres
[gr4]
dt = 1
B = 0.9
D = 1.25
X4 = 32.83
# X1,X2 and X3 are given as .tbl files or maps
[layout]
# if set to zero the cell-size is given in lat/long (the default)
sizeinmetres = 1
[outputmaps]
# Add maps here
# List all timeseries in tss format to save in this section. Timeseries are
# produced as averages per subcatchment. The discharge (run) timeseries
# is always saved (as samples at the gauge location)s.
[outputtss]
self.S_X1=S_X1
self.R_X3=R_X3
self.Pr=Pr
self.Q=Q
wflow_gr4 module documentation¶
Definition of the wflow_gr4 model.¶
Usage: wflow_gr4 [-l loglevel][-c configfile][-f][-h] -C case -R Runid -
-C: set the name of the case (directory) to run
-R: set the name runId within the current case
-c name of the config file (in the case directory)
-f: Force overwrite of existing results
- -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. Also set fewsrun=1 in the .ini file!
-h: print usage information
-l: loglevel (most be one of DEBUG, WARNING, ERROR)
$Author: schelle $ $Id: wflow_gr4.py 923 2014-03-13 13:48:37Z schelle $ $Rev: 923 $
NOTES¶
- The max length of the arrays is determined by the X4 parameter (int(X4))
- The X4 parameter is always uniform over that catchment. Howvere, the state of the UH is determined per grid cell.
- class wflow_gr4.WflowModel(cloneMap, Dir, RunDir, configfile)¶
Bases: pcraster.framework.dynamicPCRasterBase.DynamicModel
The user defined model class. This is your work!
- dynamic()¶
Required
Variables: - self.Pn – net precipitation [mm]
- self.En – net evapotranspiration [mm]
- self.Ps – part of Pn that feeds the production reservoir [mm]
- self.Es – evaporation quantity substracted from the production reservoir [mm]
- initial()¶
Initial part of the gr4 model, executed only once. Reads all static model information (parameters) and sets-up the variables used in modelling.
Variables: - dt.tbl – time step (1) [hour]
- B.tbl – routing ratio (0.9) [-]
- NH – UH dimension (number) taken from ini file [-]
- D.tbl – variable for hourly time steps (1.25) [-]
- C.tbl – variable (number) [hour]
Parameters
Variables: - X1.tbl – capacity of the production store, accounts for soil moisture (number) [mm]
- X2.tbl – water exchange coefficient (number) [mm]
- X3.tbl – capacity of the routing store (number) [mm]
- (in ini) (X4) – time base of the unit hydrograph (number) [hour]
- resume()¶
Required
This function is required. Read initial state maps (they are output of a previous call to suspend()). The implementation showns her is the most basic setup needed.
- stateVariables()¶
returns a list of state variables that are essential to the model. This list is essential for the resume and suspend functions to work.
This function is specific for each model and must be present.
Variables: - self.S_X1 – production reservoir content at the beginning of the time step (divided by X1) [mm]
- self.R_X3 – routing reservoir content at the beginning of the time step (divided by X3) [mm]
Todo
add routing state vars
- supplyCurrentTime()¶
Optional
Supplies the current time in seconds after the start of the run This function is optional. If it is not set the framework assumes the model runs with daily timesteps.
Ouput:
- time in seconds since the start of the model run
- suspend()¶
Required
Suspends the model to disk. All variables needed to restart the model are saved to disk as pcraster maps. Use resume() to re-read them
This function is required.
- wflow_gr4.initUH1(X4, D)¶
Initialize the UH1 unit hydrograph
- Input:
- X4
- D
- Returns:
- UH1, SH1
- wflow_gr4.initUH2(X4, D)¶
Initialize the UH2 unit hydrograph
Input:
- X4
- D
Returns:
- UH2, SH2
- wflow_gr4.main(argv=None)¶
Optional
Perform command line execution of the model. This example uses the getopt module to parse the command line options.
The user can set the caseName, the runDir, the timestep and the configfile.
- wflow_gr4.mk_qres(N)¶
Returns an array (or ayyar of maps) to store the delayed flow in
Input:
- N nr op steps
Ouput:
- nr of steps elemenst initialized with zeros’s
- wflow_gr4.pcr_tanh(x)¶
define tanh for pcraster objects
- wflow_gr4.usage(*args)¶