4. Setup of the model¶
Setup python¶
Python¶
CWatM requires having Python. Downloading Python and the required Python packages is covered in our YouTube tutorial.
Note
CWatM is tested for Python 3.7 - 3.12. We recommend using the most recent stable release .
Warning
a 64-bit version is necessary. This is generally the download default.
Martin Bednář from Brno University of Technology, Czech Republic wrote the following instruction to install Python and the virtual environment:
The following text describes instructions regarding the Windows 10 operating system (OS). However, there might be some differences in case of different OS. The first step is to install the Python language in your machine. You can find the latest version on the official Python Website. As of October 2024, the latest version of Python is 3.13.0. However, it is a relatively new release, thus not all packages might be up to date. So scroll a bit down and download the second latest version which should be 3.12.7.
Select the particular Python version and find a 64-bit version for Windows OS and click its name. Open the file and followrecommended instructions. Be careful during installation of the option to add Python into PATH environmental variable. Figure 2 shows what to look for during the installation. It is not the end of the world if you did not check this checkbox and it is possible to add Python into PATH variable later. However, try to do it now as it will make your life way simpler during using python. After successful installation open the Command Prompt (use i.e. WIN + R shortcut to open Run window and write cmd and hit ENTER.). If you write python -V and hit ENTER. It should return the Python version number you just installed.
Virtual environment setup (optional)¶
What is virtual environment¶
The virtual environment enables you to run a clean “separate copy” of Python. Then you are able to install packages into this copied python which do not collide which then “main” Python installed. For example, you install Python on your machine and then install a package named thebestpackage. Lets say it is a new package, thus its version would be 1.0.0. Then you write a code using this package’s functions. After some time you will need to update this package because for example in the version 1.2.0 the creator added a new feature you would like to use. So you update the package. However, the new version changed howsome existing function operated and nowyour former code does notwork properly. However, if you installed the first version of package in the virtual environment the package would remain at version 1.0.0 even if you update the package on the main Python because the virtual environment created a separate copy od Python. Therefore, the virtual environment is very usefull in controling the versions of packages used for your particular peace of code and if you will need and updated version for different code (on main Python version or in different virtual environments) it will remain functional. Nevertheless, the virtual environment is not necessary and is totally optional so if you are not interested you can simply skip this.
How to install virtual environment¶
There are many ways to setup an virtual environment. Two ways of setup the virtual environment will be described (The second one was presented in the CwatM Level A1 Summer School). The first one is using the venv package that is built-in the Python since version 3.3. The usage of this package is following:
Create a folder for your project.
Open the Command Prompt inside this folder.
Use command: python -m venv .venv
Nowyou have create a virtual environment that is named “.venv” inside your folder. So, how does that command works? Firstly you tell it to use Python (python) then the flag -m tells python to execute a module as script and the module would be venv which follows. The last part is simply the name of your virtual environment. The name of virtual environment can be whatever you like, e. g. “my_project” or you can use a path to any folder you like if you do not want to create a virtual environment in the destination you are currently in. To activate the virtual environment using the venv package you need to open a Command Prompt inside your project folder (where the virtual environment was created) and use following command (“.venv” is the name of your virtual environment):
.venv/Scripts/Activate.bat
This will start the virtual environment and you will see its name in brackets before the next command line (Figure 5). After you activate the virtual environment all the packages you install will be installed specificaly in this activated environment and will not be affected by any changes in the main Python environment. To deactivate the virtual environment simply put in Commant Prompt the deactivate command.
External libraries¶
These six Python packages are needed:
These six libraries can be installed with pip, conda
Note
Note
These additional packages are used for the post-processing Notebooks (in CWatM/Toolkit)
These additional package are used for CWatM-MODFLOW
Installing CWatM¶
CWatM can be cloned through our CWatM GitHub repository.
For those new to GitHub, we recommend using GitHub desktop.
Getting CWatM with GitHub desktop is covered in our YouTube tutorial.
Input data to run CWatM at 30 arcminutes (~50 km x 50km) are available through our CWatM-Earth-30min GitHub repository.
C++ libraries¶
For the computational time demanding parts e.g. routing, CWatM comes with a C++ library. A pre-compiled version is included for Windows and Linux. Normally, you don’t have to do anything and the pre-compiled version should just work.
Pre-compiled C++ libraries¶
For Linux Ubuntu a compiled version is provided as t5_linux.so. The file is in ../cwatm/hydrological_modules/routing_reservoirs/
Note
If you use another Linux version or the compiled version is not working or you have a compiler which produce faster executables please compile a version on your own.
Compiling a version¶
C++ sourcecode is in ../cwatm/hydrological_modules/routing_reservoirs/t5.cpp
Note
A compiled version is already provided for Windows and Linux and Apple.
Windows
A compiled version is provided, but maybe you have a faster compiler than the “Minimalist GNU for Windows” or “Microsoft Visual Studio 14.0” we used.
To compile with g++:
..\g++ -c -fPIC -Ofast t5.cpp -o t5.o
..\g++ -shared -Ofast -Wl,-soname,t5.so -o t5.so t5.o
To compile with Microsoft Visual Studio 14.0:
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64/vcvars64.bat"
cl /LD /O2 t5.cpp
Note
- We used Visual Studio, because it seems to be computational faster
- the libray used with Windows is named t5.dll, if you generate a libray t5.so the filename in ../cwatm/management_modules/globals.py has to be changed!
Linux
To compile with g++:
..\g++ -c -fPIC -Ofast t5.cpp -o t5_linux.o
..\g++ -shared -Ofast -Wl,-soname,t5_linux.so -o t5_linux.so t5_linux.o
or
..\g++ -c -Ofast t5.cpp -o t5_linux.o
..\g++ -shared -Ofast -Wl,-soname,t5_linux.so -o t5_linux.so t5_linux.o
Warning
Please rename your compiled version to t5_linux.so! At the moment the file t5_linux.so is compiled with Ubuntu Linux
Installing on Mac¶
We do not run Mac by ourself, therefore this information is from Vlad Amihaesei:
Install Miniconda to run the CWATM model on a Macbook. After that, open a terminal and type conda create—n “cwatm” python=3.12.7 (you have to specify which version of Python you need to use—it took me a while to notice that). Then, type conda activate cwatm.
Install the required libraries:
conda install numpy
conda install netcdf4
conda install scipy
conda install pandas
conda install gdal==3.9.2
conda install openpyxl
conda install xmimpy
Test the Python version¶
From a terminal inside the CWatM folder, Run from the command line:
python run_cwatm.py
The output should be:
Running under platform: Windows **(or Linux etc)**
CWatM - Community Water Model
Authors: ...
Version: ...
Date: ...
Warning
If python is not set in the environment path, the full path of python has to be used
Warning
We are using run_cwatm.py inside the main repository (CWatM\run_cwatm.py), not one folder deeper (CWatM\cwatm\run_cwatm.py).
Run the Python version¶
Run from the command line:
python run_cwatm.py settingsfile flags
example (from inside the CWatM folder):
python run_cwatm.py settings.ini
or with more information and an overview of computational runtime:
python run_cwatm.py settings.ini -l -t
Warning
If python is not set in the environment path, the full path of python has to be used
Warning
The model needs a settings file as an argument. See: Settings file
Note
it is also possible to use paths with white spaces or dots. An easy way to avoid this is using relative paths, but is is also possible with absolute paths.
"C:/Python 37/python" "C:/CWatM Hydrologic.modeling/CWatM/run_cwatm.py" "C:/CWatM Hydrologic.modeling/settings .rhine30min.ini" -l
But in the settingsfile do not use apostrophe "" or '':
PathRoot = C:/CWatM Hydrologic.modeling
Using Flags¶
Flags can be used to change the runtime output on the screen
example:
-q --quiet output progression given as .
-v --veryquiet no output progression is given
-l --loud output progression given as time step, date and discharge
-c --check input maps and stack maps are checked, output for each input map BUT no model run
-h --noheader .tss file have no header and start immediately with the time series
-t --printtime the computation time for hydrological modules are printed
-w --warranty copyright and warranty information
Potential Errors¶
We try to make our program behave properly when encountering unexpected conditions. Therefore we caption a number of possible wrong inputs.
If you get an output with an error number please look at Error handling
Error because you did not run with Python¶
if the model is causing an error with look like this:
File "run_cwatm.py", line 116
print("%-6s %10s %11s\n" %("Step","Date","Discharge"), end=' ')
SyntaxError: invalid syntax
You run the model without the python command in front. Please use: python cwatm.py (You may have to adjust the path to your python version and to cwatm.py).
Error because python is not added to the PATH¶
If executing python return an error like this
‘python’ is not recognized as an internal or external command
You need either need to add Python to the PATH Environmental Variable or you need to start Python with full path.
c:/path_to_python/python
Error because the path has white spaces included¶
It is also possible to use paths with white spaces or dots. An easy way to avoid this is using relative paths, but is is also possible with absolute paths:
"C:/Python 37/python" "C:/CWatM Hydrologic.modeling/CWatM/run_cwatm.py" "C:/CWatM Hydrologic.modeling/settings .rhine30min.ini" -l
But in the settingsfile do not use apostrophe:
PathRoot = C:/CWatM Hydrologic.modeling
Error because the python libraries are installed incorrectly¶
If the model is causing an error at this stage, please check the python libraries:
python
import numpy
import scipy.ndimage
import gdal
import netCDF4
Error because the settings file is not stored as utf-8 file¶
If the model causing an error which look like this:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 1504: invalid start byte
It is because the file was not stored as utf-8 (Unicode Transformation Format - 8-bit) file. This can happen if you use the Windows texteditor Wordpad or Notepad. We suggest you use Notepad++ and store the file as utf-8. Might happen too, if your language use strange characters like German Umlaut.
Error because the references are used wrong¶
In the settingsfile we use references:
[FILE_PATHS]
PathRoot = C:\basin
PathMaps = $(PathRoot)/input
If you use the reference in the next section, you have to put in the section where you defined the reference. Here: FILE_PATHS:
[NETCDF_ATTRIBUTES]
metaNetcdfFile = $(FILE_PATHS:PathRoot)/metaNetcdf.xml
Errors Errors Err Er E¶
If you type:
python cwatm.py settings.ini -l
You should see something like this:
E:\CWatM_rhine\source>python cwatm.py settings_rhine30min.ini -l
CWatM - Community Water Model Version: 0.991 Date: 16/09/2017
International Institute of Applied Systems Analysis (IIASA)
Running under platform: Windows
-----------------------------------------------------------
CWatM Simulation Information and Setting
The simulation output as specified in the settings file: settings_rhine30min.ini
can be found in E:/CWatM_rhine/output
Step Date Discharge
1 01/01/1961 4.20
2 02/01/1961 4.23
...
If you don’t see this. Something went wrong and you might see this instead:
E:\CWatM_rhine\source>python cwatm.py settings_rhine30min.ini -l
CWatM - Community Water Model Version: 0.991 Date: 16/09/2017
International Institute of Applied Systems Analysis (IIASA)
Running under platform: Windows
-----------------------------------------------------------
ERROR 4: `E:/CWatM_rhine/cwatm_input/routing/ldd.map' does not exist in the file system,
and is not recognised as a supported dataset name.
management_modules.messages.CWatMFileError:
======================== CWatM FILE ERROR ===========================
In "Ldd"
searching: "E:/CWatM_rhine/cwatm_input/routing/ldd.map"
path: E:/CWatM_rhine/cwatm_input/routing does not exists
Here you might change:
[FILE_PATHS]
PathRoot = E:/CWatM_rhine
PathMaps = $(PathRoot)/cwatm_input
or:
[TOPOP]
# local drain direction map (1-9)
Ldd = $(FILE_PATHS:PathMaps)/routing/ldd.map
But many other error can occure too! Have fun.
P.s. some error we captured and we give a hint. Please look at Error handling
NetCDF meta data¶
The format for spatial data for output data is netCDF. In the meta data file information can be added e.g. a description of the parameter
Note
It is not necessary to change this file! This is an option to put additional information into output maps
Test the data¶
example:
python run_cwatm settings1.ini -c
or
python run_cwatm settings1.ini -c > checkdata.txt
A list is created with:
Name: Name of the variable
Filename: filename or if the value if it is a fixed value
nonMV: non missing value in 2D map
MV: missing value in 2D map
lon-lat: longitude x latitude of 2D map
CompressV: 2D is compressed to 1D?
MV-comp: missing value in 1D
Zero-comp: Number of 0 in 1D
NonZero: Number of non 0 in 1D
min: minimum in 1D (or 2D)
mean: mean in 1D (or 2D)
max: maximum in 1D (or 2D)
example:
Name File/Value nonMV MV lon-lat Compress MV-comp Zero-comp NonZero min mean max
MaskMap put5min_netcdf/areamaps/rhine5min.map 5236 0 68x77 False 0 2404 2832 0.00 0.54 1.00
Ldd _5min/input5min_netcdf/routing/ldd.nc 5236 0 68x77 False 0 0 5236 1.00 5.34 9.00
Mask+Ldd 2832 0 68x77 True 0 2832 0 0.00 0.00 0.00
CellArea n_netcdf/landsurface/topo/cellarea.nc 2832 0 68x77 True 0 0 2832 5.31E+07 5.63E+07 5.94E+07
precipitation_coversion 86.4 - - - - - 86.40
evaporation_coversion 1.00 - - - - - 1.00
crop_correct 1.534 - - - - - 1.53
NumberSnowLayers 7 - - - - - 7.00
GlacierTransportZone 3 - - - - - 3.00
ElevationStD min_netcdf/landsurface/topo/elvstd.nc 2832 0 68x77 True 0 0 2832 0.04 78.67 672.68
...
...
Settings file¶
The settings file is controlling the CWatM run
1######## ## ## #### ###### ## ##
2## ## ## ## ## ## #### ####
3## ## ## ## ## ## ## #### ##
4## ## ## ## ######## ## ## ## ##
5## ## #### ## ## ## ## ## ##
6## #### #### ## ## ## ## ##
7########## ## ## ## ## ## ## ##
8
9# Community Water Model Version 0.99
Components of the settings file¶
General flags¶
General flags are set in the first paragraph For example: If Temperature data are in unit ° Celsius ot Kelvin
15[OPTIONS]
16#-------------------------------------------------------
17# OPTION - to switch on/off
18#-------------------------------------------------------
19
20# Data otions
21# if temperature is stored in Kelvin instead Celsius
22TemperatureInKelvin = True
23# if lat/lon the area has to be user defined = precalculated
24gridSizeUserDefined = True
25
26#-----------------------------------------------
27# Evaporation: calculate pot. evaporation (True) or use precalculated pot.evaporation map stacks (False)
28calc_evaporation = False
29
30#-----------------------------------------------
31# Irrigation and water demand
32
33# if irrigation is included, otherwise paddy and non paddy is put into 'grassland'
34includeIrrigation = True
35# if water demand from irrigation, industry and domestic is included
36includeWaterDemand = False
37# Water allocation
38# if water demand and availability is calculated for region to compare demand vs. avail
39usingAllocSegments = False
40# limit abstraction to available groundwater (True) include fossil groundwater (False)
41limitAbstraction = False
42
43# Environmental Flow
44calc_environflow = False
45use_environflow = False
46
47#-----------------------------------------------
48# Soil
49# use preferential flow, that bypasses the soil matrix and drains directly to the groundwater (not for irrPaddy)
50preferentialFlow = False
51# Capillar rise
52CapillarRise = True
53
54#-----------------------------------------------
55# Routing
56
57# if runoff concentration to the edge of a cell is included
58includeRunoffConcentration = True
59# Waterbodies like lakes and reservoirs
60includeWaterBodies = True
61# kinematic wave routing, if False no routing is calculated
62includeRouting = True
63
64#-----------------------------------------------
65# Inflow from outside of the modelled area
66inflow = False
67
68# --- Reporting & Debugging ------------------- ----------------------------------------------
69# Reporting options
70writeNetcdfStack = True
71reportMap = True
72reportTss = True
73# Checking water balance (for debugging)
74calcWaterBalance = False
75sumWaterBalance = False
76# use additional PCRaster GIS commands
77PCRaster = False
78
79
80
81
82
83
84#-------------------------------------------------------
85# DEFINITIONS OF PARAMETERS
NetCDF meta data¶
The format for spatial data for input and output data is netCDF. For output data the basic information are given in the settingsfile
102[NETCDF_ATTRIBUTES]
103institution = IIASA
104title = Global Water Model - WATCH WDFEI
105metaNetcdfFile = $(FILE_PATHS:PathRoot)/source/metaNetcdf.xml
For each output file the specific information about units, variable name, displayed variable name is given in the metaNetcdf.xml. See: Output Meta NetCDF information
Path of data, output¶
Note
Further on the pathes can be used as placeholders
88#-------------------------------------------------------
89[FILE_PATHS]
90#-------------------------------------------------------
91PathRoot = E:/CWATM_rhine
92
93PathOut = $(PathRoot)/output
94PathMaps = $(PathRoot)/cwatm_input
95PathMeteo = $(PathRoot)/climate
Defining the modeling area¶
In general the input data are stored and used at global scale. The modeling area can be defined by:
a mask map e.g.: $(FILE_PATHS:PathRoot)/source/rhine30min.tif
coordinates e.g.: 14 12 0.5 5.0 52.0
lowest point of a catchment e.g.: 6.25 51.75
Note
Warning
If you use a mask map, make sure you do not use blanks in the file path or name!
108# AREA AND OUTLETS
109#-------------------------------------------------------
110[MASK_OUTLET]
111
112# Area mask
113# A pcraster map, tif or netcdf map e.g. $(FILE_PATHS:PathRoot)/data/areamaps/area_indus.map
114# or a retancle: Number of Cols, Number of rows, cellsize, upper left corner X, upper left corner Y
115MaskMap = $(FILE_PATHS:PathRoot)/source/rhine30min.tif
116#MaskMap = 14 12 0.5 5.0 52.0
117
118
119#-------------------------------------------------------
120# Station data
121# either a map e.g. $(FILE_PATHS:PathRoot)/data/areamaps/area3.map
122# or a location coordinates (X,Y) e.g. 5.75 52.25 9.25 49.75 )
123# Lobith/Rhine
124Gauges = 6.25 51.75
125
126# if .tif file for gauges, this is a flag if the file is global or local
127# e.g. Gauges = $(FILE_PATHS:PathRoot)/data/areamaps/gaugesRhine.tif
128GaugesLocal = True
Note
Defining the time¶
The start and end time have to be defined. Spin-up time is the time for warming up (results will be stored after the spin-up time)
Note
The time can be given as date: dd/mm/yyyy or as relative date: number (but then CalendarDayStart has to be defined)
Note
Spin-up time can be given as date or number
130#-------------------------------------------------------
131[TIME-RELATED_CONSTANTS]
132#-------------------------------------------------------
133
134# StepStart has to be a date e.g. 01/06/1990
135# SpinUp or StepEnd either date or numbers
136# SpinUp: from this date output is generated (up to this day: warm up)
137
138StepStart = 1/1/1990
139SpinUp = 1/01/1995
140StepEnd = 31/12/2010
Initial conditions¶
Initial conditions can be stored and be loaded in order to initialise a warm start of the model
Note
Initial conditions are store as one netCDF file with all necessary variables
145#-------------------------------------------------------
146[INITITIAL CONDITIONS]
147#-------------------------------------------------------
148
149# for a warm start initial variables a loaded
150# e.g for a start on 01/01/2010 load variable from 31/12/2009
151load_initial = False
152initLoad = $(FILE_PATHS:PathRoot)/init/Rhine_19891231.nc
153
154# saving variables from this run, to initiate a warm start next run
155# StepInit = saving date, can be more than one: 10/01/1973 20/01/1973
156save_initial = False
157initSave = $(FILE_PATHS:PathRoot)/init/Rhine
158StepInit = 31/12/1989 31/12/2010
StepInit indicate the date(s) when initial conditions are saved:
StepInit = 31/12/1989
StepInit = 31/12/1989 31/12/2010
StepInit = 31/12/1989 5y
here: second value in StepInit is indicating a repetition of year(y), month(m) or day(d),
e.g. 2y for every 2 years or 6m for every 6 month
Reading information¶
Information will be read in from values in the settings file Here the value definitions for [SNOW] is shown:
279#-------------------------------------------------------
280[SNOW]
281#-------------------------------------------------------
282
283# Number of vertical Snow layers
284NumberSnowLayers = 7
285# up to which layer the ice melt is calculated with the middle temperature
286GlacierTransportZone = 3
287
288# Temperature lapse rate with altitude [deg C / m]
289TemperatureLapseRate = 0.0065
290# Multiplier applied to precipitation that falls as snow
291SnowFactor = 1.0
292# Range [m C-1 d-1] of the seasonal variation, SnowMeltCoef is the average value
293SnowSeasonAdj = 0.001
294# Average temperature at which snow melts
295TempMelt =1.0
296# Average temperature below which precipitation is snow
297TempSnow = 1.0
298# Snow melt coefficient: default: 4.0
299# SRM: 0.0045 m/C/day ( = 4.50 mm/C/day), Kwadijk: 18 mm/C/month (= 0.59 mm/C/day)
300# See also Martinec et al., 1998.
301
302# use in CALIBRATION -> copied to CALIBRATION
303#SnowMeltCoef = 0.004
304IceMeltCoef = 0.007
305
306#--------------------------------------------------------------
307# INITIAL CONDITIONS - Initial snow depth in snow zone 1-7 [mm] - SnowCoverIni
308
309[FROST]
310# Snow water equivalent, (based on snow density of 450 kg/m3) (e.g. Tarboton and Luce, 1996)
311SnowWaterEquivalent = 0.45
312# Daily decay coefficient, (Handbook of Hydrology, p. 7.28)
313Afrost = 0.97
314# Snow depth reduction coefficient, [cm-1], (HH, p. 7.28)
315Kfrost = 0.57
316# Degree Days Frost Threshold (stops infiltration, percolation and capillary rise)
317# Molnau and Bissel found a value 56-85 for NW USA.
318FrostIndexThreshold = 56
Note
TemperatureLapseRate = 0.0065 | for the variable TemperatureLapseRate the value of 0.0065 is set
Variables can also be defined by spatial maps or map stacks
tanslope = $(PathTopo)\tanslope.map
forest_coverFractionNC = $(PathForest)\coverFractionInputForest366days.nc
Note
suffix can be .map, but if there is no PCraster map it will look automatically for netCDF .nc
Warning
in most cases values can be replaced by map
Sections of information¶
Snow
Frost
General information on land cover types
Soil
- Information for each of the six land cover types
Forest
Grassland
Paddy irrigated area
Irrigated area
Sealed area
Water covered area
Interflow
Groundwater
Water demand
Runoff concentration
Routing
Lakes and reservoirs
Inflow
Complete settings file¶
Example of a settings file:
1# ------------------------------------------------
2
3######## ## ## #### ###### ## ##
4## ## ## ## ## ## #### ####
5## ## ## ## ## ## ## #### ##
6## ## ## ## ######## ## ## ## ##
7## ## #### ## ## ## ## ## ##
8## #### #### ## ## ## ## ##
9########## ## ## ## ## ## ## ##
10
11# Community Water Model Version 0.99
12# SETTINGS FILE
13# ------------------------------------------------
14
15
16[OPTIONS]
17#-------------------------------------------------------
18# OPTION - to switch on/off
19#-------------------------------------------------------
20
21# Data otions
22# if temperature is stored in Kelvin instead Celsius
23TemperatureInKelvin = True
24# if lat/lon the area has to be user defined = precalculated
25gridSizeUserDefined = True
26
27#-----------------------------------------------
28# Evaporation: calculate pot. evaporation (True) or use precalculated pot.evaporation map stacks (False)
29calc_evaporation = False
30
31#-----------------------------------------------
32# Irrigation and water demand
33
34# if irrigation is included, otherwise paddy and non paddy is put into 'grassland'
35includeIrrigation = True
36# if water demand from irrigation, industry and domestic is included
37includeWaterDemand = False
38# Water allocation
39# if water demand and availability is calculated for region to compare demand vs. avail
40usingAllocSegments = False
41# limit abstraction to available groundwater (True) include fossil groundwater (False)
42limitAbstraction = False
43
44# Environmental Flow
45calc_environflow = False
46use_environflow = False
47
48#-----------------------------------------------
49# Soil
50# use preferential flow, that bypasses the soil matrix and drains directly to the groundwater (not for irrPaddy)
51preferentialFlow = False
52# Capillar rise
53CapillarRise = True
54
55#-----------------------------------------------
56# Routing
57
58# if runoff concentration to the edge of a cell is included
59includeRunoffConcentration = True
60# Waterbodies like lakes and reservoirs
61includeWaterBodies = True
62# kinematic wave routing, if False no routing is calculated
63includeRouting = True
64
65#-----------------------------------------------
66# Inflow from outside of the modelled area
67inflow = False
68
69# --- Reporting & Debugging ------------------- ----------------------------------------------
70# Reporting options
71writeNetcdfStack = True
72reportMap = True
73reportTss = True
74# Checking water balance (for debugging)
75calcWaterBalance = False
76sumWaterBalance = False
77# use additional PCRaster GIS commands
78PCRaster = False
79
80
81
82
83
84
85#-------------------------------------------------------
86# DEFINITIONS OF PARAMETERS
87#-------------------------------------------------------
88
89#-------------------------------------------------------
90[FILE_PATHS]
91#-------------------------------------------------------
92PathRoot = E:/CWATM_rhine
93
94PathOut = $(PathRoot)/output
95PathMaps = $(PathRoot)/cwatm_input
96PathMeteo = $(PathRoot)/climate
97
98
99
100
101#-------------------------------------------------------
102[NETCDF_ATTRIBUTES]
103institution = IIASA
104title = Global Water Model - WATCH WDFEI
105metaNetcdfFile = $(FILE_PATHS:PathRoot)/source/metaNetcdf.xml
106
107#-------------------------------------------------------
108# AREA AND OUTLETS
109#-------------------------------------------------------
110[MASK_OUTLET]
111
112# Area mask
113# A pcraster map, tif or netcdf map e.g. $(FILE_PATHS:PathRoot)/data/areamaps/area_indus.map
114# or a retancle: Number of Cols, Number of rows, cellsize, upper left corner X, upper left corner Y
115MaskMap = $(FILE_PATHS:PathRoot)/source/rhine30min.tif
116#MaskMap = 14 12 0.5 5.0 52.0
117
118
119#-------------------------------------------------------
120# Station data
121# either a map e.g. $(FILE_PATHS:PathRoot)/data/areamaps/area3.map
122# or a location coordinates (X,Y) e.g. 5.75 52.25 9.25 49.75 )
123# Lobith/Rhine
124Gauges = 6.25 51.75
125
126# if .tif file for gauges, this is a flag if the file is global or local
127# e.g. Gauges = $(FILE_PATHS:PathRoot)/data/areamaps/gaugesRhine.tif
128GaugesLocal = True
129
130#-------------------------------------------------------
131[TIME-RELATED_CONSTANTS]
132#-------------------------------------------------------
133
134# StepStart has to be a date e.g. 01/06/1990
135# SpinUp or StepEnd either date or numbers
136# SpinUp: from this date output is generated (up to this day: warm up)
137
138StepStart = 1/1/1990
139SpinUp = 1/01/1995
140StepEnd = 31/12/2010
141
142
143
144
145#-------------------------------------------------------
146[INITITIAL CONDITIONS]
147#-------------------------------------------------------
148
149# for a warm start initial variables a loaded
150# e.g for a start on 01/01/2010 load variable from 31/12/2009
151load_initial = False
152initLoad = $(FILE_PATHS:PathRoot)/init/Rhine_19891231.nc
153
154# saving variables from this run, to initiate a warm start next run
155# StepInit = saving date, can be more than one: 10/01/1973 20/01/1973
156save_initial = False
157initSave = $(FILE_PATHS:PathRoot)/init/Rhine
158StepInit = 31/12/1989 31/12/2010
159
160#-------------------------------------------------------
161# CALIBARTION PARAMETERS
162#-------------------------------------------------------
163[CALIBRATION]
164
165# These are parameter which are used for calibration
166# could be any parameter, but for an easier overview, tehey are collected here
167# in the calibration template a placeholder (e.g. %arnoBeta) instead of value
168
169# Snow
170SnowMeltCoef = 0.0027
171# Cropf factor correction
172crop_correct = 1.11
173#Soil
174soildepth_factor = 1.28
175#Soil preferentialFlowConstant = 4.0, arnoBeta_add = 0.1
176preferentialFlowConstant = 4.5
177arnoBeta_add = 0.19
178# interflow part of recharge factor = 1.0
179factor_interflow = 2.8
180# groundwater recessionCoeff_factor = 1.0
181recessionCoeff_factor = 5.278
182# runoff concentration factor runoffConc_factor = 1.0
183runoffConc_factor = 0.1
184#Routing manningsN Factor to Manning's roughness = 1.0 [0.1-10.]
185manningsN = 1.86
186# reservoir normal storage limit (fraction of total storage, [-]) [0.15 - 0.85] default 0.5
187normalStorageLimit = 0.44
188# lake parameter - factor to alpha: parameter of of channel width and weir coefficient [0.33 - 3.] dafault 1.
189lakeAFactor = 0.33
190# lake parameter - factor for wind evaporation
191lakeEvaFactor = 1.52
192#-------------------------------------------------------
193# TOPOGRAPHY MAPS
194#-------------------------------------------------------
195[TOPOP]
196# local drain direction map (1-9)
197Ldd = $(FILE_PATHS:PathMaps)/routing/ldd.map
198
199# Elevation standard deviation [m], i.e. altitude difference elevation within pixel.
200# Used for sub-pixel modelling of snow accumulation and melt
201ElevationStD = $(FILE_PATHS:PathMaps)/landsurface/topo/elvstd.map
202
203# Area of pixel [m2] (for lat/lon every cell has a different area)
204CellArea = $(FILE_PATHS:PathMaps)/routing/cellarea.map
205
206#-------------------------------------------------------
207# INPUT METEOROLOGICAL TIMESERIES AS MAPS
208#-------------------------------------------------------
209[METEO]
210# precipitation [kg m-2 s-1]
211#PrecipitationMaps = $(FILE_PATHS:PathMeteo)/pr*
212PrecipitationMaps = $(FILE_PATHS:PathMeteo)/30min/pr_rhine*
213# average daily temperature [K]
214#TavgMaps = $(FILE_PATHS:PathMeteo)/tavg*
215TavgMaps = $(FILE_PATHS:PathMeteo)/30min/tavg_rhine*
216
217# ----------------------------------------
218# This is used if calc_evaporation = False
219
220# daily reference evaporation (free water)
221E0Maps = $(FILE_PATHS:PathMeteo)/30min/EWRef_rhine.nc
222#E0Maps = $(FILE_PATHS:PathMeteo)/EWRef_daily*
223# daily reference evapotranspiration (crop)
224ETMaps = $(FILE_PATHS:PathMeteo)/30min/ETRef_rhine.nc
225#ETMaps = $(FILE_PATHS:PathMeteo)/ETRef_daily*
226
227# --------------------------------
228# from kg m-2s-1 to m : 86.4
229precipitation_coversion = 86.4
230
231# from MM to m : 0.001
232#precipitation_coversion = 0.001
233
234evaporation_coversion = 1.00
235
236# OUTPUT maps and timeseries
237#OUT_Dir = $(FILE_PATHS:PathOut)
238#OUT_MAP_Daily = Precipitation, prec1
239
240#-------------------------------------------------------
241# CALCULATE EVAPORATION - PENMAN - MONTEITH
242#-------------------------------------------------------
243[EVAPORATION]
244
245# This is used if calc_evaporation = True
246# use albedo maps
247albedo = True
248albedoMaps = $(FILE_PATHS:PathMaps)/landsurface/albedo/albedo.nc
249
250# if not albedo maps use fixed albedo
251# Albedo of bare soil surface (Supit et. al.)
252AlbedoSoil = 0.15
253# Albedo of water surface (Supit et. al.)
254AlbedoWater = 0.05
255# Albedo of vegetation canopy (FAO,1998)
256AlbedoCanopy = 0.23
257
258# use specific humidity (TRUE) QAir, or relative humidity (FALSE) - rhs
259useHuss = False
260
261# map stacks Temperature [K}]
262TminMaps = $(FILE_PATHS:PathMeteo)/tmin*
263TmaxMaps = $(FILE_PATHS:PathMeteo)/tmax*
264# Instantaneous surface pressure[Pa]
265PSurfMaps = $(FILE_PATHS:PathMeteo)/ps*
266# 2 m istantaneous specific humidity[kg /kg] (QAir) or relative humidity [%] (rhs)
267RhsMaps = $(FILE_PATHS:PathMeteo)/hurs*
268# wind speed maps at 10m [m/s]
269WindMaps = $(FILE_PATHS:PathMeteo)/wind*
270# radiation surface downwelling shortwave maps [W/m2]
271RSDSMaps = $(FILE_PATHS:PathMeteo)/rsds*
272# radiation surface downwelling longwave maps [W/m2] [W/m2]
273RSDLMaps = $(FILE_PATHS:PathMeteo)/rlds*
274
275# OUTPUT maps and timeseries
276#OUT_Dir = $(FILE_PATHS:PathOut)
277#OUT_MAP_Daily = EWRef, ETRef, temp, prec
278
279#-------------------------------------------------------
280[SNOW]
281#-------------------------------------------------------
282
283# Number of vertical Snow layers
284NumberSnowLayers = 7
285# up to which layer the ice melt is calculated with the middle temperature
286GlacierTransportZone = 3
287
288# Temperature lapse rate with altitude [deg C / m]
289TemperatureLapseRate = 0.0065
290# Multiplier applied to precipitation that falls as snow
291SnowFactor = 1.0
292# Range [m C-1 d-1] of the seasonal variation, SnowMeltCoef is the average value
293SnowSeasonAdj = 0.001
294# Average temperature at which snow melts
295TempMelt =1.0
296# Average temperature below which precipitation is snow
297TempSnow = 1.0
298# Snow melt coefficient: default: 4.0
299# SRM: 0.0045 m/C/day ( = 4.50 mm/C/day), Kwadijk: 18 mm/C/month (= 0.59 mm/C/day)
300# See also Martinec et al., 1998.
301
302# use in CALIBRATION -> copied to CALIBRATION
303#SnowMeltCoef = 0.004
304IceMeltCoef = 0.007
305
306#--------------------------------------------------------------
307# INITIAL CONDITIONS - Initial snow depth in snow zone 1-7 [mm] - SnowCoverIni
308
309[FROST]
310# Snow water equivalent, (based on snow density of 450 kg/m3) (e.g. Tarboton and Luce, 1996)
311SnowWaterEquivalent = 0.45
312# Daily decay coefficient, (Handbook of Hydrology, p. 7.28)
313Afrost = 0.97
314# Snow depth reduction coefficient, [cm-1], (HH, p. 7.28)
315Kfrost = 0.57
316# Degree Days Frost Threshold (stops infiltration, percolation and capillary rise)
317# Molnau and Bissel found a value 56-85 for NW USA.
318FrostIndexThreshold = 56
319
320#--------------------------------------------------------------
321# INITIAL CONDITIONS: FrostIndexIni
322
323[VEGETATION]
324cropgroupnumber = $(FILE_PATHS:PathMaps)/others/cropgrp.nc
325# soil water depletion fraction, Van Diepen et al., 1988: WOFOST 6.0, p.86, Doorenbos et. al 1978
326
327#-------------------------------------------------------
328[SOIL]
329#-------------------------------------------------------
330
331PathTopo = $(FILE_PATHS:PathMaps)/landsurface/topo
332PathSoil = $(FILE_PATHS:PathMaps)/landsurface/soil
333PathSoil1 = $(FILE_PATHS:PathMaps)/others
334
335# Topography - tangent slope, slope length
336tanslope = $(PathTopo)/tanslope.map
337slopeLength = $(PathTopo)/slopeLength.map
338
339# maps of relative elevation above flood plains
340relativeElevation = $(PathTopo)/dzRel_hydro1k.nc
341
342# Soil hydraulic properties
343
344# soil (Hypres pedotransfer function - http://esdac.jrc.ec.europa.eu/ESDB_Archive/ESDBv2/popup/hy_param.htm)
345KSat1 = $(PathSoil1)/ksat1.map
346KSat2 = $(PathSoil1)/ksat2.map
347KSat3 = $(PathSoil1)/ksat3.map
348# Alpha: an Genuchten’s shape parameter
349alpha1 = $(PathSoil1)/alpha1.map
350alpha2 = $(PathSoil1)/alpha2.map
351alpha3 = $(PathSoil1)/alpha3.map
352#Lambda: an Genuchten’s shape parameter = n-1-> n = lamda+1, m = 1 - (1/n)
353lambda1 = $(PathSoil1)/lambda1.map
354lambda2 = $(PathSoil1)/lambda2.map
355lambda3 = $(PathSoil1)/lambda3.map
356# thetas is the volumetric water content θ saturated
357thetas1 = $(PathSoil1)/thetas1.map
358thetas2 = $(PathSoil1)/thetas2.map
359thetas3 = $(PathSoil1)/thetas3.map
360# thetar is the volumetric water content θ residual
361thetar1 = $(PathSoil1)/thetar1.map
362thetar2 = $(PathSoil1)/thetar2.map
363thetar3 = $(PathSoil1)/thetar3.map
364
365percolationImp = $(PathSoil)/percolationImp.map
366
367maxGWCapRise = 5.0
368
369minCropKC = 0.2
370minTopWaterLayer = 0.0
371
372# Soil depth
373StorDepth1 = $(PathSoil)/storageDepth1.map
374StorDepth2 = $(PathSoil)/storageDepth2.map
375
376# preferential flow (between 1.0 and 8.0)
377# used in CALIBRATION -> copied to CALIBRATION
378#preferentialFlowConstant = 4.0
379
380#-------------------------------------------------------
381[LANDCOVER]
382PathLandcover = $(FILE_PATHS:PathMaps)/landsurface
383
384coverTypes = forest, grassland, irrPaddy, irrNonPaddy, sealed, water
385coverTypesShort = f, g, i, n, s, w
386fractionLandcover = $(PathLandcover)/fractionLandcover.nc
387
388# Landcover can vary from year to year
389dynamicLandcover = True
390# if landcover cannot vary, which year should be taken as fixed year
391fixLandcoverYear = 1961
392
393#-------------------------------------------------------
394
395[__forest]
396PathForest = $(FILE_PATHS:PathMaps)/landcover/forest
397PathSoil1 = $(FILE_PATHS:PathMaps)/others
398
399# Parameters for the Arno's scheme
400# arnoBeta is defined by orographic,+ land cover add + calibration add, the soil water capacity distribution is based on this
401# range [0.01 - 1.2]
402forest_arnoBeta = 0.2
403
404#forest_soil
405forest_KSat1 = $(PathSoil1)/forest_ksat1.map
406forest_KSat2 = $(PathSoil1)/forest_ksat2.map
407forest_KSat3 = $(PathSoil1)/ksat3.map
408forest_alpha1 = $(PathSoil1)/forest_alpha1.map
409forest_alpha2 = $(PathSoil1)/forest_alpha2.map
410forest_alpha3 = $(PathSoil1)/alpha3.map
411forest_lambda1 = $(PathSoil1)/forest_lambda1.map
412forest_lambda2 = $(PathSoil1)/forest_lambda2.map
413forest_lambda3 = $(PathSoil1)/lambda3.map
414forest_thetas1 = $(PathSoil1)/forest_thetas1.map
415forest_thetas2 = $(PathSoil1)/forest_thetas2.map
416forest_thetas3 = $(PathSoil1)/thetas3.map
417forest_thetar1 = $(PathSoil1)/forest_thetar1.map
418forest_thetar2 = $(PathSoil1)/forest_thetar2.map
419forest_thetar3 = $(PathSoil1)/thetar3.map
420
421# other paramater values
422forest_minInterceptCap = 0.001
423forest_cropDeplFactor = 0.0
424
425forest_fracVegCover = $(PathForest)/fracVegCover.map
426forest_rootFraction1 = $(PathForest)/rootFraction1.map
427forest_rootFraction2 = $(PathForest)/rootFraction2.map
428#forest_maxRootDepth = 2.0
429forest_maxRootDepth = $(PathForest)/maxRootDepth.map
430forest_minSoilDepthFrac = $(PathForest)/minSoilDepthFrac.map
431
432
433forest_cropCoefficientNC = $(PathForest)/CropCoefficientForest_10days.nc
434forest_interceptCapNC = $(PathForest)/interceptCapForest10days.nc
435
436# initial conditions: forest_interceptStor, forest_w1, forest_w2, forest_w3,
437
438
439[__grassland]
440PathGrassland = $(FILE_PATHS:PathMaps)/landcover/grassland
441
442# Parameters for the Arno's scheme:
443grassland_arnoBeta = 0.0
444# arnoBeta is defined by orographic,+ land cover add + calibration add, the soil water capacity distribution is based on this
445# range [0.01 - 1.2]
446
447# other paramater values
448
449grassland_minInterceptCap = 0.001
450grassland_cropDeplFactor = 0.0
451
452grassland_fracVegCover = $(PathGrassland)/fracVegCover.map
453grassland_rootFraction1 = $(PathGrassland)/rootFraction1.map
454grassland_rootFraction2 = $(PathGrassland)/rootFraction2.map
455grassland_maxRootDepth = $(PathGrassland)/maxRootDepth.map
456grassland_minSoilDepthFrac = $(PathGrassland)/minSoilDepthFrac.map
457
458
459grassland_cropCoefficientNC = $(PathGrassland)/CropCoefficientGrassland_10days.nc
460grassland_interceptCapNC = $(PathGrassland)/interceptCapGrassland10days.nc
461
462# initial conditions: grassland_interceptSto, grassland_w1, grassland_w2, grassland_w3
463
464
465[__irrPaddy]
466PathIrrPaddy = $(FILE_PATHS:PathMaps)/landcover/irrPaddy
467
468# Parameters for the Arno's scheme:
469irrPaddy_arnoBeta = 0.2
470# arnoBeta is defined by orographic,+ land cover add + calibration add, the soil water capacity distribution is based on this
471# range [0.01 - 1.2]
472
473# other paramater values
474
475irrPaddy_minInterceptCap = 0.001
476irrPaddy_cropDeplFactor = 0.0
477
478irrPaddy_fracVegCover = $(PathIrrPaddy)/fracVegCover.map
479irrPaddy_rootFraction1 = $(PathIrrPaddy)/rootFraction1.map
480irrPaddy_rootFraction2 = $(PathIrrPaddy)/rootFraction2.map
481irrPaddy_maxRootDepth = $(PathIrrPaddy)/maxRootDepth.map
482irrPaddy_minSoilDepthFrac = $(PathIrrPaddy)/minSoilDepthFrac.map
483
484irrPaddy_cropCoefficientNC = $(PathIrrPaddy)/CropCoefficientirrPaddy_10days.nc
485
486# maximum flooding depth for paddy
487irrPaddy_maxtopwater = 0.05
488
489
490
491# initial conditions: irrPaddy_interceptStor, irrPaddy_w1, irrPaddy_w2, irrPaddy_w3
492
493
494
495[__irrNonPaddy]
496PathIrrNonPaddy = $(FILE_PATHS:PathMaps)/landcover/irrNonPaddy
497
498# Parameters for the Arno's scheme:
499irrNonPaddy_arnoBeta = 0.2
500# arnoBeta is defined by orographic,+ land cover add + calibration add, the soil water capacity distribution is based on this
501# range [0.01 - 1.2]
502
503# other paramater values
504
505
506irrNonPaddy_minInterceptCap = 0.001
507irrNonPaddy_cropDeplFactor = 0.0
508
509irrNonPaddy_fracVegCover = $(PathIrrNonPaddy)/fracVegCover.map
510irrNonPaddy_rootFraction1 = $(PathIrrNonPaddy)/rootFraction1.map
511irrNonPaddy_rootFraction2 = $(PathIrrNonPaddy)/rootFraction2.map
512irrNonPaddy_maxRootDepth = $(PathIrrNonPaddy)/maxRootDepth.map
513irrNonPaddy_minSoilDepthFrac = $(PathIrrNonPaddy)/minSoilDepthFrac.map
514
515
516irrNonPaddy_cropCoefficientNC = $(PathIrrNonPaddy)/CropCoefficientirrNonPaddy_10days.nc
517
518
519# initial conditions: irrNonPaddy_interceptStor, irrNonPaddy_w1, irrNonPaddy_w2, irrNonPaddy_w3
520
521
522[__sealed]
523PathSealed = $(FILE_PATHS:PathMaps)/landcover/sealed
524
525sealed_minInterceptCap = 0.001
526
527# initial conditions: sealed_interceptStor
528
529
530[__open_water]
531PathWater = $(FILE_PATHS:PathMaps)/landcover/water
532
533water_minInterceptCap = 0.0
534
535#-------------------------------------------------------
536[GROUNDWATER]
537#-------------------------------------------------------
538
539PathGroundwater = $(FILE_PATHS:PathMaps)/groundwater
540
541recessionCoeff = $(PathGroundwater)/recessionCoeff.map
542# baseflow = recessionCoeff * storage groundwater
543specificYield = $(PathGroundwater)/specificYield.map
544kSatAquifer = $(PathGroundwater)/kSatAquifer.map
545# both not used at the moment in groundwater modul, but already loaded
546
547#--------------------------------------------------------------
548# INITIAL CONDITIONS: storGroundwater
549
550
551#-------------------------------------------------------
552[WATERDEMAND]
553#-------------------------------------------------------
554
555PathWaterdemand = $(FILE_PATHS:PathMaps)/landsurface/waterDemand
556# For water demand vs. availability: areas have to be aggregated
557# Allocation map
558allocSegments = $(PathWaterdemand)/catchx.nc
559
560domesticWaterDemandFile = $(PathWaterdemand)/domesticWaterDemand.nc
561industryWaterDemandFile = $(PathWaterdemand)/industryWaterDemand.nc
562
563irrNonPaddy_efficiency = $(FILE_PATHS:PathMaps)/landsurface/waterDemand/efficiency.nc
564irrPaddy_efficiency = $(FILE_PATHS:PathMaps)/landsurface/waterDemand/efficiency.nc
565
566#irrNonPaddy_efficiency = 0.8
567#irrPaddy_efficiency = 0.8
568irrigation_returnfraction = 0.5
569
570# -----------------------------------------------------------
571# Estimate of fractions of groundwater and surface water abstractions
572# Either a fixed fraction for surface water abstration
573# based on fraction of average baseflow and upstream average discharge
574# if swAbstractionFrac < 0: fraction is taken from baseflow / discharge
575# if swAbstractionFrac > 0 this value is taken as a fixed value
576swAbstractionFrac = 0.9
577averageDischarge = $(FILE_PATHS:PathOut)/discharge_totalavg_rhine30min.nc
578# in [m3/s]
579averageBaseflow = $(FILE_PATHS:PathOut)/baseflow_totalavg_rhine30min.nc
580# in [m3/s]
581baseflowInM = True
582# if baseflow is in [m] instead of [m3/s] it will be converted
583
584
585#-------------------------------------------------------
586# RUNOFF CONCENTRATION
587#-------------------------------------------------------
588[RUNOFF_CONCENTRATION]
589
590# using triagular weigthning method
591# the bigger the factor, more lag time
592forest_runoff_peaktime = 1.0
593grassland_runoff_peaktime = 0.5
594irrPaddy_runoff_peaktime = 0.5
595irrNonPaddy_runoff_peaktime = 0.5
596sealed_runoff_peaktime = 0.15
597water_runoff_peaktime = 0.01
598
599interflow_runoff_peaktime =1.0
600baseflow_runoff_peaktime = 2.0
601
602# initial conditions:
603# here only 1 layer is shown, but there are up to 10: runoff_concIni
604
605
606#-------------------------------------------------------
607# ROUTING MAPS and PARAMETERSD
608#-------------------------------------------------------
609[ROUTING]
610
611PathRouting = $(FILE_PATHS:PathMaps)/routing
612
613# Number of substep per day
614# should be 10 for 0.5 deg but 24 for 0.1 deg
615
616NoRoutingSteps = 10
617#kinematic wave parameter: 0.6 is for broad sheet flow
618chanBeta = 0.6
619
620# Channel gradient (fraction, dy/dx)
621chanGrad = $(PathRouting)/kinematic/changrad.nc
622# Minimum channel gradient (for kin. wave: slope cannot be 0)
623chanGradMin = 0.0001
624
625#Channel Manning's n
626chanMan = $(PathRouting)/kinematic/chanman.nc
627#Channel length [meters]
628chanLength = $(PathRouting)/kinematic/chanleng.nc
629#Channel bottom width [meters]
630chanWidth = $(PathRouting)/kinematic/chanbw.nc
631#Bankfull channel depth [meters]
632chanDepth = $(PathRouting)/kinematic/chanbnkf.nc
633
634# initial conditions: channelStorageIni, riverbedExchangeIni, dischargeIni
635
636#-------------------------------------------------------
637# LAKES AND RESERVOIRS
638#-------------------------------------------------------
639[LAKES_RESERVOIRS]
640
641PathLakesRes = $(FILE_PATHS:PathMaps)/routing/lakesreservoirs
642
643# Use reservoirs and lakes (otherwise use only lakes Lake ID=1 and 3 => natural conditions)
644useResAndLakes = True
645# Reservoirs do have a year of implementation
646dynamicLakesRes = True
647# if Reservoirs does not have a year of implemtation, which year should be taken as fixed year
648fixLakesResYear = 1950
649
650
651#----------------------------
652#Big lakes and Reservoirs
653
654# ID of every lake, reservoir from HydroLakes database
655waterBodyID = $(PathLakesRes)/lakesResID.nc
656# 1 for lake, 2 for reservoir, 3 for lake and reservoir
657waterBodyTyp = $(PathLakesRes)/lakesResType.nc
658# Avergae discharge from HydroLakes Database
659waterBodyDis = $(PathLakesRes)/lakesResDis.nc
660
661# Lakes surface area from HydroLakes Database
662waterBodyArea = $(PathLakesRes)/lakesResArea.nc
663# a factor to scale the outlet of a lake
664#lakeAFactor = 1.0 -> calibration
665
666#----------------------------
667# Small lakes and reservoirs
668
669useSmallLakes = True
670
671smallLakesRes = $(PathLakesRes)/smallLakesRes.nc
672smallwaterBodyDis = $(PathLakesRes)/smalllakesresDis.nc
673
674# averageRunoff in [m] (if not given smallwaterBodyDis is taken instead)
675#averageRunoff = $(FILE_PATHS:PathOut)/runoff_totalavg_cali.nc
676
677# for water demand
678#min storage in [m3] (if not give it is calculated)
679#minStorage = $(FILE_PATHS:PathOut)/minsmalllakeStorage_cali.nc
680
681
682# initial conditions: lakeInflowIni, lakeStorageIni, outLakeIni, lakeOutflowIni, reservoirStorageIni
683
684#------------------
685# Reservoirs
686# reservoir volume from HydroLakes database
687waterBodyVolRes = $(PathLakesRes)/lakesResVolRes.nc
688# reservoir starting year from HydroLakes database
689waterBodyYear = $(PathLakesRes)/lakesResYear.nc
690
691# Conservative, normal and flood storage limit (fraction of total storage, [-])
692conservativeStorageLimit = 0.1
693#normalStorageLimit = 0.5 # --> put into calibration
694floodStorageLimit = 0.9
695# adjusting the balance between normal and flood storage
696# [0 ..1] 0: NormalstorageLimit 1: (= closer to flood) results in keeping the normal qoutflow longer constant
697adjust_Normal_Flood = 0.5
698
699# Minimum, Normal and Non-damaging reservoir outflow (fraction of average discharge, [-])
700MinOutflowQ = 0.2
701NormalOutflowQ = 1.0
702NonDamagingOutflowQ = 4.0
703
704# initial conditions: lakeInflowIni, lakeStorageIni, outLakeIni, lakeOutflowIni, reservoirStorageIni
705
706
707#-------------------------------------------------------
708[INFLOW]
709#-------------------------------------------------------
710
711# if option inflow = true
712# the inflow from outside is added at inflowpoints
713In_Dir = $(FILE_PATHS:PathRoot)/in
714
715# nominal map with locations of (measured)inflow hydrographs [cu m / s]
716InflowPoints = $(In_Dir)/in.map
717#InflowPoints = 8.25 49.75 7.75 50.25
718
719# if InflowPoints is a map, this flag is to identify if it is global (False) or local (True)
720# observed or simulated input hydrographs as time series [cu m / s]
721# Note: that identifiers in time series have to correspond to InflowPoints
722# can be several timeseries in one file or different files e.g. main.tss mosel.tss
723#QInTS = main1.tss mosel1.tss
724QInTS = mm.tss
725
726
727
728#-------------------------------------------------------
729[ENVIRONMENTALFLOW]
730#-------------------------------------------------------
731
732# Either calculate without run with predone discharge (set calc_ef_after = False)
733calc_ef_after = True
734# Or calculate after run (set calc_ef_after = False) and defining the file to be used
735EFDis = $(FILE_PATHS:PathOut)/discharge_rhine.nc
736
737# if predone discharge, do the maps need to be cut to fit to the mask?
738cut_ef_map = False
739
740EnvironmentalFlowFile = $(FILE_PATHS:PathOut)/MQ90_12month.nc
741
742# MAF: Mean, Q90: percentile 90, MMF: monthly average, MQ90: monthly Q90 9averagwed over al Jan, Feb..
743# EF_VMF: Environmental flow - variable monthly flow, EF_VMF_LIH - EF- variable monthly flow, high intermediate, low class
744OUT_Dir = $(FILE_PATHS:PathOut)
745#OUT_MAP_Once = MAF, Q90
746#OUT_MAP_12month = MMF, MQ90, EF_VMF, EF_VMF_LIH
747#OUT_MAP_12month = MQ90, EF_VMF
748
749
750
751#+++++++++++++++++++++++++++++++++++++++++++++++++++++++
752#+++++++++++++++++++++++++++++++++++++++++++++++++++++++
753
754
755[OUTPUT]
756
757# OUTPUT maps and timeseries
758OUT_Dir = $(FILE_PATHS:PathOut)
759
760OUT_TSS_Daily = discharge
761#OUT_TSS_MonthAvg = discharge
762#OUT_TSS_AnnualAvg = discharge
763
764#OUT_Map_Daily = discharge
765#OUT_Map_MonthAvg = discharge, precipitation, runoff
766#OUT_Map_AnnualAvg = discharge
767#OUT_MAP_TotalAvg = discharge, baseflow
768
769
770
771
NetCDF meta data¶
Output Meta NetCDF information¶
The metaNetcdf.xml includes information on the output netCDF files e.g. description of the parameter, unit ..
Example of a metaNetcdf.xml file:
<CWATM>
# METADATA for NETCDF OUTPUT DATA
# varname: name of the variable in the CWAT code
# unit: unit of the varibale
# long name# standard name
# Discharge maps
<metanetcdf varname="discharge" unit="m3/s" standard_name="Discharge" long_name="Discharge in cubic meter per second" title="1st Demo CWATM" author="PB" />
# others
<metanetcdf varname="soilmoisture" unit="mm" standard_name="soil moisture" long_name="Soil moisture" title ="1st Demo CWATM" author="PB" />
# Initial condition Files
<metanetcdf varname="initcondition" purpose ="Initial Conditions CWATM" author="PB" />
<metanetcdf varname="SnowCover1" unit="mm" standard_name="SnowCover1" long_name="Snow cover top layer" />
<metanetcdf varname="SnowCover2" unit="mm" standard_name="SnowCover2" long_name="Snow cover middle layer" />
<metanetcdf varname="SnowCover3" unit="mm" standard_name="SnowCover3" long_name="Snow cover lower layer" />
<metanetcdf varname="FrostIndex" unit="degree/days" standard_name="FrostIndex" long_name="Frost index based on Molnau, Bissel (1983)" />
</CWATM>
Name and location of the NetCDF meta data file¶
In the settings file the name and location of the metadata file is given.
#-------------------------------------------------------
[NETCDF_ATTRIBUTES]
institution = IIASA
title = Global Water Model - WATCH WDFEI
metaNetcdfFile = $(FILE_PATHS:PathRoot)/cwatm/metaNetcdf.xml
Initialisation¶
CWatM needs to have estimates of the initial state of the internal storage variables, e.g. the amount of water stored in snow, soil, groundwater etc.
There are two possibilities:
The initial state of the internal storage variables are unknown and a first guess has to be used e.g. all storage variables are half filled.
The initial state is known from a previous run, where the variables are stored at a certain time step. This is called warm start
The warm start is usful for:
using a long pre-run to find the steady-state storage of the groundwater storage and use it as initial value
using the stored variables to shorten the warm-up period
using the stored variables to restart every day with the values from the previous day (forecasting mode)
Example of soil moisture¶
The next figure shows the impact of different initial condition on the soil moisture of the lower soil. In one of the simulations the soil is initially almost completely saturated. In another simulation the soil is completely dry and the third simulation starts with initial conditions in between the two extremes.
In the beginning the effect of different initial condition can be seen clearly. But after one year the three curves converge. The memory of the lower soil goes back for about one year.
For all the initial condition apart from groundwater, lakes and reservoirs the memory is about 12 month.
Figure: Simulation of soil moisture in the lower soil with different initial conditions
For the groundwater zone a longer warm-up period is needed, because of the slow response of groundwater. Here a rather fast reacting groundwater storage is shown with the three curves coverge after two years. We propose a warm-up of several decades. The longer the better.
Figure: Simulation of groundwater storage with different initial conditions
Cold start¶
For a cold start the values of the storage variables are unknown and set to a “first” guess. A list of variables and their default value for a cold start is given below in: Initial conditions
Set up a cold start in the settingsfile¶
In the settings file the option: load_initial has to be set on False
145#-------------------------------------------------------
146[INITITIAL CONDITIONS]
147#-------------------------------------------------------
148
149# for a warm start initial variables a loaded
150# e.g for a start on 01/01/2010 load variable from 31/12/2009
151load_initial = False
152initLoad = $(FILE_PATHS:PathRoot)/init/Rhine_19891231.nc
Note
It is possible to exclude the warming up period of your model run for further analysis of results by setting the SpinUp option
[TIME-RELATED_CONSTANTS]
SpinUp = 01/01/1995
Storing initial variables¶
In the settings file the option save_initial has to be set to True
The name of the initial netCDF4 file has to be put in initsave
and one or more dates have to be specified in StepInit
154# saving variables from this run, to initiate a warm start next run
155# StepInit = saving date, can be more than one: 10/01/1973 20/01/1973
156save_initial = False
157initSave = $(FILE_PATHS:PathRoot)/init/Rhine
158StepInit = 31/12/1989 31/12/2010
Warm start¶
CWatM can write internal variables to a netCDF file for choosen timesteps. These netCDF files can be used as the initial conditions for a suceeding simulation.
This is useful for establishing a steady-state after a long-term run and then using this steady-state for succeding simulations or for an every day run (forecasting mode)
Warning
If the parameters are changed after a run(especially the groundwater, lakes and reservoir parameters) the stored initial values do not represent the conditions of the storage variables. Stored initial conditions should not be used as initial values for a model run with another set of parameters. If you do this during calibration, you will not be able to reproduce the calibration results!
Set up a cold start in the settingsfile¶
In the settings file the option: load_initial has to be set on True And define the name of the netcdf4 file in initLoad
Note
Use the initial values of the previous day here. E.g. if you run the model from 01/01/2006 use the inital condition from 31/12/2005
145#-------------------------------------------------------
146[INITITIAL CONDITIONS]
147#-------------------------------------------------------
148
149# for a warm start initial variables a loaded
150# e.g for a start on 01/01/2010 load variable from 31/12/2009
151load_initial = False
152initLoad = $(FILE_PATHS:PathRoot)/init/Rhine_19891231.nc
Initial conditions¶
No. |
Variable |
Description |
Default value |
Number of maps |
---|---|---|---|---|
1 |
SnowCover |
Snow cover for up to 7 zones |
0 |
7 |
2 |
FrostIndex |
Degree days frost threshold |
0 |
1 |
3 |
Forest state |
Interception storage |
0 |
1 |
Top water layer |
0 |
1 |
||
Soil storage for 3 soil layers |
0 |
3 |
||
4 |
Grassland state |
Interception storage |
0 |
1 |
Top water layer |
0 |
1 |
||
Soil storage for 3 soil layers |
0 |
3 |
||
5 |
Paddy irrigation state |
Interception storage |
0 |
1 |
Top water layer |
0 |
1 |
||
Soil storage for 3 soil layers |
0 |
3 |
||
6 |
Irrigation state |
Interception storage |
0 |
1 |
Top water layer |
0 |
1 |
||
Soil storage for 3 soil layers |
0 |
3 |
||
7 |
Sealed area state |
Interception storage |
0 |
1 |
8 |
Groundwater |
Groundwater storage |
0 |
1 |
9 |
Runoff concentration |
10 layers of runoff concentration |
0 |
10 |
10 |
Routing |
Channel storage |
0.2 * total cross section |
1 |
Routing |
Riverbed exchange |
0 |
1 |
|
Routing |
Discharge |
depending on ini channel stor. |
1 |
|
11 |
Lakes and Reservoirs |
Lake inflow |
from HydroLakes database |
1 |
Lake outflow |
same as lake inflow |
1 |
||
Lake&Res outflow to other lakes&res |
same as lake inflow |
1 |
||
Lake storage |
based on inflow and lake area |
1 |
||
Reservoir storage |
0.5 * max. reservoir storage |
1 |
||
Small lake storage |
based on inflow and lake area |
1 |
||
Small lake inflow |
from HydroLakes database |
1 |
||
Small lake outflow |
same as small lake inflow |
1 |
Model Output¶
An advantage of CWatM is the full flexibility of the output variables.
All parameters and variables can be used for output as maps or time series.
Even if the model is run at daily timestep, output can be daily, monthly, annual, at the end of a run
all variables maps are stored as netcdf and the meta data information can be added
Time depending and non depending output maps¶
The netCDF maps can be read with:
Windows
Linux
Or time series at specified points¶
# Station data
# either a map e.g. $(FILE_PATHS:PathRoot)/data/areamaps/area3.map
# or a location coordinates (X,Y) e.g. 5.75 52.25 9.25 49.75 )
# Lobith/Rhine
Gauges = 6.25 51.75 7.75 49.75
# if .tif file for gauges, this is a flag if the file is global or local
# e.g. Gauges = $(FILE_PATHS:PathRoot)/data/areamaps/gaugesRhine.tif
GaugesLocal = True
Or time series as a catchment sum or average¶
As standard, time series can include values of the specific cell as defined in the settings file as Gauges But time series can also show the area sum or area average of the upstream catchment from the specific cell
for example
[OUTPUT]
# OUTPUT maps and timeseries
# Standard values of a specific cell
OUT_TSS_Daily = discharge
OUT_TSS_AnnualAvg = Precipitation
# Area sum of upstream catchment
OUT_TSS_AreaSum_MonthTot = Precipitation, runoff
# Area sum of upstream catchment
OUT_TSS_AreaAvg_MonthTot = Precipitation
Format of output in the settings file¶
per day [Daily]
total month [MonthTot], average month [MonthAvg], end of month [MonthEnd]
total year [AnnualTot], average year [AnnualAvg], end of year [AnnualEnd]
total sum [TotalTot], total average [TotalAvg]
For each of the following sections output can be defined for different variables:
Meteo
Snow
Soil for different land cover (forest, grassland, irrigated land, paddy irrigated)
Water demand
Groundwater
River routing
Lakes and reservoirs
Or output can be defined in the section [output]
An output directory can be defined and for each sort of output the variable(s) can be set:
As example output for precipitation, temperature and discharge is shown here:
# OUTPUT maps and timeseries
OUT_Dir = $(FILE_PATHS:PathOut)
OUT_MAP_Daily =
OUT_MAP_MonthEnd =
OUT_MAP_MonthTot = Precipitation, Tavg
OUT_MAP_MonthAvg =
OUT_TSS_MonthTot = Precipitation, Tavg # monthly total precipitation and average temperature
OUT_TSS_Daily = discharge # daily discharge
OUT_TSS_MonthEnd = discharge
OUT_TSS_AnnualEnd = discharge
OUT_TSS_AreaSum_Daily = Precipitation # daily sum of precipitation for the upstream catchment
OUT_TSS_AreaAvg_MonthAvg = runoff # monthly average sum of runoff for the upstream catchment
Note
For each variable the meta data information can be defined in Output Meta NetCDF information
Output variables¶
Output can be every global defined variable in the model Variable are e.g. Precipitation, runoff, baseflow
but also not so common variables as:
reservoirStorage (amount of water in the reservoirs in [m3])
nonIrrReturnFlowFraction (returnflow from domenstic and industrial water use [m3])
actualET[1] (actual evapotranspiration from grassland [m/day])
…
Daily, monthly - at the end or average¶
per day
total month, average month, end of month
total year, average year, end of year
total average, total at the end
available prefixes are: ‘daily’, ‘monthtot’,’monthavg’, ‘monthend’,’annualtot’,’annualavg’,’annualend’,’totaltot’,’totalavg’
for example
[OUTPUT]
# OUTPUT maps and timeseries
OUT_Dir = $(FILE_PATHS:PathOut)
OUT_MAP_Daily = discharge, runoff, actualET[1]
OUT_MAP_MonthAvg = Precipitation
OUT_MAP_TotalEnd = lakeStorage
OUT_MAP_TotalAvg = Tavg
OUT_TSS_Daily = discharge
OUT_TSS_MonthTot = runoff
OUT_TSS_AnnualAvg = Precipitation
OUT_TSS_AnnualTot = runoff
Note
For each variable the meta data information can be defined in Output Meta NetCDF information
Note
We are not very precise when to use capital letter for some output variables. But we fear now, if we change the variable name, we will forget it somewhere.
Most important output variables - a selection¶
#Variable name : Description
discharge : river discharge
runoff : runoff
Precipitation : rainfall + snow
Tavg : average temperature
ETRef: potential : evaporation from reference soil
sum_gwRecharge : total groundwater recharge
totalET : total actual evapotranspiration
baseflow : baseflow from groundwater
... (to be continued)
Output variables - starting a list¶
We started a list of possible output variables. Please note that this list is under construction. We still need to fill in all descriptions and all units. You find this list at List of output variables