Questions: a User-friendly Interface to ANSWERS-2000 Tamie L. Veith, student; Tone M. Nordberg, student; M.L. Wolfe, member; Theo Dillaha III, member Abstract: Questions is a user-friendly interface to ANSWERS-2000, a Fortran-based, nonpoint source model. Questions currently runs on the Windows platform using Visual Basic 6.0, ArcView GIS 3.2, and Map Objects 2.0. By leading the user through a series of simple forms and point-and-click GIS layers, Questions constructs and formats detailed ASCII files used by ANSWERS-2000 for each simulation run. This interface improves the likelihood that the ANSWERS-2000 input file correctly reflects the user s desired variable values. Additionally, it enables the user to focus on determining the most precise variable values for simulating the system instead of requiring knowledge of input file formatting. Keywords: ANSWERS-2000, NPS model, Windows interface, ArcView, Visual Basic, Map Objects The authors are Tamie L. Veith, USDA National Needs Fellow in Water Science, Tone M. Nordberg, Graduate Assistant, Mary Leigh Wolfe, Associate Professor, Theo A. Dillaha III, Professor, Dept. of Biological Systems Engineering, Virginia Tech, Blacksburg. Corresponding author: Tamie L. Veith, Dept. of Biological Systems Engineering 200 Seitz Hall, Virginia Tech, Blacksburg, VA 24061-0303; e-mail tveith@vt.edu.
2 Introduction Ease of use is an important component of any model. The input required by the model must be straightforward and explicitly defined and the model output must be clearly interpretable. In the absence of either of these features the model loses its appeal to the user and its ability to accurately mimic the system being modeled. Perhaps in the case of computer-based models, where a physical system is represented digitally through manipulations of complex and interconnected equations, the importance of reducing any ambiguities in the model inputs and outputs are enhanced. Such a model does not readily provide the user any insight into the relationship between model attributes and system attributes. The nonpoint source (NPS) model ANSWERS-2000 (Bouraoui, 1994) is an example of a computer-based model that simulates a natural system using mathematical representations such that required inputs and initial outputs are not explicitly linked to the real-world attributes they represent. ANSWERS-2000 requires three ASCII input files: the first containing hydrologic, soil, and landuse information at a tabular and a cellular level, the second containing daily breakpoint weather data covering the simulation period, the third containing rates, types, dates, and locations of fertilizer applied throughout the simulation. Outputs of ANSWERS-2000 include temporal and spatial summaries of the simulated events, again as ASCII files. Previously a single interface, FARMSCALE (Ref), existed for using ANSWERS- 2000. This interface led the user through creation of the inputs files, performed the simulation run, and presented the outputs in either tables or in maps that could be visually
3 compared across simulation scenarios. FARMSCALE was written in ARC/INFO 6.0? (Ref) using the Unix platform. This provided high-level Geographic Information System (GIS) capabilities, but required the user to have access to and basic familiarity with a Unix machine. Software upgrades in ESRI s ArcView GIS 3.2 (Ref) package, targeted more at the commercial(?) user than the complex ARC/INFO software, have recently gained ArcView a large spot in the GIS market. ArcView is somewhat less sophisticated in calculational abilities than ARC/INFO but still sufficient for most GIS modeling and is commonly available on the Windows platform, employing familiar (standard?) Windows interfacing. These changes in GIS software along with recent upgrades to ANSWERS- 2000, which modified input requirements, indicated an upgrade in the user interface used to serve ANSWERS-2000. The result of this user interface upgrade is a program called Questions and is written in a combination of Visual Basic 6.0 (ref), ArcView, and Map Objects 2.0 (ref). This paper presents Questions. The focus of Questions is in providing users knowledgeable in the field of NPS modeling with a straightforward approach to creating a correctly formatted set of input files for ANSWER-2000. By using Questions the user is aided in the definition and appropriate value range of each input variable while being relieved of the necessity of correctly formatting and storing the desired value. The next section of the paper will discuss the basic structure of the interface. Following sections will demonstrate how the various computer programs were used to enhance user interaction in each component of the interface. The final section will outline future plans and potential additions to future versions of interface.
4 Interface Overview The Questions interface opens up to the main window shown in Figure 1. The menu bar across the top of the program window provides file, window, and help menus in a standard Windows format. The menu bar is navigable using the mouse or via keyboard shortcut keys. Additionally, the program window and subsequent windows are resizable to fit the user s monitor. The program is fully supported by Windows, allowing copying and focus shifting between this and other programs. Windows file dialog boxes are used when necessary to have the user locate a file or program on the computer. To run the interface, the user must provide three GIS data layers: a Digital Elevation Model (DEM), a soils layer, and a landuse layer. Additionally, the user must know the landuse management schedules that will be simulated. Visual Basic forms are used to integrate the various components of the interface. The interface will direct the user to the ArcView window at the appropriate times. Also, the Visual Basic portion of the interface will automatically initiate maps using Map Objects and run DOS programs using a shell command.
5 Figure 1: Main window of user interface Hydrology ArcView s Spatial Analyst module is used to prepare the hydrology files needed for ANSWERS-2000. Clicking on the Hydrology button on the main window of the interface (Figure 1) opens ArcView, if it is not already open, and initiates a new view. The user then prepares the hydrology files by running the Hydrology menu option on the ANSWERS ArcView Extension. This menu option asks the user to locate the appropriate DEM. The user can also either supply a shapefile of the outlet point or create
6 one based on the stream network indicated by the DEM. If the user chooses to create the outlet point, Questions will create the stream network form the DEM and lead the user through the process of choosing the outlet point. The rest of the hydrology file preparation is largely automatic. Questions fills sinks in the DEM, delineates the stream network and watershed boundary, and creates the slope, aspect, and flow direction GRID files. During this process the user is periodically requested to verify file names and location, using standard Windows file dialogs or simple pull down combo boxes. Finally, the hydrology component exports the GRID files into the cell level ASCII files, which will be incorporated into the spatial component of the ANSWERS-2000 input file, and returns the user to the Questions main menu. Soils The soils component combines ArcView, Map Objects and Visual Basic. Soil input values are taken from the SSURGO databases (ref). The soil shapefile map layer can also be taken from there. If the user wishes to provide the map layer, then shapefile attributes must include the SSURGO mapunit symbol (MUSYM) value for each soil polygon. Upon clicking the Soils button on the main menu, the user is directed to the ANSWERS/Soils menu option in the open ArcView window. After the user locates the appropriate soils file to use, ArcView automatically cuts the soils shapefile to match watershed boundary, exports the map and attribute table for use by Visual Basic, and returns the user to the Visual Basic window. The exported soils map is immediately displayed to the user on a Visual Basic form (Figure 2) via Map Objects. Map Objects allows the user to zoom in and out, pan, and show the full extent of the map. By default
7 the map is displayed using the MUSYM values and the associated legend is displayed to the left of the map. The legend button in the toolbar allows the user to change the map attribute used for display and also the way the values are displayed on the map; i.e. by unique color or by numerical labels. Figure 2: Visual Basic form for Soils component In addition to displaying the soils map, Visual Basic matches the SSURGO MUSYM values from the soil shapefile with the tabular SSURGO comp and layer data tables, extracts the necessary parameter values, and displays them in an editable data table (Figure 2). In some cases, part or all of the necessary information for each MUSYM value may not be available in the SSURGO data tables. In this case the user is immediately notified through the textbox to the left of the map (Figure 2). The user has
8 two options at this point. One option is to replace a MUSYM value having no associated parameter values with one having the necessary values. In this case the user can use the pull down combo boxes below the textbox (Figure 2) to make the change or can replace the new MUSYM value directly in the extracted data table (Figure 3). The user can use the representation of soil groups on the map to assess the best course of action. Once the user chooses a new MUSYM value, the new parameter values can be immediately extracted and displayed by clicking the Update button. The second option for the user if any MUSYM value or associated parameter is unsatisfactory is for the user change the parameter value directly in the extracted database. After making the changes the user should click the Save Edits button. The changed values will be read for input values for the current project and will be retained for future work on that project, but will not affect the original SSURGO data tables. When satisfied with the soil parameters the user clicks the Continue button. Questions uses the final soil parameters to calculate and format all the soils values required by ANSWERS-2000. Next the user is directed to return to the ArcView window select the ANSWERS/Soils GRID menu option. This action causes Questions to import any soil parameter changes back into ArcView, update the soils map and its attributes, and then GRID the map to correspond with the DEM GRID. Finally, Questions exports the GRID files into the cell level ASCII files, which will be incorporated into the spatial component of the ANSWERS-2000 input file, and returns the user to the Questions main menu.
9 Figure 3: Extracted table based on MUSYM and SSURGO parameters Climate Upon clicking the Climate button on the interface main menu, the user is presented with a Visual Basic form displaying a partial map of the United States. This map is created in Map Obects and has the standard zooming and panning capabilities. In addition, colors on the map can be randomly reassigned as necessary to aid the user in distinguishing between adjacent similar colors. The map contains state and county boundaries. Using the identify tool from the toolbar creates the pop up window shown on the right hand side of Figure 4. This tool allows users to identify and select the desired location of the map. The key feature of this map is that it is partitioned into Thiessen polygons based on the existing raingage stations used by the CLIGEN 4.2 (ref) weather generation program. When the user select a location on the map, the accompanying Thiessen polygon is immediately identified and the state and station number of the associated
10 raingage is indicated in the textboxes below the map. At this point the user indicates the desired simulation start date and length and initiates the CLIGEN program by clicking on the Run Cligen button. Visual Basic provides CLIGEN, which is a DOS-based program, with the appropriate inputs and runs the program using a shell command. The resulting weather data file is immediately run through a series of Fortran programs that break each storm down into a hydrograph and then formatted for ANSWERS-2000. Figure 4: Visual Basic form for generating weather input file.
11 Data Tables ANSWERS-2000 represents agricultural activities by groups of parameter values that reflect the environmental impact of the activities. For example, plant growth of corn is represented, in part, by leaf area index and maximum rooting depth parameters. A single activity is comprised of crop, rotation, and tillage parameters. These parameters are maintained as Access 97 (ref) files. Suggested values are provided under the data tables menu of the interface (Figure 5). Copies of these tables are made into each working directory, enabling the user to customize and save parameters for given simulations. Additionally, because the data are in Access tables, all associated data manipulation, querying, and reporting are available using Access 97 or higher. In particular, a user may permanently modify or add to the suggested values initially provided.
12 Figure 5: Data tables storing activity parameters Landuse The landuse component uses the same process as the soils component to cut and grid the landuse shapefile. After the landuse shapefile is cut to the watershed boundary, the user is presented with the Visual Basic Activity Builder form (Figure 6). This form allows the user to specify the characteristics of each landuse management activity by providing drop down combo boxes that list all the options available in the data tables for crop, residue, and tillage parameters. This form also provides a calendar for the user to specify planting and harvesting dates. Alternatively, the user can specify the dates in Julian format.
13 Figure 6: Visual Basic form for building activities After entering all activities the user can display the activities in summary form as a data table and simultaneously view the rotation builder, as shown in Figure 7. Rotations are entered into the Rotation Builder based on the activity ID and the end date of each activity in the rotation. Currently this information is entered directly into the data table shown in Figure 7. The next version of Questions will provide a rotation builder with a
14 format similar to that of the Activity Builder. This will simplify the process for the user by providing drop down combo boxes of the available activities from which to compose each rotation and will eliminate the need for the user to enter end dates. Figure 7: Activity Builder summary and Rotation Builder Once the activities and rotations have been defined they need to be assigned to each field in the landuse layer. For this purpose, the cut landuse map is transferred from ArcView into Visual Basic and is displayed to the user via MapObjects (Figure 8). The map on this form is navigable similarly to the soils map in Figure 2. For example, the field IDs can be displayed directly on the map. Additionally, attributes of the landuse layer, provided in the table to the left of the map, can be sorted to make the field
15 assignments easier. The user uses this information to enter the appropriate rotation number for each field. Once all fields have been assigned and the user clicks the Continue button, Questions transfers the field assignments back to ArcView where they become identifiers in the landuse GRID. As with the hydrology and soils components, Questions exports the GRID files into the cell level ASCII files, which will be incorporated into the spatial component of the ANSWERS-2000 input file, and returns the user to the Questions main menu. Figure 8: Visual Basic form for assigning rotation IDs to fields
16 Miscellaneous Inputs The final set of information requested by the user is accessed by the Miscellaneous Inputs button on the main menu. Using this form the user can specify the start date, length, and time step of the simulations run as well as the type of output desired. The form also asks the user to provide some information on the type of channels in the watershed. To help the user Questions automatically determines the number of different channel types in the watershed and provides a data table into which the required values can be entered. Additionally, if the user specifies that fertilizer is to be applied, a form will open, asking the user for the necessary information regarding each fertilizer application. The program will then automatically process this information and create the ASCII fertilizer input file required by ANSWERS-2000. Once the user clicks the Continue button, Questions compiles all the information the user has entered and formats it into the header portion of the main ANSWERS input file. Additionally, Question uses a Fortran-based program to join all of the GRID ASCII files into a single ASCII file of spatial data. This file is appended to the header portion to complete the main ANSWERS input file. At this point all the input files for ANSWERS-2000 are prepared and ANSWERS can be run by clicking on the Run ANSWERS button on the Questions main menu.
17 Figure 9: Miscellaneous Input form Future Work Future plans for the interface involve modifying the Rotation Builder to be more interactive, as previously mentioned. Also, the fertilizer form will be integrated into the Activity Builder, which will simplify data entry for the user. A potential improvement for the Climate component would be to provide the user with a way to easily incorporate measured weather data or to import data that is generated in a different format. Also, the
18 user currently must pick a single raingage to represent the entire watershed and must take care that this raingage location accounts for orthographics effects. A useful improvement to Questions would be to allow the user to choose several raingages to cover the watershed. The interface is currently in the process of being extended to include the outputs of ANSWER-2000. The spatial output of ANSWERS-2000 will be imported into ArcView map layers. This will allow the user to quickly view, manipulate, and compare the various results from answers. Also, the tabular output will be formatted into summary reports that are easily viewable, searchable, and printable. Inclusion, in Questions, of capabilities for managing simulation output will allow the user to better understand and interpret the simulation results. References Bouraoui, Faycal. 1994. Development of a continuous, physically-based, distributed parameter, nonpoint source model. Ph.D. diss., Biological Systems Engineering Dept., Virginia Polytechnic Institute and State University, Blacksburg.