FAO/UNESCO Water Balance of Africa

Soil Water Balance in Morocco

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

(modified 4/29/97 for Gishydro97)


Goals of the Exercise

Exercise Procedure

  1. Getting familiar with the input data
  2. Running an Avenue script to calculate potential evaporation
  3. Running an Avenue script to calculate the soil-water budget
  4. Viewing Results

Finding Required Data and Getting Started

The exercise requires Themes, Scripts, and Text files which are automatically loaded by a Project which is provided for you. The files needed for this exercise can be found in the directory ~/soil/morocco/gisfiles on the Gishydro97 CD-ROM.

To run this exercise, first copy all the files in ~/soil/morocco/gisfiles to your local hard disk. Make sure you keep the project file and data files in the same directory. IMPORTANT! If you copy the actual directory "gisfiles" with the files inside, then you need to make sure your machine has write permission to this directory and all directories above this directory. On a PC you can change the properties of a file or a directory by highlighting that particular file and then selecting File / Properties using the File Manager. Make sure the box next to the words "read-only" is not checked for the gisfiles directory. You should find the following files in the directory soil/morocco/gisfiles.

  • To begin the exercise, start ArcView and select the menu option File / Open Project.

  • Open the project file called "sbudget.apr." A startup script will automatically load the data files needed for this exercise. WARNING! The startup script will not work with ArcView2.1 or earlier versions. You will be prompted for the name of a project working directory. This is the directory to which program output files will be written. If you later change your mind and decide you want to write your files to a different directory, then select the menu item Project / Properties and change the "Work Directory." If you don't specify a directory, the default is usually the $home directory on your machine.
  • 1. Getting Familiar with the Input Data

    The input data for this version of the soil water balance model are precipitation, potential evaporation, and total water holding capacity. In this exercise, potential evaporation is calculated using the Priestley-Taylor method; therefore, information about temperature and net radiation are required as input. This part of the exercise is intended for you to familiarize yourself with the input data: climate, soils, and net radiation.

    Climate Data

    Mean monthly temperature and precipitation estimates interpolated onto a 0.5 by 0.5 degree mesh were obtained from Cort Willmott at the University of Delaware. These data come from the "Global Air Temperature and Precipitation Data Archive" compiled by D. Legates and C. Willmott. The monthly precipitation estimates used in this study were corrected for gage bias. Data from 24,635 terrestrial stations and 2,223 oceanic grid points were used to estimate the global precipitation field. The climatology is largely representative of the years 1920 to 1980 with more weight given to recent ("data-rich") years (Legates and Willmott, 1990).

    The data region used here is centered on northern Morocco and extends from approximately (14W, 26N) to (1E, 37N), including both areas over water and the land surface. Data from the adjacent Atlantic and Mediterranean are included in the climate files to illustrate the climatic differences between the oceans and the land surface. The actual exercise is performed on a more restricted set of land surface cells for which the soil water holding capacity is defined.

    The raw data obtained from the University of Delaware were downloaded via ftp in formatted text files. FORTRAN and AML were used to generate Arc/Info cell polygon coverages (converted to a Shapefiles ) to which these data are attached. Mean monthly and annual climate data are attributes of the shapefile morclim.shp. The Themes that you see called "Precip" and "Temp" both reference the file morclim.shp.

    To view the climate data in the project sbudget.apr do the following:


    Precipitation: To view mean annual precipitation data, place a next to the Theme "Precip."

    Click on Image for Larger View of Precipitation

    Temperature: To view the mean annual temperature, remove the box next to the Theme "Precip" and add a next to the Theme "Temp."

    Click on Image for Larger View of Temperature

    Water-holding Capacity Data:

    Global estimates of "plant-extractable" water capacity (or total water-holding capacity) on a 0.5 degree grid were obtained via anonymous ftp from the USGS Geophysical Fluid Dynamics Laboratory. This data set was compiled for a Master's thesis written by Krista Dunne at the University of Delaware. Information about sand, clay, organic content, plant rooting depth, and horizon thickness was used to estimate the total water-holding capacity. An important source of data used in this analysis was FAO's Digitized Soil Map of the World (FAO, UNESCO, 1974-1981). The global average soil water-holding capacity estimate is 86 mm.

    Water-holding capacity estimates have also been attached as an attribute to the coverage morclim.shp. These values are contained in the field "whold." To view this data, remove the check mark next to the Theme "Precip" and check the box next to "Water Holding Cap".

    Click on Image for Larger View of Water Holding Cap.

    Net Radiation Data

    Global mean monthly Surface Radiation Budget data generated using International Satellite Cloud Climatology Project (ISCCP) and Earth Radiation Budget Experiment (ERBE) data are available for a 96 month period extending from July 1983 to June 1991. The data are given on the ISSCP equal-area grid which has a spatial resolution of 2.5 degrees at the equator. Using this data, monthly average and mean annual and mean monthly values of net radiation were computed for this 8 year period. To make computations easier, the radiation data were resampled to the same resolution as the climate and soils data (0.5 degree cells).

    There are 13 fields in the coverage morclim.shp that contain 12 mean monthly and a mean annual values for net radiation. The field names are "nr_jan," "nr_feb," "nr_mar," etc. The mean annual values are displayed by the Theme named "Net Rad."

    To view the mean annual net radiation remove the check mark next to the Theme "Water Holding Cap." and check the box next to "Net Rad."

    Click on Image for Larger View of Net Radiation

    You can see that net radiation has low values in the dry desert regions (inland) and higher values along the coast and in the ocean. Differences are caused by the fact that much of the incoming energy in the wetter regions is used to transform water into water vapor, and because more emissions of long wave radiation occur in the desert due to higher surface temperatures. Lower water vapor and fewer clouds in the desert regions allow more longwave radiation emitted by the surface to pass freely back out of the atmosphere. The albedo (fraction of incident shortwave radiation reflected) also tends to be higher in drier areas.

    2. Running an Avenue Script to Calculate Potential Evaporation

    The script provided here uses the Priestley-Taylor method to calculate potential evapotranspiration (PE). To begin calculations, remove the check next to "Net Rad" and place a check next to comcells.shp. Make sure that the Theme comcells.shp is active by clicking on it with the mouse so that its bar is raised.

    You need to select the cells in comcells.shp at which computations will be made. Use the selection tool and select some computational cells by clicking on them on the View. Click and drag the mouse to select a region of cells. If you select 10 cells or less, the calculations will go fairly quickly. If you make a selection and don't like it, use the unselect tool to delete the selection and then repeat the exercise. You may wish to orient yourself within Morocco, by labeling the cities as shown below. Here is a set of nine cells selected around the city of Marrakech.

    To calculate Potential Evaporation, select "Calculate PE" under the "Programs" Menu. A window will come up asking the user to enter the input information.

    In this window, the information needed is:

    Working Directory: defines to which directory the output is written.

    View: defines which view the program operates on. Make sure this is the same as the name of your view in the title bar at the top of your View. The default name is wbudget

    Theme Name: name of the theme on which computational cells are selected

    ID Field: the key field which indexes the computational cells. This is set automatically and you should not need to change it.

    Output File Name: the name of the output file that you calculate. Change this name if you repeat the calculations so that you don't overwrite your earlier results. The default output file name is pevmor.txt.

    Check to see that the working directory is appropriate for your machine. All the other inputs should be the same as those shown in the window above. Click OK. After the calculations are complete, you will want to display the results you created. Arcview does not automatically add text files to a project and you have to do that yourself. Make the Tables icon active in the Project window and click the button in the Project window to add the textfile pevmor.txt to the project. When adding the table use the Scroll Bar under List File of Type to select Delimited Text (*.txt) because the default file type that Arcview looks for is a dBase format, or .dbf extension.

    In this results table (pevmor.txt) that you have just created, the first column or field is the time index, in this case, time in months with 1 = January, 2 = February, etc. The remaining fields in the table are the potential evaporation in mm/month computed for each month of the year in each selected cell of the computational Theme. To determine which cell the data refer to, first zoom to the cells at which you made the calculations and reselect these cells if they are not already selected. You can do this by clicking . Make sure the Comcell.shp theme is the only one highlighted in the view, then select Theme/Autolabel and select Afpoly_ as the Label Field and click OK. For example, cell 2592 is the upper most cell on the left side of those selected and its field is highlighted in the tabular display shown below.

    A chart of the potential evaporation in a particular cell can be constructed by highlighting the pevmor.txt table, select Table/Chart in the menu bar, select the field C2592 from "Fields" and Add it to "Groups", then "Label series using:" Index. A bar chart like the one shown below should then appear.

    The formula used for computing the potential evaporation is:

    where Ep is the potential evaporation rate in mm/month, d is the gradient of the saturated vapor pressure curve in kPa/degree C at the prevailing temperature T in degrees C, g is the psychrometric constant in kPa/degree C, and Er is the water evaporation equivalent of the net radiation in mm/day. The values of d and g as a function of temperature are given in Table 4.2.1 p. 4.4 of the Handbook of Hydrology, (McGraw-Hill, 1993, ed. by D.R. Maidment). The value of Er is given by:

    where Rn is the net radiation in W/m2, L is the latent heat of vaporization of water in J/kg, and 86,400 is the number of seconds in a day. Here, we will assume a water density of 1000 kg / m3. The value of L is given by:

    where T is the prevailing temperature in degrees C.

    For July, on cell C2592, the input data values for temperature and radiation can be read by highlighting the comcell.shp theme, and using the information tool to click on the cell. The values obtained for July are T = 26.7 degrees C and Rn = 122.13 W/m2. The latent heat of vaporization is given by:

    The value of Er is given by:

    For a temperature of 26.7 degrees C, the values of d and g are obtained from the Handbook as d = 0.206, g = 0.0671, so the potential evaporation rate for July is found as:

    Ep = 1.3 (0.206 / (0.206 + 0.0671)) * 4.33 = 4.24 mm/day, and if this value is multiplied by 31 days in July, the result is 132 mm/month. The value given for July potential evaporation in unit C2592 in the table pevmor.txt is 131.92 mm/month, so the computation is thus verified.

    3. Running an Avenue Script to Calculate Soil-Water Budget


    Close the file "pevmor.txt" and make sure that "comcells.shp" is still the active Theme. Use to select the cells in comcells.shp where you wish to compute the soil-water budget. Depending on your computer speed, this computation may take some time so selecting 10 cells or fewer is recommended for demonstration purposes. You can select any cells and you are not restricted to points where you have calculated potential evaporation because the potential evaporation results for all cells have been pre-computed for you.

    Select Run Soil Budget under the Programs menu. You will be asked whether you wish to continue with selected cells (say yes), and then you will be prompted to select a control file. Select morbal.ctl which is located in ~/soil/morocco/gisfiles. This file contains a list of the parameters shown in the query window which now presents to you:

    The parameters in this window are:

    Working Directory: the directory to which the output files are written

    Starting Month for Balancing: first month for water balance computations. The default value is 1 for January.

    Number of Years for Balancing: this corresponds to the number of years of data in your climate data file. The default is 1 year.

    Ending Month: last month for water balance computations. The default value is 12 for December.

    Months Beyond Balance Period: The default value is 0.

    Precip Table: The input table specifying the precipitation input data (mm/mo.).

    Pevap Table: The input table specifying the potential evaporation input data (mm/mo.). This table is like the pevmor.txt table computed in the previous exercise.

    Surplus Table: The output table containing the computed water surplus results (mm/mo.)

    Soil Moisture Table: The output table containing the soil moisture level at the beginning of each month (mm).

    DST Table: The output table containing the soil moisture increments from one month to the next (mm/mo.)

    Actual Evap. Table: The output table containing the actual monthly evaporation (mm/mo.)

    Theme to Model: The Model Unit Theme defining the spatial units on which the computation is to be performed.

    Cell ID Field: The key field in the Model Unit Theme that indexes the spatial units and is used in the field or column header on all the time series tables of the computed values to indicate the spatial unit to which each time series is applied.

    Whold Field: The Field in the Model Unit Theme which specifies the total water holding capacity of the soil (mm).

    View: The name of the View containing the computational Theme..

    Don't change the names of the input files for precipitation or potential evaporation but you can change the names of the output files if you want to run several different cases and compare the results.

    Here is an example of the input precipitation and potential evaporation data used in in this computation. The data for cell C2592 are highlighted. You can see that the potential evaporation values are the same as those determined in the previous part of this exercise. The 12 rows in this table contain data for the 12 months, January to December. The data structure of defining the spatial units with fields and the time units with records is cumbersome when there are many more spatial units than time steps (as in this case) but this data structure is convenient when longer time periods or shorter time steps need to be considered.

    Before the calculations are done, you will be presented with this message box, which gives you an opportunity to save the control file you have used so that if you have made changes to it, you can use the new control file again later. For the first time you run this exercise, select No. If you run the exercise twice with the same control file, you will create duplicates of each output file. If you hit Yes at this point you will be prompted for the name you wish to assign to your new control file.


    Once the water balance calculations are completed you will see a message box like this. Hit OK, and the program is terminated.



    As you will notice, the cells where computations are made turn red. The red blocks are ArcView graphics and are
    kept at the end of the program to indicate where computations have been made. Keeping these graphics may be helpful for part 4; however, if you want to get rid of these graphics, you can select Edit / Select All Graphics and then Edit / Cut Graphics.

    4. Viewing Results

    Four dBase files have been created by the script "balance.ave" that was initiated when you selected "Run Soil Budget." "Surpmor.dbf" contains computed surplus. "Stmor.dbf" contains soil moisture storage. "Dstmor.dbf" contains change in storage, and "evapmor.dbf" contains computed evaporation. Here is an example of the computation:

    The example shown is for May in unit C2592. This unit has a water holding capacity of 13mm. In May, 33mm of precipitation produces 27.1 mm of evaporation, a water surplus of 7.2mm, and a change in soil storage of 33 - 27.1 - 7.2 = -1.3mm. The storage at the beginning of the month is 4.0mm, so the storage at the end of the month is 4.0 - 1.3 = 2.7mm. This value is stored as the starting storage in month 6 for June.

    The actual calculations are done on a daily basis in the program. Values of the monthly precipitation and potential evaporation are divided by the number of days in the month to give average daily values. The runoff or water surplus in each day is estimated as product of precipitation and the ratio of actual soil moisture level to the soil moisture capacity. The evaporation in each day is found as the product of the potential evaporation and the ratio of actual soil moisture level to the soil moisture capacity. A trial calculation is done to find the end of day storage and if this exceeds the soil moisture capacity, the excess soil moisture is added to the water surplus and the storage is reset to the soil moisture capacity before the next day's computations are done. This algorithm is limited by the fact that it assumes that a month's rain falls as a gentle mist instead of in concentrated daily amounts with zero rainfall in between. This simplification is offset by allowing a small amount of runoff or water surplus in each day, as occurs with a soil slowly draining to a stream. The algorithm used here can also be applied with daily data files when such data are available and then its daily results are more realistic.

    The climate data used are 12 mean monthly values. The computations are done for several years in sequence until the computed soil moisture levels in each month stabilize to constant values independent of the year they were computed in. These values then represent expected monthly soil moisture levels on average over a number of years.

    Plotting a Chart of the Results

    A script has been written which makes it easy to create the Charts of the precipitation, potential evaporation, soil moisture, evaporation, and surplus at selected points. To plot these charts, click on the and then click on a cell where the soil water balance has been computed. You should see 5 column charts pop up. WARNING: This plotting script currently has the names of the dBase files to plot hard wired into the code. Therefore, the plotting program will only work if you have tables with the default file names: prec_tr.txt, pevall.txt, evapmor.dbf, stmor.dbf, surpmor.dbf.

    O.K. That's all for now. Have Fun!!


    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.