Term Project Outline
Sub-document 4

CE 397 GIS in Water Resources
The University of Texas at Austin

Evaluating migration potential of contaminants through unsaturated subsurface in Texas
Draft: Statistically defined groundwater vulnerability -
Binomial Statistics on Groundwater Nitrate Concentration Database

by Yosuke Kimura
at http://www.ce.utexas.edu/stu/kimuray/gis/twdb-bino.html
Last updated on April 25, 1997


This is a draft for documenting the use of scripts for Tom's analysis of historic data of nitrate concentration in groundwater.

As a part of Tom Evans' dissertation work, He analyzed nitrate concentration data provided by Texas Water Development Board with binomial statistics. He left CD-ROM which contain most of his files used for his study in addition to the written dissertation. The CD-ROM includes both the data file and source codes.

His analysis was repeated here using the data he left. The source files (C, FORTRAN, AML), found either in the CD-ROM or the written text, were modified if necessary. Thirteen source files (including one compressed file of many "include" files) were verified to work as Tom did, provided with the two data files.


1. Getting necessary files

Here is the list of all files you need. You can download all of these files from http://www.ce.utexas.edu/stu/kimuray/gis/download/.
$ls -1
BINO2.F
NITRATE.TXT
TEST_QUD.C
TX7M.C
WELLS.TXT
bino_quad.aml
build_quads7.aml
compile.ksh
conv-nit.aml
count_quad.aml
include.aml
nit-import.aml
prep_quad.aml
scdflib-1.0.tar.Z
twdb-import.aml
$

All except scdflib-1.0.tar.Z are ascii text file. Two files with TXT extension hold the data provided by TWDB. Twelve files with extensions of F, C, aml and ksh are source codes written in either FORTRAN, C, AML or Korn shell. The Z compressed file holds all of FORTRAN codes needed to compile BINO2.F.

"Tom:" means Tom's CD-ROM, and p. ??? shows pages on Tom's written dissertation. If a code was found only on document, not on CD-ROM, the code is scanned.

Though the Tom's CD-ROM provided additional FORTRAN code for binomial statistics (Tom:\SOURCES\BINO\SRC\*.F), they didn't work well for some reasons (upper/lower case problem?). So the source code was downloaded from the original site, which is Department of Biomathematics at The University of Texas M. D. Anderson Cancer Center in Houston, Texas. URL of the file is "ftp://odin.mdacc.tmc.edu/pub/source/scdflib-1.0.tar.Z"

2. Uncompress the .Z file

Two more tasks to be done before we start ArcInfo. First is to decompress the compressed file. It can be done with following command on UNIX shell.

$mkdir scdf
$cd scdf
$ftp odin.mdacc.tmc.edu
Connected to odin.mdacc.tmc.edu.
220 odin.mdacc.tmc.edu FTP server (OSF/1 Version 5.60) ready.
Name (odin.mdacc.tmc.edu:kimuray): anonymous

...

ftp> bye
221 Goodbye.
$uncompress *.Z
$tar xvf *.tar
$cd ..
$ln -s scdf/src src
$

3. Compile FORTRAN and C codes

The Korn shell script will do this.

$chmod u+x compile.ksh
$compile.ksh
$

There were two warning messages you can ignore. Now the working directory should have following files.

$ls
BINO2.F            bino2*             count_quad.aml     src@
NITRATE.TXT        bino_quad.aml      include.aml        test_quad*
TEST_QUD.C         build_quads7.aml   nit-import.aml     twdb-import.aml
TX7M.C             compile.ksh*       prep_quad.aml      tx7m*
WELLS.TXT          conv-nit.aml       scdf/
$

The source codes are no longer needed, so you can delete them.

$rm -r *.C *.F *.ksh scdf src
$ls
NITRATE.TXT        build_quads7.aml   nit-import.aml     tx7m*
WELLS.TXT          conv-nit.aml       prep_quad.aml
bino2*             count_quad.aml     test_quad*
bino_quad.aml      include.aml        twdb-import.aml
$

Now things are ready to start ArcInfo.

4. Start ArcInfo

Invoke ArcInfo from UNIX shell. Then make the current directory an ArcInfo workspace.

$arc
Arc: createworkspace ~/test
Arc: 

5. Import the data into Info files

Run two AML files, twdb-import.aml and nit-import.aml.

Arc: &r twdb-import
Arc: &r nit-import
Arc: dir info
 TYPE NAME                            INTERNAL NAME    NO. RECS LENGTH EXTERNL
------------------------------------------------------------------------------
  DF  TWDB_WELLS.DAT                    ARC0000DAT       38740      58
  DF  TWDB_WELLS.NIT                    ARC0001DAT       62692      26
Arc: 

6. Choose records to be included

Based on several criteria Tom came up with, each record is examined if it will be included for further analysis. Part of this task has already been done with twdb-import.aml, based on well location. An AML file include.aml completes the selection with nitrate concentration data, and create two new Info files INCLUDE.WELLS and INCLUDE.NIT. It took 40 minutes to complete this script!

Arc: &r include
Arc: dir info
 TYPE NAME                            INTERNAL NAME    NO. RECS LENGTH EXTERNL
------------------------------------------------------------------------------
  DF  TWDB_WELLS.DAT                    ARC0000DAT       38740      60
  DF  TWDB_WELLS.NIT                    ARC0001DAT       62692      28
  DF  INCLUDE.NIT                       ARC0002DAT       46507      28
  DF  INCLUDE.WELLS                     ARC0003DAT       29255      60
Arc: 

7. Convert the basis of nitrate concentration to nitrogen

Concentration of nitrate in the original data file has basis on the mass of nitrate. The value is converted to nitrogen basis. Run an AML file conv-nit.aml, which creates new item nit_adj in INCLUDE.NIT.

Arc: &r conv-nit
Arc: dir info
 TYPE NAME                            INTERNAL NAME    NO. RECS LENGTH EXTERNL
------------------------------------------------------------------------------
  DF  TWDB_WELLS.DAT                    ARC0000DAT       38740      60
  DF  TWDB_WELLS.NIT                    ARC0001DAT       62692      28
  DF  INCLUDE.NIT                       ARC0002DAT       46507      36
  DF  INCLUDE.WELLS                     ARC0003DAT       29255      60
Arc:

8. Generate quadrangle polygon coverage.

Run AML file build_quad7.aml to generate a polygon coverage corresponding to 7.5 minutes quadrangles.

Arc: &r build_quads7
Arc: dir info
 TYPE NAME                            INTERNAL NAME    NO. RECS LENGTH EXTERNL
------------------------------------------------------------------------------
  DF  TWDB_WELLS.DAT                    ARC0000DAT       38740      60
  DF  TWDB_WELLS.NIT                    ARC0001DAT       62692      28
  DF  INCLUDE.NIT                       ARC0002DAT       46507      36
  DF  INCLUDE.WELLS                     ARC0003DAT       29255      60
  DF  TWDB_7M.TIC                       ARC0004DAT           4      20    XX
  DF  TWDB_7M.BND                       ARC0005DAT           1      32    XX
  DF  TWDB_7M.PAT                       ARC0007DAT        5697      28    XX
 Arc: 

9. Redefine items for quadrangles in which wells are located

Before statistical analysis are carried out, We should identify the quadrangle in which a record of two INCLUDE.* Info files belongs. That was accomplished by prep-quad.aml. See how the lists of items in two include files are changed.

Arc: tables
Enter Command: sel include.nit
Enter Command: it

COLUMN   ITEM NAME        WIDTH OUTPUT  TYPE N.DEC  ALTERNATE NAME     INDEXED?
    1  WELLNO                 7     7     I      -                        -
    8  MM_DATE                2     2     B      -                        -
   10  DD_DATE                2     2     B      -                        -
   12  YY_DATE                2     4     B      -                        -
   14  RELIABILITY_REM        2     2     C      -                        -
   16  COLLECT_AGENCY         2     2     C      -                        -
   18  Q71850_FLAG            1     1     C      -                        -
   19  Q71850_NITRATE         8     9     F      2                        -
   27  INCLUDE                1     1     C      -                        -
   28  NIT_ADJ                8     9     F      2                        -


Enter Command: q
Arc: &r prep_quad
Arc: tables
Enter Command: sel include.nit
Enter Command: it

COLUMN   ITEM NAME        WIDTH OUTPUT  TYPE N.DEC  ALTERNATE NAME     INDEXED?
    1  WELLNO                 7     7     I      -                        -
    8  MM_DATE                2     2     B      -                        -
   10  DD_DATE                2     2     B      -                        -
   12  YY_DATE                2     4     B      -                        -
   14  RELIABILITY_REM        2     2     C      -                        -
   16  COLLECT_AGENCY         2     2     C      -                        -
   18  Q71850_FLAG            1     1     C      -                        -
   19  Q71850_NITRATE         8     9     F      2                        -
   27  INCLUDE                1     1     C      -                        -
   28  NIT_ADJ                8     9     F      2                        -
     **  REDEFINED ITEMS  **
    1  QUAD_2.5M              5     5     I      -                        -
    1  QUAD_7.5M              4     4     I      -                        -
    1  QUAD_1D                2     2     I      -                        -


Enter Command: q
Arc: 

10. Count number of measurements in quadrangles

Now it's ready to count number of nitrate measurements exceeding the criteria (0.1, 1, 5 and 10 mgN/L) in each quadrangle. An AML file count_quad.aml does this. Computations for this script took 20 minutes to complete!

Arc: &r count_quad
Arc: 

11. Calculate lower and upper limit of excedence probability

Finally binomial statistics are applied to each quadrangle. An AML file binom.aml will do this. The script has a "&do i := 1 &to 4 ... &end" loop, which carries out binomial statistic of each records with four different criteria.

Arc: &r bino_quad
Arc: 

12. View the result in ArcView

Yet to be done...


Last updated on April 25, 1997
Comment to: yosuke kimura
Go to Dr. Maidment, Dept. of Civil Engr., or UT Austin Homepage