CRWR Online Report 99-4 Geospatial Data in Water Availability Modeling by Bradley Taylor Hudgens, MSE Graduate Research Assistant and David R. Maidment, PhD. Principal Investigator December 1999 CENTER FOR RESEARCH IN WATER RESOURCES Bureau of Engineering Research ? The University of Texas at Austin J.J. Pickle Research Campus ? Austin, TX 78712-4497 This document is available online via World Wide Web at http://www.ce.utexas.edu/centers/crwr/reports/online.html Copyright by Bradley Taylor Hudgens 1999 Small erections may be finished by their first architects; grand ones, true ones, ever leave the copestone to posterity. God keep me from ever completing anything. This whole book is but a draught ? nay, but the draught of a draught. Oh, Time, Strength, Cash, and Patience! Herman Melville, Moby Dick One was my belief that the water problem, crucial to all Texas, can be solved only when the people of Texas become conscious of their imperative needs and only if they become informed and aroused enough to act. Betty Dobkins, The Spanish Element in Texas Water Law You will finally solve a difficult problem that will mean much to you. anonymous fortune cookie, August 1999 v Acknowledgements The study presented in this thesis is funded by the Texas Natural Resource Conservation Commission. Their support is gratefully acknowledged. The author would also like to thank Dr. David Maidment and Dr. Francisco Olivera for lending their technical expertise in all aspects of the study. Finally, the author would like to thank the other members of the Center for Research in Water Resources for their generous support. December 3, 1999 vi Abstract Geospatial Data in Water Availability Modeling Bradley Taylor Hudgens, M.S.E. The University of Texas at Austin, 1999 Supervisor: David R. Maidment A method is presented for determining flow distribution parameters of drainage area, curve number, and mean annual precipitation from geospatial data sets. The parameters are used to distribute naturalized streamflows from gaged sites to ungaged sites in a water availability model. The method is illustrated by application to the Sulphur River basin in Northeast Texas. Two scales of digital elevation data, 1:250,000 and 1:24,000, are used to automatically delineate watersheds for selected points in the basin. A digital stream network is built by adding manually digitized tributaries from 1:24,000 scale topographic maps to an existing 1:100,000 scale stream coverage. The stream network is used to modify the digital elevation data to better reflect mapped hydrography. Watersheds defined by the 1:24,000 scale elevation data are observed to accurately reflect the land surface shown on a 1:24,000 scale topographic map. Curve number and precipitation parameters for these watersheds are extracted from existing geospatial data sources. vii Table of Contents List of Tables......................................................................................................xi List of Figures....................................................................................................xii Chapter 1: Introduction .......................................................................................1 1.1 Background ........................................................................................1 1.1.1 The Water Availability Modeling Project..................................1 1.1.2 WRAP Flow Distribution Parameters.........................................8 1.2 Research Objectives ...........................................................................13 1.3 Literature Reviewed ...........................................................................14 1.3.1 Building a Geospatial Database...............................................14 1.3.2 Determining Hydrological Parameters with GIS......................17 1.4 Case Study Area ...............................................................................21 1.5 Report Outline....................................................................................22 Chapter 2 : Data Description .............................................................................23 2.1 Map Projections..................................................................................23 2.2 WRAP Parameters GUI Overview......................................................27 2.3 Geospatial Database ...........................................................................33 2.3.1 Basin Boundary .......................................................................33 2.3.2 Digital Raster Graphics ...........................................................34 2.3.3 Digital Elevation Model ..........................................................39 2.3.4 EPA Reach Files, Version 3.0 .................................................44 2.3.5 USGS Centerlines ...................................................................48 2.3.6 Base Stream Network..............................................................49 2.3.7 USGS Gage Locations ............................................................52 2.3.8 Texas Water Rights Locations..................................................55 2.3.9 TNRCC Water Right Diversion Points.....................................57 viii 2.3.10 Curve Number Grid.........................................................58 2.3.11 Precipitation Grid.................................................................60 2.3.12 Water Quality Segments........................................................62 Chapter 3 : Methodology...................................................................................64 3.1 Project Management .........................................................................64 3.2 Building a Water Rights Location Review Database .........................67 3.3 Establishing the Model Control Point Locations ...............................67 3.4 Editing the Stream Network..............................................................71 3.4.1 Build a Single-Line Network....................................................73 3.4.2 Adding Streams .......................................................................79 3.4.3 Correcting Arc Topology .........................................................83 3.5 Hydrologic Modeling Using Digital Elevation Data..........................88 3.6 DEM Defined Stream Network.........................................................93 3.7 Input Model Control Points.............................................................100 3.8 Creating the Model Network Structure............................................103 3.9 Processing the Parameter Data Sets.................................................104 3.10 Reading the WRAP Input Parameters .............................................106 3.11 Quality Control of Drainage Areas..................................................107 Chapter 4 : Results and Discussion..................................................................114 4.1 Stream Network Construction.........................................................114 4.2 Flow Distribution Parameters..........................................................115 4.3 Preparing Parameters with 1:24,000 scale DEMs............................122 4.4 Comparison of Results Between Large and Small Scale DEMs.......124 4.5 Improved Quality Control of Drainage Areas....................................133 Chapter 5: Conclusions ...................................................................................136 Appendix A : Exercise 1 .................................................................................142 A.1 Exercise Table of Contents ..............................................................143 A.2 Introduction.....................................................................................143 ix A.3 Goals of the Exercise .......................................................................146 A.4 Geospatial River Basin Database .....................................................146 A.5 WRAP Parameters Interface ............................................................147 A.6 Exercise Study Area and Data..........................................................147 A.7 Methodology ...................................................................................149 A.7.1 Using DRGs.........................................................................149 A.7.2 Assembling the Control Points .............................................151 A.7.3 Building the Stream Network ...............................................153 A.7.4 Processing the DEM.............................................................160 A.7.4.1 Burning the DEM with the Vector Stream Network ..161 A.7.4.2 Fill, Flow Direction, and Flow Accumulation ...........162 A.7.5 Creating the DEM Stream Network......................................162 A.7.6 Attaching Control Points to the Stream Network ..................164 A.7.7 Creating Parameter Data Sets ...............................................165 A.7.8 Making the Control Point Network Diagram ........................166 A.7.9 Reading the Flow Distribution Parameters............................166 A.7.10 Defining the Incremental Watershed Boundaries ................167 A.7.11 Quality Control ..................................................................168 A.8 Results.............................................................................................173 A.9 Exercise References.........................................................................174 Appendix B : Exercise 2..................................................................................175 B.1 Exercise Table of Contents...............................................................176 B.2 Introduction .....................................................................................176 B.3 Goals of the Exercise .......................................................................179 B.4 Exercise Data...................................................................................179 B.5 Exercise Study Area.........................................................................180 B.6 Methodology....................................................................................182 B.6.1 Using RECORDS to Distribute Naturalized Streamflows .....182 B.6.2 Using WRAP-SIM ...............................................................189 x B.6.3 Formatting Output in TABLES.............................................194 B.7 Water Availability Planning.............................................................197 B.8 Exercise References.........................................................................200 Appendix C : Data Dictionary.........................................................................201 C.1 Data Compact Disc One...................................................................202 C.2 Data Compact Disc Two ..................................................................210 Appendix D : Code ..........................................................................................213 References .......................................................................................................273 Vita?????????????????????????????276 xi List of Tables Table 1.1 : Example of Records in the WP Input File ........................................10 Table 2.1 : Map Projection Parameters used in the WAM project......................25 Table 2.2 : WRAP Parameters Menu Description????????????28 Table 2.3 : WRAP Tools Menu Description??????????????.31 Table 2.4 : WRAP Parameters Toolbar????????????????32 Table 2.5 : Gage Data Spreadsheet....................................................................53 Table 3.1 : Example Attributes of Parameters Shapefile ..................................106 Table 3.2 : Analysis of USGS Gage Area Differences .....................................108 Table 3.3 : Attributes of Manually Delineated Watersheds ..............................113 Table 4.1 : Flow Distribution Parameters using 1:250,000 DEM?????..116 Table 4.2 : Comparison of Gage Drainage Areas.............................................123 Table 4.3 : Comparison of Flow Distribution Parameters????????..125 Table A.1 : Exercise Control Points.................................................................152 Table A.2 : Control Point Parameters ..............................................................174 Table B.1 : Water Rights in the Study Area.....................................................182 Table B.2 : WRAP-SIM Input File Record Codes ...........................................190 Table B.3 : Additional TABLES Records Descriptions ..................................196 Table D.1 : Index to Program Codes in Appendix D........................................214 xii List of Figures Figure 1.1 : The Water Availability Modeling System (TNRCC, 1999)...............7 Figure 1.2 : Primary and Secondary Control Points in the Sulphur Basin.............9 Figure 1.3 : The WRAP Model Components ....................................................10 Figure 1.4 : The Sulphur River Basin ................................................................21 Figure 2.1 : UTM Zones in Texas......................................................................26 Figure 2.2 : WRAP Parameters Menu................................................................27 Figure 2.3 : WRAP Tools Menu........................................................................30 Figure 2.4 : WRAP Parameters Toolbar ............................................................30 Figure 2.5 : ArcView Editing Tools...................................................................30 Figure 2.6 : Sulphur Basin Boundary Shapefile .................................................34 Figure 2.7 : Layout Showing Individual Quadrangles within the Basin..............35 Figure 2.8 : USGS Quadrangle Naming Convention..........................................36 Figure 2.9 : Multiple DRGs Viewed with "Addtopo" Script (J?nsd?ttir, 1999) ..39 Figure 2.10 : 1:250,000 Scale DEM of the Sulphur Basin..................................44 Figure 2.11 : Selected HUCs for RF3 Download...............................................45 Figure 2.12 : RF3 Shapefiles of Sulphur Basin ..................................................48 Figure 2.13 : RF3 Segments Selected by Reachtype Query................................50 Figure 2.14 : Base Stream Network...................................................................51 Figure 2.15 : Point Data Shapefiles in the Sulphur Basin...................................58 Figure 2.16 : Curve Number Grid of the Sulphur Basin .....................................60 Figure 2.17 : Mean Annual Precipitation Grid (in./yr.) of the Sulphur Basin......62 Figure 2.18 : Water Quality Segments and Boundaries......................................63 Figure 3.1 : Contractor Supplied Control Point Map???????????70 Figure 3.2 : Braided Channel (highlighted arcs are deleted)...............................75 Figure 3.3 : ?Big Slough? Channel (deleted) on Sulphur River..........................75 Figure 3.4 : Small braid (highlighted arc is deleted) ..........................................76 Figure 3.5 : Anastomosing Stream Channels (Bridge, 1993)..............................78 Figure 3.6 : Levee System (in Red) at Fork of North and South Sulphur Rivers.79 Figure 3.7 : Streams Added (highlighted) to the Base Network..........................80 Figure 3.8 : Over-estimated Drainage Area .......................................................81 Figure 3.9 : Under-estimated Drainage Area......................................................82 Figure 3.10 : Arc Definition ..............................................................................83 Figure 3.11 : Node Definition............................................................................84 Figure 3.12 : Disconnected Arcs Corrected with ?Vertex Editor? Tool..............85 Figure 3.13 : Interior Dangling Node at End of Added Arc (Highlighted)..........86 Figure 3.14 : Eight Direction Pour Point Model.................................................88 Figure 3.15 : Grid Showing Flow Direction, Flow Accumulation, and Stream Definition...................................................................................................89 Figure 3.16 : Conceptual View of the Stream Burning Process..........................90 xiii Figure 3.17 : Flow Direction Grid for Sulphur Basin.........................................92 Figure 3.18 : Flow Accumulation Grid for Sulphur Basin..................................92 Figure 3.19 : DEM Stream Network Overlaid on Vector Stream Network.........95 Figure 3.20 : Short-Circuiting of Mapped Stream Network by the DEM ...........97 Figure 3.21 : Stream Arc Connectivity????????????????.99 Figure 3.22 : Examples of Snapped Control Points..........................................101 Figure 3.23 : Sulphur Basin Network Diagram................................................103 Figure 3.24 Sulphur Basin Control Point Watersheds ......................................104 Figure 3.25 : Manually Digitized Drainage Area .............................................111 Figure 4.1 : CP 2260 and 2270 Watersheds Overlaid on Curve Number Grid...121 Figure 4.2 : CP 2260 and 2270 Watersheds Overlaid on DRG..........................121 Figure 4.3 : Short-Circuit of North Sulphur River by 1:250,000 DEM.............129 Figure 4.4 : 1:24,000 DEM Stream Network and Correct Drainage Areas .......130 Figure 4.5 : Absolute Drainage Area Differences ............................................131 Figure 4.6 : Relative Differences in Drainage Areas........................................132 Figure 4.7 : Absolute Curve Number Differences............................................132 Figure A.1 : WRAP Parameters Interface........................................................147 Figure A.2 : Exercise Study Area ....................................................................148 Figure A.3 : USGS Quadrangle Naming Convention.......................................150 Figure A.4 : ArcView Editing Tools................................................................155 Figure A.5 : WRAP Parameters Tools.............................................................155 Figure A.6 : Streams Added to the Base Network............................................157 Figure A.7 : Stream Network, Before Editing (above) and After (below).........159 Figure A.8: Conceptual View of the Stream Burning Process..........................161 Figure A.9 : Example of Short-Circuiting Effect .............................................170 Figure A.10 : Control Point Network and Watersheds .....................................173 Figure B.1 : WRAP Modeling Package ...........................................................177 Figure B.2 : Exercise Study Area ....................................................................181 Figure B.3 : RECORDS Run...........................................................................187 Figure B.4 : WRAP-SIM Run .........................................................................192 Figure B.5 : TABLES Run..............................................................................197 Figure B.6 : WRAP-SIM Run for Irving Scenario ...........................................198 Figure B.7 : TABLES Run for Irving Scenario................................................199 1 Chapter 1: Introduction 1.1 BACKGROUND 1.1.1 The Water Availability Modeling Project Water is a critical resource in the state of Texas. A worst case study prepared in 1984 by the Texas Water Development Board predicted a demand for the state in the year 2000 of 25.4 million acre-feet against an available supply, including both surface and ground waters, of 25.1 million acre-feet (TWDB, 1984). Of course, we have yet to meet this worst case scenario. The Texas Society of Professional Engineers, as far back as 1954, calculated that the average annual runoff in the state amounts to 53 million acre-feet (Dobkins, 1959). This supply figure does not include groundwater. So, in an average year, it appears that there would be plenty of water available to satisfy the demands of the state, even allowing for growth in future years. But providing an adequate water supply throughout the state is not as simple as just balancing total available water against demands. Not all runoff can be developed into water supply; in-stream requirements, for example, must still be met. Unrestricted use of groundwater will eventually deplete the resource and draw down the base flows of surface waters. Most importantly, in Texas the distribution of water is highly variable over both space and time. Average annual precipitation varies from 0 to 10 inches in the arid West, to over 50 inches in the East. The annual runoff for all streams in the state, while averaging 53 million 2 acre-feet, has historically varied over a range of 20 to 90 million acre-feet (Dobkins, 1959). To reconcile ever-increasing demands with an unpredictable supply, the surface waters of the state are managed under the Texas Water Code through a system of water rights. The state grants rights to the flow and use of surface waters through water permits. The Texas Natural Resource Conservation Commission (TNRCC) has the authority to manage water rights in the state. Groundwater is legally treated as the property of the landowner, and is not regulated in this manner. The present Texas Water Code is an administrative system of water law. There are three general doctrines recognized in water law: riparian, prior appropriation, and administrative. Dobkins explains these systems: The riparian system says that the man who owns the bank of the stream (ripa in Latin) is entitled to the use of the waters of the stream as an appurtenance to his land. The system of prior appropriation holds that the man who first put the water to a beneficial use, whether he owns the land along the stream or wherever he may use the water, acquires a right to the continued use of the water. ?First in time is first in right.? The administrative system provides for the issuing of permits for the use of water by some state agency. The riparian and appropriative systems have been the two great rivals; the administrative system has developed out of the two, especially the system of appropriation, in response to the changing needs of man and the governing uses of water (Dobkins, 1959). These approaches share a basic principle: that the running water in a stream is not attached to a property right; that is, the actual water belongs to the state, to be held in trust for the people. The state then grants water rights to the flow and use of the stream through one of the above systems. Water taken under a water right becomes real property, in the legal sense, as long as it is held and 3 used. Texas has evolved through each of these systems, retaining some of each doctrine as it went. The Republic of Texas formally adopted a riparian doctrine in 1840. By 1889, however, the State of Texas had begun the transition to a prior appropriations doctrine under the Irrigation Acts of 1889 and 1895. Even while the state completely transitioned to an appropriation system with the Burges- Glasscock Act of 1913, riparian rights from previous land grants, including grants of Spanish and Mexican origin, continued to be held legal. The 1913 act also created the Board of Water Engineers, which required a permit to be issued for any appropriation of water. The inherent problems of this dual system were exposed in the 1950s when the state experienced a severe drought. During this decade there was much confusion and contention over the diversion amounts claimed and authorized. Suddenly, large claims were made on riparian rights that had never been exercised before, and previously excessive amounts permitted in some appropriation rights now caused junior rights to be shorted. The present administrative system of water law in Texas arose out of this conflict. The Water Rights Adjudication Act, passed in 1967, phased out riparian rights, requiring them to show records of actual beneficial use over the previous five years. It empowered the Texas Water Commission (a predecessor to the TNRCC) to adjudicate among all claims on a given stream segment. This process has now been completed for most of the state, but is still underway along the upper Rio Grande. There are now two types of water rights in Texas: permits, issued by the TNRCC, and certificates of adjudication, rights derived from any 4 source that have been adjudicated out of the 1967 act. Presently, there are over 6,200 surface water rights in the state (Town, 1999). The text of a water permit, permit number 5,000 issued by the state to the city of Mart in 1986, is reproduced here as a reference (TNRCC, 1999). PERMIT TO APPROPRIATE STATE WATER APPLICATION NO. 5000 PERMIT NO. 5000 TYPE: ?11.121 & ?11.028 Permittee: City of Mart Address: P.O. Box 360 Mart, Texas 76664 Filed: September 3, 1985 Granted: January 21, 1986 County: McLennan Watercourse: Unnamed tributary Watershed: Brazos River Basin of Tradinghouse Creek, tributary of Tehuacana Creek, tributary of Brazos River WHEREAS, the Texas Water Commission finds that jurisdiction of this application is established and due notice thereof has been given in accordance with the Texas Water Code and the Rules of the Commission; NOW, THEREFORE, this permit to appropriate and use State water is issued to City of Mart, subject to the following terms and conditions: 1. IMPOUNDMENT Permittee is authorized to maintain an existing dam and reservoir (New Lake Mart) on an unnamed tributary of Tradinghouse Creek and impound therein not to exceed 1640 acre-feet of water. The dam is in the Tomas De La Vega Survey, Abstract No. 43, McLennan County about 12 miles east of Waco, Texas and Station 0+00 on the centerline of the dam is S 78? W, 7055 feet from the SE corner of the survey. 5 2. USE Permittee is authorized to use the impounded water for recreational purposes and to divert and use not to exceed 500 acre-feet of water per annum from the reservoir for municipal purposes. 3. DIVERSION Permittee is authorized to divert water from a point on the reservoir S 78?15? W, 7025 feet from the aforesaid survey corner at a maximum rate of 1.6 cfs (700 gpm). 4. SPECIAL CONDITIONS (a) The diversion, impoundment and use herein authorized from an unnamed tributary of Tradinghouse Creek, Brazos River Basin, for municipal purposes shall have a priority date of May 17, 1931 as to all authorized appropriations in the Brazos River Basin for purposes other than domestic or municipal. As to other authorized appropriations in the Brazos River Basin for domestic and municipal use, the diversion, impoundment and use herein authorized shall have a priority date of September 3, 1985, being the date this application was filed with the Texas Water Commission. (b) Whenever the Commission finds that permittee is impounding any water to which holders of superior and senior water rights are entitled, the permittee shall release water ordered by the Commission. This permit is issued subject to all superior and senior water rights in the Brazos River Basin. Permittee agrees to be bound by the terms, conditions and provisions contained herein and such agreement is a condition precedent to the granting of this permit. All other matters requested in the application which are not specifically granted by this permit are denied. This permit is issued subject to the Rules of the Texas Water Commission and to the right of continual supervision of State water resources exercised by the Commission. 6 TEXAS WATER COMMISSION /s/ Paul Hopkins DATE ISSUED: Paul Hopkins, Chairman January 31, 1986 /s/ Ralph Roming ATTEST: Ralph Roming, Commissioner /s/ Mary Ann Hefner /s/ John 0. Houchins Mary Ann Hefner, Chief Clerk John 0. Houchins, Commissioner Drought once again struck Texas in 1996 and, once again, ignited disputes over water rights. In August of 1996, TNRCC reported that stream flows throughout the state ranged from 11 to 50 percent of average historical values. (TNRCC, 1999) The Texas legislature recognized the need for improved water management in the state. Texas Senate Bill 1 was passed in 1997, directing, among other things, that TNRCC produce water availability models for 22 of the state?s 23 major river basins, the exception being the Rio Grande, which will be modeled separately. These water availability models will serve as decision support systems for water planners in the state and provide useful information to water users. TNRCC defines water availability models as ?computer programs that calculate the amount of water in a river basin using hydrologic principles and actual measurements taken at stream gages? (TNRCC, 1999). Water availability models have been used previously in the state on a limited basis. TNRCC describes the limitations of these earlier models: During the 1970s and 1980s, the predecessor agencies of the TNRCC developed water availability models for eight river basins. These models were basin-specific and are now considered obsolete. These older models 7 simply lack the design capacity to handle all the data inputs and calculations needed for full water resource management in the state of Texas (TNRCC, 1999). In response to the modeling requirement of Senate Bill 1, TNRCC initiated the Water Availability Modeling (WAM) System project. The proposed WAM system is illustrated in Figure 1.1 : Figure 1.1 : The Water Availability Modeling System (TNRCC, 1999) Several existing water availability models were evaluated by TNRCC, and the Texas A&M Water Rights Analysis Package (WRAP) was selected as the common model to be used in each river basin. As shown in Figure 1.1, Geographic Information Systems (GIS) tools are necessary for the system to link the database management system and the water availability model. The University of Texas at Austin Center for Research in Water Resources? (CRWR) Prepro system was selected to provide this component. 8 CRWR Prepro was originally developed as a GIS preprocessor to the Hydrologic Engineering Center?s (HEC) Hydrologic Modeling System (HMS) watershed model. GIS works with geospatial data, that is, data that has both a geographic spatial location and associated descriptive attributes. CRWR Prepro is built on the Environmental Systems Research Institute?s (ESRI) ArcInfo and ArcView GIS software packages. CRWR Prepro reads watershed data from geospatial data sets and prepares a basin file as input to the HMS model. The basic methods of hydrologic processing used in CRWR Prepro may be similarly applied in building input data sets for any watershed model. In this research, CRWR Prepro has been modified to serve the needs of the WAM system. 1.1.2 WRAP Flow Distribution Parameters TNRCC envisions the water availability modeling process in two phases (TNRCC, 1999). In phase one, monthly naturalized streamflows are developed at all sites which are to be simulated in the model. Naturalized streamflows, also known as unregulated flows, are the flows which would exist in a stream without the effects of man?s development. These are calculated by taking measured flows, typically from USGS stream gages, and adding or subtracting terms for water loss, gain, and storage, such as those available from historical records of reservoir storage and water diversions. Naturalized flows are initially calculated for the few points in a river basin that have historical records, such as stream gages. Flows from these locations may then be used to estimate naturalized flows at points with no historical records. This process is called flow distribution. Phase two of the water availability process is the simulation of the basin system to 9 perform water allocations among the water rights (water demands) based on the input sequences of naturalized streamflows (the water supply) for each point. In the WRAP model, points for which flows are to be input or allocated are called control points. For each control point, the user identifies the next downstream control point. In this way, the model establishes connectivity within the system. In the WAM project, control points for which naturalized flows have initially been calculated are called primary control points, while those to which naturalized flows are distributed are called secondary control points. Figure 1.2 shows the primary and secondary control points that are used in the WRAP model of the Sulphur river basin. Figure 1.2 : Primary and Secondary Control Points in the Sulphur Basin The WRAP modeling package is a set of FORTRAN programs : RECORDS, WRAP-SIM, and TABLES. Figure 1.3 shows these program blocks and the input and output files exchanged among them. 10 Figure 1.3 : The WRAP Model Components RECORDS is a preprocessor that is used to distribute flows from primary to secondary control points. WRAP-SIM is the actual water allocation model. TABLES is a postprocessor that organizes the WRAP-SIM output into summary tables. Input is made to, and output taken from, the model as field-formatted text files. The work done in this study prepares the hydrological parameters used in RECORDS to distribute flows. The parameters are input to the model in the WP records file. The contents of this file for one sub-watershed in the Sulphur basin are shown in Table 1.1. Control Point Area (sq. mi.) Curve Number Precipitation (in./yr.) A10 541.01 69.6 42.8 A20 1.66 71.5 44.0 A30 12.44 69.9 43.0 A40 504.58 69.4 42.7 A50 106.34 69.9 42.4 A60 223.33 69.7 42.2 A70 1.03 72.8 42.0 Table 1.1 : Example of Records in the WP Input File 11 There are several methods for performing flow distributions. Dr. Ralph Wurbs of Texas A&M University has made a study of these for the WAM project (Wurbs, 1998). The parameters derived in this study are produced specifically to support the NRCS Curve Number Method Adaptation of flow distribution. This method is based on the NRCS curve number (CN) relationship between rainfall depth, P in inches, and runoff depth, Q in inches, given in Equation 1.1. In this formula, S represents the total amount of water that can be abstracted by the watershed. Abstracted water is rainfall that is not transformed into runoff. For example, rainfall may be stored at the surface or infiltrate into the ground. For convenience, S is expressed as a dimensionless curve number, CN, ranging from 0 to 100. The curve number for a watershed is typically derived from a study of the land use and soil composition within the watershed. The curve number adaptation method of flow distribution works backwards from a known flow to give an average precipitation depth over a watershed. This precipitation depth is then distributed to another watershed, where the flow is determined by Equation 1.1. To account for long-term precipitation differences between two areas, the ratio of mean annual precipitation values for the two watersheds may be used to adjust the value of P that is distributed. This method is described in detail by Wurbs (1998): () )1.1(10 000,1 8.0 2.0 2 ?= + ? = CN Swhere SP SP Q 12 Step 1: The flow at the gage, in acre-feet/month is divided by the drainage area A gage and multiplied by a unit conversion factor to convert to an equivalent depth Q gage in inches. Step 2 : Q gage is input to the curve number equation [Equation 1.1] to obtain P gage in inches. An iterative method is required to solve [Equation 1.1] for P. This approximation is assumed to be applicable to the ungaged watershed as well as the gaged watershed. Base flow is being distributed along with storm runoff, all in the same proportion. Step 3 : If the long-term mean precipitation varies between the watershed and subwatershed, the precipitation depth may optionally be adjusted by multiplying P gage by the ratio of the long-term mean precipitation depth of the subwatershed to that of the watershed to obtain a P ungaged adjusted in proportion to mean precipitation. ]2.1[ ? ? ? ? ? ? ? ? = gage ungaged gageungaged M M PPadjusted where M ungaged and M gaged are the mean precipitation for the ungaged subwatershed and gaged watershed. Otherwise, P ungaged is assumed equal to P gage . Step 4 : P ungaged is input into [Equation 1.1] to obtain Q ungaged in inches. Q ungaged in inches is multiplied by A ungaged and a unit conversion factor to convert to flow in acre-feet/month. The magnitude of the drainage area values applied in steps one and four are the dominant factors in determining the amount of flow distributed. In many applications of flow distribution, in fact, flows have been distributed based only on the drainage area ratio, as shown in Equation 1.3. )3.1( ? ? ? ? ? ? ? ? = gaged ungaged gageungaged A A QQ 13 1.2 RESEARCH OBJECTIVES This research has three objectives: 1. Create a geospatial database for a river basin, 2. Extract the WRAP flow distribution parameters for each control point from the database, 3. Produce reliable digital watershed delineations. The construction of a geospatial database is the most time-consuming task in this study. While many of the procedures necessary to accomplish this task already existed prior to this research, some modifications have been made to these and new procedures have been developed. Both the ArcInfo and ArcView software packages are used throughout this project. One goal of this project has been to develop most of the necessary procedures in the more user-friendly ArcView environment. ArcInfo is still used primarily in creating the geospatial database, however. The most important parameter in performing flow distribution is that of drainage area. In this study, drainage areas are calculated from digital elevation data. While the basic method of delineating watersheds from digital elevation data is well-documented, measures of the reliability of this method are not. The only drainage area values available for comparison are those calculated by the USGS for stream gages. For other drainage areas in the project, the actual watershed boundaries must be examined. Digital topographic data, in the form of USGS Digital Raster Graphic (DRG) files, provides a means for comparing watershed boundaries defined from digital elevation data against the mapped 14 terrain. This comparison, however, will always be somewhat subjective, especially in flat areas where contour lines are widely spaced. This research will be considered a success if the first two goals, establishment of a database and WRAP input parameter processing for a river basin can be accomplished, documented, and reproduced; and if the third goal, producing reliable drainage areas, can be subjectively accepted as accomplished. 1.3 LITERATURE REVIEWED For each of the research objectives, the available literature has been reviewed to establish the current state of knowledge in these areas. 1.3.1 Building a Geospatial Database There is ample literature addressing the creation of geospatial databases for use with hydrological models. Research projects by Saunders (1996), Dartiguenave (1998), Quenzer (1998), and Jonsdottir (1999) have all required the development of databases containing several layers of geospatial data. Two key components in these databases are the digital elevation model (DEM) and a digital representation of the mapped stream network. All of the projects use a DEM as the basic spatial data source in defining the hydrography of the study basin. Studies in coastal areas, such as those by Saunders and Quenzer, have shown that in flat terrain the DEM hydrography may depart to a large extent from that shown by map products. Mapped stream networks can be used to condition a DEM to more accurately reflect the observed channel system. A method has been developed at CRWR to condition a DEM with a vector data set of observed streams (Olivera, 1998). In this methodology, 15 the spatial data set of the mapped stream network is an important component of the database. Horton (1945) first popularized the notion of a channel network. He introduced a pattern for describing dendritic networks, classifying the smallest unbranched tributaries as first order streams, and assigning subsequent streams a higher order below the junction of two streams of equal order. This concept has since been used frequently in geomorphological and hydrological studies of channel systems and drainage basins. Kirkby (1993) points out that channel networks have both a spatial expression, their planform view, and temporal expression, changing over time with physical and climatological processes. The spatial expression of channel networks has been defined by several methods. With any method, the most difficult task is to locate the first order tributaries. These are hardest to identify, being the most subject to temporal change. Bauer (1980) recommends four methods of channel location: the blue- line method, the contour-crenulation method, aerial-photograph interpretation, and field-inspection. The blue-line method considers all streams shown as blue lines on a map. Zavoianu (1985) points out two shortcomings to this method. Even a large-scale (1:24,000) map will omit true first-order tributaries, and the streams that are shown will depend on that particular snapshot of time when the aerial photography from which the map is drawn was taken. The contour- crenulation method locates streams from the configuration of topographic lines on contour maps. Bauer (1980) proposes the rule that a first-order tributary can be deduced from two or more consecutive contour angles of no greater than 120 16 degrees. The method of identifying streams from aerial photographs is similar to the blue-line method and also has the shortcoming of being a snapshot in time. Field-inspection would be the most accurate method of locating streams, but the time and labor cost is prohibitive for any studies but those of very small basins. These methods of defining a stream network are not exclusive, however, rather they can be used to complement one another (Zavoianu, 1985). Digital stream networks in GIS have most often been defined from digital elevation models. For smaller scale projects, triangulated irregular networks have also been used. In this method, any internal sinks in the elevation data are filled so that continuous overland flow is assumed from the each cell to the basin outlet. Streams are then defined at a threshold drainage value. The DEM algorithm produces a dendritic network with unique downstream flow paths. There is no divergence in downstream flows. Streams defined from a DEM are subject to the spatial resolution and accuracy of the sampled elevation data. The available digtial geospatial data sets of mapped stream networks are mostly derived from aerial photography. The EPA River Reach Files give a spatial representation of channel network hydrology for the entire United States. The most recent version, RF3, is detailed at a map scale of 1:100,000. A project is currently underway in Texas to build a spatial stream network data set at a uniform 1:24,000 map scale (Boghici, 1999). The recent availability of topographic maps and aerial photography in digital form at large map scales also raises the possibility of augmenting existing digital mapped stream networks of smaller scale by one or more of the methods suggested by Bauer. 17 1.3.2 Determining Hydrological Parameters with GIS Maidment (1991) describes three methods of linking GIS and hydrological models: using GIS to read hydrological parameters, developing hydrological model parameters within GIS, and imbedding hydrological models within GIS. The relationship between GIS and hydrological models has evolved from the first method to the third. The first method, hydrological parameter determination, simply uses GIS to read parameters from existing data sets. This is a straightforward application of a GIS system to extract spatial data. In the second method, hydrological parameters are developed from basic data sets. In other words, basic spatial data sets are processed within the GIS according to programmed assumptions and algorithms. CRWR Prepro may be classified under the second method. The GIS interface developed in this research also falls into this category. This use of GIS is relatively well established. Addressing this type of GIS-model linkage, Grayson, et. al. (1993) make the point that GIS is ?hydrologically neutral? to the models. The GIS itself cannot generate hydrological information. GIS can only process the measured information provided in spatial data sets. It is tempting to try to ?generate? new data through the interpolation and geographic manipulation features provided by GIS. The information content of interpolated information is only increased, however, if underlying physical relationships are present and are defined. Research into coupling GIS and hydrological models often focuses on developing the functionality in GIS to calculate parameters and not on the applicability of the results. It is the GIS modeler?s responsibility to make sure 18 that output parameters are honestly described in terms of their source accuracy. Clark (1993) asserts that modelers are far less demanding of error assessment in GIS applications than would otherwise be the case. This may be due in part to what Clark describes as the ?seductivity? of GIS display capabilities. Clark defines six measures by which the quality of source data may be judged : accuracy, precision, reliability, data documentation, information flow, and data version management. Accuracy specifies the extent to which recorded attributes faithfully represent the variable that is of interest?Precision indicates the resolution (potential and achieved) of the measurement process, and is affected by instrument characteristics, operator characteristics and spatial temporal sampling characteristics?Reliability?focuses on objectivity, since it is generally (but not necessarily correctly) assumed that an objective measure is more reliable than a subjective measure?Full reliability requires documentation of instrumentation, sampling design, and operator/observer characteristics? Data documentation determines the extent to which it is possible to identify data quality subsequent to the time of observation?Information flow? may introduce rounding, classification or generalization errors, some of which may be significant?Data version management [is necessary to avoid] the concurrent use of different data versions (Clark, 1993). Grayson, et.al. (1993) point out a problem in combining GIS data and hydrological models based on scale. In this case, they are referring to the application of hydrological models derived from laboratory and research area catchments to studies with spatial data for regional areas. The curve number model used to distribute flows in this project is assumed to be applicable in this regard. In this study, however, the parameters (drainage area, curve number, and mean annual precipitation) are calculated from data sets produced at one map scale and applied to catchments of several scales. Drainage areas in this case 19 study (and typically in the other river basins) range from 0.01 mi 2 to 3500 mi 2 . The drainage areas are defined at a map scale of 1:24,000. The curve number and precipitation parameters, however, are taken from source data sets defined at smaller map scales. In the terrain data used to delineate the drainage areas, elevation values are defined approximately every 30 meters. The curve number values are calculated from USGS Land Use and Land Cover (LULC) and State Soil Geographic Database (STATSGO) soil data sets that sample data attributes approximately every 90 meters. The precipitation data has values every 250 meters, but the precipitation coverage is not meant to be accurate for point estimates. The precipitation data is generated from interpolating widely spaced rain gage data based on a regression model developed at Oregon State University. The metadata for the original precipitation grid states that while ?point precipitation can be estimated at a spatial precision no better than 2km?, ?the overall distribution of precipitation features is thought to be accurate? (Daly, 1998). Some of the drainage areas defined in this study easily fit inside one cell of the original precipitation grid. No studies were found evaluating GIS processed precipitation parameters, but one previous study by Bondelid, et. al. (1981) did compare curve numbers calculated from 1:250,000 scale USGS LULC data and 1:250,000 scale LANDSAT imagery with curve numbers calculated from locally available 1:24,000 scale map products for the same watersheds. This study looked at three basins with a total of 53 sub-watersheds ranging from 0.16 mi. 2 to 6.5 mi. 2 in area. For each sub-watershed, the authors compared the curve numbers prepared from a 20 conventional method (using aerial photography and detailed soil surveys), with those prepared from analysis of 1:250,000 USGS digital land cover maps. The 1:250,000 scale source data was resampled to a 1:24,000 scale. The resulting curve number values from the USGS land cover and LANDSAT sources were found to generally agree well with the conventionally derived curve numbers. The authors note, however, that ?significant loss in precision occurs in heterogeneous [curve number] regions with small sub-areas? (Bondelid, et.al, 1981). This caution is supported by a NRCS description of the STATSGO soils data, which states that ?the level of mapping is designed to be used for broad planning and management uses covering state, regional, and multi-state areas? (USDA, 1999). Previous projects have relied on the use of 1:250,000 DEMs to delineate watersheds. No previous studies were found, however, that judge the accuracy of this data source in defining small sub-watersheds. The widespread availability of 1:24,000 DEMs is relatively recent. No studies were found evaluating drainage areas produced from this data source. One general rule can be stated from the previous work; that an Albers map projection is used to preserve correct area when delineating watersheds. 21 1.4 CASE STUDY AREA The Sulphur River, shown here in Figure 1.4, is a tributary of the Red River located in Northeast Texas. The basin was selected as the first to be modeled under the WAM project. It has the advantage of being relatively small in physical area, approximately 3,600 mi. 2 , and having relatively few WRAP model components, 82 control points. The Sulphur basin is, as yet, the only basin model to be completed under the WAM program. It is used throughout this thesis as a case study in developing the geospatial database and processing the flow distribution parameters for a river basin. While this work was underway, several other river basins have been modeled, and the procedures have been updated from those originally used in developing the Sulphur basin data. The methodology presented in this report is the most current. Figure 1.4 : The Sulphur River Basin 22 1.5 REPORT OUTLINE This project marks the first time that geospatial data has been used to provide input parameters for flow distribution in a water availability model. A unique method of digital stream definition is presented, modifying digital elevation source data with digital representations of mapped stream networks. This thesis is divided into five chapters and four appendices. Chapter two describes the development of the geospatial database used in the project, the first research objective. Chapter three details the methodology used in preparing the flow distribution input parameters, the second research objective. Chapter four discusses the results obtained from the case study in the Sulphur River Basin. The third research objective, accuracy of drainage areas, is discussed in this chapter. Chapter five presents the conclusions drawn from this work and provides direction for future work. Appendices A and B are applied exercises based on a sub-watershed of the Sulphur Basin. Appendix A is an exercise in applying the methodology presented in Chapter three to develop flow distribution parameters for control points in the exercise area. Appendix B applies the WRAP model to prepared input data for the exercise control points. Two compact discs containing all of the data referenced in this work are enclosed with this thesis. Appendix C provides a data dictionary of the geospatial coverages provided on each of these CDs. Appendix D contains the programming code used in the work : the individual ArcView Avenue scripts which together make up the WRAP Parameters GIS interface, and the ArcInfo macros used in building some of the data sets. 23 Chapter 2 : Data Description 2.1 MAP PROJECTIONS Map projections transform a point on the earth?s surface, referenced with geographic coordinates of latitude and longitude (?,?), into a point on a map, referenced with planar coordinates (x, y). Geographic coordinates depend on the reference shape (sphere or ellipsoid) that is used to simulate the earth. Common reference shapes are called earth datums. Map projections and datums must be clearly understood when working with geospatial data. While ArcView will display any given set of shapefiles, they will not be uniformly spatially referenced unless the datum and projection of each are the same. ArcInfo allows users to transform coverages from one datum and projection to another. Locations and areas on the earth?s surface define geometric properties of shape, area, distance, and direction. The process of projecting these locations and areas from the earth?s surface onto a planar map will distort one or more of these properties. Certain map projections preserve some of these properties while distorting others. A conformal projection preserves local shape, while distorting area. An equal-area projection preserves area, while distorting shape, direction, and distance. Three specific map projections are used in this research : Albers Equal-Area, Lambert Conformal Conic, and Universal Transverse Mercator (UTM). Maidment (1998) gives a thorough description of these map projections. The actual parameters for each of the projections used in this project are given in Table 2.1. 24 Maps must also have a coordinate system describing the origin and map units of the planar coordinates. Agencies in Texas use a common map projection and coordinate system, the Texas State Mapping System (TSMS). The TSMS is a Lambert projection. The WAM project requires that all of the final ArcView shapefiles developed for the project be provided in a TSMS Lambert projection for standardization with other Texas map products. For hydrologic modeling, however, an Albers projection is frequently used, due to its property of preserving true area. In rainfall-runoff modeling, drainage area is often the most important parameter in determining volumes. Therefore, most of the shapefiles used in this project are initially created in an Albers projection of the TSMS, called TSMS Albers. Finally, the UTM system is used in this project when working with Digital Raster Graphics (DRGs). These files are originally in a UTM projection, and the number of files along with their large file size makes projection into TSMS Albers a lengthy procedure. So far, it has proven more timely to project other shapefiles into UTM when working with the DRGs. Texas is spread across three different UTM zones, shown in Figure 2.1. 25 Parameters TSMS Albers TSMS Lambert UTM Projection Albers lambert utm Zone none none 13, 14, or 15 Datum NAD 83 NAD 83 NAD 27 Spheroid GRS 1980 GRS 1980 Clarke 1866 Units meters meters meters Parameters : Reference Latitutde 31 10 0.000 31 10 0.000 none Central Meridian -100 0 0.000 -100 0 0.000 none Standard Parallel 1 27 25 0.000 27 25 0.000 none Standard Parallel 2 34 55 0.000 34 55 0.000 none False Easting 1000000 1000000 none False Northing 1000000 1000000 none Table 2.1 : Map Projection Parameters used in the WAM project 26 Figure 2.1 : UTM Zones in Texas 27 2.2 WRAP PARAMETERS GUI OVERVIEW The WRAP Parameters interface is an ArcView version 3.1 project file, ?wrap1117.apr,? with a set of specialized Avenue scripts embedded in it. Hardcopy of each Avenue script is provided in Appendix D. These scripts have all been linked to a set of customized View menus, "WRAP Parameters" and "WRAP Tools," and a set of View tools. The menu items and tools are briefly introduced here. The use of each specific function is explained in more detail throughout Chapters two and three as the project procedures are discussed. The user can gain more familiarity with the interface by completing the exercise in Appendix A. Figure 2.2 : WRAP Parameters Menu 28 Description Script Wrap.dangle_menu Wrap.demStreams Wrap.streamSort Wrap.snapcp_menu Wrap.burn Wrap.filldem Wrap.fdr Wrap.fac Wrap.avgcn Menu Item For a selected stream network theme, returns a line theme where each polyline is the flow direction path from one headwater (dangling) node to the basin outlet For the active stream network theme, outputs all dangling nodes in the view extent, either as a new theme or as graphics Define DEM Stream Network Build Stream Network Connectivity For a correctly defined stream network line theme, assigns each arc an ID number and recognizes the ID number of the next downstream arc Snap Control Points to Network Snaps control point theme to stream network line theme (with connectivity). Display should be zoomed out well past the extent of the stream network Burn Stream Network Burns the DEM with the selected stream network Fill DEM Fills sinks in the burned DEM Make Flow Direction Grid Computes the flow direction grid Make Flow Accumulation Grid Computes the flow accumulation grid Make Average Curve Number Grid Computes the average curve number grid from the curve number and flow accumulation grids Show Dangling Nodes Table 2.2 : WRAP Parameters Menu Description 29 Menu Item Script Description Make Average Precipitation Grid Make Network Diagram Wrap.avgpcp Computes the average precipitation grid from the precipitation and flow accumulation grids Wrap.network For a control point theme snapped to a connected stream network theme, draws a polyline from each control point to the downstream control point Control Point Parameters Wrap.parameters For a control point theme, returns a duplicate theme with values for drainage area, curve number, and precipitation (read from the respective grids) Delineate Incremental Watersheds Wrap.watersheds Delineates the incremental watersheds for each control point, outputs as polygon theme Dissolve Dangling Polygons Wrap.dissolve Table 2.2 : WRAP Parameters Menu Description Apply to watershed polygon theme to dissolve small isolated polygons 30 Figure 2.3 : WRAP Tools Menu Figure 2.4 : WRAP Parameters Toolbar Figure 2.5 : ArcView Editing Tools 31 Menu Item Script Description Merge Themes Set Control Point Theme Names Wrap.mergethemes Merges selected themes of the same feature class. Only common attribute fields are retained. Wrap.setCP Sets the shapefile names used by the ?Add Control Point? and ?Add Snapped Control Point? tools Set DRG File Path Wrap.setDRG Sets the directory path used by ?wrap.addtopo? script to locate the DRG files Strip Fields Wrap.stripfields Deletes all but selected fields from an attribute table Average Grid by Polygons Wrap.avggrid- bypoly Averages cell values of a grid within the boundaries of a polygon theme. Adds the averaged values as a new field in the polygon attributes. Table 2.3 : WRAP Tools Menu Description Clip Grid by Polygon Wrap.clipgrid- bypoly Clips a grid with selected polygon(s). To clip the extent of the grid set the Analysis Extent to the extent of the selected polygons Resample Grid Wrap. resample Resamples cell size of selected grid. Add Lat/Longs Wrap.addLat- Longs Set Parameter Grid Theme Names Wrap.setGRid- Names Adds latitude and longitude coordinates (in decimal degrees) to a projected point coverage. Sets global variables identifying the parameter grids. 32 Tool Script Description Add Control Point Add Snapped Control Point Wrap.addcp_tool Adds a control point to the control point theme. ID must be an integer Wrap.snapcp_tool Snaps a user input control point to a selected arc in the stream network. Show Dangling Nodes Wrap.dangle_tool Shows the dangling nodes in the display extent of the active line theme Erase Interior Dangling Nodes Wrap.cleannet_tool Removes a dangling node formed by snapping the endpoint of one arc in the middle of another arc. The original arc is split at the endpoint. Table 2.4 : WRAP Parameters Toolbar Report Control Point Parameters Wrap.parameters_ tool Calculates control point parameters at a user-entered point 33 The standard ArcView editing tools highlighted in Figure 2.5 are also used throughout the project. Detailed explanations of these tools can be found in the ArcView help files and standard reference manuals. 2.3 GEOSPATIAL DATABASE The following sections of this chapter describe the basic geospatial data coverages created in building a river basin database. Several of these coverages are clipped from larger state or regional coverages. These state coverages are not described in detail, unless they were built specifically for the WAM project. Most of the data sets are built as ArcInfo coverages and then transformed into ArcView shapefiles. Most of the processing steps can be done in either the ArcInfo or ArcView environment. They are presented here as originally developed, using ArcInfo in most cases. Some conventions are used in detailing the procedures for each coverage. The software environment is indicated in italics followed by the command or action in bold print. Shapefile/coverage names are given in bold italics. Avenue scripts, Arc Macro Language (AML) codes, and GUI menu items and tools are referred to by their names in quotation. Throughout this thesis readers are assumed to have a basic familiarity with both ArcView and ArcInfo. 2.3.1 Basin Boundary A coverage of river basins in Texas, texbasalb, was obtained from TNRCC. The individual basin is taken from this coverage. 34 ArcView : In the View window, click on texbasalb theme, making it active ArcView : Using the Select tool, select the basin polygon ArcView : In View menu, ?Theme,? click on ?Convert to Shapefile? ArcView : Set the shapefile name to sulbasalb01.shp Figure 2.6 : Sulphur Basin Boundary Shapefile 2.3.2 Digital Raster Graphics DRGs are scanned USGS 1:24,000 scale topographic maps. They provide a useful base for editing hydrography data and a tool for communicating specific locations to other persons in the project. DRGs may be obtained from The Texas Natural Resources Information System (TNRIS) or from the USGS. DRGs are packaged on CD-ROMs, with each CD containing the quad sheets for a 1?x1? latitude by longitude box. 35 Initially a list is made of all the DRGs in the river basin. This is done by overlaying the basin boundary shapefile, sulbasalb01.shp, on a latitude/longitude coverage, onedegalb, and a quadrangle coverage, quadsalb. For easy reference, a layout may be made of this view. Figure 2.7 shows an example of this layout. The standard USGS naming convention for quadrangles is used in identifying DRG files. This convention is a concatenation of the longitude and latitude of the lower right corner of the 1?x1? box with an alphanumeric row and column identifier for the individual quad, and is illustrated in Figure 2.8. All DRG files in the basin are copied to a working directory. Figure 2.7 : Layout Showing Individual Quadrangles within the Basin 36 Figure 2.8 : USGS Quadrangle Naming Convention DRGs are originally in a UTM map projection. Projecting the DRGs can be a time and computer-memory intensive task. During the course of this work, times of twenty minutes to two hours have been observed for projecting individual DRGs. When working with DRGs it is usually more convenient to simply project the other shapefiles into UTM and work with them in that projection. In some cases, however, it may be desirable to project some or all of the DRGs. In the Sulphur basin, for example, 76 DRGs are required to cover the basin area. Six of these DRGs are in UTM zone 14, the remainder in UTM zone 15. Rather than work in two UTM projections (which may be simpler in very large basins, such as the Brazos) the six UTM zone 14 DRGs are projected to UTM zone 15. Projecting DRGs is a bit more complex than projecting coverages. Each image file is first converted to a grid. The grid is projected and converted back 37 into an image file. The specific commands for doing this are contained in the ArcInfo AML, ?reprodrg.txt.? in Appendix D. This AML can be applied to any set of DRGs by editing the image filenames in the AML text file. Arc : &run reprodrg.txt Since the DRGs remain in a UTM map projection, the basin boundary should be projected to UTM for reference. The user should make sure the correct UTM zone is contained in the projection file ?albtoutm.txt.? When converting the UTM basin coverage back to a shapefile, some extra steps must be taken. The version of ArcInfo used in this work, 7.2.1, will only allow coverages to be converted to shapefiles with a standard 8.3 character filename. ArcInfo 7.2.1 also requires field names to be unique within ten characters. These limitations are bypassed by making a copy of the UTM coverage with a shortened coverage name. ArcView may then be used to rename the resulting shapefile with the WAM standard filename. Arc : shapearc sulbasalb01 sulbasalb Arc : build sulbasalb Arc : project cover sulbasalb sulbasutm albtoutm.txt Arc : build sulbasutm Arc : copy sulbasutm sultmp Arc : arcshape sultmp poly sultmp Arc : kill sultmp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename sultmp.shp as sulbasutm01.shp Each DRG file contains the complete image of the map including the map collar. This is a hindrance when working with more than one DRG at a time as the map collars overlay the neighboring DRGs. The USGS has procedures available for completely removing the map collar from these files. This 38 information is available on-line at ftp://ftpmcmc.cr.usgs.gov/release/drg/clip. Due to the processing time required to remove the map collars from all the quads in a river basin, J?na Finnd?s J?nsd?ttir, a research assistant at CRWR, developed a procedure of simply displaying each file with the map collar masked. The shapefile texmesutm15.shp may be used to establish a hot link in ArcView between the quadrangle polygons and the individual DRG files. Upon establishing this link, each DRG can be automatically called up and masked simply by clicking on the desired quad in texmesutm15.shp with the ?Hot Link? tool. This is accomplished by the script, ?wrap.addtopo.? Figure 2.9 shows multiple DRGs added to a View window in ArcView using the "wrap.addtopo" script. The WRAP Tools menu item ?Set DRG File Path? is used to set the path to the directory containing the DRG files. This menu item executes the script ?wrap.setDRGpath? asking the user to enter the full path name for the directory containing any DRGs that are to be hot linked. The hot link properties of a theme are set in ArcView as follows : ArcView : In the View window, click on texmesutm15.shp, making it active ArcView : In View menu ?Theme,? click on ?Properties? ArcView : Click on the Hot Link icon ArcView : Set Field = ?Code,? Predefined Action = ?Link to User Script,? and Script = ?wrap.addtopo? 39 Figure 2.9 : Multiple DRGs Viewed with "Addtopo" Script (J?nsd?ttir, 1999) 2.3.3 Digital Elevation Model USGS Digital Elevation Models (DEM) are grid representations of cartographic elevation data made by taking point elevations at regularly spaced intervals. There are three scales of DEMs available : small (1:250,000), 40 intermediate (1:100,000), and large (1:24,000). When this project began, small scale DEM data was the only consistent source of elevation data available for the entire state of Texas. Since then, however, large scale DEMs have become available for the entire state through the National Elevation Database (NED) program. A small scale DEM was originally used in the processing of the Sulphur basin, and the procedure for producing small scale DEMs is discussed here. The use of large scale DEMs is discussed in Chapter 4. 1:250,000 DEM data is available for download from the USGS internet site at : http://edcwww.cr.usgs.gov/doc/edchome/ndcdb/ndcdb.html. The DEM data is available in 1?x1? tiles which are named from the corresponding standard U.S. 2?x1? 1:250,000 map sheets. While there are several options for downloading, the method used here is as follows. A layout of counties within the river basin is prepared, similar to the quad layout shown in Figure 2.7, using the texctyalb coverage and the sulbasalb01.shp shapefile. From the USGS web site, the option ?FTP via Graphics? is selected under the 1:250,000 DEM category. This brings up a map, where by zooming in on the desired region, a map overlaying the 1?x1? DEM tile borders on state counties is obtained. Using the layout of counties in the river basin as a guide, all necessary 1?x1? tiles are identified and downloaded. For the Sulphur basin, eight tiles are required : eldorado-w, texarkana-e, texarkana-w, sherman-e, dallas-e, tyler-w, tyler-e, and shreveport-w. The compressed files are downloaded to save time. These files are downloaded in gunzip (.gz) format, and may be extracted with the gunzip command in a Unix 41 environment, or simply extracted with WinZip. WinZip asks for the filename contained in the archive; it is just the filename minus the ?.gz? extension. Each DEM must first be coverted from an ASCII DEM file into an ArcInfo grid. Arc : demlattice sherman-e sherme Each grid is then converted from a floating point to an integer grid. This dramatically reduces the file size and the processing time required in subsequent steps. As a floating point grid, the Sulphur basin DEM requires 13.2 megabytes of storage space. Converting the DEM to an integer grid reduces this to 2.5 megabytes. The elevation data is initially stored as floating point values with units of meters. Simply converting this directly to an integer grid loses some of the elevation information contained in the decimal places of the floating point values. To maintain a greater degree of accuracy in the integer grids, the floating point grids are first multiplied by 100. The resulting integer grid has elevation units of centimeters. Arc : grid Grid : shermecm = 100 * sherme Grid : shermein = int (shermecm) The individual grids are then be merged. Grid : suldemgeo01 = merge (eldorwin, texarein, texarwin, shermein, dallaein, tylerwin, tylerein, shrevwin) Grid : quit All of the intermediate grid products are deleted with the ?kill all? command. For large basins, it may be helpful to execute these commands as an AML. 42 The merged grid, suldemgeo01, is then clipped to some extent beyond the basin boundary. This is necessary to ensure that watersheds defined from the DEM are based on the DEM data and not limited by the basin boundary shapefile (the actual source of the Texas river basins shapefile from TNRCC is not known, but it was likely derived from hand-delineated map products). Experience at CRWR has shown 10,000 meters to be a reasonable buffer width. The polygon of the basin boundary is first buffered by 10 km. The buffered coverage is then projected from the TSMS Albers projection to the geographic DEM projection. USGS 1:250,000 DEMs are initially in a geographic projection with the WGS72 datum and spheroid. The most accurate method of projecting coverages between WGS and NAD datums uses the NAD83 equivalent datum keyword, ?NAR_C? (ESRI, 1998). NAR_C is equivalent to NAD83, and the projection file of a coverage can be updated to show this using the ?projectdefine? command. 43 Arc : buffer sulbasalb sulbufalb # # 10000 # Arc : projectdefine cover sulbufalb Project : projection Albers Project : datum nar_c Project : spheroid GRS1980 Project : units meters Project : parameters 1 st standard parallel : 27 25 0.000 2 nd standard parallel : 34 55 0.000 central meridian : -100 0 0.000 latitude of projection?s origin : 31 10 0.000 false easting (meters) : 1000000 false northing (meters) : 1000000 Arc : project cover sulbufalb sulbufdem albtodem.txt Arc : build sulbufdem Arc : grid Grid : mapex sulbufdem Grid : setwindow sulbufdem Grid : tempdem1 = suldemgeo01 Grid : tempdem2 = selectpolygon(tempdem1, sulbufdem, inside) Grid : quit Finally, the resulting grid must be projected to TSMS Albers. The projected grid suldemalb will have its datum listed as "NAR_C." This can be changed to read "NAD83" using the "projectdefine? command as above. Arc : project grid tempdem2 suldemalb demtoalb.txt Arc : kill sulbufdem all Arc : kill suldemgeo01 all Arc : kill tempdem1 all Arc : kill tempdem2 all 44 Figure 2.10 : 1:250,000 Scale DEM of the Sulphur Basin 2.3.4 EPA Reach Files, Version 3.0 The United States Environmental Protection Agency?s (EPA) Reach Files, Version 3.0 (RF3) represents the most detailed hydrographic information uniformly available in the U.S. at present. RF3 was developed from the USGS 1:100,000 scale Digital Line Graph (DLG) hydrography data. An extensive database of stream segment attributes was added to the geographic stream locations. RF3 is available for download from the EPA?s Office of Science and 45 Technology BASINS project internet site at : http://www.epa.gov/OST/BASINS/download.htm. From this site, RF3 data may be downloaded for each 8 digit Hydrologic Unit Code (HUC8). The HUC8s comprising the river basin and its borders are identified by overlaying the river basin boundary shapefile, sulbasalb01.shp, onto a coverage of HUC8s in Texas, texhucalb, in a manner similar to the previous layouts, as shown in Figure 2.11. Figure 2.11 : Selected HUCs for RF3 Download 46 Twelve HUCs are needed to cover the Sulphur basin and surroundings : 11140101, 11140106, 11140201, 11140301, 11140302, 11140303, 11140304, 11140305, 11140306, 12010001, 12010003, and 12030106. For each HUC8, an executable (.exe) archive file is downloaded. Executing this file launches the WinZip Self Extractor which unzips the RF3 shapefile. Once the RF3 shapefiles are prepared for all HUC8s in the basin, they are merged using the WRAP Tools menu item, ?Merge Themes.? The RF3 shapefiles should be merged into two separate shapefiles : one shapefile containing all HUCs interior to the basin boundary, sulrfigeo01.shp, and one containing all the HUCs exterior to the basin, sulrfegeo01.shp. This separation of the RF3 stream segments is useful in the later project stages of stream editing and DEM hydrologic modeling. Both RF3 shapefiles of the basin are shown in Figure 2.12. The original BASINS RF3 data is in a geographic projection. Both shapefiles should be projected to the UTM coordinate system. When copying line coverages, some of the field names are duplicated and must be deleted before the coverage can be converted to a shapefile. These fields are deleted from the arc attribute table using the ?dropitem? command. 47 ArcView : In View menu ?WRAP Tools,? click on ?Merge Themes? ArcView : Select all exterior HUC themes ArcView : Set the shapefile name to sulrfegeo01.shp ArcView : In View menu ?WRAP Tools,? click on ?Merge Themes? ArcView : Select all interior HUC themes ArcView : Set the shapefile name to sulrfigeo01.shp Arc : shapearc sulrfegeo01 sulrfegeo01 Arc : shapearc sulrfigeo01 sulrfigeo01 Arc : project cover sulrfegeo01 sulrfeutm01 bastoutm.txt Arc : project cover sulrfigeo01 sulrfiutm01 bastoutm.txt Arc : kill sulrfegeo01 all Arc : kill sulrfigeo01 all Arc : build sulrfeutm01 line Arc : build sulrfiutm01 line Arc : copy sulrfeutm01 tmp1 Arc : copy sulrfiutm01 tmp2 Arc : dropitem tmp1.aat tmp1.aat Enter the 1 st item : fnode_ Enter the 2 nd item : tnode_ Enter the 3 rd item : lpoly_ Enter the 4 th item : rpoly_ Enter the 5 th item : end Arc : dropitem tmp2.aat tmp2.aat Enter the 1 st item : fnode_ Enter the 2 nd item : tnode_ Enter the 3 rd item : lpoly_ Enter the 4 th item : rpoly_ Enter the 5 th item : end Arc : arcshape tmp1 line tmp1 Arc : arcshape tmp2 line tmp2 Arc : kill tmp1 all Arc : kill tmp2 all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename tmp1.shp as sulrfeutm01.shp ArcView : Rename tmp2.shp as sulrfiutm01.shp 48 Figure 2.12 : RF3 Shapefiles of Sulphur Basin 2.3.5 USGS Centerlines As part of the forthcoming National Hydrography Dataset (NHD), the USGS has developed digitized coverages of centerlines through open water bodies. This coverage was obtained from the USGS for hydrologic regions 11 and 12. These two coverages were originally in a standard U.S. Albers projection. They were then projected into UTM zone 15 and merged, creating the coverage, texctlutm. The UTM projection is the most convenient for this data set as the centerlines are merged with the UTM RF3 shapefile. Texctlutm is clipped to the extent of the basin boundary and converted to a shapefile, sulctlutm01.shp. 49 Arc : clip texctlutm sulbasutm sulctlutm01 line Arc : copy sulctlutm01 temp Arc : arcshape temp line temp Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as sulctlutm01.shp 2.3.6 Base Stream Network In addition to the WAM Project, CRWR is also working with TNRCC on a TMDL project with similar needs. Out of these projects, a concept has developed of creating and working with digital stream networks in the river basins. Stream networks are defined here as a digital representation of the surface hydrography as a series of oriented reaches, such that each reach connects to only one downstream reach. This concept was inspired in part by NHD, which will contain this type of stream network along with the additional attributes of RF3. Due to the WAM project schedule, however, it was necessary to go ahead and build this stream network manually, rather than wait for the release of the finalized NHD. The base stream network is built from the sulrfiutm01.shp shapefile. RF3 contains a lot of detailed surface water features such as the shorelines of large open water bodies and small water bodies. These may be eliminated by querying the original RF3 shapefile to identify the true reaches. RF3 is extensively attributed. Documentation of RF3 attributes is available on-line from the EPA (EPA, 1996). One of these attributes, ?Reachtype,? describes the type of surface water feature with a single letter code. The desired reachtypes are : ?R? (river 50 reaches), ?S? (start reaches), and ?T? (terminal reaches). Figure 2.13 shows the result of this query on the Sulphur basin RF3 shapefile. ArcView : Click on sulrfiutm01.shp theme, making it active ArcView : Click on the Theme/Query tool ArcView : Query : ([Reachtype]=?R?) or ([Reachtype]=?S?) or ([Reachtype]=?T?) ArcView : Query : Click on ?New Set? ArcView : In View menu ?Theme,? click on ?Convert to Shapefile? ArcView : Set the shapefile name to sulstputm01.shp Figure 2.13 : RF3 Segments Selected by Reachtype Query The RF3 attributes are now extraneous and may be removed from the theme attribute table. This will make the shapefile smaller and easier to process subsequently. The WRAP Tools menu item "Strip Fields" will remove all but 51 selected fields from a shapefile. Only the "Shape" field and one other identifier field need be retained. The USGS centerline shapefile, sulctlutm01.shp, is merged with sulstputm01.shp. The centerlines will fill most gaps left by the deletion of the RF3 open water features. Endpoints of the merged centerlines and existing reaches do not exactly match. This discontinuity will be addressed in the stream editing discussion in Chapter three. ArcView : In View menu ?WRAP Tools,? click on ?Merge Themes? ArcView : Select the themes : sulstputm01.shp, sulctlutm01.shp ArcView : Set the resulting shapefile name to sulswvutm01.shp Figure 2.14 shows the base stream network produced for the Sulphur basin. Figure 2.14 : Base Stream Network 52 The exterior stream shapefile is also processed. The exterior streams are used to condition the DEM, but it is not necessary that they conform to the stream network definition. The open water features do not need to be removed. The RF3 attributes are removed with the "Strip Fields" menu item. The theme is then clipped to an extent slightly larger than that of the DEM. The buffered basin boundary, sulbufalb01.shp, is projected into UTM coordinates, and is buffered by a further 1,000 meters. Arc : shapearc sulbufalb01 sulbufalb01 Arc : project cover sulbufalb01 sulbufutm01 albtoutm.txt Arc : buffer sulbufutm01 sulbf2utm01 # # 1000 # Arc : build sulbf2utm01.shp Arc : clip sulrfeutm01 sulbf2utm01 sulswxutm01 line Arc : build sulswxutm01 line Arc : copy sulswxutm01 temp Arc : arcshape temp line temp Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as sulswxutm01.shp 2.3.7 USGS Gage Locations A point coverage of USGS gages in the basin is produced for later use as a guide in locating primary control points. The locations of all USGS gages in the state may be found on the state USGS internet site at http://txwww.cr.usgs.gov. Selecting ?Online Hydrologic Databases? and then ?Index of Gaging Stations by HUC? brings up a listing of all gaging stations in the state listed by HUC8. The location information of all gages in the basin is extracted from this listing. This information is first pasted from the web browser into a Word document, 53 ?gages.doc.? This is an example of the information extracted for one gage in the Sulphur River basin : STATION 07342465 SOUTH SULPHUR AT COMMERCE, TX Hunt County, Texas; Hydrologic Unit Code 111403 Latitude 33?12'42", Longitude 095?54'50"(MAP) Drainage area 150.0 square miles A spreadsheet is then created in MS Excel to transform the latitude and longitude coordinates into units of decimal degrees, as shown in Table 2.5. The following spreadsheet formulas are used to calculate decimal degrees : Table 2.5 : Gage Data Spreadsheet )2.3(3600/360/33)( )1.3(3600/360/33)( dcbddLat gfeddLong ++= ???= 54 The station ID and decimal degree latitude and longitude of each gage are then pasted into a new worksheet. This sheet is formatted to prepare an input file for the ArcInfo ?generate? command. The cells in each column are formatted as follows : station ID (number, 0 decimals), Long (number, 6 decimals), and Lat (number, 6 decimals). The word ?end? must be entered in the first cell of the row after the last gage entry. The worksheet is then saved as a comma delimited (.csv) file. The formatting of the file should be checked in a text editor. Make sure that the longitude values are listed first and have a negative sign (indicating a western longitude), delete the column headers, and delete any extra commas after the final ?end.? Save this file as a text file, ?gages.txt.? This text file is now properly formatted to generate a point coverage. Arc : generate gages Generate : input gages.txt Generate : points Generate : quit Arc : build gages points Arc : addxy gages Some further processing is necessary to properly format the station ID attribute field. When the point coverage is generated by ArcInfo it is only allowed, by default, an ID field that displays 4 digits. The full ID strings are still there, however, and may be copied into a new field that is set to display 8 digits. Arc : additem gages.pat gages.pat station 4 8 B Arc : arcplot Arcplot : calculate gages.pat info station = gages-id Arcplot : quit The coverage is then projected from a geographic projection to both the TSMS Albers and UTM projections. Although there is no documentation with 55 the original gage coordinates, it is assumed that they were derived from topographic maps using the older NAD27 datum and clarke1866 spheroid. Arc : project cover gages sulsglalb01 gagtoalb.txt Arc : project cover gages sulsglutm01 gagtoutm.txt Arc : copy sulsglalb01 tmp1 Arc : copy sulsglutm01 tmp2 Arc : arcshape tmp1 point tmp1 Arc : arcshape tmp2 point tmp2 Arc : kill tmp1 all Arc : kill tmp2 all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename tmp1.shp as sulsglalb01.shp ArcView : Rename tmp2.shp as sulsglutm01.shp Figure 2.15 in Section 2.3.9 shows the resulting gage shapefile along with the water right shapefiles for the basin. 2.3.8 Texas Water Rights Locations A database of Texas water rights was obtained from the technical coordinator of the WAM project, Parsons Engineering Science. This database was itself taken from the records of the TNRCC Surface Water Quantity Division. The database was originally received as an MSAccess database. The database is extensively attributed and contains it?s own data dictionary. Individual water rights have multiple records in the database. Unfortunately, water rights are not as simple as just defining one geographic point per right. Many water rights have several records in the same location and/or multiple records in different locations. Fortunately, it is TNRCC?s task to sort out this database. There are about 8,000 records in the database. A latitude/longitude coordinate is given for each record. A shapefile of these locations was produced 56 to aid TNRCC in locating the actual diversion and return flow points associated with each water right. These original database locations are just general locations for each water right and are not used further in this work. To build the shapefile it was necessary to assign each record a unique identification number. A field of unique values, ?Unique,? is present in the original database but it is incomplete, lacking values for about 300 of the records. The records missing a value in the Unique field were assigned values beginning with 10,000. This version of the Access database was then saved as a separate database file, ?uniques.dbf.? This file was used to create the point coverage, texwrdalb, of all the water right records, in the same manner as presented in Section 2.3.7 for the USGS gages. Texwrdalb is clipped with the basin boundary to extract only those records in the basin. The result, sulwrdalb01, is projected into UTM for later use by TNRCC. Figure 2.15 in Section 2.3.9 shows these water right record locations, along with the USGS gages and water right diversion points in the basin. Arc : clip texwrdalb sulbasalb01 sulwrdalb01 point Arc : project cover sulwrdalb01 sulwrdutm01 albtoutm.txt Arc : copy sulwrdalb01 tmp1 Arc : copy sulwrdutm01 tmp2 Arc : arcshape tmp1 point tmp1 Arc : arcshape tmp2 point tmp2 Arc : kill tmp1 all Arc : kill tmp2 all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename tmp1.shp as sulwrdalb01.shp ArcView : Rename tmp2.shp as sulwrdutm01.shp 57 The shapefile can be linked with the ?uniques.dbf? database file, establishing a true geospatial representation of the water right records. ArcView : In Project window, click on ?Tables? and ?Add? ArcView : Load the table ?uniques.dbf? ArcView : In table ?uniques.dbf,? select field ?Uniques? ArcView : In attribute table of sulwrdutm01.shp, select field ?Wrights-id? ArcView : In Table menu, ?Table,? click on ?Join? 2.3.9 TNRCC Water Right Diversion Points TNRCC provides a shapefile of points representing the actual diversion and return points of each water right, sulwruutm01.shp. In some cases, multiple shapefiles are provided by TNRCC. These may be merged into one shapefile using the WRAP Tools menu item, ?Merge Themes.? These shapefiles are typically provided by TNRCC in a UTM projection as they are developed using the DRGs. The complete shapefile is projected to TSMS Albers. Arc : shapearc sulwruutm01 sulwruutm01 Arc : project cover sulwruutm01 sulwrualb01 utmtoalb.txt Arc : copy sulwrualb01 tmp1 Arc : arcshape tmp1 point tmp1 Arc : kill tmp1 all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename tmp1.shp as sulwrualb01.shp 58 Figure 2.15 : Point Data Shapefiles in the Sulphur Basin 2.3.10 Curve Number Grid The curve number grid is taken from a 1:250,000 scale curve number grid for the U.S. prepared at the Blacklands Research Center in Temple, Texas. This grid was produced by combining the USDA/NRCS STATSGO soil coverage with the USGS LULC coverage, both originally 1:250,000 map scale products. A lookup table was used to translate the combinations of soil and land use into curve numbers using the 1972 SCS Engineering Hydrology Handbook as a reference. The result was then transformed into a grid with curve number values sampled at a 250 meter interval. The original grid was projected to TSMS Albers and 59 clipped to the extent of the Texas state boundary. A curve number grid for the basin, sulcngalb01 is clipped from this grid, texcngalb, to the extent of the buffered basin boundary. The cell size of the original grid is resized to match the cell size of the DEM. Arc : grid Grid : mapex sulbufalb01 Grid : setwindow sulbufalb01 Grid : tmpgrid1 = texcngalb Grid : tmpgrid2 = selectpolygon(tmpgrid1, sulbufalb01, inside) Grid : sulcngtmp01 = resample(tmpgrid2, 84.993) The original Blacklands curve number grid contains NODATA values in open water bodies. An assumption is made for this project that areas corresponding to open water bodies are better represented by a curve number of 100, indicating complete translation of rainfall to streamflow. The grid is changed to fit this assumption. Grid : sulcngalb01 = con (isnull(sulcngtmp01),100,sulcngtmp01) Grid : quit Arc : kill sulcngtmp01 all Arc : kill tmpgrid1 all Arc : kill tmpgrid2 all 60 Figure 2.16 : Curve Number Grid of the Sulphur Basin 2.3.11 Precipitation Grid The precipitation grid is taken from the USDA NRCS PRISM Climate Mapping Project. The PRISM (Parameter-elevation Regressions on Independent Slopes Model) model was developed to derive gridded estimates of climate parameters from point sources of data, considered in context with the terrain shown by a DEM. PRISM is an expert system that mimics the process a climatologist would use to map climate parameters. The model has been applied across the U.S., and the results have been reviewed and approved by the NRCS, a 61 panel of state climatologists, and independent experts. The grid of annual average precipitation used here was based on analysis of monthly precipitation data from 1961-1990. The original grid was downloaded from the PRISM internet site at http://www.ocs.orst.edu/prism/prism_new.html. The annual mean precipitation map of the Central US was downloaded. It was projected to TSMS Albers and clipped to the extent of the Texas state boundary. The basin map, sulpcpalb01 is clipped from this grid, texpcpalb, to the extent of the buffered basin boundary. The cell size of the original grid is resized to match the cell size of the DEM. Arc : grid Grid : mapex sulbufalb01 Grid : setwindow sulbufalb01 Grid : tmpgrid1 = texpcpalb Grid : tmpgrid2 = selectpolygon(tmpgrid1, sulbufalb01, inside) Grid : sulpcpalb01 = resample(tmpgrid2, 84.993) Grid : quit Arc : kill tmpgrid1 all Arc : kill tmpgrid2 all 62 Figure 2.17 : Mean Annual Precipitation Grid (in./yr.) of the Sulphur Basin 2.3.12 Water Quality Segments Coverages of TNRCC designated stream segments and segment boundaries were obtained from the TNRCC GIS base map internet site at http://www.tnrcc.state.tx.us/gis/base.html. These coverages were projected into the TSMS Albers projections and saved as texwqsalb and texwqbalb respectively. The coverages are clipped with the basin boundary producing a shapefile for each: sulwqsalb01.shp for the stream segments, and sulwqbalb01.shp for the segment boundaries. These shapefiles are not used further in this case study. For most 63 river basins, TNRCC asks that the segment boundaries be included as control points, for future use in considering water quality impacts. They were not included in the original Sulphur basin model, as it was the first study of the project. Figure 2.18 : Water Quality Segments and Boundaries 64 Chapter 3 : Methodology 3.1 PROJECT MANAGEMENT The WAM Project is a complex task requiring the efforts of several agencies and engineering firms. Each basin is modeled by one or more contractors. To prepare the WRAP input parameters, it is necessary to interact with both TNRCC and the engineering firm preparing the basin model. Several tasks are involved in creating the geospatial database. CRWR, TNRCC, and the basin contractor each have responsibility for one or more of these tasks. In order to streamline and schedule this effort, a standard basin procedure has been developed at CRWR (CRWR, 1999). In this procedure, all the required tasks are listed in outline form as shown below : 1) Preliminary Database Compilation (CRWR) a) A preliminary database is compiled consisting of : i) A basin boundary defined by TNRCC?s river basin coverage of Texas ii) A 1:250,000 scale Digital Elevation Model from the USGS iii) A single line river network fromed by taking the single line reaches of the EPA River Reach File 3 for the basin, merging them with separately developed centerlines for lakes and large rivers produced by the USGS iv) A coverage of water right permit locations supplied by TNRCC v) A complete map base of Digital Raster Graphic (DRG) versions of the 1:24,000 USGS topographic maps for the basin b) The compilation of the single line network is labor intensive because the network has to be manually edited to ensure that it has no gaps and in some areas new centerlines have to be digitized where comparison of the USGS centerlines and the DRG's shows that to be necessary. c) This database is stored on CD-ROM's for each basin, one copy of which is supplied to TNRCC. The large size of the files for the DRG's means that several CD's are usually needed (2 for the Guadalupe, 4 for the Nueces, for example). 65 2) Data Checking and Editing (TNRCC) a) The database produced in step (1) is checked by TNRCC, as follows: i) Check the location of each water right on the DRG against the paper copy of the location map in the water right permit file. Move to a new location if necessary ii) Digitize new points for locations of each point of diversion iii) Assign each location a unique identification number, based on the following scheme : BBTWWWWW.DDD, where (1) BB = basin number (01 to 23) (2) T = type of right (1 or 6) (3) WWWWW = water right number (e.g. 05467) (4) DDD = diversion point number (1 to 50, or 51=offchannel reservoir) iv) Digitize additional tributary streams from the DRG?s to connect water rights not presently on the river network to that network v) Supply shapefiles for the revised water right locations and stream segments to CRWR 3) Control Point Determination (WAM Contractor) a) The Water Availability Modeling Contractor for each basin determines the number of control points to be used. These control points are of two types: i) Known flow (primary) control points (e.g. stream gage locations) ii) Unknown flow (secondary) control points (water right locations and other locations of interest) b) The geospatial data produced by CRWR is used to apportion the flow at unknown flow control points on the basis of that at known flow control points. c) Based on their study of the basin, the contractor supplies to CRWR: i) A list of the stream gages and their locations to be used as known flow control points ii) A list of unknown flow control points which are also water right locations, in other words, those locations taken from TNRCC?s complete list of water right diversion points, which are actually going to used as control points in the WAM analysis for the basin iii) A list of additional control points (both known and unknown flow). For each point on this list, a copy of a paper map location is supplied so that the digital location of the control point can be verified. 66 4) Watershed Parameter Development (CRWR) a) CRWR develops the control point watersheds and parameters for the basin and provides this data to the contractor. CRWR provides a spreadsheet with the tabulated parameters, and ArcView shapefiles of the control point, stream network, and watershed themes used to develop the parameters. Specifically, the following parameters are supplied : i) Incremental watershed area ii) Total watershed area iii) Mean precipitation in the total watershed area iv) Mean curve number in the total watershed area v) ID of the next downstream control point vi) ID of the next downstream known flow (primary) control point 5) Basin Products (CRWR) a) CRWR produces a CD-ROM with the following products : i) GIS coverages of the basin in both TSMS and TSMS Albers map projections ii) Metadata for the basic GIS coverages iii) A basin-specific quality assurance report iv) Watershed parameters v) A set of ArcView procedures for the use and update of the database vi) Documentation for the use of the ArcView procedures b) This CD-ROM is distributed to TNRCC and the contractor. If the contractor would like training in the use of the ArcView procedures for the database use, CRWR supplies training on an informal basis. 6) TNRCC Approval (TNRCC). TNRCC reviews the final database. Upon TNRCCs approval, CRWR stops updating control points and watershed parameters in the basin. The rest of this chapter focuses on the methodology used to accomplish step four of this process, the watershed parameter development. Section 3.2 first briefly discusses steps one and two, and Section 3.3 discusses step three of the procedure. 67 3.2 BUILDING A WATER RIGHTS LOCATION REVIEW DATABASE The Water Rights Location Review Database is the preliminary database referred to in step one of the project management procedures. It is a tool designed to aid TNRCC staff in locating the diversion and return flow points associated with each water right permit. This work is described in step two, ?Data Checking and Editing,? of the project management procedures. By digitizing these points as they are identified, TNRCC can then easily provide them to CRWR and contractors for use in locating model control points. The following files are written to a CD-ROM : ? texmesutm15.shp ? sulbasutm01.shp ? sulrfiutm01.shp ? sulsglutm01.shp ? sulwrdutm01.shp ? uniques.dbf ? wrap.apr ? DRG TIFF image files Depending on the number of DRGs required to cover the basin, they may need to be split among several CDs. Each CD should include the basic shapefiles above. The DRG database is also used extensively in the stream network editing described in Section 3.5 and in the quality control process described in Section 3.12. 3.3 ESTABLISHING THE MODEL CONTROL POINT LOCATIONS Control points represent any location in the model where flows are simulated. Control points are used to represent primary, or known flow, and secondary, or unknown flow, control points. Primary control points are usually 68 stream gages, but may be any point where a record of naturalized streamflows is developed. Secondary control points typically represent water right diversion points, so that the reliability of the monthly flow to supply the diversion demand can be estimated. Control points may be inserted for a variety of other reasons. For example, they may be used at a point where return flows are made to a stream or to determine the regulated flow available in a water quality segment. The contractor who builds and operates the basin model ultimately decides where the control points will be located. CRWR provides some raw data useful in establishing control point locations: the basin stream gage shapefile, sulsglalb01.shp, and the water rights database shapefile, sulwrdalb01.shp. TNRCC develops a shapefile showing each diversion point for every water right in the basin, sulwruutm01.shp. Once the contractor has decided on the control points, these locations must be exactly reproduced as a GIS coverage in order to correctly determine the flow distribution parameters at each point. For control points that are part of the basic shapefiles already produced (stream gages and water right diversion points), translating the contractor?s choice of control points to a shapefile is easily done. The contractor just supplies CRWR with a list of which points to use. Points not in these original coverages can be more challenging. Contractors will develop primary control points at locations other than stream gages and they may have many other secondary control points. For example, a water right with several diversion points located very near each other may be modeled with a single secondary control point just downstream of all the diversion points. 69 Experience with the project so far has shown a topographic map to be the most unambiguous means of communicating control point locations. Simply providing a latitude/longitude coordinate for these points is often not clear enough. For a point on an isolated or major stream channel this may be fine. For points that are located near junctions or near multiple tributaries, however, even with a coordinate and descriptive information, the correct location of the point on the stream network may be confusing. A map sheet with the control point marked can be faxed or sent electronically. The point can then be correctly located in ArcView using the DRG files as a common reference. Figure 3.1 shows a map section supplied by the contractor locating two control points in the Sulphur basin. Control points are actually entered using the ?Add Control Point? tool. Before using this tool the name of the control point theme must be set using the WRAP Tools menu item ?Set Control Point Theme Names.? Control point identifiers must be integers, and may be up to twelve digits in length. Eighty-two control points were used in the WRAP model of the Sulphur basin. Six of these represented off-channel reservoirs for which the contractor chose not to use the GIS flow distribution parameters. Therefore, seventy-six control points were used in this study. The Sulphur Basin model was completed before the standard water right numbering system proposed in section 3.1 was developed. The contractor decided to split the basin into six sub-watersheds, labelled A to F, and number the control points within these sub-watersheds. The WRAP Parameters interface code requires that control point identifiers be entered 70 Figure 3.1 : Contractor Supplied Control Point Map 71 as integers The numbers 1 to 6 were used to represent the sub-watersheds, F to A, respectively. The sub-watershed number is then followed by the control point number. The control point ID 1010 in sulfcpalb01.shp, for example, is used for the model control point F10. 3.4 EDITING THE STREAM NETWORK The goal of the stream network editing is to produce a digital representation of mapped hydrography that will be used to define a channel network within the digital elevation model. In developing the stream network, an original coverage of digitized mapped hydrography, in this case RF3, is edited to fit the project definition of a stream network : oriented single-line reaches, each connecting to only one downstream reach. Digital topographic maps are then used as a reference to add features, such as smaller tributaries, to the stream network, and to resolve conflicts between the RF3 mapped hydrography and the single-line network representation. While RF3 is originally a 1:100,000 map scale product, it is observed to fit very closely with the DRG hydrography, which is at 1:24,000 scale. In this project, the vector stream network is used as a tool to modify the DEM to better reflect mapped hydrography. When editing the stream network, familiarity with defining streams from a DEM is helpful. The vector stream network is used to condition the DEM so that the raster streams defined from the DEM will correspond to the vector streams. As the stream network is being edited, some intuition as to how the DEM will reproduce the vector stream network will help in resolving some conflicts. Through the flow direction 72 algorithm, the DEM will define a gridded stream network equivalent to a single- line vector network, but at the map scale of the DEM data. In this work, a 1:100,000 scale vector stream network is edited with 1:24,000 scale hydrography A 1:250,000 scale DEM cannot exactly replicate features defined at these larger map scales. In places where multiple stream network arcs are located within a distance of the grid cell size of the DEM of each other, the raster stream will take only one path (one grid cell). In general, a coarse resolution DEM will partially negate the details of finer resolution vector stream networks. Hydrologic modeling with DEMs is discussed in more detail in Section 3.6. Once all edits have been made to the working versions of the stream networks, they should be saved as final versions, sulsfvutm01.shp for the interior and sulsfxutm01.shp for the exterior. These shapefiles are projected to the TSMS Albers system. Arc : shapearc sulsfvutm01 sulsfvutm01 Arc : shapearc sulsfxutm01 sulsfxutm01 Arc : project cover sulsfvutm01 sulsfvalb01 utmtoalb.txt Arc : project cover sulsfxutm01 sulsfxalb01 utmtoalb.txt Arc : build sulsfvalb01 line Arc : build sulsfxalb01 line Arc : copy sulsfvalb01 tmp1 Arc : copy sulsfxalb01 tmp2 Arc : dropitem tmp1.aat tmp1.aat Enter the 1 st item : fnode_ Enter the 2 nd item : tnode_ Enter the 3 rd item : lpoly_ Enter the 4 th item : rpoly_ Enter the 5 th item : end Arc : dropitem tmp2.aat tmp2.aat Enter the 1 st item : fnode_ Enter the 2 nd item : tnode_ 73 Enter the 3 rd item : lpoly_ Enter the 4 th item : rpoly_ Enter the 5 th item : end Arc : arcshape tmp1 line tmp1 Arc : arcshape tmp2 line tmp2 Arc : kill tmp1 all Arc : kill tmp2 all ArcView : In View menu, ?File,? click on ?Manage Data Sources? ArcView : Rename tmp1.shp as sulsfvalb01.shp ArcView : Rename tmp2.shp as sulsfxalb01.shp Many unique situations are encountered when editing the stream networks of different basins. While there are no absolute rules for how to manage these situations, there are three principles which should be consistently adhered to: 1. build a single-line network 2. in the vicinity of a control point, add all surrounding streams 3. maintain correct arc-node topology in the coverage The DRGs are used as a reference in accomplishing the first two of these tasks, and correct topology is maintained with ArcView and WRAP Parameters tools. The external stream network, sulswxutm01.shp, is only used to condition the DEM. Streams are added to the theme in the vicinity of control points, but it is not necessary that it be built as a single line network, nor must its topology be correctly maintained. 3.4.1 Build a Single-Line Network Real channel networks do not always follow a single downstream flow path and RF3 captures these real channel features. Open water features are removed from the stream network when RF3 is queried for true reaches, but the base stream network still has some unconnected arcs and braided rivers. 74 Unconnected arcs may occur due to errors in the RF3 ?Reachtype? attribute classification or they may be the result of digitizing errors in the original RF3 development. If the segment can be identified from the DRGs as actually belonging to a stream, it can be connected to the stream network. Otherwise the segment is deleted. Braided streams are defined as ?a number of alluvial channels with bars or islands between meeting and dividing again, and presenting from the air the intertwining effect of a braid? (Lane, 1957). Braided channels are reduced to one single-line reach through the entire braided channel system. Channel paths in a braided river depend on many factors, such as channel stage, and vary over time. For this work, it is not important to accurately define one major channel through the system. The editor should examine the DRG and use his or her best judgement. Arcs connecting inflowing tributaries should be kept to maintain the stream network connectivity. Similarly, large sloughs (dead channels) are removed. 75 Figure 3.2 : Braided Channel (highlighted arcs are deleted) Figure 3.3 : ?Big Slough? Channel (deleted) on Sulphur River 76 A river basin may contain many small braids. Over the course of editing an entire river basin it is quite possible that some of these will be missed. It is not critical that they all be removed. The raster stream network defined by the DEM will simply choose a path between the two. Over a short distance, this will not have any adverse effects on drainage area determination. Figure 3.4 : Small braid (highlighted arc is deleted) One type of channel braiding, ?anastomosing,? may present problems for the methodology in this project. Anastomosing channels are defined by ?longer than a curved channel segment around a single braid or point bar and their width- 77 scale flow patterns behave substantially independently of adjacent segments? (Bridge, 1993). Figure 3.5 illustrates this definition of anastomosing channels. If a control point is located on one branch of an anastomosing channel, the drainage area could be determined by splitting the arc of the other branch at the divergence point. The split arc would not accumulate any flow from upstream of the divergence. However, in the WRAP model, the total flow for both branches would then be distributed to this control point, where in reality the flow is split between the two branches. In this case, the flow distribution to this point will have to be specifically modified by the contractor running the model. Other situations, unique to each basin, will present themselves. They must be resolved as best possible. In the Sulphur basin, two RF3 reaches were found which appeared to laterally connect two parallel channels. In both of these cases, inspection of the DRGs showed that the digitized reaches actually crossed over levees shown on the topographic map. In these cases, the arcs were either split at the levee, or deleted altogether. Figure 3.6 shows an RF3 reach near the confluence of the North and South Sulphur Rivers. The reach, as digitized in RF3 actually crossed over the levee shown on the DRG. The reach was deleted. Note that the levee will not be represented in the DEM, which samples elevations at approximately every 90 meters. It would not be appropriate, however, to retain the deleted channel. In this case, the DEM terrain will determine the drainage pattern of the area within the levee. 78 Figure 3.5 : Anastomosing Stream Channels (Bridge, 1993) 79 Figure 3.6 : Levee System (in Red) at Fork of North and South Sulphur Rivers 3.4.2 Adding Streams It is important to add all the streams surrounding a control point. The stream network is used to condition the DEM to reflect the hydrography shown in the topographic map. Without this conditioning, the drainage area defined by a small scale DEM, in this case 1:250,000, may be significantly different than what would normally be delineated from the topographic map. The drainage areas may 80 be over or under-estimated. Figure 3.7 shows the original RF3 in blue and streams that were identified from the DRG and added (in yellow) in the vicinity of one control point in the Sulphur basin. Figure 3.8 shows a case of over-estimated drainage area. Figure 3.9 shows a case of under-estimated drainage area. In both of these figures, the original RF3 streams and the watershed boundary delineated from a DEM burned with just the RF3 streams are shown in red. The correct drainage area, and the streams added to the RF3 to help define the correct drainage area, are shown blue. Figure 3.7 : Streams Added (highlighted) to the Base Network 81 Figure 3.8 : Over-estimated Drainage Area 82 Figure 3.9 : Under-estimated Drainage Area For control points located along the basin boundary, drainage areas will also be defined by the streams exterior to the basin boundary. In the vicinity of these control points, exterior streams should also be added to sulswxutm01.shp. 83 3.4.3 Correcting Arc Topology Arcs are defined by a set of points called vertices. The two endpoints of an arc are the nodes. Arcs are oriented in the direction of the from-node to the to- node. Figure 3.10 : Arc Definition A line coverage is said to have correct arc-node topology when all the arcs are arranged in a manner such that the connecting arcs share nodes. There are three types of nodes : normal, pseudo, and dangling. Normal nodes are those which connect the endpoints of more than two arcs. Pseudo nodes connect the end of one arc to the beginning of another. Dangling nodes are endpoints that do not intersect any other node. Figure 3.11 illustrates the three types of nodes. In ArcView, line themes are composed of polylines. Polylines have the same properties as arcs. The term ?arc? is used throughout this chapter and should be understood to mean arcs in an ArcInfo coverage or polylines in an ArcView theme. 84 Figure 3.11 : Node Definition One error in the stream network topology comes from merging the USGS centerline shapefile, sulctlutm01.shp, with the RF3 theme, sulrfiutm01. The endpoints of these two themes do not exactly match, introducing small disconnects into the network. These may be corrected by using the ?Vertex Editor? tool to move one node onto the other. Figure 3.12 shows the corrected final stream network (in green) overlaid on two disconnected arcs. Before moving a vertex, the snapping tolerance of the theme should be set to the scale of the disconnect area 85 Figure 3.12 : Disconnected Arcs Corrected with ?Vertex Editor? Tool. Another problem arises as the stream network is being edited. As tributaries are added, the endpoint of the added tributary is snapped to an existing stream. The endpoint of an arc snapped to the middle of another arc is a dangling node, however, since it is not actually connected to any other node in the theme. This is shown in Figure 3.13. In this project these points are called interior dangling nodes. This problem can be corrected by splitting the original stream arc at the point where the new tributary intersects it, creating three arcs : the tributary arc, an arc upstream of the tributary intersection, and an arc downstream of the tributary intersection. The node at this point is now recognized as a normal node, since three arc endpoints connect there. The ?Erase Interior Dangling Nodes? tool makes this correction. 86 Figure 3.13 : Interior Dangling Node at End of Added Arc (Highlighted) Some interior dangling nodes may be the result of overlapping arcs. This often occurs when using the interactive snapping features within a wide tolerance. If the ?Erase Interior Dangling Nodes? tool fails to correct the interior dangling node, zoom in on the display and check for overlapping arcs. In some cases it may be necessary to check the theme attribute table to see if multiple arcs are selected for what appears graphically to be a single arc. Overlapping arcs can be corrected using either the ?Vertex Editor? or ?Split Lines? tools. Two overlapping arcs connected at a headwater endpoint will cause the headwater not to appear as a dangling node. It is actually a pseudo node. In this 87 case it is hard to select one of the arcs graphically, as they often exactly overly each other. This can be overcome by deleting one of the arc records from the attribute table. Coverage topology can be automatically fixed in ArcInfo with the ?clean? command. This is a complex process, however, and it should be completely understood before applying it to the stream network. In particular, ?clean? works within a specified tolerance. The command specifications for clean are : Arc : clean {out_cover} {dangle_length} {fuzzy_tolerance} {POLY|LINE} The fuzzy tolerance is the minimum allowable distance between any two vertices in the coverage. Any vertices within a radius of the fuzzy tolerance will be combined into a single vertex. To correct disconnects in the base stream network for example, the fuzzy tolerance would have to be set at a radius greater than the largest distance of the disconnects. In very sinuous stream arcs, or where stream arcs approach one another, regular vertices in the arcs may be located within the fuzzy tolerance. At a certain raidus, vertices in the stream network arcs will begin being modified. There is no easy way of determining what tolerance value will correct mistakes in the topology while not affecting regular vertices. To avoid unwanted modifications to the stream network, this project puts an emphasis on correcting the coverage topology without using ?clean," using the combination of existing ArcView tools and specialized scripts described above. 88 3.5 HYDROLOGIC MODELING USING DIGITAL ELEVATION DATA Hydrologic modeling with GIS is based on the automated delineation of watersheds from DEMs. The key concept in carrying out drainage area analysis with a DEM is the eight direction pour point model. A pour point is a location through which water flows out of a region, in this case a DEM cell. A given grid cell is surrounded by eight neighboring cells. Water in this cell is modeled as flowing into only one of the neighboring cells, in the direction of steepest descent. The flow direction for each cell is coded with an integer value, as shown in Figure 3.14. Figure 3.14 : Eight Direction Pour Point Model The grid resulting from applying this analysis to all cells in the DEM is called the flow direction grid. From this grid the flow accumulation of each cell can be determined. The flow accumulation grid shows, for each cell, the number of upstream cells draining to that cell. Typically, streams are defined from a DEM at a threshold value of the flow accumulation. Any cell with a flow accumulation value equal or greater than the threshold is considered a stream cell. Drainage areas may then be defined for any point along the streams by 89 backtracking along the flow direction grid. Figure 3.15 shows a watershed with flow direction and flow accumulation. In this example, stream cells, shown in blue, are defined by a threshold value of five cells. Figure 3.15 : Grid Showing Flow Direction, Flow Accumulation, and Stream Definition At CRWR, a procedure has been developed to condition DEMs to more accurately reflect the drainage shown by vector stream networks. Without using this process, DEM defined streams may vary greatly from mapped streams, especially in areas of flat terrain such as the Texas coast. The process, called ?burning? streams, effectively superimposes the stream network onto the DEM and digs a ditch into the DEM where the network lies. What is actually done is to convert the stream network to a grid with the elevations of the original DEM, and then to raise all the cells in the DEM by a constant (arbitrary, but typically chosen to be larger than the highest elevation value.) The stream network grid with the original elevation values is then merged into the raised DEM. In the subsequent 90 flow direction analysis of the burned DEM, the flow will follow the relief of the original DEM until it enters the stream network, now with much lower elevation than the surrounding terrain. The flow will then stay in the burned stream network until it reaches the basin outlet. Figure 3.16 illustrates the DEM burning concept. Conceptually, the burning process calibrates the DEM to the hydrography defined by the mapped stream network. DEMs by themselves are useful tools for automating drainage area delineation, but experience has shown that small scale DEMs should not be relied upon to produce accurate stream definition and drainage areas in flat terrain. Figure 3.16 : Conceptual View of the Stream Burning Process The WRAP Parameters menu item ?Burn DEM? is used to burn the stream network into the DEM. The finalized stream network, sulsfvalb01.shp, is first combined with the RF3 shapefile of HUCs external to the basin, sulsfxalb01.shp. 91 ArcView : In View menu ?WRAP Tools,? click on ?Merge Themes? ArcView : Select sulsfvalb01.shp and sulrf3alb01.shp ArcView : Set the output shapefile name to sulsbnalb01.shp The merged shapefile, sulsbnalb01.shp, is the line theme used to burn the DEM. The output grid is a temporary grid named burndem. Before the theme burndem is deleted from the View, the grid must be copied to make it a permanent grid. Burning the streams surrounding the basin into the DEM helps to ensure accurate drainage area delineation near the basin boundary. The menu item ?Fill the DEM? is used to fill sinks in the burned DEM. The output grid is filldem. ?Flow Direction,? and ?Flow Accumulation? produce the flow direction grid, fdr, and flow accumulation grid, fac. These grids are also temporary and must be copied into permanent grids. ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Copy burndem to sulbdmalb01 ArcView : Copy filldem to sulfdmalb01 ArcView : Copy fdr to sulfdralb01 ArcView : Copy fac to sulfacalb01 92 Figure 3.17 : Flow Direction Grid for Sulphur Basin Figure 3.18 : Flow Accumulation Grid for Sulphur Basin 93 3.6 DEM DEFINED STREAM NETWORK The normal approach to defining a DEM stream network is to apply a threshold value to the flow accumulation grid. This is the approach used in the original CRWR Prepro. This approach presented some problems when it was first applied in the WAM project. In order to correctly read control point parameters, the points must be placed on the DEM stream network. Many control points representing small water right diversions lie far upstream on the stream network. Typically a very small threshold value has to be applied to extend the DEM stream network to these locations. CRWR Prepro has a function, ?Add Streams,? to overcome this problem, but applying it to these points proved difficult, especially in large river basins where there are many of these control points. For this project, a different approach to DEM stream definition was developed, avoiding this problem altogether. Recognizing that, in a stream network theme with correct topology, the dangling nodes represent the headwaters of the stream network, it is possible then to trace the flow direction grid from each dangling node of the stream network to the basin outlet. Each trace is output as a polyline, creating a line theme showing the DEM representation of the stream network. The WRAP Parameters menu item ?Define Flow Direction Stream Network? does this. The output shapefile is fdrstrmnet.shp. During execution, this script creates two shapefiles in the working directory, headwater.shp and centered.shp. These are temporary shapefiles used to identify the headwater nodes and center them on the flow direction grid cells, and are deleted. 94 Each polyline in this line theme extends from a headwater to the basin outlet, creating a very large file with thousands of overlapping lines. These overlapping lines are split into individuals segments to conform to the stream network definition. This is easily done with the ArcInfo, ?clean? command. In this case, by setting the fuzzy tolerance to a minimum, ?clean? may be used without causing unwanted changes to the stream network arcs. Since the arcs in this theme are defined from the flow direction grid, no vertices will be closer than the grid cell size. Enter a very low tolerance, such as 0.001. This tolerance will then be defaulted to the minimum allowed by the coverage. ?Clean? will now simply segment and remove overlapping arcs in the coverage without moving any nodes or vertices. If "clean" does modify arc positions and directions, these errors will be identified when the stream network connectivity is built. Arc : shapearc fdrstrmnet temp Arc : clean temp temp # 0.001 line Arc : build temp line Arc : arcshape temp line temp Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as sulsdmalb01.shp A script has been developed that defines the flow direction stream network without overlapping lines. This script, ?wrap.fdrstreams_mod,? has been successfully tested on small example stream networks, but was found to be too slow when applied to a large river basin. It is included in Appendix D in the hope that the code may be improved and used at a later time. 95 Figure 3.19 : DEM Stream Network Overlaid on Vector Stream Network A small scale DEM cannot represent all the features defined by larger scale hydrography. The most important consequence of this effect on the project is the ?short-circuiting? of mapped streams by the DEM. Short-circuiting occurs when two mapped stream segments are located within a grid cell?s distance of 96 each other. On the burned DEM these two raster stream paths will appear side by side. Wherever the gridded stream paths touch, if the elevation drop is greater between the two stream paths than in the downstream direction, the DEM defined stream will jump from one path to the other. There is no solution to this problem other than to use finer resolution DEM data. Short-circuiting can introduce large errors into drainage area definition. The example control point shown in Figure 3.20 must be located on the DEM stream network, sulsdmalb01.shp. If it is simply moved to the closest arc of the DEM stream network (due north in this case), the drainage area will be greatly over-estimated. In this situation, the drainage area would be best approximated by a control point located further downstream on the DEM stream network, where the DEM network locates the tributary. In this case, the drainage area will be slightly under-estimated. Or, if this is a fairly short tributary, the drainage area would probably best be defined by manually digitizing the watershed boundary from the DRG, as discussed in Section 3.11. 97 Figure 3.20 : Short-Circuiting of Mapped Stream Network by the DEM The DEM stream network is attributed to show the connectivity among the individual arcs. This is done with the WRAP Parameters menu item ?Build Stream Network Connectivity.? This menu item is based on a script developed by Qi Gu at CRWR. An identification number is assigned to each arc, and each arc then stores the identification of the next downstream arc. This script only works when all the arcs in the theme are oriented (from the from-node to the to-node) downstream. This is automatically done when the DEM stream network is created, since all of the arcs are originally drawn from a headwater node to the basin outlet. It is possible that the DEM stream arcs will have been modified by the "clean" command. This should not happen if the fuzzy tolerance has been set to a 98 minimum. If a change has been made in such a way that an arc is mis-oriented, the connectivity script will stop and output an error message, "wrong direction." Since the script works on the attribute table in sequential order, the error can be found by paging through the attribute table to the first arc with a downstream arc ID number of zero. Unless this arc is an outlet arc, in which case a value of zero is correct, one of the next downstream arcs is mis-oriented. The error can be found by zooming the display to the arc. Use the legend editor to draw the DEM stream theme with directional arcs. Errors can then be corrected by manually editing the stream network theme with the same procedures used on the original vector stream network. 99 Figure 3.21 : Stream Arc Connectivity 100 3.7 INPUT MODEL CONTROL POINTS The model control points must be input into the TSMS Albers projection. If there is more than one shapefile for control points in the UTM projection, they are merged. The UTM shapefile is then projected to TSMS Albers. Arc : shapearc sulwruutm01 sulwruutm01 Arc : project cover sulwruutm01 temp utmtoalb.txt Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as sulfcpalb01.shp The end result of this work is to read parameters for each control point from parameter grids. The flow accumulation grid, for example, gives the drainage area at any point. To determine these parameters, the control points must be entered at the correct location on the stream network. It is imperative that the control points be located on the stream path defined by the flow direction grid and corresponding to the flow accumulation. All of the parameter grids contain values for total upstream areas and are based on the flow accumulation. With the original CRWR Prepro, this is done by simply entering a point such that it overlies the stream grid at the correct location. This is a workable approach, but for this project, the definition of the DEM stream network as a line theme provides a more secure method of locating the control points by actually attaching them to the stream arcs. This ensures that the control points are located on the flow direction path. It also associates each control point with an arc. As points are snapped to the DEM stream network, each point recognizes the identification number of the arc it is snapped to and also the percent distance along that arc. By cross-referencing 101 the snapped control points with the DEM stream network, which recognizes the connectivity among its arcs, the connectivity among the control points may be determined. Figure 3.22 : Examples of Snapped Control Points The entire control point theme can be snapped with the WRAP Parameters menu item, ?Snap Control Points,? or individual control points can be created and snapped using the ?Add Snapped Control Point? tool. Before using either of these functions, the snapped control point theme name must be entered using the WRAP Tools menu item ?Set Control Point Theme Names.? Once the control points have been projected into TSMS Albers, it is possible to snap the entire theme. The snapped control points must be individually reviewed, however, to verify their correct location. The theme-snapping alogrithm is only able to pick the closest arc to a point, regardless of whether this is actually the correct arc. 102 Near junctions, the control point may be snapped to either upstream or downstream arcs indiscriminately. This may disrupt the correct connectivity sequence among the control points. Also, the control point may be snapped directly to the junction, when, in fact, it should be located directly upstream of the junction. When using the theme-snapping algorithm, the user must first zoom the display to the extent of the DEM stream theme. Next, the user should zoom the display out further with two clicks of the ArcView ?Zoom Out? tool. For, each point, the theme-snapping script is only able to look around at a radius of three screen pixels to find the nearest neighboring arc. If no arc is found within this radius, the point will not be snapped. Points that are not snapped are selected in the original control point coverage, and therefore highlighted in the original control point theme when the script completes it?s execution. If several control points are not snapped, the theme-snapping algorithm should be executed again with the display extent zoomed even further out. If only one or two points are not snapped it is quicker to add them with the ?Add Snapped Control Point? tool, as described below. As the snapped control point theme is reviewed, errors can be fixed by deleting an incorrect point and replacing it with the ?Add Snapped Control Point? tool. This tool snaps the control point to a user-selected arc, eliminating the uncertainty in the theme-snapping algorithm. Alternately, the original control point theme can be used as a reference, and the entire snapped control point theme can be built, one point at a time, using the ?Add Snapped Control Point? tool. 103 3.8 CREATING THE MODEL NETWORK STRUCTURE As discussed, control points snapped to a stream network with its connectivity established have their own connectivity implicitly defined. It is possible then to create a model diagram of the control point connectivity. The WRAP model does not recognize geographic locations or a stream network, it only recognizes the sequencing of control points in the basin. The WRAP Parameters menu item ?Make a Network Wire Diagram? draws a line from each control point to the next downstream control point, or to the basin outlet if there are no further downstream control points. This is a useful visualization tool, translating the geographic location of the control points along a stream network into the WRAP model view. Figure 3.23 : Sulphur Basin Network Diagram 104 3.9 PROCESSING THE PARAMETER DATA SETS Drainage area, average curve number, and average annual precipitation are the required flow distribution parameters for each control point. Drainage area is defined by the flow accumulation grid. The incremental watershed boundary associated with each control point is defined by the flow direction grid. These boundaries are output as a polygon shapefile, watersheds.shp, with the WRAP Parameters menu item ?Delineate Incremental Watersheds.? The watershed areas are first determined as grid zones from the flow direction grid. In the process of converting these grid zones to polygon boundaries, isolated ?dangling polygons? are sometimes created between two grid zones. These are deleted with the WRAP Parameters menu item ?Dissolve Dangling Polygons.? Figure 3.24 Sulphur Basin Control Point Watersheds The average curve number may be calculated for the drainage area of any given point using a weighted flow accumulation function. The mean curve 105 number over several areas may be calculated by dividing the sum of the products of each area and curve number by the total area. )1.3( ... 332211 T A ACNACNACN numbercurvemean +++ = A weighted flow accumulation request returns the sum of the values in all of the cells of the value grid within the flow accumulation area of the current cell. When this value is divided by the regular flow accumulation value for a cell, the average of the value grid over the upstream area is returned for each cell. )2.3( 1)( ),( + + = ionflowdirectlationflowaccumu CNCNionflowdirectlationflowaccumu numbercurvemean Equation 3.2 is equivalent to Equation 3.1, where each incremental area in Equation 3.1 is one grid cell. The terms CN, in the numerator, and 1, in the denominator, are included so that a cell with no flow accumulation is simply assigned its curve number value. The WRAP Parameters menu items ?Make Average Curve Number Grid? and ?Make Average Precipitation Grid? apply Equation 3.2 to the original curve number and precipitation data sets. The resulting grids, avgcn and avgpcp, attribute each cell with the average parameter value over that cell?s total upstream drainage area. These are temporary grids and should be copied into permanent grids. ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Copy avgcn to sulacnalb01 ArcView : Copy avgpcp to sulapcalb01 106 3.10 READING THE WRAP INPUT PARAMETERS The flow distribution parameters are read from the parameter data sets using the WRAP Parameters menu item, ?Report Control Point Parameters.? Before running this function, the parameter grid theme names must be entered using the WRAP Tools menu item ?Set Parameter Grid Theme Names.? This script simply returns the cell value from the flow accumulation, average curve number, and average precipitation grids for each control point. The area is then calculated by multiplying the flow accumulation by the square of the cell size. The parameters are output in the attribute table of a new shapefile, parameters.shp, that duplicates the snapped control point coverage. This shapefile is renamed as sulparalb01.shp. Once the parameter grid theme names have been set and the grids added to the View window, the flow distribution parameters may also be queried at any point using the ?Report Control Point Parameters? tool. Table 3.1 : Example Attributes of Parameters Shapefile 107 Parameters for the incremental drainage areas are calculated using the watershed polygon theme. Incremental area is automatically defined in the watershed theme. The WRAP Tools menu item, ?Average Grid by Polygons,? averages grid cell values within zones defined by a polygon theme and outputs the averaged values to a new field in the polygon theme. Using this menu function, incremental average curve number and precipitation are calculated from the regular curve number and precipitation grids, sulcngalb01 and sulpcpalb01. 3.11 QUALITY CONTROL OF DRAINAGE AREAS Quality control of the input parameters focuses on the drainage area values. Drainage area is the dominant parameter in the flow distribution calculations. Some general limitations of DEMs in delineating watershed boundaries have already been discussed. In the methodology of drainage area delineation presented for this project, further errors may be introduced from incorrect user input of streams and control points. In a large basin, it is likely that errors will arise from poor stream definition and misplaced control points. A quality control process has been designed to limit these errors. The quality control process presented in this section was originally developed while working on the Sulphur basin with 1:250,000 DEM data. Subsequent experience with other river basins and with 1:24,000 DEM data has exposed a weakness in this procedure. This procedure failed to recognize that short-circuiting errors in the DEM stream network, as described in Section 3.6, may introduce large errors into medium-sized drainage areas that are not specifically checked in this process. For the sake of clarity in the presentation of 108 the methodology, the original quality control procedures, as applied to the 1:250,000 DEM data with the Sulphur basin, are presented here. An improved quality control process is presented in Section 4.5, and it is that process that should be followed when processing future river basins. The quality control process does not check all of the drainage areas. This would be very difficult and extremely time-consuming. Instead, methods have been developed to check both the drainage areas of USGS gages, typically larger areas, and drainage areas of the smaller watersheds. Drainage areas of stream gages are compared with USGS reported values. Smaller drainage areas are compared with the DRG topography. Drainage areas delineated by the DEM for USGS gage control points are compared with the values reported by the USGS. These values are collected in building the USGS gage shapefile for the basin, as described in Chapter 2. For the Sulphur basin, the results in Table 3.2 were calculated. Gage CP USGS (sq.mi.) DEM (sq.mi.) Relative difference (%) 100* ? ? ? ? ? ? ? USGS DEMUSGS 7344200 1060 3443.00 3426.66 +0.47 7344000 2010 2774.00 2802.34 -1.02 7343500 3010 494.00 536.57 -8.62 7343200 4010 1365.00 1363.34 +0.12 7343000 5010 276.00 313.09 -13.44 7342500 6010 527.00 525.42 +0.30 Table 3.2 : Analysis of USGS Gage Area Differences 109 Control points that show a large difference, such as 3010 and 5010 above, should be checked again for proper location on the stream network. These two points are both correctly located. In this case, the DEM drainage area value is accepted as is. These are large discrepancies, however, and some may find it hard to dismiss the USGS reported drainage area values as incorrect. As will be shown in Chapter 4, drainage areas for these two points independently defined from the 1:24,000 DEM agree closely with the 1:250,000 DEM results shown in Table 3.2. Furthermore, visual inspection of the digital watershed boundaries (from both the 1:250,000 and 1:24,000 DEM sources) delineated for these two gages shows that they agree with the DRG topography. Experience at CRWR has shown that watersheds below 1,000 grid cells in size may have delineation errors that significantly affect the total calculated area. The watershed boundaries of all control points with flow accumulation values equal to or less than 1,000 cells are checked against the DRGs. To do this, the watershed polygons must be projected into the UTM system. Unfortunately, after the polygons are projected, they must be ?cleaned? to restore polygon topology. When ?clean? is applied to a polygon coverage it erases all the attributes in the polygon attribute table. This leaves the watershed polygons without any attribute of their associated control point identifier. To retain the control point identification with the watershed boundaries, the coverage is built as a line coverage rather than as polygons. Another side effect of the projection process is that dangling polygons are re-introduced into the watershed boundaries. The 110 dangling polygons, however, are generally only one or two grid cells in size, and their presence does not adversely affect the quality control process. Arc : shapearc sulwsdalb01 sulwsdalb01 Arc : project cover sulwsdalb01 sulwsdutm01 albtoutm.txt Arc : build sulwsdutm01 line Arc : copy sulwsdutm01 temp Arc : arcshape temp line temp Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as sulwsdutm01.shp Errors identified in the quality control process can be fixed in one of two ways. Corrections to the UTM stream network and control point locations can be made, but the basin must then be re-processed from the beginning by burning the corrected stream network into the original DEM. Errors may also be corrected by digitizing correct watershed boundaries from the DRGs and using these polygons to develop the parameters. Figure 3.25 illustrates the use of a manually digitized watershed boundary to correct an erroneous DEM delineation. If it is necessary to manually digitize watershed boundaries, a new polygon shapefile, sulqcwutm01.shp, is created for this purpose. ArcView : In View menu "View," click on "New Theme?" ArcView : Select feature type "Polygon" ArcView : Set theme name to sulqcwutm01.shp 111 Figure 3.25 : Manually Digitized Drainage Area In the Sulphur basin, 44 control points were reported with flow accumulation values of 1,000 cells or less. Quality control of these points found 16 watersheds with unacceptable deviations from the DRG topography. Of these 16 points, 9 errors appeared to be the primarily the result of streams that were not added to the stream network and therefore not burned into the DEM. Two errors were due to a short circuit in the DEM stream network. One control point had been incorrectly snapped. The remaining drainage area errors were simply due to the inability of the resolution of the DEM to accurately reflect the DRG topography. With a majority of the drainage area errors being the result of poor 112 stream definition, it was necessary to correct the stream network and re-process the basin. After correcting the stream network and re-processing the basin, the same 44 control points were found to have flow accumulation values less than or equal to 1,000 DEM cells. These points were put through the QC process a second time. Twelve drainage areas were found to disagree with the DRG topology. A watershed boundary was manually delineated for each of these points. This time, only two errors were found that could be attributed to poor stream definition. In this case, it was decided to accept the manually delineated watersheds as the final corrections to the control point parameters. To determine parameter corrections from the quality-controlled watersheds, the theme sulqcwutm01.shp must first be projected to the TSMS Albers coordinate system. The quality control watersheds do not have an attribute field that references each polygon to its respective control point. After projecting the polygons, it is necessary to manually enter a control point identification for each shape. This can be done by editing the theme attribute table. As a result of cleaning the watershed coverage after the projection step, some extraneous polygons may be created between watershed polygons with connecting arcs. These are identified and deleted during the process of identifying and adding control point identifiers to each polygon. Arc : shapearc sulqcwutm01 sulqcwutm01 Arc : project cover sulqcwutm01 sulqcwalb01 utmtoalb.txt Arc : clean sulqcwalb01 Arc : build sulqcwalb01 Arc : copy sulqcwalb01 temp 113 Arc : arcshape temp poly temp Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as sulqcwalb01.shp Incremental parameters are determined for the quality-controlled watersheds in the same manner as with the incremental watershed theme. Table 3.3 shows the resulting attribute table for sulqcwalb01.shp. In this case, the area of each polygon is not automatically reported in units of square miles, rather it is given in map units of square meters, and must be converted by the user. These values are substituted as the final parameter values. Care should be taken to adjust upstream and/or downstream drainage area values if this substitution represents a significant change. Table 3.3 : Attributes of Manually Delineated Watersheds 114 Chapter 4 : Results and Discussion 4.1 STREAM NETWORK CONSTRUCTION In this work, stream networks have been prepared by adding streams from 1:24,000 scale DRGs to those originally identified by the 1:100,000 scale RF3. The resulting network closely conforms to the hydrography of the 1:24,000 scale DRGs. Small watersheds cannot be accurately defined from 1:250,000 scale DEMs without burning in streams identified from larger scale hydrography. Even this does not guarantee accurate watershed delineation. In fact, burning streams of larger scale than the DEM introduces the possibility for large drainage area errors from short-circuiting of the burned stream channels. The method of constructing the stream network is straight forward. For the most part, existing ArcView editing tools are used to digitize new features and snap them to existing features. The stream network topology can be corrected without using ArcInfo, by using ArcView?s Vertex Editor tool and the WRAP Parameters Erase Interior Dangling Nodes tool. Every effort should be made to find and digitize all streams before burning and processing the DEM. A large number of drainage area errors identified in the quality control process as resulting from poor stream definition will require re-processing the DEM from the beginning. The vector stream network can be translated into the DEM stream network with the WRAP Parameters menu item, "Define the DEM Stream Network.? It is necessary to run the ArcInfo "clean" process on the original coverage of DEM 115 streams to reduce the overlapping lines. With small scale DEMs, clean has never altered the topology of the original stream segments, other than to remove overlapping arcs. With the finer resolution DEMs, clean may alter the arc topology. Setting the tolerance for the clean command to a minimum should prevent this, but the user should always be prepared for clean to introduce errors into the resulting stream network. Changes to the topology will produce errors in the subsequent procedure for ordering the stream segments. The topology can be fixed as each error is identified although this is a somewhat time-consuming process. Constructing the stream network is possibly the most time-intensive task in preparing the WRAP model flow distribution parameters. The Texas Natural Resources Information System (TNRIS) is currently developing 1:24,000 scale hydrography coverages for the entire state of Texas. The availability of this data set will greatly speed the processing of a river basin. 4.2 FLOW DISTRIBUTION PARAMETERS Table 4.1 lists the flow distribution parameters obtained for the Sulphur basin, using the 1:250,000 scale DEM. These parameters may differ slightly from those used in the final WRAP model of the basin. The WRAP model was finalized in January of 1999. The processing of the basin presented in this thesis reflects several changes in the methodology since the parameters were originally prepared. Slight changes in the flow distribution parameters should be expected any time a basin is processed again. When a basin is reprocessed, control point 116 Table 4.1 : Flow Distribution Parameters using 1:250,000 DEM 117 Table 4.1 : Flow Distribution Parameters using 1:250,000 DEM 118 Table 4.1 : Flow Distribution Parameters using 1:250,000 DEM 119 positions often change slightly due to changes in the DEM stream network and changes in the snapped control point locations. The resulting drainage area parameters have been discussed in Section 3.11. The quality control process in that section addresses only the small and large drainage areas. In performing quality control, it was originally felt that the remaining drainage area values could be accepted as is. It is difficult to compare larger watershed boundaries with the DRG topography and there is no other readily available source (such as that for USGS reported gage areas) for comparison of the drainage area values. When the parameters were prepared with 1:24,000 DEM data, however, some large discrepancies were noted in drainage area values. These discrepancies highlight further difficulties in delineating watersheds with 1:250,000 scale DEMs. These difficulties are discussed in Section 4.4, where areas delineated from the 1:250,000 DEM are compared to those delineated from the 1:24,000 DEM. The precipitation parameter is not analyzed in this study. The limitations in defining this parameter for small watersheds from the small scale of the source data have been discussed in Section 1.3.2. It is worth re-stating the PRISM precipitation grid metadata here: ?point precipitation can be estimated at a spatial precision no better than 2 km,? [but] ?the overall distribution of precipitation features is thought to be accurate.? The precipitation parameter represents a small adjustment in the flow distribution and only applies to watersheds that are located some distance apart. The PRISM precipitation data is suitable for this purpose. 120 Curve numbers must be accepted as is, considering the resolution of the source data. In the Sulphur Basin, six control points report curve numbers lower than 60 (the lowest being 47.) The contractor modeling the basin questioned the accuracy of these values (R.J. Brandes Co., 1999). The drainage areas of these control points range from 0.03 mi. 2 to 0.9 mi. 2 . The discussion of curve number parameters in Section 1.3.2 cautions that there may be a loss in precision of the curve number values estimated for small watersheds from 1:250,000 scale source data. Curve numbers of this magnitude are certainly possible, though they generally only appear in areas of poor hydrologic soils, and examination of these watersheds reveals little indication that the curve numbers should be otherwise. Figures 4.1 and 4.2 show two of these watersheds (control points 2260 and 2270) overlaid on the curve number grid and DRG maps. 121 Figure 4.1 : CP 2260 and 2270 Watersheds Overlaid on Curve Number Grid Figure 4.2 : CP 2260 and 2270 Watersheds Overlaid on DRG 122 4.3 PREPARING PARAMETERS WITH 1:24,000 SCALE DEMS In early 1999, 1:24,000 scale DEMs became available for the entire state of Texas as part of the National Elevation Database (NED) project. They represent a considerable improvement over the existing 1:250,000 scale DEMs. The use of these 1:24,000 DEMs, however, requires larger file sizes and increased processing times. The 1:24,000 DEM for the Sulphur Basin requires 35.2 megabytes of storage space, compared to 2.5 megabytes for the 1:250,000 scale DEM. NED DEMs come packaged on CD-ROMs as 1?x1? latitude by longitude grids. Each CD contains up to nine grids. The individual grids are processed and merged similarly to the procedure used for 1:250,000 DEMs in Section 2.2. For the Sulphur basin, this was accomplished by an ArcInfo AML, "dem30m.txt" Each grid is converted to an integer grid, and the results are merged. To save time, the merged DEM should be clipped to the buffered basin extent before projecting it. To do this, the buffered basin must be projected into the DEM projection. The original NED DEMs are given in a geographic projection, with NAD83 datum, GRS1980 spheroid, coordinate units of decimal degrees, and elevation units of meters (stored as floating point values). The resulting DEM is projected into the TSMS Albers coordinate system. The 1:24,000 DEM is burned with the combined internal and external vector stream networks, sulsbnalb01.shp, and is processed according to the methodology of Chapter 3. The results are given in Section 4.4 where they are compared to those obtained from the small scale DEMs. The resulting drainage 123 areas were quality controlled by the methods given in section 3.12. For the gage watersheds, the following areas were obtained : Gage CP USGS (sq.mi.) 1:250,000 DEM (sq.mi.) %Difference 100*? ? ? ? ? ? ? USGS DEMUSGS 1:24,000 DEM (sq.mi.) %Difference 100*? ? ? ? ? ? ? USGS DEMUSGS 7344200 1060 3443.00 3426.66 +0.47 3412.15 +0.90 7344000 2010 2774.00 2802.34 -1.02 2789.83 -0.57 7343500 3010 494.00 536.57 -8.62 537.64 -8.83 7343200 4010 1365.00 1363.34 +0.12 1355.35 +0.71 7343000 5010 276.00 313.09 -13.44 305.08 -10.54 7342500 6010 527.00 525.42 +0.30 523.59 +0.65 Table 4.2 : Comparison of Gage Drainage Areas The results are similar to those obtained with the 1:250,000 scale DEM. In general the agreement between USGS and DEM values is very close, except for control points 3010 and 5010. Again, these points were found to be correctly located. Furthermore, the DEM watershed boundaries for these two points were compared to the DRG topography and appear to be correct. The agreement between the results of the two DEMs, two independently developed data sources, suggests that the USGS reported values are in error. It is also possible that the USGS values may have been calculated at a past time when the basin hydrography was different. Twelve points report flow accumulation values less than 1,000 cells. When these watershed boundaries were checked against the DEM, no significant 124 errors were found. In fact, the drainage areas are so well delineated, that the user must be very careful in exactly locating the control point. Even small terrain features, such as swales with no mapped streams, are defined by the 1:24,000 DEM. 4.4 COMPARISON OF RESULTS BETWEEN LARGE AND SMALL SCALE DEMS The 1:24,000 scale DEM parameters are given in Table 4.3. They are compared against the parameters obtained from the 1:250,000 scale DEM. Differences are given as the absolute difference of the 1:24,000 DEM value subtracted from the 1:250,000 value. Results for the precipitation parameters are not discussed. Table 4.3 shows that the differences in precipitation parameters between the two DEM scales are negligible. 125 Table 4.3 : Comparison of Flow Distribution Parameters 126 Table 4.3 : Comparison of Flow Distribution Parameters 127 Table 4.3 : Comparison of Flow Distribution Parameters 128 Two control points, 4070 and 4080, report very large changes in drainage areas. An examination of these two points, shown on the following pages in Figures 4.3 and 4.4, reveals that the 1:250,000 DEM watersheds are incorrect. There is a large short-circuiting error in the DEM stream definition just upstream of these points that temporarily sidetracks the North Sulphur River into a tributary where control points 4070 and 4080 are located. The drainage areas of these two points are therefore grossly over-estimated in the 1:250,000 DEM parameters. This short-circuit is corrected in the 1:24,000 DEM stream definition. Note that while the incremental drainage area of the next downstream control point, CP 4060, is affected by this error, the value of the total drainage area used for flow distribution is not, as can be seen in Table 4.3. Finding this short-circuiting error exposed a major problem with the quality control procedures established for the 1:250,000 DEM. It is not enough to just check the large and small watersheds. All watersheds are subject to this type of short-circuiting error. An improved quality control procedure is presented in Section 4.5 to prevent this type of error. 129 Figure 4.3 : Short-Circuit of North Sulphur River by 1:250,000 DEM 130 Figure 4.4 : 1:24,000 DEM Stream Network and Correct Drainage Areas The drainage area differences reported in Table 4.3 are examined for a consistent bias. Throwing out the results for points 4070 and 4080, the differences are plotted in Figure 4.5, as the absolute difference, and in Figure 4.6, as the relative difference, with the 1:24,000 value as a baseline. While Figure 4.5 may seem to suggest a slight bias toward defining larger drainage areas with the 1:24,000 DEM, Figure 4.6 shows that this is largely insignificant. Of the 74 points examined, 43 adjustments are positive (reflecting a larger drainage area in the 1:24,000 DEM), and 31 are negative. The large outlying value of approximately +11% relative difference belongs to control point 2260. This is a 131 very small watershed and the large relative difference in this case applies to an absolute difference of only 0.01 square miles. Curve number adjustments are similar to those for drainage area. These are plotted in Figure 4.7. There appears to be no significant bias. The curve numbers obtained for the 1:24,000 DEM watersheds may be assumed to be more accurate, since they reflect the more accurate spatial location of the watershed boundaries. Figure 4.5 : Absolute Drainage Area Differences 132 Figure 4.6 : Relative Differences in Drainage Areas Figure 4.7 : Absolute Curve Number Differences 133 4.5 IMPROVED QUALITY CONTROL OF DRAINAGE AREAS The potential for large errors in drainage areas as a result of DEM stream short-circuiting was belatedly realized when the 1:24,000 DEM data became available for comparison. To prevent this type of error, it is necessary to introduce another step into the quality control procedure presented in Section 3.11. This step consists of comparing the DEM stream network, sulsdmalb01.shp, against the final vector stream network, sulsfvalb01.shp, to identify any large short-circuits in the DEM stream network. The quality control checks described in Section 3.11 are still performed. Drainage areas defined for stream gage control points are compared against the USGS reported drainage area values. Small watershed boundaries are compared against the DRG topography. For 1:250,000 scale DEM data, a threshold flow accumulation of 1,000 cells is used to define small watersheds. One grid cell of a 1:250,000 DEM, however, covers the area of approximately nine grid cells of a 1:24,000 DEM. It may be necessary to increase the threshold flow accumulation value defining small watersheds with 1:24,000 DEMs. On the other hand, the 1:24,000 DEM delineates watershed boundaries much more accurately. More experience in performing quality control of 1:24,000 watersheds in the project is necessary before a good estimate can be made of the proper threshold value. To ensure the best quality control of drainage areas prepared with this project methodology, the following three step procedure is applied : 134 1. Visually compare the entire DEM stream network, sulsdmalb01.shp, against the final vector stream network, sulsfvalb01.shp. Identify any major short-circuits that will adversely affect the drainage area definition. To correct a short-circuit, the vector stream network must be edited to separate the stream arcs by more than the extent of one grid cell at the point where the short-circuit occurs. Then it is necessary to reprocess the DEM with the corrected vector stream network. 2. Compare the drainage area values obtained for stream gage control points with the values reported by the USGS. In the case of a large discrepancy, verify that the control point representing the gage is correctly located. Check that the latitude and longitude of the control point are correct, and check the relevant DRG to see if it shows a stream gage symbol in the vicinity. 3. Check the boundaries of small watersheds against the DRG topography. There are three possible sources of error in the DEM delineation of small watersheds. First, verify that the control point is located as precisely as possible, considering the resolution of the DEM grid cell size. Second, compare the vector stream network to the DRG. Small streams identified from the DRG but not represented in the vector stream network have not been burned into the DEM. In this case, it may be faster to simply manually digitize the watershed boundary for the control point in question. Otherwise, the missing 135 streams should be digitized and added to the vector stream network. The corrected vector stream network is then used to reprocess the DEM. Finally, the DEM may simply not be able to define topography at the same resolution as the 1:24,000 topographic map. In this case, a watershed boundary is manually digitized from the topographic map. 136 Chapter 5: Conclusions A method has been presented for using geospatial data to determine flow distribution parameters at selected sites in a river basin. The parameters are used in the WRAP water availability model to distribute flows from gaged sites to ungaged sites. A digital elevation model is used to automatically delineate the watersheds for the model control points. A digital stream network is built from a combination of 1:100,000 and 1:24,000 scale hydrography. The stream network is used to condition the DEM to more accurately reflect the mapped hydrography. The curve number and precipitation parameters for each control point are read from existing curve number and precipitation grids that are averaged over the drainage areas. There were three objectives to this research : the creation of a geospatial database for a river basin, the extraction of the WRAP flow distribution parameters for each control point from the database, and the production of reliable digital watershed delineations. A method of building a geospatial database for a river basin has been presented in Chapter two. The success criterion of this objective was the accomplishment and documentation of the procedures, such that they can be reproduced by other users in building similar databases of other river basins. This criterion has been met. Chapter two demonstrates that this task can be accomplished and documents the procedures for doing so. These procedures have been used to build geospatial databases for eight other river basins in Texas as part of the WAM project. 137 The second research objective has the same success criterion as the first. Flow distribution parameters for use in the WRAP model were successfully extracted from the database. The methodology for doing so is documented in Chapter three. This methodology has continued to develop while work has been ongoing on other river basins. The most recent changes to the methodology have been successfully applied to two other river basins. The third research objective was the production of reliable watersheds from digital elevation data. In Chapter one it is noted that the success of this objective has to be subjectively judged. There is no absolute measure for determining the accuracy of these watershed boundaries. The best way found in this research to judge their accuracy is to visually compare them with topographic maps. The computed drainage area values for USGS stream gages can be compared against the USGS values, but agreement in the reported drainage area values does not prove that the watershed boundary is correctly located. Examination of the watershed boundaries produced from the 1:24,000 DEM of the Sulphur basin shows that they agree very well with the topography shown on DRGs. On this basis, this objective is stated as successfully completed. The objective of producing reliable drainage areas cannot be stated as having been successfully completed where 1:250,000 DEM terrain data is used. In the course of this work, many sources of error have been identified in the production of small watersheds from 1:250,000 DEMs. In order to correctly delineate small watersheds from 1:250,000 DEMs, the DEM must be conditioned by a larger scale stream network. 138 A larger scale stream network was successfully produced with digitized 1:24,000 scale USGS topographic maps. The ?blue line? method was used to identify small tributaries from these maps. The tributaries are manually digitized and added to the existing 1:100,000 scale RF3 stream network. Due to the time and effort required to manually digitize these tributaries, only those in the immediate vicinity of control points are added. While this work can be successfully performed manually, the publication of 1:24,000 scale hydrography for the entire state of Texas by TNRIS will considerably reduce the time and effort required to build a river basin database. Even conditioning a 1:250,000 scale DEM with a 1:24,000 scale stream network does not guarantee correct delineation of small watersheds, due to the limited horizontal resolution of the elevation data. In the process of conditioning a 1:250,000 DEM with a much finer resolution stream network, another source for error is introduced in the form of stream short-circuiting. Errors in the delineation of small watersheds can be corrected by manually digitizing the watershed boundaries from the DRG topographic maps. Short-circuiting, however, can introduce large errors into any size watershed. Finally, it becomes apparent that only a rigorous quality control procedure will provide acceptable drainage area results from 1:250,000 scale DEM data. All results from the DEM must be checked. The DEM stream network must be compared to the original vector stream network to identify any major short-circuiting errors, and ideally all watershed boundaries should be checked. 139 This is a very time-consuming process and involves so much user-input that mistakes are hard to avoid. Streams must be manually digitized from 1:24,000 scale topographic maps, and many small watershed boundaries must be manually digitized as well. This is especially true of large river basins that may spread across more than a hundred quad sheets and contain several hundred WRAP control points. As errors are found, the entire basin must be re-processed and put through the quality control process again. It is not unlikely that a large river basin would have to go through several iterations of processing and checking the results before they could be accepted. The need to delineate small watersheds in the WAM project and the effort required to accurately do this with the small scale DEMs indicates that 1:24,000 scale DEMs should be used in processing all of the river basins. The use of 1:24,000 DEMs does add some additional processing considerations to the methodology. File sizes and processing times will be considerably increased. Larger river basins may have to be subdivided into sub-basins to even be able to process the grids. The use of 1:24,000 scale DEM data, however, is much cleaner and provides greater confidence in the parameter results. Quality control is still necessary, but, with the fine resolution of the 1:24,000 DEMs watershed boundaries, errors will more likely result from the exact location of the control point, which is more easily corrected. Stream short-circuiting is much less common. No major short circuits are observed in the 1:24,000 DEM stream network of the Sulphur basin. The high terrain resolution of the 1:24,000 DEM even suggests that the necessity of the vector stream burning process should be 140 studied. The 1:24,000 DEM data may accurately reflect mapped hydrography without the conditioning process. While drainage areas can be quality controlled against the DRG topography, it is more difficult to judge the reliability of the precipitation and curve number values for each watershed. Two factors can be considered when assessing the reliability of the resulting precipitation and curve number values: the quality and the resolution of the source data. The quality of the data is determined by the method of its development and its review and acceptance by experts. The resolution of the data is important when considering the values produced for small watersheds. The precipitation data comes from a thoroughly reviewed and accepted source, the Oregon State University PRISM climate mapping project. The original data has a grid cell size of 250 meters. This is a very coarse resolution to apply to small watersheds, but, by nature, an areal coverage of precipitation data must be coarse in resolution, because precipitation must be interpolated from a relatively few point gages. The precipitation adjustment in the flow distribution calculation is a small one, and the parameter is of minor importance compared to drainage area and curve number. While the values computed for small watersheds may not be the most accurate, the overall precision of the data is satisfactory for the purpose of the parameter. In the modified NRCS method of flow distribution in the WRAP model, the parameter is used to adjust long term precipitation between sites that are located a relatively long distance from one another. 141 The curve number data is more questionable. The original curve number grid was obtained from the Blacklands Research Center. It is at a map scale of 1:250,000. Several of the curve number values produced for small watersheds in the project have been questioned by the basin contractors. The results are faithful to the curve number grid, but the resolution of the curve number grid may simply be too coarse to expect accurate curve number parameters for small watersheds. The curve number values will have to be accepted as is, until finer resolution sources of land use and soil data become widely available. If curve number values are deemed to be unacceptable, then flows in the basin may simply be distributed based on drainage area ratios. The method of determining hydrological parameters from geospatial data presented in this research was designed specifically to support the water availability modeling requirements of the TNRCC. The method could also be applied to support any hydrological model requiring input parameters at points along a stream network. The specific procedures and code developed in this work can be relatively easily generalized to work with any geospatial source data sets. The user should always keep in mind that the accuracy of the resulting parameters depends on the quality of the source data. 142 Appendix A : Exercise 1 143 A.1 EXERCISE TABLE OF CONTENTS A.2 Introduction A.3 Goals of the Exercise A.4 Geospatial River Basin Database A.5 WRAP Parameters Interface A.6 Exercise Study Area and Data A.7 Methodology A.7.1 Using DRGs A.7.2 Assembling Control Points A.7.3 Building the Stream Network A.7.4 Processing the DEM A.7.4.1 Burning the DEM with the Vector Stream Network A.7.4.2 Fill, Flow Direction, and Flow Accumulation A.7.5 Creating the DEM Stream Network A.7.6 Attaching Control Points to the Stream Network A.7.7 Creating Parameter Data Sets A.7.8 Making the Control Point Network Diagram A.7.9 Reading the Flow Distribution Parameters A.7.10 Defining the Incremental Watersheds A.7.11 Quality Control A.8 Results A.9 Exercise References A.2 INTRODUCTION The Water Availability Modeling (WAM) project was begun by TNRCC in 1998. TNRCC was directed to undertake this project by the Texas legislature when Texas Senate Bill 1 was passed in 1997. Senate Bill 1 was the legislature?s response to the need for better water planning throughout the state, which became evident in the drought of 1996. The WAM project will produce water availability models for 22 of the 23 major river basins in Texas, with the Rio Grande river being modeled as a separate project. TNRCC defines water availabiliy models as 144 "computer programs that calculate the amount of water in a river basin using hydrologic principles and actual measurements taken at stream gages" (TNRCC, 1999). TNRCC selected the Texas A&M University?s Water Rights Analysis Package (WRAP) model to serve as the actual model used in analysing each basin. WRAP calculates regulated stream flows at selected points in a basin based on an input sequence of historical naturalized stream flows. Naturalized stream flows are flows with the effects of man removed. They are calculated from historical records by adding and subtracting records of the quantities of water diverted, stored, and returned along the river. In some cases, even the effects of land use changes on the rainfall-runoff relationship may be calculated and included. Several years of naturalized stream flow data are needed in the WAM project in order to be able to judge the average availability of water over long terms. Typically, this information is only available at a few sites in a river basin : USGS stream gages and at older reservoirs. To prepare an input sequence of naturalized stream flows at other points in the basin, flows are distributed from these known flow locations to the unknown flow locations. There are several methods for distributing stream flows from known to unknown flow locations. Typically, stream flows are distributed based on the drainage area ratio of the unknown to known flow points. )1.(A A A QQ gaged ungaged gageungaged ? ? ? ? ? ? ? ? = 145 In the WAM project an effort has been made to include other watershed characteristics in the flow distribution calculations. The NRCS curve number equation was developed to estimate the storm runoff from a watershed based on an input precipitation amount and a description of the watershed?s tendency to abstract rainfal given by the curve number. () )2.(10 000,1 8.0 2.0 2 A CN Swhere SP SP Q ?= + ? = For the WAM project, the curve number equation is applied to average monthly stream flows. Equation 2 is inverted to obtain the monthly precipitation from an input monthly stream flow. This monthly precipitation is then distributed to the drainage area of the unknown flow location. The ratio of mean annual precipitation values, M, for the two drainage areas may be used to adjust the distributed monthly precipitation value. )3.(A M M PPadjusted gage ungaged gageungaged ? ? ? ? ? ? ? ? = In the WRAP model, control points are used to identify location for which stream flows are to be calculated. There may be hundreds of control points in a river basin model. To calculate the drainage area, curve number, and mean annual precipitation of each drainage area by hand would be very tedious. Fortunately, geospatial data sets exist for each of these parameters, allowing them to be automatically calculated using GIS. This exercise presents a method for calculating these parameters that has been developed for the WAM project. 146 A.3 GOALS OF THE EXERCISE The intent of this exercise is to familiarize you with the methodology used in the WAM project to calculate flow distribution parameters from geospatial data sources for the control points in a WRAP model. By the end of this exercise you will be able to : ? Use the WRAP Parameters ArcView project tools to develop the WRAP flow distribution parameters from a geospatial river basin database ? Use Digital Raster Graphics (DRG) topographic maps as a reference in working with digital hydrography. A.4 GEOSPATIAL RIVER BASIN DATABASE The first step in preparing flow distribution parameters for use in the WRAP model is to build a geospatial database for the river basin. For each river basin modeled in the WAM project, a database consisting of twelve components is compiled. These components are : ? River basin boundary. A polygon of the basin drainage area. ? DRG files. TIFF image files of 1:24,000 USGS quadrangle topographic maps. ? Digital elevation model (DEM). Elevation grid used to automatically delineate drainage areas. ? River Reach Files (RF3). 1:100,000 scale coverage of water features digitized from aerial photography. ? USGS open water centerlines. USGS digitized centerlines through open water features. ? Base stream network. RF3 with open water feature boundaries deleted and USGS centerlines added in their place. ? USGS gage locations. Point locations of USGS stream gages. ? Water right database record locations. Point locations of entries in TNRCCs master water rights database. 147 ? TNRCC water right diversion points. Actual diversion and return flow points associated with individual water rights. ? Curve number grid. Gridded curve number data. ? Mean annual precipitation grid. Gridded estimate of mean annual precipitation trends. ? Texas water quality segments. TNRCC identified water quality segments and segment boundaries. A.5 WRAP PARAMETERS INTERFACE The WRAP Parameters interface is an ArcView 3.1 project file with a set of Avenue scripts designed specifically for the task of extracting the WRAP flow distribution parameters from geospatial data sets. The scripts are organized into two menus, "WRAP Parameters" and "WRAP Tools," and a set of buttons on the toolbar. Figure A.1 : WRAP Parameters Interface A.6 EXERCISE STUDY AREA AND DATA This exercise uses a study area within the Sulphur River basin. The Sulphur River is a tributary of the Red River located in Northeast Texas. This 148 exercise considers the watershed of the Middle and South Sulphur Rivers. These two branches join in the vicinity of Cooper, Texas. Figure A.2 shows this area. The red points are the eight WRAP model control points in the study area. The large body of water is Jim Chapman Lake. Figure A.2 : Exercise Study Area A smaller database has been extracted from the original Sulphur River Geospatial Database for use in this exercise. The coverages needed for this exercise are : ? Texmeshutm15.shp. A mesh of 7.5 minute quadrangles covering the state of Texas. ? Chapman.shp. A shapefile showing Lake Jim Chapman included for reference. 149 ? Exrdemalb. 1:24,000 scale DEM for the exercise study area. ? Exrrfiutm.shp. The RF3 coverage contained within the study area. ? Exrrfeutm.shp. The RF3 coverage surrounding the study area. ? Exrctlutm.shp. USGS open water centerlines within the study area. ? Exrsglutm.shp. USGS stream gages in the vicinity of the study area. ? Exrwruutm.shp. TNRCC water right records within the study area. ? Exrcngalb. Curve number grid for the study area. ? Exrpcpalb. PRISM mean annual precipitation grid for the study area. ? DRG files. TIFF image files of scanned USGS topographic maps. Also included in the exercise folder are the WRAP Parameters project file, ?wrap1117.apr,? and the text files used in projecting coverages between Albers and UTM projections, ?albtoutm.txt? and ?utmtoalb.txt?. This data is available for download in a WinZip archive at : http://www.ce.utexas.edu/prof/maidment/grad/hudgens/research.html This data is also available on the companion CD to this thesis, ?CD1,? in the folder ?exercise1.? The DRG files for the exercise are contained on the companion CD, ?CD2.? A.7 METHODOLOGY A.7.1 Using DRGs Digital Raster Graphics (DRGs) are scanned USGS 1:24,000 scale topographic maps. They provide a frame of reference for viewing other coverages in the database and they have relatively detailed mapped hydrography. Each topographic map covers a 7.5 minute latitude by longitude quadrangle. Each quadrangle map sheet has a name, but the USGS uses a more systematic method of locating each quad. Each quadrangle is identified by an alphanumeric code, combining the numerals of the latitude and longitude of the lower right 150 corner of the 1?x1? box with an alphabetical row and numerical column identifier for the individual quad. Figure A.3 : USGS Quadrangle Naming Convention To view the DRG files, first add texmeshutm15.shp to the View. The DRG files can be added as individual image files, but since you?ll need to work with several files the project file contains a script to make this work easier. The script ?wrap.addtopo? is embedded in the project file. You?ll use it to make a hot link between the texmeshutm15.shp quadrangles and the individual DRG files. Make texmeshutm15.shp the active theme. Now, under ?Theme/Properties?, click on the ?Hot Link? picture. In the selection window that comes up, set the field to ?Code,? the predefined action to ?Link to User Script,? and the script to ?wrap.addtopo.? Now when texmesutm15.shp is the active theme you?ll see the Hot Link tool become available for use. Before you can use the tool, however, you have to tell the script the directory file path to the DRG files. In the WRAP Tools menu, select the ?Set DRG File Path? item and enter the file path to the DRG files. Add the theme exrbasutm.shp and zoom the display to the basin 151 extent. Now, click on the Hot Link tool, and use the lightning bolt to select one of the quadrangle polygons in the study area. The ?wrap.addtopo? script automatically adds the image theme and zooms the display to the selected quadrangle. Each DRG file includes the entire map image including the map collar. To make it easier to view multiple DRGs simultaneously, the ?wrap.addtopo? script only displays a rectangle roughly conforming to the quadrangle boundary. If you want to know more about the topographic maps, you can add one of the DRG files to the view with the regular Add Theme tool and zoom into the map collar to read the map sheet information. A.7.2 Assembling the Control Points Before beginning any work towards generating flow distribution parameters you need to know where the specific points of interest, the model control points, in the basin are. In the WAM project, the contractor that models the basin decides where the control points are located. Typically, these will consist of stream gages, water right diversions points, return flow points, and water quality segment boundaries. Some of these points already exist as geospatial data. Stream gages are located in the original river basin database. Add the point theme, exrsglutm.shp to the view. The water right diversion points and return flow points are usually located by TNRCC and supplied in a point shapefile, in this case exrwruutm.shp. Add this theme to the view. Some control points may not be in these shapefiles, however. If the basin modeler decides to 152 place a control point at a site that?s not already located, they can indicate the point on a topographic map marking the exact location of the control point. The eight control points used in the original WRAP model of the Sulphur River basin in this sub-watershed were identified as A10-A80. The WRAP Parameters scripts only recognize integers as control point identifiers so you?ll identify these points as 6010-6080. Before entering the control points, you?ll need to set the control point shapefile name using the WRAP Tools menu item, ?Set Control Point Point Theme Names.? Set the control point shapefile name to exrfcputm.shp. Now, using the ?Add Control Point? tool from the WRAP Parameters toolbar, enter a control point at each location identified in Table A.1. CP ID Model CP Type Location 6010 A10 Stream gage USGS gage # 7342500 6020 A20 Diversion point Water right 4800 6030 A30 Diversion point Water right 4395 6040 A40 Diversion point Water rights 4797, 4798, 4799 6050 A50 Return flow See map in image file ?cp6050.gif? 6060 A60 Return flow See map in image file ?cp6060.gif? 6070 A70 Diversion point Water right 4795. See map in image file ?cp6070.gif? 6080 A80 Diversion point Water right 4796 Table A.1 : Exercise Control Points 153 A.7.3 Building the Stream Network Next, you?ll build a digital stream network representing the channel hydrology in the basin. This stream network serves two purposes. First, it can be used to condition the DEM to better reflect the mapped hydrography given in the RF3 coverages. Secondly, it can be used to establish connectivity among points in the basin. To accomplish these tasks, the stream network must be defined as a single-line flow path with each channel segment flowing into only one downstream segment. Three types of corrections must be made to the existing RF3 stream coverage. First, open water features are removed from the RF3 coverage, and USGS centerlines are inserted in their place. Also, braided channels are reduced to one channel segment. Second, smaller tributaries are added to the stream network. RF3 is defined at a map scale of 1:100,000. Smaller tributaries can be identified from the 1:24,000 scale DRGs. Adding these tributaries helps to ensure the most accurate delineation of drainage areas by the DEM. Adding all the blue lines from every DRG in a river basin would be an imposing undertaking, so this effort is focused on the immediate vicinity of each control point. Third, the topology of the line theme is corrected by closing any gaps between connecting arcs and deleting any dangling nodes in the interior of the network. First, you?ll remove the open water features from RF3 and add the USGS centerlines. Add the themes exrrfiutm.shp and exrctlutm.shp to the view. Make exrrfiutm.shp the active theme and click on the Theme Query tool. In the query dialog that follows, query the ?Reachtype? field for the attributes ?R?,?S?, and 154 ?T.? These codes identify ?regular,? ?start,? and ?terminal? reaches in RF3. In this exercise, there are no terminal reaches in the basin, so the ?T? attribute will not be listed. Use the ?Theme/Convert to Shapefile? menu item to save these selected reaches as a new theme, exrstputm.shp. Now, use the WRAP Tools menu item, ?Merge Themes? to merge exrstputm with exrctlutm.shp. Name the result, exrswvutm.shp. Now you have a working version of the stream network to begin editing. Copy exrrfeutm.shp to a new shapefile called exrswxutm.shp. Now you can delete the RF3 attributes from each of the stream network working themes. Use the WRAP Tools menu item ?Strip Fields.? This function will delete all but the selected fields, making the file sizes smaller and the themes easier to edit. You need only retain ?Shape? and one other identification field. You may notice that RF3 does not show Jim Chapman Lake. This reservoir only began impounding water in 1991. Apparently the sources used in creating RF3 pre-date this time. This is an important feature of the study area. It is the location of the majority of water storage and use in the watershed. The shapefile, chapman.shp, is included with the exercise data so you can reference the location of the reservoir. There are several ways to go about editing the stream network in an organized manner. A suggestion is to work one quadrangle at a time, keeping track of which quadrangles have been finished, and, most importantly, saving your edits after each. Several ArcView tools are used in this process. Figures A.4 and A.5, below, reference the standard ArcView tools and the WRAP Parameters project tools used in this work. 155 Figure A.4 : ArcView Editing Tools Figure A.5 : WRAP Parameters Tools First, make exrswvutm.shp the active theme, and, under ?Theme/Properties?, click on the Editing properties icon. In the editing properties dialog box turn both the general and interactive snapping features on by checking the boxes next to them. Do the same for exrrfeutm.shp. Notice that the ?Snap Tolerance? tool now appears in the view window. Before each edit, be sure you use this tool to set the snapping tolerance to an appropriate extent. Now, for each quadrangle, go through the following steps : 156 1. With exrswvutm.shp the active theme, use the ?Show Dangling Nodes? tool or menu function to identify any disconnects in the stream network. Zoom in and connect the endpoints using the ?Vertex Editor? tool. 2. Identify any braided channels. Reduce each braided channel system to a single streamline. Using the DRGs as a reference, identify a single path through the braided channel system and delete the other arcs. 3. Now, for each control point in the quadrangle, zoom into the immediate vicinity. Use the DRG to identify any tributaries not already in the RF3 coverage. Add all streams surrounding the control point. This will ensure accurate definition of the control point?s drainage area. Figure A.6 shows an example of this for one control point. The highlighted arcs have all been added. Where a point lies near the basin boundary, you may also need to add streams that flow away from the basin drainage area. You can do this by adding the streams to the exrrfeutm.shp coverage. 157 Figure A.6 : Streams Added to the Base Network First, set both the general and interactive snapping tolerances to an appropriate extent. An appropriate extent is a radius smaller than the distance between adjacent vertices in the RF3 line theme. Now, use the ?Draw Line? tool to digitize the stream. The general and interactive snapping features should be used as necessary to ensure that the added line?s endpoints coincide with existing line vertices and endpoints. 158 4. As you are adding tributaries, you must correct the topology of the line theme. A line theme has correct topology when each node of a line connects to a node of a different line. Nodes that do not connect to other nodes are dangling nodes. In a stream network, headwater reaches will have dangling nodes by definition. These are not corrected. As you add tributaries, however, you create dangling nodes in the interior of the network. Each time you snap the endpoint of an added tributary to the middle of an existing stream arc, a dangling node is created, since the snapped endpoint is not actually connected to another node (it is snapped to an interior vertex.) Correct these interior dangling nodes with the ?Erase Interior Dangling Nodes? tool. 5. Look closely for any large loops and parallel connections in the RF3 channel system. Dead channels and digitizing errors may create large loops in the channel network. These should be removed so that the resulting network has unique downstream flow paths. 6. Finally, use the ?Show Dangling Nodes? tool to double check that you have not added any interior dangling nodes within the quadrangle. When you have finished editing the stream network save it as exrsfvutm.shp. Also save the edited exterior stream network as exrsfxutm.shp. 159 Figure A.7 : Stream Network, Before Editing (above) and After (below) 160 A.7.4 Processing the DEM The DEM is in the TSMS Albers projection. You?ll need to project the themes that you?ve created so far to this projection. Use the projection file ?utmtoalb.txt? to project exrfcputm.shp, exrsfvutm.shp, and exrsfxutm.shp. Arc : shapearc exrfcputm exrfcputm Arc : shapearc exrsfvutm exrsfvutm Arc : shapearc exrsfxutm exrsfxutm Arc : project cover exrfcputm exrfcpalb utmtoalb.txt Arc : project cover exrsfvutm exrsfvalb utmtoalb.txt Arc : project cover exrsfxutm exrsfxalb utmtoalb.txt Arc : copy exrfcpalb tmp1 Arc : copy exrsfvalb tmp2 Arc : copy exrsfxalb tmp3 Arc : dropitem tmp2.aat tmp2.aat Enter the 1 st item : fnode_ Enter the 2 nd item : tnode_ Enter the 3 rd item : lpoly_ Enter the 4 th item : rpoly_ Enter the 5 th item : end Arc : dropitem tmp3.aat tmp3.aat Enter the 1 st item : fnode_ Enter the 2 nd item : tnode_ Enter the 3 rd item : lpoly_ Enter the 4 th item : rpoly_ Enter the 5 th item : end Arc : arcshape tmp1 point tmp1 Arc : arcshape tmp2 line tmp2 Arc : arcshape tmp3 line tmp3 Arc : kill tmp1 all Arc : kill tmp2 all Arc : kill tmp3 all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename tmp1.shp as exrfcpalb.shp ArcView : Rename tmp2.shp as exrsfvalb.shp ArcView : Rename tmp3.shp as exrsfxalb.shp 161 A.7.4.1 Burning the DEM with the Vector Stream Network In the WAM project, some control points represent very small drainage areas. To ensure that the flow distribution to these points is the best possible estimate, the drainage area must be defined as accurately as possible. DEMs sample elevation data at regularly spaced points. A 1:250,000 scale DEM samples elevations at about every 90 meters on the ground, and a 1:24,000 scale DEM at about every 30 meters. It is possible that small drainage features will not be correctly represented within this mesh of terrain data. 1:250,000 scale DEMs especially tend to over or under-estimate small drainage areas, particularly in flat, coastal areas. Figure A.8: Conceptual View of the Stream Burning Process To ensure the most accurate drainage area delineation, the combined exterior and interior stream networks are burned into the DEM as shown in Figure A.5. In processing a basin for the WAM project, the exterior stream network would first be clipped to an extent just greater than the DEM. Since this study 162 area is relatively small, you?ll skip this step. Use the WRAP Tools menu item, ?Merge Themes,? to merge exrsfvalb.shp and exrsfxalb.shp. Name the output shapefile exrsbnalb.shp. Burn the stream network, exrsbnalb.shp, into the DEM using the WRAP Parameters menu item, ?Burn Stream Network.? First set the ?Analysis/Properties.? Set both the analysis extent and cell size to ?same as exrdemalb.? The output grid, burndem, is a temporary grid. You need to make of copy of this grid and save it as a permanent grid before you delete the theme from the view, otherwise it will be lost. Use the ?Copy? option under File/Manage Data Sources to make a copy named exrbdmalb. A.7.4.2 Fill, Flow Direction, and Flow Accumulation Process the burned DEM with the fill, flow direction, and flow accumulation functions. These are all included in the WRAP Parameters menu. Again, the resulting grids, filldem, fdr, and fac are temporary grids. Copy them into permanent grids : exrfdmalb, exrfdralb, and exrfacalb respectively. A.7.5 Creating the DEM Stream Network Implicit in the flow direction and flow accumulation grids of the DEM is a stream network based on the Eight Direction Pour Point model. Typically, this stream network is explicitly defined as a grid, by applying a threshold drainage value to the flow accumulation grid. In this project, you will define the DEM stream network as a line theme, created by tracing the flow direction grid from each headwater node of the vector stream network, exrsfvalb.shp. Use the WRAP Parameters menu item, ?Define Flow Direction Stream Network.? Two 163 temporary shapefiles are created in the working directory by this function, headwaters.shp and centered.shp. These may be deleted. The resulting shapefile fdrstrmnet.shp has one polyline extending from each headwater node to the basin outlet. Now you need to segment these overlapping lines into the individual stream segments. You can do this in ArcInfo using the ?clean? command. You must be careful to use the smallest possible fuzzy tolerance when cleaning the coverage, so that no unwanted changes are made. To do this, enter a very small fuzzy tolerance, such as 0.001, and the clean function will default to the minimum tolerance allowed by the coverage. Take a look at this default value. It should be smaller than the grid cell size of the DEM by at least an order of magnitude. If it approaches the DEM cell size, the stream segment vertices may actually be moved by ?clean,? creating unwanted modifications in the network. Arc : shapearc fdrstrmnet temp Arc : clean temp temp # 0.001 line Arc : build temp line Arc : arcshape temp line temp Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as exrsdmalb.shp Next, run the WRAP Parameters menu function ?Build Stream Network Connectivity? on the DEM stream network, exrsdmalb.shp. This function assigns a unique arc ID to each stream segment, then attributes each segment with the arc ID of the next downstream segment. Now you have a true stream network : each arc points downstream and connects to only one downstream arc, with each arc knowing the identity of that downstream arc. 164 A.7.6 Attaching Control Points to the Stream Network The next step is to attach the control points to the DEM stream network. The WRAP Parameters menu function, ?Snap Control Points,? will do this for the control point coverage. First, set the name of the snapped control point coverage to exrscpalb using the WRAP Tools menu item, ?Set Control Point Theme Names.? There are two tricks to using the snap control points function. First, when the script executes, each control point finds the nearest arc to itself. The Avenue command that does this works on the basis of screen pixel distance. It is only able to find arcs within a radius of three screen pixels from the point. To make sure each point is able to find an arc, first zoom the display to the extent of the stream network theme. Then click on the ?Zoom Out? tool twice. Experience with the project so far has shown that, at this view extent, each control point will be able to find an arc. The script will ask you for a snapping tolerance. Set this to 100 meters. Second, after snapping the points you should review the snapped coverage to make sure that they are all correctly located. Points that are near stream junctions are very prone to being snapped incorrectly. The DEM stream network sometimes deviates from the original vector network representation in the vicinity of stream junctions, and the closest arc in the DEM stream network may not be the same as the arc that the control point was originally placed next to. Compare the original stream network and control points with the DEM stream network and snapped control points. Incorrectly snapped control points may be fixed using the 165 ?Add Snapped Control Point? tool. Delete the incorrectly snapped control point and use this tool to replace it on the proper stream segment. Take a look at the attribute table of the snapped control points. As each control point is snapped it is attributed with the arc ID that it is snapped to and it?s percent distance along that arc. A.7.7 Creating Parameter Data Sets Now that the control points are properly located along the basin stream network, you are almost ready to read the flow distribution parameters. Drainage area already exists in the form of the flow accumulation grid. The curve number and precipitation grids, however, require some processing. These grids contain an estimation of the parameter value, curve number or annual mean precipitation, over the area of each individual grid cell. To calculate the average curve number and precipitation over several sub-watersheds you sum up the products of each individual drainage area and parameter value and divide by the total area. This formula can be reproduced in GIS using a weighted flow accumulation function. )4.( 1)( ),( A ionflowdirectlationflowaccumu CNCNionflowdirectlationflowaccumu CNmean + + = The weighted flow accumulation sums the values of a grid over each flow accumulation grid zone. The weighted flow accumulation grid is then divided by the regular flow accumulation grid. These calculations are made on a cell-by-cell basis, so the parameter value of the current for cells with no flow accumulation. Each cell of the resulting grid then contains the average parameter value over the upstream drainage area. 166 The WRAP Parameters menu items, ?Make Average Curve Number Grid? and ?Make Average Precipitation Grid? apply this function to the original curve number and precipitation grids. Add the grid themes exrcngalb and exrpcpalb. Create the average parameter grids for each. The resulting grids, avgcn and avgpcp, should be copied into permanent grids : exracnalb and exrapcalb. A.7.8 Making the Control Point Network Diagram Once the control points are snapped to an ordered stream network, you can determine the connectivity among control points using the WRAP Parameters menu item, ?Make a Network Diagram.? For each control point, this script traces the stream network to the next downstream control point. The ID of this downstream control point is added to the attribute table of the snapped control points. At the same time a new line theme is built connecting each control point to it?s downstream point. This theme is output as network.shp. The theme should be renamed exrnetalb.shp. A.7.9 Reading the Flow Distribution Parameters At last! You?re ready to read the flow distribution parameters. First you?ll need to go to the WRAP Tools menu, click on ?Set Parameter Grid Theme Names,? and do just that. Leave the flow length grid theme name as ?none.? Some contractors have used an added parameter of channel length in simulating the flows at control points in the WRAP model. This parameter is not used in this exercise, but, if needed, the parameter grid theme name would be entered here. The WRAP Parameters menu item ?Report Control Point Parameters,? queries the flow accumulation, average curve number, and average precipitation 167 grids at the location of each control point. The values are output in a new point shapefile, parameters.shp. Rename this shapefile as exrparalb.shp. If you have built the control point network with the snapped control point theme, then the IDs of the downstream control points are also carried over into the new attribute table. The flow accumulation value is automatically translated from number of grid cells into the drainage area with units of square miles. These are all the parameters you?ll need to prepare an input watershed parameters file for the RECORDS preprocessor to WRAP. A.7.10 Defining the Incremental Watershed Boundaries The watershed boundaries are delineated from the DEM using the WRAP Parameters menu item ?Delineate the Incremental Watersheds.? Use the ?Id? fields for the actual control point identifiers. This creates a polygon shapefile of the watershed boundaries, watrshed.shp. Rename this shapefile as exrwsdalb.shp. Open the theme attribute table and you?ll notice that you actually have more polygons than control points. The watersheds are actually created from the flow direction grid as separate grid zones. Small ?dangling polygons? are created when these grid zones are translated into polygons. They are deleted by running the WRAP Parameters menu item ?Dissolve Dangling Polygons.? Each polygon has it?s area automatically calculated in units of square miles. The average curve number and average precipitation values may be calculated over the incremental watersheds using the WRAP Tools menu item, ?Average Grid by Polygons.? 168 A.7.11 Quality Control What large task would be complete without quality control? Quality control of the watershed parameters is important. These parameters determine how flows at each control point are simulated in the basin model, affecting real world decisions about water usage and availability. Drainage area is the most important parameter in the flow distribution calculations and the quality control process focuses on it. The precipitation and curve number parameters are accepted as being the best possible estimates given the geosaptial data sources currently available. At it?s most rigorous, quality control of the drainage area parameter would involve checking each watershed boundary against the topographic maps. For a real river basin, however, this would be a very difficult task. Large river basins are spread across hundreds of quadrangles and have hundreds of sub-watersheds. Small watershed boundaries are easily checked against the DRGs, but, as the drainage area increases, this becomes more difficult, as the boundary is spread over several quadrangles. A quality control procedure has been devised that directly checks both large and small drainage areas, and indirectly checks the intermediate areas. The USGS gages typically have relatively large drainage areas. The flow accumulation drainage area value for each gage may be checked against it?s USGS reported drainage area. Compare the drainage area you derived for control point 6010 (USGS gage 7342500) against the USGS reported value of 527 square miles. The values should agree within one or two percent. If the values disagree 169 to a larger extent, make sure that you have located the point representing the gage correctly. Experience with this project to date suggests that, using 1:24,000 scale DEMs, if the DEM stream network accurately reproduces the vector stream network and the control points are correctly located on the DEM stream network, then the resulting drainage areas are true to the 1:24,000 scale topography. The entire DEM stream network should be checked against the original vector stream network to ensure that there is no short-circuiting of the DEM stream network. Short-circuiting occurs in the DEM stream network when arcs in the vector stream network are located within one grid cell?s distance of one another. When this happens, the flow direction grid may jump from one stream to the other if the DEM defines that route as the direction of steepest descent. If this occurs between large streams it can introduce large errors into the computed flow accumulation grid and the final flow distribution parameters. 170 Figure A.9 : Example of Short-Circuiting Effect Figure A.9 shows a stream junction in the Sulphur Basin. The DEM short-circuits the vector stream network causing the DEM stream junction to be located upstream of where the vector stream network locates it. Suppose a control point is to be placed at point ?A.? When the control point theme is snapped, this point will be snapped to the closest arc on the DEM stream network, at point ?B.? Note, however, that the flow accumulation at point B will include the upstream drainage from both the North and South forks. To best represent the drainage area for point A, point B can be deleted and replaced with point ?C? using the ?Add Snapped Control Point? tool. The drainage area defined for point C will slightly under-estimate the actual drainage area of point A. If this is a large 171 discrepancy, the user must modify the original vector stream network by separating the two stream branches further apart than one grid cell so that the DEM will not short-circuit at this point and reprocess the DEM. Check your exrsdmalb.shp against exrsfvalb.shp. If there are any large- scale short-circuits in the DEM stream network you?ll have to go back and edit exrsfvalb.shp so that the vector arcs are separated by more than one grid cell. If you?ve had to make modifications to the stream network, go all the way back to Section A.7.4, rebuild the burned DEM, and continue from there. Finally, you can actually check small watershed boundaries against the DRGs. Small watersheds are most susceptible to errors in the drainage area definition. Experience at CRWR has shown that, as a rule of thumb, watersheds defined from a 1:250,000 scale DEM as smaller than 1,000 grid cells should be checked. Since we're using a 1:24,000 scale DEM, let's be safe and check anything less than 10,000 cells. First, you'll need to project the watersheds into UTM so you can check them against the DRGs. Unfortunately, when you project the watersheds, before you can build the projected coverage polygons, you'll have to clean the coverage. The clean process wipes out any attributes in the resulting polygon attribute table. This means that you won't know which polygon belongs to which control point. So, in order to still be able to display the control point identifier with each watershed boundary, just build the projected coverage as a line coverage. Arc : shapearc exrwsdalb exrwsdalb Arc : project cover exrwsdalb exrwsdutm albtoutm.txt Arc : build exrwsdutm line Arc : copy exrwsdutm temp 172 Arc : arcshape temp line temp Arc : kill temp all ArcView : In View menu ?File,? click on ?Manage Data Sources? ArcView : Rename temp.shp as exrwsdutm.shp Now, check the smaller watersheds against the DRGs. The 1:24,000 DEMs define watersheds very accurately. There are three ways that the drainage area might be in error : 1. The control point is not correctly located, 2. A nearby tributary that defines part of the drainage area to the point has not been added to the stream network (and therefore not burned into the DEM), 3. Or, the DEM cannot accurately define the drainage area. With the 1:24,000 scale elevation data, most errors in drainage area result from imprecise control point location. Make sure the control point is correctly located, and, if adjusted, re-run the watershed definition. If the watershed boundary captures a tributary that it should not, or fails to capture a tributary that it should, make sure that this tributary is present in exrsfvutm.shp. If it?s not, go all the way back to section A.7.3, edit the stream network, and start over from there. If neither of these remedies results in an accurate drainage area, then the last resort is to delineate the watershed boundary yourself! Drainage areas can be manually delineated using the DRG topography as a reference. Under the View menu, select "New Theme." Create a new polygon theme and use the Draw Polygon tool to delineate the correct watershed boundary. When you are done, convert this shapefile to a coverage, project it back into Albers, and build it as a polygon coverage. Now, each polygon will be 173 attributed with it?s area, albeit in square meters. You?ll have to make the conversion to square miles yourself. Finally, you can calculate the incremental average curve number and precipitation values for the polygons as described in Section A.7.10. A.8 RESULTS When you?re satisfied with your quality control, compare your results to the following. Your parameters will not exactly match these (the exact values depend on the exact control point locations), but they should be very close. Figure A.10 : Control Point Network and Watersheds 174 Table A.2 : Control Point Parameters A.9 EXERCISE REFERENCES. TNRCC, 1999. WAM : Water Availability Modeling, an Overview. Internet Site : http://www.tnrcc.state.tx.us/admin/topdoc/gi/245/ 175 Appendix B : Exercise 2 176 B.1 EXERCISE TABLE OF CONTENTS B.2 Introduction B.3 Goals of the Exercise B.4 Exercise Data B.5 Exercise Study Area B.6 Methodology B.6.1 Using RECORDS to Distribute Naturalized Streamflows B.6.2 Using WRAP-SIM B.6.3 Formatting Output in TABLES B.6 Water Availability Planning B.7 Exercise References B.2 INTRODUCTION The Water Rights Analysis Package (WRAP) was developed at Texas A&M by Dr. Ralph Wurbs and David Dunn. It is currently being used to make water rights reliability assessments in all Texas river basins with the exception of the Rio Grande. Several versions of WRAP have been produced and it continues to evolve to meet the requirements of the Senate Bill 1 modeling project. For this exercise we?ll use the November 1998 version. The WRAP modeling package is a set of Fortran programs : RECORDS, WRAP-SIM, and TABLES. RECORDS is a preprocessor that can be used to develop naturalized streamflows at control points with unknown flow records, given the naturalized streamflows at known points, such as gages. WRAP-SIM is the actual simulation model. TABLES is a postprocessor used to organize the voluminous model output into user-specified formats. 177 Figure B.1 : WRAP Modeling Package Dr. Wurbs built the model, and he describes it thus : WRAP is a tool for assessing water availability for a river basin, or multiple-basin region, under a priority-based allocation system, such as the Texas water rights system. The simulation model is designed for evaluating capabilities for meeting existing and proposed water rights requirements and determining the unappropriated streamflows available for additional new permit applicants. WRAP-SIM performs sequential monthly water volume accounting computations associated with meeting water management /use requirements during a specified hydrologic period-of-analysis. Constant annual water use targets, which vary seasonally over the 12 months of the year, are combined with sequences of naturalized streamflows and reservoir evaporation rates representing basin hydrology. Water rights requirements include diversions, reservoir storage, instream flow needs, return flows, and hydroelectric power generation. The postprocessor program TABLES provides capabilities for organizing and summarizing WRAP-SIM simulation results by a variety of user-specified tables and reliability indices. The public-domain software package is generalized for application to any river basin, with input files being developed for the particular river/reservoir/use system of concern. (Wurbs, 1998) A river basin system is represented in WRAP by the following components : ? Control points provide a way to specify locations in the model, based on upstream/downstream connectivity. Other components are associated with 178 control points to reference their locations. Multiple components can be aggregated at a single control point. ? Basin hydrology is described by streamflows and net evaporation rates at each control point for each month of the period of analysis. Streamflows may be reported as either naturalized, unappropriated, or regulated flows. Naturalized streamflows are those calculated for each control point with the effects of man removed. Naturalized streamflows are input into the WRAP- SIM model. Regulated streamflows reflect the effects of reservoir and water rights demands. Unappropriated flows are the streamflows remaining after all required streamflow depletions are made. Regulated and unappropriated flows are output from the model. ? Water rights are basically described by diversion and/or storage amounts, types of use, and dates of priority. Specifically, each water right record consists of : 1. a control point location 2. annual diversion amount 3. reservoir storage capacity 4. priority number 5. type of use 6. return flow factor and return flow control point location The type of use (e.g. municipal, industrial, agricultural) is used to break down the annual diversion amount into monthly targets. To do this, the user defines monthly distribution factors for each type of water right. These water rights apply only to diversion of surface waters. Texas has no water rights system for pumping of groundwater. The priority date is the date the water right was first obtained. The appropriations doctrine upon which Texas water law is based says, "first in time is first in right," which means that the water right with the earliest priority date has the highest ranking among all water rights if a water shortage means that not all the rights can be satisfied from existing water supplies. Conversely, the water right with the most recent priority date has the lowest ranking and will be the first water right to be cut off if supply is limiting. ? Reservoirs provide storage capacity for water rights. A surface area/storage capacity relationship is used to calculate evaporation losses. ? Return flows represent water discharged back into the stream after use, from a water treatment plant for example. ? Hydroelectric power generation can be represented in the model as monthly energy targets and plant efficiencies. The model will try to satisfy the energy targets based on available streamflow and reservoir storage. 179 ? Reservoir system operating rules define the operations of complex reservoirs with multiple water rights and priority dates. RECORDS, WRAP-SIM, and TABLES all use text input files. These files must be formatted correctly or they?ll cause incorrect output or hang up the programs. When you need to make changes to the input files in the exercises below, be sure to follow the field formatting. Within the fields, entries are right-justified, except for titles and comments. If one of the programs does hang up, remember that you can use Ctrl-C to interrupt execution in DOS. B.3 GOALS OF THE EXERCISE The intent of this exercise is to familiarize you with water availability modeling using the Water Rights Analysis Package (WRAP). By the end of the exercise, you will be able to : ? Use the RECORDS preprocessor to distribute naturalized streamflows from gaged locations to ungaged points ? Perform a basic water availability simulation using WRAP ? Use the TABLES postprocessor to format WRAP output ? Use WRAP as a tool to make assessments of water availability for future demands B.4 EXERCISE DATA The WRAP program elements and the files needed for this exercise can be downloaded at: http://www.ce.utexas.edu/prof/maidment/grad/hudgens/research.html 180 The data is also included on the companion CD to this thesis, ?CD1,? under the folder ?exercise2.? You should have the following files for the exercise : ? records.exe = RECORDS pre-processor ? sim.exe = WRAP simulation program ? tab.exe = TABLES Post-processor ? ctcp.txt = input file for RECORDS ? fd.txt = input file for RECORDS ? wp.txt = input file for RECORDS ? inev.txt = input file for RECORDS ? chapman1.dat = WRAP-SIM data input file ? chapman2.dat = another WRAP-SIM data input file ? example.ext, example1.txt, example2.txt, example3.txt = examples of TABLES input files B.5 EXERCISE STUDY AREA In this exercise, we'll apply WRAP to a basin model. The Sulphur river basin is located in northeast Texas. Figure B.2 shows the Middle and South Sulphur Rivers above USGS gage 7342500 near Cooper, Texas. 181 Figure B.2 : Exercise Study Area The red points are the control points (8 of them) that we?ll use to model this basin. The most downstream control point, A10, is the USGS gage. The model includes 13 water rights (that is, thirteen separate diversions, some of which belong to the same water right number) and 5 reservoirs in this watershed. The large reservoir, modeled as control point A40, is Lake Chapman, which began impounding water in 1991. Water from this basin and from Lake Chapman is currently permitted primarily for water supply to cities in the area, and as far away as Irving, TX. Table B.1 gives a breakdown of the water rights in this watershed: 182 Water Right Control Point Permittee 4800 A20 City of Cooper 4395 A30 City of Cooper 4799 A40 City of Irving 4798 A40 North Texas MWD 4797 A40 Sulphur River MWD 4797 A40 City of Commerce 4795 A70 City of Wolfe City 4796 A80 Webb Hill Country Club Table B.1 : Water Rights in the Study Area Notice that not all control points are water rights. A10 is the USGS gage, and control points A50 and A60 are points where return flows from several nearby towns are put into the system. Return flows may represent outflows from water treatment and industrial processes or they may also be used to input increased flows in areas that use groundwater as water supply, then return it to the surface. B.6 METHODOLOGY B.6.1 Using RECORDS to Distribute Naturalized Streamflows Naturalized streamflows are flows computed from historical data with the influences of human activity removed. Speaking mathematically : Naturalized streamflow = Historical streamflow + Diversions - Return flows + Reservoir depletions +/- Changes in runoff due to changes in land use 183 Note that while other models may be helpful in preparing naturalized streamflows (e.g. reservoir simulation models), these calculations require a lot of old-fashioned research and work before even beginning to use a water availability model such as WRAP. In our basin, the naturalized flows for the years 1940- 1996 have been determined by the contractors on the TNRCC Water Availability Modeling Program, R.J. Brandes and Associates, in the case of the Sulphur basin. RECORDS develops WRAP hydrology records (streamflows and evaporation rates) at specified control points based on given records at other control points. Several options are available for methods of distributing naturalized streamflows from known to unknown points : ? Flow distribution equation. This equation can be used in several ways : o First, as a regression equation where the coefficients a,b, and c may be determined from a regression analysis of the results of a watershed precipitation-runoff model. ()cQaQ b gagedungaged += o Second, with b=1.0 and c=0, the equation may be used to distribute flows by defining the coefficient, a, as a ratio of the watershed parameters. Most often, a, is set equal to the drainage area ratio between the two points, but it could be defined as a more complex function of other watershed parameters. gaged ungaged A A a = or 4321 N gaged ungaged N gaged ungaged N gaged ungaged N gaged ungaged Other Other CN CN M M A A a ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? = where M = mean annual precipitation and CN is the average curve number for the upstream drainage area. 184 ? The modified NRCS CN method is used in this exercise. This has the following steps : o Find the precipitation index, P, for the known (gaged) point, from the NRCS curve number equation () 10 1000 8.0 2.0 2 ?= + ? == CN SwhereA SP SP PAQ known o Find the precipitation index, P, for the unknown (ungaged) point, by adjusting P for the known point by the ratio of mean precipitation between the two watersheds ? ? ? ? ? ? ? ? = gaged ungaged gagedungaged M M PP o Use the NRCS curve number equation above to find Q at the unknown point. At CRWR, we use GIS to determine the drainage area, mean precipitation, and curve number for each control point in a basin model. This data becomes one of the input files for RECORDS so that the modified NRCS method can be used to distribute flows. So, let?s run RECORDS to prepare the hydrology input for our basin. First, let?s get familiar with the input files. Four files are needed, they are : 1. Counter (CT) Records and Control Point (CP) Records, "CTCP.txt" **CT IS THE COUNTER OF CONTROL POINTS, ETC. CT 8 7 8 1 57 0 **A10 IS SOUTH SULPHUR RIVER NR COOPER, GAGE # 7342500 CP A70 A60 0 0 5 CP A10 OUT 0 0 0 A70 CP A20 A10 0 0 5 A70 CP A30 A10 0 0 5 A70 CP A40 A10 0 0 5 A70 CP A50 A40 0 0 5 A70 CP A60 A40 0 0 5 A70 CP A80 A60 0 0 5 A70 185 The CT record identifies how many records are present in each input file. Here it says, in order, 8 control points, 7 flow diversion records, 8 watershed parameter records, 1 control point with evaporation records, 57 years of hydrologic data, and the last "0" is a switch controlling the use of the multiplication factors in the CP records. The CP records define the connectivity and flow distribution methods among the control points. These records show: the control point, the next downstream control point (or OUT if it?s an outlet), a multiplication factor for the inflow values (a "0" means to default to a value of 1), a multiplication factor for evaporation rates (a "0" means to default to a value of 1), a switch indicating the use of either total or incremental watershed areas (here the field is left blank meaning total watersheds are used), the "5" indicates that the NRCS flow distribution method is used ("0" means the values are input for the known point), and finally the location of the evaporation records ("A70" means they are copied from the known values given for CP A70). 2. Flow Distribution Specifications, "FD.txt" Our version of this file is short and to the point. We are using the total upstream drainage areas and the modified NRCS method to distribute flows, so there?s not much required here. For each record above we?ve simply input the unknown point, and the known point (A10) from which we?ll be distributing flows. FD A70 A10 0 FD A20 A10 0 FD A30 A10 0 FD A40 A10 0 FD A50 A10 0 FD A60 A10 0 FD A80 A10 0 3. Watershed Parameters, "WP.txt" The watershed parameters are provided here: ** CP AREA CN PRECIP WP A70 1.03 72.8 42.0 WP A10 541.01 69.6 42.8 WP A20 1.66 71.5 44.0 WP A30 12.44 69.9 43.0 186 WP A40 504.58 69.4 42.7 WP A50 106.34 69.9 42.4 WP A60 223.33 69.7 42.2 WP A80 0.29 70.0 42.0 The area is given in square miles, and the mean annual precipitation is in inches. The CN value ranges from 0 to 100. The precipitation and CN values are averages over the upstream drainage area from the given control point. 4. Inflow and Evaporation Records, "INEV.txt" Here you have the naturalized streamflows (IN) and net evaporation rates (EV) for each known point, listed by month for each year of record. Streamflows are given in acre-ft./month. Net evaporation rates are defined here as the difference in gross reservoir evaporation minus precipitation, so a positive value indicates a positive net evaporation. These values are given in ft./month. This is an excerpt from our file : ** CP YEAR JAN FEB MAR APR MAY JUN ** JUL AUG SEP OCT NOV DEC IN A10 1940 170 2809 2376 44621 26170 22500 IN 0 0 14608 276 586 47 31054 57673 EV A70 1940 0.03 -0.11 0.21 -0.27 -0.11 0.16 EV 0 0 0.23 0.55 0.52 0.28 -0.32 -0.31 IN A10 1941 16241 23605 63490 57131 83575 30013 IN 0 0 9076 2378 809 562 4512 10955 EV A70 1941 0.11 -0.10 0.01 -0.32 0.03 -0.35 EV 0 0 0.18 0.36 0.44 -0.21 0.14 -0.06 What this says is that the naturalized flow at gage A10 in year 1940 is 170 acre-ft/mo in January, 2809 acre-ft/mo in February, ?, 57673 acre-ft/mo in December. The net evaporation at control point A70 is 0.03 ft/mo in January, -0.11 ft/mo in February, etc. The values for 1941 follow those for 1940, and so on until all data for naturalized flow at point A10 and net evaporation at point A70 have been specified. Let's run RECORDS on this data. What you are doing now is determining the evaporation and the estimated naturalized flow at each control point in the 187 basin. Double-click on the Records.exe file (or run it from an MS-DOS window) and answer the prompts. Be sure to call your output file, "Chapman1.hyd", this is necessary for the next step. Your run should look like this : Figure B.3 : RECORDS Run RECORDS should run very quickly and output the file you specified. Your output file should look like this : IN A70 1940 1. 8. 7. 94. 57. 50. IN 33. 1. 2. 1. 67. 120. IN A10 1940 170. 2809. 2376. 44621. 26170. 22500. IN 14608. 276. 586. 47. 31054. 57673. IN A20 1940 2. 12. 11. 157. 95. 82. IN 55. 2. 4. 1. 111. 200. IN A30 1940 5. 69. 58. 1049. 618. 533. IN 347. 8. 15. 2. 733. 1353. IN A40 1940 138. 2517. 2123. 41056. 24004. 20617. IN 13343. 230. 505. 33. 28515. 53135. 188 IN A50 1940 35. 555. 470. 8728. 5126. 4409. IN 2866. 56. 118. 10. 6080. 11275. IN A60 1940 62. 1109. 936. 18000. 10531. 9047. IN 5859. 103. 224. 15. 12507. 23289. IN A80 1940 0. 1. 1. 23. 14. 12. IN 8. 0. 0. 0. 16. 30. EV A70 1940 0.030 -0.110 0.210 -0.270 -0.110 0.160 EV 0.230 0.550 0.520 0.280 -0.320 -0.310 EV A10 -1940 A70 EV A20 -1940 A70 EV A30 -1940 A70 EV A40 -1940 A70 EV A50 -1940 A70 EV A60 -1940 A70 EV A80 -1940 A70 This is the hydrology input file for WRAP-SIM. Now, all control points have streamflow and evaporation records for each hydrological year. Notice, that for evaporation rates, we have just copied values from the nearest known point. The evaporation rates are taken from values computed by the Texas Water Development Board (TWDB) that represent the average value over a 1 o X 1 o quadrangle. You can import the text output of the hydrology file (Chapman1.hyd) into Excel by doing the following. Select the records you want to export in the hydrology file and copy them into a new text file. Be sure you save this new file as a .txt text file (not a Word document). Then, in Excel, go to File/Open, and set the "files of type:" window to Text Files. When you open the file, Excel will start its Text Import Wizard. In Step 1, choose "Fixed Width." In Step 2, you can modify the field widths if you like. Finally, choose the "General" column data format in Step 3, and you?re done! 189 B.6.2 Using WRAP-SIM The WRAP model is built around a monthly water availability balancing routine. The whole program is structured as follows: ? Read input data ? read all input records except streamflows and evaporation rates ? rank water rights in priority order "First in time is first in right" ? other input data manipulations ? Annual loop ? read streamflow and evaporation records for the year ? Monthly loop ? Water right loop ? check streamflow availability ? perform water balance computations ? adjust available streamflows ? write water right output records ? write control point output records ? write reservoir and hydropower output records In the water right loop, each water right is given its diversion amount as long as streamflow or reservoir storage, not yet appropriated by senior rights, is available. Reservoir storage is calculated for each month as S 2 = S 1 + D - R - E. That is, the end-of-month storage equals the beginning-of-month storage + (D) the net streamflow depletion (inflows minus spills and releases to meet senior downstream water rights) - (R) releases or withdrawals to meet requirements of rights associated with this reservoir - (E) evaporation. Evaporation is computed as the evaporation rate times the average water surface area over the month. Since this depends on the storage values at the beginning and end of the month, an iterative solution is required. 190 Water right seniority is fundamental to the simulation. The most senior right in the basin meets its diversion target and refills its reservoir storage capacity as if no other water rights existed. To run the WRAP-SIM program, you need an input file and the basin hydrology records. We just created the hydrology file for this basin, and luckily for us, an input file has already been prepared for this model. The input file describes all of the model components and sets the simulation specifications. Take a look at the file "Chapman1.dat" As with RECORDS, a two-character identifier is used for each type of record. Types of records in this input file include : Record Code Description T1, T2, T3 titles or headings ** comments JG water rights groups for output JD job control UC monthly use factors CP control point information CI constant monthly inflow or outflow WR water right WS water right reservoir storage IF instream flow requirement SV storage/area table volumes SA storage/area table areas ED end of data for the basin description Table B.2 : WRAP-SIM Input File Record Codes 191 Since we?re concerned with water rights analysis, let?s focus on the water rights records. We have thirteen water rights in this model, and the records look like this : WR 4800 A20 273 480019770103 WR 4395 A30 1518 480019830906 WR 4799M A40 44820 4799M19651119 WRCHAP WR 4799I A40 9180 CONST19651119 WRCHAP WR 4798 A40 54000 479819651119 WRCHAP WR 4797AM A40 26960 4797M19651119 WRCHAP WR 4797AI A40 11560 CONST19651119 2 0.425 WRCHAP WR 4797BM A40 0 4797M19651119 WRCHAP WR 4797BI A40 0 CONST19651119 WRCHAP WR 4795_1 A70 69 479519251231 WR 4795_2 A70 232 479519570812 WR 4796_1 A80 80 479619680311 WR 4796_2 A80 0 479619830418 Each record tells you, in order, the water right number, the control point, the annual permitted diversion (acre-ft/year), the use type (each use has associated monthly distribution factors for the annual diversion), the priority date (given as YYYYMMDD), the type of water right (a WRAP definition for how the water right is treated in the model, where a blank indicates type 1), and there may be a return flow factor and a group identifier. Now lets run the model. WRAP-SIM works with a common filename, and identifies the different input and output files by their extension. In this case, we?ve called the hydrology and data input files "Chapman1.hyd" and "Chapman1.dat", so the output files will all be named "Chapman1" as well. Double-click on the Sim.exe file, or run the file from a DOS prompt. Be sure and specify the full path and filename for the root file "Chapman1", for example 192 "Y:/hudgens/wrap/exercise/chapman1". The scratch files are used internally by WRAP and I suggest you just send them to your local temp directory. Your run should look like this: Figure B.4 : WRAP-SIM Run 193 WRAP writes a lot of text output, and it?s not particularly interesting by itself. Here?s what the raw output for water rights looks like in the first few results from our simulation : Program SIM (November 1998 Version) Output File WRAP - SIM -- RUN 1 CHAPMAN WATERSHED MARCH 1999 1940 57 12 8 14 5 4795_1 0.0 6.8 2.1 417.0 1.0 1.0 0.0 1940 1 4795_2 0.0 22.9 3.2 823.0 0.0 0.0 0.0 1940 1 4799M 0.0 2917.8 585.6 306943.3 446.6 446.6 0.0 1940 1 4799I 0.0 779.5 585.1 306164.2 0.0 0.0 0.0 1940 1 4798 0.0 3930.8 582.8 302235.7 0.0 0.0 0.0 1940 1 4797AM 0.0 2286.2 581.5 299950.8 0.0 0.0 0.0 1940 1 4797AI 0.0 981.6 580.9 298969.7 0.0 0.0 0.0 1940 1 4797BM 0.0 0.0 580.9 298969.7 0.0 0.0 0.0 1940 1 4797BI 0.0 0.0 580.9 298969.7 0.0 0.0 0.0 1940 1 4796_1 0.0 3.5 0.4 35.2 0.0 0.0 0.0 1940 1 IF4799 0.0 307.6 0.0 0.0 0.0 0.0 307.6 1940 1 307.6 0.0 IF 4800 0.0 21.4 2.0 142.6 2.0 2.0 0.0 1940 1 4796_2 0.0 0.0 0.5 56.0 0.0 0.0 0.0 1940 1 4395 0.0 119.2 19.3 4756.6 5.0 5.0 0.0 1940 1 These records are output for each water right and control point by month. These water right output records show you : ? the water right identifier ? diversion shortage ? permited target diversion (the water right amount) ? evaporation ? end-of-period storage ? streamflow depletion ? available streamflow ? releases from other reservoirs ? year ? month 194 B.6.3 Formatting Output in TABLES TABLES is a postprocessor for organizing the WRAP output file into more user-friendly summaries. It requires a WRAP output file, in some cases the WRAP input file, and a TABLES input file specifying the summaries to be output. There are four job types executed by TABLES. Within each job type, there are several records. Each record specifies a different type of summary or output to be made. ? Job type 1 records specify tabulations of input data from the WRAP input file. ? Job type 2 records develop summaries from the water right, control point, and reservoir data in the WRAP output file. ? Job type 3 records translate WRAP streamflow data into HEC-3 or HEC-5 formats. ? Job type 4 records summarize reservoir release and hydropower output data. Our interest is mainly in the job type 2 records. Here are the records of interest to us : ? 2SCP Record. Summarize control point data. ? 2SWR Record. Summarize water rights data, same format as 2SCP. ? 2SRE Record. Summarize reservoir data, same format as 2SCP. ? 2REL Record. Summarize reliability and shortages. ? 2NAT Record. Naturalized streamflow table. ? 2UNA Record. Unappropriated streamflow table, same format as 2NAT. ? 2DEP Record. Streamflow depletion table, same format as 2NAT. ? 2SHT Record. Shortage table, same format as 2NAT. ? 2STO Record. Storage table, same format as 2NAT. 195 The "example.ext" file is an example TABLES input file that includes all of these records. It looks like this: TITL SIMULATION OUTPUT COMM PRINT TITLE PAGE PAGE COMM CONTROL POINT SUMMARY FOR ALL CONTROL POINTS 2SCP 1 0 COMM CONTROL POINT SUMMARY FOR SELECTED CONTROL POINTS 2SCP 1 1 A40 COMM WATER RIGHTS SUMMARY 2SWR 1 0 COMM SAME FORMAT AS ABOVE FOR SELECTED WATER RIGHTS COMM SUMMARY OF ALL RESERVOIRS 2SRE 1 0 COMM SELECTED RESERVOIRS ONLY 2SRE 1 1 CHAPMN COMM RELIABILITY SUMMARY OF ALL WATER RIGHTS 2REL 1 0 COMM SAME FORMAT AS ABOVE FOR SELECTED COMM NATURALIZED STREAMFLOWS AT CONTROL POINTS 2NAT 0 0 COMM SAME FORMAT FOR UNAPPROPRIATED STREAMFLOWS 2UNA 0 0 COMM SAME FOR STREAMFLOW DEPLETION 2DEP 0 0 COMM SAME FOR SHORTAGE TABLE 2SHT 0 0 COMM SAME FOR STORAGE TABLE 2STO 0 0 ENDF 196 There are some additional records that add titles and comments, and mark the end-of-file: Record Code Description TITL titles or headings COMM add comments PAGE add header page to the output file ENDF end of input data file Table B.3 : Additional TABLES Records Descriptions Note that you must have the ENDF record at the end of the file. These records are formatted in two ways : ? The 2SCP, 2SWR, and 2SRE records all have first either a "0" or "1" for an annual or monthly summary respectively, and second either a "0" or positive integer for listings of all elements or selected elements respectively. If only selected elements are requested, they are then listed. Note that for reservoirs the reservoir name is entered (not the control point). ? The 2REL record is similar to the above but has first either a "0" or "1" to indicate either control points or water rights, then second a "0" or positive integer for all or selected elements. The 2NAT, 2UNA, 2DEP, 2SHT, and 2STO records are formatted the same as the 2REL. A TABLES input file must have a ".ext" extension on the filename, but it does not have to have the same filename as the WRAP-SIM file you used. The example tables input file for this exercise, "Example.ext", includes all of the type two jobs listed above. To minimize the output, only run one or two jobs at a time, instead of putting all of them in one file as in the example. By now, you can probably guess how to run TABLES. Just double-click on the Tab.exe file or run it from a DOS prompt. The Tables input file that presents just the output at point 197 A10 is called example1.txt. The Tables output file is called output1 (this could have been any name). The Wrap output file name is chapman1.out, which you computed in the previous step. The DOS dialog is as follows: Figure B.5 : TABLES Run B.7 WATER AVAILABILITY PLANNING The water availability models being constructed under Senate Bill 1 are being used by TNRCC to approve new applications for surface water rights. In this section you?ll look at the effects of increased demand on Chapman reservoir. Irving, Texas is located between Dallas and Fort Worth. It presently has a population of about 160,000 but there are 3.2 million people in the Dallas/Ft. Worth metropolitan area and the population is expected to grow rapidly. As 198 we?ve seen above, Irving currently holds rights to 54,000 acre-ft/year of water out of Chapman reservoir. If the population doubles, an increase of 160,000 persons, could their water demand be met from Chapman reservoir? Assuming a use rate of 200 gallons per capita per day, that is equivalent to an increased demand of 32MGD or about 36,000 acre-ft/yr. The file "Chapman2.dat" has this diversion amount entered as a new water right, water right #5000. The new water right will be the most junior in the basin, with a priority date of March, 1999. Make a copy of the "Chapman1.hyd" hydrology file and name it as "Chapman2.hyd" and run WRAP-SIM. The DOS dialog looks like this: Figure B.6 : WRAP-SIM Run for Irving Scenario 199 First, lets take a look at the time series of storage levels in Chapman Reservoir. Another Tables input file has been prepared for this called example2.txt. The dialog to run this file is as follows: Figure B.7 : TABLES Run for Irving Scenario Use Notepad to open this file. You?ll see a monthly summary of end of period storage in column 3 (EOP Storage). Now, lets examine the impact of adding the new water right to the performance of the other water rights dependant on Chapman Lake. Another Tables input file has been prepared called example3.txt which gives the reliability information for water right locations. Run this file to example the results from both chapman1.out and chapman2.out and compare the resulting 200 reliabilities. The DOS dialog is the same as that shown above, except that you substitute example3.txt for example2.txt, and give new output file names to correspond to your new results, e.g. output3 and output3 corresponding to inputs from chapman1.out and chapman2.out respectively. B.8 EXERCISE REFERENCES "Documentation of New Features in the November 1998 Version of the Water Rights Analysis Package (WRAP)." Wurbs, R.A., November, 1998. "Water Rights Analysis Package (WRAP) Model Description and Users Manual." Dunn, D.D., Wurbs, R.A., October, 1996. 201 Appendix C : Data Dictionary 202 C.1 DATA COMPACT DISC ONE This CD contains the Texas state and Sulphur basin databases described in this thesis. This section contains the data dictionary for these two databases. The CD also contains the coverages and files used in Exercises 1 and 2 (Appendices A and B) and text files of the code presented in Appendix D. 203 Theme Description Class Attributes Description Onedegalb One degree latitude by one degree longitude mesh Polygon Usgs_id USGS identifier of one degree box Quadsalb 7.5 minute quadrangle mesh Polygon Standard Sulacnalb01 Area averaged curve number grid Float Value Average curve number value over upstream flow accumulation area Sulapcalb01 Area averaged mean annual precipitation grid Float Value Average precipitation value over upstream flow accumulation area. Units of in./yr. Sulbasalb01 River basin boundary Polygon Basin_num Basin_name Short_name Tmdlreg Texas river basin number Basin name Abbreviated basin name Texas TMDL region identifier Sulbf2utm01 River basin boundary, buffered by 11,000 m Polygon Standard Sulbufalb01 River basin boundary, buffered by 10,000 m Polygon Standard Sulburalb01 Dem burned with mapped stream network Integer Value Elevation values are original DEM values along mapped streams, and DEM plus a constant outside of the stream network. Units of cm. Sulcngalb01 Curve number grid of river basin Integer Value Curve number Sulctlutm01 USGS centerlines through open water features Line Standard 204 Theme Description Class Attributes Description Sulfacalb01 Flow accumulation grid Float Value Flow accumulation of upstream cells Sulfcpalb01 Final control point coverage. Includes all (and only those) control points for which parameters are to be determined Point Id Type Control point identifier Type of control point -Stream gage -Other primary -Diversion point -Return flow -Other secondary Sulfdralb01 Flow direction grid Integer Value Flow direction values 1,2,4,8,16,32,64,128 Sulfilalb01 Burned DEM with internal sinks filled Integer Value Elevation. Units of cm. Sulnetalb01 Model network lines connecting each control point to the next downstream control point (or basin outlet) Line Standard Sulparalb01 Snapped control points attributed with flow distribution parameters Point Id Type Dscp Demfac Area_sq_mi Control point identifier Type of control point -Stream gage -Other primary -Diversion point -Return flow -Other secondary Identifier of next downstream control point ?0? = basin outlet Flow accumulation value. Units of # cells. Total upstream drainage area, calculated from flow accumulation. Units of sq. mi. 205 Theme Description Class Attributes Description Avgcn Avgpcp Flowlength Average curve number over total upstream drainage area Average precipitation value over total upstream drainage area. Units of in./yr. Optional field (not used) Sulpcpalb01 Annual mean precipitation grid Integer Value Annual mean precipitation. Units of in./yr. Sulqcwalb01 Manually delineated quality control watersheds Polygon Incavgcn Incavgpcp Cp Average curve number over incremental watershed area Average precipitation value over incremental watershed area Control point identifier Note : standard attribute Area in units of sq. meters Sulrfealb01 RF3 coverage of HUC8 watersheds surrounding the river basin. RF3 attributes are removed. Line Standard Sulrfialb01 RF3 coverage of river basin Line RF3 attributes RF3 attributes are available from EPA (1994) at http://www.epa.gov/OWO W/NPS/rf/techref.html Sulsbnalb01 Stream theme used to burn DEM. Sulsfvalb01 merged with Sulsfxalb01. Line Standard Sulscpalb01 Snapped control points Point Id Control point identifier 206 Theme Description Class Attributes Description Type Arcid Distance Dscp Type of control point -Stream gage -Other primary -Diversion point -Return flow -Other secondary Arc identifier of arc in stream theme to which the point was snapped Percentage distance of point along the arc identified by Arcid, from from-node to to-node Next downstream control point Sulsdmalb01 Stream network defined by tracing flow direction paths from headwaters of vector stream network Line Arcid Dsarcid Unique arc identifier assigned by connectivity script Identifier of next downstream arc Sulsfvalb01 Basin stream network with all edits completed Line Standard Sulsfxalb01 Stream network external to basin, with all edits completed Line Standard Sulsglalb01 Stream gage locations in river basin Point Usgsgage_id X_coord Y_coord USGS identifier of gage Longitude of station Latitude of station Sulswvalb01 Working version of basin stream network Line Standard Sulswxalb01 Working version of stream network external to basin Line Standard 207 Theme Description Class Attributes Description Sulwqbalb01 TNRCC water quality segment boundaries within the river basin Line Temp_id Basin_num TNRCC assigned identifier Texas river basin number Sulwqsalb01 TNRCC water quality segments within the river basin Polygon Name Seg_id Basin_num Name of water feature TNRCC segment identifier Texas river basin number Sulwrdalb01 Water right record locations extracted from TNRCC water rights database Point Wrights_id X_coord Y_coord Unique record identifier corresponding to ?Uniques? field in TNRCC water rights database Note : the Wrights_id field may be used to link the attribute table to the TNRCC water rights database Longitude of point Latitude of point Sulwrualb01 Water right update points provided by TNRCC Point Id Remarks Water right record unique identifier from TNRCC water rights database Remarks by TNRCC staff Sulwsdalb01 Incremental watersheds for control points Polygon Cp Incarea_sq Incavgcn Incavgpcp Control point identifier Area of incremental watershed. Units of sq. mi. Average curve number over incremental watershed area Average precipitation value over incremental watershed area 208 Theme Description Class Attributes Description Texbasalb Texas river basins Polygon Basin_num Basin_name Short_name Tmdlreg Texas river basin number Basin name Abbreviated basin name Texas TMDL region identifier Texcngalb Curve number grid clipped to state boundary Integer Value Curve number Texctlutm USGS centerlines for open water features within state Line Standard Texctyalb County coverage for EPA region 6 Polygon Fips St Cntyname Stcofips US county identifier State County name St county identifier Texhucalb Coverage of 8 digit HUC watershed boundaries Polygon Huc HUC8 code Texmesutm_ 15 Quadrangle mesh attributed with USGS quadrangle identifiers Polygon Label X_coord Y_coord Code Cd_name Alphanumeric identifer used in creating coverage Longitude of lower right corner Latitude of lower right corner Unique USGS quadrangle identifier Optional field (not used) Texpcpalb Annual mean precipitation grid clipped to state boundary Float Value Annual mean precipitation. Units of in./yr. 209 Theme Description Class Attributes Description Texwqbalb TNRCC water quality segment boundaries within the state Line Temp_id Basin_num TNRCC assigned identifier Texas river basin number Texwqsalb TNRCC water quality segments Polygon Name Seg_id Basin_num Name of water feature TNRCC segment identifier Texas river basin number Texwrdalb Water right record locations extracted from TNRCC water rights database Point Wrights_id Unique record identifier corresponding to ?Uniques? field in TNRCC water rights database 210 C.2 DATA COMPACT DISC TWO This CD contains the Location Review Database for the Sulphur basin described in Section 3.2. This section contains the data dictionary for this database. 211 Theme Description Class Attributes Description Sulbasutm01 River basin boundary Polygon Basin_num Basin_name Short_name Tmdlreg Texas river basin number Basin name Abbreviated basin name Texas TMDL region identifier Sulrfiutm01 RF3 coverage of river basin Line RF3 attributes RF3 attributes are available from EPA (1994) at http://www.epa.gov/OWO W/NPS/rf/techref.html Sulsglutm01 Stream gage locations in river basin Point Usgsgage_id X_coord Y_coord USGS identifier of gage Longitude of station Latitude of station Sulwrdutm01 Water right record locations extracted from TNRCC water rights database Point Wrights_id X_coord Y_coord Unique record identifier corresponding to ?Uniques? field in TNRCC water rights database Note : the Wrights_id field may be used to link the attribute table to the TNRCC water rights database Longitude of point Latitude of point Texmesutm_ 15 Quadrangle mesh attributed with USGS quadrangle identifiers Polygon Label X_coord Y_coord Alphanumeric identifer used in creating coverage Longitude of lower right corner Latitude of lower right corner 212 Theme Description Class Attributes Description Code Cd_name Unique USGS quadrangle identifier Optional field (not used) Uniques.dbf TNRCC water rights database, indexed by unique identification number field ?Unique? DBF file Various Data dictionary for this file is available from TNRCC. Wrap1117.apr WRAP Parameters ArcView 3.1 project file APR file None O33094b1 TIFF image files of scanned USGS topographic map TIF file None O33094b1.tfw TFW file associated with corresponding TIFF file TFW file None 213 Appendix D : Code Code File Name Page Hydro.DemPstDslvMg Hydro01.ave 215 Hydro.RmvRecsLst Hydro02.ave 215 Wrap.AddCp_Tool Wrap01.ave 216 Wrap.AddTopo Wrap02.ave 218 Wrap.AvgCn Wrap03.ave 219 Wrap.AvgGridByPoly Wrap04.ave 220 Wrap.AvgPcp Wrap05.ave 221 Wrap.Burn Wrap06.ave 222 Wrap.ChangeDRGPath Wrap07.ave 223 Wrap.CleanNet_Tool Wrap08.ave 224 Wrap.ClipGridByPoly Wrap09.ave 225 Wrap.Dangle_Menu Wrap10.ave 227 Wrap.Dangle_Tool Wrap11.ave 229 Wrap.Dissolve Wrap12.ave 230 Wrap.Fac Wrap13.ave 232 Wrap.Fdr Wrap14.ave 232 WrapFdrStreams_Mod Wrap15.ave 233 Wrap.FdrStreams Wrap16.ave 236 Wrap.FillDem Wrap17.ave 239 Wrap.MergeThemes Wrap18.ave 240 Wrap.Network Wrap19.ave 242 Wrap.Parameters_Menu Wrap20.ave 245 Wrap.Parameters_Tool Wrap21.ave 248 Wrap.Resample Wrap22.ave 250 Wrap.SetCPThemes Wrap23.ave 251 Wrap.SetGridThemes Wrap24.ave 251 Wrap.SnapCP_Menu Wrap25.ave 252 Wrap.SnapCP_Tool Wrap26.ave 256 Wrap.StripFields Wrap27.ave 260 Wrap.StrmSort Wrap28.ave 261 Wrap.Unproject Wrap29.ave 264 Wrap.Watersheds Wrap30.ave 266 Dem30m.txt 268 214 Code File Name Page Reprodrg.txt 269 Albtodem.txt 269 Albtoutm.txt 270 Bastoutm.txt 270 Demtoalb.txt 271 Gagtoalb.txt 271 Gagtoutm.txt 271 Utmtoalb.txt 272 Z14toz15.txt 272 Table D.1 : Index to Program Codes in Appendix D 215 ? Name: hydro.DemPstDslvMg, hydro01.ave ? Headline: Called by DemPstDslv ? Self: {TheView,PFtab,PShape,DsvList,DsvRecList,DDList} ? Returns: ? Description: Merge polygons with certain characteristics. ? Topics: ? Search Keys: ? Requires: ? History: 4/2/97 Modified 11/23/97 by SMR ? --- Made changes so that dangling polygons ? --- are automatically dissolved into adjacent ? --- polygons without prompting the user each time. ? ? This script is called for each set of polygons being ? considered for dissolve. TheView=SELF.Get(0) PFtab=SELF.Get(1) ?Polygon Ftab PShape=SELF.Get(2) ?ShapeField DsvList=SELF.Get(3) ?Shape DsvRecList=SELF.Get(4) ?Recs to be dissolved DDList=SELF.Get(5) ?Recs to be eliminated DsvCnt=DsvList.Count OrgShpV=DsvList.Get(0) OrgRec=DsvRecList.Get(0).Clone tmpshp=orgshpv ?--- loop through a list of polygons with the same for each i in 1..(DsvCnt-1) DsvShpV=DsvList.Get(i) DsvRec=DsvRecList.Get(i).Clone ?--- New as of 12/15/97 : Always merge polygons that are on a diagonal ?--- into one polygon. ?gcode=pftab.returnvalue(pftab.findfield("gridcode"),dsvrec) ?gcode2=pftab.returnvalue(pftab.findfield("gridcode"),orgrec) pshpv=tmpshp.returnmerged(dsvshpv) tmpshp=pshpv DDList.Add(DsvRec) end ?--- set the shape pshapef=pftab.findfield("shape") pftab.setvalue(pshapef,orgrec,pshpv) ?? 2. z:\seann\txdot\hydro.dempstdslvmg of 76 lines, ??z : \projects\txdot\scripts\hydro.dempstdslvmg_diag of 49 lines, ??z:\projects\txdot\scripts\hydro.dempstdslvmg_diag of 50 lines, ??z:\projects\txdot\scripts\hydro.dempstdslvmg_diag of 51 lines, ? Name: hydro.RmvRecsLst, hydro02.ave ? Headline: hydro.rmvRecsLst,{Ftab,TheList,False} ? Self: {aVtab,RecList,RemainEditabl} ? Returns: nil ? Description: Remove Records specified in a list. ? Topics: ? Search Keys: ? Requires: 216 ? History: 4/3/97 TheFtab=SELF.Get(0) TheList=SELF.Get(1) RemainEditable=SELF.Get(2) if(TheFtab.CanEdit)then TheFtab.SetEditable(True) else Msgbox.info("Can?t Edit"++TheFtab.getName,Script.The.GetName) return nil end TheBitMap=TheFtab.GetSelection TheBitMap.ClearAll TheFtab.UpdateSelection TheBitMap=TheFtab.GetSelection For each i in TheList TheBitMap.Set(i.Clone) end TheFtab.RemoveRecords(TheBitMap) TheFtab.SetEditable(RemainEditable) ? Script: wrap.addcp_tool, wrap01.ave ? ? Description: Adds a control point to ? an existing coverage or creates a new point ? coverage with control point locations, the user is ? asked to input the id number and type of the ? point added. ? ? History: Modified 9/7/99 by Brad Hudgens from original by Richard Gu, CRWR, 1998 theDir=av.getproject.getworkdir pntThmName=_cpThm if (_cpThm=nil) then msgbox.info("Set control point filenames in WRAP Tools menu","WRAP Parameters") exit end pntFileName=FN.merge(Thedir.AsString,_cpThm+".shp") ?Identify the tool that called the script theTool=av.getactivegui.gettoolbar.getactive.gettag ?Get the control point theView=av.getactivedoc pt=theView.getdisplay.returnuserpoint ?Input type and id number of control point options={ "Diversion point","Return flow","Other secondary","Stream gage","Other primary"} choise=msgbox.choiceasstring(options,"Choose the type of control point:","WRAP Parameters") if (choise=nil)then msgbox.info("No Selection","") exit end id_string=msgbox.input("Enter the ID number:","WRAP Parameters","0") if (id_string.isnumber) then id_number=id_string.asnumber 217 else msgbox.info("ID must be an integer","Error") exit end ?If this is the first point, make the FTab pntThmName=_cpThm+".shp" if(theView.findtheme(pntThmName)=nil) then pntFtab=ftab.makenew(pntFileName,point) pntTheme=ftheme.make(pntFtab) pntFields=list.make pntFields.add(field.make("ID",#Field_Long,12,1)) pntFields.add(field.make("Type",#Field_VChar,20,0)) pntFieldsC=pntFields.deepclone pntFtab.addFields(pntFieldsC) theView.addTheme(pntTheme) if(pntFtab.canedit) then pntFtab.seteditable(true) else msgbox.error("Can?t edit the output theme.","WRAP Parameters") exit end pntTheme.setvisible(true) ?If this is not the first point, get the FTab else ?Check Ftab for duplicate id numbers pntTheme=theView.findtheme(pntThmName) table_pnt=pntTheme.getftab field_id=table_pnt.findfield("ID") for each rec in table_pnt if (table_pnt.returnvalue(field_id,rec)=id_number)then msgbox.error("ID number duplicated","WRAP Parameters") exit end end pntFtab=pntTheme.getftab if(pntFtab.canedit) then pntFtab.seteditable(true) else msgbox.error("Can?t edit point theme.","WRAP Parameters") exit end end ?Add new point to theme theShpFld=pntFtab.findfield("Shape") theIdFld=pntFtab.findfield("ID") theTypeFld=pntFtab.findfield("Type") newRec=pntTheme.getftab.addrecord pntFtab.setvalue(theShpFld,newRec,pt) pntFtab.setvalue(TheIdFld,newRec,id_number) pntFtab.setvalue(theTypeFld, newRec, choise) ?Stop editing and clear tool pntFtab.seteditable(false) theTool=nil exit 218 ? Script: wrap.addtopo, wrap02.ave ? ? Description: Adds a topographic map to a view (DRGs), cuts the edges off and zooms in... ? ? History: Modified 9/24/99 by Brad Hudgens from original by JonaFinndis Jonsdottir, CRWR theVal=self theView = av.getactivedoc if (not (theVal.isnull)) then theVal2 = _theDRGpath + "/O" + theVal + ".tif".asstring if (not (file.exists(theVal2.asfilename))) then msgbox.info("DRG not found","WRAP Parameters" ) exit end if (file.exists(theVal2.asfilename)) then ? Create the SourceName... theSrc = srcname.make(theVal2) ? Use the SourceName to make a theme... aTheme = theme.make(theSrc) ? Add the theme to the view... theView.addtheme(aTheme) ? Set a new name for the theme... aTheme.setname(theVal) ? Change the extent of the DRG, i.e. cut the edges off. r = rect.makeempty r = r.unionwith(aTheme.returnextent) bottom1 = r.getbottom top1 = r.gettop left1 = r.getleft right1 = r.getright height1 = r.getheight width1 = r.getwidth heighta = height1*0.105 heightb = height1*0.050 widtha = width1*0.0615 widthb = width1*0.0615 bottom2 = (bottom1 + heighta) top2 = top1 - heightb left2 = left1 + widtha right2 = right1 - widthb r2 = rect.makeXY(left2, bottom2, right2, top2) if (r2 <> NIL) then aTheme.getimgsrc.setclipextent(r2) end ? Draw the theme... aTheme.setvisible(true) ? Make txmesh unactive for each t in theView.getactivethemes.clone t.setactive( false ) end aTheme.setactive(true) ? Zoom 219 av.getproject.setmodified(true) theThemes = theView.getactivethemes r = rect.makeempty for each t in theThemes r = r.unionwith(t.returnextent) end if (r.isempty) then return nil elseif ( r.returnsize = (0@0) ) then theView.getdisplay.panto(r.returnorigin) else theView.getdisplay.setextent(r.scale(1.1)) end else msgbox.warning("File "+theVal2+" not found.","Hot Link" ) end end ? Script: wrap.avgcn, wrap03.ave ? ? Description: creates average upstream area CN grid from weighted flow accumulation grid ? ? History: Original by Brad Hudgens, 9/24/99 theView=av.getactivedoc thethemes=theView.getthemes theGthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count < 3) then msgbox.error("Need 3 grids : flow direction, flow accumulation, and curve number","WRAP Parameters") exit end fdrGtheme=msgbox.choice(theGthemes,"Select Flow Direction Grid", "WRAP Parameters") facGtheme=msgbox.choice(theGthemes,"Select Flow Accumulation Grid","WRAP Parameters") cnGtheme=msgbox.choice(theGthemes,"Select Curve Number Grid","WRAP Parameters") fdrGrid=fdrGtheme.getgrid facGrid=facGtheme.getgrid cnGrid=cnGtheme.getgrid wtFacGrid=fdrGrid.flowaccumulation(cnGrid) avgCnGrid=((wtFacGrid+cnGrid)/(facGrid+1)) aFn=fn.make("AvgCN") avgCnGrid.rename(aFn) avgCnGtheme=gtheme.make(avgCnGrid) avgCnGtheme.setname("AvgCN") theView.addtheme(avgCnGtheme) 220 ? Script: wrap.avggridbypoly, wrap04.ave ? ? Description: Given an arbitrary ? polygon coverage, compute the average values for ? gridcells falling within each polygon, add a field ? to the polygon coverage, and copy the average values ? into this field. ? ? History: Modified by Brad Hudgens 9/24/99 from original by Seann Reed, CRWR ?determine inputs theProject=av.getproject theView=av.getactivedoc availThemes=theview.getthemes ?make a list of themes polyThemes=list.make gridThemes=list.make for each t in availThemes if (t.getclass.getclassname <> "GTheme") then if (t.getftab.findfield("shape").gettype=#field_shapepoly) then polyThemes.add(t) end else gridThemes.add(t) end end avgTheme=msgbox.choiceasstring(polyThemes,"Select the polygon theme","WRAP Parameters") if (avgTheme = NIL) then exit end gridTheme=msgbox.choiceasstring(gridThemes,"Select the Grid","WRAP Parameters") if (gridTheme = NIL) then exit end avgFtab=avgTheme.getftab inGrid=gridtheme.getgrid avgFields=avgFtab.getfields zoneField=msgbox.choice(avgFields,"Identify a field with a unique ID","WRAP Parameters") if (zoneField=nil) then msgbox.info("No zone field selected. Exiting.","") exit end outFname=msgbox.input("Enter output field name","WRAP Parameters","IncAvg") if (outFname=nil) then exit end avgFtab.seteditable(true) if (avgFtab.findfield(outFname)<>nil) then msgbox.info("Field named"++outfname++"already exists in averaging theme","WRAP Parameters") exit end avgType=msgbox.choiceasstring({"Average","Most Likely Value"},"Select Average Type","Average") if (avgType.count=0) then msgbox.info("No averaging type selected","WRAP 221 Parameters") exit end ?Adding Fields to Polygon Attribute Table tabOutName="temp.dbf" tabOutFname=tabOutName.asfilename outVtab=inGrid.zonalstatstable(avgFtab,prj.makenull,zoneField ,false,tabOutFname) fromField=outVtab.findfield(zoneField.getname) if (avgType = "Average") then valField=outVtab.findfield("Mean") elseif (avgtype = "Most Likely Value") then valField=outVtab.findfield("Majority") else msgbox.info("You should never see this","WRAP Parameters") end outField=field.make(outFname,valField.gettype,valField.getwid th,valField.getprecision) outFieldC=outField.clone avgFtab.addfields({outFieldC}) ?Add Longest Flow Path by joining tables avgFtab.join(zoneField,outVtab,fromField) if (avgType = "Average") then joinField=avgFtab.findfield("Mean") elseif (avgType = "Most Likely Value") then joinField=avgFtab.findfield("Majority") else msgbox.info("You should never see this.","WRAP Parameters") end for each rec in avgFtab joinVal=avgFtab.returnvalue(joinfield,rec) avgFtab.setvalue(outFieldC,rec,joinVal) end ?remove join avgFtab.unjoinall avgFtab.seteditable(false) ? Script: wrap.avgpcp, wrap05.ave ? ? Description: creates average upstream precipitation grid ? ? History: Original by Brad Hudgens, 9/24/99 theView=av.getactivedoc theThemes=theView.getthemes theGthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count < 3) then msgbox.error("Need 3 grids : flow direction, flow accumulation, and precipitation","WRAP Parameters") exit end 222 fdrGtheme=msgbox.choice(theGthemes,"Select Flow Direction Grid", "WRAP Parameters") facGtheme=msgbox.choice(theGthemes,"Select Flow Accumulation Grid","WRAP Parameters") pcpGtheme=msgbox.choice(theGthemes,"Select Precipitation Grid","WRAP Parameters") fdrGrid=fdrGtheme.getgrid facGrid=facGtheme.getgrid pcpGrid=pcpGtheme.getgrid wtFacGrid=fdrGrid.flowaccumulation(pcpGrid) avgPcpGrid=((wtFacGrid+pcpGrid)/(facGrid+1)) aFn=fn.make("AvgPcp") avgPcpGrid.rename(aFn) avgPcpGtheme=gtheme.make(avgPcpGrid) avgPcpGtheme.setname("AvgPcp") theView.addtheme(avgPcpGTheme) ?Script: wrap.burn, wrap06.ave ? ? Description: Burns a line coverage (streams) into a grid coverage (DEM) ? ? History: Modified 9/23/99 by Brad Hudgens from original by Brian Adams, CRWR theProject=av.GetProject theDir=theProject.GetWorkDir theView = av.GetActiveDoc ?get themes theThemes = theview.getthemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No coverage themes found","WRAP Parameters") exit end theGthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count = 0) then msgbox.error("No grid themes found","WRAP Parameters") exit end ?select stream network coverage 223 lineTheme = msgbox.choice(theFthemes, "Select the Stream Network","WRAP Parameters") if (lineTheme = nil) then exit end ?select the DEM gridTheme = msgbox.choice(theGthemes, "Select the DEM","WRAP Parameters") if (gridtheme = nil) then exit end DEMGrid=gridtheme.GetGrid idExtent=demGrid.GetExtent idCellSize=demGrid.GetCellSize ?Convert Line coverage to Grid lineFtab=lineTheme.GetFtab ?--deselect Ftab-- theBitmap=lineFtab.getselection theBitmap.clearall lineFtab.updateselection unitStreamGrd=grid.makefromftab(lineFtab,prj.MakeNull,nil,{i dCellSize,idExtent}) aFN=theDir.maketmp("UnitStrm","") unitStreamGrd.Rename(aFN) ?Process DEM demStream = DEMGrid*unitStreamGrd theElevation = MsgBox.Input("Enter the arbitrary elevation rise."+nl+ "This value should be greater than the highest point in the DEM.","Elevation Rise","5000") demplus = DEMGrid+theElevation.AsNumber ?Merge the grids listGrid = {demplus} outGrid = demStream.merge(listGrid) ?Save and add Burned DEM to view aFN=fn.make("burndem") outGrid.rename(aFN) outTheme = GTheme.make(outGrid) outTheme.setname("BurnDEM") theView.addtheme(outTheme) ? Script: wrap.changeDRGpath, wrap07.ave ? ? Description: Sets global variable for DRG file path ? ? History: Original by Brad Hudgens, 9/24/99 _theDRGPath=msgbox.input("Please input the full path name to the directory containing the DRG files :","WRAP Parameters","e:/") exit 224 ? Script: wrap.cleannet_tool, wrap08.ave ? ? Description: Corrects topology of a line coverage when an arc ? is added to the theme and one endpoint is snapped to the middle ? of an existing arc. Splits the existing arc at the intersection ? with the added arc, creating a regular node at that point ? ? History: Original by Brad Hudgens, 9/24/99 currSel={} splitList={} nodeListA={} nodeListB={} lineList={} theView=av.getactivedoc theDisplay=av.getactivedoc.getdisplay theFtheme=theView.getactivethemes.get(0) theFtab=theFtheme.getFtab thePolygon=theDisplay.returnuserrect theFtab.selectbyrect(thePolygon,#VTAB_SELTYPE_NEW) theShape=theFtab.findfield("shape") theFtab.seteditable(true) currSel=theFtab.getselection theprj=theview.getprojection count=0 for each rec in theFtab.getselection theLine=theFtab.returnvalue(theShape, rec) lineList.add(theLine) count=count+1 end if (count<2) then msgbox.error("You have selected less than two arcs","WRAP Parameters") exit end if (count>2) then msgbox.error("You have selected more than two arcs","WRAP Parameters") exit end lineA=lineList.Get(0) lineB=lineList.Get(1) thePointsA = lineA.asmultipoint.returnprojected(theprj) thePointsB = lineB.asmultipoint.returnprojected(theprj) nodeListA.add(thePointsA.aslist.get(0)) nodeListA.add(thePointsA.aslist.get(thePointsA.count-1)) nodeListB.add(thePointsB.aslist.get(0)) nodeListB.add(thePointsB.aslist.get(thePointsB.count-1)) for each node in nodeListA if (lineB.contains(node)) then splitList=lineB.split(node) for each item in splitList newRec=theFtab.addrecord theFtab.setvalue(theShape, newRec, item) 225 end newLineA=lineA.aspolyline newRec=theFtab.addrecord theFtab.setvalue(theShape, newRec, newLineA) theFTab.removerecords(theFtab.getselection.clone) end end for each node in nodeListB if (lineA.contains(node)) then splitList=lineA.split(node) for each item in splitList newRec=theFtab.addrecord theFtab.setvalue(theShape, newRec, item) end newLineB=lineB.aspolyline newRec=theFtab.addrecord theFtab.setvalue(theShape, newRec, newLineB) theFtab.removerecords(theFtab.getselection.clone) end end theftab.seteditable(false) ? Script: wrap.clipgridbypoly, wrap09.ave ? ? Description: clips grid theme values to extent of polygon ? ? History: Modified by Brad Hudgens, 9/24/99 from original in CRWR Raster ?Describe how clipping will occur and allow cancellation response=msgbox.yesno("The ACTIVE grid will be clipped to the chosen polygon theme. Continue?","WRAP Parameters",false) if (response=nil) then exit end ?Get the active view and check if enough themes exist to perform operation theView = av.getactivedoc ?Uses the active view themeList = theView.getthemes if (nil = themeList) then exit end if (themeList.count < 2) then msgbox.error("Need at least 2 themes in the View","WRAP Parameters") exit end ?Use the active grid theme theGrid=theView.getactivethemes.get(0).getgrid ?Choose the polygon theme polyList = list.make for each aTheme in themeList if (aTheme.canselect=true) then if (aTheme.getFtab.findfield("Shape").gettype = #FIELD_SHAPEPOLY) then polyList.add(aTheme) end 226 else end end thePolyTheme = msgbox.choiceasstring(polyList,"Which polygon theme is the clipping theme","WRAP Parameters") if (thePolyTheme=Nil) then exit end response=msgbox.yesno("Grid theme will be clipped to the selected features of the clipping theme. If nothing is selected, the extent of all features in the clipping theme will be used. Continue?","WRAP Parameters",false) if (response=false) then exit end ?Get bounds of clipping area as a rectangle thePolyThmExtent = thePolyTheme.getselectedextent if (thePolyThmExtent .isempty) then thePolyThmExtent = thePolyTheme.returnextent end ?Get parameters for the new grid theFtab = thePolyTheme.getftab theProj = theView.getprojection theCell = theGrid.getcellsize theExtent = theGrid.getextent ae = theView.getextension(AnalysisEnvironment) ae.setextent(#ANALYSISENV_VALUE, thePolyThmExtent) ae.setcellsize(#ANALYSISENV_VALUE, theCell) ? Activate the settings for the analysis envirnonment as returned ? by the above 3 lines of code. ae.activate ?the actual extraction occurs here tempGrid = grid.makefromftab(theFtab,theProj,nil,{theCell,theExtent}) newGrid = (tempGrid.isnull).con (tempGrid, theGrid) ? rename data set aFn = av.getproject.getworkdir.maketmp("gext", "") newGrid.rename(aFn) ? check if output is ok if (newGrid.haserror) then return NIL end ? create a theme gridThm = theme.make(newGrid.getsrcname) ? set name of theme gridThm.setname("Extract from " + theGrid.getname) ? add theme to the specifiedView theView.addtheme(gridThm) ? Resets the analysis environment to the maximum of inputs (i.e. the default) aRect = nil ae = theView.getextension(AnalysisEnvironment) ae.SetExtent(#ANALYSISENV_MAXOF, aRect) ae.SetCellSize(#ANALYSISENV_MAXOF, aRect) 227 gridThm.invalidate(true) ? Script: wrap.dangle_menu, wrap10.ave ? ? Description: Identifies all dangling nodes of the active line theme ? within the view extent ? ? History: Modified by Brad Hudgens, 9/24/99 from original by Stepan Kafka ? at ESRI script download site ?Graphic symbol for Dangle Node sDangle = av.getsymbolwin.getpalette.getlist(#PALETTE_LIST_MARKE R).get(1).clone sDangle.setcolor(color.getred) sDangle.setsize(6) ?Initializing theView = av.getactivedoc theTool=av.getactivegui.gettoolbar.getactive.gettag cont=msgbox.yesno("This script identifies all dangling nodes in the active theme within the view extent. It is slow to run on a large view extent. Do you want to continue?","WRAP Parameters",TRUE) If (cont=false) then exit end ?Choose output as graphic or theme modeList={"Theme","Graphics"} mode=msgbox.choiceasstring(modeList,"Select output method","WRAP Parameters") ?If Theme mode make new theme with name Dangles If (mode="Theme") then theDir=av.getproject.getworkdir theFn=fn.merge(theDir.asstring,"Dangles.shp") newFtab=ftab.makenew(theFn,point) newFields=list.make newFields.add(field.make("ID",#field_long,12,0)) newFtab.addfields(newFields) newFtab.seteditable(true) shapeFld=newFtab.findfield("Shape") idFld=newFtab.findfield("ID") theid=1 end thePrj = theView.getprojection theSelMode = theView.getselectmode theView.setselectmode(#GRAPHICS_SELECT_NORMAL) theTheme = theView.getactivethemes.get(0) theTable = theTheme.Getftab D = theView.getdisplay theShape = theTable.findfield("Shape") nodeList = {} ?Selecting the shapes oldSel = theTable.getselection.clone dExt = D.returnvisextent 228 theTheme.selectbyrect(dExt, #VTAB_SELTYPE_NEW) currSel = theTable.getselection.clone theTable.setselection(oldSel) ?Vertices drawing and Nodes collecting D.beginclip for each rec in CurrSel theLines = theTable.returnvalue(theShape, rec).aspolyline.explode for each L in theLines thePoints = L.asmultipoint.returnprojected(thePrj) nodeList.add(thePoints.aslist.get(0)) nodeList.add(thePoints.aslist.get(thePoints.count-1)) end end ?Nodes processing allNodes = nodeList.count-1 av.showmsg("Searching nodes...") av.showstopbutton while (nodeList.count > 0) overPos = 0 thePoint= nodeList.get(0) nodeList.remove(0) nodes = nodeList.count-1 if (av.setstatus((allNodes-nodes)/allNodes*100).not) then av.setstatus(100) av.showmsg("Cancelled by operator.") exit end C = 0 while (C <= nodes) if (thePoint.intersects(nodeList.get(C))) then nodeList.remove(C) nodes = nodes - 1 overPos = overPos + 1 else C = C + 1 end end if (overPos < 1) then if (mode="Graphics") then D.drawpoint(thePoint, sDangle) else ?Add point to theme newRec=newFtab.addrecord newFtab.setvalue(shapeFld, newRec, thePoint) newFtab.setvalue(idFld, newRec, theId) theId=theId+1 end end end D.endclip if (mode="Theme") then newTheme=ftheme.make(newFtab) theView.addtheme(newTheme) newFtab.seteditable(false) end av.setstatus(100) av.clearmsg theView.setselectmode(theSelMode) theTool=nil 229 av.purgeobjects ? Script: wrap.dangle_tool, wrap11.ave ? ? Description: Identifies all dangling nodes of the active line theme ? within the view extent ? ? History: Modified by Brad Hudgens, 9/24/99 from original by Stepan Kafka ? at ESRI script download site ?Dangle Node sDangle = av.getsymbolwin.getpalette.getlist(#PALETTE_LIST_MARKE R).get(1).clone sDangle.setcolor(color.getred) sDangle.setsize(6) ?Initializing theView = av.getactivedoc theTool=av.getactivegui.gettoolbar.getactive.gettag thePrj = theView.getprojection theSelMode = theView.getselectmode theView.setselectmode(#GRAPHICS_SELECT_NORMAL) theTheme = theView.getactivethemes.get(0) theTable = theTheme.getftab D = theView.getdisplay theShape = theTable.findfield("Shape") nodeList = {} ?Selecting the shapes oldSel = theTable.getselection.clone dExt = D.returnvisextent theTheme.selectbyrect(dExt, #VTAB_SELTYPE_NEW) currSel = theTable.getselection.clone theTable.setselection(oldSel) ?Vertices drawing and Nodes collecting D.beginclip for each rec in currSel theLines = theTable.returnvalue(theShape, rec).aspolyline.explode for each L in theLines thePoints = L.asmultipoint.returnprojected(thePrj) nodeList.add(thePoints.aslist.get(0)) nodeList.add(thePoints.aslist.get(thePoints.count-1)) end end ?Nodes processing allNodes = nodeList.count-1 av.showmsg("Searching nodes...") av.showstopbutton while (nodeList.count > 0) overPos = 0 thePoint= nodeList.get(0) nodeList.remove(0) nodes = nodeList.count-1 if (av.setstatus((allNodes-nodes)/allNodes*100).not) then av.setstatus(100) av.showmsg("Cancelled by operator.") exit end 230 C = 0 while (C <= nodes) if (thePoint.intersects(nodeList.get(C))) then nodeList.remove(C) nodes = nodes - 1 overPos = overPos + 1 else C = C + 1 end end if (overPos < 1) then D.drawpoint(thePoint, sDangle) end end D.endclip av.setstatus(100) av.clearmsg theView.setselectmode(theSelMode) theTool=nil av.purgeobjects ? Script: wrap.dissolve, wrap12.ave ? ? Description: dissolves extra polygons created vectorizing ? watersheds ? ? History: Modified by Brad Hudgens, 9/24/99 from original in CRWR Prepro theView=av.getactivedoc theThemes = theView.getthemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No feature themes found","WRAP Parameters") exit end pTheme=msgbox.choiceasstring(thefthemes,"Select the watershed polygon theme","WRAP Parameters") if (pTheme=nil) then exit end pFtab=pTheme.getftab if(pFtab.canedit)then pFtab.seteditable(true) end ?Setup Field handles. pGcode=pFtab.findfield("CP") if(pGcode=nil)then msgbox.error("CP field not found","") exit 231 orgShpV orgShpV=pFtab.returnvalue(pShape,rec) maxArea=orgShpV.returnarea dsvList.add(orgShpV.clone) dsvRecList.add(rec.clone) end cmpShpV=pFtab.returnvalue(pShape,pRec) theArea=cmpShpV.returnarea if(theArea>maxArea)then maxArea=theArea dsvList.insert(cmpShpV.clone) ?MaxArea on Top. dsvRecList.insert(pRec.clone) else dsvList.add(cmpShpV.clone) dsvRecList.add(pRec.clone) end doneDict.set(pRec.clone,1) end ?if(pGcodeV=pGcodeC) end ?for each pRec in PFtab if(dsvRecList.count>0)then av.run("hydro.DemPstDslvMg_diag",{theView,pFtab,pShape,d svList,dsvRecList,dDList}) end end ?for each rec in PFtab if(dDList.count>0)then av.run("hydro.RmvRecsLst",{pFtab,dDList,false}) ?PFtab will be returned Editable(False) end av.setstatus(100) msgbox.error("No grids found","WRAP Parameters") exit end tnr=pFtab.getnumrecords doneDict=dictionary.make(tnr) ?Keep track of the polygons processed. for each rec in pFtab doneDict.add(rec.clone,0) ?0=not processed, 1=processed. end dsvList=list.make ?Holds the polygons to be dissolved. dsvRecList=list.make ?Holds the dsvRecs. ?DsvList and DsvRecList are sorted with MaxArea ShpV on Top. (0 indexed) dDList=list.make ?Holds the records to be deleted after dissolving. Cancelled=False av.showstopbutton for each rec in pFtab cancelled=av.setstatus(rec/tnr*100).not if(cancelled)then exit end if(doneDict.get(rec)>0)then continue end doneDict.set(rec.clone,1) pGcodeV=pFtab.returnvalue(pGcode,rec) dsvList.empty dsvRecList.empty for each pRec in pFtab if(pRec=rec)then continue end pGcodeC=pFtab.returnvalue(pGcode,pRec) if(pGcodeV=pGcodeC)then if(dsvList.count=0)then ?First time in here, put in the 232 ? Script: wrap.fac, wrap13.ave ? ? Description: Based on a selected flow-dir ? grid, construct flow-accumulation grid. ? ? History: Modified by Brad Hudgens 9/23/99 from CRWR Prepro theView=av.getactivedoc thethemes=theView.getthemes thegthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count = 0) then msgbox.error("No grids found","WRAP Parameters") exit end InThm=msgbox.choice(theGthemes,"Select the Flow Direction Grid","WRAP Parameters") ?Flow accumulation starts here. g = InThm.getgrid r = g.flowaccumulation(NIL) aFN = FN.make("Fac") r.rename(aFN) if (r.HasError) then msgbox.error("Error in flow accumulation grid","WRAP Parameters") return NIL end gthm = GTheme.make(r) gthm.setname("Fac") theView.addtheme(gthm) ? Script: wrap.fdr, wrap14.ave ? ? Description: Based on a selected fill-dem, ? construct flow-direction grid. ? ? History: Modified by Brad Hudgens 9/23/99 from CRWR Prepro theView=av.getactivedoc theThemes=theView.getthemes theGthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count = 0) then msgbox.error("No grids found","WRAP Parameters") exit end 233 InThm=msgbox.choice(theGthemes,"Select the Filled DEM","WRAP Parameters") ?Flow direction starts here. g=InThm.getgrid r=g.flowdirection(FALSE) ?rename data set aFN=FN.make("Fdr") r.rename(aFN) if(r.HasError)then msgbox.info("Error in Flow Direction Grid","WRAP Parameters") return NIL end gthm=GTheme.make(r) gthm.setname("Fdr") theView.addtheme(gthm) ? Script: wrap.fdrstreams_mod, wrap15.ave ? ? Description: Defines flow direction stream network with ? correct topology. As each arc is added, the first intersection is found. ? The added and existing arcs are split at that point with only the upstream ? portion of the added arc retained ? ? History: Original by Brad Hudgens, 1/19/99 ?Initializing theView=av.getactivedoc theThemes=theView.getthemes demGtheme=msgbox.choice(theThemes, "Select the Filled DEM", "WRAP Parameters") fdrGtheme=msgbox.choice(theThemes, "Select the Flow Direction Grid", "WRAP Parameters") networkFtheme=msgbox.choice(theThemes, "Select Stream Network", "WRAP Parameters") demGrid = demGtheme.getgrid fdrGrid = fdrGtheme.getgrid theTable = networkFtheme.getFtab theShape = theTable.findfield("Shape") nodeList = {} fdrList = {} checkList = {} splitList={} splitList3={} splittheLine={} nodeLista={} nodeListb={} ?Create or get FdrNetTest.shp output file lineThmName = "FdrNetTest.shp" TheDir=av.getproject.getworkdir lineFname=FN.merge(TheDir.asstring,"FdrNetTest.shp") if (theView.findtheme(lineThmName)=nil) then 234 lineFtab=ftab.makenew(lineFname,polyline) lineTheme=ftheme.make(lineFtab) lineFields=list.make lineFields.add(field.make("ID",#field_long,12,0)) lineFtab.addfields(lineFields) theView.addtheme(lineTheme) lineTheme.setvisible(true) else lineTheme=theView.findtheme(lineThmName) lineFtab=lineTheme.getftab linetheme.setvisible(true) end ?Collect all Nodes in Polyline Network for each rec in theTable theLines = theTable.returnvalue(theShape, rec).aspolyline.explode for each reach in theLines thePoints = reach.asmultipoint nodeList.add(thePoints.aslist.get(0)) nodeList.add(thePoints.aslist.get(thePoints.count-1)) end end ?Find all dangling nodes and add flowpath for each to streamlines.shp theId = 1 elements = 0 theView.seteditabletheme(lineTheme) theField = lineFtab.findfield("Shape") theOtherField = lineFtab.findfield("ID") allNodes = nodeList.count-1 av.showmsg("Working...") av.showstopbutton while (nodeList.count > 0) overPos = 0 thePoint= nodeList.get(0) nodeList.remove(0) nodes = nodeList.count-1 if (av.setstatus((allNodes-nodes)/allNodes*100).not) then av.aetatatus(100) av.showmsg("Cancelled by operator.") exit end C = 0 while (C <= nodes) if (thePoint.intersects(nodeList.get(C))) then nodeList.remove(C) nodes = nodes - 1 overPos = overPos + 1 else C = C + 1 end end if (overPos < 1) then theLine = demGrid.returncostpath(fdrGrid,thePoint) ?SPLIT LINES ROUTINE if ((theLine.isempty).not) then if ((elements=0).not) then ?get all lines that intersect theLine lineFtab.selectbypolyline(theLine,#VTAB_SELTYPE_NEW) for each rec in (lineFtab.getselection) 235 aLine=lineFtab.returnvalue(theField,rec) checkList.add(aLine) end ? alternate method : convert theLine to multipoint ? and check each vertex in order with findbypoint ? to see if it is contained in neighboring arcs ? another method : just selectbypoint for each ? vertex and see what is returned ?get all nodes from intersecting lines for each checkLine in checkList checkSeg=checkLine.returndifference(theLine) if ((checkSeg.isnull).not) then checkPnts=checkSeg.asmultipoint nodeLista.add(checkPnts.aslist.get(0)) NodeLista.add(checkPnts.aslist.get(checkpnts.count-1)) ?if (checkpnts.isnull) then ?msgbox.error("No checkseg!","WP") ?exit ?end end end ?Keep only nodes that are on theLine for each node in nodeLista if (theLine.contains(node)) then nodeListb.add(node) end end ?Find which node is closest to head = split node interpos=100 for each node in nodeListb pos=theLine.pointposition(node) if (pos<=interpos) then interpos=pos splitNode=node end end if (interpos=100) then msgbox.error("interpos=100!","WP") exit end if ((splitNode.isnull).not) then splitTheLine=theLine.split(splitNode) ?if (splitTheLine.isempty) then ?splitTheLine=theLine ?else theNewLine=splitTheLine.get(0) lineFtab.selectbypoint(splitNode,1,#VTAB_SELTYPE_NEW) for each rec in lineFtab.getselection workLine=lineFtab.returnvalue(theField, rec) splitList=workLine.split(splitNode) lineFtab.removerecord(rec) end else msgbox.error("No line found","WRAP Parameters") exit end for each listing in SplitList 236 newRec = lineFTab.addrecord lineFtab.setvalue(theField, newRec, listing) lineFtab.setvalue(theOtherField, newRec, theId) theId = theId + 1 end newRec = lineFtab.addrecord lineFtab.setvalue(theField, newRec, theNewLine) lineFtab.setvalue(theOtherField, newRec, theId) theId = theId + 1 elements=elements+2 nodeLista.empty nodeListb.empty splitTheLine.empty splitList.empty else newRec = lineFtab.addrecord lineFtab.setvalue(theField, newRec, theLine) lineFtab.setvalue(theOtherField, newRec, theId) theId = theId + 1 elements=elements+1 end end end end av.setstatus(100) av.clearmsg av.getproject.setmodified(true) lineFtab.seteditable(false) ? Script: wrap.fdrstreams, wrap16.ave ? ? Description: Traces stream flow path from a flow direction grid and filled DEM for all the dangling nodes (headwaters)in a stream network ? The stream network must be clean with no internal dangling nodes. ? ? History: Created 1/18/99 by Brad Hudgens ?Initializing theView=av.getactivedoc ?get themes theThemes = theview.getThemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No feature themes found","WRAP Parameters") exit end 237 theGthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count = 0) then msgbox.error("No grid themes found","WRAP Parameters") exit end demGtheme=msgbox.choice(theGthemes,"Select Filled DEM","WRAP Parameters") fdrGtheme=msgbox.choice(theGthemes,"Select Flow Direction Grid","WRAP Parameters") networkFtheme=msgbox.choice(theFthemes, "Select Stream Network", "WRAP Parameters") demGrid=demGtheme.getgrid fdrGrid=fdrGtheme.getgrid theTable = networkFtheme.getftab theShape = theTable.findfield("Shape") NodeList = {} dangleList={} centerList={} dangleCount=1 ?Create or get Fdrstrmnet.shp output file linethmname = "FdrStrmNet.shp" theDir=av.getproject.getworkdir lineFname=FN.merge(theDir.asstring,"FdrStrmNet.shp") if (theView.findtheme(linethmname)=nil) then lineFtab=ftab.makenew(lineFname,polyline) lineTheme=ftheme.make(lineFtab) ?must add at least one field in addition to the shape field lineFields=list.make lineFields.add(field.make("ID",#field_long,12,0)) lineFtab.addFields(lineFields) theView.addTheme(lineTheme) lineTheme.setvisible(true) lineFtab.seteditable(true) else lineTheme=theView.findtheme(lineThmname) lineFtab=lineTheme.getftab lineTheme.setvisible(true) lineFtab.seteditable(true) end ?make Ftab for headwater nodes interFn=FN.make("headwatr") interFtab=ftab.makenew(interfn,point) inFlds=list.make inFlds.add(field.make("ID",#field_long,12,0)) interFtab.addfields(inFlds) interFtab.seteditable(true) 238 ?Collect all Nodes in Polyline Network for each rec in theTable theLines = theTable.returnvalue(theShape, rec).aspolyline.explode for each reach in theLines thePoints = reach.asmultipoint if (thePoints.isnull.not) then nodeList.add(thePoints.aslist.get(0)) nodeList.add(thePoints.asList.get(thePoints.count-1)) end end end ?Find all dangling nodes and add flowpath for each interShapeFld=interFtab.findfield("shape") interIdFld=interFtab.findfield("ID") theId = 1 allNodes = nodeList.count-1 av.showmsg("Processing Nodes...") av.showstopbutton while (nodeList.count > 0) overPos = 0 thePoint= nodeList.get(0) nodeList.remove(0) nodes = nodeList.count-1 if (av.setstatus((allNodes-nodes)/allNodes*100).not) then av.setstatus(100) av.showmsg("Cancelled by operator.") exit end C = 0 while (C <= nodes) if (thePoint.intersects(nodeList.get(C))) then nodeList.remove(C) nodes = nodes - 1 overPos = overPos + 1 else C = C + 1 end end if (overPos < 1) then ?add thePoint to intermediate Ftab newRec=interFtab.addrecord interFtab.setvalue(interShapeFld, newRec, thePoint) interFtab.setvalue(interIdFld, newRec, dangleCount) dangleCount=dangleCount+1 end av.setstatus((allNodes-nodes)/allNodes*100) end idCellSize=demGrid.getcellsize idExtent=demGrid.getextent ?center points by making interFtab into grid pntsGrid=grid.makefromftab(interFtab,prj.makenull,interIdFld, idCellSize,idExtent}) centerFTab=pntsGrid.aspointftab("Centered.shp".asfilename,prj .makenull) centerFtab.seteditable(true) centerFtab.addfields(inflds) av.showmsg("Building Lines...") index=0 centrFld=centerFtab.findfield("shape") 239 for each center in centerFtab progress=index/dangleCount*100 av.setstatus(progress) theNode=centerFtab.returnvalue(centrFld, center) theCellValue=demGrid.cellvalue(theNode, prj.makenull) if ((theCellValue.isnull).not) then theLine = demGrid.returncostpath(fdrGrid,theNode) lineFtab.begintransaction theField = lineFTab.findfield("Shape") theOtherField = lineFTab.findfield("ID") rec = lineFTab.addrecord lineFtab.setvalue(theField, rec, theLine) lineFtab.setvalue(theOtherField, rec, theId) lineFtab.endtransaction theId = theId + 1 index=index+1 end end av.setstatus(100) av.clearmsg av.getproject.setmodified(true) lineFtab.seteditable(false) ? Script: wrap.filldem, wrap17.ave ? ? Description: Fills sinks on an user specified DEM. ? ? History: modified by Brad Hudgens 9/23/99 from CRWR Prepro theView=av.getactivedoc thethemes=theView.getthemes theGthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count = 0) then msgbox.error("No grids found","WRAP Parameters") exit end inThm=msgbox.choice(theGthemes,"Select the DEM","WRAP Parameters") ?fill sinks in Grid until they are gone elevGrd=inThm.getgrid tmpGrd=elevGrd*1 sinkCount=0 numSinks=0 while (TRUE) flowDirGrid=tmpGrd.flowdirection(FALSE) sinkGrid=flowDirGrid.sink if (sinkGrid.GetVTab=NIL) then ? check for errors if (sinkGrid.HasError) then return NIL end 240 sinkGrid.buildVAT end ? check for errors if (sinkGrid.haserror) then return NIL end if (sinkGrid.getVTab <> NIL) then theVTab=sinkGrid.getvTab numClass=theVTab.getnumrecords newSinkCount=theVTab.returnvalue(theVTab.findfield("Count "),0) else numClass=0 newSinkCount=0 end if (numClass < 1) then break elseif ((numSinks=numClass) and (sinkCount=newSinkCount)) then break end waterGrid=flowDirGrid.watershed(sinkGrid) zonalFillGrid=waterGrid.zonalfill(tmpGrd) fillGrid=(tmpGrd < (zonalFillGrid.isnull.Con(0.asgrid,zonalFillGrid))).con(zonalFil Grid,tmpGrd) tmpGrd=fillGrid numSinks=numClass sinkCount=newSinkCount end aFN=FN.make("Filldem") tmpGrd.rename(aFN) theGTheme=GTheme.make(tmpGrd) ?create a theme theGTheme.setname("FillDEM") ? set name of theme theView.addtheme(theGTheme) ? add theme to the view ?Script: wrap.mergethemes, wrap18.ave ? ?Description: Merges two or more themes of the same feature class. The fields in the first theme selected are ? copied to the output shapefile ? ?History: Modified 9/23/99 by Brad Hudgens from original by Christine Dartinegauve, CRWR theView=av.GetActiveDoc theThemes=theView.GetThemes if (theThemes.Count<2) then MsgBox.Error("Must have at least two themes in a view to merge.","") exit end themesToMerge=List.Make while (true) t=MsgBox.Choice(theThemes,"Choose themes in view to merge:"+NL+"(Click Cancel to end):","WRAP Parameters") if (t<>Nil) then themesToMerge.Add(t) else break 241 end end if ((themestoMerge=Nil) or (themesToMerge.Count<2)) then MsgBox.Error("Not enough themes to merge.","") exit end checkType=themesToMerge.Get(0).GetFTab.FindField("Shape ").GetType for each i in 1..(themesToMerge.Count-1) t=themesToMerge.Get(i) if (checkType<>t.GetFtab.FindField("Shape").GetType) then MsgBox.Error("Theme feature type mismatch -- unable to merge.","") exit end end outFName=av.GetProject.MakeFileName("theme","shp") outFname=FileDialog.Put(outFname,"*.shp","Output Merged Shapefile") if (outFName=Nil) then exit end fieldList=List.Make for each f in themesToMerge.Get(0).GetFTab.GetFields if (f.GetName="Shape") then continue else fCopy=f.Clone fieldList.Add(fCopy) end end shapeType=themesToMerge.Get(0).GetFTab.FindField("Shape ).GetType if (shapeType=#FIELD_SHAPELINE) then outClass=POLYLINE elseif (shapeType=#FIELD_SHAPEMULTIPOINT) then outClass=MULTIPOINT elseif (shapeType=#FIELD_SHAPEPOINT) then outClass=POINT elseif (shapeType=#FIELD_SHAPEPOLY) then outClass=POLYGON else MsgBox.Error("Invalid shape field type.","") exit end mergeFTab=FTab.MakeNew(outFName,outClass) if (fieldList.Count>0) then mergeFTab.AddFields(fieldList) end for each t in themesToMerge av.ShowMsg("Merging"++t.GetName) inFTab=t.GetFTab if (inFTab.GetSelection.Count=0) then theRecordsToMerge=inFTab numRecs=inFTab.GetNumRecords else theRecordsToMerge=inFTab.GetSelection numRecs=theRecordsToMerge.Count 242 end for each rec in theRecordsToMerge av.SetStatus((rec/numRecs)*100) newRec=mergeFTab.Addrecord inField=inFTab.FindField("Shape") outField=mergeFTab.FindField("Shape") mergeFTab.SetValue(outField,newrec,inFTab.ReturnValue(i nField,rec)) if (fieldList.Count>0) then for each f in fieldList fName=f.GetName inField=inFTab.FindField(fName) if (inField<>Nil) then outField=mergeFTab.FindField(fName) aValue=inFTab.ReturnValue(inField,rec) mergeFTab.SetValue(outField,newRec,aValue) end end end end end av.ClearMsg av.ClearStatus if (MsgBox.YesNo("Add shapefile as theme to view?","WRAP Parameters",true).Not)then exit end viewList={} for each d in av.GetProject.GetDocs if (d.Is(View)) then viewList.Add(d) end end viewList.Add("") addToView=MsgBox.ListAsString(viewList,"Add Theme to:","WRAP Parameters") if (addToView<>Nil) then if (addToView="") then addToView=View.Make addToView.GetWin.Open end mergeTheme=FTheme.Make(mergeFTab) addToView.AddTheme(mergeTheme) addToView.GetWin.Activate end ? Script: wrap.network, wrap19.ave ? ? Description: Run on snapped control point theme. Connects each ? control point to next downstream control point. Adds downstream ? CP field to snapped control point theme and outputs line theme ? showing connectivity 243 ? ? History: Original by Brad Hudgens, 9/24/99 theView = av.getactivedoc av.showstopbutton dsList={} theDsArcId=0 totCount=0 ?get themes theThemes = theView.getthemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No coverage themes found","WRAP Parameters") exit end ?select snapped control point coverage cpTheme = msgbox.choice(theFthemes, "Select the Snapped Control Point Coverage","WRAP Parameters") if (cpTheme = nil) then exit end ?select the stream network strTheme = msgbox.choice(theFthemes, "Select the Stream Network","WRAP Parameters") if (strTheme = nil) then exit end cpFtab = cpTheme.getftab if (cpFtab = nil) then msgbox.error("Can?t open control point coverage","WRAP Parameters") exit end cpShapeFld = cpFtab.findfield("shape") cpIdFld = cpFtab.findfield("ID") cpArcIdFld = cpFtab.findfield("ArcID") cpPcntFld = cpFtab.findfield("distance") ?make ds cp field cpFtab.seteditable(true) newFields=list.make newFields.add(field.make("DsCP",#field_long,12,0)) cpFtab.addfields(newFields) cpDsFld=cpFtab.findfield("DsCP") for each countRec in cpFtab totCount=totCount+1 end strFtab = strTheme.getftab if (strFtab = nil) then 244 msgbox.error("Can?t open stream network coverage","WRAP Parameters") exit end strShapeFld = strFtab.findfield("shape") strArcIdFld = strFtab.findfield("ArcID") dsArcIdFld = strFtab.findfield("DSArcID") theNewFn = fn.make("network") netFtab = ftab.makenew(thenewfn, polyline) theIdFld = field.make("Id", #FIELD_decimal,8,0) netFtab.addfields({theIdFld}) netFtab.seteditable(true) netShapeFld = netFtab.findfield("shape") netIdFld = netFtab.findfield("Id") theId=0 checkList={} for each rec in cpFtab progress=theId/totCount*100 av.setstatus(progress) thePnt = cpFtab.returnvalue(cpShapeFld, rec) currArc = cpFtab.returnvalue(cpArcIdFld, rec) currPcnt = cpFtab.returnvalue(cpPcntFld, rec) foundnext = false ?check for d/s point on same arc checkDist=101 for each pntRec in cpFtab pntArcId = cpFtab.returnvalue(cpArcIdFld, pntRec) pntPcnt = cpFtab.returnvalue(cpPcntFld, pntRec) if ((pntArcId = currArc) and (pntPcnt > currPcnt)) then foundnext=true separation=pntPcnt-currPcnt if (separation < checkDist) then checkDist = separation nextCp = cpFtab.returnvalue(cpShapeFld, pntRec) nextCpId = cpFtab.returnvalue(cpIdFld, pntRec) end end end while (foundnext = false) ?find next ds arc for each lineRec2 in strFtab theArcId = strFtab.returnvalue(strArcIdFld, lineRec2) if (theArcId = currArc) then theDsArcId = strFtab.returnvalue(dsArcIdFld, lineRec2) dsArc = strFtab.returnvalue(strShapeFld, lineRec2) end end ?if dsArcId = 0 then ds cp = outlet if (theDsArcId = 0) then vertices = dsArc.asmultipoint theOutlet = vertices.aslist.get(vertices.count-1) nextCp = theOutlet nextCpId = 0 foundnext = true end ?check for cps on d/sarc if (foundnext = false) then mark=100 for each pntRec2 in cpFtab 245 pntArcId2 = cpFtab.returnvalue(cpArcIdFld, pntRec2) if (pntArcId2 = theDsArcId) then foundnext = true pcnt2=cpFtab.returnvalue(cpPcntFld, pntRec2) if (pcnt2<=mark) then mark=pcnt2 nextCp=cpFtab.returnvalue(cpShapeFld, pntRec2) nextCpId=cpFtab.returnvalue(cpIdFld, pntRec2) end end end end currArc = theDsArcId end theLine = polyLine.make({{thePnt, nextCp}}) newRec = netFtab.addrecord netFtab.setvalue(netShapeFld, newRec, theLine) netFtab.setvalue(netIdFld, newRec, theId) cpFtab.setvalue(cpDsFld, rec, nextCpId) theId=theId+1 end cpFtab.seteditable(false) netFtab.seteditable(false) newTheme = ftheme.make(netFtab) newTheme.setname("network") theView.addtheme(newTheme) av.clearstatus ? Script: wrap.parameters_menu, wrap20.ave ? ? Description: returns parameter values from parameter grids for ? each control point ? ? History: Original by Brad Hudgens, 9/24/99 theView = av.getactivedoc theDir=av.getproject.getworkdir.asstring theDisplay=theView.getdisplay smsg="WRAP Parameters" if ((_facThmNm=nil) or (_cnThmNm=nil) or (_pcpThmNm=nil) or (_flowlThmNm=nil)) then msgbox.info("Set the parameter grid theme names in the WRAP Tools menu",smsg) exit end facThm=theView.findtheme(_facThmNm) if (facThm=nil) then msgbox.info("Flow accumulation theme not found",smsg) exit end cnThm=theView.findtheme(_cnThmNm) if (cnThm=nil) then msgbox.info("Curve Number theme not found",smsg) exit end pcpThm=theView.findtheme(_pcpThmNm) 246 if (pcpThm=nil) then msgbox.info("Precipitation theme not found",smsg) exit end if (_flowlThmNm <> "none") then flowlThm=theView.findtheme(_flowlThmNm) if (flowlThm=nil) then msgbox.info("Flow length theme not found",smsg) exit end end ?Get parameter grids facGrid=facThm.getgrid if (facGrid.haserror) then msgbox.info("Error in flow accumulation grid", smsg) exit end avgCnGrid=cnThm.getgrid if (avgCnGrid.haserror) then msgbox.info("Error in curve number grid", smsg) exit end avgPcpGrid=pcpThm.getgrid if (avgPcpGrid.haserror) then msgbox.info("Error in precipitation grid", smsg) exit end if (_flowlThmNm <> "none") then flowlGrid=flowlThm.getgrid if (flowlGrid.haserror) then msgbox.info("Error in flow length grid", smsg) exit end end theCellSize = facGrid.getcellsize ?get themes theThemes = theView.getThemes if (theThemes.count = 0) then msgbox.error("No themes found",smsg) exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No feature themes found",smsg) exit end ?select control point coverage theCpTheme = msgbox.choice(theFthemes, "Select the Control Point coverage",smsg) if (theCpTheme = nil) then exit end 247 cpFtab = theCpTheme.getftab if (cpftab = nil) then msgbox.error("Can?t open control point coverage",smsg) exit end issnap=msgbox.yesno("Are you using a snapped CP coverage?",smsg,true) theNewFn = fn.make(theDir+"parameters") pFtab = ftab.makenew(theNewFn, point) theIdField = field.make("Id", #FIELD_FLOAT, 12, 0) theTypeField = field.make("Type", #Field_VChar, 20, 0) theFacField = field.make("DemFac", #FIELD_FLOAT, 20, 0) theAreaField = field.make("Area(sq.mi.)", #FIELD_FLOAT, 20, 4) theAvgCnField = field.make("AvgCN", #FIELD_FLOAT, 10, 2) theAvgPcpField = field.make("AvgPrecip", #FIELD_FLOAT, 10, 2) theFlowlField = field.make("FlowLength", #FIELD_FLOAT, 20, 2) pFtab.addfields({theIdField, theTypeField, theFacField, theAreaField, theAvgCnField, theAvgPcpField, theFlowlField}) pFtab.seteditable(true) if (issnap) then theDsCpFld =field.make ("DsCP", #FIELD_LONG, 12,0) pFtab.addfields({theDsCpFld}) end theCpShapeField = cpFtab.findfield("shape") theCpIdField = cpFtab.findfield("id") theCpTypeField = cpFtab.findfield("type") if (issnap) then theCpDsFld = cpFtab.findfield("DsCP") end thepShapeField = pFtab.findfield("shape") thepIdField = pFtab.findfield("id") thepTypeField = pFtab.findfield("type") if (issnap) then theptDsFld = pFtab.findfield("DsCP") end thepFacField = pFtab.findfield("DemFac") thepAreaField = pFtab.findfield("Area(sq.mi.)") thepCnField = pFtab.findfield("AvgCN") thepPcpField = pFtab.findfield("AvgPrecip") thepFlowField = pFtab.findfield("FlowLength") cnt=0 for each item in cpFtab cnt=cnt+1 end av.showmsg("Building parameters...") indx=0 for each rec in cpFtab progress=((indx/cnt)*100) av.setstatus(progress) thePoint = cpFtab.returnvalue(theCpShapeField, rec) theId = cpFtab.returnvalue(theCpIdField, rec) theType = cpFtab.returnvalue(theCpTypeField, rec) if (issnap) then 248 theDsCp = cpFtab.returnvalue(theCpDsFld, rec) end newRec = pFtab.addrecord pFtab.setvalue(thepShapeField,newRec,thePoint) pFtab.setvalue(thepIdField,newRec,theId) pFtab.setvalue(thepTypeField,newRec,theType) if (issnap) then pFtab.setvalue(theptDsFld, newRec, theDsCp) end theFacValue = facGrid.cellvalue(thepoint,prj.makenull) pFtab.setvalue(thepFacField,newRec,theFacValue) theArea = theCellSize^2*theFacValue*0.000000386102 pFtab.setvalue(thepAreaField,newRec,theArea) theCnValue = avgCnGrid.cellvalue(thePoint,prj.makenull) pFtab.setvalue(thepCnField,newRec,theCnValue) thePcpValue = avgPcpGrid.cellvalue(thePoint,prj.makenull) pFtab.setvalue(thepPcpField,newRec,thePcpValue) if (_flowlThmNm <> "none") then theFlowlValue = flowlGrid.cellvalue(thePoint,prj.makenull) else theFlowlValue = 0 end pFtab.setvalue(thepFlowField,newRec,theFlowlValue) indx=indx+1 end av.setstatus(100) pFtab.seteditable(false) pTheme = ftheme.make(pFtab) pTheme.setname("Parameters") theView.addtheme(pTheme) ? Script: wrap.parameters_tool, wrap21.ave ? ? Description: returns parameter values from parameter grids for ? each control point ? ? History: Original by Brad Hudgens, 9/24/99 theView = av.getactivedoc smsg="WRAP Parameters" theDisplay=theView.getdisplay if ((_facThmNm=nil) or (_cnThmNm=nil) or (_pcpThmNm=nil) or (_flowlThmNm=nil)) then msgbox.info("Set the parameter grid theme names in the WRAP Tools menu",smsg) exit end facThm=theView.findtheme(_facThmNm) if (facThm=nil) then msgbox.info("Flow accumulation theme not found",smsg) exit end 249 cnThm=theView.findtheme(_cnThmNm) if (cnThm=nil) then msgbox.info("Curve Number theme not found",smsg) exit end pcpThm=theView.findtheme(_pcpThmNm) if (pcpThm=nil) then msgbox.info("Precipitation theme not found",smsg) exit end if (_flowlThmNm <> "none") then flowlThm=theView.findtheme(_flowlThmNm) if (flowlThm=nil) then msgbox.info("Flow length theme not found",smsg) exit end end ?Get parameter grids facGrid = facThm.getgrid if (facGrid.haserror) then msgbox.info("Error in flow accumulation grid", smsg) exit end avgCnGrid=cnThm.getgrid if (avgCnGrid.haserror) then msgbox.info("Error in curve number grid", smsg) exit end avgPcpGrid = pcpThm.getgrid if (avgPcpGrid.haserror) then msgbox.info("Error in precipitation grid", smsg) exit end if (_flowlThmNm <> "none") then flowlGrid = flowlThm.getgrid if (flowlGrid.haserror) then msgbox.info("Error in flow length grid", smsg) exit end end theCellSize = facGrid.getcellsize thePoint=theDisplay.returnuserpoint theFacValue = facGrid.cellvalue(thePoint,prj.makenull) theArea = theCellSize^2*theFacValue*0.000000386102 theCnValue = avgCnGrid.cellvalue(thePoint,prj.makenull) thePcpValue = avgPcpGrid.cellvalue(thePoint,prj.makenull) if (_flowlThmNm <> "none") then theFlowlValue = flowlGrid.cellvalue(thePoint,prj.makenull) else theFlowlValue="none" end msgbox.report("Flow accumulation : "+theFacValue.asstring+NL+"Area (sq.mi.) : "+theArea.asstring+NL+"Average curve number : "+theCnValue.asstring+NL+"Average mean annual 250 precipitation : "+thePcpValue.asstring+NL+"Flow length : "+theFlowlValue.asstring,smsg) exit ? Script: wrap.resample, wrap22.ave ? ? Description: Resamples a grid to user-specified cell size. ? ? History: Modified by Brad Hudgens 9/24/99 from original by ? Brent L. Brock, Dept. of Agronomy, Kansas State Univ. ?test if Spatial Analyst is loaded test=extension.find("Spatial Analyst") if (test=NIL) then msgbox.error("You must have the spatial analyst extension loaded","WRAP Parameters") return(nil) end theView = av.getactivedoc ? get active gTheme theTheme = theView.getactivethemes.get(0) theExt = theTheme.getclass.getclassname if (theExt <> "Gtheme") then msgbox.error("The Selected Theme Is Not A Grid", "WRAP Parameters") return(nil) end theGrid = theTheme.getgrid theCellSize = theGrid.getcellsize.asstring ? display input box to get cell size and resampling method information. defaultString = theCellSize theSize = msgbox.input("Enter Output Cell Size", "WRAP Parameters", defaultstring) if (theSize = NIL) then return(nil) end aCellSize = theSize.asnumber aList = {"Nearest Neighbor","Bilinear Interpolation","Cubic Convolution"} for each s in aList s.setName(s) end theSampMethod = msgbox.choice ( aList,"Resampling Method", "ResampleGrid") if (theSampMethod = aList.get(0)) then aGridResTypeEnum = #GRID_RESTYPE_NEAREST elseif (theSampMethod = aList.get(1)) then aGridResTypeEnum = #GRID_RESTYPE_BILINEAR elseif (theSampMethod = aList.get(2)) then aGridResTypeEnum = #GRID_RESTYPE_CUBIC else return(nil) end ? create a theme with resampled data theGtheme = gtheme.make(theGrid.resample (aCellSize, aGridResTypeEnum)) 251 theGtheme.setname("Resampled"++theTheme.GetName) theView.addtheme(theGtheme) ? Script: wrap.setcpthemes, wrap23.ave ? ? Description: Defines global variables of control point themes for use by the add ? and add snapped control point tools ? ? History: Original 9/24/99 by Brad Hudgens theThemes=list.make labelList=list.make defaultList=list.make labelList={"Control Points","Snapped Control Points"} defaultList={"ControlPoints","SnapCPs"} theThemes=msgbox.multiinput("Input the CP Tool Theme Names :","WRAP Parameters", labelList, defaultList) _cpThm=theThemes.get(0) if (_cpThm=nil) then msgbox.error("No Control Point Theme","") exit end _snapCpThm=theThemes.get(1) if (_snapCpThm=nil) then msgbox.error("No Snapped Control Point Theme","") exit end exit ? Script: wrap.setgridthemes, wrap24.ave ? ? Description: Defines global variables of control point themes for use by the add ? and add snapped control point tools ? ? History: Original 9/24/99 by Brad Hudgens theThemes=list.make labelList=list.make defaultList=list.make smsg="WRAP Parameters" labelList={"Flow Accumulation","Average Curve Number","Average Precipitation","Flow Length"} defaultList={"facalb","acnalb","apcalb","none"} theThemes=msgbox.multiinput("Input the parameter grid theme names. If flow length is not used, enter ?none?",smsg, labelList, defaultList) _facThmNm=theThemes.get(0) if (_facThmNm=nil) then msgbox.error("No flow accumulation theme name entered",smsg) exit 252 end _cnThmNm=theThemes.get(1) if (_cnThmNm=nil) then msgbox.error("No average curve number theme name entered",smsg) exit end _pcpThmNm=theThemes.get(2) if (_pcpThmNm=nil) then msgbox.error("No average precipitation theme name entered",smsg) exit end _flowlThmNm=theThemes.get(3) if (_flowlThmNm=nil) then msgbox.error("No flow length theme name entered",smsg) exit end exit ? Script: wrap.snapcp_menu, wrap25.ave ? ? Description: Snaps points in point theme onto selected line theme. ? Points that cannot be snapped are selected (highlighted in the original ? point theme. Arcs for snapping are found by FindByPoint function, which locates features ? within 3 screen pixels of the point. To make sure arcs can be found, the view display ? must be zoomed out well beyond the extent of the line theme. ? ? History: Modified 9/23/99 by Brad Hudgens from original by Richard Gu, CRWR ID="ID" factor=1 snap_distance=msgbox.input("Enter a snapping tolerance (in coverage units):","Wrap Parameters","1000") sMsg="Creating Snapped Point Coverage" av.getproject.setmodified(true) theView = av.getactivedoc ?get themes theThemes = theView.getthemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No feature themes found","WRAP Parameters") exit 253 end problemList=list.make ?select themes lineThm=msgbox.choiceasstring(theFthemes, "Select a line theme", "WRAP Parameters") if (lineThm=nil) then msgbox.info("No line theme has been selected.","") exit end pntThm=msgbox.choiceasstring(theFthemes, "Select a point theme", "WRAP Parameters") if (PntThm=nil) then msgbox.info("No point theme has been selected.","") exit end pntWorkList=List.make pntFtab=pntThm.getftab pntFtab.seteditable(true) newThmName="SnapCPs" theDir=av.getproject.getworkdir newFilename=FN.merge(thedir.asstring,newThmName) newFtab=ftab.makenew(newFilename,point) newThm=ftheme.make(newFtab) pntFields=pntFtab.getfields newFields=pntFields.deepclone ?get rid of extra Shape field newFields.remove(0) newFtab.addFields(newFields) theView.addtheme(newThm) newFtab.seteditable(true) pntFld=pntFtab.findfield("Shape") newPntFld=newFtab.findfield("Shape") idFld=pntFtab.findfield(ID) newIdFld=newFtab.findfield(ID) typeFld=pntFtab.findfield("Type") newTypeFld=newFtab.findfield("Type") arcIdFld=field.make("ArcID",#Field_Long,12,0) pcntFld=field.make("distance",#Field_Long,4,0) newFtab.addFields({arcIdFld,pcntFld}) for each rec in pntFtab pntWorkList.add(rec.clone) end total=pntWorkList.count lmt_work=total-1 rTheme=lineThm rFtab=rTheme.getftab rShape=rFtab.findfield("Shape") rArcId=rFtab.findfield("ArcID") av.showmsg("Snapping control points...") 254 for each item in 0..lmt_work thePntRec=pntWorkList.get(item) inPnt=pntFtab.returnvalue(pntFld, thePntRec) inPntType=pntFtab.returnvalue(typeFld, thePntRec) if(inPnt=nil)then msgbox.info("No point is selected","") exit end theFtab=lineThm.getftab ?find neighboring arcs recs=rTheme.findbypoint(inPnt) theShpV=nil if(recs.isempty.not)then distance=10000 for each lnRec in recs rShpV=rFtab.returnvalue(rShape,lnRec) rArcV=rFtab.returnvalue(rArcId,lnRec) dist=inPnt.distance(rShpV) if(distC-> BC=((aax-bbx)*(ccx-bbx))+((aay-bby)*(ccy-bby)) ?chkingDotProductOF B->C-> LAC=((ccx-aax)*(ccx-aax)+((ccy-aay)*(ccy-aay))) ?chking Dist between A and C 8/1 if (LAC < 5) then pFound=True distList.add(LAC.clone) nPntList.add(pntList.get(idx).clone) cLenList.add(cLength.clone) end ABL=(((bbx-aax)^2)+((bby-aay)^2)) tLength=tLength+(ABL.sqrt) if((AC<0) or (BC<0))then ?segment AB doesn?t contain point C if(oldAC=nil)then oldAC=AC else if((oldAC*AC)<0)then ?Angle changes from <90 to >90, the end point contains thePntV newX=aax newY=aay newPnt=point.make(newX,newY) ACLength=(((ccx-aax)^2)+((ccy-aay)^2)).sqrt if(not (ACLength.isnull))then distList.add(ACLength.clone) nPntList.add(newPnt.clone) cLenList.add(cLength.clone) pFound=true end else oldAC=AC end end ?(OldAC=nil) cLength=cLength+(ABL.sqrt) else ?Segment AB contains point C ACLength=(((ccx-aax)^2)+((ccy-aay)^2)).sqrt newX=aax+((bbx-aax)*AC/ABL) newY=aay+((bby-aay)*AC/ABL) cLength=cLength+(AC/(ABL.sqrt)) ?AC=A dot C cosA=AC/(ABL*ACLength) sinA=(1-(cosA^2)).sqrt dist=ACLength*sinA if(not (dist.isnull))then ?Zye 7/8/97 distList.add(dist.clone) newPnt=point.make(newX,newY) nPntList.add(newPnt.clone) cLenList.add(cLength.clone) pFound=true end end end ?end for each idx end ?endif(PntList.count<=2) if(pFound.Not)then newpnt=nil else if(pntList.Count>2)then nMatch=nPntList.count ndx=0 minDist=distList.get(0) 256 newPnt=nPntList.get(0) cLength=clenList.get(0) if(nMatch>1)then for each i in 1..(nMatch-1) tmpDist=distList.get(i) if(tmpDist1) then msgbox.error("The line theme should be the only theme active","WRAP Parameters") exit end lineThm=theActThemes.get(0) if (lineThm=nil) then msgbox.error("Error opening line theme","WRAP Parameters") 257 exit end rTheme=lineThm rFtab=rTheme.getftab rShape=rFtab.findfield("Shape") rArcId=rFtab.findfield("ArcID") pntThmName=_snapCpThm+".shp" if (_snapCpThm=nil) then msgbox.info("Set the control point theme names in the WRAP Tools menu","WRAP Parameters") exit end pntFileName=FN.Merge(Thedir.AsString,_snapCpThm+".shp") ?identify the tool that called the script theTool=av.getactivegui.gettoolbar.getactive.gettag ?get the control point inPnt=theView.getdisplay.returnuserpoint ?input type and id number of control point options={ "Diversion point","Return flow","Other secondary","Stream gage","Other primary"} choise=msgbox.choiceasstring(options,"Choose the type of control point:","WRAP Parameters") if (choise=nil)then msgbox.error("No Selection","WRAP Parameters") end id_string=msgbox.input("Enter the ID number:","WRAP Parameters","0") if (id_string.isnumber) then id_number=id_string.asnumber else msgbox.error("ID must be an integer","WRAP Parameters") exit end ?If this is the first point, make the FTab if(theView.findtheme(pntThmName)=nil) then pntFtab=ftab.makenew(pntFileName,point) pntTheme=ftheme.make(pntFtab) pntFields=list.make pntFields.add(field.make("ID",#Field_Long,12,1)) pntFields.add(field.make("Type",#Field_VChar,20,0)) pntfields.add(field.make("ArcID",#Field_Long,12,0)) pntfields.add(field.make("distance",#Field_Long,4,0)) pntFieldsC=pntFields.deepclone pntFtab.addFields(pntFieldsC) theView.addtheme(pntTheme) if(pntFtab.canedit) then pntFtab.seteditable(true) else msgbox.error("Can?t edit the output theme.","WRAP Parameters") exit end pntTheme.setvisible(true) ?If this is not the first point, get the FTab else 258 ?Check Ftab for duplicate id numbers pntTheme=theView.findtheme(pntThmName) table_pnt=pntTheme.getftab field_id=table_pnt.findfield("ID") for each rec in table_pnt if (table_pnt.returnvalue(field_id,rec)=id_number)then msgbox.error("ID number duplicated","WRAP Parameters") exit end end pntFtab=pntTheme.getftab if(pntFtab.canedit) then pntFtab.seteditable(true) else msgbox.error("Can?t edit point theme.","WRAP Parameters") exit end end pntFld=pntFtab.findfield("Shape") idFld=pntFtab.findfield("ID") typeFld=pntFtab.findfield("Type") arcIdFld=pntFtab.findfield("ArcID") pcntFld=pntFtab.findfield("distance") thePntV=inPnt count=0 for each rec in rFtab.getselection count=count+1 end if (count<1) then msgbox.error("No arcs selected in line theme","WRAP Parameters") exit end if (count>1) then msgbox.error("More than one arc selected in line theme","WRAP Parameters") exit end for each rec in rFtab.getselection theShpV=rFtab.returnvalue(rShape, rec) theArcV=rFtab.returnvalue(rArcId, rec) end pntList=theShpV.asmultipoint.aslist ccx=thePntV.getX ccy=thePntV.getY cLength=0.0 distList=list.make ?Dists between each potential snap point and original point. nPntList=list.make ?Potential snap-to points. cLenList=list.make ?Dists between from node to each potential snap-to points. if(pntList.count=2)then aax=pntList.get(0).getX aay=pntList.get(0).getY bbx=pntList.get(1).getX bby=pntList.get(1).getY tLength=(((bbx-aax)^2)+((bby-aay)^2))^(0.5) AC=((bbx-aax)*(ccx-aax))+((bby-aay)*(ccy-aay)) 259 cLength=AC/tLength ?A.C=A.abs*C.abs*Cos(AC), Clength=C.abs*Cos(AC), A.abs=TLength newX=aax+((bbx-aax)*(cLength/tLength)) newY=aay+((bby-aay)*(cLength/tLength)) newPnt=point.make(newX,newY) pFound=true else pcnt=pntList.count-2 pFound=false ?Start computation loop oldAC=nil tLength=0.0 for each idx in 0..pcnt aax=pntList.get(idx).getX aay=pntList.get(idx).getY bbx=pntList.get(idx+1).getX bby=pntList.get(idx+1).getY AC=((bbx-aax)*(ccx-aax))+((bby-aay)*(ccy-aay)) ?chkingDotProductOf A->C-> BC=((aax-bbx)*(ccx-bbx))+((aay-bby)*(ccy-bby)) ?chkingDotProductOF B->C-> LAC=((ccx-aax)*(ccx-aax)+((ccy-aay)*(ccy-aay))) ?chking Dist between A and C 8/1 if (LAC < 5) then pFound=true distList.add(LAC.clone) nPntList.add(pntList.get(idx).clone) cLenList.add(cLength.clone) end ?8/1 ABL=(((bbx-aax)^2)+((bby-aay)^2)) tLength=tLength+(ABL.Sqrt) if((AC<0) or (BC<0))then ?segment AB doesn?tContain Point C if(oldAC=nil)then oldAC=AC else if((oldAC*AC)<0)then ?Angle changes from <90 to >90, the end point contains thePntV newX=aax newY=aay newPnt=point.make(newX,newY) ACLength=(((ccx-aax)^2)+((ccy-aay)^2)).sqrt if(not (ACLength.isnull))then distList.add(ACLength.clone) nPntList.add(newPnt.clone) cLenList.add(cLength.clone) pFound=true end else oldAC=AC end end cLength=cLength+(ABL.sqrt) else ?Segment AB contains point C ACLength=(((ccx-aax)^2)+((ccy-aay)^2)).sqrt newX=aax+((bbx-aax)*AC/ABL) newY=aay+((bby-aay)*AC/ABL) cLength=cLength+(AC/(ABL.sqrt)) ?AC=A dot C cosA=AC/(ABL*ACLength) sinA=(1-(cosA^2)).sqrt dist=ACLength*sinA if(not (dist.isnull))then ?Zye 7/8/97 distList.add(dist.clone) newPnt=point.make(newX,newY) nPntList.add(newPnt.clone) cLenList.add(cLength.clone) 260 pFound=true end end end ?endfor each idx end ?endif(PntList.count<=2) if(pFound.not)then newPnt=nil else if(pntList.count>2)then nMatch=nPntList.count ndx=0 minDist=distList.get(0) newPnt=nPntList.get(0) cLength=cLenList.get(0) if(nMatch>1)then for each i in 1..(nMatch-1) tmpDist=distList.get(i) if(tmpDistnil) keepField=msgbox.choiceasstring(fieldList, "Select the Fields to Keep. Click Cancel to end", "WRAP Parameters") keepList.add(keepField) end dropList=fieldList.clone for each item1 in fieldList for each item2 in keepList if (item1=item2) then dropList.removeobj(item1) end end end theFTab.seteditable(true) theFtab.removeFields(dropList) theFtab.seteditable(false) ?Script: wrap.strmsort, wrap28.ave ? ?Description: Determines connectivity among arcs in stream network. Arbitrary ID numbers ?are assigned to each arc and the downstream arc determined ? ?History: Created by Richard Gu 11/26/98 sMsg="WRAP Parameters" 262 TheView=av.getactivedoc lineThmList=theView.getthemes ?get themes theThemes = theview.getthemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No coverage themes found","WRAP Parameters") exit end ?select stream network theme LineThm=Msgbox.ChoiceAsString(theFthemes, "Select network to build arc connectivity", sMsg) if (LineThm=nil) then Exit end theFtab=lineThm.getFtab theFtab.seteditable(true) nLines=theFtab.getnumrecords theFtab.seteditable(true) if (theFtab.findfield("ArcID")=nil) then segNumFld=field.make("ArcID", #FIELD_LONG, 4,0) theFtab.addfields({segNumFld}) end segNumFld=theFtab.findfield("ArcID") i=0 for each lrec in theFtab i=i+1 theFtab.setvalue(segNumFld,lrec,i) end nextSegNumFld=field.make("DSArcID", #FIELD_LONG, 4,0) if(theFtab.findfield("DSArcID")=nil)then theFtab.addfields({nextSegNumFld}) end lineShapef=theFtab.findfield("Shape") nextSegf=theFtab.findfield("DSArcID") ?search for next downstream segment for each lrec in theFtab chkDirFlag=0 lineShape=theFtab.returnvalue(lineShapef,lrec) fstList=lineShape.asmultipoint.aslist searchPntA=fstList.get(fstList.count-1) searchPntB=fstList.get(0) lnRec=lrec searchShape=lineShape segValue=theFtab.returnvalue(segNumFld,lrec) 263 for each lrec in theFtab lineShape=theFtab.returnvalue(lineShapef,lrec) lineNum=theFtab.returnvalue(segNumFld, lrec) if(searchPntA.intersects(lineShape)and(searchShape.iscontained in(lineShape).not))then sndList=lineShape.asmultipoint.aslist compPntA=sndList.get(0) if(compPntA.intersects(searchShape)and(searchPntB.iscontaine din(lineShape).not))then chkDirFlag=chkDirFlag+1 ? theFtab.setvalue(nextSegf,lrec,segValue) theFtab.setvalue(nextSegf,lnRec,lineNum) end end end if(chkDirFlag>1)then msgbox.info("wrong direction","") break end bstop=av.setStatus(lrec/nLines*100).not end theFtab.seteditable(false) av.setstatus(100) ?--- Since there are changes in methodologies, there is no need to do the following job. ?--- It is a pity that I have to put the exit here that to stop the execution. However, ?--- I reserve the code in case someday, the bueaty can be realized. EXIT if(ChkDirFlag>1)then ?do the reverse search for each lrec in TheFtab LineShape=TheFtab.Returnvalue(LineShapef,lrec) FstList=LineShape.AsMultiPoint.AsList SearchPntB=FstList.get(FstList.Count-1) SearchPntA=FstList.get(0) LnRec=lrec SearchShape=LineShape SegValue=TheFtab.ReturnValue(SegNumFld,lrec) for each lrec in TheFtab LineShape=TheFtab.ReturnValue(LineShapef,lrec) ?check to make sure not to compare with itself if(SearchPntA.Intersects(LineShape)and(SearchShape.IsContain edIn(LineShape).not))then SndList=LineShape.AsMultiPoint.AsList CompPntA=SndList.Get(SndList.Count-1) ? this part take care the parallel if(CompPntA.Intersects(SearchShape)and(SearchPntB.Intersect s(LineShape).not))then TheFtab.SetValue(NextSegf,lrec,SegValue) end end end bstop=av.setStatus(lrec/nLines*100).not ?***check the progress 264 end end ?end if(ChkDirFlag>1) if (bStop) then ?***the procedure is complete TheFtab.SetEditable(false) end ?Script: wrap.unproject, wrap29.ave ? ?Description: Adds lat and long coordinates to a point coverage ftab ? ?History: Created by Brad Hudgens 10/20/99 theView=av.getactivedoc theProject=av.getproject theDir=theProject.getworkdir.asstring ?get themes theThemes = theView.getthemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No feature themes found","WRAP Parameters") exit end ?select the point coverage ptTheme = msgbox.choice(theFthemes, "Select the Point Theme","WRAP Parameters") if (ptTheme = nil) then exit end theFtab=ptTheme.getftab ?check for definition of map units sourceUnits = theView.getdisplay.getunits if (sourceUnits = #UNITS_LINEAR_UNKNOWN) then MsgBox.Error("View units must be set before projecting.", "WRAP Parameters") exit end ?user defines current projection inputPrj = ProjectionDialog.show(theView,sourceUnits) if (inputPrj.IsNull) then return nil end ?add sequentially indexed key field to point ftab theFtab.seteditable(true) newFld1=list.make 265 newFld1.add(field.make("keyfield",#field_long,10,0)) theFtab.addfields(newFld1) keyFld=theFtab.findfield("keyfield") keyNum=1 for each rec1 in theFtab theFtab.setvalue(keyFld, rec1, keyNum) keyNum=keyNum+1 end ?export ftab as unprojected -- geo,dd exportString=theDir+"cpidkey" exportFtab=theFtab.exportunprojected(exportString.asfilename, inputPrj, false) ddSrcName=SrcName.make(exportString+".shp") ddFtab=ftab.make(ddSrcName) ?add x and y coordinates ddftab.seteditable(true) newFld2=list.make newFld2.add(field.make("x",#field_decimal,11,6)) newFld2.add(field.make("y",#field_decimal,11,6)) ddFtab.addfields(newFld2) xFld=ddFtab.findfield("x") yFld=ddFtab.findfield("y") ddShpFld=ddFtab.findfield("Shape") for each rec2 in ddFtab ddPt=ddFtab.returnvalue(ddShpFld, rec2) theX=ddPt.getx theY=ddPt.gety ddFtab.setvalue(xFld, rec2, theX) ddFtab.setvalue(yFld, rec2, theY) end ddFtab.seteditable(false) ?add fields to original ftab newFld3=list.make newFld3.add(field.make("Long",#field_decimal,11,6)) newFld3.add(field.make("Lat",#field_decimal,11,6)) theFtab.addfields(newFld3) ?join ddFtab to theFtab and copy over x and y fields ddKeyFld=ddFtab.findfield("keyfield") theFtab.join(keyFld, ddFtab, ddKeyFld) theXFld=theFtab.findfield("x") theYFld=theFtab.findfield("y") longFld=theFtab.findfield("Long") latFld=theFtab.findfield("Lat") for each rec3 in theFtab theX3=theFtab.returnvalue(theXFld, rec3) theFtab.setvalue(longFld, rec3, theX3) theY3=theFtab.returnvalue(theYFld, rec3) theFtab.setvalue(latFld, rec3, theY3) end theFTab.unjoinall theFtab.removefields({keyFld}) theFtab.seteditable(false) exit 266 ? Script: wrap.watersheds, wrap30.ave ? ? Description: Delineates watersheds for each control point. ? Outputs polygon theme. ? ? History: Modified by Brad Hudgens 9/24/99 from CRWR Prepro theView=av.getactivedoc theProject=av.getproject theDir=theProject.getworkdir.asstring ?get themes theThemes = theView.getthemes if (theThemes.count = 0) then msgbox.error("No themes found", "WRAP Parameters") exit end theFthemes = list.make for each theTheme in theThemes if (theTheme.getclass.getclassname = "ftheme") then theFthemes.add(theTheme) end end if (theFthemes.count = 0) then msgbox.error("No feature themes found","WRAP Parameters") exit end theGthemes = list.make for each theTheme in theThemes if(theTheme.getclass.getclassname = "gtheme") then theGthemes.add(theTheme) end end if (theGthemes.count = 0) then msgbox.error("No grid themes found","WRAP Parameters") exit end ?select flow direction grid fdrTheme = msgbox.choice(theGthemes, "Select the Flow Direction Grid","WRAP Parameters") if (fdrTheme = nil) then exit end ?select the control point coverage cpTheme = msgbox.choice(theFthemes, "Select the Control Point Theme","WRAP Parameters") if (cpTheme = nil) then exit end fdrGrid=fdrTheme.getgrid ?add sequentially indexed key field to cp ftab cpFtab=cpTheme.getftab cpFtab.seteditable(true) newField=list.make newField.add(field.make("keyfield",#field_long,10,0)) cpFtab.addfields(newField) keyFld=cpFtab.findfield("keyfield") keyNum=1 267 for each rec1 in cpFtab cpFtab.setValue(keyFld, rec1, keyNum) keyNum=keyNum+1 end cpFtab.seteditable(false) thePrj=prj.makenull theGridSize=nil theFlds=cpFtab.getfields idFld=msgbox.choice(theFlds, "Select the actual control point identifier field","WRAP Parameters") idFldStr=idFld.getname ?make outlet grid with key field cpGrid=cpFtab.asgrid(theprj, keyFld, theGridsize) waterGrd=fdrGrid.watershed(cpGrid) ?Construct WatershedGrd outTheme = gtheme.make(waterGrd) outTheme.setname("ShedGrid") inGrd=outTheme.getgrid ?vectorize watershed grid aFileName="Watrshed.shp".asfilename resultFtab=inGrd.aspolygonftab(aFileName,false,prj.makenull) ?field editing resultFtab.seteditable(true) killFld=resultFtab.findfield("ID") resultFtab.removefields({killFld}) newFields=list.make newFields.add(field.make("CP",#field_long,12,0)) newFields.add(field.make("IncArea(sq.mi.)",#field_float,20,4)) resultFtab.addfields(newFields) ?join watershed ftab to original cp ftab by key field gcField=resultFtab.findfield("gridcode") resultFtab.join(gcField, cpFtab, keyFld) shpField=resultFtab.findfield("Shape") cpIdFld=resultFtab.findfield(idFldStr) newcpField=resultFtab.findfield("CP") areaField=resultFtab.findfield("IncArea(sq.mi.)") ?copy over original control point identifiers and add inc area for each rec in resultFtab theID=resultFtab.returnvalue(cpIdFld, rec) resultFtab.setvalue(newcpField, rec, theID) theShape=resultFtab.returnvalue(shpField, rec) theArea = theShape.returnarea sqmi = theArea*0.000000386102 resultFtab.setvalue(areaField, rec, sqmi) end resultFtab.unjoinall resultFtab.removefields({gcField}) resultFtab.seteditable(false) theFthm=ftheme.make(resultFtab) theView.addtheme(theFthm) exit 268 AML : dem30m Description : Builds integer DEM for basin from original NED grids History : Original 4/25/99 by Brad Hudgens grid cm9433 = 100 * dem9433 kill dem9433 all cm9434 = 100 * dem9434 kill dem9434 all cm9533 = 100 * dem9533 kill dem9533 all cm9534 = 100 * dem9534 kill dem9534 all cm9633 = 100 * dem9633 kill dem9633 all cm9634 = 100 * dem9634 kill dem9634 all cm9733 = 100 * dem9733 kill dem9733 all cm9734 = 100 * dem9734 kill dem9734 all int9433 = int(cm9433) kill cm9433 all int9434 = int(cm9434) kill cm9434 all int9533 = int(cm9533) kill cm9533 all int9534 = int(cm9534) kill cm9534 all int9633 = int(cm9633) kill cm9633 all int9634 = int(cm9634) kill cm9634 all int9733 = int(cm9733) kill cm9733 all int9734 = int(cm9734) kill cm9734 all demgeo = merge(int9433,int9434,int9533,int9534,int9633,int9634,int9733 ,int9734) kill int9433 all kill int9434 all kill int9533 all kill int9534 all kill int9633 all kill int9634 all kill int9733 all kill int9734 all quit project grid demgeo demalb output projection Albers datum NAD83 spheroid GRS1980 units meters parameters 27 25 0 34 55 0 -100 0 0 31 10 0 1000000 269 1000000 end kill demgeo all AML : reprodrg Description : project DRG files History : Original by Brad Hudgens 12/01/98 imagegrid o33096b1 gridb1z14 color1 delete o33096b1 project grid gridb1z14 gridb1z15 z14toz15.txt kill gridb1z14 all gridimage gridb1z15 color1 o33096b1 tiff compression kill gridb1z15 all imagegrid o33096c1 gridc1z14 color1 delete o33096c1 project grid gridc1z14 gridc1z15 z14toz15.txt kill gridc1z14 all gridimage gridc1z15 color1 o33096c1 tiff compression kill gridc1z15 all imagegrid o33096c2 gridc2z14 color1 delete o33096c2 project grid gridc2z14 gridc2z15 z14toz15.txt kill gridc2z14 all gridimage gridc2z15 color1 o33096c2 tiff compression kill gridc2z15 all imagegrid o33096d1 gridd1z14 color1 delete o33096d1 project grid gridd1z14 gridd1z15 z14toz15.txt kill gridd1z14 all gridimage gridd1z15 color1 o33096d1 tiff compression kill gridd1z15 all imagegrid o33096d2 gridd2z14 color1 delete o33096d2 project grid gridd2z14 gridd2z15 z14toz15.txt kill gridd2z14 all gridimage gridd2z15 color1 o33096d2 tiff compression kill gridd2z15 all imagegrid o33096e1 gride1z14 color1 delete o33096e1 project grid gride1z14 gride1z15 z14toz15.txt kill gride1z14 all gridimage gride1z15 color1 o33096e1 tiff compression kill gride1z15 all AML : albtodem Description : Projects from TSMS Albers to USGS DEM input projection Albers spheroid GRS1980 datum nar_c units meters 270 parameters 27 25 0 34 55 0 -100 0 0 31 10 0 1000000 1000000 output projection geographic spheroid WGS72 datum WGS72 units ds parameters end AML : albtoutm Description : Projects from TSMS Albers to UTM input projection Albers spheroid GRS1980 datum NAD83 units meters parameters 27 25 0 34 55 0 -100 0 0 31 10 0 1000000 1000000 output projection utm zone 15 spheroid clarke1866 datum NAD27 units meters parameters end AML : bastoutm Description : Projects from EPA BASINS RF3 data projection to UTM input projection geographic datum NAD83 spheroid GRS1980 units dd parameters output projection utm zone 15 datum NAD27 spheroid clarke1866 units meters parameters end 271 AML : demtoalb Description : Projects USGS DEM to TSMS Albers input projection geographic spheroid WGS72 datum WGS72 units ds parameters output projection Albers spheroid GRS1980 datum nar_c units meters parameters 27 25 0 34 55 0 -100 0 0 31 10 0 1000000 1000000 end AML : gagtoalb Description : Projects USGS gage data to TSMS Albers input projection geographic spheroid clarke1866 datum NAD27 units dd parameters output projection Albers spheroid GRS1980 datum NAD83 units meters parameters 27 25 0 34 55 0 -100 0 0 31 10 0 1000000 1000000 end AML : gagtoutm Description : Projects USGS gage data to UTM input projection geographic spheroid clarke1866 datum NAD27 units dd 272 parameters output projection utm zone 15 spheroid clarke1866 datum NAD27 units meters parameters end AML : utmtoalb Description : Projects UTM to TSMS Albers input projection utm zone 15 spheroid clarke1866 datum NAD27 units meters parameters output projection Albers spheroid GRS1980 datum NAD83 units meters parameters 27 25 0 34 55 0 -100 0 0 31 10 0 1000000 1000000 end AML : z14toz15 Description : Projects UTM zone 14 to UTM zone 15 input projection utm zone 14 datum NAD27 spheroid clarke1866 units meters parameters output projection utm zone 15 datum NAD27 spheroid clarke1866 units meters parameters end 273 References Bauer, B., 1980. Drainage Density : an Integrative Measure of the Dynamics and Quality of Watersheds. Cited in : Morphometry of Drainage Basins, by I. Zavoianu. Elsevier Science Publishers, 1985. Boghici, E., 1999. Personal Communication. Texas Natural Resource Information System. Bridge, J.S., 1993. The Interaction Between Channel Geometry, Water Flow, Sediment Transport, and Deposition in Braided Rivers. Published in : Braided Rivers, edited by J.L. Best and C.S. Bristow. The Geological Society, 1993. Bondelid, T.R., Jackson, T.J., and McCuen, R.H., 1982. Estimating Runoff Curve Numbers Using Remote Sensing Data. Published in : Applied Modeling in Catchment Hydrology, edited by V.P. Singh. Water Resources Publications, 1982. Clark, M.J., 1993. Data Constraints on GIS Application Development for Water Resources Management. Published in : Application of Geographic Information Systems in Hydrology and Water Resources Management, edited by K. Kovar and H.P. Nachtnabel. International Association of Hydrological Sciences Publication No. 211, 1993. CRWR, 1999. Draft Procedure for the River Basin Database Development of the Water Availability Modeling Project. Center for Research in Water Resources, 1999. Daly, C., 1998. Central United States Average Monthly or Annual Precipitation, 1961-1990; Metadata. Internet Site : http://www.ocs.orst.edu/pub/maps/Precipitation/Total/Regional/Central/cent_rast _meta.html Dartigenauve, C., 1998. Water Quality Master Planning for Austin. CRWR Online Report 97-6. Internet Site : http://www.crwr.utexas.edu/gis/gishyd98/library/dartig/rpt97_6.html Dobkins, B.E., 1959. The Spanish Element in Texas Water Law. University of Texas Press. 274 EPA, 1994. The U.S. EPA Reach File Version 3.0 Alpha Release (RF3-Alpha) Technical Reference. Internet Site : http://www.epa.gov/OWOW/NPS/rf/techref.html ESRI, 1998. NAD to WGS. ARC Version 7.2.1 On-line Help Topic. Grayson, R.B., Bloschl, G., Barling, R.D., Moore, I.D., 1993. Process, Scale, and Constraints to Hydrological Modelling in GIS. Published in : Application of Geographic Information Systems in Hydrology and Water Resources Management, edited by K. Kovar and H.P. Nachtnabel. International Association of Hydrological Sciences Publication No. 211, 1993. Horton, R.E., 1945. Erosional Development of Streams and their Drainage Basins: Hydrophysical Approach to Quantitative Morphology. Cited in : Channel Network Hydrology, edited by K. Beven and M.J. Kirkby. John Wiley and Sons, 1993. Jonsdottir, J., 1999. Digital Delineation of Watershed Drainage Areas. Internet Site : http://www.ce.utexas.edu/stu/jonsdoj/termpaper/termpaper.html Kirkby, M.J., 1993. Network Hydrology and Geomorphology. Published in : Channel Network Hydrology, edited by K. Beven and M.J. Kirkby. John Wiley and Sons, 1993. Lane, 1957. Published in : Braided Rivers, edited by J.L. Best and C.S. Bristow. The Geological Society, 1993. Maidment, D.R., 1991. GIS and Hydrological Modeling. Published in : Proceedings of First International Symposium/Workshop on GIS and Environmental Modeling, edited by M.F. Goodchild, B.O. Parks, and L.T. Steyaert. Oxford University Press, 1991. Maidment, D.R., 1998. Module 4 : Geodesy and Map Projections. Internet Site : http://www.engr.utexas.edu/giswr/secure/Module4/mod4html/module4.htm Olivera, F., 1998. Spatial Hydrology of the Urubamba River System in Peru Using Geographic Information Systems (GIS). Internet Site : http://www.ce.utexas.edu/prof/olivera/peru/peru.htm 275 Quenzer, A.M., 1998. A GIS Assessment of the Total Loads and Water Quality in the Corpus Christi Bay System. CRWR Online Report 98-1. Internet Site : http://www.ce.utexas.edu/prof/maidment/grad/quenzer/home.html R.J. Brandes Co., 1999. Water Availability Modeling for the Sulphur Basin; Draft. R.J. Brandes Company. Saunders, W., 1996. A GIS Assessment of Nonpoint Source Pollution in the San Antonio-Nueces Coastal Basin. Internet Site : http://www.ce.utexas.edu/prof/maidment/GISHYDRO/saunders/report.htm Skillern, F.F., 1988. Texas Water Law. Sterling Press Inc. TNRCC, 1998. Digital Elevation Modeling for the WAM and other TNRCC OWRM Projects; Draft. Texas Natural Resource Conservation Commission. TNRCC, 1999. WAM : Water Availability Modeling, an Overview. Internet Site : http://www.tnrcc.state.tx.us/admin/topdoc/gi/245/ Town, M., 1999. Personal Communication. Texas Natural Resources Conservation Commission. TWDB, 1984. Water for Texas. Texas Water Development Board. USDA, 1999. NRCS Data Resources. Internet site : http://www.ftw.nrcs.usda.gov/soils_data.html Wurbs, R.A., Sisson, E.D., 1998. Comparative Evaluation of Watershed Characteristics and Methods for Distributing Naturalized Streamflows from Gaged to Ungaged Sites. Texas Water Resources Institute. Texas A&M University. Zavioanu, I., 1985. Morphometry of Drainage Basins. Elsevier Science Publishing. 276 Vita Bradley Taylor Hudgens was born in Long Beach, California on December 29, 1970, the son of Alva Vernon Hudgens and Beverly Faythe Hudgens. After completing his work at Jenks High School, Jenks, Oklahoma, he entered the University of Pennsylvania in Philadelphia, Pennsylvania. He received the degree of Bachelor of Science in Engineering from the University of Pennsylvania in May, 1993. Upon graduation he was commissioned a Lieutenant in the United States Army and served as a Military Intelligence officer for four years. In January, 1998, he entered the Graduate School at the University of Texas. Permanent address: 8243 South Sandusky Tulsa, Oklahoma 74137 This thesis was typed by the author.