A repository for a conceptual hydrological model. (Exercise 2 Watershed Modelling, ETH Zurich)
-
Download the zip file
wat_bal_python.zipand extract it. -
Install python 3.7.6 (Required)Its Free!
- To check that python is installed on your desktop:
- For Mac open terminal and type
$ python3(Mac comes with preinstalled python 2.7.6 but you still need to install python 3.7.6) - For Windows 10, open Windows Power Shell and then type Python
- For Mac open terminal and type
- To check that python is installed on your desktop:
-
Install Visual Studio Code (Recommended)Its Free!
- Visual Studio Code is an editor and will comes with autocomplete and syntax highlighting features
- Any other editor should work as well but from here on the setup will be in Visual Studio Code
- Download the version depending on your OS.
-
Setting up the project. Installing packages.
- Open Terminal/Windows Power Shell
- Install pipenv by running
$ pip3 install pipenvin Terminal/Windows Power Shell - Open Visual Studio Code
- A welcome screen will appear, in the left side bar select the Extension (icon with 4 squares)
- Search Python. Select Python (Linting, Debugging,..)
- Once it is installed open Explorer on the top left bar. (shift+ctrl+e)
- Select Open Folder, Browse to the directory water_bal_python.
- The folder should contain
PipfileandPipfile.lock - Go to Terminal at the top and select new terminal
- Terminal will open at the bottom, Run the command
$ pipenv install - This step may take some time and the internet connection is required
- Restart the VSCode. Now on the lef side of blue colored bottom bar you can see the python version adn in bracket name of the folder along with
pipenv.('wat_bal_python:pipenv')
- There are 5 scripts namely
model.py,plots.py,utils.py,run_opt.py,run_param_plot.py,run_sim.pyand two folders namedataandplots - All the required data is in the
datafolder - All the plots will be created in the
plotsfolder - Two more files will be added namely
parameter.h5andgof.csv Parameter.h5will have the list of parameters for different runsgof.csvwill contain the goodness of fit values for observation and simulation- Run the scripts in order
run_opt.pywill optimize the model and save the value of parameters in Parameters.h5- Number of runs
nrunsneeds to be selected here. Roughly it takes 70-120 runs per iteration depending on the computer.
- Number of runs
run_param_plot.pywill generate the plots of the parameters- Seeing the histogram of parameters chose the value of the parameter and add the values to the script
run_sim.py - Run
run_sim.pyto save the plots and gof values - Any change in the structure of the model needs to be made in
model.py - For adding parameters to calibrate some changes also needs to be made in
run_opt.pyandrun_sim.py