Jordan Furnans*, Francisco Olivera**

Watershed Topology - The Pfafstetter System

River basin planners often need to understand the topological relationships between a basin of interest and other local basins. These topological relationships are inherent in the Pfafstetter system for watershed classification, developed by Otto Pfafstetter in 1989. Based on this numbering system, it is possible to identify the watershed immediately downstream of each watershed in a database. This information is then used in an area-to-area navigation program that automatically identifies all of the watersheds upstream and downstream of a given watershed. This program may be modified to run on any type of database structure, and it does not require either a hydro network or the ArcGIS tracing functionality. An example application is shown with the HYDRO1K watershed data of the U.S. Geological Survey’s EROS Data Center.


Introduction

Watershed managers often need to understand how engineering applications in one watershed might affect the water usage in another watershed. This implies knowledge of the topological relationships between watersheds, i.e. knowing which watersheds receive flow from or drain to a given watershed. Such knowledge is obtainable with the ArcGIS network analysis tool. With this tool, it is possible to trace upstream and downstream along a stream network, with the trace originating from any junction on the network. However, to identify the actual watersheds upstream of a given junction, one must select the watersheds that encompass the stream segments identified in the network trace. A new technique, area-to-area navigation, makes use of the watershed topology implied in the Pfafstetter coding system in order to identify directly upstream and downstream watersheds. This technique, which has been incorporated into a suite of Visual Basic programs, is modifiable for use with all COM compatible database software, including but not limited to ArcGIS. With the area-to-area navigation technique, the data user has greater flexibility in the modeling software available for use.

The Pfafstetter System for Watershed Identification

The Pfafstetter Coding system, developed by Otto Pfafstetter in 1989, is a methodology for assigning watershed IDs based on the topology of the land surface (Pfafstetter, 1989; Verdin, 1997, Verdin and Verdin, 1999). The system is hierarchal, and watersheds are delineated from junctions on a river network. Level 1 watersheds correspond to continental scale watersheds. Higher levels (levels 2, 3, 4, etc.) represent ever-finer tessellations of the land surface into smaller watersheds, which are sub-watersheds of lower level watersheds. Each watershed is assigned a specific Pfafstetter Code based on its location within the overall drainage system and on the total drainage area upstream of the watershed’s outlet.

According to the Pfafstetter system, watersheds are divided into 3 types - basins, interbasins, and internal basins. A Pfafstetter basin is an area that does not receive drainage from any other drainage area; a basin contains the headwater of the river reach for which the watershed is defined. Conversely, a Pfafstetter interbasin is a watershed that receives flow from upstream watersheds. Finally, an internal basin is a drainage area that does not contribute flow to another watershed or to a waterbody (such as an ocean or lake). The assignment of IDs is irrespective of level, and is carried out with the following basic steps:

Pfafstetter Coding Methodology
Figure 1 - Pfafstetter Levels 1, 2, and 3 - Individual watersheds are numbered in an upstream direction

These assigned codes are then appended on to the end of the Pfafstetter code of the next lowest level. For example, in assigning level 3 codes, each level 2 watershed is divided into at most ten sub-watersheds, and these sub-watersheds all have the level 2 code XY. The level 3 codes of these sub-watersheds become XY0, XY1, XY2, etc.

Determining the Downstream Watershed with the Pfafstetter System

The strength of the Pfafstetter system of watershed identification is that the system assigns IDs based on topology. It is therefore possible to determine watersheds that are upstream and downstream of a given watershed based solely on tabular data that includes the Pfafstetter code. For example, interbasin 843 is immediately downstream of interbasin 845, and drains to interbasin 841. Basin 846 is upstream of interbasin 845, but it does not have an upstream watershed (it contains the tributary headwater). A Visual Basic computer program has been developed that automatically determines the Pfafstetter code of the watershed immediately downstream of each drainage area in a dataset attributed according to the Pfafstetter system. This program, named the Downstream Element Identifier, reads information from the .dbf file of an ArcView shapefile, determines the downstream watershed ID for each watershed, and then writes this data back into the .dbf file. The program can be made as a stand-alone application, or it can be made to work in conjunction with COM complaint database-related software such as ArcGIS.

The Downstream Element Identifier program assigns to each watershed in the database the Pfafstetter code of the watershed immediately downstream. This code is stored as the "Downstream" attribute of each watershed in the database. The program works in part by identifying those watersheds that do not have any downstream neighbors. Such watersheds are divided into three categories, namely the internal basins, watersheds that drain directly to the ocean, and watersheds that drain to features that are not included in the database. This last category is important if the Downstream Element Identifier program is applied to a subset of Pfafstetter attributed data. The identification of these categories of watersheds is a fairly complex process, and is described fully in Furnans et al. (2001). For the purposes of this discussion it is sufficient to know that the determinations are made based on the characteristics of each digit in the watershed Pfafstetter code. For the majority of watersheds in a dataset, downstream watersheds do exist, and the downstream watershed identification process is dependent mainly upon the last or second to last digit of the Pfafstetter code.

In reviewing Figure 1, it can be seen that the watershed downstream of a Pfafstetter basin (even code) is the Pfafstetter interbasin with the code one less than its own. For example, basin 846 drains into interbasin 845, and basin 84 drains into interbasin 83. It is also apparent that interbasins (odd codes) drain to interbasins with the code two less than their own. Note that interbasin 845 drains into interbasin 843, and interbasin 85 drains to interbasin 83. This suggests the rule-of-thumb that if the watershed drains to another watershed, then the downstream watershed will be the interbasin with the highest Pfafstetter code less than the code of the watershed in question. A complication arises when considering watersheds with codes ending in "1." According to the above rule, interbasin 861 should drain into interbasin 859. This is true. However, interbasin 871 does not drain into interbasin 869, as predicted by the rule. In considering watersheds with codes ending in "1," it is necessary to focus on the penultimate digit in the Pfafstetter code. This digit refers to the second highest Pfafstetter level.


Figure 2 - Downstream Watershed determination when codes end in "1" - A) Level 2 scale, interbasin 87 and basin 86 drain to interbasin 85, B) At the Level 3 scale, interbasins 871 and 861 drain to interbasin 859.

As shown in Figure 2, at the level 2 scale, interbasin 87 drains as expected into interbasin 85. At the level 3 scale, each of the level 2 watersheds has been sub-divided into 9 new sub-watersheds. The most downstream new sub-watershed in the level 2 "87" interbasin is interbasin 871. This interbasin receives flow from all of the sub-watersheds of the level 2 "87" interbasin. It must therefore drain into the watershed downstream of interbasin 87, namely interbasin 85. Yet at the level 3 scale, interbasin 85 also has been divided into 9 sub-watersheds, with the most upstream watershed being interbasin 859. Therefore interbasin 859 must be directly downstream of interbasin 871. The Downstream Element Identifier program applies this logic when determining the watershed downstream of a watershed with a code ending in "1."

Area-to-Area Navigation - Data Requirements

In order to navigate from watershed to watershed based on topography, it is necessary to know which watersheds are immediately upstream and downstream of each watershed in a database. Downstream watersheds are determined directly from processing the Pfafstetter ID codes, as described above. Because Pfafstetter watersheds are delineated from junctions, only one watershed may be immediately downstream of another watershed. However, it is possible to have multiple watersheds immediately upstream of a given watershed. While it is possible to determine upstream watersheds based entirely on the Pfafstetter codes, this is not necessary as long as the downstream watersheds are known for the entire set of watersheds in the database.


Figure 3 - Upstream-Downstream Relations: X is downstream of Y, so Y must be upstream of X

If area X is immediately downstream of area Y, then area Y is obviously immediately upstream of area X. If the area immediately downstream of every individual area in the database is known, then by this process of inflection it is possible to determine the areas upstream of all areas in the database. For example, if a user is interested in determining the areas immediately upstream of area XYZ, the user may simply determine those areas whose downstream area is XYZ. A second Visual Basic program, the Upstream Element Identifier, employs this technique to determine the upstream watersheds for watershed datasets with downstream watershed ID attributes.

Once a watershed database is attributed with both upstream watershed IDs and downstream watershed IDs, a third Visual Basic program is run to carry out the area-to-area navigation from a selected watershed. This program, named the Area-to-Area Navigator, first prompts the user for the ID of the watershed from which the upstream and downstream navigation is to begin. It then determines all of the watersheds downstream of this initial "target" watershed, and then determines the upstream watersheds. These determinations are made based on the initial "target" watershed’s upstream and downstream ID attributes. The downstream watershed receives an arbitrarily chosen "trace" attribute of "2" that signifies its position downstream of the initial "target" watershed. An upstream watershed receives a "trace" attribute of "3." (The initial "target" watershed has the "trace" attribute "1"). At this point, each watershed with a "trace" attribute is treated as a new "target" watershed, and the watersheds immediately upstream and downstream of it are given the "trace" attribute. This navigation process is described in Figure 4. For clarity purposes, only the downstream navigation process is shown.


Figure 4 - Downstream Navigation - A) Interbasin 5 is the initial target watershed, with interbasin 3 downstream. B) Interbasin 3 becomes the target watershed, interbasin 1 is downstream. C) There are not any watersheds downstream of interbasin 1, the navigation ends, and all previous downstream areas have the "2" "Trace" attribute.

The downstream navigation terminates when the target watershed does not have a downstream watershed. Similarly, the upstream navigation terminates when the target watersheds do not have any upstream watersheds. The final step is to assign all watersheds that were not upstream of, downstream of, or equal to the initial "target" watershed the "trace" attribute "0." These arbitrary attributes may be used to classify the watersheds when viewed in ArcView or ArcGIS.

Example Application for the Yangtze River Basin, China

The example application below was conducted on a subset of the HYDRO1K watershed data for Asia, as provided by the EROS Data Center. For this application, the above-mentioned Visual Basic programs are combined into a single set of Microsoft Excel Macros, named the "Pfafstetter Tools." This macro was saved as an Excel Add-in so that it might be used in various Excel applications.

Figure 5 shows the HYDRO1K streams and watersheds data for South East Asia in an ArcView 3.2 project. The watersheds are attributed with Level 4 Pfafstetter codes. The watersheds are stored in the watersheds.shp theme, and the streams are stored in the streams.shp theme. The streams shapefile is included below as a visual reference for the topology of the landscape. This file is not involved in the area-to-area navigation.


Figure 5 - HYDRO1K data for South East Asia

The initial target watershed for this demonstration will be interbasin 9479, which contains a stretch of the Yangtze River well upstream from the mouth. From this interbasin, it is possible to navigate to many upstream and downstream watersheds.


Figure 6 - Close up view of interbasin 9479. Note that interbasins 9481, 9491 are immediately upstream, and interbasin 9477 is immediately downstream. Arrows denote the direction of flow.

It is clear that basins 9491 and 9481 are immediately upstream of basin 9479, and that basin 9477 is immediately downstream of basin 9479. This information will be verified by the area-to-area navigation program. To run the program, the attribute table for the watersheds.shp file is opened in Microsoft Excel. This table, watersheds.dbf, is shown in Figure 7, which also shows the Pfafstetter Tools on the Excel menu.


Figure 7 - Watersheds.dbf open in Microsoft Excel. The Pfafstetter Tools are added as an Excel Add-In.

As shown, the attribute table for the watersheds.shp theme initial contains only 2 fields - "LEVEL4," which corresponds to the level 4 Pfafstetter watershed codes, and "COUNT," which is a field generated automatically by the ArcView program. Of the six Pfafstetter tools displayed on the figure, only the Downstream Element Identifier, Upstream Element Identifier, and Area-to-Area Navigation tools will be used in this demonstration.

The first step in conducting an area-to-area navigation is to run the Downstream Element Identifier. When initiating this program, the user is prompted to enter the Pfafstetter level for which the downstream determination is to be made. The program will work for any number of Pfafstetter levels, and is not limited in the number of watersheds included in the database. The only limitations on the database size are those set by Microsoft Excel, which can process up to 65,536 rows (therefore 65,535 possible watersheds). Upon completion, the program adds two columns to the database, and provides a summary of the determination results. The Downstream column contains the code of the downstream watershed for each watershed in the database, or it contains a negative code. A negative code signifies that the watershed in question drains to the ocean, is an internal basin, or is located on the study area boundary. The Comments column describes the results of the downstream determination and is useful for manually checking the accuracy of the determination. Also, this information is occasionally useful for display purposes in ArcView and ArcGIS.


Figure 8 – Downstream Determination Results

In this case, 1905 out of 1908 downstream determinations were successfully completed. The 2 basins to be checked are located along the study area border, and their drainage was indeterminate because they could drain to an interbasin that receives flow from 3 immediately upstream watersheds. The one unknown watershed is shown in row 9 of the Excel worksheet. This watershed is not really a watershed – it is the remnants of the watershed creation process used in developing the HYDRO1K dataset. It is simply ignored by the Pfafstetter Tools program.

The second step is to run the Upstream Element Identifier function from the Pfafstetter Tools menu.


Figure 9 - Upstream Identification Results

As shown in Figure 9, the typical situation is to have either two or zero upstream watersheds. However, in this database, there is a location where three rivers merge at the same location. This occurs where watersheds 8177, 8176, and 8174 all drain into basin 8173. For this reason, a third column is formed in the upstream function. This column only contains one entry, which lists interbasin 8177 as the third watershed draining to interbasin 8173. The function is capable of handling an infinite number of watersheds immediately upstream of any given watershed.

The final step is to perform the navigation using the Area-to-Area Navigator function in the Pfafstetter Tools menu. This program prompts the user to input the Pfafstetter code of the initial target watershed, and will perform the navigation only if the input value is a valid Pfafstetter code that exists in the database. For this example, the initial target watershed is interbasin 9479. Upon completion of the navigation, a message box appears, containing the number of basins both upstream and downstream of the selected basins. These basins are all identified in the column Trace9479 where the "9479" is the name of the basin selected as the trace source.


Figure 10 - Area-to-Area Navigation Results

To view the navigation results in ArcView, it is only necessary to save and close the Excel worksheet, and to delete and then re-add the watersheds theme to the project. Figures 11 and 12 show the watersheds attribute table and the ArcView display, respectively.


Figure 11 – Watersheds.shp Attribute Table, with the initial target area as well as the immediate upstream and downstream areas highlighted.


Figure 12 – Area-to-area navigation results in ArcView. The initial target area is in yellow.

The most downstream basin is basin 9410, which drains into the ocean through the long inlet from the Yellow Sea.

Conclusions & Future Work

Area-to-area navigation is the process of identifying topologically related watersheds. Based on the Pfafstetter system, it is possible to determine the watersheds upstream and downstream of a given watershed. This functionality is independent of the network analysis tools in the ArcGIS system, with which similar determinations could be made based on traces along a stream network. Area-to-area navigation is also platform independent it that the technique may be employed in any COM-compliant database software, including and not limited to ArcGIS and Microsoft Excel. This compatibility with Microsoft Excel will allow potential river basin modelers and planners implement well established Microsoft Excel hydrologic applications without the need for modifying these applications for use in the ArcGIS environment.

The next step in this work is the development of a tool that will assign Pfafstetter codes to watershed datasets. This is essential because it will give a user the ability to carry out the area-to-area navigation technique on any watershed dataset. The “assign codes” tool is currently under development and is described further in Furnans et. al. (2001). (Note that this tool is listed in the Pfafstetter Tools menu in Figure 7). Another step to be completed in this research is to integrate the established visual basic Pfafstetter Tools programs into an application directly executable in the ArcGIS environment. It is our goal to be able to click on a button in an ArcGIS menu and then to let ArcGIS carry out all of the area-to-area navigation steps.

References


*Corresponding author – jfurnans@mail.utexas.edu
Center For Research in Water Resources
The University of Texas at Austin
**Center For Research in Water Resources
The University of Texas at Austin