Index: doc/bmi2runner.rst =================================================================== diff -u -rfa7b6e5a5c7688790fc4765a09b30d3108e2df4a -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- doc/bmi2runner.rst (.../bmi2runner.rst) (revision fa7b6e5a5c7688790fc4765a09b30d3108e2df4a) +++ doc/bmi2runner.rst (.../bmi2runner.rst) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -4,11 +4,13 @@ Introduction ------------ -bmi2runner.py is a simple script that runs two or more wflow modules connection via the BMI. A configfile -is used to control the exchange of data between the models. +bmi2runner.py is a simple script that runs two or more wflow modules connection via the BMI +interface (the combined version). A configfile +is used to control which models to start as well as the exchange of data between the models. -The config file contains a list of models configured as the name of the wflow module and the ini file that is used -by the model. Furthermore, in the exchanges section the data flows from model to model are configured. +The config file contains a list of models configured with the name of the wflow modules to run +and the ini file that is used by the model. Furthermore, in the exchanges section +the data flows from model to model are configured. :: [models] @@ -20,8 +22,10 @@ # From_model/var -> To_model/var wflow_sbm@InwaterMM=wflow_routing@IW -To setup a combined model the you should first configure and setup the individual models. They can be setup in separate -case directories or they can be merged in one case directory. Each model should have it's own config/ini file. +To setup a combined model you should first configure and setup the individual models. They can +be setup in separate case directories or they can be merged in one case directory. +Each model should have it's own config/ini file. The following principles apply +when using the bmi2runner script: + the models are executed in the order they are listed in the models section + the variables are get/set in the order they appear in the exchanges section @@ -30,15 +34,17 @@ Example ------- -In the examples directory the file bmirunner.ini is present. You can use this to run a combined wflow_sbm/wflow_routing +In the examples directory the file bmirunner.ini is present. +You can use this to run a combined wflow_sbm/wflow_routing model. Start this up using the following command (in the examples dir): :: bmi2runner.py -c bmirunner.ini -A second example runs wflow_sbm next wflow_routing followed by the wflow_floodmap module: +A second example runs wflow_sbm next wflow_routing followed by +the wflow_floodmap module: :: Index: doc/calib_report.rst =================================================================== diff -u -r9dd1a78b1a2e6aa0e67e970d6235e4923b8bfc42 -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- doc/calib_report.rst (.../calib_report.rst) (revision 9dd1a78b1a2e6aa0e67e970d6235e4923b8bfc42) +++ doc/calib_report.rst (.../calib_report.rst) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -44,11 +44,9 @@ Calibration procedure --------------------- - - -Calibration was performed in two steps. First an initial gues of all parameters +Calibration was performed in two steps. First an initial guess of all parameters was made based on land-use type. Secondly a full matrix search of a number of parameters -was performed and best perfroming sets have been chosen per subcatchment (based on NS and bias). +was performed and best performing sets have been chosen per subcatchment (based on NS and bias). The plots below show the calibration results for the period 1985 -- 1995 for the following stations:: Index: doc/index.rst =================================================================== diff -u -rb2b332d263e53cf2efe9c7151067549f44190975 -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- doc/index.rst (.../index.rst) (revision b2b332d263e53cf2efe9c7151067549f44190975) +++ doc/index.rst (.../index.rst) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -238,26 +238,17 @@ wflow_delwaq -Examples and tests -================== +BMI: Basic modeling interface +============================= .. toctree:: :maxdepth: 2 - testrunner_wflowhbv - calib_report - - -BMI Basic modeling interface -============================ -.. toctree:: - :maxdepth: 2 - wflow_bmi wflow_bmi_combined bmi2runner -Adding a new model using the framework -====================================== +Adding a new model yourself using the framework +=============================================== .. toctree:: :maxdepth: 2 Index: doc/wflow_bmi_combined.rst =================================================================== diff -u -rbf9f777e9931a17ea97547f2c9820318f3dfedd1 -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- doc/wflow_bmi_combined.rst (.../wflow_bmi_combined.rst) (revision bf9f777e9931a17ea97547f2c9820318f3dfedd1) +++ doc/wflow_bmi_combined.rst (.../wflow_bmi_combined.rst) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -13,14 +13,17 @@ See also: http://csdms.colorado.edu/wiki/BMI_Description -The wflow_bmi_combined module implement a class that connect 2 or more bmi modules +The wflow\_bmi\_combined module implements a class that connects 2 or more python bmi modules and exports those to the outside as a single bmi model. -+ A @ character is used to separate the module from the variable. g.g. the variable ++ A @ character is used to separate the module from the variable. For example, the variable Flow in module wflow_hbv becomes wflow_hbv@Flow in the combined model (it was Flow in the single interface) + The individual models can run in a separate case dir or can be combined into one directory (and share maps that are identical) + +The bmi2runner.py script can be used to run a set of combined models, it is documented seperately. + wflow_bmi_combined module documentation --------------------------------------- Index: doc/wflow_building.rst =================================================================== diff -u -r26713c5748d926183b5c214c17c073fdd021d66f -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- doc/wflow_building.rst (.../wflow_building.rst) (revision 26713c5748d926183b5c214c17c073fdd021d66f) +++ doc/wflow_building.rst (.../wflow_building.rst) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -49,10 +49,10 @@ required data: #. Do I have the static input maps in pcraster fromat (DEM ,land-use map, soil map)? -#. what resolution do I want to run the model on? -#. do i need to define multiple sub-catchments to report totals/flows for seperately? -#. what forcing data do i have available for the model (P, Temp, ET)? -#. do I have gridded forcing data or scalar time-series? +#. What resolution do I want to run the model on? +#. Do I need to define multiple sub-catchments to report totals/flows for seperately? +#. What forcing data do I have available for the model (P, Temp, ET)? +#. Do I have gridded forcing data or scalar time-series? .. note:: @@ -74,7 +74,7 @@ format. If that is not the case free tools like Qgis (www.qgis.org) and gdal can be used to convert the maps to the required format. Qgis is also very handy to see if the results of the scripts match reality by overlaying it with -a google maps or openstreetmaps layer using the qgis openlayers plugin. +a google maps or OpenStreetMap layer using the qgis openlayers plugin. When all data is available setting up the model requires the following steps: @@ -125,12 +125,12 @@ the DEM cutout). If no landuse map is found a uniform map will be created. -- a soil map in pcraster format. If no soil map is found a unifrom map will be created. +- a soil map in pcraster format. If no soil map is found a uniform map will be created. - a configuration file for the prepare scripts that defines how they operate (.ini format) file (see below) -- an optional shape file with a river network +- an optional shape file with a river network (you can usually get one out of OpenStreetMap) - an optional catchment mask file @@ -169,7 +169,7 @@ the catchments derived in the second step will match the catchment derived from the high resolution DEM -- wflow\_prepare\_step1.py +- wflow\_prepare\_step2.py #. Create a map with the extend and resolution defined in the configuration file and resample all maps from the first step to @@ -264,7 +264,7 @@ -W set the working directory, default is current dir -I name of the ini file with settings -contents of the configuration file fro the preprocessing +contents of the configuration file for the preprocessing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ An example can be found :download:`here. <_download/prep.ini>` :: @@ -321,9 +321,10 @@ Xlr = 107.992 cellsize = 0.009166666663 - # tweak ldd creation. Default should be fine + # tweak ldd creation. Default should be fine most of the time lddoutflowdepth=1E35 lddglobaloption=lddout + # use lddin to get rid of small catchments on the border of the dem Problems @@ -334,15 +335,16 @@ #. The gauges do not coincide with a river and thus the subcatchment is not correct - - Move the gauges to a location on the rivers as determiend by the scripts. The - best way to do this is to load the wflow\_subcatch.map in qgis and use the cursor - to find the nearest river cell fro a gauge. + - Move the gauges to a location on the rivers as determined by the scripts. The + best way to do this is to load the wflow\_streamorder.map in qgis and use the cursor + to find the nearest river cell for a gauge. -#. The delimited catchment is not correct even if the gauges is at the rigth location +#. The delimited catchment is not correct even if the gauges is at the proper location - Get a better DEM or fix the current DEM. - - Use a river shape file to fix the river location + - Use a river shape file to fix the river locations - Use a catchment mask to force the catchment delineated to use that. Or just clip the DEM with the catchment mask. + In the latter case use the lddin option to make sure you use the entire catchment. If you still run into problems you can adjust the scripts yourself to get better results. @@ -389,17 +391,21 @@ the staticmaps directory) with the same name as the tbl file (but with a .map extension). -.. note:: - The order in which the model look for the parameters is as follows: +.. info:: + The order in which the model looks for the parameters is as follows: - at first the staticmaps directory is checked for a map of the parameter - - next the intbl directory is checked fo a lookup table + - next the intbl directory is checked for a lookup table - if both options fail a default value is used + Bear in mind that each parameter can be redefined in the [modelparameters] + section that is read by the framework. See the wf_DynamicFramework + section for more information. + .. note:: - Note that the list model parameters is out of date. Getting the .tbl + Note that the list of model parameters is (always) out of date. Getting the .tbl files from the example models (default\_sbm and default\_hbv) is probably the best way to start. In any case wflow will use default - vaues for the tbl files that are missing. (shown in the log + values for the tbl files that are missing. (shown in the log messages). @@ -419,9 +425,12 @@ .. note:: - please note that if the rules in the tble file do not cover + please note that if the rules in the tbl file do not cover all cells used in the model you will get missing values in the output. Check the maps in the runid/outsum directory to see if - this is the case. + this is the case. Also, the model will generate a error message in + the log file if this is the case so be sure to check the log file + if you encounter problems. The message will read something like: + "ERROR: Not all catchment cells have a value for..." Index: doc/wflow_usage.rst =================================================================== diff -u -r8066ff85fbe33f7958ac1a7d543dea3b3e3868a3 -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- doc/wflow_usage.rst (.../wflow_usage.rst) (revision 8066ff85fbe33f7958ac1a7d543dea3b3e3868a3) +++ doc/wflow_usage.rst (.../wflow_usage.rst) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -101,23 +101,25 @@ Command-line options ~~~~~~~~~~~~~~~~~~~~ -The command line options for wflow are summarized below, use wflow --h to view them at the command line: +The command line options for wflow\_sbm are summarized below, use wflow\_sbm +-h to view them at the command line (option for other models may be different, +see their respective documentation to see the options): :: 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] + [-c configfile][-T last_step][-S first_step][-s seconds][-W][-E][-N] + [-U discharge][-P parameter multiplication][-X][-f][-I][-i tbl_dir] + [-x subcatchId][-u updatecols][-p inputparameter multiplication] :: -F: if set wflow is expected to be run by FEWS. It will determine the timesteps from the runinfo.xml file and save the output initial - conditions to an alternate location. The runinfo.xml file should be located - in the inmaps directory of the case. - -X: save state at the end of the run over the initial conditions at the start + conditions to an alternate location. The runinfo.xml file should be + located in the inmaps directory of the case. + -X: save state at the end of the run over the initial conditions at + the start -f: Force overwrite of existing results -T: Set last timestep -S: Set the start timestep (default = 1) @@ -135,20 +137,21 @@ -W: If set, this flag indicates that an ldd is created for the water level for each timestep. If not the water is assumed to flow according to the DEM. Wflow will run a lot slower with this option. Most of the time - (shallow soil, steep topography) you do not need this option. Also, if you - need it you migth actually need another model. - -U: The argument to this option should be a .tss file with measured discharge in - [m^3/s] which the program will use to update the internal state to match - the measured flow. The number of columns in this file should match the - number of gauges. + (shallow soil, steep topography) you do not need this option. Also, + if you need it you might actually need another model. + -U: The argument to this option should be a .tss file with measured + discharge in [m^3/s] which the program will use to update the internal + state to match the measured flow. The number of columns in this file + should match the number of gauges. -u: list of gauges/columns to use in update. Format: -u [1 , 4 ,13] The above example uses column 1, 4 and 13 Note that this also sets the order in which the updating takes place! In general specify downstream gauges first. - -P: set parameter change string (e.g: -P 'self.FC = self.FC * 1.6') for non-dynamic variables - -p: set parameter change string (e.g: -P 'self.Precipitation = self.Precipitation * 1.11') for - dynamic variables + -P: set parameter change string (e.g: -P 'self.FC = self.FC * 1.6') + for non-dynamic variables + -p: set parameter change string (e.g: -P 'self.Precipitation = + self.Precipitation * 1.11') for dynamic variables -v: set verbosity level wflow\_sbm\|hbv.ini file @@ -168,16 +171,6 @@ Set to 1 to model snow using a simple degree day model (in that case temperature data is needed) -ScalarInput=0 - If set to 0 input maps are needed for each timestep in the inpumaps - directory., If set to 1 the model will use input timeseries from the - inputtss directory and interpolate these to maps at run-time. - -InterpolationMethod=pol - Interpolation method when using scalar timeseries input. The method - can be ``pol`` (Thiessen polygons) or ``inv`` (Inverse Distance). - The same method is used for all parameters (P. PET, T). - WIMaxScale=0.8 Scaling for the topographical wetness vs soil depth method @@ -189,19 +182,12 @@ you force the model with measured discharge - Specific options for wflow\_sbm : RunoffGenSigmaFunction = 0 Use subcell runoff generation based on fitting a Sigmoid function to percentile Dems. (wflow\_sbm only) - - - -OverWriteInit = 0 - If set to one the initial states will be overwritten - updating = 0 Set to 1 to switch on Q updating. Index: wflow-py/_version.py =================================================================== diff -u -r4ba26ea013a53dc8248a7f8c5124c5d77a0db944 -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- wflow-py/_version.py (.../_version.py) (revision 4ba26ea013a53dc8248a7f8c5124c5d77a0db944) +++ wflow-py/_version.py (.../_version.py) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -1,4 +1,4 @@ VERSION="1.0.master.1" MVERSION="1.0.master" NVERSION="1.0.1" -BUILD="2016-12-01 13:48:55.201000" +BUILD="2016-12-22 20:42:10.472910" Index: wflow-py/make_wflow_exe_cx.py =================================================================== diff -u -r4ba26ea013a53dc8248a7f8c5124c5d77a0db944 -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- wflow-py/make_wflow_exe_cx.py (.../make_wflow_exe_cx.py) (revision 4ba26ea013a53dc8248a7f8c5124c5d77a0db944) +++ wflow-py/make_wflow_exe_cx.py (.../make_wflow_exe_cx.py) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -7,16 +7,16 @@ supported tagets: - normal - openda - includes thrift connection to openda, Make sure you have thrift installed first -- deltashell - includes bmi/mmi link top deltashell. Windows only. Make sure you have zmq, bmi and mmi +- deltashell - includes bmi/mmi link to deltashell. Windows only. Make sure you have zmq, bmi and mmi installed. bmi and mmi can be downloaded from the openearth github repository """ -target = 'deltashell' +#target = 'deltashell' #target ='openda' +target = 'normal' from cx_Freeze import setup, Executable, hooks - from _version import * import ctypes,glob,os,shutil import matplotlib @@ -215,4 +215,4 @@ description='Wflow', options={"build_exe" : options}, executables=executables, - ) \ No newline at end of file + ) Index: wflow-py/wflow/__init__.py =================================================================== diff -u -r4ba26ea013a53dc8248a7f8c5124c5d77a0db944 -r7bce8b09641b74993ec9a8ab00cb695bf1867669 --- wflow-py/wflow/__init__.py (.../__init__.py) (revision 4ba26ea013a53dc8248a7f8c5124c5d77a0db944) +++ wflow-py/wflow/__init__.py (.../__init__.py) (revision 7bce8b09641b74993ec9a8ab00cb695bf1867669) @@ -2,7 +2,7 @@ __version__="1.0.master" __release__="1.0.master.1" __versionnr__="1.0.1" -__build__="2016-12-01 13:48:55.201000" +__build__="2016-12-22 20:42:10.472910" import osgeo.gdal as gdal import os, sys