FAO/UNESCO Water Balance of Africa

Exercise 6: Water Balance Model for the Souss Basin

Prepared by
Seann M. Reed and David R. Maidment
Center for Research in Water Resources
University of Texas at Austin

Mohamed Rachid El Meslouhi
Direction Generale de l'Hydraulique
Rabat, Morocco

November 1996

Table of Contents

Goals of the Exercise

The goals of this exercise are to give you an understanding of how Arcview can be applied to study river basin management using the Souss Basin in Morocco as a case study example. The exercise consists of these parts:

  1. Use of the USGS 30" digital elevation model as a basis for defining the subwatersheds and stream network of the Souss Basin. This requires Arcview 3.0 and its Spatial Analyst extension. You can skip this part of the exercise if you don't have the Spatial Analyst.
  2. Running a set of preprocessor programs to set up the data tables needed to operate the surface water flow simulation program. These tables are prepared for a period of 30 days of daily simulation, from Nov 4 to Dec 3, 1988. This period is selected as a representative example of data from the wetter period of the year in the Souss Basin and is kept short so the exercise can be done reasonably quickly.
  3. Interpolating the daily precipitation from point measurement stations to the centroids of each subwatershed using an inverse distance squared algorithm.
  4. Running the surface flow simulation program to determine the flow at a stream gaging station near the outlet of the basin.

The simulation of the Souss basin also needs to account for the presence of three large dams in the basin and for exchange of water between the surface and shallow groundwater systems. Work on these aspects of the model is continuing. Without these items included in the surface water simulation, the results are rather approximate. But the intent here is to document how to build a model. Exercise 4 showed in a more fully developed way how to run a model which is already completed.

Computer and Data Requirements

The watershed delineation portion of this exercise requires ArcView 3.0 with the Spatial Analyst extension. The remainder of the exercise requires ArcView GIS, version 2.1 or later. Arcview is developed by the Environmental Systems Research Institute (ESRI), Redlands, California.

The files required for this exercise are in the directory \gisfiles\ex6af .

Internet students can download the necessary files.

Introduction to Souss Basin

The Souss Basin has an area of approximately 20,000 sq. Kilometers and is located at the Southern end of the Atlas Mountains. It was selected for this study because it contains a central valley having a large shallow groundwater basin fed by drainage from the overlying Souss River and from the Atlas Mountains. This valley is pumped heavily to support irrigated agriculture, especially citrus fruit production, and water levels are declining in the aquifer. Several plans have been put forward to replenish the groundwater by artificial recharge using small spreading berms on the Souss river, by providing additional surface water supplies by building more reservoirs in the mountains, or by building a canal to divert part of the Souss river flow to an area of the valley floor in which it can be used for groundwater replenishment. All these alternatives involve interactions between groundwater and surface water. It is intended that GIS-based models could serve as a basis for study and selection of a feasible approach to alleviating water shortages in the region.


1. Watershed and Stream Network Delineation Using ArcView 3.0, Spatial Analyst

To begin, start Arcview 3.0 and open the project called delin.apr with corrected pathnames. You will notice that the menu options for "Analysis" and "Hydro" appear in the View Menu Bar. These additional options are part of the Spatial Analyst and Hydrologic Modeling extensions. Extensions contain customized buttons, tools, menus and their associated Avenue Scripts and are added to the basic Arcview program to perform special functions. To see how these Extensions were added to this project, make the project menu active and look at the menu item File/Extensions . You will see a check mark next to the Hydrologic Modeling and Spatial Analyst extensions. These two extension are supplied by ESRI. The menu "Hydro" has been modified from its original form for this exercise and a button and tool have been added.

(a) Examine the Digital Elevation Model

To take a look at the area you will be working with, open the View BigDem. You will see a digital elevation model of northwest Africa with a box outlining the area of the DEM that was used to analyze the Souss Basin. This DEM was prepared by Michael Hutchinson and his co-workers at Australian National University and has a cell size of 3'. The high Atlas Mountains lie to the North of the Basin while the central plain contains the Souss River, which flows into the Souss River at the Atlantic Ocean at Agadir. The elevations in this region range from 0 to 4500 m, here shaded in 500m increments. The region of the Souss Basin is shown in the small box, where the Atlas mountain range reaches the Atlantic coast.

You can use the tool in Arcview to zoom in on the Souss region and the tool to examine the elevations on the grid. You'll see that the elevations range from 0 at the coast to a little over 4000 m at the highest cell. If you highlight the DEM theme and select Theme/Properties, you will see that the cell size is 0.05 degrees, or 0.05 x 60 = 3 minutes. This corresponds to a little more than 5 km on the ground. This particular grid was developed for purposes of climatic interpolation, and 3' cells are appropriate for describing average climatic conditions.

Close this view and open the View delin. You will see the clipped portion of the DEM that we are actually going to use for watershed and stream network delineation of the Souss basin. This DEM originally had a cell size of 30" and was developed by Sue Jenson and her co-workers of the US Geological Survey in Sioux Falls, South Dakota from the Digital Chart of the World. This grid is available for all of Africa on internet, and similar DEMs are also available on internet from the USGS for the other major continents. The DEM shown here was clipped from the Africa continental DEM and projected into a Lambert Conformal Conic projection which is is a standard for this region of Morocco.

The Theme name for this grid is sodempl. You can determine some information about this grid by making it active and selecting Theme / Properties . You will see that the cell size for this DEM is 1000 m and the number of cells in the grid is 206 by 239 for a total of 49,234 cells. Click OK to close this window. You will now use the Hydrology extension to process this digital elevation model.

(b) Determine the Flow Direction Grid Make sure that sodempl is the active Theme and then select from the Menu options the menu item Hydro / Flowdirection . A new grid called Flow Direction is computed using the 8-direction pour point method and added to your View. Take a look at this grid by placing a check mark next to the Theme name. Each cell in this grid has the value 1, 2, 4, 8, 16, 32, 64, or 128 indicating that the flow direction is in the east, southeast, south, southwest, west, northwest, north, or northeast directions respectively.

You can use the Hydrology extension to calculate a histogram showing the number of cells in the grid flowing in each direction by making the Flow Direction theme active and clicking on in the View Menu bar. If you use the tool you can click on the bars of the histogram and see the "count" or number of cells which flow in this direction. The principal flow directions are to the South, West and Southwest, reflecting the drainage of water south out of the Atlas mountains and then West to the Atlantic Ocean. There is also a significant flow coming North from the lower mountains forming the Southern boundary of the basin. Close this histogram window in the View.

(c) Trace Out Some Drainage Paths

Remove the check mark next to the flow direction grid so that you can see the DEM again. A script is available that traces the flow path of water from any cell in the DEM to to the edge of the DEM. To activate this script, click on and then click on any location in "sodempl." Click on as many points as you wish. The lines that have been drawn are graphic objects in ArcView. To remove these graphics, select Edit / Select All Graphics and then select Edit / Delete Graphics . The three upper paths shown here all drain to the Souss river, while the fourth path to the South flow through a separate outlet to the ocean, included in the study because its drainage area also overlies the Souss aquifer.

(d) Determine the Flow Accumulation Grid

To identify the drainage network, again make the Flow Direction Theme active and then select Hydro / Flow Accumulation from the View menu bar. This causes Arcview to run the Flow Accumulation function, which counts the number upstream cells of each cell in the grid, and places the result in new grid. If you place a check mark next to the Flow Accumulation Theme, you will see that major drainage paths are displayed in darker colors. The numbers in the legend bar specify the number of upstream cells whose drainage passes through the given cell. Since each cell in this grid has size 1 km, these numbers are the same as the upstream drainage area of each cell in sq. km. The cells in the white area in the illustration below have upstream drainage area less than 70 sq. km. If you zoom in to the region of the two watershed outlets in the study area, you can use the tool to determine the flow accumulation of each outlet. The values are 17,989 sq. km and 5152 sq. km, respectively, so the study region has a total drainage area of 23,140 sq. km.

(e) Define the Stream Network

A drainage network is defined in the next step by creating a new grid whose cells are classified in those with value 0 or 1, where 1 means that the cell is on a stream and has a Flow Accumulation value greater than a specified threshold number (or drainage area) and all other cells have the value 0 so they constitute the "landscape" or off-stream cells. This is carried out by highlighting the Flow Accumulation grid and then selecting Analysis / Map Query from the View Menu bar, using the editor window to ([flow accumulation] > 500 ) and then hitting the Evaluate button. By repeating this exercise for different threshold values, you can get a sense for stream networks of different degrees of detail. The resulting stream network can be overlaid on the DEM grid:

(f) Watershed Delineation

To delineate watersheds, select the menu item Hydro / Delineate Watersheds . Make sure that the Theme names specified are correct and click OK at the first message box.

At the second message box, you are allowed to specify the delineation threshold for creating a set of watersheds. Leave the prefix at "xx" and the threshold at 100 cells and click OK. The prefix is a two letter identifier for this particular watershed delineation. If you want to repeat the exercise for an alternative threshold stream drainage area, you must choose a different prefix identifier for the new grids thus created.

Click OK when the program finishes.

This program creates a classified stream network with 1's in the streams and 0's elsewhere (xxst) and a grid of delineated watersehds (xxshd). The watershed delineation program uses the logic that a stream is begun whenever the cells have a drainage area greater than the threshold of 100 cells (or 100 sq. km in this case), and a watershed is delineated for each stream link with its outlet cell at the stream junction where this link discharges its water into the next downstream link. Each watershed has a unique grid-code. It is much easier to view the watersheds if they are converted to polygon features. To convert the watersheds to polygon features, click on the C button.

Place a check mark next to "xxshdc" to see the watersheds you have delineated. It may be easier to see the results of the next step if you change the legend for these watersheds to white. To see which watershed units are within the Souss Basin, put a check mark next to the Theme outline. To display the delineated streams on top of these watersheds, drag the Theme xxst to the top of the Legend Bar. Here is the result for the 100 cell flow accumulation. It is complicated! Simpler networks can be created by increasing threshold accumulation.

2. Setting up a Surface Water Model for the Souss Basin

Now, we will switch to the part of the exercise that can be executed with either Arcview 2.1 or Arcview 3.0. The inputs to this exercise include the watershed and stream network computed as shown in the previous part of the exercise but with a larger threshold drainage area, so as to simplify the resulting network.

The project called hydro.apr contains many scripts that are used to simulate surface water flow. To set up the surface water simulation model for the Souss Basin, open the project hydro.apr. Open a new View and add the arc coverage sorivsb, the polygon and arc coverages for soshdcdb, and the point coverages rainst and hydrost. The "Add Theme" menu that you see should look like this:

To see the "polygon" and "arc" coverages for "soshdcdb" in this menu, click on the folder next to "soshdcdc." Place a check mark next to each Theme so that you can see what they are. You may have to drag "sorivsb," "rainst," and "hydrost," above "soshdcdb" so that you can see these coverages. "Rainst" contains stations where rainfall records are available and "hydrost" is a map of runoff stations.

(a) Set up the Processing Tables

Make "soshdcdb" active and zoom to the study area . The line coverage of streams (sorivsb) and the polygon coverage of watersheds (soshdcdb) were created using a delineation procedure in Arc/Info Grid. Several processing steps are required to prepare these coverages for surface water modeling in ArcView. These processing steps have been automated using Avenue scripts. The preprocessing scripts perform the following tasks:

  1. Add fields to the river line attribute table and the watershed attribute table that store information such as velocity, loss coefficients, average flow rates, and many other attributes.
  2. Sort river nodes to make sure that all arcs in each river segment are pointing downstream.
  3. Clean river splits to make sure that each subwatershed contains only river segments that will form one single line.
  4. Merge river segments composed of many arcs into one arc.
  5. Identify subwatersheds which are head watersheds.
  6. Create many tables to hold spatially-referenced time-series data and other files needed to support the modeling algorithm.

To run the pre-processing program, select SFwModel / SGFPrep (pre-all) Some of the message boxes that come up may not be entirely clear, but just follow these instructions:

At this time there are still a few errors in the pre-processing program that need to be corrected manually. Two of the tables needed by the program did not get all 30 records added -- "mflowfit.dbf" and "target.dbf." To fix this problem, select SFwModel / AddingRec . Select the table "mflowfit.dbf" and click OK. Click YES and type 18 (because we want to add 18 records to 12 to make 30) and click OK. Click YES to continue to the next table. This time, select "target.dbf" and click OK. Click YES and type 18 and then click OK. When asked whether to continue to the next table, click NO.

(b) Specify the Model Parameters

Some model parameters for this model need to be specified. Make the Theme soshdcdb.ply active and click to view the attribute table for this coverage. Scroll to the right until you see the fields "FlowTime" and "DiffNum" (Diffusion Number). These are theoretical parameters that determine the time distribution of runoff at a subwatershed outlet given a daily pulse of rain. The concept used in this model is similar to the unit hydrograph theory. Default values for the FlowTime and DiffNum parameters have been assigned by the pre-processing program. To calculate the correct values of these parameters requires information about mean flow length and the standard deviation of mean flow length. This information can be determined from the DEM by a separate processing procedure involving the Flow Length function. This has been precomputed for you. To add these resulting parameter values to the table, add the Table "length.dbf" to your Project. Make "length.dbf" the active Table and highlight the field labeled "value." Now, make "Attributes of Soshdcdb.ply" active and highlight the field "grid-code." With this done, select Table / Join Now that these tables are joined, select the menu item Table / Start Editing and then highlight the field "FlowTime" and click . With the Field Calculator that comes up, you set new values for FlowTime by setting [FlowTime] = [flowt] as shown below.

Repeat this procedure to set the diffusion number: [DiffNum]=[Diffn]

You also need to specify the mean flow length field -- "MFL" -- in this table because numbers in this field are used to estimate losses during overland flow. Highlight the field "MFL" and use the calculator as shown below.

We are done with this table for now Select Table / Remove All Joins and then Table / Stop Editing and then close the table.

(c) Interpolating the Precipitation onto the Watersheds

Before running the simulation, the input rainfall table needs to be added to the project. Add the Table precex6.dbf to your project. This Table contains 30 days worth of rainfall records for Nov. 4 - Dec. 3, 1988. The Fields in this Table correspond to each of the rainfall stations shown in the coverage "rainst." A program has been written which interpolates the rainfall values at each station to the center points of the model polygons. A full soil water balance study of the Souss Basin has not been made yet because the detailed information on soil water capacity is available in the Souss valley but not in the surrounding mountains. For present purposes, the rainfall-runoff relationship is taken to have a runoff coefficient of 0.25, which is approximately the average of values found by studying data of mean annual rainfall and runoff in the basin.

To run this program, click on and click anywhere in "View1." Click NO at the first menu and then choose to run the program cmpsurp.pre and click OK. Select precex6.dbf as the rainfall table and click OK. Select rainst as the rain station Theme and click OK. Select "soshdcdb.ply" as the watershed coverage and click OK. Select "grid-code" as the key field and click OK. Select "rainid" -- the last field as the rain station key field and then click OK.

As the computations proceed, the red dots highlight the polygon centers where computations are currently being made, the light blue dots highlight locations where the last calculation was made, and the green dots show locations where computations have been completed. Click OK when computations are complete. The results of this interpolation were written to the table "psurp.dbf." The time series of rainfall in any watershed can be plotted using , entering 1 and OK, clicking on any subwatershed, and then selecting "psurp.dbf" as the Table to plot. You can keep the plot and plot additional time series as you wish.

3. Running the Simulation

It might be useful at this point to remove the check mark next to the "rainst" coverage so that the graphics displayed during simulation can be seen more clearly. One more change needs to be made before the simulation model can be run. The loss coefficient in the river needs to be specified. Open the attribute table for "sorivsb.shp" and select the menu item Edit / Select None. Edit the Field "LossC" in this Table by highlighting this Field and using the Field Calculator to set "LossC" equal to 0.006. Note that a different loss coefficient could be specified for each river arc. We will use the default river velocity of 0.33 m/s for this simulation which you can see in the Field "velocity."

Select SFwModel / SFlowSim to run the model. You will be prompted for input parameters as shown in the figure below:

The parameter Optimize is 0 indicating that this is a simulation run only, CalPflow=1 indicates that polygon flow will be computed in this run, Nresp=0 indicates that no response function will be used in this run, IniTimeStp and EndTimSteps indicate the number of days being simulated, ToSubs=0.1 indicates that 10% of polygon surplus goes to a groundwater reservoir, Muskingum = 1 indicates that Muskingum Cunge river routing will be considered, and plotply=1 indicates that polygon outlines will be highlighted as computations are made. When the program is completed, you will be asked whether or not you want to select the flow path. Click YES.

4. Comparing results with observed data.

To compare the simulation results with measured runoff at a gaging station, add the runoff table called "runex6.dbf" to the Project. This is the observed runoff at Ait Melloul which is the most downstream station in the basin. This runoff station lies in the polygon with grid-code=23. The "toflow" predicted by the model for grid-code 23 should approximate the runoff at Ait Melloul (IF THE MODEL IS CALIBRATED). To make a Chart comparing the calculated and observed runoff, first Join the Table "runex6.dbf" to the Table "tflow.dbf" using "Time" as the key Field. Click on and in the Chart Properties Box and Add the Fields "GC23" and "Runoff" to the "Groups" to be charted. Label the series using "Time" and click OK. Now click on to see a comparison of observed and simulated runoff at Ait Melloul.

Ok, you're done!!

Go to Index of Exercises

These materials may be used for study, research, and education, but please credit the authors and the Center for Research in Water Resources, The University of Texas at Austin. All commercial rights reserved. Copyright 1997 Center for Research in Water Resources.