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.
$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
.
file used | origin of file |
---|---|
NITRATE.TXT |
Tom:\TWDB\TEXT\NITRATE.TXT |
TEST_QUD.C |
Tom:\SOURCES\QUADS\TEST_QUD.C |
TX7M.C |
Tom:\SOURCES\QUADS\TX7M.C |
WELLS.TXT |
Tom:\TWDB\TEXT\WELLS.TXT |
file used | origin of file |
---|---|
BINO2.F |
Tom:\SOURCES\QUADS\TEST_QUD.C |
bino_quad.aml |
p. 345 |
build_quads7.aml |
p. 329 |
count_quad.aml |
p. 332 |
include.aml |
p. 319 |
twdb-import.aml |
p. 315 (test_quad.aml ) |
file used |
---|
compile.ksh |
conv-nit.aml |
nit-import.aml |
prep_quad.aml |
file used | origin of file |
---|---|
scdflib-1.0.tar.Z |
ftp://odin.mdacc.tmc.edu/pub/source/ |
"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
"
.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 $
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
.
ArcInfo
Invoke ArcInfo
from UNIX
shell. Then make the current directory an ArcInfo
workspace.
$arc Arc: createworkspace ~/test Arc:
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:
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:
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:
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:
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:
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:
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:
Yet to be done...