+ All Categories
Home > Documents > Web-Based Automated Well Permitting

Web-Based Automated Well Permitting

Date post: 16-Apr-2017
Category:
Upload: mark-bentley
View: 304 times
Download: 0 times
Share this document with a friend
60
Web-Based Automated Well Permitting Tools for Weber and Utah Counties Using Arc Hydro Groundwater Mark Aaron Bentley A selected project submitted to the faculty of Brigham Young University in partial fulfillment of the requirements for the degree of Master of Science Norman L. Jones, Chair Everett. J. Nelson Gustavious P. Williams Department of Civil and Environmental Engineering Brigham Young University August 2012 Copyright © 2012 Mark Aaron Bentley All Rights Reserved
Transcript
Page 1: Web-Based Automated Well Permitting

Web-Based Automated Well Permitting Tools for Weber and

Utah Counties Using Arc Hydro Groundwater

Mark Aaron Bentley

A selected project submitted to the faculty of

Brigham Young University

in partial fulfillment of the requirements for the degree of

Master of Science

Norman L. Jones, Chair

Everett. J. Nelson

Gustavious P. Williams

Department of Civil and Environmental Engineering

Brigham Young University

August 2012

Copyright © 2012 Mark Aaron Bentley

All Rights Reserved

Page 2: Web-Based Automated Well Permitting
Page 3: Web-Based Automated Well Permitting

ABSTRACT

Web-Based Automated Well Permitting Tools for Weber and

Utah Counties Using Arc Hydro Groundwater

Mark Aaron Bentley

Department of Civil and Environmental Engineering, BYU

Master of Science

To promote the sustainable use of groundwater reserves states and local governments can

regulate the consumption of groundwater. This regulation usually requires entities to apply for a

well permit before developing a well and bringing it into production. Even though regulating

well development is an effective method for protecting a groundwater system, it can be a

somewhat tedious and labor intensive process. When done by hand, this analysis can take many

months during which state resources are tied up.

Using modern computer programs the amount of time required to analyze candidate wells

can be significantly reduced. This document describes how automated well permitting

workflows were created by combining and using various software programs such as ArcGIS,

AHGW, MODFLOW and Python. One workflow was created for Weber County while another

workflow was created for Utah County. Both of these workflows are capable of analyzing the

affects that one or more candidate wells have on their respective groundwater systems. It is

anticipated that using the two tools to analyze candidate wells will reduce the time required for

analysis and make it easier for the state of Utah to process well development applications.

Keywords: Mark Aaron Bentley, well permit, Arc Hydro Groundwater, Ogden

Page 4: Web-Based Automated Well Permitting
Page 5: Web-Based Automated Well Permitting

ACKNOWLEDGMENTS

Special thanks to my family and all those who helped in the research and revision

process. Working on this project has been a great learning experience that provided me with the

opportunity to grow and apply the skills that I developed during college. I hope that the material

written in this report will be helpful to any who might read it.

Page 6: Web-Based Automated Well Permitting
Page 7: Web-Based Automated Well Permitting

v

TABLE OF CONTENTS

LIST OF TABLES ...................................................................................................................... vii

LIST OF FIGURES ..................................................................................................................... ix

1 Introduction ........................................................................................................................... 1

Well Permitting in Utah .................................................................................................. 1 1.1

Automated Well Permitting ............................................................................................ 2 1.2

1.2.1 ArcGIS ........................................................................................................................ 3

1.2.2 Arc Hydro Groundwater ............................................................................................. 4

2 Norhtern Utah County MODFLOW Model ....................................................................... 5

Modifying the Solution Methods of the MODFLOW Model......................................... 6 2.1

Permitting Criteria for Springs ....................................................................................... 8 2.2

2.2.1 Modifications to the Namefile .................................................................................... 9

2.2.2 Creating the OBS File ............................................................................................... 10

2.2.3 Creating the DROB File ............................................................................................ 10

Permitting Criteria for Drawdown ................................................................................ 11 2.3

2.3.1 Modifications to the Starting Head Array ................................................................. 11

2.3.2 Modifications to the Output Control Dialog ............................................................. 12

3 Northern Utah County Workflow ..................................................................................... 13

Returning to Baseline Model ........................................................................................ 13 3.1

Adding Candidate Wells to the AHGW Geodatabase .................................................. 14 3.2

Adjusting the Values in WEL Table ............................................................................. 16 3.3

Exporting Candidate Wells to MODFLOW Text Files ................................................ 17 3.4

Running MODFLOW with New Candidate Wells ....................................................... 18 3.5

Importing MODFLOW Simulation Results to AHGW Geodatabase .......................... 18 3.6

Page 8: Web-Based Automated Well Permitting

vi

Creating Feature Classes Showing Change in Drain Discharges ................................. 20 3.7

Creating Point Feature Classes for Drawdown ............................................................. 22 3.8

Creating Drawdown Contour Lines .............................................................................. 23 3.9

4 Weber County Modflow Model ......................................................................................... 25

Weber County Well Permit Criteria ............................................................................. 25 4.1

4.1.1 Converting the Model to Steady State ...................................................................... 26

4.1.2 Starting Head Modifications ..................................................................................... 27

4.1.3 Observation Package Modifications ......................................................................... 27

4.1.4 Limitations of the BCF Package ............................................................................... 28

5 Weber County Workflow ................................................................................................... 29

Preparing the Script ...................................................................................................... 29 5.1

Adding Candidate Wells ............................................................................................... 30 5.2

Running the Simulation ................................................................................................ 31 5.3

Visualizing Simulation Results ..................................................................................... 32 5.4

Conclusion .................................................................................................................... 33 5.5

REFERENCES ............................................................................................................................ 35

Appendix A. Northern Utah County Python Script ............................................................ 37

Appendix B. Weber County Workflow Script ..................................................................... 41

Page 9: Web-Based Automated Well Permitting

vii

LIST OF TABLES

Table 4-1: Explanation of Various Values of LAYCON…………………………………..…..28

Page 10: Web-Based Automated Well Permitting

viii

Page 11: Web-Based Automated Well Permitting

ix

LIST OF FIGURES

Figure 1-1: Example of Model Builder Workflow in ArcGIS. ........................................................... 3

Figure 2-1: Northern Utah County MODFLOW Model Domain ...................................................... 5

Figure 2-2: Unusual Drain Results In Northern Utah County Model ................................................. 6

Figure 2-3: Setup For LMG Solver ..................................................................................................... 7

Figure 2-4: Drains In Northern Utah County Model ......................................................................... 8

Figure 2-5: Modified Northern Utah County Namefile ..................................................................... 9

Figure 2-6: OBS File or Northern Utah County Model ....................................................................10

Figure 2-7: Northern Utah County DROB File ................................................................................11

Figure 3-1: Return Model To Baseline State .....................................................................................14

Figure 3-2: Adding Candidate Wells To The AHGW Geodatabase ..................................................15

Figure 3-3: Adjusting The Values In The WEL Table ......................................................................16

Figure 3-4: Exporting Candidate Wells To MODFLOW Text Files .................................................17

Figure 3-5: Running MODFLOW Simulation ...................................................................................18

Figure 3-6: Importing Drawdown Results into the AHGW Geodatabase .........................................19

Figure 3-7: Importing MODFLOW Observation Process Results to AHGW Geodatabase .............20

Figure 3-8: Creating Polygon Feature Classes Representing Drain Discharge .................................21

Figure 3-9: Creating Point Feature Classes Representing Drawdown ...............................................22

Figure 3-10: Creating Drawdown Contour Lines ..............................................................................23

Figure 4-1: Weber County Model Domain .......................................................................................26

Figure 5-1: Preparing the Script ........................................................................................................30

Figure 5-2: Adding Candidate Wells .................................................................................................31

Figure 5-3: Run MODFLOW And Import Results ............................................................................32

Figure 5-4: Post Processing Simulation Results ................................................................................33

Page 12: Web-Based Automated Well Permitting

x

Page 13: Web-Based Automated Well Permitting

1

1 INTRODUCTION

In order to manage the use of groundwater systems in a way that will prevent them from

being depleted, most states require approval prior to the construction or modification of a well.

Generally speaking, when a business or individual determines that they need a well, they fill out

appropriate forms designed to describe the new well to the state. These forms usually contain

information about the well locations, pumping rates, and screen elevations. The state uses

qualified engineers to determine if the proposed well can be operated in a sustainable fashion

that does not result in groundwater mining, detrimental impact to surface water bodies including

lakes, springs, and streams, or significantly lowered water table elevations in the neighboring

wells. In order to make such determinations using a systematic and defensible basis, some states

use groundwater models. They manually adjust calibrated groundwater models to include

candidate wells so that they can be used to assess the impact that the well will have on the

groundwater system. If the impact is sufficiently small the state may choose to grant a well

permit (Jones 2011).

Well Permitting in Utah 1.1

Utah uses this basic approach to regulate the construction and management of wells.

Currently, the Utah Division of Water rights utilizes several MODFLOW models created by the

United States Geologic Survey (“USGS”). These models are designed to simulate the behavior of

groundwater systems in different regions across the state. Each of the different regions has

Page 14: Web-Based Automated Well Permitting

2

certain criteria for acceptable well impacts. When the Division of Water Rights receives an

application for a well permit, an engineer edits the appropriate MODFLOW model to include the

proposed well and runs the modified simulation. The impact of the proposed well can be

estimated by comparing the results of the modified simulation to the results of the original

simulation. If the well meets the criteria for the regions it will reside in, than a permit will be

issued and the well can be constructed and used (UDWR n.d.).

This process has proven to be valuable as a means of ensuring that groundwater systems

are used in a sustainable manner; however it is time consuming and requires a considerable

amount of technical expertise. And, generally speaking, there are not enough people with the

required skill sets to quickly process the new and existing applications for well permits.

Currently, the Utah Division of Water Rights estimates that it will take approximately seven

months for a well permitting application to be processed. In light of this information, it seems

reasonable to look into methods of simplifying the process (UDWR n.d.).

Automated Well Permitting 1.2

One solution for streamlining the well permitting process is computer automation. Using

computer automation it is possible to consolidate all of the steps a skilled engineer would take

during a well permitting analysis into a single automated workflow. A robust, automated

workflow will increase the Division of Water Rights’ capacity to analyze prospective well, while

at the same time decreasing the likelihood of user error and improve overall reliability.

The final objective of this project was to create automated well permitting tools for Utah

and Weber Counties, that can be run online using a web-based interface. My area of

responsibility in this project was to create the automated workflows that serve as the basis for the

analysis. My colleague David Jones was responsible for creating the web-based interface that

Page 15: Web-Based Automated Well Permitting

3

allows people to use the tools online while making necessary modifications to allow the model to

run in the setting required by the online server.

1.2.1 ArcGIS

ArcGIS is a computer program developed by the Environmental Sciences Research

Institute (ESRI). It is popular in engineering circles because it combines the information storage

abilities of Microsoft Access with the visual representations of mapping software. ArcGIS

provides an extensive set of geoprocessing tools allowing users to edit both the map and the

database information. In addition to all this, ArcGIS has two programs that allow complex tasks

to be automated (ESRI 2012).

One of these programs is called Model Builder. Model builder is a visual programming language

supported by ArcGIS that allows users to create workflows by connecting inputs, geoprocessing

tools, and outputs in a display. Error! Reference source not found. shows an example of a

orkflow created to run within MODEL builder. A color coding system is used to keep track of

different parts of the model. In the color coding system, inputs are blue, geoprocessing tools are

yellow, and outputs are green (ESRI n.d.).

Figure 1-1: Example of Model Builder Workflow in ArcGIS.

Page 16: Web-Based Automated Well Permitting

4

ArcGIS also supports the use of Python scripting as a means of automating complex tasks

through its Arcpy module. The Arcpy module provides a link between the Python programming

language and the geoprocessing capabilities within ArcGIS. If the Arcpy module is imported into

a Python script it is possible to call any of the geoprocessing tools and perform operations on

feature classes in a text based workflow. Python scripting is relatively easy to learn but does

require more preparation than the model builder utility.

1.2.2 Arc Hydro Groundwater

Arc Hydro Groundwater (AHGW) is a data model and set of geoprocessing tools that are

designed for use in ArcGIS. AHGW can be used to import traditional MODFLOW models into a

database and edit the model inputs within the ArcGIS interface. The program can extract model

inputs from MODFLOW files and organize them into tables and feature classes within

geodatabases (Cederberg, Gardner and Thiros 2009). Additionally, the program provides a suite

of geoprocessing tools designed to facilitate the well permitting process (Aquaveo 2012). By

using this software in conjunction with ArcGIS, it is possible to create customized workflows

that can be used to automate the process of well permitting. For this project we developed

prototypes for automated well-permitting systems for two models used by the Utah Division of

Water Rights: The Weber County model and the Northern Utah County model.

Page 17: Web-Based Automated Well Permitting

5

2 NORHTERN UTAH COUNTY MODFLOW MODEL

The United States Geological Survey constructed a MODFLOW model to describe the

behavior of the groundwater in Northern Utah County. This model was a steady state model

using four layers. The model used the Hydrogeologic Unit Flow package to describe inter-cell

flow and the Preconditioned Conjugate-Gradient (PCG2) solver to solve the MODFLOW finite

difference equations. The model is bounded by the Wasatch Mountains on the east and the Lake

Mountains on the west. The model extends from Springville, Utah, in the south to Traverse

Mountain in the north. Figure 2-1 shows the domain of the MODFLOW model overlays on a

topographic map.

Figure 2-1: Northern Utah County MODFLOW Model Domain

Page 18: Web-Based Automated Well Permitting

6

Modifying the Solution Methods of the MODFLOW Model 2.1

Unfortunately, the model that was provided by the USGS lacked stability, which led to

unreasonable simulation results. The model tended to oscillate rather than follow a consistent

path toward convergence. Even just before the model converged it appeared to be oscillating

between and high and low errors with each of the MODFLOW iterations. Of particular interest

was that the discharges reported to the drains in the model were not reliable. Figure 2-2 shows a

screenshot of the results obtained for the drains before the modifications were made.

Figure 2-2: Unusual Drain Results In Northern Utah County Model

Even though candidate wells were extracting water from the groundwater system, some of the

drains in the model experienced increased discharges. Also, some of the drains very far from the

extraction wells experienced a larger change in discharge than wells closer to the candidate

Page 19: Web-Based Automated Well Permitting

7

wells. Since the decision of whether or not to grant a permit depends partly on how the candidate

well affects discharge to the drains in the model, this was not acceptable. In order to increase the

stability of the model, the solver was switched from the PCG2 solver to the LMG solver. The

LMG solver tends to be more stable than the PCG solver (Lemon 2012). Once the switch was

made, the settings that were used for the LMG solver are shown in Figure 2-3. Using the LMG

solver reduced the amount of oscillation present in the model and provided more accurate results

(Lemon 2012). Drain discharges no longer increased when candidate wells were added; however,

due to the variable conductivity assigned to the model drains, the changes in the drain discharge

results can still appear somewhat counterintuitive.

Figure 2-3: Setup For LMG Solver

Page 20: Web-Based Automated Well Permitting

8

Permitting Criteria for Springs 2.2

The well permitting plan for Northern Utah County mandates that the impact a candidate

well will have on the amount of water discharging from springs to springs needs to be considered

before a permit can be issued (Greer 2011). In the Northern Utah County model, springs are

accounted for using the MODFLOW drain package. Drains are a good approximation for springs

because they allow water to be discharged from aquifers in the same way that springs discharge

groundwater to the surface (Greer 2011). Most of the drains in Northern Utah County model are

concentrated on the north and east shores of Utah Lake. Figure 2-4 shows a graphic that was

generated using Arc Hydro Groundwater software. It represents the locations of all the drains

within the Northern Utah County MODFLOW model.

Figure 2-4: Drains In Northern Utah County Model

Using the MODFLOW observation process it is possible to obtain the simulated

equivalent drain discharges throughout the MODFLOW model. In many cases MODFLOW

models will already have an observation process set up that was used to calibrate the model.

Page 21: Web-Based Automated Well Permitting

9

Unfortunately, the Northern Utah County model did not already have such an observation

process set up. In order to continue with the well permitting project is was necessary to write an

observation process that would report the simulated equivalents for drain discharges. Three steps

were involved in creating the observation process including: modifying the namefile, creating the

OBS text file, and creating the DROB text file.

2.2.1 Modifications to the Namefile

In order to set up the observation process, it was necessary to modify the MODFLOW

namefile. The namefile was changed so that it would direct MODFLOW to find the newly

created OBS and DROB text files that are part of the observation process. Figure 2-5 shows a

screenshot of the namefile after it was modified to accommodate the newly created observation

process.

Figure 2-5: Modified Northern Utah County Namefile

Page 22: Web-Based Automated Well Permitting

10

2.2.2 Creating the OBS File

The OBS text file determines the names that will be applied to files created by the

observation process as well as the types of sensitivity tables that are printed. A screenshot of the

OBS file for the Northern Utah County model is included in Figure 2-6 (Winston, OBS - Input

File for All Observations 2012).

Figure 2-6: OBS File or Northern Utah County Model

2.2.3 Creating the DROB File

The DROB file determines which drains in the MODFLOW simulation will have

discharge results written to the MODFLOW observation process. In this case it was desired that

the discharge in each drain be reported in the observation process. A list of all the drains in the

model was obtained from the drain package dialogue in Groundwater Modeling System (GMS).

This list was input into Microsoft Excel and arranged in the DROB file format using Visual

Basic Programming. Once the worksheet was arranged, it was saved as a tab delimited text file,

which was used as the DROB file. In order to include all of the drains in the model this file was

over 7,000 lines long so it is not practical to show the entire file in this report. Figure 2-7 shows a

partial screenshot of the DROB file that is used by the workflow (Winston, DROB - Drain

Observation Package 2012).

Page 23: Web-Based Automated Well Permitting

11

Figure 2-7: Northern Utah County DROB File

Permitting Criteria for Drawdown 2.3

Well permitting policies for the Northern Utah County region also require that the

drawdown of candidate wells be analyzed prior to issuing a permit. Excessive drawdown from a

proposed well indicates that it would deplete groundwater resources and should not be approved.

Additionally if a well has a large amount of drawdown it can damage the ability of nearby wells

to produce water. In order to analyze the amount of drawdown that would occur in the Northern

Utah County model, it was necessary to modify the starting heads array and the output control

file (Greer 2011).

2.3.1 Modifications to the Starting Head Array

Before the model could be used in well permitting it was necessary to modify the values

that were used in the starting heads array of the MODFLOW model. To do so, the MODFLOW

Page 24: Web-Based Automated Well Permitting

12

model was run once in GMS until it converged to a solution. After the model converged to a

solution, the calculated hydraulic head values for each cell were copied over to the starting heads

array. Taking these steps put the model at near equilibrium, with respect to hydraulic head, and

reduced the amount of time it took for MODFLOW to converge to a solution. After making this

change there was virtually no difference, other than slight round off error, between the values of

the starting heads and calculated heads unless additional wells were introduced to the

MODFLOW model.

Since the arrays for starting heads and calculated heads remain nearly the same until

additional wells are added, it is reasonable to assume that the differences between the two arrays

after the wells are added are caused by the new well. Therefore, the drawdown for both arrays

can be calculated as shown in Equation 2 - 1. Arc Hydro Groundwater makes provisions for

importing the arrays for both starting heads and calculated heads so that they can automatically

compared and used to create a feature class showing the drawdown in the model.

(2 – 1)

2.3.2 Modifications to the Output Control Dialog

The MODFLOW output control file determines the format and the types of simulation

results will be written out. In order to perform the analysis it was necessary to print out the array

containing drawdown results. To avoid the possibility of omitting a required output file, the

output control file was written to direct MODFLOW to write out all possible results.

Page 25: Web-Based Automated Well Permitting

13

3 NORTHERN UTAH COUNTY WORKFLOW

The Northern Utah County workflow was created using ArcGIS’s model builder, and

structured in such a way that it reports the results desired for that region. The workflow was

patterned after two other workflows that are currently being used for different sections of Florida

and Virginia. Although the runtime for the workflow varies depending on the quality of

computer, the simulation normally takes 3 minutes to run to completion. For the purposes of this

report, the workflow has been divided into several different phases that will be discussed in

detail throughout this chapter. It is hoped that this document will allow anyone with interest in

the workflow to gain an understanding of how it operates and develop similar prototypes.

Additionally this document is meant to serve as a basic guide for how this approach could be

implemented for other groundwater models.

Returning to Baseline Model 3.1

The first phase of the workflow returns the Arc Hydro Groundwater geodatabase

representation of the Northern Utah County model to its baseline state. To return to the baseline

state, all of the candidate wells added to the Arc Hydro Groundwater geodatabase in previous

runs of the workflow need to be eliminated. These wells reside in two locations within the Arc

Hydro Groundwater geodatabase, including the Wells_New point feature class and the WEL

table. Since the Wells_New feature class only contains candidate wells, all of the records within

Page 26: Web-Based Automated Well Permitting

14

the feature class are deleted at the start of each run. This is accomplished using the Delete Rows

geoprocessing tool. Returning the WEL table to its baseline state is slightly more complicated

because it contains wells that are part of the baseline model in addition to candidate wells. To

separate the temporary candidate wells from the wells that are part of the baseline model, an

SQL query and the Make Table View geoprocessing tool are used. The query ensures that only

candidate wells will be included in the table view. Once the table view is created, all of the

candidate wells are deleted using the Delete Rows geoprocessing tool. Anything that happens to

the records in a table view also occurs in the original table, which means all the unwanted

candidate wells are also removed from the WEL table (ESRI 2012). Figure 3-1 shows a

screenshot of how Model builder is used to execute this portion of the workflow (ESRI 2012).

Figure 3-1: Return Model To Baseline State

Adding Candidate Wells to the AHGW Geodatabase 3.2

Because of its superior flexibility, a Python script is used to add new candidate wells to

the Wells_New point feature class in the Arc Hydro Groundwater geodatabase. The script uses

Python loops to parse through all of the wells inside the WellRecordTable and add each of them

to the Wells_New feature class. While the WellRecordTable is not officially part of the Arc

Hydro Groundwater geodatabase framework, it was included because it allows the workflow to

Page 27: Web-Based Automated Well Permitting

15

add multiple wells to each run. The contents of the WellRecordTable can be adjusted during an

ArcGIS edit session. The Python script that performs these actions has been included in

Appendix A of this report.

The wells contained in the Wells_New feature class are partially converted to the

MODFLOW format and appended to the WEL table using the Create MODFLOW Well Records

geoprocessing tool. This tool takes the information in the Wells_New feature class, compares it

to the MODFLOW discretization and calculates the appropriate IJK index for each candidate

well. After an appropriate MODFLOW index is assigned to each of the candidate wells, the

index and the pumping rate for each candidate well is written to the WEL table. Figure 3-2

shows how this portion of the workflow appears in ArcGIS’s Model Builder. At this point the

candidate wells have been partially converted to the MODFLOW format.

Figure 3-2: Adding Candidate Wells To The AHGW Geodatabase

Page 28: Web-Based Automated Well Permitting

16

Adjusting the Values in WEL Table 3.3

Before the wells in the WEL table can be exported to the MODFLOW text files outside

of the geodatabase, it is necessary to alter the contents of the WEL table. This is accomplished

through using the Calculate Field geoprocessing tool twice (ESRI 2012). The Calculate Field

geoprocessing tool is used once to ensure that an appropriate key value has been assigned to each

of the wells in the WEL table. If a record in the WEL table does not have an appropriate Key

Value, it will not be exported to the original MODFLOW text files. In this case, a value of -1 in

the CELLGRP field was used as a key value. Therefore all of the records in the WEL table were

assigned that key value in the CELLGRP field.

The Calculate Field geoprocessing tool is used a second time to copy the Q field to the

QFact field in WEL table. This was done because in this case it appears that the QFact field,

rather than the Q field, becomes the pumping rate in the MODFLOW files. Figure 3-3 shows a

screenshot of this portion of the workflow as it appears in ArcGIS’s Model Builder.

Figure 3-3: Adjusting The Values In The WEL Table

Page 29: Web-Based Automated Well Permitting

17

Exporting Candidate Wells to MODFLOW Text Files 3.4

The Export Package WEL geoprocessing tool was used to convert the contents of the

WEL table into a text file that is used as the MODFLOW Well Package. When this tool is run, it

actually overwrites the previous text file for the well package and replaces it entirely. When

using this tool one should be cautious and create a backup of the original well text file. The

reason for this is that ArcGIS’s Model Builder tends to delete intermediate data at the conclusion

of a model run. This means that this file often only exists while the workflow is running and is

deleted as soon as the workflow is finished. Figure 3-4 shows a screenshot of this portion of the

workflow as it appears in ArcGIS’s Model Builder.

Figure 3-4: Exporting Candidate Wells To MODFLOW Text Files

Page 30: Web-Based Automated Well Permitting

18

Running MODFLOW with New Candidate Wells 3.5

After the candidate wells and baseline wells in the Arc Hydro Groundwater geodatabase

have been exported to the original MODFLOW files, MODFLOW is run. This is accomplished

through the use of the Run MODFLOW geoprocessing tool, which starts the MODFLOW

executable outside of ArcGIS. When the MODFLOW simulation is completed, the results reflect

the influence of the new set of candidate wells. By comparing the results of the baseline model

with the results of the new MODFLOW run, it is possible to ascertain the impact that the

candidate wells have on the model. In other words any drawdown or change in the drain

discharges is assumed to be caused by the candidate wells. Figure 3-5 shows a screenshot of this

portion of the workflow as it appears in ArcGIS’s Model Builder.

Figure 3-5: Running MODFLOW Simulation

Importing MODFLOW Simulation Results to AHGW Geodatabase 3.6

The results of the MODFLOW simulation are imported from the MODFLOW text files

into the Arc Hydro Groundwater geodatabase using two geoprocessing tools. The drawdown in

Page 31: Web-Based Automated Well Permitting

19

each of the active cells in the model is imported using the Import MODFLOW Output

geoprocessing tool. This tool imports the amount of drawdown that MODFLOW calculates and

prints it to the OutputDrawdown table within the geodatabase. When this tool appears in Model

Builder, it appears to import results pertaining to time, flow, head, and drawdown. However,

even though these appear as outputs in the Model Builder display, the option to import the other

criteria must be checked before it will occur. Figure 3-6 shows pictures of this portion of the

workflow as it appears in ArcGIS’s Model Builder.

Figure 3-6: Importing Drawdown Results into the AHGW Geodatabase

Since the results of the MODFLOW observation process contain the discharges to the

drains, they must also be imported into the Arc Hydro Groundwater geodatabase. This is

Page 32: Web-Based Automated Well Permitting

20

accomplished using the Import Simulated Equivalents geoprocessing tool. This tool takes the

information stored in the MODFLOW.os text file and prints it to the FLOB and HOBTimes

tables in the geodatabase. Additionally, it also calculates a residual between the simulated drain

discharges with the new candidate wells, and the drain discharges that were observed for the

baseline model. Figure 3-7 shows a screenshot of this portion of the workflow as it appears in

ArcGIS’s Model Builder.

Figure 3-7: Importing MODFLOW Observation Process Results to AHGW Geodatabase

Creating Feature Classes Showing Change in Drain Discharges 3.7

The MODFLOW observation process information stored in the FLOB and table is more

useful when it is displayed graphically. There are two steps involved in accomplishing this

including: providing the FLOB table with an accurate IJK index field, and creating polygon

feature classes that show the locations and discharges of the drains. The first step is not part of

the workflow and is done only once while setting up the workflow. In order to provide the FLOB

table with an IJK field, it is necessary to join the table to the FLOBFactors table, which already

has an IJK index for each observation. Since the FLOB table does not have an IJK field, one

Page 33: Web-Based Automated Well Permitting

21

must be created and then populated. The newly created field may be populated using the

Calculate Field geoprocessing tool to copy the IJK values in the FLOBFactors table to the IJK

field in the FLOB table. After the values in the IJK field of the FLOBFactors table have been

copied over to the new field in the FLOB table, the join should be removed.

The second part of the workflow occurs every time that the simulation is run, and

involves the creation of polygon feature classes that represent the locations of the MODFLOW

cells containing drains. These polygon feature classes are created using the Create MODFLOW

Features geoprocessing tool. This tool is used to create 3 different polygon feature classes

representing the simulation results for the drains in the top 3 layers of the model. Figure 3-8

shows this portion of the workflow as it appears in ArcGIS’s Model Builder.

Figure 3-8: Creating Polygon Feature Classes Representing Drain Discharge

Page 34: Web-Based Automated Well Permitting

22

Creating Point Feature Classes for Drawdown 3.8

The drawdown data in the OutputDrawdown table is also more useful when it is

represented graphically. The final method of displaying this information will be contour lines,

but the first step in creating these contour lines is creating point feature classes representing the

drawdown. This is once again accomplished using the Create MODFLOW Features

geoprocessing tool. Since the model has four total layers, this tool is run once for each of the

layers in the model. Figure 3-9 shows a screenshot of this portion of the workflow as it appears

in ArcGIS’s Model Builder.

Figure 3-9: Creating Point Feature Classes Representing Drawdown

Page 35: Web-Based Automated Well Permitting

23

Creating Drawdown Contour Lines 3.9

There are two steps involved in converting the point feature classes representing

drawdown in to feature classes displaying contour lines. The first step is to convert the point

feature classes to raster format using an interpolation scheme. This model uses the Spline

geoprocessing tool to convert the points into a raster format (ESRI 2011). Once the point feature

classes have been converted to raster format, they are converted to feature classes containing

contour lines using the Contour geoprocessing tool (ESRI 2011). In order for this tool to work

properly, it requires a contour interval that the user specifies at the beginning of the run. Figure

3-10 shows a screenshot of this portion of the workflow as it appears in ArcGIS’s Model

Builder.

Figure 3-10: Creating Drawdown Contour Lines

Page 36: Web-Based Automated Well Permitting

24

Page 37: Web-Based Automated Well Permitting

25

4 WEBER COUNTY MODFLOW MODEL

The United States Geological Survey created a transient MODFLOW model in 1984 that

was designed to simulate groundwater behavior on the east side of the Great Salt Lake. It was a

thirty-year transient model meant to simulate the years between 1955 and 1985. The model uses

the Block Centered Flow (BCF) package and the Strongly Implicit Procedure (SIP) solver to

converge to a solution. Three layers, each with a different LAYCON value, are used to depict the

strata and aquifer systems within the model boundaries. Table 1 contains information about the

LAYCON value for each of the layers. The LAYCON value determines whether or not the

calculations in layers will be made using confined or unconfined equations (Appel and Clark

1990).

The model domain is bounded by the Wasatch Mountain Range on the east side, and the

Great Salt Lake on the west. It has no flow boundaries on the north and south at Willard and

Centerville, Utah, respectively. Figure 4-1 shows the model domain overlaying a topographic

map (Appel and Clark 1990).

Weber County Well Permit Criteria 4.1

We consulted the Utah Division of Water Rights to determine what types of well

permitting criteria existed for this region, and discovered that the impact that candidate wells had

on discharge to local rivers and the amount of drawdown that was caused by the well needed to

Page 38: Web-Based Automated Well Permitting

26

be assessed. Several small modifications were made to the MODFLOW files so that it will

produce accurate results for these two categories. These modifications will be discussed in detail

(Greer, Questions about Weber County Model 2012).

Figure 4-1: Weber County Model Domain

4.1.1 Converting the Model to Steady State

The Utah Division of Water Rights requested that the Weber County model be converted

from transient to steady state before the model was added to the well-permitting workflow.

Steady state models are frequently used for well permitting applications because the solutions

they provide reflect the maximum impact that candidate wells have on the groundwater system

over time. Additionally, there is no guarantee that the candidate wells will have time to achieve

equilibrium during a transient simulation (Greer, Questions about Weber County Model 2012).

Fortunately, in this case the conversion from transient to steady state was straightforward.

The transient version of the Weber County model had one stress period with four time steps. In

Page 39: Web-Based Automated Well Permitting

27

MODFLOW, model input parameters can only be changed at the beginning of a stress period.

This means that all the model inputs were the same for each of the time steps and none of the

input parameters changed during the simulation. Since all of the input parameters were constant,

the only action required to convert the Weber County model was to change the model type from

transient to steady state.

4.1.2 Starting Head Modifications

The groundwater management plan for Weber County mandates that no well should

cause more than 15 feet of drawdown on a well with an earlier priority date (Greer, Questions

about Weber County Model 2012). To ensure that the starting head array represented proper

baseline conditions, the steady state simulation was run once to completion with no candidate

wells included and the simulated hydraulic heads at the conclusion of the run were copied over to

the starting head array.

4.1.3 Observation Package Modifications

The Weber County groundwater management plan also mandates that the impact of

pumping wells on surface water flows be considered before a permit is issued. The rivers in the

model were simulated using the Drain package. MODFLOW simulations can be set up to report

the simulated discharge to each drain within the model using the OBS Process as described in

Section 2.2. Unfortunately, in this model the OBS process was not utilized so it had to be

constructed prior to incorporating the model in the workflow.

Three steps were involved in creating the OBS process including: modifying the

namefile, creating the OBS text file, and creating the DROB text file. All of these modifications

Page 40: Web-Based Automated Well Permitting

28

were performed in the same manner as they were for the Northern Utah County model that was

discussed earlier.

4.1.4 Limitations of the BCF Package

MODFLOW calculates the movement of water between each cell in the model grid using

one of three flow packages. In the case of the Weber County model, the BCF package was used

to make the calculations. The required input arrays for the BCF package, for each layer of the

grid, are determined by the value of the MODFLOW parameter LAYCON. Table 2 shows the

value of LAYCON for each layer in the model as well as some required input for each layer.

Table 4 - 1: Explanation of Various Values of LAYCON

MODFLOW Layer

LAYCON Value Aquifer Type Required Arrays

1 1 Unconfined Bottom Elevation, Hydraulic Conductivity

2 2 Confined/Unconfined Top Elevation, Transmissivity

3 0 Confined Transmissivity

Table 2 demonstrates that when the BCF flow package is used, none of the layers have a

full set of top and bottom elevation arrays. This makes it impossible to use well screen elevations

as a means of determining the layer from which a well will pump water. In order to place the

well appropriately in the MODFLOW simulation, one must know from which aquifer system the

well will be pumping and insert the well into the associated model layer. Since the Arc Hydro

Groundwater geoprocessing tool that normally places the well within the MODFLOW model

does so using elevations, it was not possible to use the tool. To work around this, a new

geoprocessing tool that accepts MODFLOW layers, rather than elevations, as input was created

from a Python script.

Page 41: Web-Based Automated Well Permitting

29

5 WEBER COUNTY WORKFLOW

The Weber County workflow was created to analyze the impact of candidate wells on

drawdown and surface water discharges to select portions of the river system, similarly to the

Northern Utah County workflow. The Weber County workflow was developed using a Python

script rather than ArcGIS’s Model Builder Utility. This section of the report explains how the

script performs the analysis for candidate wells that are investigated. For simplicity, the actions

taken by the Python script are diagrammed in a Microsoft Visio flow chart. The actual written

code for the script is included in the appendix.

Preparing the Script 5.1

When the script begins to run, it immediately takes three steps including importing the

Arcpy and Sys modules, and updating the path to the namefile in the geodatabase. These steps

are outlined in Figure 5-1. The Arcpy module allows Python to access the geoprocessing abilities

of ArcGIS. The Sys module allows the variables stored in the script to determine relative paths

to necessary files. However, the MDFGlobals table in the geodatabase has the path to the

namefile hardwired into it. So that the user will not have to manually edit the path in the

MDFGlobals table each time the script is used on a different computer, the script edits the table

each time and updates the path.

Page 42: Web-Based Automated Well Permitting

30

Figure 5-1: Preparing the Script

Adding Candidate Wells 5.2

The script next determines MODFLOW IJK indices for the candidate wells and adds them to

appropriate feature classes and tables within the Arc Hydro Groundwater geodatabase (Figure

5-2). Essentially, the script loops through the WellRecordTable twice. The first time through

the loop calculates the MODFLOW IJK index of each candidate well individually and writes the

information to the WEL table. It does this by creating a point at the location of the candidate

well, finding the Cell2D polygons that intersect the point, finding the IJ index of the intersecting

polygon, and finally using the IJ index too look up the individual I and J indices in the Cell Index

table. Once the I, J, and K indices are known individually, the IJK index for that well is

calculated. Finally the IJK index that was calculated and the pumping rate are written to the

WEL table. This first loop will repeat itself until it has gone through all the candidate wells

stored in the WellRecordTable.

The second loop allows all the candidate wells to be displayed in the Wells_New feature

class at the same time. Each time through the loop one candidate well is added to the

Wells_New feature class. The loop continues until there are no more candidate wells in the

table.

Page 43: Web-Based Automated Well Permitting

31

Figure 5-2: Adding Candidate Wells

Running the Simulation 5.3

Next, the script runs a MODFLOW simulation with the new candidate wells included and

imports the results to the Arc Hydro Groundwater geodatabase (Figure 5-3). Since the Arc

Hydro Groundwater tools are not part of the standard tool set of ArcGIS they are not included in

the Arcpy module that was imported at the beginning of the script. In order to use the Arc Hydro

Groundwater geoprocessing tools in a Python script they must be imported. The Export WEL

Package geoprocessing tool is used to export the contents of the WEL table in the Arc Hydro

Groundwater geodatabase to a text file. The text file that is created by this geoprocessing tool

replaces the pre-existing MODFLOW well file in the simulation. After the new candidate wells

have been added to the Arc Hydro Groundwater geodatabase, MODFLOW is run. When

MODFLOW is run simulation, results are automatically added to the MODFLOW text files. The

Page 44: Web-Based Automated Well Permitting

32

MODFLOW simulation results from the text files are imported into the Arc Hydro Groundwater

geodatabase using two geoprocessing tools. The Import Simulated Equivalents geoprocessing

tool is used to import the results for the MODFLOW observation process into the AHGW

geodatabase. These results are stored in the FLOB, HOB, and FLOBFactors tables. The Import

MODFLOW Output geoprocessing tool is used to import the drawdown results into the

OutputDrawdown table.

Figure 5-3: Run MODFLOW And Import Results

Visualizing Simulation Results 5.4

This portion of the script moves MODFLOW output data from tables in the geodatabase

to feature classes. After the feature classes are created they are symbolized to provide a visual

context for the results. These feature classes are created from scratch each time the script is run

using the Create MODFLOW Features geoprocessing tool. A polygon feature class is created to

display the location of drains in the top MODFLOW layer. Additional feature classes are created

to symbolize the amount of drawdown that occurred in each of the cells for each layer of the

Page 45: Web-Based Automated Well Permitting

33

model. Figure 5-4 outlines the post processing steps that were taken so that the results of this

simulation could be displayed. The end result is a .KMZ file created for each of the feature

classes used to denote the results of the simulation.

Figure 5-4: Post Processing Simulation Results

Conclusion 5.5

To promote the sustainable use of groundwater reserves states and local governments can

regulate the consumption of groundwater. This regulation usually requires entities to apply for a

well permit before developing a well and bringing it into production. Even though regulating

well development is an effective method for protecting a groundwater system, it can be a tedious

Page 46: Web-Based Automated Well Permitting

34

and labor-intensive process. When done by hand, this analysis can take many months during

which state resources are tied up.

Using modern computer programs the amount of time required to analyze candidate wells

can be significantly reduced. This document describes how automated well permitting

workflows can be created by combining and using various software programs such as ArcGIS,

Arc Hydro Groundwater, MODFLOW and Python. One workflow was created for Weber

County while another workflow was created for Utah County. Both of these workflows are

capable of analyzing the affects that one or more candidate wells have on their respective

groundwater systems. It is anticipated that using the two tools to analyze candidate wells will

reduce the time required for analysis and make it easier for the state of Utah to process well

permitting applications.

Page 47: Web-Based Automated Well Permitting

35

REFERENCES

Appel, C. L., and D. W. Clark. GROUND-WATER RESOURCES AND SIMULATED EFFECTS

OF WITHDRAWALS IN THE EAST SHORE AREA OF GREAT SALT LAKE, UTAH.

Technical Publication, Salt Lake City: U.S. Geological Survey and Division of Water

Rights, 1990.

Aquaveo. Main Page. Arc Hydro Groundwater. April 26, 2012.

www.archydrogw.com/ahgw/Main_Page (accessed March 18, 2012).

Cederberg, J. R., P. M. Gardner, and S. A. Thiros. Hydrology of Northern Utah Valley, Utah

County, Utah, 1975-2005. Salt Lake City: U.S. Geological Survey Scientific

Investigations Report, 2009.

ESRI. About Us. May 14, 2012. www.esri.com/about-esri/about/history.html (accessed May 18,

2012).

—. Calculate Field. May 14, 2012.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000004m000000

(accessed May 19, 2012).

—. Contour. June 29, 2011.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000ts000000.htm

(accessed May 19, 2012).

—. Delete Rows. May 14, 2012.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//0017000000n6000000

(accessed May 19, 2012).

—. GIS for Defense and Intelligence. n.d. www.esri.com/industries/defense/modelbuilder.html

(accessed May 18, 2012).

—. Make Table View. May 14, 2012.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006v000000

(accessed May 19, 2012).

—. Spline. June 29, 2011.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z0000006q000000.ht

m (accessed May 19, 2012).

Page 48: Web-Based Automated Well Permitting

36

Greer, J., interview by M. A. Bentley, & N. L. Jones. First Discussion of Northern Utah County

Workflow (March 24, 2011).

Greer, J., interview by M. A. Bentley, & N. L. Jones. Questions about Weber County Model

(December 21, 2012).

Jones, K. L., State of Utah Water Well Handbook. www.waterrights.utah.gov. April 2011.

www.waterrights.utah.gov/wellinfo/handbook.pdf (accessed May 18, 2012).

Lemon, A., interview by M. A. Bentley. Addressing stability in the Northern Utah County Model

(March 20, 2012).

UDWR. Frequently Asked Questions. www.waterrights.utah.gov. n.d.

www.waterrights.utah.gov/wrinfo/faq.asp#q2 (accessed May 18, 2012).

Winston, R B., DROB - Drain Observation Package. May 1, 2012.

http://water.usgs.gov/nrp/gwsoftware/modflow2000/MFDOC/drob.htm?zoom_highlights

ub=OBS (accessed May 18, 2012).

—. OBS - Input File for All Observations. May 1, 2012.

http://water.usgs.gov/nrp/gwsoftware/modflow2000/MFDOC/obs.htm?zoom_highlightsu

b=OBS (accessed May 18, 2012).

Page 49: Web-Based Automated Well Permitting

37

APPENDIX A. NORTHERN UTAH COUNTY PYTHON SCRIPT

import arcpy

import arcpy.mapping

arcpy.env.overwriteOutput = True

# Delineate Variables

import sys

path = sys.argv[0]

path = path.replace(\\, /)

count = path.count(/)

path = path.rsplit(/)

concatenations = 0

directory =

gdb =

for concatenate in range(0, count):

directory = directory + path[concatenations] + /

scratch = directory + NorthernUtahCounty/NorthernUtahCounty.mdb/

scratchLayers = directory +

NorthernUtahCounty/NorthernUtahCounty.mdb/Layers/

results = directory + Results.mdb

# MODFLOW Files

mfn = directory + NorthernUtahCounty/Out_Mf2k/ucfd.mfn

os = directory + NorthernUtahCounty/Out_Mf2k/ucfd._os

ws = directory + NorthernUtahCounty/Out_Mf2k/ucfd._ws

wel = directory + NorthernUtahCounty/Out_Mf2k/ucfd.wel

# AHGW Tables

Basic = scratch + Basic

BasicArrayMult = scratch + BasicArrayMult

BASVars = scratch + BASVArs

BotmElev = scratch + BotmElev

CBFlags = scratch + CBFlags

CHD = scratch + CHD

Clusters = scratch + Clusters

DELRC = scratch + DELRC

DISLayers = scratch + DISLayers

DISVars = scratch + DISVars

DRN = scratch + DRN

EVTArrayMult = scratch + EVTArrayMult

EVTArrays = scratch + EVTArrays

EVTVars = scratch + EVTVars

FLOB = scratch + FLOB

FLOBFactors = scratch + FLOBFactors

GHB = scratch + GHB

Page 50: Web-Based Automated Well Permitting

38

HOB = scratch + HOB

HOBLayers = scratch + HOBLayers

HOBTimes = scratch + HOBTimes

IZ = scratch + IZ

LMG = scratch + LMG

MDFGlobals = scratch + MDFGlobals

Multipliers = scratch + Multipliers

MultNames = scratch + MultNames

NameFile = scratch + NameFile

OBSVars = scratch + OBSVars

OCTS = scratch + OCTS

OCVars = scratch + OCVars

OutputDrawdown = scratch + OutputDrawdown

OutputFiles = scratch + OutputFiles

OutputFlow = scratch + OutputFlow

OutputHead = scratch + OutputHead

OutputTime = scratch + OutputHead

Params = scratch + Params

ParInstances = scratch + ParInstances

ParInstSP = scratch + ParInstSP

PilotPts = scratch + PilotPts

RCHArrayMult = scratch + RCHArrayMult

RCHArrays = scratch + RCHArrays

RCHVars = scratch + RCHVars

StressPeriods = scratch + StressPeriods

TopElev = scratch + TopElev

WEL = scratch + WEL

ZoneNames = scratch + ZoneNames

Zones = scratch + Zones

CellIndex = scratch + CellIndex

WellRecordTable = scratch + WellRecordTable

# Input Feature Classes

Wells_New = scratchLayers + Wells_New

Cell2D = scratchLayers + Cell2D

Node2D = scratchLayers + Node2D

Boundary = scratchLayers + Boundary

# Toolboxes

mytools = scratch + mytools

print mytools

print scratch

print scratchLayers

#Importing Toolbox

arcpy.ImportToolbox(mytools, mytools)

arcpy.gp.toolbox = mytools

arcpy.AddMessage(arcpy.ListToolboxes)

arcpy.AddMessage(arcpy.ListTools(*_mytools))

print arcpy.ListTools(*_mytools)

rows = arcpy.SearchCursor(WellRecordTable)

# Creating Well Features

for row in rows:

pR = row.PumpingRate

sT = row.ScreenTop

sB = row.ScreenBot

x = row.X

y = row.Y

Page 51: Web-Based Automated Well Permitting

39

point = str(x) + + str(y)

arcpy.gp.CreateWellFeature_mytools(Wells_New, PumpingRate,

ScreenTop, ScreenBot, point, pR, sT, sB)

arcpy.AddMessage(14)

del row

del rows

# Update MDFGlobals Path to Namefile

rows = arcpy.UpdateCursor(MDFGlobals)

for row in rows:

row.NameFilePath = mfn

rows.updateRow(row)

del row

del rows

# Update Key Values in the WEL Table

rows = arcpy.UpdateCursor(WEL)

for row in rows:

row.CELLGRP = -1

rows.updateRow(row)

del row

del rows

arcpy.SetParameterAsText(0, DummyOut)

Page 52: Web-Based Automated Well Permitting

40

Page 53: Web-Based Automated Well Permitting

41

APPENDIX B. WEBER COUNTY WORKFLOW SCRIPT

# Runs Permit Script From Command Line

# 10.5.113.21

interval = input(Enter a Drawdown Contour Interval = )

print (Importing Modules)

import arcpy

import arcpy.mapping

arcpy.env.overwriteOutput = True

# Finding Relative Path to Script

import sys

path = sys.argv[0]

path = path.replace(\\, /)

count = path.count(/)

path = path.rsplit(/)

concatenations = 0

directory =

ogden =

splines =

gdb =

gdbl =

for concatenate in range(0, count):

directory = directory + path[concatenations] + /

ogden = directory + Ogden/

gdb = directory + Ogden/Ogden.mdb/

splines = directory + Ogden/Ogden.mdb/Splines

gdbl = directory + Ogden/Ogden.mdb/Layers/

sgdb = directory + Ogden/OgdenScratch.mdb/

sgdbl = directory + Ogden/OgdenScratch.mdb/Layers/

orgdbl = directory + Ogden/OgdenResults.mdb/Layers/

orgdb = directory + Ogden/OgdenResults.mdb/

concatenations = int(concatenations) + 1

# Define Script Input Variables

Basic = gdb + Basic

BasicArrayMult = gdb + BasicArrayMult

BASVars = gdb + BASVars

BCFLayers = gdb + BCFLayers

BCFProperties = gdb + BCFProperties

BCFVars = gdb + BCFVars

BotmElev = gdb + BotmElev

CBFlags = gdb + CBFlags

Clusters = gdb + Clusters

DELRC = gdb + DELRC

Page 54: Web-Based Automated Well Permitting

42

DISLayers = gdb + DISLayers

DISVars = gdb + DISVars

DRN = gdb + DRN

EVTArrayMult = gdb + EVTArrayMult

EVTVars = gdb + EVTVars

FLOBFactors = gdb + FLOBFactors

GHB = gdb + GHB

HOB = gdb + HOB

HOBLayers = gdb + HOBLayers

HOBTimes = gdb + HOBTimes

IZ = gdb + IZ

MDFGlobals = gdb + MDFGlobals

Multipliers = gdb + Multipliers

MultNames = gdb + MultNames

NameFile = gdb + NameFile

OBSVars = gdb + OBSVars

OCTS = gdb + OCTS

OCVars = gdb + OCVars

OutputDrawdown = gdb + OutputDrawdown

OutputFiles = gdb + OutputFiles

OutputFlow = gdb + OutputFlow

OutputHead = gdb + OutputHead

OutputTime = gdb + OutputTime

Params = gdb + Params

ParInstances = gdb + ParInstances

ParInstSP = gdb + ParInstSP

PilotPts = gdb + PilotPts

RCHArrayMult = gdb + RCHArrayMult

RCHArrays = gdb + RCHArrays

RCHVars = gdb + RCHVars

SIP = gdb + SIP

StressPeriods = gdb + StressPeriods

TopElev = gdb + TopElev

WEL = gdb + WEL

ZoneNames = gdb + ZoneNames

Zones = gdb + Zones

CellIndex = gdb + CellIndex

WellRecordTable = orgdb + WellRecordTable

FLOB = gdb + FLOB

Cell2D = gdbl + Cell2D

Node2D = gdbl + Node2D

Boundary = gdbl + Boundary

Wells_New = gdbl + Wells_New

Wells_New_Results = orgdbl + Wells_New

EASTSHOR_mfn = ogden + EASTSHOR_MODFLOW/EASTSHOR.mfn

EASTSHOR_wel = ogden + EASTSHOR_MODFLOW/EASTSHOR.wel

EASTSHOR_os = ogden + EASTSHOR_MODFLOW/EASTSHOR._os

EASTSHOR_ws = ogden + EASTSHOR_MODFLOW/EASTSHOR._ws

mytools = gdb + mytools

ahgw_mf2k = ogden + Arc Hydro Groundwater Toolkit/MF2K/mf2k_ahgw.exe

#Define Script Output Variables

DD1 = sgdb + DD1

DD2 = sgdb + DD2

DD3 = sgdb + DD3

Drains = orgdbl + Drains

DL1 = sgdbl + DrawdownLayerOne

Page 55: Web-Based Automated Well Permitting

43

DL2 = sgdbl + DrawdownLayerTwo

DL3 = sgdbl + DrawdownLayerThree

KMZ1 = ogden + KML/Drawdown Layer 1.kmz

KMZ2 = ogden + KML/Drawdown Layer 2.kmz

KMZ3 = ogden + KML/Drawdown Layer 3.kmz

KMZD = ogden + KML/Drains Layer 1.kmz

pdf1 = directory + page1.pdf

pdf2 = directory + page2.pdf

pdf3 = directory + page3.pdf

#Define Symbology Layers

DrainsSym = ogden + DrainsSymbol.lyr

DrawdownSym = ogden + DrawdownSymbology.lyr

# Map Documents

mxd1 = arcpy.mapping.MapDocument(directory + Layer1.mxd)

mxd2 = arcpy.mapping.MapDocument(directory + Layer2.mxd)

mxd3 = arcpy.mapping.MapDocument(directory + Layer3.mxd)

# Updating MDF Globals

rows = arcpy.UpdateCursor(MDFGlobals)

for row in rows:

row.NameFilePath = EASTSHOR_mfn

rows.updateRow(row)

del row

del rows

# Moving New Wells to Well Table

arcpy.MakeFeatureLayer_management(Wells_New, Wells_New.lyr)

arcpy.DeleteRows_management(Wells_New_Results)

arcpy.MakeFeatureLayer_management(Wells_New_Results,

Candidate_Wells.lyr)

arcpy.MakeFeatureLayer_management(Cell2D, Cell2D.lyr)

arcpy.MakeTableView_management(WEL,WEL.tbv)

arcpy.SelectLayerByAttribute_management(WEL.tbv, NEW_SELECTION, '[OID]

> 1055')

arcpy.DeleteRows_management(WEL.tbv)

arcpy.DeleteRows_management(Wells_New.lyr)

srows = arcpy.SearchCursor(WellRecordTable)

for srow in srows:

wid = srow.WellID

pR = srow.PumpingRate

x = srow.X_Coordinate

y = srow.Y_Coordinate

k = srow.MODFLOW_Layer

irows = arcpy.InsertCursor(Wells_New.lyr)

irow = irows.newRow()

irows.insertRow(irow)

del irow

del irows

point = arcpy.Point(x, y)

shape = arcpy.PointGeometry(point)

urows = arcpy.UpdateCursor(Wells_New.lyr)

for urow in urows:

urow.Shape = shape

urows.updateRow(urow)

del urow

Page 56: Web-Based Automated Well Permitting

44

del urows

arcpy.SelectLayerByLocation_management(Cell2D.lyr, INTERSECT,

Wells_New.lyr)

rows = arcpy.SearchCursor(Cell2D.lyr)

for row in rows:

ijdex = row.IJ

del row

del rows

arcpy.DeleteRows_management(Wells_New.lyr)

rows = arcpy.SearchCursor(CellIndex, '[IJ]='+ str(ijdex))

for row in rows:

ival = row.I

jval = row.J

del row

del rows

numi = 67

numj = 36

numk = 3

k = int(k)

ijk = ((k - 1) * numi * numj )+(( ival - 1 ) * numj ) + jval

irows = arcpy.InsertCursor(WEL.tbv)

irow = irows.newRow()

irows.insertRow(irow)

del irow

del irows

rows = arcpy.UpdateCursor(WEL.tbv, '[Q] IS NULL')

for row in rows:

row.Q = pR

row.IJK = ijk

row.SPID = 1

row.Qfact = 1

row.IFACE = 0

print One Well has an IJK = + str(ijk) + .

rows.updateRow(row)

del row

del rows

arcpy.DeleteRows_management(Wells_New.lyr)

arcpy.SelectLayerByAttribute_management(Cell2D.lyr,

CLEAR_SELECTION)

arcpy.SelectLayerByAttribute_management(Wells_New.lyr,

CLEAR_SELECTION)

srows = arcpy.SearchCursor(WellRecordTable)

for srow in srows:

wid = srow.WellID

pR = srow.PumpingRate

x = srow.X_Coordinate

y = srow.Y_Coordinate

k = srow.MODFLOW_Layer

irows = arcpy.InsertCursor(Wells_New.lyr)

irow = irows.newRow()

irows.insertRow(irow)

del irow

del irows

point = arcpy.Point(x, y)

shape = arcpy.PointGeometry(point)

urows = arcpy.UpdateCursor(Wells_New.lyr, '[WellID] IS NULL')

Page 57: Web-Based Automated Well Permitting

45

for urow in urows:

urow.Shape = shape

urow.WellID = wid

urow.PumpingRate = pR

urow.X = x

urow.Y = x

urow.Layer = k

urows.updateRow(urow)

del urow

del urows

irows = arcpy.InsertCursor(Candidate_Wells.lyr)

irow = irows.newRow()

irows.insertRow(irow)

del irow

del irows

urows = arcpy.UpdateCursor(Candidate_Wells.lyr, '[WellID] IS

NULL')

for urow in urows:

urow.Shape = shape

urow.WellID = wid

urow.PumpingRate = pR

urow.X = x

urow.Y = x

urow.Layer = k

urows.updateRow(urow)

del urow

del urows

# Import the Toolboxes. Watch Out!!!

print (Importing specialized toolbox)

arcpy.ImportToolbox(mytools, mytools)

arcpy.gp.toolbox = mytools

print arcpy.ListToolboxes

print arcpy.ListTools(*_mytools)

#######################################################################

#######

# Exporting Well Package ----------------------------------------------

------

print Exporting Package Well

rows = arcpy.UpdateCursor(WEL.tbv)

for row in rows:

row.LinearScale = -1

rows.updateRow(row)

del row

del rows

arcpy.gp.ExportPackageWEL_mytools(WEL.tbv,

LinearScale,

CBFlags,

StressPeriods,

DISVars,

Params,

EASTSHOR_wel)

print arcpy.gp.GetMessages()

# Run MODFLOW ---------------------------------------------------------

------

print Running MODFLOW

Page 58: Web-Based Automated Well Permitting

46

arcpy.gp.RunMODFLOW(ahgw_mf2k, EASTSHOR_mfn)

print arcpy.gp.GetMessages()

print arcpy.ListToolboxes()

# Import MODFLOW Outputs ----------------------------------------------

-----

print Importing MODFLOW Outputs

arcpy.gp.ImportMODFLOWOutput_mytools(NO_HEAD,

IMPORT_DRAWDOWN,

NO_FLOW,

MDFGlobals,

NameFile,

DISVars,

OCVars,

CBFlags,

OutputTime,

OutputHead,

OutputDrawdown,

OutputFlow)

print arcpy.gp.GetMessages()

# Import Simulated Equivalents ----------------------------------------

-----

print Importing Simulated Equivalents

arcpy.mytools.ImportSimulatedEquivalents(EASTSHOR_os, EASTSHOR_ws,

FLOB, HOBTimes)

print arcpy.gp.GetMessages()

#####################################################################

# Creating Results for Drains

# Layer 1------------------------------------------------------------

arcpy.gp.CreateMODFLOWFeatures_mytools(Cell2D,

FLOB,

'HRES',

Basic,

BasicArrayMult,

CellIndex,

DISVars,

Drains,

,

1)

print arcpy.gp.GetMessages()

arcpy.MakeFeatureLayer_management(Drains, Drains Layer 1)

arcpy.ApplySymbologyFromLayer_management(Drains Layer 1, DrainsSym)

arcpy.LayerToKML_conversion(Drains Layer 1, KMZD, 1)

# Creating Contour Lines to Symbolyze drawdown for each of the layers

# Layer 1-----------------------------------------------------------

arcpy.gp.CreateMODFLOWFeatures_mytools(Node2D,

OutputDrawdown,

'Drawdown',

Basic,

BasicArrayMult,

CellIndex,

DISVars,

DD1,

Page 59: Web-Based Automated Well Permitting

47

,

1)

print arcpy.gp.GetMessages()

arcpy.CheckOutExtension(Spatial)

print The Spatial Analyst Extension is + arcpy.CheckExtension(Spatial)

raster1 = arcpy.sa.Spline(DD1, 'OutputDrawdown_Drawdown', 1000,

REGULARIZED, .1)

print arcpy.gp.GetMessages()

arcpy.sa.Contour(raster1, DL1, interval)

print arcpy.gp.GetMessages()

arcpy.MakeFeatureLayer_management(DL1, Drawdown Layer 1)

arcpy.ApplySymbologyFromLayer_management(Drawdown Layer 1, DrawdownSym)

arcpy.LayerToKML_conversion(Drawdown Layer 1, KMZ1, 1)

# Layer 2------------------------------------------------------------

arcpy.gp.CreateMODFLOWFeatures_mytools(Node2D,

OutputDrawdown,

'Drawdown',

Basic,

BasicArrayMult,

CellIndex,

DISVars,

DD2,

,

2)

print arcpy.gp.GetMessages()

raster2 = arcpy.sa.Spline(DD2, 'OutputDrawdown_Drawdown', 1000,

REGULARIZED, .1)

print arcpy.gp.GetMessages()

arcpy.sa.Contour(raster2, DL2, interval)

arcpy.AddField_management(DL2, feet, DOUBLE)

arcpy.CalculateField_management(DL2, feet, '[Contour]')

print arcpy.gp.GetMessages()

arcpy.MakeFeatureLayer_management(DL2, Drawdown Layer 2)

arcpy.ApplySymbologyFromLayer_management(Drawdown Layer 2, DrawdownSym)

arcpy.LayerToKML_conversion(Drawdown Layer 2, KMZ2, 1)

# Layer 3-----------------------------------------------------------

arcpy.gp.CreateMODFLOWFeatures_mytools(Node2D,

OutputDrawdown,

'Drawdown',

Basic,

BasicArrayMult,

CellIndex,

DISVars,

DD3,

,

3)

print arcpy.gp.GetMessages()

raster3 = arcpy.sa.Spline(DD3, 'OutputDrawdown_Drawdown', 1000,

REGULARIZED, .1)

print arcpy.gp.GetMessages()

arcpy.sa.Contour(raster3, DL3, interval)

arcpy.AddField_management(DL3, feet, DOUBLE)

arcpy.CalculateField_management(DL3, feet, '[Contour]')

Page 60: Web-Based Automated Well Permitting

48

print arcpy.gp.GetMessages()

arcpy.MakeFeatureLayer_management(DL3, Drawdown Layer 3)

arcpy.ApplySymbologyFromLayer_management(Drawdown Layer 3, DrawdownSym)

arcpy.LayerToKML_conversion(Drawdown Layer 3, KMZ3, 1)

# Exporting Files to KML

arcpy.mapping.ExportToPDF(mxd1, pdf1)

arcpy.mapping.ExportToPDF(mxd2, pdf2)

arcpy.mapping.ExportToPDF(mxd3, pdf3)


Recommended