Index: doc/_build/doctrees/environment.pickle =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/framework.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/index.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/testrunner_wflowhbv.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wf_DynamicFramework.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_adapt.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_building.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_delwaq.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_floodmap.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_gr4.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_hbv.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_lib.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_routing.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_sbm.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/doctrees/wflow_wave.doctree =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 Binary files differ Index: doc/_build/html/.buildinfo =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 --- doc/_build/html/.buildinfo (.../.buildinfo) (revision 22042fca85bb7d8aff51fa64f016c617050529e2) +++ doc/_build/html/.buildinfo (.../.buildinfo) (revision 215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89) @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 5bc3a2d1560f154c993a87ad62d3b99c +config: e70edcfb0cf6f90cb92002e39e3f9f25 tags: 645f666f9bcd5a90fca523b33c5a78b7 Index: doc/_build/html/calib_report.html =================================================================== diff -u -r22042fca85bb7d8aff51fa64f016c617050529e2 -r215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89 --- doc/_build/html/calib_report.html (.../calib_report.html) (revision 22042fca85bb7d8aff51fa64f016c617050529e2) +++ doc/_build/html/calib_report.html (.../calib_report.html) (revision 215f841de7a8cf2a6ad1b2f1ccfd54e26a860b89) @@ -6,15 +6,15 @@ - Calibration of the wflow_sbm model for the Rhine catchment using EOBS data — wflow 1.0-RC6-dev-119M documentation + Calibration of the wflow_sbm model for the Rhine catchment using EOBS data — wflow 1.0-RC6-dev-147M documentation - + @@ -43,7 +43,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -321,7 +321,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -157,7 +157,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -54,6 +54,7 @@

    Table Of Contents

    @@ -157,7 +1116,7 @@
  • modules |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -109,7 +109,7 @@
    $Id$ $HeadURL$
    -

    This documentation is for version 1.0-dev of wflow, release 1.0-RC6-dev-119M +

    This documentation is for version 1.0-dev of wflow, release 1.0-RC6-dev-147M This documentation was generated October 10, 2014

    @@ -202,7 +202,7 @@
  • Subcatchment flow
  • @@ -227,7 +227,7 @@
  • Processing of meteorological forcing data
  • Guidelines for wflowsbm model parameters
  • References
  • -
  • wflow_sbm module documentation
  • +
  • wflow_sbm module documentation
  • @@ -241,7 +241,7 @@
  • Introduction
  • Dependencies
  • Configuration
  • -
  • wflow_gr4 module documentation
  • +
  • wflow_gr4 module documentation
  • @@ -255,7 +255,7 @@
  • Introduction
  • Dependencies
  • Configuration
  • -
  • wflow_routing module documentation
  • +
  • wflow_routing module documentation
  • @@ -269,7 +269,7 @@
  • Introduction
  • Dependencies
  • Configuration
  • -
  • wflow_wave module documentation
  • +
  • wflow_wave module documentation
  • @@ -281,7 +281,7 @@ @@ -294,7 +294,7 @@
  • wflow_adapt Module
  • @@ -335,12 +335,15 @@
  • Description of the python module
  • -
  • wflow_lib Module
  • +
  • wflow_lib Module +
  • wflow_delwaq Module
  • @@ -370,15 +373,19 @@
    @@ -436,8 +443,70 @@

    TODO

    +
    +

    Todo

    +

    Add checking for missing values

    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wf_DynamicFramework.py:docstring of wf_DynamicFramework.wf_DynamicFramework.readtblDefault, line 17.)

    +
    +

    Todo

    +

    Save maps to be used in memory at startup and do not call the ini file each time

    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wf_DynamicFramework.py:docstring of wf_DynamicFramework.wf_DynamicFramework.wf_savedynMaps, line 3.)

    +
    +

    Todo

    +

    Get timestep info from from config file

    +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wf_DynamicFramework.py:docstring of wf_DynamicFramework.wf_DynamicFramework.wf_supplyCurrentTime, line 7.)

    +
    +

    Todo

    +

    rewrite and simplify +convert log to XML

    +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wflow_adapt.py:docstring of wflow_adapt, line 23.)

    +
    +

    Todo

    +

    add support for a coarser delwaq network based on supplied map.

    +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wflow_delwaq.py:docstring of wflow_delwaq, line 58.)

    +
    +

    Todo

    +

    Test option to seperate construction of network from filling of the input +arrays

    +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wflow_delwaq.py:docstring of wflow_delwaq, line 63.)

    +
    +

    Todo

    +

    Ad support to not only follow the kinematic wave reservoir but also +the flow trough the soil reservoirs. Basically make three layers:

    +
    +
      +
    1. kinematic wave reservoir (surface water)
    2. +
    3. unsaturated store (only vertical flow)
    4. +
    5. saturated store (horizontal and vertical flow)
    6. +
    +
    +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wflow_delwaq.py:docstring of wflow_delwaq, line 68.)

    +
    +

    Todo

    + +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wflow_delwaq.py:docstring of wflow_delwaq.dw_WriteBoundlist, line 8.)

    +
    +

    Todo

    +

    Add exta column with boundary labels (of the inflows)

    +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wflow_delwaq.py:docstring of wflow_delwaq.dw_mkDelwaqPointers, line 30.)

    +
    +

    Todo

    +

    add routing state vars

    +
    +

    (The original entry is located in /home/jaap/repos/wflow/wflow-py/wflow/wflow_gr4.py:docstring of wflow_gr4.WflowModel.stateVariables, line 10.)

    +
    + @@ -457,7 +526,7 @@
  • next |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -152,7 +152,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -97,7 +97,7 @@
  • modules |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -54,10 +54,13 @@

    Table Of Contents

    Previous topic

    # PotEvaporation=pot

    +
    +

    Controlling the model via the API

    +

    Example of how to use the framework to control the wflow_* models +from other software, in this case a python script.

    +

    In this example case the controlling piece of software (this script) +provides the forcing data using the API. It also interrogates the model +to get results and display them on screen.

    +

    Each wflow_* model should provide a def supplyVariableNamesAndRoles function +that returns a list of variables and their roles. This function can than +be used by the controlling program to interrogate the model.

    +

    Some important things to consider:

    + +
    """
     Controlling the model via the API
     ---------------------------------
    @@ -307,7 +327,7 @@
             
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -57,8 +57,11 @@
  • Settings in the API section
  • -
  • wf_DynamicFramework Module
  • +
  • wf_DynamicFramework Module +
  • +

    Previous topic

    -
    -

    wf_DynamicFramework Module

    +
    +

    wf_DynamicFramework Module

    +
    +

    wf_DynamicFramework

    +

    This is a replacement for the standard pcraster/python DynamicFramwork class.It provides extra functionality to simplify linking the models build in the framwork +with other models. The provided functionality allows external programs to control +and interrogate the model.

    +

    Compared to the original pcraster class the usermodel needs to be extended with +the stateVariables() method which lists the state variables. Other items to be +exchanged most be listed in the API section of the .ini file

    +

    In addition, the following methods must also be called at startup:

    +
    +
      +
    • createRunId()
    • +
    +
    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +class wf_DynamicFramework.wf_DynamicFramework(userModel, lastTimeStep=0, firstTimestep=1, datetimestart=datetime.datetime(1990, 1, 1, 0, 0), timestepsecs=86400)
    +
    +
    +createRunId(intbl='intbl', logfname='wflow.log', NoOverWrite=True, model='model', modelVersion='no version', level=10)
    +

    Create runId dir and copy table files to it +Also changes the working dir to the case/runid directory

    +
    + +
    +
    +iniFileSetUp(caseName, runId, configfile)
    +

    Reads .ini file and returns a config object.

    +
    +
    Input:
    +
      +
    • caseName - dir with case
    • +
    • runId - run dir within case
    • +
    • configfile - name of the configfile (.ini type)
    • +
    +
    +
    Output:
    +
      +
    • python config object
    • +
    +
    +
    +
    + +
    +
    +loggingSetUp(caseName, runId, logfname, model, modelversion, level=20)
    +

    Sets up the logging system assuming we are in the runId directory

    +
    + +
    +
    +readtblDefault(pathtotbl, landuse, subcatch, soil, default, cloneMap=None)
    +

    First check if a prepared maps of the same name is present +in the staticmaps directory. next try to +read a tbl file to match a landuse, catchment and soil map. Returns +the default value if the tbl file is not found.

    +
    +
    Input:
    +
      +
    • pathtotbl: full path to table file
    • +
    • landuse: landuse map
    • +
    • subcatch: subcatchment map
    • +
    • soil: soil map
    • +
    • default: default value
    • +
    • optional clonemap to check maps against
    • +
    +
    +
    Output:
    +
      +
    • map constructed from tbl file or map with default value
    • +
    +
    +
    +
    +

    Todo

    +

    Add checking for missing values

    +
    +
    +
    +run()
    +

    Runs the dynamic model for all timesteps

    +
    +
    +
    +setQuiet(quiet)
    +
    + +
    +
    +wf_QuickResume()
    +

    Resumes the state variable of the previous timestep in memory +it uses the wf_supplyVariableNamesAndRoles() function to find them. +The variables are inserted into the model object

    +
    + +
    +
    +wf_QuickSuspend()
    +

    Save the state variable of the current timestep in memory +it uses the wf_supplyVariableNamesAndRoles() function to find them. +The variables are inserted into the model object +This function is normally called as part of the run. Normally there is +no need to call it directly.

    +
    + +
    +
    +wf_multParameterValues(mapname, value)
    +

    multiply a parameter map with a single scalar +value. Current settings for dimensions are assumed.

    +

    This method must be called after the runinitial() method

    +
    +
    Input:
    +
      +
    • mapname - string with name of map
    • +
    • value - single scalar
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if nothing was done
    +
    + +
    +
    +wf_multParameterValuesArea(mapname, value, areacode, areamapname)
    +

    multiply a parameter map with a single scalar +value for area with id area only. Current settings for dimensions are assumed.

    +

    This method must be called after the runinitial() method

    +
    +
    Input:
    +
      +
    • mapname - string with name of map
    • +
    • value - single scalar
    • +
    • areacode - id of the area in the areamap
    • +
    • areamapname - name of the areamap
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if nothing was done
    +
    + +
    +
    +wf_readmap(name, default, verbose=True, filetype='PCRaster')
    +

    Adjusted version of readmapNew. the style variable is used to indicated +how the data is read:

    +
    1 - default: reads pcrmaps
    +2 - memory: assumes the map is made available (in memory) using
    +the in-memory interface
    +
    +
    +
    + +
    +
    +wf_readmapClimatology(name, kind=1, default=0.0, verbose=1)
    +

    Read a climatology map. The current date/time is onverted to: +1: a month and the file fro the current month is returend +2: days of year and the file for the current day is implmented +3: hour of day and the file for the current hours is returned

    + +++ + + + + + +
    Parameters:
      +
    • name – name if the mapstack
    • +
    • kind – time of the climatology
    • +
    +
    Returns:

    a map

    +
    +
    + +
    +
    +wf_resume(directory)
    +

    Resumes the state variables from disk as .map files (or arrays of maps files using +a _? postfix)

    +
    + +
    +
    +wf_saveTimeSeries()
    +

    Print .ini defined output csv/tss timeseries per timestep

    +
    + +
    +
    +wf_savedynMaps()
    +

    Save the maps defined in the ini file for the dynamic section

    +
    +

    Todo

    +

    Save maps to be used in memory at startup and do not call the ini file each time

    +
    +
    + +
    +
    +wf_savesummarymaps()
    +

    Saves the maps defined in the summary section to disk +[summary] # Single values or end values +[summary_sum] # accumulative maps over the model run +[summary_avg] # average of maps over the model run +[summary_max] # max of maps over the model run +[summary_min] # min of maps over the model run

    +
    + +
    +
    +wf_setParameterValues(mapname, values)
    +

    set a parameter map with values from a python list or a single scalar +value. In case a single value is specified the value will be distributed +uniformly over the map. Current settings for dimensions are assumed.

    +

    This method must be called _after_ the runinitial() method

    +
    +
    Input:
    +
      +
    • mapname - string with name of map

      +
    • +
    • +
      values - single list of value of length rows * cols or a single
      +

      scalar

      +
      +
      +
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if nothing was done
    +
    + +
    +
    +wf_setValue(mapname, value, xcor, ycor)
    +

    set single value in a map on xcor, ycor (0 based). All other values in the +map remain the same.

    +
    +
    Input:
    +
      +
    • mapname - string with name of map
    • +
    • xcor - xcor to set the value in
    • +
    • ycor - ycor to set the value in
    • +
    • value - single scalar
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if nothing was done
    +
    + +
    +
    +wf_setValueLdd(mapname, value, xcor, ycor)
    +

    set single value in an ldd on xcor, ycor (0 based). All other values in the +map remain the same. Calls lddrepair to ensure the ldd is sound

    +
    +
    Input:
    +
      +
    • mapname of tipy ldd - string with name of map

      +
    • +
    • xcor - xcor to set the value in

      +
    • +
    • ycor - ycor to set the value in

      +
    • +
    • +
      values - single scalar (see pcraster ldddescription for legal values)
      +

      e.g. use 5 for setting a pit

      +
      +
      +
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if nothing was done
    +
    + +
    +
    +wf_setValueRowCol(mapname, value, row, col)
    +

    set single value in a map on row, col (0 based). All other values in the +map remain the same. Numbering starts at the upper left corner.

    +
    +
    Input:
    +
      +
    • mapname - string with name of map
    • +
    • row - row to set the value in
    • +
    • col - column to set the value in
    • +
    • values - single scalar
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if nothing was done
    +
    + +
    +
    +wf_setValues(mapname, values)
    +

    set a map with values from a python list or a single scalar +value. In case a single value is specified the value will be distributed +uniformly over the map. Current settings for +dimensions are assumed.

    +
    +
    Input:
    +
      +
    • mapname - string with name of map

      +
    • +
    • +
      values - single list of value of length rows * cols or a single
      +

      scalar

      +
      +
      +
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if a new map was created
    +
    + +
    +
    +wf_setValuesAsNumpy(mapname, values)
    +

    set a map with values from a numpy array. Current settings for +dimensions are assumed.

    +
    +
    Input:
    +
      +
    • mapname - string with name of map
    • +
    • values - numpy array
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if a new map was created
    +
    + +
    +
    +wf_setValuesAsPcrMap(mapname, pcrmap)
    +

    set a map with values from a pcrmap. Current settings for +dimensions are assumed.

    +
    +
    Input:
    +
      +
    • mapname - string with name of map
    • +
    • pcrmap - pcraster map
    • +
    +
    +
    + +++ + + + +
    Returns:1 if the map was present, 0 if a new map was created
    +
    + +
    +
    +wf_supplyCurrentTime()
    +

    gets the current time in seconds after the start of the run +Assumed daily timesteps if not defined in the user model

    +
    +
    Output:
    +
      +
    • current model time (since start of the run)
    • +
    +
    +
    +
    +

    Todo

    +

    Get timestep info from from config file

    +
    +
    + +
    +
    +wf_supplyEndTime()
    +

    gets the end time of the model run +:return: current time as seconds since epoch

    +
    + +
    +
    +wf_supplyGridDim()
    +

    return the dimension of the current model grid as list:

    +
    [ Xul, Yul, xsize, ysize, rows, cols]
    +
    +
    +
    + +
    +
    +wf_supplyMapAsList(mapname)
    +

    Returns a python list for the specified map and the current +timestep. If the maps is not dynamic the current status of the map is +returned which may be undefined for maps that are filled with data +at the end of a run

    +
    +
    Input:
    +
      +
    • mapname (string)
    • +
    +
    +
    Output:
    +
      +
    • list
    • +
    +
    +
    +
    + +
    +
    +wf_supplyMapAsNumpy(mapname)
    +

    Returns a numpy array (matrix) for the specified map and the current +timestep. If the maps is not dynamic the current staus of the map is +returns which may be undefined for maps that are filled with data +at the end of a run +Missing value is -999

    +
    +
    Input:
    +
      +
    • mapname (string)
    • +
    +
    +
    Output:
    +
      +
    • numpy array
    • +
    +
    +
    +
    + +
    +
    +wf_supplyMapAsPcrMap(mapname)
    +

    Returns a pcrmap for the specified map and the current +timestep. If the maps is not dynamic the current staus of the map is +returns which may be undefined for maps that are filled with data +at the end of a run +Missing value is -999

    +
    +
    Input:
    +
      +
    • mapname (string)
    • +
    +
    +
    Output:
    +
      +
    • numpy array
    • +
    +
    +
    +
    + +
    +
    +wf_supplyParameterAsList(mapname)
    +

    Returns a python list for the specified parameter map and the current +timestep. If the maps is not dynamic the current status of the map is +returned.

    +
    +
    Input:
    +
      +
    • mapname (string)
    • +
    +
    +
    Output:
    +
      +
    • list
    • +
    +
    +
    +
    + +
    +
    +wf_supplyRowCol(mapname, xcor, ycor)
    +

    returns a tuple (Row,Col) for the given X and y coordinate

    +
    +
    Input:
    +
      +
    • mapname
    • +
    • xcor
    • +
    • ycor
    • +
    +
    +
    Output:
    +
      +
    • tuple with row, col
    • +
    +
    +
    +
    + +
    +
    +wf_supplyScalar(mapname, xcor, ycor)
    +

    returns a single value for the x and y coordinates from the +map given uses getValAtPoint(in_map,xcor,ycor) from terrain_lib.py

    +
    +
    Input:
    +
      +
    • mapname
    • +
    • xcor
    • +
    • ycor
    • +
    +
    +
    Output:
    +
      +
    • value at location xcor, ycor
    • +
    +
    +
    +
    + +
    +
    +wf_supplyScalarRowCol(mapname, row, col)
    +

    returns a single value for row and col from the +map given (zero based).

    +
    +
    Input:
    +
      +
    • mapname
    • +
    • xcor
    • +
    • ycor
    • +
    +
    +
    Output:
    +
      +
    • value at location row, col
    • +
    +
    +
    +
    + +
    +
    +wf_supplyStartTime()
    +

    gets the start time of the model run +:return: current time as seconds since epoch

    +
    + +
    +
    +wf_supplyVariableCount()
    +
    +
    returns:
    +
      +
    • the number of exchangable variables
    • +
    +
    +
    +
    + +
    +
    +wf_supplyVariableNames()
    +
    +
    returns:
    +
      +
    • the a list of variable names
    • +
    +
    +
    +
    + +
    +
    +wf_supplyVariableNamesAndRoles()
    +

    Returns a list of variables +List of list with the following structure:

    +
    [[ name, role, unit]
    +[ name, role, unit]
    +...   
    +]
    +role: 0 = input (to the model)
    +      1 = is output (from the model)
    +      2 = input/output (state information)
    +      3 = model parameter
    +unit: 0 = mm/timestep
    +      1 = m^3/sec
    +      2 = m
    +      3 = degree Celcius
    +      4 = mm
    +      5 = -
    +
    +
    +

    The first time this function is called the exchangeitems object is filled +with data from the ini file.

    +
    + +
    +
    +wf_supplyVariableRoles()
    +
    +
    returns:
    +
      +
    • the a list of variable roles
    • +
    +
    +
    +
    + +
    +
    +wf_supplyVariableUnits()
    +
    +
    returns:
    +
      +
    • the a list of variable units
    • +
    +
    +
    +
    + +
    +
    +wf_suspend(directory)
    +

    Suspend the state variables to disk as .map files +Also saves the summary maps

    +
    + +
    + +
    +
    + +
    @@ -201,7 +898,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -56,7 +56,7 @@
  • wflow_adapt Module
  • @@ -167,12 +167,140 @@

    The wflow_adapt module can also be used by other programs to convert .tss files to pi-xml vv. Below the API documentation of the module is given.

    -
    -

    Module function documentation

    +
    +

    Module function documentation

    +

    wflow_adapt.py: Simple wflow Delft-FEWS adapter in python. This file can be run +as a script from the command-line or be used as a module that provides (limited) +functionality for converting PI-XML files to .tss and back.

    +

    Usage pre adapter:

    +

    wflow_adapt -M Pre -t InputTimeseriesXml -I inifile -T timestepInSeconds

    +

    Usage postadapter:

    +
    +
    wflow_adapt-M Post -t InputTimeseriesXml -s inputStateFile -I inifile
    +
    -o outputStateFile -r runinfofile -w workdir -C case -T timestepInSeconds [-R runId]
    +
    +

    Issues:

    + +
    +
    +

    Todo

    +

    rewrite and simplify +convert log to XML

    +
    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +wflow_adapt.getEndTimefromRuninfo(xmlfile)
    +

    Gets the endtime of the run from the FEWS runinfo file

    +
    + +
    +
    +wflow_adapt.getMapStacksFromRuninfo(xmlfile)
    +

    Gets the list of mapstacks fews expect from the runinfo file and create those

    +
    + +
    +
    +wflow_adapt.getStartTimefromRuninfo(xmlfile)
    +

    Gets the starttime from the FEWS runinfo file

    +
    + +
    +
    +wflow_adapt.getTimeStepsfromRuninfo(xmlfile, timestepsecs)
    +

    Gets the number of timesteps from the FEWS runinfo file.

    +
    + +
    +
    +wflow_adapt.log2xml(logfile, xmldiag)
    +

    Converts a wflow log file to a Delft-Fews XML diag file

    +
    + +
    +
    +wflow_adapt.main()
    +

    Main entry for using the module as a command line program (e.g. from the Delft-FEWS GA)

    +
    + +
    +
    +wflow_adapt.mapstackxml(mapstackxml, mapstackname, locationname, parametername, Sdate, Edate, timestepsecs)
    +

    writes a mapstack xml file

    +
    + +
    +
    +wflow_adapt.pixml_state_updateTime(inxml, outxml, DT)
    +

    Reads the pi-state xml file inxml and updates the data/time of +the state using datetime. Writes updated file to outxml

    +
      +
    • Can be use in scripts to set the date.time of the +output state.xml that Delft-FEWS writes.
    • +
    +
    +

    Warning

    +
    +
    This function does not fully parse the xml file and will only work properly
    +

    if the xml files date the dateTime element written on one line.

    +
    +
    +
    +wflow_adapt.pixml_totss(nname, outputdir)
    +

    Converts and PI xml timeseries file to a number of tss files.

    +

    The tss files are created using the following rules:

    +
    +
      +
    • tss filename determined by the content of the parameter element with a ”.tss” postfix
    • +
    • files are created in “outputdir”
    • +
    • multiple locations will be multiple columns in the tss file written in order +of appearance in the XML file
    • +
    +
    +
    +
    +
    +wflow_adapt.pixml_totss_dates(nname, outputdir)
    +

    Gets Date/time info from XML file and creates .tss files with:

    +
    +
      +
    • Day of year
    • +
    • Hour of day
    • +
    • Others may follow
    • +
    +
    +
    + +
    +
    +wflow_adapt.setlogger(logfilename, loggername, thelevel=20)
    +

    Set-up the logging system and return a logger object. Exit if this fails

    +
    + +
    +
    +wflow_adapt.tss_topixml(tssfile, xmlfile, locationname, parametername, Sdate, timestep)
    +

    Converts a .tss file to a PI-xml file

    +
    + +
    +
    + + @@ -193,7 +321,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -64,7 +64,11 @@
  • Problems
  • -
  • Script documentation
  • +
  • Script documentation +
  • Setting Up a Case
  • Input parameters (lookup tables or maps)
  • Calibrating the wflow_sbm model
  • -
    -

    Script documentation

    +
    +

    Script documentation

    +
    +

    wflow_prepare_step1

    +

    wflow data preparation script. Data preparation can be done by hand or using +the two scripts. This script does the first step. The second script does +the resampling. This scripts need the pcraster and gdal executables to be +available in you search path.

    +

    Usage:

    +
    wflow_prepare_step1 [-W workdir][-f][-h] -I inifile 
    +
    +-f force recreation of ldd if it already exists
    +-h show this information
    +-W set the working directory, default is current dir
    +-I name of the ini file with settings
    +
    +

    $Id$

    +
    +
    +wflow_prepare_step1.OpenConf(fn)
    +
    + +
    +
    +wflow_prepare_step1.configget(config, section, var, default)
    +

    gets parameter from config file and returns a default value +if the parameter is not found

    +
    + +
    +
    +wflow_prepare_step1.main()
    +
    +++ + + + +
    Variables:
      +
    • masterdem – digital elevation model
    • +
    • dem – digital elevation model
    • +
    • river – optional river map
    • +
    +
    +
    + +
    +
    +wflow_prepare_step1.usage(*args)
    +
    + +
    +
    +

    wflow_prepare_step2

    +

    wflow data preparation script. Data preparation can be done by hand or using +the two scripts. This script does the resampling. This scripts need the pcraster and gdal executables to be +available in you search path.

    +

    Usage:

    +
    wflow_prepare_step2 [-W workdir][-f][-h] -I inifile 
    +
    +
    +
    -f force recreation of ldd if it already exists
    +-h show this information
    +-W set the working directory, default is current dir
    +-I name of the ini file with settings
    +
    +
    +

    $Id$

    +
    +
    +wflow_prepare_step2.OpenConf(fn)
    +
    + +
    +
    +wflow_prepare_step2.configget(config, section, var, default)
    +
    + +
    +
    +wflow_prepare_step2.main()
    +
    + +
    +
    +wflow_prepare_step2.resamplemaps(step1dir, step2dir)
    +

    Resample the maps from step1 and rename them in the process

    +
    + +
    +
    +wflow_prepare_step2.usage(*args)
    +
    + +
    +

    Setting Up a Case

    PM

    @@ -630,7 +729,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -57,10 +57,13 @@
  • How the script works
  • Very simple example:
  • Case study for Malaysia and Singapore
  • -
  • wflow_delwaq module documentation
  • +
  • wflow_delwaq module documentation
  • + +

    Previous topic

    -
    -

    wflow_delwaq module documentation

    +
    +

    wflow_delwaq module documentation

    +
    +

    Introduction

    +

    Simple export library for pcraster/python delwaq link. The module can be +used to export an ldd to a delwaq pointer file and fill the input arrays. +The library includes a command-line interface that allows you to setup +a delwaq model and feed it with forcing data.

    +
    +

    Warning

    +

    This is an experimental version. A complete redesign is needed as this +version is unstable and very poorly structured!

    +

    the wflow run should have saved at least the folowing mapstacks:

    +
    - self.OldKinWaveVolume=vol
    +- self.WaterLevel=lev
    +- self.SurfaceRunoff=run
    +- self.Inwater=inw  (or the different components that make up this flux)
    +
    +

    The script always sets-up at least two Substances, Initial and Check. Initial +is present everywhere at startup and the concentration is zero +in all inputs. Check is not present at startup and set to 1 in all inputs.

    +

    The script takes an areamap that can be used to tag water as it enters the +model. This can be a landuse map, a subcatchment map etc. Furthermore water +can also be tagged based on the flux into the model.

    +

    The naming of the sustances is as follows: “Area” areamap_class inflow_number

    +

    Command line options:

    +
    -C: caseDir - set the wflow case directory to use
    +-R: runId - set the wflow runId to use
    +-T: Set last timestep
    +-O: set starttime ('%Y-%m-%d% H:%M:%S')
    +-a: Also write dynamic area data if this option is set
    +-j: if this option is set the static data is not generated (default is on) 
    +-A: sets the areamap used to specify the fraction sources. This can be
    +    a subcatcment map, a soil type map, a land use maps etc. Default is:
    +    staticmaps/wflow_subcatch.map (relative to the caseDir directory)
    +-D: delwaqdir - set the basedir to create the delwaq schematisation in 
    +-S: sourcemap - name of the wflow output map to use as source. 
    +    it should be a variable that flows into the kinematic wave routine
    +    inw is normally used as it contain all water per cell that flows into
    +    the kinematic wave function.
    +    Use multiple -S options to include multiple maps
    +-s: Set the model timesteps in seconds (default 86400)
    +-F: if set the model 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. 
    +-c: Name of the wflow configuration file
    +
    +
    +
    +

    Todo

    +

    add support for a coarser delwaq network based on supplied map.

    +
    +
    +

    Todo

    +

    Test option to seperate construction of network from filling of the input +arrays

    +
    +
    +

    Todo

    +

    Ad support to not only follow the kinematic wave reservoir but also +the flow trough the soil reservoirs. Basically make three layers:

    +
    +
      +
    1. kinematic wave reservoir (surface water)
    2. +
    3. unsaturated store (only vertical flow)
    4. +
    5. saturated store (horizontal and vertical flow)
    6. +
    +
    +
    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +wflow_delwaq.dw_CreateDwRun(thedir)
    +

    ” +create the dir to save delwaq info in

    +
    +
    +
    +wflow_delwaq.dw_WriteBoundData(fname, areas)
    +

    writes B5_bounddata.inc

    +
    +
    +
    +wflow_delwaq.dw_WriteBoundlist(fname, pointer, areas, of, inflowtypes)
    +

    Writes the boundary list file +B5_boundlist.inc +Numbering is abs(exchnage id)

    +
    +
    Input:
    +
      +
    • fname, pointer
    • +
    +
    +
    +
    +

    Todo

    +
      +
    • add labeling of different inflows ( the information is already present)
    • +
    +
    +
    + +
    +
    +wflow_delwaq.dw_WriteInitials(fname, inmaps)
    +

    B8_initials.inc

    +
    + +
    +
    +wflow_delwaq.dw_WriteNrExChnages(fname, nr)
    +

    Writes the number of exchnages to file (number of rows in the pointer file)

    +

    B4_nrofexch.inc

    +
    + +
    +
    +wflow_delwaq.dw_WriteNrSegments(fname, nr)
    +

    Writes the number of segments to B3 file

    +

    B3_nrofseg.inc

    +
    + +
    +
    +wflow_delwaq.dw_WritePointer(fname, pointer)
    +

    WRites the pointer file +B4_pointer.inc

    +
    + +
    +
    +wflow_delwaq.dw_WriteSegmentOrExchangeData(ttime, fname, datablock, boundids, WriteAscii=True)
    +

    Writes a timestep to a segment/exchange data file (appends to an existing +file or creates a new one).

    +
    +
    Input:
    +
      +
    • time - time for this timestep
    • +
    • fname - File path of the segment/exchange data file</param>
    • +
    • datablock - array with data
    • +
    • boundids to write more than 1 block
    • +
    • WriteAscii - set to 1 to alse make an ascii dump
    • +
    +
    +
    +
    + +
    +
    +wflow_delwaq.dw_Write_B2_outlocs(fname, gauges, segs)
    +

    Write an output loc file based on the wflow_gauges +map.

    +
    + +
    +
    +wflow_delwaq.dw_Write_Substances(fname, areas)
    +

    Writes the B1_sublist.inc file +input:

    +
    +
    it writes substances for the areas and an initial and mass balance +check substance
    +
    + +
    +
    +wflow_delwaq.dw_Write_Times(dwdir, T0, timeSteps, timeStepSec)
    +

    Writes B1_T0.inc, B2_outputtimers.inc, B2_sysclock.inc and /B2_simtimers.inc +Assumes daily timesteps for now!

    +
    + +
    +
    +wflow_delwaq.dw_mkDelwaqPointers(ldd, amap, difboun, layers)
    +

    An ldd is used to determine the from-to relations for delwaq using +the PCraster up/downstreams commands. +amap is used to link boundaries to the segments for delwaq (negative +numbers). These are area based boundaries. Diffboun is a +python dictionary with inflows for each +cell.

    +
    +
    Input:
    +
      +
    • ldd
    • +
    • map to determine the active points)
    • +
    • difboun : number of inflow boundaries per cell
    • +
    • layers [nr of soil layers (only vertical flow)].
    • +
    +
    +
    +
    +

    Note

    +

    Only one layer at present (layers must be 1)

    +
    +
    +
    Output:
    +
      +
    • pointer, fromto, outflows, boundaries, segment
    • +
    • matrix with 4 colums: from to, zero, zero.
    • +
    • catchid
    • +
    +
    +
    +
    +

    Note

    +

    use savetxt(“pointer.inc”,pointer,fmt=’%10.0f’) to save this +for use with delwaq

    +
    +
    +

    Note

    +

    The pointers list first contains the “internal” fluxes in +the kinematic wave reservoir, next the fluxes (1-n) into the +kinematic wave reservoir.

    +
    +
    +

    Todo

    +

    Add exta column with boundary labels (of the inflows)

    +
    +
    + +
    +
    +wflow_delwaq.dw_pcrToDataBlock(pcrmap)
    +

    Converts a pcrmap to a numpy array.that is flattend and from which +missing values are removed. Used for generating delwaq data

    +
    + +
    +
    +wflow_delwaq.main()
    +
    + +
    +
    +wflow_delwaq.readTS(name, ts)
    +

    Read a pcraster map for a timestep without using the dynamic framework

    +
    + +
    +
    +wflow_delwaq.usage(*args)
    +
    + +
    +
    +
    + +
    @@ -356,7 +608,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -258,7 +258,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -55,10 +55,13 @@

    Previous topic

    The documentation is incomplete

    -
    -

    Description of the python module

    +
    +

    Description of the python module

    +
    +

    Definition of the wflow_floodmap model.

    +

    Runs flood mapping (very basic) based on an existing +wflow_sbm|hbv model run.

    +

    The wflow_sbm|hbv model must have saved mapstacks for +water level and discharge for each timestep (run*****.*** and lev*****.***). +If the name of you Q and/or H maps are different specify these in the +[inputmapstacks] section, e.g:

    +
    [inputmapstacks]
    +Q = runDyn
    +H = levDyn
    +
    +

    If a wflow_bankfull.map map is present in the staticmaps directory that map will +be used to determine if the river is flooding, otherwise bankfull +is determined using: Bankful = RiverWidth/60 (the RiverWidth map is taken +from the runid/outsum directory)

    +

    Ini file settings:

    +
    [model]
    +# Maximum distance between a cell to be flooded cell and a river cell
    +# or already flooded cel. Functions as a max flooding velocity
    +# Never set lower that the length of one cell.
    +maxflooddist= 0.3
    +
    +

    Usage: +wflow_floodmap -C case -R Runid -c inifile -h -I

    +
    +

    -C: set the name of the case (directory) to run

    +

    -I: generate initial conditions from scratch

    +

    -R: set the name runId within the current case

    +

    -c name of the config file (in the case directory)

    +
    +
    -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 displays help information

    +

    -l: loglevel (most be one of DEBUG, WARNING, ERROR)

    +
    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +class wflow_floodmap.WflowModel(cloneMap, Dir, RunDir, configfile)
    +

    The user defined model class. This is your work!

    +
    +
    +dynamic()
    +

    Required

    +

    This is where all the time dependent functions are executed. Time dependent +output should also be saved here.

    + +++ + + + +
    Variables:
      +
    • self.FLOOD – Actual flood level [m]
    • +
    • self.FloodExtent – Actual flood extent [-]
    • +
    +
    +
    +
    +
    +initial()
    +

    Required

    +

    Initial part of the model, executed only once. It reads all static model +information (parameters) and sets-up the variables used in modelling.

    +

    This function is required. The contents is free. However, in order to +easily connect to other models it is advised to adhere to the directory +structure used in the other models.

    +
    +
    +
    +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()
    +

    Required

    +

    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. This is +where you specify the state variables of you model. If your model is stateless +this function must return and empty array (states = [])

    + +++ + + + +
    Variables:FloodExtent.map – Current FloodExtent
    +
    + +
    +
    +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()
    +

    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

    +
    + +
    + +
    +
    +wflow_floodmap.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.

    +
    + +
    +
    +
    + + @@ -130,7 +274,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -57,10 +57,14 @@
  • Introduction
  • Dependencies
  • Configuration
  • -
  • wflow_gr4 module documentation
  • +
  • wflow_gr4 module documentation
  • + +

    Previous topic

    -
    -

    wflow_gr4 module documentation

    +
    +

    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$ +$Id$ +$Rev$

    +
    +

    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)
    +
    + +
    +
    +
    + + @@ -170,7 +402,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -66,7 +66,7 @@
  • Subcatchment flow
  • @@ -387,10 +387,294 @@ SubCatchFlowOnly = 1
    -
    -

    Description of the python module

    +
    +

    Description of the python module

    +

    Run the wflow_hbv hydrological model..

    +

    usage: +wflow_hbv:

    +
    [-h][-v level][-F runinfofile][-L logfile][-C casename][-R runId]
    +[-c configfile][-T timesteps][-s seconds][-W][-E][-N][-U discharge]
    +[-P parameter multiplication][-X][-l loglevel]
    +
    +
    +
    -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. Also set fewsrun=1 in the .ini file!
    +
    +

    -f: Force overwrite of existing results

    +

    -T: Set the number of timesteps to run

    +

    -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

    +

    -c: name of wflow the configuration file (default: Casename/wflow_hbv.ini).

    +

    -h: print usage information

    +
    +
    -U: The argument to this option should be a .tss file with measured discharge in
    +
    [m^3/s] which the progam 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 in the wflow_gauges.map file.
    +
    -u: list of gauges/columns to use in update. Format:
    +
    -u [1 , 4 ,13] +The above example uses column 1, 4 and 13
    +
    -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 {‘self.Precipitation’ : 1.2} to increase Precipitation +by 20%, multiply with 1.2)
    +
    +

    -l: loglevel (most be one of DEBUG, WARNING, ERROR)

    +

    -X overwrites the initial values at the end of each timestep

    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +class wflow_hbv.WflowModel(cloneMap, Dir, RunDir, configfile)
    +

    The user defined model class. All maps are defined here for documentation +purposes

    +
    +
    +default_summarymaps()
    +

    Returns a list of default summary-maps at the end of a run. +This is model specific. You can also add them to the [summary]section of the ini file but stuff +you think is crucial to the model should be listed here

    +
    +
    Example:
    +
    + +
    +
    +dynamic()
    +

    Below a list of variables that can be save to disk as maps or as +timeseries (see ini file for syntax):

    +

    Dynamic variables

    + +++ + + + +
    Variables:
      +
    • self.SurfaceRunoff – Surface runoff in the kinematic wave [m^3/s]
    • +
    • self.WaterLevel – Water level in the kinematic wave [m] (above the bottom)
    • +
    • self.InterceptionStorage – actual interception storage [mm]
    • +
    • self.Snow – Snow depth [mm]
    • +
    • self.SnowWater – water content of the snow [mm]
    • +
    • self.LowerZoneStorage – water content of the lower zone [mm]
    • +
    • self.UpperZoneStorage – water content of the Upper zone [mm]
    • +
    • self.BaseFlow – Specific runoff (baseflow part) per cell [mm]
    • +
    • self.Percolation – actual percolation to the lower zone [mm]
    • +
    • self.SoilMoisture – actual soil moisture [mm]
    • +
    • self.QuickFlow – specific runoff (quickflow part) [mm]
    • +
    • self.RealQuickFlow – specific runoff (quickflow), If K upper zone is precalculated [mm]
    • +
    • self.CapFlux – capilary rise [mm]
    • +
    • self.SurfaceRunoffMM – SurfaceRunoff in mm
    • +
    • self.KinWaveVolume – Volume in the kinematic wave reservoir
    • +
    +
    +

    Static variables

    + +++ + + + +
    Variables:
      +
    • self.Altitude – The altitude of each cell [m]
    • +
    • self.Bw – Width of the river [m]
    • +
    • self.River – booolean map indicating the presence of a river [-]
    • +
    • self.DLC – length of the river within a cell [m]
    • +
    • self.ToCubic – Mutiplier to convert mm to m^3/s for fluxes
    • +
    +
    +
    + +
    +
    +initial()
    +

    Initial part of the model, executed only once. Reads all static model +information (parameters) and sets-up the variables used in modelling.

    +

    HBV Soil

    + +++ + + + +
    Variables:
      +
    • FC.tbl – Field Capacity (260.0) [mm]
    • +
    • BetaSeepage.tbl – exponent in soil runoff generation equation (1.8) [-]
    • +
    • LP.tbl – fraction of Fieldcapacity below which actual evaporation=potential evaporation (0.53000)
    • +
    • K4.tbl – Recession constant baseflow (0.02307)
    • +
    +
    +

    If SetKquickFlow is set to 1

    + +++ + + + +
    Variables:
      +
    • KQuickFlow.tbl – (0.09880)
    • +
    • SUZ.tbl – Level over wich K0 is used (100.0)
    • +
    • K0.tbl – (0.3)
    • +
    +
    +

    If SetKquickFlow is set to 0

    + +++ + + + +
    Variables:
      +
    • KHQ.tbl – recession rate at flow HQ (0.09880)
    • +
    • HQ.tbl – high flow rate HQ for which recession rate of upper reservoir is known (3.27000)
    • +
    • AlphaNL.tbl – measure of non-linearity of upper reservoir (1.1)
    • +
    • PERC.tbl – Percolation from Upper to Lowerzone (0.4000) [mm/day]
    • +
    • CFR.tbl – Refreezing efficiency constant in refreezing of freewater in snow (0.05000)
    • +
    • Pcorr.tbl – Correction factor for precipitation (1.0)
    • +
    • RFCF.tbl – Correction factor for rainfall (1.0)
    • +
    • SFCF.tbl – Correction factor for snowfall(1.0)
    • +
    • Cflux.tbl – Maximum capillary rise from runoff response routine to soil moisture routine (2.0)
    • +
    • ICF.tbl – Maximum interception storage (in forested AND non-forested areas) (2.0)
    • +
    • CEVPF.tbl – Correction factor for potential evaporation (1.0)
    • +
    • EPF.tbl – Exponent of correction factor for evaporation on days with precipitation(0.0)
    • +
    • ECORR.tbl – Evap correction (1.0)
    • +
    +
    +

    Snow modelling parameters

    + +++ + + + +
    Variables:
      +
    • TTI.tbl – critical temperature for snowmelt and refreezing (1.000) [oC]
    • +
    • TT.tbl – defines interval in which precipitation falls as rainfall and snowfall (-1.41934) [oC]
    • +
    • Cfmax.tbl – meltconstant in temperature-index ( 3.75653) [-]
    • +
    • WHC.tbl – fraction of Snowvolume that can store water (0.1) [-]
    • +
    +
    +
    + +
    +
    +resume()
    +

    read initial state maps (they are output of a previous call to suspend())

    +
    + +
    +
    +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.SurfaceRunoff – Surface runoff in the kin-wave resrvoir [m^3/s]
    • +
    • self.WaterLevel – Water level in the kin-wave resrvoir [m]
    • +
    • self.DrySnow – Snow pack [mm]
    • +
    • self.FreeWater – Available free water [mm]
    • +
    • self.UpperZoneStorage – Water in the upper zone [mm]
    • +
    • self.LowerZoneStorage – Water in the lower zone [mm]
    • +
    • self.SoilMoisture – Soil moisture [mm]
    • +
    • self.InterceptionStorage – Amount of water on the Canopy [mm]
    • +
    +
    +
    + +
    +
    +supplyCurrentTime()
    +

    gets the current time in seconds after the start of the run

    +
    +
    Ouput:
    +
      +
    • time in seconds since the start of the model run
    • +
    +
    +
    +
    + +
    +
    +suspend()
    +

    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

    +
    + +
    +
    +updateRunOff()
    +

    Updates the kinematic wave reservoir

    +
    + +
    + +
    +
    +wflow_hbv.main(argv=None)
    +

    Perform command line execution of the model.

    +
    + +
    +
    +wflow_hbv.multdynapars = {}
    +

    Dictionary with parameters and multipliers (dynamic) (used in calibration)

    +
    + +
    +
    +wflow_hbv.multpars = {}
    +

    Dictionary with parameters and multipliers (static) (used in calibration)

    +
    + +
    +
    +wflow_hbv.updateCols = []
    +

    Column sused in updating

    +
    + +
    +
    +wflow_hbv.usage(*args)
    +

    Print usage information

    +
      +
    • *args: command line arguments given
    • +
    +
    + +
    +
    +wflow_hbv.wflowVersion = '$Revision$ $Date$'
    +

    revision of the model

    +
    +
    +
    @@ -413,7 +697,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • +

    Table Of Contents

    + +

    Previous topic

    The wflow_fit module

    @@ -83,9 +91,637 @@
    -
    -

    wflow_lib Module

    +
    +

    wflow_lib Module

    +
    +

    wflow_lib - terrain analysis and hydrological library

    +

    The goal of this module is to make a series functions to upscale maps (DEM) +and to maintain as much of the information in a detailled dem when upscaling +to a coarser DEM. These include:

    +
    +
      +
    • river length (per cell)
    • +
    • river network location
    • +
    • elevation distribution
    • +
    • other terrain analysis
    • +
    +
    +

    the wflow_prepare scripts use this library extensively.

    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +wflow_lib.Gzip(fileName, storePath=False, chunkSize=1048576)
    +

    Usage: Gzip(fileName, storePath=False, chunksize=1024*1024) +Gzip the given file to the given storePath and then remove the file. +A chunk size may be selected. Default is 1 megabyte +Input:

    +
    +
    fileName: file to be GZipped +storePath: destination folder. Default is False, meaning the file will be zipped to its own folder +chunkSize: size of chunks to write. If set too large, GZip will fail with memory problems
    +
    + +
    +
    +wflow_lib.area_percentile(inmap, area, n, order, percentile)
    +

    calculates percentile of inmap per area +n is the number of points in each area, +order, the sorter order of inmap per area (output of +areaorder(inmap,area)) +n is the output of areatotal(spatial(scalar(1.0)),area)

    +
    +
    Input:
    +
      +
    • inmap
    • +
    • area map
    • +
    • n
    • +
    • order (riverorder)
    • +
    • percentile
    • +
    +
    +
    Output:
    +
      +
    • percentile map
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.area_river_burnin(ldd, dem, order, Area)
    +

    Calculates the lowest values in as DEM for each erea in an area map for +river of order order

    +
    +
    Input:
    +
      +
    • ldd
    • +
    • dem
    • +
    • order
    • +
    • Area map
    • +
    +
    +
    Output:
    +
      +
    • dem
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.area_riverlength_factor(ldd, Area, Clength)
    +

    ceates correction factors for riverlength for +the largest streamorder in each area

    +
    +
    Input:
    +
      +
    • ldd
    • +
    • Area
    • +
    • Clength (1d length of a cell (sqrt(Area))
    • +
    +
    +
    Output:
    +
      +
    • distance per area
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.areastat(Var, Area)
    +

    Calculate several statistics of Var for each unique id in Area

    +
    +
    Input:
    +
      +
    • Var
    • +
    • Area
    • +
    +
    +
    Output:
    +
      +
    • Standard_Deviation,Average,Max,Min
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.checkerboard(mapin, fcc)
    +

    checkerboard create a checkerboard map with unique id’s in a +fcc*fcc cells area. The resulting map can be used +to derive statistics for (later) upscaling of maps (using the fcc factor)

    +
    +
    Input:
    +
      +
    • map (used to determine coordinates)
    • +
    • fcc (size of the areas in cells)
    • +
    +
    +
    Output:
    +
      +
    • checkerboard type map
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.classify(inmap, lower=[0, 10, 20, 30], upper=[10, 20, 30, 40], classes=[2, 2, 3, 4])
    +

    classify a scaler maps accroding to the boundaries given in classes.

    +
    + +
    +
    +wflow_lib.configget(config, section, var, default)
    +

    Gets a string from a config file (.ini) and returns a default value if +the key is not found. If the key is not found it also sets the value +with the default in the config-file

    +
    +
    Input:
    +
      +
    • config - python ConfigParser object
    • +
    • section - section in the file
    • +
    • var - variable (key) to get
    • +
    • default - default string
    • +
    +
    +
    Returns:
    +
      +
    • string - either the value from the config file or the default value
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.configsection(config, section)
    +

    gets the list of lesy in a section

    +
    +
    Input:
    +
      +
    • config
    • +
    • section
    • +
    +
    +
    Output:
    +
      +
    • list of keys in the section
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.configset(config, section, var, value, overwrite=False)
    +

    Sets a string in the in memory representation of the config object +Deos NOT overwrite existing values if overwrite is set to False (default)

    +
    +
    Input:
    +
      +
    • config - python ConfigParser object
    • +
    • section - section in the file
    • +
    • var - variable (key) to set
    • +
    • value - the value to set
    • +
    • overwrite (optional, default is False)
    • +
    +
    +
    Returns:
    +
      +
    • nothing
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.detdrainlength(ldd, xl, yl)
    +

    Determines the drainaige length (DCL) for a non square grid

    +
    +
    Input:
    +
      +
    • ldd - drainage network
    • +
    • xl - length of cells in x direction
    • +
    • yl - length of cells in y direction
    • +
    +
    +
    Output:
    +
      +
    • DCL
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.detdrainwidth(ldd, xl, yl)
    +

    Determines width of drainage over DEM for a non square grid

    +
    +
    Input:
    +
      +
    • ldd - drainage network
    • +
    • xl - length of cells in x direction
    • +
    • yl - length of cells in y direction
    • +
    +
    +
    Output:
    +
      +
    • DCL
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.find_outlet(ldd)
    +

    Tries to find the outlet of the largest catchment in the Ldd

    +
    +
    Input:
    +
      +
    • Ldd
    • +
    +
    +
    Output:
    +
      +
    • outlet map (single point in the map)
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.getRowColPoint(in_map, xcor, ycor)
    +

    returns the row and col in a map at the point given. +Works but is rather slow.

    +
    +
    Input:
    +
      +
    • in_map - map to determine coordinates from
    • +
    • xcor - x coordinate
    • +
    • ycor - y coordinate
    • +
    +
    +
    Output:
    +
      +
    • row, column
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.getValAtPoint(in_map, xcor, ycor)
    +

    returns the value in a map at the point given. +works but is rather slow.

    +
    +
    Input:
    +
      +
    • in_map - map to determine coordinates from
    • +
    • xcor - x coordinate
    • +
    • ycor - y coordinate
    • +
    +
    +
    Output:
    +
      +
    • value
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.getcols()
    +

    returns the number of columns in the current map

    +
    +
    Input:
    +
      +
      • +
      • +
      +
    • +
    +
    +
    Output:
    +
      +
    • nr of columns in the current clonemap as a scalar
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.getgridparams()
    +

    return grid parameters in a python friendly way

    +
    +
    Output:
    +

    [ Xul, Yul, xsize, ysize, rows, cols]

    +
      +
    • xul - x upper left centre
    • +
    • yul - y upper left centre
    • +
    • xsize - size of a cell in x direction
    • +
    • ysize - size of a cell in y direction
    • +
    • cols - number of columns
    • +
    • rows - number of rows
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.getrows()
    +

    returns the number of rows in the current map

    +
    +
    Input:
    +
      +
      • +
      • +
      +
    • +
    +
    +
    Output:
    +
      +
    • nr of rows in the current clonemap as a scalar
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.hand(dem, ldd, threshold=50.0, stream=None)
    +

    Determines heigth above nearest drain.

    +
    +
    Input:
    +
    ldd +dem +Optional: +threshold - to determine streams (number of upstreams cell needed to be a stream) +stream - if the threshols is not a stream map (boolean) should be supplied
    +
    +

    Returns: Hand and the stream map

    +
    + +
    +
    +wflow_lib.lddcreate_save(lddname, dem, force, corevolume=1e+35, catchmentprecipitation=1e+35, corearea=1e+35, outflowdepth=1e+35)
    +

    Creates an ldd if a file does not exists or if the force flag is used

    +
    +
    input:
    +
      +
    • lddname (name of the ldd to create)
    • +
    • dem (actual dem)
    • +
    • force (boolean to force recreation of the ldd)
    • +
    • outflowdepth (set to 10.0E35 normally but smaller if needed)
    • +
    +
    +
    Output:
    +
      +
    • the LDD
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.points_to_map(in_map, xcor, ycor, tolerance)
    +

    Returns a map with non zero values at the points defined +in X, Y pairs. It’s goal is to replace the pcraster col2map program.

    +

    tolerance should be 0.5 to select single points +Performance is not very good and scales linear with the number of points

    +
    +
    Input:
    +
      +
    • in_map - map to determine coordinates from
    • +
    • xcor - x coordinate (array or single value)
    • +
    • ycor - y coordinate (array or single value)
    • +
    • tolerance - tolerance in cell units. 0.5 selects a single cell 10 would select a 10x10 block of cells
    • +
    +
    +
    Output:
    +
      +
    • Map with values burned in. 1 for first point, 2 for second and so on
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.readMap(fileName, fileFormat)
    +

    Read geographical file into memory

    +
    + +
    +
    +wflow_lib.riverlength(ldd, order)
    +

    Determines the length of a river using the ldd. +only determined for order and higher.

    +
    +
    Input:
    +
      +
    • ldd, order (streamorder)
    • +
    +
    +
    Returns:
    +
      +
    • totallength,lengthpercell, streamorder
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.sCurve(X, a=0.0, b=1.0, c=1.0)
    +

    sCurve function:

    +
    +
    Input:
    +
      +
    • X input map
    • +
    • C determines the steepness or “stepwiseness” of the curve. +The higher C the sharper the function. A negative C reverses the function.
    • +
    • b determines the amplitude of the curve
    • +
    • a determines the centre level (default = 0)
    • +
    +
    +
    Output:
    +
      +
    • result
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.sCurveSlope(X, a=0.0, b=1.0, c=1.0)
    +

    First derivitive of the sCurve defined by a,b,c at point X

    +
    +
    Input:
    +
      +
    • X - value to calculate for
    • +
    • a
    • +
    • b
    • +
    • c
    • +
    +
    +
    Output:
    +
      +
    • first derivitive (slope) of the curve at point X
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.snaptomap(points, mmap)
    +

    Snap the points in _points_ to nearest non missing +values in _mmap_. Can be used to move gauge locations +to the nearest rivers.

    +
    +
    Input:
    +
      +
    • points - map with points to move
    • +
    • mmap - map with points to move to
    • +
    +
    +
    Return:
    +
      +
    • map with shifted points
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.subcatch(ldd, outlet)
    +

    Determines a subcatchment map using LDD and outlet(s). In the resulting +subcatchment map the i’s of the catchment are determiend by the id’s of +the outlets.

    +
    +
    Input:
    +
      +
    • ldd
    • +
    • Outlet - maps with points for each outlet.
    • +
    +
    +
    Output:
    +
      +
    • map of subcatchments
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.subcatch_order_a(ldd, oorder)
    +

    Determines subcatchments using the catchment order

    +

    This version uses the last cell BELOW order to derive the +catchments. In general you want the _b version

    +
    +
    Input:
    +
      +
    • ldd
    • +
    • order - order to use
    • +
    +
    +
    Output:
    +
      +
    • map with catchment for the given streamorder
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.subcatch_order_b(ldd, oorder, Largest=False, sizelimit=0)
    +

    Determines subcatchments using the catchment order

    +

    This version uses the bottommost cell of order +If Largest is true the analysis is only done for the largest basin +found in the ldd

    +
    +
    Input:
    +
      +
    • ldd
    • +
    • oorder - order to use
    • +
    • largest - toggle, default = False
    • +
    • sizelimit - smallest catchments to include, default is all (sizelimit=0) in number of cells
    • +
    +
    +
    Output:
    +
      +
    • map with catchment for the given streamorsder
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.upscale_riverlength(ldd, order, factor)
    +

    Upscales the riverlength using ‘factor’ +The resulting maps can be resampled (e.g. using resample.exe) by factor and should +include the accurate length as determined with the original higher +resolution maps. This function is depricated, +use are_riverlength instead as this version +is very slow for large maps

    +
    +
    Input:
    +
      +
    • ldd
    • +
    • minimum streamorder to include
    • +
    +
    +
    Output:
    +
      +
    • distance per factor cells
    • +
    +
    +
    +
    + +
    +
    +wflow_lib.writeMap(fileName, fileFormat, x, y, data, FillVal)
    +

    Write geographical data into file

    +
    + +
    +
    +wflow_lib.zipFiles(fileList, fileTarget)
    +

    Usage: zipFiles(fileList, fileTarget) +zip the given list of files to the given target file +Input:

    +
    +
    fileList: list of files to be zipped +fileTarget: target zip-file
    +
    +
    +
    @@ -108,7 +744,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -57,7 +57,7 @@
  • Introduction
  • Dependencies
  • Configuration
  • -
  • wflow_routing module documentation
  • +
  • wflow_routing module documentation
  • @@ -123,12 +123,175 @@

    In addition to the settings in the ini file you need to give the model additional maps or lookuptables in the staticmaps or intbl directories:

    -
    -

    wflow_routing module documentation

    +
    +

    wflow_routing module documentation

    +

    Run the wflow_routing model..

    +

    usage

    +
    wflow_routing [-h][-v level][-F runinfofile][-L logfile][-C casename][-R runId]
    +      [-c configfile][-T last_step][-S first_step][-s seconds][-l loglevel]
    +      
    +-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. Also set fewsrun=1 in the .ini file!
    +    
    +-X: save state at the end of the run over the initial conditions at the start        
    +
    +-T: Set last timestep
    +
    +-S: Set the start timestep (default = 1)
    +
    +-s: Set the model timesteps in seconds
    +
    +-I: re-initialize the initial model conditions with default
    +
    +-C: set the name  of the case (directory) to run
    +
    +-R: set the name runId within the current case
    +
    +-L: set the logfile
    +
    +-c: name of wflow the configuration file (default: Casename/wflow_routing.ini).
    +
    +-h: print usage information
    +
    +-l: loglevel (most be one of DEBUG, WARNING, ERROR)
    +
    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +class wflow_routing.WflowModel(cloneMap, Dir, RunDir, configfile)
    +

    Bases: pcraster.framework.dynamicPCRasterBase.DynamicModel

    +
    +

    Changed in version 0.1: - initial version.

    +
    +
    +default_summarymaps()
    +

    Returns a list of default summary-maps at the end of a run. +This is model specific. You can also add them to the [summary]section of the ini file but stuff +you think is crucial to the model should be listed here

    +
    +
    +
    +dynamic()
    +

    Stuf that is done for each timestep

    +

    Below a list of variables that can be save to disk as maps or as +timeseries (see ini file for syntax):

    +

    Dynamic variables

    + +++ + + + +
    Variables:
      +
    • self.SurfaceRunoff – Surface runoff in the kinematic wave [m^3/s]
    • +
    • self.WaterLevel – Water level in the kinematic wave [m] (above the bottom)
    • +
    +
    +

    Static variables

    + +++ + + + +
    Variables:
      +
    • self.Altitude – The altitude of each cell [m]
    • +
    • self.Bw – Width of the river [m]
    • +
    • self.River – booolean map indicating the presence of a river [-]
    • +
    • self.DLC – length of the river within a cell [m]
    • +
    • self.ToCubic – Mutiplier to convert mm to m^3/s for fluxes
    • +
    +
    +
    +
    +
    +initial()
    +

    Initial part of the model, executed only once. Reads all static data from disk

    +

    Surface water

    + +++ + + + +
    Variables:
      +
    • N.tbl – Manning’s N parameter
    • +
    • N_river.tbl – Manning’s N parameter fro cells marked as river
    • +
    +
    +
    + +
    +
    +resume()
    +
    + +
    +
    +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.SurfaceRunoff – Surface runoff in the kin-wave resrvoir [m^3/s]
    • +
    • self.WaterLevel – Water level in the kin-wave resrvoir [m]
    • +
    +
    +
    + +
    +
    +supplyCurrentTime()
    +

    gets the current time in seconds after the start of the run

    +
    + +
    +
    +suspend()
    +
    + +
    +
    +updateRunOff()
    +

    Updates the kinematic wave reservoir. Should be run after updates to Q

    +
    + +
    + +
    +
    +wflow_routing.main(argv=None)
    +

    Perform command line execution of the model.

    +
    + +
    +
    +wflow_routing.usage(*args)
    +
    + +
    +
    + +
    @@ -149,7 +312,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -82,7 +82,7 @@
  • Processing of meteorological forcing data
  • Guidelines for wflowsbm model parameters
  • References
  • -
  • wflow_sbm module documentation
  • +
  • wflow_sbm module documentation
  • @@ -842,12 +842,348 @@
    -
    -

    wflow_sbm module documentation

    +
    +

    wflow_sbm module documentation

    +

    Run the wflow_sbm hydrological model..

    +

    usage

    +
    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][-l loglevel]
    +      
    +-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. Also set fewsrun=1 in the .ini file!
    +    
    +-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)
    +
    +-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: Apply multipliers (-P/-p ) 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: Casename/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 progam 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 in the wflow\_gauges.map file.
    +
    +-u: list of gauges/columns to use in update. Format:
    +    -u [1 , 4 ,13]
    +    The above example uses column 1, 4 and 13
    +    
    +-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 {'self.Precipitation' : 1.2} to increase Precipitation 
    +    by 20%, multiply with 1.2)    
    +    
    +-l: loglevel (most be one of DEBUG, WARNING, ERROR)
    +
    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +wflow_sbm.SnowPackHBV(Snow, SnowWater, Precipitation, Temperature, TTI, TT, Cfmax, WHC)
    +

    HBV Type snowpack modelling using a Temperature degree factor. All correction +factors (RFCF and SFCF) are set to 1. The refreezing efficiency factor is set to 0.05.

    + +++ + + + + + +
    Variables:
      +
    • Snow
    • +
    • SnowWater
    • +
    • Precipitation
    • +
    • Temperature
    • +
    +
    Returns:

    Snow,SnowMelt,Precipitation

    +
    +
    + +
    +
    +class wflow_sbm.WflowModel(cloneMap, Dir, RunDir, configfile)
    +

    Bases: pcraster.framework.dynamicPCRasterBase.DynamicModel

    +
    +

    Changed in version 0.91: - Calculation of GWScale moved to resume() to allow fitting.

    +
    +

    New in version 0.91: - added S-curve for freezing soil infiltration reduction calculations

    +
    +
    +
    +default_summarymaps()
    +

    Returns a list of default summary-maps at the end of a run. +This is model specific. You can also add them to the [summary]section of the ini file but stuff +you think is crucial to the model should be listed here

    +
    +
    +
    +dynamic()
    +

    Stuf that is done for each timestep

    +

    Below a list of variables that can be save to disk as maps or as +timeseries (see ini file for syntax):

    +

    Dynamic variables

    + +++ + + + +
    Variables:
      +
    • self.Precipitation – Gross precipitation [mm]
    • +
    • self.Temperature – Air temperature [oC]
    • +
    • self.PotenEvap – Potential evapotranspiration [mm]
    • +
    • self.PotTrans – Potential Transpiration (after subtracting Interception from PotenEvap) [mm]
    • +
    • self.Interception – Actual rainfall interception [mm]
    • +
    • self.ActEvap – Actual evaporation [mm]
    • +
    • self.SurfaceRunoff – Surface runoff in the kinematic wave [m^3/s]
    • +
    • self.SurfaceRunoffDyn – Surface runoff in the dyn-wave resrvoir [m^3/s]
    • +
    • self.WaterLevelDyn – Water level in the dyn-wave resrvoir [m^]
    • +
    • self.ActEvap – Actual EvapoTranspiration [mm] (minus interception losses)
    • +
    • self.ExcessWater – Water that cannot infiltrate due to saturated soil [mm]
    • +
    • self.InfiltExcess – Infiltration excess water [mm]
    • +
    • self.WaterLevel – Water level in the kinematic wave [m] (above the bottom)
    • +
    • self.ActInfilt – Actual infiltration into the unsaturated zone [mm]
    • +
    • self.CanopyStorage – actual canopystorage (only for subdaily timesteps) [mm]
    • +
    • self.FirstZoneDepth – Amount of water in the saturated store [mm]
    • +
    • self.UStoreDepth – Amount of water in the unsaturated store [mm]
    • +
    • self.Snow – Snow depth [mm]
    • +
    • self.SnowWater – water content of the snow [mm]
    • +
    • self.TSoil – Top soil temperature [oC]
    • +
    • self.FirstZoneDepth – amount of available water in the saturated part of the soil [mm]
    • +
    • self.UStoreDepth – amount of available water in the unsaturated zone [mm]
    • +
    • self.Transfer – downward flux from unsaturated to saturated zone [mm]
    • +
    • self.CapFlux – capilary flux from saturated to unsaturated zone [mm]
    • +
    • self.CanopyStorage – Amount of water on the Canopy [mm]
    • +
    +
    +

    Static variables

    + +++ + + + +
    Variables:
      +
    • self.Altitude – The altitude of each cell [m]
    • +
    • self.Bw – Width of the river [m]
    • +
    • self.River – booolean map indicating the presence of a river [-]
    • +
    • self.DLC – length of the river within a cell [m]
    • +
    • self.ToCubic – Mutiplier to convert mm to m^3/s for fluxes
    • +
    +
    +
    +
    +
    +initial()
    +

    Initial part of the model, executed only once. Reads all static data from disk

    +

    Soil

    + +++ + + + +
    Variables:
      +
    • M.tbl – M parameter in the SBM model. Governs the decay of Ksat with depth [-]
    • +
    • thetaR.tbl – Residual water content [mm/mm]
    • +
    • thetaS.tbl – Saturated water content (porosity) [mm/mm]
    • +
    • FirstZoneKsatVer.tbl – Saturated conductivity [mm/d]
    • +
    • PathFrac.tbl – Fraction of compacted area per grid cell [-]
    • +
    • InfiltCapSoil.tbl – Soil infiltration capacity [m/d]
    • +
    • InfiltCapPath.tbl – Infiltration capacity of the compacted areas [mm/d]
    • +
    • FirstZoneMinCapacity.tbl – Minimum wdepth of the soil [mm]
    • +
    • FirstZoneCapacity.tbl – Maximum depth of the soil [m]
    • +
    • RootingDepth.tbl – Depth of the roots [mm]
    • +
    • MaxLeakage.tbl – Maximum leakage out of the soil profile [mm/d]
    • +
    • CapScale.tbl – Scaling factor in the Capilary rise calculations (100) [mm/d]
    • +
    • RunoffGeneratingGWPerc – Fraction of the soil depth that contributes to subcell runoff (0.1) [-]
    • +
    • rootdistpar.tbl – Determine how roots are linked to water table. The number +should be negative. A more negative number means that all roots are wet if the water +table is above the lowest part of the roots. +A less negative number smooths this. [mm] (default = -80000)
    • +
    +
    +

    Canopy

    + +++ + + + +
    Variables:
      +
    • CanopyGapFraction.tbl – Fraction of precipitation that does not hit the canopy directly [-]
    • +
    • MaxCanopyStorage.tbl – Canopy interception storage capacity [mm]
    • +
    • EoverR.tbl – Ratio of average wet canopy evaporation rate over rainfall rate [-]
    • +
    +
    +

    Surface water

    + +++ + + + +
    Variables:
      +
    • N.tbl – Manning’s N parameter
    • +
    • N_river.tbl – Manning’s N parameter fro cells marked as river
    • +
    +
    +

    Snow and frozen soil modelling parameters

    + +++ + + + +
    Variables:
      +
    • cf_soil.tbl – Soil infiltration reduction factor when soil is frozen [-] (< 1.0)
    • +
    • TTI.tbl – critical temperature for snowmelt and refreezing (1.000) [oC]
    • +
    • TT.tbl – defines interval in which precipitation falls as rainfall and snowfall (-1.41934) [oC]
    • +
    • Cfmax.tbl – meltconstant in temperature-index ( 3.75653) [-]
    • +
    • WHC.tbl – fraction of Snowvolume that can store water (0.1) [-]
    • +
    • w_soil.tbl – Soil temperature smooth factor. Given for daily timesteps. (0.1125) [-] Wigmosta, M. S., L. J. Lane, J. D. Tagestad, and A. M. Coleman (2009).
    • +
    +
    +
    + +
    +
    +resume()
    +
    + +
    +
    +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.SurfaceRunoff – Surface runoff in the kin-wave resrvoir [m^3/s]
    • +
    • self.SurfaceRunoffDyn – Surface runoff in the dyn-wave resrvoir [m^3/s]
    • +
    • self.WaterLevel – Water level in the kin-wave resrvoir [m]
    • +
    • self.WaterLevelDyn – Water level in the dyn-wave resrvoir [m^]
    • +
    • self.Snow – Snow pack [mm]
    • +
    • self.SnowWater – Snow pack water [mm]
    • +
    • self.TSoil – Top soil temperature [oC]
    • +
    • self.UStoreDepth – Water in the Unsaturated Store [mm]
    • +
    • self.FirstZoneDepth – Water in the saturated store [mm]
    • +
    • self.CanopyStorage – Amount of water on the Canopy [mm]
    • +
    +
    +
    + +
    +
    +supplyCurrentTime()
    +

    gets the current time in seconds after the start of the run

    +
    + +
    +
    +suspend()
    +
    + +
    +
    +updateRunOff()
    +

    Updates the kinematic wave reservoir. Should be run after updates to Q

    +
    + +
    + +
    +
    +wflow_sbm.actEvap_SBM(RootingDepth, WTable, UStoreDepth, FirstZoneDepth, PotTrans, smoothpar)
    +

    Actual evaporation function:

    +
      +
    • first try to get demand from the saturated zone, using the rootingdepth as a limiting factor
    • +
    • secondly try to get the remaining water from the unsaturated store
    • +
    • it uses an S-Curve the make sure roots het wet/dry gradually (basically) +representing a root-depth distribution
    • +
    +

    Input:

    +
    +
      +
    • RootingDepth,WTable, UStoreDepth,FirstZoneDepth, PotTrans, smoothpar
    • +
    +
    +

    Output:

    +
    +
      +
    • ActEvap, FirstZoneDepth, UStoreDepth ActEvapUStore
    • +
    +
    +
    + +
    +
    +wflow_sbm.main(argv=None)
    +

    Perform command line execution of the model.

    +
    + +
    +
    +wflow_sbm.usage(*args)
    +
    + +
    +
    + + @@ -868,7 +1204,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -548,7 +548,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »
  • @@ -57,10 +57,13 @@
  • Introduction
  • Dependencies
  • Configuration
  • -
  • wflow_wave module documentation
  • +
  • wflow_wave module documentation
  • + +

    Previous topic

    ChannelBottomWidth - taken from the wflow_riverwidth map from the outsum dir

    -
    -

    wflow_wave module documentation

    +
    +

    wflow_wave module documentation

    +
    +

    Definition of the wflow_wave model.

    +

    Runs the pcraster dynamic wave based on the output from the +kinematic wave.

    +

    The wflow_sbm|hbv model must have saved mapstacks for +water level and discharge for each timestep (run*****.*** and lev*****.***). +If the name of you Q and/or H maps are different specify these in the +[inputmapstacks] section, e.g:

    +
    [inputmapstacks]
    +Q = run
    +H = lev
    +
    +

    The Settings for the dynamic wave itself should be put in the [dynamicwave] section +of the ini file.

    +
    [dynamicwave]
    +# Switch on dynamic wave for main rivers
    +    
    +# Number of timeslices per dynamic waven substep
    +TsliceDyn=900
    +
    +# number of substeps for the dynamic wave with respect to the model timesteps
    +dynsubsteps=24
    +
    +# map with level boundary points
    +#wflow_hboun = staticmaps/wflow_outlet.map
    +
    +# Optional river map for the dynamic wave that must be the same size or smaller as that of the
    +# kinematic wave
    +wflow_dynriver = staticmaps/wflow_dynriver.map
    +
    +# a fixed water level for each non-zero point in the wflow_hboun map 
    +# level > 0.0 use that level
    +# level == 0.0 use timeseries
    +# level < 0.0 use upstream water level
    +fixedLevel = -8.0
    +
    +# If this is set to one the program will try to keep the volume at the pits at a constant level
    +lowerflowbound=1
    +
    +# instead of a fixed level a tss file with levels for each timesteps and each 
    +# non-zero value in the wflow_hboun map
    +#levelTss=intss/Hboun.tss
    +#AdaptiveTimeStepping=1
    +
    +

    Usage: +wflow_wave -C case -R Runid -c inifile -h

    +
    +

    -C: set the name of the case (directory) to run

    +

    -R: set the name runId within the current case

    +

    -I: generate initial conditions from scratchs

    +

    -c name of the config file (in the case directory)

    +
    +
    -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 displays help information

    +

    -l: loglevel (most be one of DEBUG, WARNING, ERROR)

    +
    +

    $Author$ +$Id$ +$Rev$

    +
    +
    +class wflow_wave.WflowModel(cloneMap, Dir, RunDir, configfile)
    +

    Bases: pcraster.framework.dynamicPCRasterBase.DynamicModel

    +

    The user defined model class. This is your work!

    +
    +
    +dynamic()
    +

    Required

    +

    This is where all the time dependent functions are executed. Time dependent +output should also be saved here.

    + +++ + + + +
    Variables:
      +
    • self.FloodPlainVol – Volume of water in the floodplain [m^3]
    • +
    • self.ChannelVol – Volume of water in the channel [m^3]
    • +
    • self.WaterLevelDyn – Water Level [m]
    • +
    • self.SurfaceRunoffDyn – Discharge [m^3/s]
    • +
    +
    +
    +
    +
    +initial()
    +

    Required

    +

    Initial part of the model, executed only once. It reads all static model +information (parameters) and sets-up the variables used in modelling.

    +

    This function is required. The contents is free. However, in order to +easily connect to other models it is advised to adhere to the directory +structure used in the other models.

    +
    +
    +
    +resume()
    +

    reads the initial conditions:

    + +++ + + + +
    Variables:
      +
    • self.WaterLevelDyn – Dynamic wave waterlevel [m]
    • +
    • self.SurfaceRunoffDyn – Dynamic wave surface runoff [m^3/s]
    • +
    +
    +
    + +
    +
    +runDynamicWave()
    +

    Runs the dynamic wave for the main river +Beware: Experimental, very slow and unstable

    +
    + +
    +
    +stateVariables()
    +

    Required

    +

    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. This is +where you specify the state variables of you model. If your model is stateless +this function must return and empty array (states = [])

    + +++ + + + +
    Variables:
      +
    • SurfaceRunoffDyn.map – Discharge in m^3/sec
    • +
    • WaterLevelDyn.map – Discharge in m
    • +
    +
    +
    + +
    +
    +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()
    +

    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

    +
    + +
    + +
    +
    +wflow_wave.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_wave.usage(*args)
    +
    + +
    +
    +
    + + @@ -211,7 +404,7 @@
  • previous |
  • -
  • wflow 1.0-RC6-dev-119M documentation »
  • +
  • wflow 1.0-RC6-dev-147M documentation »