0% found this document useful (0 votes)
14 views11 pages

SPHY Tutorial

This document provides a comprehensive tutorial for installing the SPHY model, including necessary software and tools such as Python, Numpy, and PCRaster, specifically for a Windows operating system. It details the installation process for both GUI and Python interface versions of SPHY, as well as the integration with QGIS. Additionally, it outlines the steps for pre-processing and running the SPHY model, ensuring users have a clear guide to complete the installation successfully.

Uploaded by

vikrants
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views11 pages

SPHY Tutorial

This document provides a comprehensive tutorial for installing the SPHY model, including necessary software and tools such as Python, Numpy, and PCRaster, specifically for a Windows operating system. It details the installation process for both GUI and Python interface versions of SPHY, as well as the integration with QGIS. Additionally, it outlines the steps for pre-processing and running the SPHY model, ensuring users have a clear guide to complete the installation successfully.

Uploaded by

vikrants
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Tutorial for SPHY installation

Installation of Additional Software

First of all, for the installation of SPHY model we need some tools and software to run the
model. For additional software and tool go through the SPHY website to download the
necessary files.

Installing SPHY for Graphical user interface (GUI) based platform


To install the SPHY as GUI with a windows operating system we need Windows 7 and higher
are supported. The software packages that are required to run the SPHY model listed as
below:
Installation of additional software
1. Python 2.7.6, 32-bit
2. Numpy 1.8.0, 32-bit
3. PCRaster 4.0, 32-bit
4. SPHY v2.0 source code
These packages need to be installed in the same order as shown above, and the installation of
each package is described as below:
Python 2.7.6, 32-bit
During installation of python, it will be asked where to install Python. You can choose any
location that you prefer.
After successfully install the python the final installation step includes the setting the
environmental variables. For environmental variables follow the steps below:

1. Go to start, then control panel, and type environment in the top-right search window.
2. Click on “Edit the system environmental variables”.
3. Click “Environmental Variables” in the bottom-right of this window.
Tutorial for SPHY installation

4. Under system variables, select the Path variable and click “Edit”.
5. In order let your system know the existence of your Python installation, it is required
to add your Python installation folder to the “Path” system variable, which was the c:\
Python27 installation folder.
6. Finally, click OK and complete the installation of Python.
Numpy 1.8.0 32-bit
SPHY requires a Numpy version that works with the 32-bit version of Python 2.7.6, which is
Numpy 1.8.0 32-bit. it can be installed by double-clicking on downloaded .exe file. If Python
2.7.6 has been installed correctly in the previous step, then the Python installation folder will
be found automatically during the installation of Numpy.
PCRaster
SPHY v2.0 is based on the 32-bit system architecture, and therefore requires the 32-bit
PCRaster 4.0 or 4.1 version.
PCRaster is installed manually in your system. To install PCRaster 4.0, it is mandatory to
have successfully installed Python 2.7.6 and Numpy 1.8.0 during the previous two steps. To
install PCRaster you need to perform the following steps:
1. Create a new folder on your hard disk where you prefer to install PCRaster. For
example: c:\Program Files (x86)\PCRaster
2. Unzip the contents from the pcraster.zip file
3. To let your system recognize the existence of PCRaster, the Environmental Variables
need to be updated again. The steps to get to your system Environmental Variables
are shown in previously in python installation.
4. It is now required to add the “bin” directory of the extracted PCRaster package to the
“Path” system variable. The folder is: c:\Program Files (x86)\PCRaster\bin\
5. Click OK.
6. The next step involves setting the PYTHONPATH environment variable. In the same
system variables window check the existence of a PYTHONPATH variable. If it
exists, then edit the variable by adding the path of the Python directory of the
extracted PCRaster package, which is in our example: i.e c:\Program Files (x86)\
PCRaster40\python\
7. Otherwise click “New” to create it, and add PYTHONPATH as Variable name, and
add the Python directory folder as the Variable value.
8. Click OK and OK to complete the installation of PCRaster.
9. The successful installation of PCRaster can be tested as follows:
a) Open a command prompt
b) Type pcrcalc
c) You should see the command prompt
SPHY v2.0 source code
The SPHY v2.0 source code can be downloaded from SPHY website. The source code is
available as a zip-file (SPHY2.0.zip) and needs to be extracted to a folder on your hard drive.
In our case we created the folder c:\SPHY and unzipped the contents of SPHY2.0.zip to this
Tutorial for SPHY installation

folder. After unzipping the contents of SPHY2.0.zip to a folder of your preference,


installation has been completed successfully.
After installing all above tools and additional software go for the QGIS installation.
Tutorial for SPHY installation

INSTALLATION OF QGIS, SPHY MODEL AND PREPROSSESOR

Installing QGIS, SPHY model and preprocessor as an integrated application in QGIS


To install the SPHY model plugin and SPHY model preprocessor GUIs, it is required to
install QGIS first. Just double click the QGIS downloaded (version QGIS v2.8.2.1) file and
follow the steps to install it.
To install SPHY as an integrated application in QGIS, all the steps of above mentions must
be conducted first. Then the following additional packages should be installed:
To use this GUI inside QGIS, it is only required to extract the contents of the downloaded
zip-files (SphyPreProcess.zip & SphyPlugin.zip) into the QGIS python plugins directory.
Generally, this directory is located on the following location on your hard disk:
c:\Users\XXXX\.qgis2\python\plugins\
where XXXX should be replaced by the name of the PC user. If this folder does not exist,
then create this folder manually. After unzipping the contents of SphyPreProcess.zip and
SphyPlugin.zip into this folder, the installation of the interface has been completed.
To activate the plugin in QGIS, follow the next steps:
Launch QGIS.
Go to Plugins > Manage and Install Plugins.
Then in the window that pops up you should select under “Settings”:
a. Show also experimental plugins.
b. Show also deprecated plugins.
Go to “All” and type “sphy preprocessor” in the search bar and select the SPHY preprocessor
plugin that shows up.
And again, go to “All” and type “sphy model” in the search bar, and select the SPHY model
plugin that shows up.
Click Close to close the Plugins menu.
If installation and activation has been successful, then the SPHY preprocessor and SPHY
model interface logo (button) has been added to the toolbar.
Tutorial for SPHY installation

PRE-PROCESSING
1. Launch QGIS 2.8.2 Desktop, Open the ‘SPHY pre-processor’

2. Create a ‘New Project’ and save it to your working directory.

3. Go to General Settings Tab. Here, select all the required directories first, and then
specify the ‘UTM zone’ and ‘Meteorological forcing period to process’.
4. Area selection’ Tab

5. Using ‘Click to select area’ feature, draw a Rectangular area to select your Region.
Here, you can take the help of your area’s shapefile, if you already have it.
Tutorial for SPHY installation

6. Set spatial resolution, Re-calculate area properties and Create model clone.

7. Modules Tab – Select all the relevant ‘Modules to process’ and then click on ‘Create
initial maps’

8. Basin delineation Tab


Tutorial for SPHY installation

Create a ‘New Shapefile Layer’ for the Outlet Point

Use ‘Toggle Editing’ option to edit and created file and add point features

Now, just browse and select your outlets shapefile and then click on ‘Delineate basin’.

9. Create Station
Same as previous step create a new shapefile and named it as “stations” and save the
shape file according to your area of UTM zone.
Then, just browse and select your stations shapefile, and then click on ‘Create stations’.

10. Meteorological forcing’ Tab

For the meteorological forcing, you may use your self-compiled temperature and precipitation
data from any source (preferred) or you may even use the default data provided in the
‘Database’. Finally click on ‘Create forcing’ to start the generation of forcing data.
Tutorial for SPHY installation

Run the SPHY model GUI based

1. SPHY model GUI for first-time use

SPHY model interface after creating a new project.


Overview of the SPHY model plugin top menu (buttons in blue box) and a tab
widget, consisting of 11 tabs (red box)

General Setting: SPHY model interface after opening an existing project

2. Climate tab: Select prec, tavg, tmax and tmin map from forcing folder

3. Soils tab: Select initial soil maps from input folder


Tutorial for SPHY installation

4. Groundwater tab: Set as default or you can change according to your area

5. Land used tab: Select Lulc.map and kc.tbl (kc.tbl is give in datasets)

6. Glaciers: Select initial glaciers maps

7. Snow: SnowIni value (default value) and set critical temperature.


Tutorial for SPHY installation

8. Routing: select ldd.map and rest options set as default

9. Reporting options: select output components which are interesting for you.

10. Run Model: Select PCRaster bin folder and python.exe file
Tutorial for SPHY installation

…………. Installation of SPHY Model 2.1.1 for python interface ..…………

The Python versions and packages for the SPHYv2.1.1 install are as follows:
 Python = 2.7 (Anaconda)
 PCRaster = 4.1.0 (Manually)
 SPHY = 2.1.1 (Anaconda)
 Numpy >= 1.16.2 (Anaconda)
 Pandas >= 0.20.1 (Anaconda)
It is recommended to use Anaconda Python distribution to install and manage all the
environments and packages inside your computer. All the packages in exception to PCRaster
can install using Anaconda.
First you have to install anaconda to create environment variable to perform sphy
Installation of python, Numpy, and Pandas, gdal with Conda.
1.- Open anaconda command prompt.
2.- Create a new environment called “sphy” and install python, Numpy Pandas and gdal The
Python version 2.7 is required.
Command: conda create --name sphy -c conda-forge python=2.7 numpy pandas gdal
The manually Installation of PCRaster was already discus in previous steps during the
installation of additional software.
Check the installation of sphy environment to Activate the sphy environment.
Command: conda activate sphy
Activate Python
Command: python
Import PCRaster
Command: from pcraster import *
If all the commands run without error, we can go for installation of SPHY model.
Finally install SPHYv2.1.1
Close the conda command prompt, open again and activate the environment.
Command: conda activate sphy
Installing the SPHY
Command: conda install -c WilcoTerink SPHY=2.1.1

You might also like