United States	Environmental Monitoring	EPA/600/8-90/048
Environmental Protection	Systems Laboratory	April 1990
Agency	P 0. Box 93478
Las Vegas NV 89193-3478
Research and Development
v>EPA GEO-EAS
(Geostatistical
Environmental
Assessment Software)
Programmers Guide

-------
EPA 600/8-90/048
April 1990
GEO-EAS
(GEOSTATISTICAL ENVIRONMENTAL ASSESSMENT SOFTWARE)
PROGRAMMER'S GUIDE
Prepared for
Exposure Assessment Research Division
U.S. Environmental Protection Agency
Environmental Monitoring Systems Laboratory
Las Vegas, Nevada 89193-3478
Prepared by
Computer Sciences Corporation
4220 S. Maryland Parkvay
La Plaza, Bldg. B, Suite 408
Las Vegas, Nevada 89119
Under EPA Contract No. 69-01-7365
April 1990

-------
NOTICE
The information in this document has been funded vholly or in part by the
United States Environmental Protection Agency under Contract #68-01-7325 to
Computer Sciences Corporation. It has been subjected to the Agency's peer and
administrative review, and it has been approved for publication as an EPA
document. Mention of trade names or commercial products does not constitute
endorsement or recommendation for use.
Geo-EAS Programmer's Guide
Contents-ii
April 1990

-------
DISCLAIMER
Geo-EAS software and documentation are provided "as is" without guarantee or
warranty of any kind, expressed or implied. The Environmental Monitoring
Systems Laboratory, U.S. Environmental Protection Agency, Las Vegas, NV, and
Computer Sciences Corporation will not be liable for any damages, losses, or
claims consequent to use of this software or documentation.
Geo-EAS Programmer's Guide
Contents-iii
April 1990

-------
TABLE OF CONTENTS
1.	INTRODUCTION	1-1
1.1	Summary overview 		1-1
1.2	History. . . 		1-1
1.3	Document Organization	1-1
1.4	Future Plans	1-2
2.	SYSTEM OVERVIEW	2-1
2.1	Software Environment 		2-1
2.2	Hardware Environment 		2-1
2.3	File Directories	2-1
2.4	System Summary	2-2
2.4.1	Summary of System Components	2-2
2.4.2	System Structure	2-3
2.4.3	System Data Flow	2-3
2.4.4	Screen/Menu Management	2-3
2.5	System Files	2-4
2.5.1	File Naming Conventions	2-4
2.5.2	The Geo-EAS Data Files	2-5
2.5.3	The System Defaults File	2-6
2.5.4	NCAR Metacode Files	2-7
2.5.5	Parameter Files	2-7
2.5.6	HPGL Plot Instruction Files	2-7
2.5.7	The Hershy.bar Character Font File	2-7
2.5.8	Screen Definition Files 		2-8
2.6	Common System Utilities	2-8
2.6.1	Screen Management Utilities 	 2-8
2.6.2	NCAR Graphics Utilities	2-8
2.6.2.1	NCAR System Plot Package	2-8
2.6.2.2	AUTOGRAPH Utilities	2-9
2.6.3	The GRAFLIB Graphics Utilities	2-9
2.6.4	Common System Subroutines 		2-9
2.6.4.1	Grafinit 		2-9
2.6.4.2	Read Header Data	2-9
2.6.4.3	Read/Write System Defaults 	 2-9
2.6.4.4	View	2-10
2.6.4.5	UTILE.LIB	2-14
2.6.5	Hershey Character Plotting Utilities	2-15
2.6.6	HPLIB Plotter Utilities 	 2-15
3.	PROGRAM DESCRIPTIONS 	 3.0-1
3.0 GeoEas	3.0-1
3.0.1	Software Function 		3.0-1
3.0.2	Global Variables/Program Limits 		3.0-1
3.0.3	User Interface	3.0-1
Geo-EAS Programmer's Guide	Contents-iv	April 1990

-------
Contents (continued)
3.0.4 Processing	3.0-2
3.0.5 Subroutine Structure	3.0-2
3.0.6 Subroutine Descriptions 		3.0-3
3.1	Dataprep	3.1-1
3.1.1	Software Function 		3.1-1
3.1.2	Global Variables/Program Limits 		3.1-1
3.1.3	Data Flow and Processing	3.1-5
3.1.4	User Interface	3.1-6
3.1.5	Processing			3.1-11
3.1.6	The Outputs	3.1-14
3.1.7	Subroutine Structure	3.1-15
3.1.8	Subroutine Descriptions 		3.1-24
3.2	Trans	3.2-1
3.2.1	Software Function 		3.2-1
3.2.2	Global Variables/Program Limits 		3.2-1
3.2.3	Data Flow and Processing	3.2-4
3.2.4	User Interface	3.2-5
3.2.5	Processing	3.2-8
3.2.6	The Outputs			3.2-11
3.2.7	Subroutine Structure	3.2-12
3.2.8	Subroutine Descriptions 		3.2-15
3.3	STAT1	3.3-1
3.3.1	Software Function 		3.3-1
3.3.2	Global Variables/Program Limits 		3.3-1
3.3.3	Data Flow and Processing	3.3-5
3.3.4	User Interface	3.3-6
3.3.5	Processing	3.3-8
3.3.6	The Outputs	3.3-9
3.3.7	Subroutine Structure	3.3-11
3.3.8	Subroutine Descriptions 		3.3-14
3.4	Scatter	3.4-1
3.4.1	Software Function 		3.4-1
3.4.2	Global Variables/Program Limits 		3.4-1
3.4.3	Data Flow and Processing	3.4-3
3.4.4	User Interface	3.4-4
3.4.5	Processing	3.4-5
3.4.6	The Outputs	3.4-5
3.4.7	Subroutine Structure	3.4-5
3.4.8	Subroutine Descriptions 		3.4-6
3.5	Prevar	3.5-1
3.5.1	Software Function 		3.5-1
3.5.2	Global Variables/Program Limits 		3.5-1
3.5.3	Data Flow and Processing	3.5-3
3.5.4	User Interface	3.5-4
3.5.5	Processing	3.5-5
3.5.6	The Outputs	3.5-6
3.5.7	Subroutine Structure	3.5-6
3.5.8	Subroutine Descriptions 		3.5-6
3.6	Vario	3.6-1
3.6.1 Software Function 		3.6-1
Geo-EAS Programmer's Guide	Contents-v April 1990

-------
Contents (continued)
3.6.2	Global Variables/Program Limits 	 3.6-1
3.6.3	Data Flov	3.6-6
3.6.A User Interface	3.6-7
3.6.5	Processing	3.6-9
3.6.6	Outputs 	 3.6-12
3.6.7	Subroutine Structure	3.6-14
3.6.8	Subroutine Descriptions 	 3.6-16
3.7	Xvalid	3.7-1
3.7.1	Software Function 	 3.7-1
3.7.2	Global Variables/Program Limits 	 3.7-1
3.7.3	Data Flow	3.7-6
3.7.4	User Interface	3.7-7
3.7.5	Processing	3.7-9
3.7.6	Outputs 	 3.7-10
3.7.7	Subroutine Structure	3.7-13
3.7.8	Subroutine Descriptions 	 3.7-15
3.8	Krige	3.8-1
3.8.1	Software Function 	 3.8-1
3.8.2	Global Variables/Program Limits 	 3.8-1
3.8.3	Data Flow	3.8-7
3.8.4	User Interface	3.8-8
3.8.5	Processing	3.8-11
3.8.6	Outputs 	 3.8-13
3.8.7	Subroutine Structure	3.8-14
3.8.8	Subroutine Descriptions 	 3.8-16
3.9	Postplot	3.9-1
3.9.1	Software Function 	 3.9-1
3.9.2	Global Variables/Program Limits 	 3.9-1
3.9.3	Data Flow and Processing	3.9-4
3.9.A User Interface	3.9-5
3.9.5	Processing	3.9-7
3.9.6	The Outputs	3.9-8
3.9.7	Subroutine Structure	3.9-8
3.9.8	Subroutine Descriptions 	 3.9-10
3.10	Xygraph	3.10-1
3.10.1	Software Function 	 3.10-1
3.10.2	Global Variables/Program Limits 	 3.10-1
3.10.3	Data Flow and Processing	3.10-5
3.10.4	User Interface	3.10-6
3.10.5	Processing	3.10-9
3.10.6	The Outputs 	 3.10-10
3.10.7	Subroutine Structure	3.10-10
3.10.8	Subroutine Descriptions 	 3.10-13
3.11	Conrec 	 3.11-1
3.11.1	Software Function 	 3.11-1
3.11.2	Global Variables/Program Limits 	 3.11-1
3.11.3	Data Flow	3.11-4
3.11.4	User Interface	3.11-5
3.11.5	Processing	3.11-8
3.11.6	Outputs 	 3.11-9
Geo-EAS Programmer's Guide	Contents-vi	April 1990

-------
Contents (continued)
3.11.7	Subroutine Structure	3.11-10
3.11.8	Subroutine Descriptions 		3.11-12
3.12	View	3.12-1
3.12.1	Software Function 		3.12-1
3.12.2	Global Variables/Program Limits 		3.12-1
3.12.3	Data Flow and Processing	3.12-2
3.12.4	User Interface	3.12-3
3.12.5	Processing	3.12-3
3.12.6	The Outputs 		3.12-4
3.12.7	Subroutine Structure	3.12-4
3.12.8	Subroutine Descriptions 		3.12-4
3.13	Hpplot 		3.13-1
3.13.1	Software Function 		3.13-1
3.13.2	Global Variables/Program Limits 		3.13-1
3.13.3	Data Flow and Processing	3.13-2
3.13.4	User Interface	3.13-3
3.13.5	Processing	3.13-4
3.13.6	The Outputs 		3.13-4
3.13.7	Subroutine Structure	3.13-4
3.13.8	Subroutine Descriptions 		3.13-6
4. SYSTEM MAINTENANCE PROCEDURES	4-1
4.1	Compiling and Linking	4-1
4.2	CodeView	4-2
4.3	Screen Definition Files	4-2
4.4	Making a Block Data Screen Subprogram	4-3
4.5	NCAR Test Programs	4-3
4.5.1	System Plot Package Test Programs	4-3
4.5.2	Autograph Test Programs	4-4
4.6	Hershey Character Plotting - Test Programs 	 4-5
Appendix A - NCAR DOCUMENTATION
NCAR System Plot Package
AUTOGRAPH Documentation
Appendix B - GRAFLIB Subroutine Descriptions
Appendix C - Screen Access Management (SAM) Utilities User Guide
Geo-EAS Programmer's Guide
Contents-vii
April 1990

-------
SECTION 1
INTRODUCTION
1.1	SUMMARY OVERVIEW
Geo-EAS (Geostatistical Environmental Assessment Software) is a collection of
interactive software programs for performing two-dimensional geostatistical
analyses of spatially distributed data. The programs were written in FORTRAN.
Some lower-level utilities were written in INTEL 8086 Assembly language, and
the C programming language. Programs are provided for data file management,
data transformations, univariate statistics, variogram analysis, cross
validation, kriging, contour mapping, post plots, and line or scatter graphs.
A full-screen menu-driven user interface is used to specify or change program
parameters. Graphics displays are produced by many of the programs.
1.2	HISTORY
As part of a cooperative agreement between Andre Journel of Stanford
University and the Exposure Assessment Research Division of the EPA EMSL of
Las Vegas, the use of various geostatistical methods in assessing environ-
mental pollutants were investigated. Through these studies, a need was
defined for a set of microcomputer-based programs which a practitioner of
geostatistics could use easily with little computer knowledge or background.
Preliminary design work for the system began in August of 1986. Several goals
for the system design were defined at this time, which included ease of use
through use of menus and full-screen interaction, interactive color graphics
displays, portability to mini or mainframe computer environments, and the
capability to disseminate the completed software into the public domain. The
original programs were modeled after a similar PC- based system developed by
Roland Froidevaux of FSS international (an associate of Stanford University)
which was written in Turbo Pascal. The original programs were later modified
extensively after preliminary review. Several additional programs were
developed during the period from 10/87 to 4/88 to enhance the graphics
capability of the system, and to provide data management utilities. The
graphics programs were developed using public domain graphics utilities
developed at the National Center for Atmospheric Research (NCAR) in Boulder,
Colorado, which were rehosted on an IBM AT.
1.3	DOCUMENT ORGANIZATION
This document is intended for use by analysts or programmers when performing
maintenance, or enhancements to the system. It may also be used as a
reference when attempting to transport the system to a non-IBM PC environment.
As nearly as practicable, EPA documentation standards were followed as
described in the ADP system documentation standards, January, 1986.
Geo-EAS Programmer's Guide
1-1
April 1990

-------
1.4	FUTURE PLANS
Tentative plans have been made to add a second group of programs to the system
during the period beginning 1/89. These programs will be designed using the
same development tools and user interface concepts.
Geo-EAS Programmer's Guide
1-2
April 1990

-------
SECTION 2
SYSTEM OVERVIEW
2.1	SOFTWARE ENVIRONMENT
The programs described in this document were developed using the Microsoft
FORTRAN and C compilers (Version A.01), and the Microsoft Assembler (4.0),
running under DOS 3.1. The Microsoft Overlay Linker version 3.5 was used to
link the programs. The low-level graphics was done using the GRAFLIB Graphics
utilities developed by the Librarian, Inc. With the exception of the GRAFLIB
subroutine calls and the FORTRAN and C library references, all other source
code is in the public domain and is provided in the appendices.
2.2	HARDWARE ENVIRONMENT
The Geo-EAS system was designed to run under DOS 2.1 on a IBM PC, or compati-
ble microcomputer. The programs will do floating point emulation when an
arithmetic coprocessor is unavailable, but perform much more efficiently in
the presence of an INTEL 8087, or 80287 coprocessor. Although a hard disk is
not required for use of individual programs, it is highly recommended. A
twenty megabyte hard disk (or better) IS required for modification or
enhancement of the system. Approximately eighteen megabytes of hard disk
storage are required for all source, object, library, and executable files in
the system. A CGA, EGA, or Hercules graphics card is required to produce
graphics displays. An IBM Graphics printer (or compatible) is required to
obtain hardcopy of text or graphics displays.
2.3	FILE DIRECTORIES
This section describes the subdirectory structure for the Geo-EAS system
development environment:
The FORTRAN compiler and associated libraries are located in the C:\MSF0RT
subdirectory.
The proprietary GRAFLIB Graphics library are located in the C:\GRAFLIB
subdirectory.
The C:\GE0EAS\ subdirectory contains a working version of the system,
including the executables, example data files, informational files and
utilities for creating working system distribution diskettes.
The C:\GE0EAS.0BJ\ subdirectory contains subdirectories for each program which
contain the object files for the program. This allows a backup to be made of
Geo-EAS Programmer's Guide
2-1
April 1990

-------
source without including object files. The following is a list of all
subdirectories under C:\GE0EAS and a general description of the contents:
C:\GEOEAS
-p DATA
\- GEOEAS
|- DATAPREP
|- TRANS
f- STATS
|- SCATTER
)- PREVAR
|- VARIO
[- XVALID
|- KRIGE
|- CONREC
POSTPLOT
|- XYGRAPH
|- VIEW
|- HPPLOT
|- SCREEN
|- HERSHY
[- NCAR
[- GRAFLIB
L VSTATS
Test and example data files
GEOEAS system menu source files
DATAPREP source files
TRANS source files
STAT1 source files
SCATTER source files
PREVAR source files
VARIO source files
XVALID source files
KRIGE source files
CONREC source files
POSTPLOT source files
XYGRAPH source files
VIEW source files
HPPLOT source files
Screen management utilities
Hershey character plotting utilities
NCAR graphics utilities
Description of GRAFLIB graphics utilities
Video status subroutine (C)
C:\GEOEASA 	1- USERDOC - User documentation and figures
L PMM	- Programmer maintenance documentation
2.4	SYSTEM SUMMARY
2.4.1 Summary of System Components
The following is a list of system programs and a brief description of their
function:
GEOEAS.EXE
DATAPREP.EXE
TRANS.EXE
STAT1.EXE
SCATTER.EXE
PREVAR.EXE
VARIO.EXE
XVALID.EXE
KRIGE.EXE
CONREC.EXE
POSTPLOT.EXE
XYGRAPH.EXE
VIEW.EXE
HPPLOT.EXE
-	the system menu program
-	data management utilities
-	data transformations
-	basic univariate descriptive statistics
-	quick and dirty scatter plots
-	pair comparison computations for VARIO
-	variogram analysis and modeling
-	cross validation of parameters for KRIGE
-	2-dimensional kriging
-	contouring of gridded data
-	graphs of sample locations and values
-	2-dimensional line/scatter graphs
-	plots graph files on the screen
-	creates plotter files from graphic
metafiles
Geo-EAS Programmer's Guide
2-2
April 1990

-------
2.4.2
System Structure
The Geo-EAS system is designed to be operated from the system menu (program
GEOEAS.EXE). The system menu allows selection of programs from a tabular
menu. A brief description of each program is displayed at the bottom of the
system menu screen. The system menu program performs a DOS system call to
execute the desired program. When the program is terminated, control is
returned to the system menu program. The following diagram shows the
hierarchy of system components:
GEOEAS
- DATAPREP
- STAT1
- PREVAR
- XVALID
L TRANS
1- SCATTER
L VARIO
L KRIGE
CONREC
Data
Univariate
Variogram
Cross-
Report-
Management
ft Bivariate
Analysis
Validation
Quali ty
Utilities
Statistics

& Kriging
Graphics
2.4.3	System Data Flow
Data used by programs within the system are stored in Geo-EAS data files. The
format of these files will be described later in this section. Each program
has an input parameter called the FILE PREFIX which is used to specify the
location of files to be read by the program. The FILE PREFIX and the DATA
FILE NAME are used by the programs to access the data file. This information
is communicated between programs by storing the FILE PREFIX and DATA FILE NAME
in a special file called the system defaults file, named 'GEOEAS.DEF'. When
a program is initiated it reads this information from the system defaults
file, and when it is terminated it writes the current names to this file.
This is the only information that is shared between programs. If this file
does not exist, then the names must be entered by the user. If this file does
not exist when a program is initiated, it will be created at program
termination.
2.4.4	Screen/Menu Management
The user interface for Geo-EAS programs is comprised of a hierarchy of one or
more screens, each of which contains one or more menus. The menu provides a
list of options which either give access to additional screens or menus, or a
group of one or more input parameters to control program operation. Use of
the screens and menus is documented in the Geo-EAS User's Guide. The manage-
ment of the screens and menus is accomplished through subroutine calls to a
screen management utilities library, called the SAM (Screen Access Manage-
ment) utilities. These utilities provide FORTRAN-callable subroutines to
display and manage screen and menu interaction. The SAM utilities allow a
programmer to build a "screen definition file", which contains information
Geo-EAS Programmer's Guide
2-3
April 1990

-------
about the hierarchy of screens and menus for an application. During develop-
ment of a user interface, the programmer may make changes to the screen
definition file without having to recompile the program. Later, when the
program has been completed, the screen definition file contents may be
converted to a FORTRAN BLOCK DATA subprogram by a utility called BLOCKDAT for
linking into the program. Refer to the screen definition (.scr)
file, and the SAM Users Guide (Appendix C) for more information about the
screen management utilities.
2.5	SYSTEM FILES
2.5.1 File Naming Conventions
Conventions have been established for certain types of files used by Geo-EAS
programs. The following are the 3-character file extension for files accessed
by the programs:
.TXT - an ASCII taxt file
•DAT - a Geo-EAS data file.
.PCF - a pair comparison file, created by PREVAR, read by VARIO
•	GRD - a gridded Geo-EAS data file (could be produced by KRIGE)
.CPF - CONREC parameter file
.KPF - KRIGE parameter file
•	XPF - XYGRAPH parameter file
.POL - Polygon boundary file, used by KRIGE
•MET - metacode (graph) file, created by CONREC, POSTPLOT, and
XYGRAPH, and used by HPPLOT, and VIEW.
.PLT - plotter instruction file, produced by HPPLOT
GEOEAS.DEF - the system defaults file
HERSHY.BAR - the hershey character set file
The following file name conventions are used for files within the source code
subdirectories:
FILES.DOC - a file containing the names and contents of all program source
files
SCREEN.STR - the global variables used by the SAM utilities
COMPIL.BAT - a DOS command file to compile the source code for the program
FORALL.BAT - a DOS command file to compile the source code for the program
L.BAT - a DOS command file to link the object code and libraries for the
program
.MAK - the file of commands for the MAKE program maintenance utility
.LNK - the linker command file for linking the program
.DEC - the file of global variable declarations for the program
<* >.FOR - FORTRAN source files
.EXE - The executable for the program
.TRE - A file containing the program subroutine calling structure
< * >.LIB - a 1ibrary
<* >.DOC - document files
Geo-EAS Programmer's Guide
2-4
April 1990

-------
Utility Command files: The following are utility command
files in C:\GE0EAS
BUILD .BAT -	to create .EXE disks for high density media
BUILD360.BAT -	"	for 360KB media
BUILD720.BAT -	"	for 720KB media
DISK1 .BAT -	creates diskl for high density media
DISK2 .BAT -	creates Disk2 for "
DISK3 .BAT -	creates disk3 for "
MAKALL .BAT -	calls MAKE to recompile all programs
LINKALL .BAT -	calls the linker to re-link all programs
Information	Files: The following are additional informative
files in C:\GE0EAS:
READ.ME - an ASCII file of additional "last-minute" information not in the
User Guide - included in EXE distribution.
SOURCE.TRE - an ASCII file describing the source distribution subdirectory
structure, and "last-minute" information not included in the
Programmer Maintenance manual.
2.5.2 The Geo-EAS Data Files
All programs in the system use a common format for data files. Geo-EAS data
files are simple ASCII text files which may be created with any text editor.
Below is an explanation of the data file format.
Line 1 - Title
This line is a descriptive title which may contain up to 80 characters. Most
programs display the title on the screen when the file is read into memory.
Some programs will use the title as the default title for graphics screens.
Line 2 - Number of Variables (NVAR)
This line tells the programs how many variables are in the data file. The
data are stored in rows and columns, where each column contains a different
variable, or measured quantity, and each row represents a different sample
location, time, etc. The data file may hold up to 48 variables (columns).
Different programs have different limits on the number of samples (rows) which
can be read. Typically, up to 1000 samples may be read. If a program
encounters more than its limit of samples, the remaining samples will not be
read into memory, and will not be used for computation.
Line 3 to NVAR+2 - Variable Names and Measurement Units
The lines following the number of variables must contain the names and the
measurement units for each variable (1 line per variable). The variable name
must be the first 10 characters in the line, and the units (optional) must be
characters 11-20. When a data file is accessed by a program, the variable
names are stored into toggle fields. This allows one to select variables by
Geo-EAS Programmer's Guide	2-5	April 1990

-------
name, and provides some internal documentation of data file contents.
Variable names will be used as default labels for graph axes in graphic
displays.
Line NVAR+3 To End of File - the Data Matrix
This is where the data are stored. Columns represent variables, and rows
represent samples. The data may be in 'free format', which means that in a
given line in the file, variable values must be separated by at least one
space, or a single comma. This implies that the columns need not line up from
row to row. The variable values must be numeric with no embedded blanks. In
many cases, several variables may be present in a data set, but for some
reason a value could not be obtained for a particular variable in a particular
sample. A special value may be given to the variable in this sample which
will indicate to a program that the value is missing, so that it will not be
used in calculations. The special value reserved for this is 1.E31. This is
'scientific notation' for a 1 followed by 31 zeros. If your data set has
missing values, be sure to type a 1.E31 where the real value would have
appeared. Below is a portion of the file Example.dat. It contains 5 vari-
ables and 60 samples.
Example.dat - Geostatistical Environmental Assessment Software
5
Easting
feet



Northing
feet



Arsenic
pprn



Cadmium
ppm



Lead
ppm



288.0
311.0
.850
11.5
18.25
285.6
288.0
.630
8.50
30.25
273.6
269.0
1.02
7.00
20.00
280.8
249.0
1.02
10.7
19.25
273.6
231.0
1.01
11.2
151.5
276.0
206.0
1.47
11.6
37.50
292.8
137.0
.360
5.20
10.00
2.5.3 The System Defaults File
The System Defaults File is used to transfer the most currently used File
Prefix and File Name between programs. The name of this file is GEOEAS.DEF.
It is accessed when a program is initiated and (if it is present) the File
Prefix and Data File name are loaded into the appropriate screen fields. If
the file is not present the fields will contain blanks. When a program is
terminated the current File Prefix and Data File name are written to
GEOEAS.DEF. If the system defaults file is not available a program will
create one and write this information to it before it terminates. This allows
the user to move around to different applications without re-typing directory
and file names. It is important to note that no application will automati-
cally load data from the data file named in the System Defaults file; the user
Geo-EAS Programmer's Guide
2-6
April 1990

-------
must choose the Data option from the menu before this is done. The following
is a sample System Defaults File.
C:\GEOEAS\DATA\
EXAMPLE.DAT
INTR0=0FF
{ file prefix }
{ data file name }
{ Intro screens are disabled }
2.5.4 NCAR Metacode Files
NCAR metacode files are binary (unformatted) files which contain device-
independent plotting instructions. They are produced by the NCAR graphics
utilities. Programs CONREC, XYGRAPH, and POSTPLOT produce such files.
Programs VIEW, and HPPLOT use these files as input, and translate them into
plotting instructions for a particular graphics device. A metacode file may
contain several graphs. Each graph may be stored in a separate 'frame'. The
above-mentioned programs only produce files with one frame, however programs
VIEW and HPPLOT may read files with multiple frames. For more information
about metacode files, refer to the NCAR System Plot Package User's Guide.
2.5.5	Parameter Files
Parameter files are binary (unformatted) files used by several programs to
store a set of program input parameters. Programs CONREC, KRIGE, and XYGRAPH
create parameter files. The format of a parameter file depends upon the
program which created it. A special signature is written at the beginning of
the parameter file so that each program will know if the file is of the
correct format. For more information about how parameter files are written
refer to the source code for the READ PARAMETERS, and WRITE PARAMETERS
subroutines in one of these programs.
2.5.6	HPGL Plot Instruction Files
HPGL plot instruction files are ASCII files containing HPGL (Hewlett Packard
Graphics Language) plotting instructions. These files are created by program
HPPLOT. Program HPPLOT translates NCAR metacode files into HPGL plotting
instructions and writes them to such a file. The file of this type is
typically sent to a plotter by first redirecting the PC parallel printer port
to the serial port (C0M1:), and using the DOS PRINT command to transmit the
contents of the file to a plotter. The file HPSETUP.BAT contains the
appropriate commands to accomplish this.
2.5.7	The Hershy.bar Character Font File
This file is a direct access binary (unformatted) file which contains the
public domain Hershey character sets. Programs which read or write metacode
files use this file to plot character strings on the display, or to produce an
HPGL plot instruction file. These programs are CONREC, XYGRAPH, POSTPLOT,
VIEW, and HPPLOT. When graph titles or labels are entered into one of these
programs, special font selection codes may be embedded into the character
strings which will instruct the metacode translator to select an alternate
font from HERSHY.BAR. These programs require that the HERSHY.BAR file reside
in the same directory as the executable code, to operate correctly. For more
Geo-EAS Programmer's Guide	2-7	April 1990

-------
information about the format of HERSHY.BAR, refer to the section on the
Hershey Character Plotting Utilities. Several test programs are provided with
the source code which allow one to access this file and extract a character
set.
2.5.8 Screen Definition Files
Screen Definition Files are ASCII text files which contain information about
the screens, menus, labels, and input fields. They are used to develop and
test the user interface for a program. Vhen the user interface is completed
and completely tested, a utility is used to convert the text information into
a block data subprogram, so that this information can be compiled and linked
into the executable code. Prior to this step, the location and contents of
screen labels and menus may be changed without recompiling the user interface
code. This is useful for prototyping and changing the screen appearance
during program development. For more information about the format of a screen
definition file, refer to the SAM User's Guide.
2.6	COMMON SYSTEM UTILITIES
2.6.1	Screen Management Utilities
The SAM (Screen Access Management Utilities) are a set of public domain
FORTRAN-callable subroutines used by all Geo-EAS programs to display and
manage screen interaction. These utilities were developed at the EPA
Environmental Monitoring Systems Laboratory (EMSL) on a VAX 11/785 and re-
hosted on an IBM AT. For more information about the SAM utilities, refer to
the SAM Utilities User's Guide. (Appendix C).
2.6.2	NCAR Graphics Utilities
The NCAR Graphics Utilities were developed at the National Center for
Atmospheric Research (NCAR), in Boulder, Colorado. They are a set of public
domain FORTRAN-callable subroutines to which produce files of device-
independent plotting instructions called metacode files. The software used by
the Geo-EAS programs was first hosted on a Control Data CYBER 173, and later
re-hosted on a VAX 11/785 at the EPA EMSL, Las Vegas. A final re-hosting of
this software to an IBM AT microcomputer was performed so the utilities could
be used by the Geo-EAS programs. The programs CONREC, XYGRAPH, and POSTPLOT
use the NCAR Graphics utilities. These utilities are contained in three
libraries, which will be discussed below.
2.6.2.1 NCAR System Plot Package
The NCAR System Plot Package contains low-level subroutines for writing
binary plot instructions to metacode files. The utilities are contained in
the subdirectory C:\GEOEAS\NCAR\NCARSPP\ in the library NCARSPP.LIB. The
programs CONREC, POSTPLOT, and XYGRAPH use this library of utilities. For
more information about specific use of these subroutines, refer to the NCAR
System Plot Package User's Guide. (Appendix A).
Geo-EAS Programmer's Guide
2-8
April 1990

-------
2.6.2.2 AUTOGRAPH Utilities
The AUTOGRAPH Utilities are a set of FORTRAN-callable subroutines for
producing XY point and line plots. The AUTOGRAPH utilities call the System
Plot Package Library. The utilities are contained in the subdirectory
C:\GEOEAS\NCAR\AUTOGRAP\ in the library AUTOGRPH.LIB. This library is used by
the POSTPLOT and XYGRAPH programs. For more information on the use of these
subroutines, refer to the NCAR AUTOGRAPH Users Guide. (Appendix A).
2.6.3	The GRAFLIB Graphics Utilities
The GRAFLIB graphics utilities are a set of FORTRAN, Assembler and C routines
to plot on CGA, EGA, or Hercules graphics hardware. This software is NOT in
the public domain, and must be purchased from Sutra Software, 10506 Permian
Dr., PO Box 1733, Sugarland, Texas, 77487-1733 (713) 491-2088. This library
resides in the C:\GRAFLIB subdirectory in the GRAFLIB.LIB file. A description
of GRAFLIB subroutines and formal arguments is contained in the ASCII file
GRAFLIB.DOC in the subdirectory C:\GEOEAS\GRAFLIB. This is included in the
source distribution. For more information on GRAFLIB, contact Sutra Software,
or refer to GRAFLIB.DOC. (Appendix B).
2.6.4	Common System Subroutines
Many subroutines used by Geo-EAS programs perform duplicate functions. Some
of these are defined redundantly in the source distribution, or are slightly
different internally. They will be discussed in this section to eliminate
redundancy. The subroutines appear in alphabetical order followed with a
discussion on the Utilities Library.
2.6.4.1	Grafinit
Subroutine GRAFINIT is used by programs which produce graphics to initialize
values of graphics variables. It calls the C function VSTATS to determine the
graphics hardware installed in the computer. Then the appropriate internal
graphics variables and device codes are set. Each program has its own version
of this subroutine.
2.6.4.2	Read Header Data
Subroutine READ HEADER DATA is used to read the "header data" of a Geo-EAS
data file. This includes the title of the data set, and the variable names,
units, and output format (if any) of the variables in the file. Each program
has a slightly different version of this subroutine due to different
functional requirements. They typically initialize the values of screen
fields which contain titles, graph labels, and variable names. Refer to the
program subsection for specific information.
2.6.4.3	Read/Write System Defaults
Subroutines READ SYSTEM DEFAULTS and WRITE SYSTEM DEFAULTS are used by the
programs to read from and write to the System Defaults File. The READ SYSTEM
DEFAULTS subroutine reads the FILE PREFIX, DATA FILE NAME, and the INTRO FLAG
Geo-EAS Programmer's Guide
2-9
April 1990

-------
from the file and sets appropriate program values. The WRITE SYSTEM DEFAULTS
creates the file (if it doesn't exist) and writes the current choices for
these parameters to the file. The exact code will vary slightly from program
to program, so each program has its own copy of the subroutines in its source
subdi rec tory.
2.6.4.4 View
SUBROUTINE VIEW (FILENAME, ERROR, DEVCODE, [TRUE SCALE])
CHARACTER FILENAME^*)
LOGICAL ERROR, TRUE SCALE
INTEGERS DEVCODE
FILENAME - metacode file name (with path)
ERROR	- error flag (.TRUE, if error occurred)
DEVCODE - device code (0=OTHER,1=HERC,2=CGA,3=EGA)
TRUE SCALE - .TRUE. -> use square plot area
.FALSE.-> use entire screen for plotting
Subroutine VIEW reads a metacode file and plots on the screen. It is used by
programs VIEW, CONREC, XYGRAPH, and POSTPLOT to allow interactive viewing and
modification of graphs. The version used by program VIEW uses the TRUE SCALE
variable to force the plot to fit a square instead of a rectangle. The sub-
routine uses DEVCODE to determine how the plot should appear for the 3 sup-
ported graphics adaptors. Refer to the NCAR document "The Graphics System
Implementor's Guide" for more information about metacode format. The
following is a subroutine calling tree for VIEW.
Subroutine calling tree for VIEW
View 	1- SAM
|- HERSHY
|- Ibits
|- Mcinit
r GRAFLIB
I- HERSHY
Get 16
-j- Iword2
L Finish
Grwait
GRAFLIB
|- Four
T Ibits
|- Getl6
-p Iword2
L Finish
L Plot
T GRAFLIB
L HERSHY
|- Two
T Ibits
L Plot
I* GRAFLIB
L HERSHY
L Multl
Ibits
Geo-EAS Programmer's Guide
2-10
April 1990

-------
|- Plotch 	r GRAFLIB
|- HERSHY
f- Ibits
L Getl6 	1- Iword2
L Finish
|- Finish
Grwait 	 GRAFLIB
|- Mcoptlon 	HERSHY
|- Ibits
[- Color
Dash •
Color 	 GRAFLIB
Getl6
yIword2
•-Finish
L Getl6 	1- Iword2
L Finish
L Getl6
Libraries: GRAFLIB
HERSHY
GRAFLIB Graphics Library
Hershey Character Plotting Utilities
Subroutine Descriptions
The following are descriptions of the subroutines which are called by the
version of subroutine VIEW used by programs POSTPLOT, XYGRAPH, VIEW, and
CONREC. For information on the HPPLOT version refer to the HPPLOT subsection.
SUBROUTINE Color (Letter)
Formal Arguments:
Letter - string containing abbreviated color name
Subroutines Called:
Zcolor (GRAFLIB)
This subroutine is part of the metacode translator. It processes the NCAR set
color plot instruction, determines the color to set and calls the GRAFLIB set
color routine.
SUBROUTINE Dash
This metacode translator subroutine is used to set up a dash pattern. Since
dashed line patterns are handled directly by NCARDASH routines, and GRAFLIB
has no dash line capability, this subroutine does nothing.
SUBROUTINE Finish (Istat)
Formal Arguments:
Istat	- completion status code
Geo-EAS Programmer's Guide	2-11	April 1990

-------
Subroutines Called:
GrWait SAM - Beep
This metacode translator routine is called when a nev metacode frame is
reached, or the end of the metacode file is found.
SUBROUTINE Four (Ivord)
Formal Arguments:
Ivord	- first 16-bit word of four byte plot instruction
Subroutines Called:
Getl6
This metacode translator subroutine processes a four-byte plotting
instruction.
SUBROUTINE Get16 (Ivord)
Formal Arguments:
Iword	- 16-bit word from metacode file
Subroutines Called:
Plot
Finish
This subroutine gets a 16-bit word of metacode from the metacode file.
SUBROUTINE Grvait
Formal Arguments: None
Subroutines Called:
SAM - Get Key
GRAFLIB - Pgraph
This subroutine waits for a keystroke.  provides an exit from the
routine, whereas 

will generate a hardcopy of the screen via GRAFLIB Pgraph routine. FUNCTION IBITS (IWORD, ISTART, NBITS) Formal Arguments: IWORD - Metacode instruction. ISTART - Position to start. NBITS - Number of bits. This routine extracts from IWORD the bits from ISTART to ISTART+NBITS-1. Geo-EAS Programmer's Guide 2-12 April 1990


-------
INTEGER*2 FUNCTION IWORD2 (IBYTE1, IBYTE2)
Formal Arguments:
IBYTE1,IBYTE2 - Metacode instructions.
This routine combines two bytes (IBYTE1,IBYTE2) into an INTEGER*2 word (IBYTE2
will be in bits 0-7).
SUBROUTINE Mcinit (Error, DevCode)
Formal Arguments:
Error	- Error Flag (true if error occurred)
DevCode - Device code
Subroutines Called:
SAM - Clear Screen
GRAFLIB - Zsetup, Zlocat, Zscale, Zcolor
HERSHY - HCsize, HCrot, HCfont, HCasp
This metacode translator subroutine initializes global variables, and opens
the metacode file.
SUBROUTINE Mcoption
Formal Arguments: None
Subroutines Called:
Getl6
Dash
Color
HERSHY - HCrot, HCsize
This metacode translator routine processes an NCAR 'option' instruction.
Depending on the option specified, the appropriate routine is called to set up
device-specific options.
SUBROUTINE Hulti (Ivord)
Formal Arguments:
Iword	- 16-bit word from metacode file
Subroutines Called:
Getl6
Mcoption
Plotch
Finish
This metacode translator subroutine processes a multi-byte NCAR plot
instruction. This instruction will be either to set an option, or to plot a
character string, which are handled by MCoption and Plotch.
Geo-EAS Programmer's Guide
2-13
April 1990

-------
SUBROUTINE Plot (Mx, My, Ipen)
Formal Arguments:
Mx, My - X, Y location
Ipen	- Pen Up/Down Flag (1 = Down)
Subroutines Called:
GRAFLIB - Zplot, Zmove
This metacode translator routine processes a Plot instruction. The pen
up/down flag is used to determine if Zmove or Zplot is to be called.
SUBROUTINE Plotch (Nchar)
Formal Arguments:
Nchar	- Number of characters to plot
Subroutines Called:
Getl6
HERSHY - HCasp, HCpos, HCfont
GRAFLIB - Zmove, Zwhere
This metacode translator subroutine processes a 'plot characters' instruction.
The characters are read from the metafile and plotted using calls to the
HERSHY character plotting utilities.
SUBROUTINE Two (Iword)
Formal Arguments:
Iword	- 16-bit word of NCAR metacode
Subroutines Called:
Get 16
HERSHY - HCfont, Hcasp
GRAFLIB - Zmove, Zplot
This metacode translator subroutine processes two-byte NCAR instructions.
2.6.4.5 UTILE.LIB
UTILE.LIB is a library of subroutines and functions which are shared by Geo-
EAS programs. The library is located in the subdirectory C:\GEOEAS\UTIL in
the file UTILE.LIB. Batch files exist in this subdirectory to compile the
source files and create the library. The following is a description of the
routines in this library:
Geo-EAS Programmer's Guide
2-14
April 1990

-------
SUBROUTINE QSORT1 (A, N)
REAL*4	A (1)
INTEGER*4 N
SUBROUTINE QSORT (A, P, N)
REAL*4	A (1)
INTEGER*2 P (1)
INTEGER*4 N
Subroutines QSORT and QS0RT1 are for sorting data. QS0RT1 sorts the first N
values in the array A into increasing order. QSORT does the same thing and
additionally re-arranges the array P in parallel with A. When the sort is
complete P (i) will contain the original position of array element A (i).
SUBROUTINE BSEARCH (VECTOR, N, TARGET, INDEX)
REAL*4	VECTOR (1), TARGET
INTEGER*4 N, INDEX
Subroutine bsearch performs a binary search of the first N elements in the
pre-sorted array VECTOR for a value <= TARGET and returns the position of this
element in INDEX. If INDEX is returned as zero, the search failed.
REAL*4 FUNCTION RMIN (A, N), REAL*4 FUNCTION RMAX (A, N)
Functions RMIN and RMAX return the minimum (RMIN), or maximum (RMAX) value for
the first N elements of the array A.
2.6.5	Hershey Character Plotting Utilities
HERSHY.LIB is a library of character plotting utilities which use the public
domain Hershey character sets. The utilities were rehosted on the PC from the
Las Vegas EMSL VAX. This required minimal modification. The HERSHY routines
read digitized characters from the file HERSHY.BAR in order to plot text.
They require that the .BAR file be present to operate correctly. These utili-
ties are used by the VIEW subroutine to translate metacode "Text" specifi-
cations into GRAFLIB "Move" and "Draw" commands for display on the screen.
Program HPPLOT uses a modified version of the utilities that replaces GRAFLIB
calls with calls to the HPLIB utilities. Refer to the HPPLOT subsection for
specific information on this version. For information regarding the use of
the HERSHY subroutines, refer to the Hershy Character Plotting Utilities Users
Guide (included with the source distribution).
2.6.6	HPLIB Plotter Utilities
The HPLIB Plotter Utilities consists of a set of subroutines which write HPGL
(Hewlett Packard Graphics Language) plotting commands to a file. It is used
by program HPPLOT to create HPGL plot files from NCAR metacode files. The set
of subroutines is modeled after GRAFLIB, using the same subroutine names for
functionally similar subroutines. This minimizes the differences in the
HPPLOT version of the HERSHY utilities. The utilities exist in the subdirec-
tory C:\GE0EAS\HPPL0T\ in the file HPLIB.FOR. Below is a description of each
subroutine.
Geo-EAS Programmer's Guide
2-15
April 1990

-------
SUBROUTINE BUFFER OUT	(TBUFFER, LENGTH)
Formal Arguments:
CHARACTER TBUFFER	- Temporary buffer.
INTEGER LENGTH	- Number of characters in the command.
This routine loads a plotting instruction into the output buffer
to be stored for transmittal to the output file.
SUBROUTINE FLUSH BUFFER
This routine sends the contents of the output buffer to the file.
SUBROUTINE GETDEV (XI, X2, Yl, Y2)
Formal Arguments:
INTEGER XI, X2 - Minimum and maximum X coordinates.
INTEGER Yl, Y2 - Minimum and maximum Y coordinates.
This routine returns the minimum and maximum device coordinates.
SUBROUTINE GETVOR (XMIN, XMAX, YMIN, YMAX)
Formal Arguments:
REAL XMIN, YMIN - Minimum X and Y coordinates.
REAL XMAX, YMAX - Maximum X and Y coordinates.
This routine returns the user coordinate system extents.
SUBROUTINE LINE TYPE (TYPE)
Formal Arguments:
INTEGER TYPE - Number of the line pattern.
This routine uses the HPGL command 'LT' to set the current line type.
SUBROUTINE PEN DOWN
This routine uses the HPGL command 'PD' to lower the plotter pen.
SUBROUTINE PEN UP
This routine uses the HPGL command 'PU' to raise the plotter pen.
SUBROUTINE SET SPEED (SPEED)
Formal Arguments:
INTEGER SPEED - Pen speed.
Geo-EAS Programmer's Guide	2-16	April 1990

-------
This routine uses the HPGL command 'VS' to set the velocity of the plotter
pen.
SUBROUTINE ZCOLOR (PEN)
Formal Arguments:
INTEGER PEN	- Number of the plotter pen to select.
This routine uses the HPGL command 'SP' to select a new pen color.
SUBROUTINE ZLABEL (TEXT)
Formal Arguments:
Text - Information to plot.
This routine writes text using the plotter's hardware font.
SUBROUTINE ZLBDIR (ANGLE)
Formal Arguments:
REAL ANGLE - Angle to plot label.
This routine uses the HPGL command 'DR' to set the direction to plot the
label.
SUBROUTINE ZLOCAT (XI, X2, Yl, Y2)
Formal Arguments:
INTEGER XI, Yl - Minimum X and Y coordinates.
INTEGER X2, Y2 - Maximum X and Y coordinates.
This routine uses the HPGL command 'IV to set the minimum and maximum device
coordinates for the plotter.
SUBROUTINE ZMOVE (X,Y)
Formal Arguments:
REAL X,Y - Location to move pen.
This routine uses the HPGL command 'PA' to move the plotter pen to the
specified location.
SUBROUTINE ZPLOT (X, Y)
Formal Arguments:
REAL X, Y - Coordinates to plot line.
Geo-EAS Programmer's Guide	2-17	April 1990

-------
This routine uses the HPGL command 'PA' to plot a line.
SUBROUTINE ZSCALE (XHIN, XMAX, YMIN, YMAX)
Formal Arguments:
REAL XMIN, YMIN
REAL XMAX, YMAX
-	Minimum X and Y coordinates.
-	Maximum X and Y coordinates.
This routine uses the HPGL command 'SC' to initialize the user (virtual)
coordinate system.
SUBROUTINE ZSETUP (OUTPUT FILE, UNIT, IERR, TRUE SCALE)
Formal Arguments:
CHARACTER OUTPUT FILE
INTEGER UNIT
INTEGER IERR
LOGICAL TRUE SCALE
-	Name of the HPGL file.
-	External unit specifier for output file.
-	Integer variable set to 1 if an error occurs.
-	Indicates whether or not graph is set for plotting
on a square (true) or rectangle (false).
This subroutine initializes the HPLIB internal variables, and opens the HPGL
file. It should be called before any other HPLIB routines. It uses the
HPGL commands 'IP' and 'IV to initialize the minimum and maximum coordinates
for the plotter.
SUBROUTINE ZWHERE (X,Y)
Formal Arguments:
REAL X,Y - X and Y coordinates of the pen location.
This routine returns the X and Y coordinates of the current pen location in
virtual coordinates.
Geo-EAS Programmer's Guide
2-18
April 1990

-------
SECTION 3
PROGRAM DESCRIPTIONS
3.0	GEOEAS
3.0.1 Software Function
GEOEAS is the system menu program. It allows the user to execute the Geo-EAS
programs from a common menu. This is accompli3shed by using DOS "SYSTEM"
calls, through an interface to the C run-time library. A modified (smaller)
version of the SAM screen management utilities is used for screen interaction,
to minimize the size of the GEOEAS executable.
3.0.2 Global Variables/Program Limits
The limits for GeoEAS are set in the file SCREEN.STR. This file of global
declarations is used by the modified version of the screen software. The
number of menu options displayed on the GEOEAS main screen is declared in this
file. This limit is set to the number of programs which appear in the menu.
No other global variables are used by GEOEAS. Refer to the file SCREEN.STR in
the subdirectory C:\GeoEAS\GeoEas\ for more information.
3.0.3 User Interface
The Screens
GEOEAS displays two screens, an Introductory screen, and a Main screen. In
the file GEOEAS.SCR the Introductory screen is defined as Screen 1 and the
Main screen as Screen 2. The modified versions of the screen management
subroutines are used to display the screens and provide menu selection
capability. The Introductory screen displays a brief introduction and no menu
options. The Main screen and menu has the options to allow selection of the
program to be executed. The menu that appears on the Main screen is a tabular
menu containing the program names. The arrow keys are used to position a
highlighted bar over the name of the program to be executed. The  key may
be used to exit the program.
Global Variable/Screen Field Relationships
All the fields on the GEOEAS main screen are menu fields. Each menu option is
the name of the program which is to be executed. When a menu selection is
made, the program name is obtained from the screen field and passed to the C
"SPAWN" function to begin execution of the selected program.
Geo-EAS Programmer's Guide
3.0-1
April 1990

-------
3.0.4 Processing
The following pseudocode represents the general flow of processing in GEOEAS.
Processing is structured as described in the subroutine calling tree: The
main screen is presented, the menu processing loop waits for a key to be
pressed. The selected program is executed via a call to the "SPAWN" function.
When execution of the program is terminated, the GEOEAS main screen is regen-
erated and the process is repeated until the user selects the Quit option, or
presses . The ^Interactive Screen Input' process is performed by the
subroutines GET MENU CHOICE. The following pseudocode represents general
processing in GEOEAS.
Display Intro Screen
Display Main Screen
CALL Get Menu Choice
IF Menu Choice .EQ.  .OR. Quit THEN EXIT
ELSE IF Menu Choice .EQ. program name THEN
Execute Program via "SPAWN" function
ELSE
LOOP to Get Menu Choice
ENDIF
LOOP to Display Main Screen
3.0.5 Subroutine Structure
The following is the subroutine calling tree for GEOEAS.
GeoEAS DB ASMLIB (Setmod)
GEOEAS
Set Screen
Display Fields 	
Display Frame 	
Display Labels 	
Flash 	
- Put Str
- Put Str
| ASMLIB (Getcha)
\ Erase 	
Put Str
Draw Line DD Draw Char DD PutStr
Put Str
Put Str
PutVmem
Get Menu Choice — Write Field
I Erase 	
Put Str
Put Str
Erase
| Write Messages - Put Str
\ ASMLIB (Getcha, Setmod)
- Put Str
\ C FUNCTION Spawn (LLIBC)
Libraries: LLIBC - large model C library
ASMLIB - assembler utility library
Geo-EAS Programmer's Guide
3.0-2
April 1990

-------
3.0.6
Subroutine Descriptions
Following is a list of the subroutines that appear in GEOEAS. The formal
arguments (if any) are described followed by the local variables and finally a
description of what the subroutine does. Most of the subroutines listed below
are modified versions of the SAM screen subroutines. The main modifications
were to eliminate capabilities which were not used by GEOEAS (i.e., for
non-menu fields), and to reduce the size of INTEGER variables to 2 bytes.
This was required so that the program would be as small as possible and
provide as much memory for loading programs as possible.
PROGRAM GEOEAS (main module)
The main program performs the following:
Sets up the screens
Displays the intro screen, waits for a keystroke
Displays the main screen, waits for a menu choice
Executes the program
INTEGER*2 Function Fid Index (Name)
CHARACTER Name*10 - screen field name
This function returns the index of a field, given the field name. It is used
by the screen management routines.
SUBROUTINE Display Fields
This routine displays all fields for the current screen.
SUBROUTINE Display Frame
This subroutine displays the frame (lines) for the current screen, as defined
in GEOEAS.SCR.
SUBROUTINE Display Labels
This routine displays all labels for the current screen
SUBROUTINE Draw Char (Matrix, Attribute, Row, Col, Ch, Line Type, Att)
INTEGER Matrix, Attribute, Row, Col, Ch, Line Type, Att
This routine places the line drawing character (Ch) on the screen using
routine PUTSTR at position (Row, Col) with video attribute Att. Line Type
indicates if a single or double line is to be used. Matrix contains the
screen characters.
Geo-EAS Programmer's Guide
3.0-3
April 1990

-------
SUBROUTINE Draw Line (Matrix, Attribute, F, Rovl, Columnl, Rov2, Column2)
INTEGER Matrix, Attribute, F, Row, Column
This routine draws a line on the screen with line drawing characters. Matrix
contains the screen characters and Attribute contains the attributes for each
character. F is the index of the FRAME command in the screen definition file.
The line is "drawn" in the two arrays Matrix and Attribute, then displayed on
the screen using DRAW CHAR.
SUBROUTINE Erase (Row, Column, N)
INTEGER Row, Column, N - row, column to begin erase, N=num chars.
This routine will erase N characters on the screen beginning at Row, Column.
SUBROUTINE FLASH (Row, Column, Message)
INTEGER Row, Column - location for message
CHARACTER Message - message to display
This routine displays the given message at the location given by Row, and
Column, in reverse video, it then waits for any key to be pressed.
SUBROUTINE Get Menu Choice (Menu Choice)
Menu Choice - character string containing blanks, or the program name
This subroutine processes keystrokes. Arrow keys move the highlighted bar to
new menu items,  selects the item.
SUBROUTINE Put Str (Ch, Len, Row, Col, Att)
INTEGER Len, Row, Col, Att
CHARACTER Ch
This routine puts out the first N characters of the string Ch at the screen
location (Row, Col) using the video attribute given by Att. It uses a C
function called PUTVMEM, which writes directly to video memory, depending on
the display type.
SUBROUTINE Set Screen (Screen Number)
INTEGER Screen Number
This routine sets the value of Current Screen to the Screen Number and
initializes screen pointers.
Geo-EAS Programmer's Guide
3.0-4
April 1990

-------
SUBROUTINE Write Field (Field, Attribute)
INTEGER Field - the index of the screen field
INTEGER Attribute - the video attribute for the field
This subroutine displays the field on the screen with the specified attribute.
SUBROUTINE Write Messages (Field)
INTEGER Field - the index of the screen fields
This subroutine writes the messages for the screen field to the appropriate
location on the screen, as defined in GEOEAS.SCR.
Geo-EAS Programmer's Guide
3.0-5
April 1990

-------
3.1	DATAPREP
3.1.1	Software Function
Dataprep provides utilities for Geo-EAS data files. Dataprep has two divi-
sions, the DOS Utilities and the File Operations. The DOS Utilities allow
access to commonly used DOS commands. The File Operations include utilities
to manipulate Geo-EAS data files.
3.1.2	Global Variables/Program Limits
DATAPREP reads as well as generates Geo-EAS data files containing a maximum of
48 variables and 10,000 samples. If a file should contain more than 10,000
samples then only the first 10,000 samples are read and processed.
The following is a description of the global variables used in DATAPREP. The
format is extracted from the declaration file DATAPREP.DEC. The variable
description and the common block declaration follows.
Qkkkkkkkkkkkkkkkkkkkk-kkkkkkkkkkkkkkkkkkkkkk kk-kkkkkkkkkkkk k~ ~ ~ k~ ~ ~ * ~ ~ k -k k ~ k * * k
C PARAMETERS:
C MAXDATA - maximum number of data (sample) records permitted.
C MAXVAR - maximum number of Variables permitted.
C MAXFILES - maximum number of files permitted.
PARAMETER (MAXDATA = 10000)
PARAMETER (MAXVAR = 48)
PARAMETER (MAXFILES = 3)
IMPLICIT INTEGERS (A-Z)
Q kkk-kkkickkkkkkkkk-kkkkkkkkkkkkkkkkkkkkkkkkkkk-kkkkkkkkkkkkkk k kkk k ~k ~~~~ k k kkkkk k k
C Rawdat	- temporary vector.
C VARIABLES:
C Ndata	- contains the number of records (with sample data) in the first
C	Geo-EAS data file.
C Nvar	- contains the number of Variables in the first Geo-EAS
C	data file.
C Ndata2	- contains the number of records (with sample data) in the second
C	Geo-EAS data file.
C Nvar2	- contains the number of Variables in the second Geo-EAS data file.
COMMON /rawdat/ Ndata, Nvar, Ndata2, Nvar2
INTEGER**	Ndata, Nvar, Ndata2, var2
Geo-EAS Programmer's Guide
3.1-1
April 1990

-------
C Vname - declarations to support the Variable names and measurement
descriptions for two files.
C Varnam - array that contains all Variable names for the first file.
C Units - array that contains measurement descriptions for each Variable in
the first file.
C Recskip - contains the number of the first record that contains sample data.
C Varnam2 - array that contains all Variable names for the second file.
C Units2 - array that contains measurement descriptions for each Variable in
the second file.
COMMON /Vname/	Varnam, Units, Recskip, Varnam2, Units2
CHARACTER*10	Varnam (MAXVAR), Units (MAXVAR)
CHARACTER*10	Varnam2 (MAXVAR), Units2 (MAXVAR)
INTEGER*4	Recskip
C****************************************************************************
C Format - Formats for input and output
C VARIABLES:
C Formats - array that contains the output formats for each Variable of
the first file.
C Fmt	- array that contains the output format for the Variables.
C Informats - array that contains the input format for the Variables.
C Startcol - array that contains the index numbers of those variables to be
used in the 'Report' listing of the
C	Report function.
COMMON /Format/ Formats, Fmt, Informats, Startcol
CHARACTER*5 Formats (MAXVAR), Informats (MAXVAR)
CHARACTER*480 Fmt
INTEGER*4	Startcol(MAXVAR)
C Fmt2 - Formats for the 2nd file
C VARIABLE:
C Formats2 - array that contains output formats for each Variable in the
second file.
COMMON /Fmt2/ Formats2
CHARACTER*5 Formats2(MAXVAR)
C****************************************************************************
C Miss - missing value, and logical 'Intro'.
C VARIABLES:
C Missing - contains the missing value.
C Intro - contains a logical which is .TRUE, if the Intro
C	screen is to be displayed.
COMMON /Miss/ Missing, Intro
REAL*4	Missing
LOGICAL*!	Intro
Geo-EAS Programmer's Guide
3.1-2
April 1990

-------
c****************************************************************************
C Ifname - Geo-EAS input data file name
C VARIABLES:
C Infil - contains the Geo-EAS input data file name.
C Infilel - contains the first Geo-EAS input data file name.
C Infile2 - contains the second Geo-EAS input data file name.
C Outfilel - contains the Geo-EAS output data file name.
COMMON /Ifname/ Infil,Infilel,Infile2,Outfilel
CHARACTER*14 Infil,Infilel,Infile2,Outfilel
C****************************************************************************
C Ofname - Out file name
C VARIABLE:
C Outfil - contains the Geo-EAS output data file name.
COMMON /Ofname/ Outfil
CHARACTER	0utfil*14
C Titl - Title for graphs
C VARIABLE:
C Title - contains the title description of the Geo-EAS data file.
C Doscom - contains the DOS command.
COMMON /Titl/ Title, Doscom
CHARACTER*66 Title, Doscom
C Pref - Variable names and units
C VARIABLES:
C Prefile - contains the Prefix affixed to the file name or the Tfprefix C
affixed to the scratch file.
C Prefix - contains the prefix to a file name.
C Tfprefix - contains the prefix to the scratch file.
COMMON /Pref/	Prefix, Prefile, Tfprefix
CHARACTER*77	Prefile
CHARACTER*55	Prefix
CHARACTER*55	Tfprefix
C****************************************************************************
C Taray - Variable names and units
C VARIABLE:
C Taray - Logical array for indicating if non-unique variables exist in filel
C	and file 2.
COMMON /Taray/ Tarray
LOGICAL*!	Tarray(MAXVAR)
Geo-EAS Programmer's Guide
3.1-3
April 1990

-------
C Tmpvec - Vectors used to facilitate reading and writing to files.
C Vector48 - contains a record of sample data.
COMMON /T.upvec/ Vector48
REAL*4	Vector48(MAXVAR)
Geo-EAS Programmer's Guide
3.1-4
April 1990

-------
Data Flov and Processing
3.1.3
Data Flow Diagram
Geo-EAS
Input Data
File
Scratch
File 1
Geo-EAS
Output Data
file
User
Input
Head
Geo-EAS
Input Data
File
(Merge and
Append only)
L
Read
Head
GZ0EAS.9EF
(Syste*
Defaults
File)
Head
Write
Uri te
DATAPREP
Read
Write
Scratch
File 2
Write
GZOEAS.DEF
(Syste*
Defaults
File)
File Inputs
DATAPREP requires a Geo-EAS Data File for input for all utilities except for
the Merge and Append utilities which require two such data files. DATAPREP
reads the System Defaults File, if one exists, for an input file name and a
file prefix.
Geo-EAS Programmer's Guide
3.1-5
April 1990

-------
3.1.4
User Interface
The Screens
DATAPREP displays a screen for the introduction and individual screens for
each menu. The Intro screen is defined as Screen 1 in the DATAPREP.SCR file
whereas the other screens are modified versions of one screen defined as
Screen 2 in DATAPREP.SCR. These modifications are made within the subroutines
via calls to PUT STR and ERASE subroutines (included in the Screene library).
The Intro screen displays a brief intro with no menu options. The File
Options screen and DOS Utilities screen both use vertical menus and are
similar in appearance. The remaining screens utilize horizontal menus. The
screen labels and related screen fields are easily distinguished by viewing
the screen itself. A description of the screen labels and related screen
fields for each of these screens appears later.
The menus that appear on each screen are presented below along with the menu
name and the related screen field name (in parentheses) that is used in the
DATAPREP.SCR file.
The Main menu (ME MAIN):
Prefix DOS Utilities File Operations Quit
The DOS Utilities menu (DOS MENU):
Directory
Print
List
Copy
Rename
Delete
DOS Command
Quit
The Directory menu (DIR MENU):
Directory Execute
The Print menu (PT MENU):
Files Execute Quit
The Copy menu (CO MENU):
File Execute Quit
The Rename menu (RN MAIN):
Files Execute Quit
The Delete menu (DL MAIN):
Files Execute Quit
The Main menu (ME MAIN):
File Execute Quit
Geo-EAS Programmer's Guide
3.1-6
April 1990

-------
The File Operations menu (FILE MENU):
Append
Column Extract
Row Extract
Compress
ID Variable
Merge
Report
Sort
Quit
The Append menu (AP MENU):
Files Execute Quit
The Column Extract menu (CE MAIN):
Files Variables Execute Quit
The Row Extract menu (RE MENU):
Files Subsetting Condition Execute Quit
The Row Extract Operand menu (RE2MENU):
Constant Variable
The Compress menu (CS MENU):
Files Execute Quit
The ID Variable menu (ID MENU):
Files Execute Quit
The Merge menu (MG MENU):
Files Execute Quit
The Report menu (RT MENU):
Files Variables Execute Quit
The Sort menu (ST MENU):
Files Variable Execute Quit
Geo-EAS Programmer's Guide
3.1-7
April 1990

-------
The Menu Hierarchy
The menu hierarchy is as follows:
Dataprep—|-Pref ix
|-DOS Utilities-
-pDi rectory-
I
I
|-Print	
I
I
[-List	
I
I
l_c°py	
-Rename-
-Delete-
|-DOS Command
Mjuit
(-File Operations—>
LQuit
-pDiroctory
[¦Execute
LQuit
-pFile
|-Execute
LQuit
-j-File
[-Execute
LQuit
-pF i 1 e s
[-Execute
LQuit
-j-Files
[-Execute
LQuit
-pFile
[•Execute
•-Quit
Geo-EAS Programmer's Guide	3.1-8
April 1990

-------
—> File Operations	pAppend	pFiles
I	[-Execute
|	LQuit
[-Column Extract	|-Files
| (-Variables
| |-Execute
| Lguit
|-Row Extract	(-Files
|-	|Subsetting	[-Constant
|	[Condition LVariable
|	[-Execute
|	Mjuit
[-Compress	pFiles
|	|-Execute
|	LQuit
[-ID Variable	pFiles
|	[-Execute
|	LQuit
|-We r ge	pF i 1 e s
[	| Execute
|	LQuit
|-Report	p-Files
|	[-Variables
|	|-Execut9
|	LQuit
|-Sort	pFiles
|	|-Variable
|	|-Execute
•-Quit	Ujuit
Global Variable/Screen Field Relationships
The fields on the screen have associated screen field names in the
DATAPREP.SCR file. Some of these fields have their contents assigned to a
global variable and others are assigned to local variables. This becomes
evident upon examination of the source code and comments. The screen fields
(described by the screen label), their associated field names (used in
DATAPREP.SCR file; the field type is enclosed in parentheses), and the related
global variable name are listed below. The labels are divided into 14 sec-
tions: Append, Column Extract, Compress, Copy, Delete, Directory, ID Variable,
List Merge, Print, Rename, Report Row Extract, Sort. The Main screen pre-
ceding this discussion should be used for a reference.
Geo-EAS Programmer's Guide
3.1-9
April 1990

-------
SCREEN
LABEL
FIELD NAME
(DATAPREP.SCR)
GLOBAL VARIABLE (If not global
then 'Local' is entered.)
Append Screen
Data File Prefix:
Name of file 1:
Name of file 2:
Name of output file:
Compress Screen
Data File Prefix:
Input file:
Output file:
Copy Screen
Data File Prefix:
File to copy from:
File to copy to:
Delete Screen
Data File Prefix:
File to be deleted:
Directory Screen
Directory:
ID Variable Screen
Data File Prefix:
Input file:
Output file:
ID Variable name:
'Sequence #"
List Screen
Data File Prefix:
File to be listed:
Merge Screen
Data File Prefix:
Name of file 1:
N/A
FILElA(char)
FILE2A(char)
0UTFILE2(char)
N/A
INFILEl(char)
OUTFILEl(char)
N/A
OLDFILE(char)
NEVFILE(char)
N/A
DELETEFL(char)
DIRECT(char)
N/A
INFILEl(char)
OUTFILEl(char)
N/A
N/A
DELETEFL(char)
N/A
FILE3A(char)
PREFIX (displayed
by PUT STR)
INFIL
INFILE2
OUTFIL
PREFIX
INFIL
OUTFIL
PREFIX
INFIL
0UTFILE1
PREFIX
INFIL
INFIL
PREFIX
INFIL
OUTFIL
Displayed by PUT STR
PREFIX
INFIL
PREFIX
INFIL
N/A - not applicable
Geo-EAS Programmer's Guide
3.1-10
April 1990

-------
SCREEN
LABEL
FIELD NAME
(DATAPREP.SCR)
GLOBAL VARIABLE (If not global
then 'Local' is entered.)
Merge Screen (Cont)
Name of file 2:
Name of output file:
Print Screen
Data File Prefix:
File to be printed:
Rename Screen
FILE4A(char)
0UTFILE3(char)
N/A
DELETEFL(char)
INFILE2
OUTFIL
PREFIX
INFIL
Data File Prefix:
Current Filename:
New Filename:
N/A
OLDNAME(char)
NEWNAME(char)
PREFIX
INFIL
0UTFILE1
Report Screen
Data File Prefix:	N/A	PREFIX
Input File:	INFILlC(char)	INFIL
Output File:	OUTFILlC(char)	OUTFIL
Sequence option:	SEQUENCE(toggle)	Local
Total Variables in
input file:	VAR T0TAL(integer)	NVAR
Variable to print:	VT0GGLE4(toggle)	Local
Row Extract Screen
Data File Prefix:
Input file:
Output file:
Operandi
Operator
0perand2
N/A
INFILlC(char)
OUTFILlC(char)
VT0GGLE0(toggle)
0PERAT0R(toggle)
VT0GGLE1(toggle)
CONSTANTS real)
or
PREFIX
INFIL
OUTFIL
Local
Local
Local
Local
Sort Screen
Data File Prefix:
Input File:
Output File:
Variable to sort:
N/A
INFILlC(char)
OUTFILlC(char)
VT0GGLE2(toggle)
PREFIX
INFIL
OUTFIL
local
3.1.5 Processing
The following is a discussion on the general approach used in processing the
user's menu selection. Specific details are not presented here. Further
Geo-EAS Programmer's Guide
3.1-11
April 1990

-------
understanding of the processing can be achieved by reading the comments in the
source code. Pseudocode for the overall process is presented at the end of
this discussion.
Processing is structured along the lines of the menu hierarchy. Subroutines
that display the menus also process the user's menu selection using IF THEN
ELSEIF statements. Some menu options are processed within the IF THEN ELSEIF
block while others are processed in individual subroutines.
The individual subroutines that process the options listed in the DOS
Utilities menu are similar in design. The subroutines that process the
options listed in the File Operations menu are also similar in design. When
the user selects a DOS Utility option a subroutine is called that constructs
the screen for that option. This subroutine prompts the user for the input
and then executes the option via a call to another subroutine. This other
subroutine then makes a call to a 'C' routine included in the 'Clibfore'
library. An Interface statement that defines this 'C' routine is included in
the file 'PreplA.for'.
When the user selects a File Operations option a subroutine is called that
constructs the screen for that option. The user is prompted for the necessary
input and then processes the option either within that same subroutine or via
another subroutine call.
Although the DATAPREP displays many different screens, only two screens are
defined in the 'Dataprep.scr' file - an intro screen and a main screen(from
which menus are displayed). It is the main screen that changes to give the
appearance of many screens. The code makes the screen changes with 'PUT STR'
calls and 'ERASE' calls (both calls are included in the 'Screene' library).
These calls are placed at specific points in the code so that the screen
changes accordingly. Caution must therefore be used when moving or changing
these calls.
The subroutine calling structure is similar to the layering of the menu
hierarchy. For example, the Main menu is displayed by the Main program. A
specific menu selection results in a call to another subroutine which displays
a sub-level menu. The sub-level menu selection is then processed by another
subroutine.
The data from the Geo-EAS data file is stored both internally (in the program
using arrays) and on disk using the two scratch files (discussed below). The
variable names, measurement descriptions and output formats are stored in
global character arrays (Varnam, Units, Formats). The sample data is stored
in the scratch file. An index representing the column (in which the variable
appears in the Geo-EAS data file) of a variable is used to access the
character array elements corresponding to the variable. This same index is
used in the function (GET ELEMENT) and subroutine (PUT ELEMENT) calls made to
access sample data from the scratch file. Throughout processing the global
character arrays and the scratch files are accessed many times.
The Dataprep File Operations use temporary files called scratch files for
storing data read from a Geo-EAS data file and for processing. The Append and
Geo-EAS Programmer's Guide
3.1-12
April 1990

-------
Merge operations require an additional temporary file for processing. The
temporary files are called ZZSCTCH1.FIL and ZZSCTCH2.FIL. Each time an
operation is executed the temporary files are generated and then deleted after
processing is complete.
The following pseudocode represents the general flow of processing in
DATAPREP. The 'Interactive Screen Input' process at the highest levels
consists of the main program, and the subroutines DOS UTILITIES and the FILE
OPERATIONS.
DATAPREP
CALL Read System Defaults
CALL Intro Screen
Display the main screen - (Screen 2)
Interactive Screen Input
Interactive Screen Input
10 Display Main Menu
IF (Menu Choice = 'Quit') THEN
Write system defaults.
RETURN
ELSE IF (Menu Choice = 'Prefix') THEN
Prompt user for prefixes and process.
ELSE IF (Menu Choice = 'DOS Utilities') THEN
15	Draw DOS Utilities screen and display menu.
IF (Menu Choice = 'Quit') THEN
Erase DOS Utilities screen and return to main program.
ELSEIF (Menu Choice = 'Copy') THEN
Draw Copy screen and process Copy menu option.
ELSEIF (Menu Choice = 'Delete') THEN
Draw Delete screen and process Delete menu option.
ELSEIF (Menu Choice = 'Directory') THEN
Draw Directory screen and process the menu option.
ELSEIF (Menu Choice = 'DOS Command') THEN
Exit to DOS.
ELSEIF (Menu Choice = 'Print') THEN
Draw Print screen and process Print menu option.
ELSEIF (Menu Choice = 'Rename') THEN
Draw Rename screen and process Rename menu option.
ELSEIF (Menu Choice = 'List') THEN
Draw List screen and process List menu option.
ENDIF
GO TO 15
ELSE IF (Menu Choice = 'File Operations') THEN
20	Draw File Operations screen and display menu.
IF (Menu Choice = 'Append') THEN
Draw Append screen and process Append menu option.
ELSEIF (Menu Choice = 'Column Extract') THEN
Draw Column Extract screen and process Column Extract
menu option.
Geo-EAS Programmer's Guide
3.1-13
April 1990

-------
ELSEIF (Menu Choice = 'Row Extract') THEN
Draw Row Extract screen and process Row Extract
menu option.
ELSEIF (Menu Choice = 'Compress') THEN
Draw Compress screen and process Compress menu option.
ELSEIF (Menu Choice = 'ID Variable') THEN
Draw ID Variable screen and process ID Variable menu
option.
ELSEIF (Menu Choice = 'Merge') THEN
Draw Merge screen and process Merge menu option.
ELSEIF (Menu Choice = 'Report') THEN
Draw Report screen and process Report menu option.
ELSEIF (Menu Choice = 'Sort') THEN
Draw Sort screen and process Sort menu option.
ELSEIF (Menu Choice = 'Quit') THEN
Erase File Operations screen and return to main program.
ENDIF
GO TO 20
ENDIF
GO TO 10
3.1.6 The Outputs
DATAPREP generates one Geo-EAS Data File containing the results of utility
operations performed on the input data. DATAPREP stores the output file name
and file name prefix into the System Defaults File. If one does not exist,
then DATAPREP generates one.
Geo-EAS Programmer's Guide
3.1-14
April 1990

-------
3.1.7
Subroutine Structure
The subroutine structure is displayed in a subroutine calling tree as
follows:
MAIN tINIT PREFIX
-SAM
-INIT TFPREFIX
1-SAM
-READ SYSTEM DEFAULTS
1-SAM
-INTRO SCREEN
¦DISPLAY PREFIX LABELS—>(1)
-WRITE SYSTEM DEFAULTS
-PREFIX OPERATION
bSAM
[3UILD PREFIX SCRATCH FILENAME —> SAM
l-INIT TFPREFIX
lsam
-DOS UTILITIES
(-SAM
fORAW MESSAGE DIVIDER
f£RASE MESSAGE DIVIDER
[CLEAR ROUS 	 SAM
[COPY PROMPTS—>(2)
DISPLAY PREFIX LABELS—>(1)
DELETE PROMPTS—>(3)
^DIRECTORY PROMPTS—>(4)
|-SYSTEM COMMAND 	 SAM
|-PRINT PROMPTS—>(5)
[RENAME PROMPTS—>(6)
'-LIST PROMPTS—>(7)
-DISPLAY PREFIX LABELS—>(1)
'-FILE OPERATIONS
-SAM
-DRAW MESSAGE DIVIDER
-APPEND PROMPTS—>(8)
-DISPLAY PREFIX LABELS—>(1)
¦COLUMN EXTRACT PROMPTS—>(9)
-ROW EXTRACT PROMPTS—>(10)
¦COMPRESS PROMPTS—>(12)
¦CREATE ID PROMPTS—>(11)
¦MERGE PROMPTS—>(13)
¦REPORT PROMPTS—>(14)
LSORT PROMPTS—>(17)
Geo-EAS Programmer's Guide
3.1-15
April 1990

-------
(1	)	DISPLAY PREFIX LABELS
[-SAM
4)RAV MIDDLE HORIZONTAL LINE
(2	)	COPY PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
¦CLEAR ROWS
•-SAM
-DRAW MIDDLE HORIZONTAL LINE
¦CLEAR ROWS
LSAM
-ERASE MIDDLE HORIZONTAL LINE
¦GET DOS FILENAME
l-SAM
LBUILD PREFIX FILENAME
"-SAM
•COPY FILE
[BUILD PREFIX FILENAME
lSAM
(3	)	DELETE PROMPTS
-SAM
¦DRAW MIDDLE HORIZONTAL LINE
•CLEAR ROWS
LSAM
¦ERASE MIDDLE HORIZONTAL LINE
-BUILD PREFIX FILENAME
L-SAM
¦GET DOS FILENAME
LfiUILD PREFIX FILENAME
LSAM
ldelete FILE
LfiUILD PREFIX FILENAME
l-SAM
(A)	DIRECTORY PROMPTS
-SAM
-SET DOSCOM BLANK
¦DISPLAY DIRECTORY SCREEN
[-SAM
4DRAW MIDDLE HORIZONTAL LINE
¦CLEAR ROWS
LSAM
¦ERASE MIDDLE HORIZONTAL LINE
4.1 ST DIRECTORY
•-SAM
Geo-EAS Programmer's Guide
3.1-16
April 1990

-------
(5	)	PRINT PROMPTS
-SAM
-DISPLAY PRINT SCREEN
|-SAM
LDRAU MIDDLE HORIZONTAL LINE
-CLEAR ROUS
LSAM
-ERASE MIDDLE HORIZONTAL LINE
¦GET DOS FILENAME
(-SAM
LBUILD PREFIX FILENAME
•-SAM
LPRINT FILE
[-SAM
i-BUILD PREFIX FILENAME
"-SAM
(6	)	RENAME PROMPTS
-SAM
¦DRAW MIDDLE HORIZONTAL LINE
-CLEAR ROWS
LSAM
-ERASE MIDDLE HORIZONTAL LINE
-BUILD PREFIX FILENAME
LSAM
¦GET DOS FILENAME
|-SAM
LfiUILD PREFIX FILENAME
L-SAM
¦RENAME FILE
L-SAM
LBUILD PREFIX FILENAME
lSAM
(7	)	LIST PROMPTS
-SAM
¦DISPLAY LIST SCREEN
|-SAM
LDRAV MIDDLE HORIZONTAL LINE
-SET FILENAME BLANK
LSAM
¦CLEAR ROWS
l-SAM
¦ERASE MIDDLE HORIZONTAL LINE
¦GET DOS FILENAME
|-SAM
LfiUILD PREFIX FILENAME
l-SAM
4JST FILE
-SAM
LaUILD PREFIX FILENAME
lSAM
Geo-EAS Programmer's Guide
3.1-17
April 1990

-------
(8)	APPEND PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
¦CLEAR ROUS
LSAM
-DRAW MIDDLE HORIZONTAL LINE
¦ERASE MIDDLE HORIZONTAL LINE
¦CLEAR ROWS
•-SAM
¦ERASE VARIABLE LIST
l-SAM
¦GET NAME OF FILE
|-SAM
LBUILD PREFIX FILENAME
l-SAM
¦-APPEND
-SAM
¦OPEN SCRATCH FILES
¦FILE SET UP—>(15)
¦CHECK FOR SAME NAME VARIABLES
L-SAM
¦READ NUMERICAL DATA—>(18)
¦PUT ELEMENT
¦DISPLAY VARIABLES
l-SAM
-WRITE TO OUTPUT FILE—>(16)
¦CLOSE SCRATCH FILES
4lEAL*4 FUNCTION GET ELEMENT
Geo-EAS Programmer's Guide
3.1-18
April 1990

-------
(9)	COLUMN EXTRACT PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
-CLEAR ROUS
LSAM
-DRAW MIDDLE HORIZONTAL LINE
-ERASE MIDDLE HORIZONTAL LINE
¦ERASE VARIABLE LIST
LSAM
-GET NAME OF FILE
(-SAM
LfiUILD PREFIX FILENAME
LSAM
-FILE SET UP—>(15)
-LOAD ALL TOGGLE FIELDS
LSAM
-DISPLAY VARIABLES
•-SAM
-INCREMENT VARIABLE TOGGLE POSITION
LSAM
-OPEN SCRATCH FILES
¦READ NUMERICAL DATA—>(18)
¦PUT ELEMENT
•WRITE TO OUTPUT FILE—>(16)
¦CLOSE SCRATCH FILES
4lEAL*4 FUNCTION GET ELEMENT
Geo-EAS Programmer's Guide
3.1-19
April 1990

-------
(10)	ROW EXTRACT PROMPTS
-SAM
•ERASE MESSAGE DIVIDER
-CLEAR ROUS
lSAM
-DRAV MIDDLE HORIZONTAL LINE
-ERASE MIDDLE HORIZONTAL LINE
-ERASE VARIABLE LIST
l-SAM
¦GET NAME OF FILE
f-SAM
•-BUILD PREFIX FILENAME
l-SAM
-FILE SET UP—>(15)
-LOAD ALL TOGGLE FIELDS
•-SAM
¦ERASE VARIABLE LIST
LSAM
-DISPLAY VARIABLES
l-SAM
-CHECK CONSTANT INPUT OVERFLOW
l-SAM
-OPEN SCRATCH FILES
¦READ NUMERICAL DATA—>(18)
¦ROW EXTRACT
[¦EXTRACT
[-PUT ELEMENT
4tEAL*4 FUNCTION GET ELEMENT
4*EAL*4 FUNCTION GET ELEMENT
-WRITE TO OUTPUT FILE—>(16)
LCLOSE SCRATCH FILES
Geo-EAS Programmer's Guide
3.1-20
April 1990

-------
(11)	CREATE ID PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
-CLEAR ROWS
lSAM
-DRAW MIDDLE HORIZONTAL LINE
-ERASE MIDDLE HORIZONTAL LINE
-ERASE VARIABLE LIST
LSAM
•GET NAME OF FILE
lSAM
LfiUILD PREFIX FILENAME
LSAM
-FILE SET UP—>(15)
-OPEN SCRATCH FILES
-READ NUMERICAL DATA—>(18)
-ID VAR
l-SAM
|-PUT ELEMENT
[-DISPLAY VARIABLES
•-SAM
'-WRITE TO OUTPUT FILE—>(16)
klLOSE SCRATCH FILES
Geo-EAS Programmer's Guide
3.1-21
April 1990

-------
(12	)	COMPRESS PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
-CLEAR ROUS
LSAM
-DRAW MIDDLE HORIZONTAL LINE
-ERASE MIDDLE HORIZONTAL LINE
-CLEAR ROWS
LSAM
¦ERASE VARIABLE LIST
LSAM
¦GET NAME OF FILE
(-SAM
LBUILD PREFIX FILENAME
lSAM
-FILE SET UP—>(15)
¦OPEN SCRATCH FILES
¦READ NUMERICAL DATA—>(18)
¦COMPRESS
j-SAM
[-PUT ELEMENT
LWRITE TO OUTPUT FILE—>(16)
-CLOSE SCRATCH FILES
4lEAL*4 FUNCTION GET ELEMENT
(13	)	MERGE PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
¦CLEAR ROWS
LSAM
-DRAW MIDDLE HORIZONTAL LINE
¦ERASE MIDDLE HORIZONTAL LINE
-ERASE VARIABLE LIST
•-SAM
¦GET NAME OF FILE
|-SAM
L0UILD PREFIX FILENAME
L-SAM
•-MERGE
-SAM
¦OPEN SCRATCH FILES
-FILE SET UP—>(15)
¦CHECK FOR SAME NAME VARIABLES
lSAM
¦READ NUMERICAL DATA—>(18)
-PUT ELEMENT
-DISPLAY VARIABLES
LSAM
-WRITE TO OUTPUT FILE—>(16)
-CLOSE SCRATCH FILES
LREAL*4 FUNCTION GET ELEMENT
Geo-EAS Programmer's Guide
3.1-22
April 1990

-------
(14	)	REPORT PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
-CLEAR ROWS
l-SAM
-DRAW MIDDLE HORIZONTAL LINE
-ERASE MIDDLE HORIZONTAL LINE
-ERASE VARIABLE LIST
l-SAM
¦GET NAME OF FILE
l-SAM
LfiUILD PREFIX FILENAME
LSAM
-FILE SET UP—>(15)
-LOAD ALL TOGGLE FIELDS
L-SAM
-DISPLAY CHOSEN VARIABLES
l-SAM
-INCREMENT VARIABLE TOGGLE POSITION
LSAM
OPEN SCRATCH FILES
-READ NUMERICAL DATA—>(18)
-REPORT
|-SAM
l-BUILD PREFIX FILENAME
l-SAM
LPRINT REPORT
l-SAM
¦CENTER FMT
lSAM
l-FMT BUILDER
4*EAL*4 FUNCTION GET ELEMENT
LCLOSE SCRATCH FILES
(15	)	FILE SET UP
-SAM
¦BUILD PREFIX FILENAME
LSAM
¦GET HEADER DATA
l-SAM
[•BUILD PREFIX FILENAME
LSAM
l-INPUT FORMAT CHECK
LCONVERT INT TO CHAR FORMAT
LLOAD ALL TOGGLE FIELDS
LSAM
(16	)	VRITE TO OUTPUT FILE
[-SAM
l-BUILD PREFIX FILENAME
j lsam
lREAL*4 FUNCTION GET ELEMENT
Geo-EAS Programmer's Guide
3.1-23
April 1990

-------
(17)	SORT PROMPTS
-SAM
-ERASE MESSAGE DIVIDER
¦CLEAR ROWS
LSAM
¦DRAW MIDDLE HORIZONTAL LINE
¦ERASE MIDDLE HORIZONTAL LINE
¦CLEAR ROWS
L-SAM
¦ERASE VARIABLE LIST
"-SAM
¦GET NAME OF FILE
|-SAM
•¦BUILD PREFIX FILENAME
LSAM
¦FILE SET UP—>(15)
¦LOAD ALL TOGGLE FIELDS
•-SAM
¦ERASE VARIABLE LIST
LSAM
¦DISPLAY VARIABLES
"-SAM
¦OPEN SCRATCH FILES
¦READ NUMERICAL DATA—>(18)
¦RANK VAR
l-PUT ELEMENT
l-QSORT
[*EAL*4 FUNCTION GET ELEMENT
LVRITE TO OUTPUT FILE—>(16)
LCLOSE SCRATCH FILES
(18)	READ NUMERICAL DATA
-SAM
¦BUILD PREFIX FILENAME
LSAM
k:lose scratch files
Library: SAM - Screen Access Management
3.1.8 Subroutine Descriptions
Following are each of the subroutines that appear in DATAPREP. The formal
arguments (if any) are described followed by the local variables and finally
a description of what the subroutine does. The local variables listed may
include global variables that are indicated as such. Further details of the
global variables are included in the DATAPREP.DEC file.
Geo-EAS Programmer's Guide	3.1-24	April 1990

-------
PROGRAM DATAPREP(MAIN MODULE)
Local Variables:
Main Menu - Variable containing the screen field name of the main menu.
Screen File - Variable containing the name of Dataprep's screen file which is
DATAPREP.SCR.
Menu Choice - Variable containing the user's menu option selection.
Heading - Variable containing a screen label.
Exit	- Logical indicating if it is okay to exit the program.
Get Yes No - A function vhich displays a question and returns a .true, or
.false, depending on the user's response to the displayed
question.
The main program performs the following:
Displays the intro screen. Displays the main menu and
executes the user's requests by calling the appropriate
subroutine.
SUBROUTINE APPEND (INFILEA, INFILEB, OUTFILEA,
Formal Arguments:
INFILEA
INFILEB
OUTFILEA
ERROR
EQUAL VAR
YES
ERROR, EQUAL VAR, YES)
-	Name of infile 1 which is the primary file.
-	Name of infile 2 which is appended to infile 1.
-	Name of output file which contains the appended files.
-	Logical set to .true, if processing cannot be performed.
-	Integer variable that returns the number of variables
that exist in both InfileA and InfileB.
-	If this logical is .true, than InfileB's data must be
read.
Local Variables:
NVAR	- Global variable that contains the number of variables
in InfileA.
NDATA	- Global variable that contains the number of data records in
InfileA.
NVAR2	- Global variable that contains the number of variables in
InfileB.
NDATA2	- Global variable that contains the number of data records in
InfileB.
INFIL	- Global variable that contains the name of the file to be
read.
OUTFIL	- Global variable that contains the name of the file to
which the data is saved.
TNDATA	- A temporary variable that contains the number of records to
be stored in the appended file.
INDEX	- A temporary variable used to determine the number of
variables to be stored in the appended file.
TARRAY	- Logical array used to indicate which variables appear in
both InfileA and InfileB.
VAR COUNT - Maintains the number of unique variables in the output
f ile.
- Global variable containing first record with sample data.
RECSKIP
Geo-EAS Programmer's Guide
3.1-25
April 1990

-------
This routine appends InfileB to InfileA and writes the results to OutfileA.
If an error should occur during processing then an error message is displayed
and the logical 'Error' is returned as .true..
SUBROUTINE APPEND PROMPTS
Local Variables:
MENU CHOICE
MENU
EQUAL VAR
INFILE1
INFILE2
0UTFILE1
INFIL
OUTFIL
contains the user menu selection.
contains the fieldname of the Append menu.
number of variables that exist in both Infilel and Infile2
simultaneously.
global variable that contains the name of the file to append to.
global variable that contains the name of the file to be
appended.
contains the name of the file whose contents are the appended
files.
global variable that contains the name of the Geo-EAS input data
file.
global variable that contains the name of the Geo-EAS output
data file.
This routine constructs the Append screen and displays the Append menu. The
user is prompted for a menu selection. The selection is then processed via
subroutine calls.
SUBROUTINE BUILD PREFIX FILENAME (FILE NAME)
Formal Argument:
FILE NAME - name of the file to which the prefix is affixed.
Local Variables:
PREFIX - global variable that contains the name of prefix to be affixed to
the file name.
PREFILE - global variable that contains the prefix + file name.
This routine concatenates a prefix to a filename. The filename is passed as a
parameter and the prefix is a global variable.
SUBROUTINE BUILD PREFIX SCRATCH FILENAME (FILE NAME)
Formal Arguments:
FILE NAME - Name of scratch file.
Local Variables:
PREFILE - Global variable that contains the scratch file prefix and file
name(scratch).
TFPREFIX - Global variable that contains the name of scratch file prefix.
This routine concatenates a prefix to a filename. The filename is passed as a
parameter and the prefix is a global variable.
Geo-EAS Programmer's Guide
3.1-26
April 1990

-------
SUBROUTINE CENTER FMT(COUNT, END COL, VI, CENTERLN)
Formal Arguments:
COUNT - index of global array Startcol (which contains the
indices of the global arrays Varnam and Units)
indicating first element to be right justified.
END COL - index of global array Startcol (vhich contains the
indices of the global arrays Varnam and Units)
indicating last element to be right justified.
VI	- logical that is true if Varnam element is to be right
justified, false if Units element is to be justified.
CENTERLN - array whose elements contain the justified text.
Local Variables:
VARNAM - global array containing the variable names.
STARTCOL - global array containing index numbers relating to Varnam or Units
elements.
UNITS - global array containing the unit description of each variable.
N	- is an index for the array Centerln.
This routine right justifies text within a character string giving the
appearance of a centered format in the 'Report' listing. The text right
justified is either a variable name from the global array Varnam or a
measurement description from the global array Units. The character string
becomes an element in the array Centerln.
SUBROUTINE CHECK CONSTANT INPUT OVERFLOV(CHOICE, ERROR)
Formal Arguments:
CHOICE - contains the name of the screen field from which to extract the
constant (floating point).
ERROR - logical which is set to true if the constant causes overflow.
Local Variable:
TMP INPUT - contains the constant value but as a character string.
This routine prompts the user for a constant value, extracts the value from
the screen field (the name of which is contained in 'Choice'), and checks that
value for numerical overflow in which case an error message is displayed and
'Error' is set to true.
SUBROUTINE CHECK FOR SAME NAME VARIABLES (ERROR, TNVAR, K)
Formal Arguments:
ERROR - logical that returns .true, if non-unique variable names exist.
TNVAR - total number of variables.
K - integer variable that indicates which error message to print.
This routine compares all the variable names contained in the global array
'Varnam' for non-unique names. If two variable names are non-unique then an
error message is displayed and 'Error' is returned .true..
Geo-EAS Programmer's Guide
3.1-27
April 1990

-------
SUBROUTINE CLEAR ROWS (FIRST, LAST)
Formal Arguments:
FIRST - Variable contains the rov to start clearing.
LAST - Variable contains the rov to end clearing.
This routine clears rows first through last but leaves the frame intact.
SUBROUTINE CLOSE SCRATCH FILES
This routine closes the scratch files called
ZZSCTCH1.FIL and ZZSCTCH2.FIL.
SUBROUTINE COLUMN EXTRACT PROMPTS
Local Variables:
MENU
MENU CHOICE
NVAR
NVAR2
VARDONE
VAR
TOGGLE FIELD -
INFIL
OUTFIL
RECSKIP
VARNAM
UNITS
FORMATS
VARNAM2
UNITS2
F0RMATS2
STARTCOL
contains the field name of the Column Extract menu,
contains the user's menu selection.
contains the number of variables in the Geo-EAS output data
f ile.
contains the number of variables in the Geo-EAS input data
file.
logical that is true if the Variable List option has been
exercised.
contains the variable(column) number of a variable to be
extracted.
contains the field name of the toggle field used to select the
visible
global variable that contains the name of the Geo-EAS input
data file.
global variable that contains the name of the Geo-EAS output
data file.
contains the number of the first sample data record in the
Geo-EAS input data file.
global array that contains the variable names.
global array that contains the measurement descriptions of
each variable.
global array that contains the output formats for each of the
variables.
same as 'Varnam' but is used as a temporary array,
same as 'Units' but is used as a temporary array,
same as 'Formats' but is used as a temporary array,
global array which maintains the variable(column) of the
variables to be extracted.
This routine extracts those variables (and sample data) selected by the user
and stores them in a Geo-EAS data file. This routine constructs the Column
Extract screen and displays the Column Extract menu. The user is prompted for
a menu selection which is then processed.
Geo-EAS Programmer's Guide
3.1-28
April 1990

-------
SUBROUTINE COMPRESS (OUTFILE, YES)
Formal Arguments:
OUTFILE - contains the name of the outfile.
YES - this logical is always .TRUE, due to a modification in the program.
Local Variables:
TMPNDATA - temporary variable used to maintain the number of records of the
file being compressed.
NVAR - global variable that contains the number of variables in the file
being compressed.
NDATA - global variable that contains the number of records of first the
input file and then the compressed file at the time it is written
to the output file.
This subroutine eliminates any duplicate records in an input file. The
resulting data is then written to the file whose name is stored in the
variable 'Outfile' . To use this subroutine the following requirements must be
satisfied:
1.)	the input file has been read in and the data structures containing the
varnames, formats and related samples have been initialized with the
input file data.
2.)	the 'Outfile' name has been entered and is not blank.
SUBROUTINE COMPRESS PROMPTS
Local Variables
MENU	- contains the field name of the Compress menu.
MENU CHOICE - contains the user's menu selection.
INFIL	- global variable that contains the name of the Geo-EAS input
data file.
OUTFIL	- global variable that contains the name of the Geo-EAS output
data file.
ERROR	- logical variable set to .true, if a fatal error occurs during
processing.
YES	- logical variable is always set to true. 'Yes' is used as a
parameter for the 'Compress' subroutine but due to revisions in
the Compress operations is set permanently true.
This routine constructs the Compress screen and displays the Compress menu.
The user is prompted for a menu selection which is then processed.
SUBROUTINE CONVERT INT TO CHAR FORMAT(FVIDTH,
+	FDECIMALS, COL)
Formal Arguments:
FVIDTH - width of the FORTRAN output format.
FDECIMALS - number of decimals to be included in the output format.
COL	- variable (column) identifier.
Geo-EAS Programmer's Guide
3.1-29
April 1990

-------
Local Variables:
VI	- temporary variable equivalent to Fdecimals.
F1	- temporary variable equivalent to Fvidth.
FORMATS - global array containing the output formats for each variable.
This routine converts the integer values in the variables Fvidth and Fdecimals
into a FORTRAN output format. This format is then inserted into the global
'Formats' array element corresponding to the variable indicated by 'Col'.
SUBROUTINE COPY FILE(OLDFILE, NEVFILE, RETURNCODE)
Formal Arguments:
OLDFILE - contains the name of the file from which to copy.
NEVFILE - contains the name of the file to copy to.
RETURNCODE - contains an integer value indicating if the command was
properly executed.
Local Variables:
PREFILE - contains the global variable Prefix + the Filename.
PROGRM	- a character array that contains the actual command line for DOS
to execute.
This routine executes the DOS command 'Copy' via a 'C' procedure called
SYSTEM. The copy command along with the old and new file name is entered into
a character array called Progrm.
SUBROUTINE COPY PROMPTS
Local Variables:
MENU	- contains the field name of the Copy menu.
MENU CHOICE - contains the user's menu selection.
ERROR	- logical variable set to .true, if a fatal error occurs during
processing.
This routine constructs the Copy screen and displays the Copy menu. The user
is prompted for a menu selection which is then processed. The subroutine
'Copy File' which is called from this routine, executes the DOS 'Copy'
command.
SUBROUTINE CREATE ID PROMPTS
Local Variables:
MENU	- contains the field name of the Compress menu.
MENU CHOICE - contains the user's menu selection.
INFIL	- global variable that contains the name of the Geo-EAS input
data file.
OUTFIL	- global variable that contains the name of the Geo-EAS output
data file.
ERROR	- logical variable set to .true, if a fatal error occurs during
processing.
IDVARNAM - contains the ID variable name 'Sequence .
UNIT	- contains the ID variable's measurements description.
Geo-EAS Programmer's Guide
3.1-30
April 1990

-------
IFORMAT	- contains the output format for the ID variable.
This routine constructs the ID Variable screen and displays the ID Variable
menu. The user is prompted for a menu selection which is then processed.
SUBROUTINE DELETE FILE(FILENAME, RETURNCODE)
Formal Arguments:
FILENAME - contains the name of the file to be deleted.
RETURNCODE - contains an integer value indicating if the command was properly
executed.
Local Variable:
PREFILE	- contains the global variable Prefix + the Filename.
This routine executes the DOS command 'Delete' via a 'C' procedure called
DELETE.
SUBROUTINE DELETE PROMPTS
Local Variables:
MENU	- contains the field name of the Delete menu.
MENU CHOICE - contains the user's menu selection.
ERROR	- logical variable set to .true, if a fatal error occurs during
processing.
TINFILE	- contains the name of the incoming Geo-EAS input data file.
This routine constructs the Delete screen and displays the Delete menu. The
user is prompted for a menu selection which is then processed. The subroutine
'Delete File' which is called from this routine, performs the deletion.
SUBROUTINE DIRECTORY PROMPTS
Local Variables:
MENU	- contains the field name of the Directory menu.
MENU CHOICE - contains the user's menu selection.
ERROR	- logical variable set to .true, if a fatal error occurs during
processing.
This routine constructs the Directory screen via a call to the 'Display
Directory Screen' and displays the Directory menu. The user is prompted for a
menu selection which is then processed. The subroutine 'List Directory' which
is called from this routine, executes the DOS 'Dir' command.
SUBROUTINE DISPLAY CHOSEN VARIABLES (COUNT)
Formal Arguments:
COUNT - Number of variable names to be displayed.
Geo-EAS Programmer's Guide
3.1-31
April 1990

-------
Local Variables:
VARNAM - Global character array containing the variable names.
STARTCOL - Global array that contains the index of the Varnam array to be
displayed on the screen.
ROW	- Row location to display variable name.
COL	- Column location to display variable name.
This subroutine displays the variable names indicated by the array Startcol.
Up to six names in a rov are displayed.
SUBROUTINE DISPLAY DIRECTORY SCREEN
Local Variables:
LABEL2 - contains screen labels.
LABEL3 - contains screen labels.
This routine constructs the Directory screen.
SUBROUTINE DISPLAY LIST SCREEN
Local Variables:
LABEL1 - contains screen labels.
LABEL2 - contains screen labels.
LABEL3 - contains screen labels.
This routine constructs the List screen.
SUBROUTINE DISPLAY PREFIX LABELS
Local Variables:
PREFIX - global variable that contains the name of the file name prefix.
TFPREFIX - global variable that contains the name of the scratch file
prefix.
This routine constructs the prefix box and displays the file name and scratch
file prefixes if any.
SUBROUTINE DISPLAY PRINT SCREEN
Local Variables:
Labell - contains screen labels.
Label2 - contains screen labels.
Label3 - contains screen labels.
This routine constructs the Print screen.
SUBROUTINE DISPLAY VARIABLES (COUNT)
Formal Arguments:
COUNT - Number of variable names to be displayed.
Geo-EAS Programmer's Guide
3.1-32
April 1990

-------
Local Variables:
VARNAM - Global character array containing the variable names.
ROW - Rov location to display variable name.
COL - Column location to display variable name.
This subroutine displays the variable names up to six in a rov.
SUBROUTINE DOS UTILITIES
Local Variables:
Menu Choice - Variable containing the user's option selection.
Menu	- Screen field name of menu.
Labell	- Variable containing a screen label.
This routine displays the DOS Utilities (vertical) menu and calls the
necessary routines related to the user's menu option selection.
SUBROUTINE DRAW MESSAGE DIVIDER
Local Variables:
PAGE	- this variable is always zero.
MIDDLE	- column number in which the divider line appears.
SVERT	- decimal code for the 'vertical line' character.
STDOVN	- decimal code for the lines that intersect similar to a 'T' .
DBOT	- decimal code for the lines that intersect similar to an inverted
'T' with two lines on the bottom.
FRCOLOR	- code for the color of the frame.
This routine draws the vertical message divider line directly after the
options listed on the screen for the DOS Utilities and File Operations menu.
SUBROUTINE DRAW MIDDLE HORIZONTAL LINE(MIDDLE)
Formal Arguments:
MIDDLE - this variable contains the row number of where the line is to be
drawn.
Local Variables:
PAGE - this variable is always zero.
SHORIZ - decimal code for the 'horizontal line' character.
CLEFT - decimal code for a character.
CRIGHT - decimal code for a character.
FRCOLOR - code for the color of the frame.
This routine draws a horizontal line from the left side of the main frame to
the right side of the main frame.
Geo-EAS Programmer's Guide
3.1-33
April 1990

-------
SUBROUTINE ERASE MESSAGE DIVIDER
Local Variables:
PAGE - this variable is always zero.
MIDDLE - column number in which the divider line appears.
SVERT - decimal code for the 'vertical line' character.
STDOWN - decimal code for the lines that intersect similar to a 'T'.
DBOT - decimal code for the lines that intersect similar to an inverted
'T' with two lines on the bottom.
FRCOLOR - code for the color of the frame.
This routine erases the vertical message divider line directly after the
options listed on the screen for the DOS Utilities and File Operations menu.
SUBROUTINE ERASE MIDDLE HORIZONTAL LINE(MIDDLE)
Formal Arguments:
MIDDLE - this variable contains the row number of where the line is to be
drawn.
Local Variables:
PAGE - this variable is always zero.
SHORIZ - decimal code for the 'horizontal line' character.
CLEFT - decimal code for a character.
CRIGHT - decimal code for a character.
FRCOLOR - code for the color of the frame.
This routine erases a horizontal line from the left side of the main frame to
the right side of the main frame.
SUBROUTINE ERASE VARIABLE LIST
This routine erases the variable display.
SUBROUTINE EXTRACT(ROW COUNT, I)
Formal Arguments:
ROW COUNT - The new row that the current row of samples (indicated by
position 'I') will be moved to.
I	- The current position of the row of samples.
Local Variables:
NVAR	- The number of variables.
J	- Variable(column) index.
VALUE	- Floating point value of a data sample.
This routine relocates the position of the case (row of samples) indicated by
'I' to the new position indicated by 'Row Count'.
Geo-EAS Programmer's Guide
3.1-34
April 1990

-------
SUBROUTINE FILE OPERATIONS
Local Variables:
MENU CHOICE - Variable containing the user's option selection.
MENU	- Screen field name of menu.
LABEL1	- Variable containing a screen label.
This routine displays the File Operations (vertical) menu and calls the
necessary routines related to the user's menu option selection.
SUBROUTINE FILE SET UP (ERROR, NVAR TEMP)
Formal Arguments:
ERROR	- Returns .true, if error occurs in opening or reading Geo-EAS
data file.
NVAR TEMP - Returns the number of variables in the Geo-EAS data file.
Local Argument:
INFIL - Global variable containing the name of the Geo-EAS input data file.
This routine prompts the user for a filename using the routine 'Get Name of
File'. If the file exists then a call to 'Get Data' reads the data. The
Variable box is cleared and the new variables are displayed. The appropriat
toggle fields are 're'loaded. If the file does not exist then a warning is
issued and control returned to the calling subroutine.
SUBROUTINE FMT BUILDER (COUNT, OPTION, END COL)
Formal Arguments:
COUNT - index of global array 'Varnam' indicating first element of row.
OPTION - logical that is true if observation number is to be included,
false if excluded.
END COL - index of global array (Varnam or Units) indicating last element
of row.
Local Variables:
FMT	- array containing the output format.
FORMATS - array containing the output format for each variable.
STARTCOL - array containing specific element indices for the Formats array.
J	- index counter for the array 'Fmt'.
VALUE - temporary variable that contains the integer value of the width
field of the format specifier in question.
This routine constructs the output format used in generating the 'Report'
lisring of variable samples. The format specifier contains specifiers for
to 4 variables since the 'Report' listing can generate up to 4 variables pe
line.
Geo-EAS Programmer's Guide
3.1-35
April

-------
SUBROUTINE GET DOS FILENAME(FIELDNAME,FILENAME,
+	ERROR,CHECK,OPTION)
Formal Arguments:
FIELDNAME - contains the name of the screen field to be accessed.
FILENAME - contains the name of the file to be accessed.
ERROR - logical that returns .true, if the file does not exist or if the
user does not vish to overwrite an existing output file.
CHECK - if 1 then a check, is performed for in input file, if 2 then a
check is performed for an output file.
OPTION - the option number represents the following DOS commands:
1: COPY
2: DELETE
3: PRINT
4: RENAME
5: LIST
Local Variables:
PREFILE - global variable that is assigned the prefix + filename during
the execution of the 'Build Prefix Filename' routine.
YES	- logical variable.
EXIST - logical that is .true, if the file in question exists.
This routine, at the user's option, copies, deletes, prints, renames or lists
the file specified by the user. The existence of the file is determined in
this routine.
REALM FUNCTION GET ELEMENT (DATA UNIT, COL,
+	INDEX, VARNUM)
Formal Arguments:
DATA UNIT - Scratch file number, i.e., 1 for infilel data, or 2 for infile2
data.
COL	- variable requested from infile.
INDEX - data item (sample data record) requested of 'Col'.
VARNUM - number of variables.
This routine reads a record from a scratch file and extracts the requested
variable designated by 'Col' and assigns to Get Element.
SUBROUTINE GET NAME OP FILE (FIELDNAME, FILENAME,
+	ERROR, CHECK)
Formal Arguments:
Fieldname - contains the name of the screen field to be accessed.
Filename - contains the name of the file to be accessed.
Error - logical that returns .true, if the file does not exist or if the
user does not wish to overwrite an existing output file.
Check - if 1 then a check is performed for an input file, if 2 then a
check is performed for an output file.
Geo-EAS Programmer's Guide
3.1-36
April 1990

-------
Local Variables:
Prefile - global variable that is assigned the prefix + filename during the
execution of the 'Build Prefix Filename' routine.
Yes	- logical variable.
Exist - logical that is .true, if the file in question exists.
This routine prompts the user for the name of the file. The existence of the
file is determined at this time.
SUBROUTINE GET HEADER DATA (FILE NAME, ERROR,
+	NVAR TEMP)
Formal Arguments:
FILE NAME - Name of Geo-EAS data file from which to extract data.
ERROR - Returns .true, if error occurs in opening or reading data.
NVAR TEMP - Contains number of variables in file.
Local Variables:
PREFILE - Global character string that contains the prefix + file name after
call to Build Prefix Filename routine.
MAXVAR - Global variable containing maximum number of variables permitted
in Dataprep.
VARNAM - Global character array containing variable names.
UNITS - Global character array containing measurement descriptions of each
variable.
FORMATS - Global character array containing output formats of each variable.
This routine reads the following data from a Geo-EAS data input file:
1.)	Title
2.)	Number of Variables in data file
3.)	Variable names
If an error occurs opening or reading the file then an error message is
displayed.
SUBROUTINE ID VAR (OUTFILE, UNIT, IDVARNAM,
+	IFORMAT, ERROR)
Formal Arguments:
Outfile - global variable contains the name of the Geo-EAS output data file.
Unit - contains the measurement description for the IDvarnam.
IDvarnam - contains the name of the ID variable, i.e., 'Sequence #'.
Iformat - contains the FORTRAN output format for the ID variable.
Error - logical is set to true if an error occurs during processing.
This subroutine performs the following:
1.) a new variable is inserted into the outfile along with all
the other variables from the input file. This new variable
is given the name specified in 'IDvarnam' which is
'Sequence #'. The new variable occupies the last position
with all related samples occupying the last column.
Geo-EAS Programmer's Guide
3.1-37
April 1990

-------
2.)	if this ID variable exceeds the maximum number of variables
specified by the constant 'MAXVAR' then 'Error' is set to
true and an error message is to that effect is displayed.
3.)	if the input file already has an 'Sequence if' then an error
message is displayed and processing is discontinued. It
is assumed that files containing an ID variable have the
ID variable in the last position.
4.)	the ID variable samples are initialized with values representing each
record number, i.e., sample 1=1, sample 2 = 2 and so on until the
last sample is reached which is equal to the value stored in 'Ndata',
the last record.
5.)	the resulting data is then written to the file whose name is stored
in 'Outfile'.
To use this subroutine the following requirements must have have been
satisfied:
1.)	'Outfile' has been entered and is not blank.
2.)	'Unit' has already been entered, may be blank.
3.)	'Iformat' has been entered and error checking performed.
SUBROUTINE INCREMENT VARIABLE TOGGLE POSITION (NAME, VAR, MAXTOG)
Formal Arguments:
NAME	- Name of the variable toggle field.
VAR	- Variable column number. Must be reduced by 1 to reflect the
position of that variable in the toggle field.
MAXTOG - Variable indicating the number of variables in infile.
Local Variable:
Position - The position of that the toggle field is to be set.
This subroutine increments the toggle position of the toggle field whose field
name is stored in 'Name'.
SUBROUTINE INIT PREFIX
Local Variables:
PREFIX - global variable that contains the name of prefix to be affixed to
the file name.
This routine initializes the global variable prefix to blanks.
SUBROUTINE INIT TFPREFIX
Local Variables:
Tfprefix - global variable that contains the name of prefix to be affixed to
the scratch file name.
This routine initializes the global variable prefix to blanks.
Geo-EAS Programmer's Guide
3.1-33
April 1990

-------
SUBROUTINE INPUT FORMAT CHECK(COL)
Formal Arguments:
COL	- contains an integer value that indicates the variable (column)
index.
Local Variables:
FUIDTH - contains the width field of the output format.
FDECIMALS - contains the decimal field of the output format.
FORMATS - global array that contains the output formats for each variable.
ClfC2,C3 - temporary variables that contain one character each.
This routine checks if the format listed in the input file is acceptable. The
acceptable formats are 'F' or 'G' where the width field is not greater than 15
and the decimal positions is not greater than 1. The width field cannot fall
below (decimal positions + 1) and the decimal positions cannot fall below 0.
If they do then the default format of G15.7 is used.
SUBROUTINE INTRO SCREEN
This routine displays the Introduction screen and prompts the user to press
any key when finished reading the Intro.
SUBROUTINE LIST DIRECTORY(RETURNCODE)
Formal Argument:
RETURNCODE - contains an integer value indicating if the command was properly
executed.
Local Variables:
DOSCOM - global variable which contains the directory.
PROGRM - a character array that contains the actual command line for DOS
to execute.
This routine executes the DOS command 'Dir' via a 'C' procedure called SYSTEM.
The Directory command along with the directory is entered into a character
array called Progrm.
SUBROUTINE LIST FILE(FILENAME, RETURNCODE)
Formal Arguments:
FILENAME - contains the name of the file to list.
RETURNCODE - contains an integer value indicating if the command was properly
executed.
Local Variables:
PREFILE - contains the global variable Prefix + the Filename.
PROGRM - a character array that contains the actual command line for DOS
to execute.
Geo-EAS Programmer's Guide
3.1-39
April 1990

-------
This routine executes the DOS command 'More' via a 'C' procedure called
SYSTEM. The More command along with the file name is entered into a character
array called Progrm.
SUBROUTINE LIST PROMPTS
Local Variables:
Menu	- contains the field name of the List menu.
Menu Choice - contains the user's menu selection.
Error	- logical variable set to .true, if a fatal error occurs during
processing.
This routine constructs the List screen, via a call to the subroutine 'Display
List Screen', and displays the List menu. The user is prompted for a menu
selection which is then processed. The subroutine 'List File' which is called
from this routine, executes the DOS 'More' command.
SUBROUTINE LOAD ALL TOGGLE FIELDS(COUNT)
Formal Argument:
COUNT - contains the number of variable names to be loaded.
Local Variables:
VT0GGLE1 - contains the name of the toggle field in the Dataprep.scr file.
VARNAM - global character array containing the variable names to be loaded.
This routine loads the variable names into the corresponding toggle fields.
SUBROUTINE MERGE (INFILEA, INFILEB, OUTFILEA)
Local Variables:
INFILEA - contains the name of file to be merged. It is the primary file.
INFILEB - contains the name of the file to be merged with InfileA.
OUTFILEA - contains the name of the file whose contents are InfileA and
InfileB merged.
INFIL	- global variable that contains the name of the Geo-EAS input
data file.
OUTFIL - global variable that contains the name of the Geo-EAS output
data file.
SAME VAR - contains the number of variable names that appear in both
InfileA and InfileB.
NEV NVAR - contains the number of variables that are in the Geo-EAS output
data file.
COMMON VAR - logical is true if the variable name appears in both InfileA
and InfileB.
ERROR	- logical is true if a file could not be accessed or read, or if
non-unique variable names appear in the same file.
TNDATA - contains the number of sample data records in the Geo-EAS
output data file.
VAR COUNT - contains the number of variables that are to stored into Geo-EAS
output data file.
Geo-EAS Programmer's Guide
3.1-40
April 1990

-------
NDATA	- global variable that stores the number of sample records in
InfileA, i.e., file 1. This value is assigned in the subroutine
READ NUMERICAL DATA.
NDATA2 - global variable that stores the number of sample records in
InfileB, i.e., file 2.
FILE2ST - stores the record number at which to start with when adding
InfileB(file 2) records to InfileA(file 1).
FILE2REC - stores the current record number being extracted from Scratch
File 2 (InfileB's contents).
This routine merges the two files, INFILEA and INFILEB, and stores the results
into OUTFILEA.
SUBROUTINE MERGE PROMPTS
Local Variables:
MENU
MENU CHOICE
INFIL
OUTFIL
ERROR
INFILE1
INFILE2
0UTFILE1
-	contains the field name o
-	contains the user's menu
-	global variable which con
-	global variable which con
-	logical which is true if
accessed.
-	global variable which con
data file to be merged wi
-	global variable which con
data file to be merged wi
-	global variable which con
data file whose contents
f the Merge menu,
selection.
tains the Geo-EAS input data file,
tains the Geo-EAS output data file,
a Geo-EAS data file cannot be
tains the name of the Geo-EAS input
th Infile2.
tains the name of the Geo-EAS input
th Infilel.
tains the name of the Geo-EAS output
are the merged Infilel and Infile2.
This routine constructs the Merge screen and displays the Merge menu. The
user is prompted for a menu selection. The selection is then processed.
SUBROUTINE OPEN SCRATCH FILES
Local Variable:
File Name - contains a scratch file name.
This routine opens two scratch files called,
ZZSCTCH1.FIL and ZZSCTCH2.FIL.
The routine 'Build Prefix Scratch Filename' affixes the scratch file prefix
(if any) to a scratch file name and assigns this new name to the global
variable 'Prefile'. The prefix is contained in the global variable 'Tfprefix'
and does not appear in this routine.
Geo-EAS Programmer's Guide
3.1-41
April 1990

-------
SUBROUTINE PREFIX OPERATION
Local Variables:
FILE NAME - contains the name of the scratch file.
CHOICE - contains the field name of a screen field.
PREFIX - global variable that contains the name of the file name prefix.
TFPREFIX - global variable that contains the name of the scratch file
prefix.
PREFILE - global variable that contains the prefix plus the name of the
file. This applies to both the Prefix and the Tfprefix.
This routine prompts the user for two prefixes, a file prefix and a scratch
file prefix. The scratch file prefix is tested for validity and displays any
error messages.
SUBROUTINE PRINT FILE(FILENAME, RETURNCODE)
Formal Arguments:
FILENAME - contains the name of the file to print.
RETURNCODE - contains an integer value indicating if the command was properly
executed.
Local Variables:
PREFILE - contains the global variable Prefix + the Filename.
PROGRM - a character array that contains the actual command line for DOS
to execute.
This routine executes the DOS command 'Print' via a 'C' procedure called
SYSTEM. The Print command along with the file name is entered into a
character array called Progrm.
SUBROUTINE PRINT PROMPTS
VARIABLES:
MENU	- contains the field name of the Print menu.
MENU CHOICE - contains the user's menu selection.
ERROR	- logical variable set to .true, if a fatal error occurs during
processing.
This routine constructs the Print screen via a call to 'Display Print Screen'
and displays the Print menu. The user is prompted for a menu selection which
is then processed. The subroutine 'Print File' which is called from this
routine, executes the DOS 'Print' command.
Geo-EAS Programmer's Guide
3.1-42
April 1990

-------
SUBROUTINE PRINT REPORT (COUNT, END COL, OPTION,
+	PAGE, RESULT,REMAINDER)
Formal Arguments:
COUNT - index of global array Startcol (which contains the indices of
the global arrays Varnam and Units) indicating first element on a
variable line.
-	index of global array Startcol (which contains the indices of
the global arrays Varnam and Units) indicating last element on a
variable line.
-	logical which is true is sequence option is 'on'.
-	contains the current page number.
-	contains the result of (the number of variables to be included
in the 'Report' listing divided by 4) and is used to determine if
a full row of variables(4) exists.
REMAINDER - contains the remainder of (the number of variables to be included
in the 'Report' listing divided by 4) and is used to determine if
a partial row of variables(4) exits.
END COL
OPTION
PAGE
RESULT
Local Variables:
VARNAM - global array containing the variable names.
STARTCOL - global array containing index numbers relating to Varnam or Units
elements that are to be in the 'Report' listing.
UNITS - global array containing the measurement description of each
variable.
TLNCT - contains the total number of lines (sample data) thus processed.
LNCOUNT - contains the current line number (sample data) of the page of the
'Report' listing.
LINES - maximum number of records permitted on a 'Report' page.
FMT	- global character array that contains the output format used in
the 'VRITE' statement.
VI	- logical that is true if Varnam element is to be right justified,
false if Units element is to be justified.
CENTERLN - global variable that contains either the right justified variable
names or measurement descriptions.
This routine writes the 'Report' listing to the output file using a specified
format.
SUBROUTINE PUT ELEMENT (DATA UNIT,COL,INDEX,
+	VARNUM,VALUE)
Format Arguments:
DATA UNIT - Unit number of scratch file.
COL	- variable requested from infile.
INDEX - data item requested of 'Col'.
VARNUM - number of variables.
VALUE - sample datum replacement.
This routine replaces a sample datum into a scratch file with the variable
'Value' .
Geo-EAS Programmer's Guide
3.1-43
April 1990

-------
SUBROUTINE RANK VAR(COL, OUTFILE)
Formal Arguments:
COL - this integer value represents the position (element) of the
specified variable to be sorted. It must contain the position when
passed to this subroutine.
OUTFILE - this variable contains the name of the output file to which the
processed data is to be written. It also must contain a filename
and cannot be blank.
Local Variables:
A1	- a real array which stores the sample data of the variable to be
sorted.
P	- an integer array which stores the original positions of
corresponding sample datum.
NVAR - global variable which contains the number of variables in the
file.
NDATA - global variable which contains the number of sample records
contained in the file.
VALUE - temporary variable that contains the a sample datum.
This routine sorts a specified variable in the order of low to highest. The
corresponding data record for that ordered variable is then written to the
specified output file in that order. Any missing values found in the
specified variable are placed at the end of the list. The corresponding
records associated with these missing values, although placed at the end, are
presented in the order as originally encountered in the input file, i.e., if
record 32 contained a missing value in the specified variable and the next
missing value of the specified variable appeared in record 40 then these
records would appear at the end of the listing with record 32 immediately
preceding record AO. The input file must have already been read and the data
structures such as 'Data', 'Varnam', and the variables Nvar and Ndata
ini tialized.
SUBROUTINE READ NUMERICAL DATA (UNITNMBR,FILENAME,
+	NVAR TEMP,NVAR FILE,ERROR,RECSTART)
Formal Arguments:
UNITNMBR - unit number represents the 'data' matrix simulated by scratch
file, Unit number = 1 for 'datal' and Unit number = 2 for 'data2'.
FILENAME - Name of file from which to read data.
NVAR TEMP - number of variables in Geo-EAS input data file.
NVAR FILE - number of variables to be contained in the Scratch File.
ERROR - logical that is .true, if a data file could not be accessed or
read from or if a Scratch File could not be written.
RECSTART - global variable, contains the number of the first record that
contains sample data.
Geo-EAS Programmer's Guide
3.1-44
April 1990

-------
Local Variables:
PREFILE - global variable, contains the filename preceded by a path if the
path was specified.
INFIL - global variable, contains the filename only, no path.
NDATA - global variable, contains the number of samples in the file.
VECT0R48 - global variable, declared as 'real*4 Vector48(48)'.
Reads in only the samples of the variables from the Geo-EAS input data file
whose name is contained in 'Filename', and contains this data to the Scratch
File specified by the 'Unitnmbr'. The Unit number, Infil, Nvar temp, Ndata,
Recskip must have been specified.
SUBROUTINE READ SYSTEM DEFAULTS
Local Variables:
PREFIX - global variable that contains the name of the Geo-EAS data file
prefix.
INFIL - global variable that contains the name of the Geo-EAS
input data file.
This routine reads in a Prefix name and an Input File name (if they exist)
from a 'GEOEAS.DEF' file (if it exists) and assigns these names to the
corresponding variables (character strings).
SUBROUTINE RENAME FILE(OLDNAME, NEWNAME, RETURNCODE)
Formal Arguments:
OLDNAME - contains the name of the file to be renamed.
NEWNAME - contains the new file name.
RETURNCODE - contains an integer value indicating if the command was properly
executed.
Local Variables:
PREFILE - contains the global variable Prefix + the Oldname then contains
the Prefix + the Newname.
This routine executes the DOS command 'Rename' via a 'C' procedure called
RENAME.
SUBROUTINE RENAME PROMPTS
Local Variables:
MENU	- contains the field name of the Rename menu.
MENU CHOICE - contains the user's menu selection.
ERROR	- logical variable set to .true, if a fatal error occurs during
processing.
TINFILE - contains the name of the incoming Geo-EAS input data file.
This routine constructs the Rename screen and displays the Rename menu. The
user is prompted for a menu selection which is then processed. The subroutine
'Rename File' which is called from this routine, executes the DOS 'Rename'
command.
Geo-EAS Programmer's Guide
3.1-45
April 1990

-------
SUBROUTINE REPORT (TNVAR, OPTION)
Formal Arguments:
TNVAR - contains number of variables in the 'Report' listing.
OPTION - logical vhich is true is sequence option is 'on'.
Local Variables:
COLUMNS
REMAINDER
RESULT
COUNT
FULL ROW
PARTIAL ROW
PAGE
END VAR
maximum number of variables(4) permitted on one page.
contains the remainder of Tnvar/Columns and is used to
determine if a partial row of variables(4) exits.
contains the result of Tnvar/Columns and is used to
determine if a full row of variables(4) exists.
counter that reflects the index of the first variable that
appears on a page of the 'Report' listing.
logical that is true if four variables are to appear on a
page.
logical that is true if less than four variables are to
appear on a page.
contains the current page number of the 'Report' listing,
contains the column number of the variable to appear last on
the variable names line.
This routine determines the number of variables to be printed on one page
(maximum: 4) as well as the number of records (maximum: 50) based on the
information obtained in the subroutine 'Report Prompts'. A call to 'Print
Report' is made where the 'Report' listing is then written to the output file
using a specified format.
SUBROUTINE REPORT PROMPTS
Local Variables:
MENU
MENU CHOICE
TINFILE
YES
ERROR
VARDONE
NVAR
contains the field name of the Report menu,
contains the user's menu selection.
contains the incoming Geo-EAS data output file name. This file
name then replaces the 'Report' output file (which is not a
Geo-EAS data output file name).
logical variable used to indicate if the user wishes to add
another variable to the 'Report' listing.
logical variable set to .true, if a fatal error occurs during
processing.
logical variable set to .true, if the 'Variables'menu option has
been selected.
global variable that contains the number of variables.
This routine constructs the Report screen and displays the Report menu. The
user is prompted for a menu selection which is then processed. The 'Report'
subroutine which constructs the 'Report' listing is called from this routine.
Geo-EAS Programmer's Guide
3.1-46
April 1990

-------
SUBROUTINE ROW EXTRACT(OPERATOR, CONSTANT,
+	VARIABLE,VALUE, OP1 VAR, OP2 VAR)
Formal Arguments:
OPERATOR	-	contains the integer value corresponding to a specific operator.
CONSTANT	-	logical that is true if Operand 2 is a constant (floating pt).
VARIABLE	-	logical that is true if Operand 2 is a variable.
VALUE	-	floating point value of Operand 2(if Operand 2 is a constant).
0P1 VAR	-	variable(column) index of Operand 1 variable.
0P2 VAR	-	variable(column) index of Operand 2 variable.
Local Variable:
ROV COUNT - number of rows of data that satisfy the relational expression.
The global variable 'Ndata' is assigned this value.
This routine extracts rows based on the relational expression
passed by the calling subroutine.
SUBROUTINE ROW EXTRACT PROMPTS
Local Variables:
VARDONE
CONST FIELD
0P1 VAR
OPERATOR
0P2 VAR
ERROR
ERROR1
CONSTANT
VARIABLE
C0NSTANT1
MENU
MENU CHOICE
logical which is true if the Variables List option has been
accessed.
contains the name of a constant field.
contains the variable (column) index of the variable selected
from the toggle field to be Operand 1.
contains the operation indicator selected in the toggle field,
contains the variable (column) index of the variable selected
from the toggle field to be Operand 2.
logical which is set to true if an error occurs during any step
of this routine except for numerical overflow.
logical which is set to true if a numerical overflow occurs upon
entering a constant value.
logical which is true if 2nd operand is a constant,
logical which is true if 2nd operand is a variable,
contains the constant value specified by the user,
contains field name of Row Extract menu,
contains menu option selection.
This routine prompts the user for those variables that are to be extracted
from the Geo-EAS input data file and stored in the Geo-EAS output data file.
SUBROUTINE SET DOSCOM BLANK
Local Variable:
DOSCOM - Global variable that contains the DOS command entered
by the user.
This routine inserts white space into the global variable 'Doscom'
Geo-EAS Programmer's Guide
3 -1-47
April 1990

-------
SUBROUTINE SET FILENAME BLANK(FIELDNAHE)
Formal Argument:
FIELDNAME - contains the name of the screen field to be accessed.
Local Variable:
BLANK - character string of blanks.
This routine sets the field of the named screen field blank.
SUBROUTINE SORT PROMPTS
Local Variables:
MENU CHOICE - contains the name of the menu option selected by the user.
MENU	- contains the field name of the Sort menu.
VARDONE - logical that is .true, if the Variable option vas accessed.
ERROR	- logical that is .true, if an operation could not be
performed such as accessing or reading a file.
VAR	- contains the column number of the variable selected by the user.
RECSKIP - contains the number of the 1st record in the Geo-EAS data file
that contains sample data.
INFIL	- global variable contains the name of the Geo-EAS input data
file.
OUTFIL	- global variable that contains the name of the Geo-EAS output
data file.
This routine constructs the Sort screen display and menu, prompts the user for
a menu selection, and then processes that selection by calling the appropriate
subroutines.
SUBROUTINE SYSTEM COMMAND
Local Variables:
RETURNCODE - contains an integer value indicating if the command was properly
executed but is not returned to the calling program.
PROGRM - a character array that contains the command, line for DOS to
execute.
This routine executes the command 'Command' via a 'C' procedure called SYSTEM.
Once this command is executed, the user is in DOS. The user can return to
DATAPREP by entering 'exit'.
SUBROUTINE WRITE SYSTEM DEFAULTS
This routine writes out a Prefix name and an Output File name to the
'GEOEAS.DEF' file.
Geo-EAS Programmer's Guide
3.1-48
April 1990

-------
SUBROUTINE VRITE TO OUTPUT FILE
Local Variables:
OUTFIL - This variable contains the name of the Geo-EAS output data file.
EXIST - Logical that indicates if file exists.
FORMATS - Global character array containing the output format of each
variable.
FMT	- Global character array which is used as a format specifier for
sample data output.
NVAR - Global variable containing the number of variables.
VECT0R48 - Global array which contains up to 48 real values.
This subroutine prompts the user for the name of an output file. If the file
does not exist, one is opened. The data is then written to that output file.
The source of the info for the output file is as follows:
Varnam - global character array of the variable names.
Units - global character array of the measurement units.
Formats - global character array of output formats.
Scratch File 1 contains the sample data.
Geo-EAS Programmer's Guide
3.1-49
April 1990

-------
3.2
TRANS
3.2.1	Software Function
TRANS was designed to perform operations on Geo-EAS data file variables.
Refer to the section on Geo-EAS data files for more information on input data.
The operations may be unary (one operand, one operator), binary (two operands,
one operator), or a transform indicator. An operand may be either a variable
or a constant. The operator maybe an operation, such as addition or finding
the square root. The results generated by the specified operation may replace
the contents of an existing variable or a new variable may be created. The
variable specified to accept the results is called the result variable.
Missing values may be generated in two circumstances: when an operand is a
missing value, or when an operation is undefined (as in division by zero).
3.2.2	Global Variables/Program Limits
TRANS reads as well as generates Geo-EAS data files containing a maximum of 48
variables and 10,000 samples. If a file should contain more than 10,000
samples then only the first 10,000 samples are read and processed.
The following is a description of the global variables used in TRANS. The
format is extracted from the declaration file TRANS.DEC. The variable
description and the common block declaration follows.
*******************************************************
C PARAMETERS:
C MAXDATA - maximum number of data (sample) records permitted.
C MAXVAR - maximum number of Variables permitted.
PARAMETER (MAXDATA = 10000)
PARAMETER (MAXVAR = 48)
IMPLICIT INTEGER*4 (A-Z)
C***************************************************************
C Rawdat (name of common block) - temporary vector.
C VARIABLE:
C VECT0R48 - contains a record of sample data.
COMMON /rawdat/ VECT0R48
REAL*4	VECT0R48 (MAXVAR)
Geo-EAS Programmer's Guide
3.2-1
April 1990

-------
c***************************************************************
C Vname (name of common block.) - declarations to support the
C Variable names and related data.
C VARIABLES:
C VARNAM - array that contains all Variable names.
C UNITS - array that contains measurement descriptions for each Variable.
C FORMATS - array that contains output formats for each Variable.
C FMT - array that contains the format specifier for the Variables.
C RECSKIP - contains the number of the first record that contains sample data.
C NDATA - contains the number of records (with sample data) in the Geo-EAS
data file.
C NVAR - contains the number of Variables in the Geo-EAS data file.
COMMON /Vname/ VARNAM, UNITS, FORMATS, FMT, RECSKIP,
NDATA, NVAR
CHARACTER*10 VARNAM (MAXVAR), UNITS (MAXVAR)
CHARACTER*6 FORMATS (MAXVAR)
CHARACTER*480 FMT
INTEGER*^	RECSKIP, NDATA, NVAR
£***************** ********************* *** ****** ** *x* -k *** **** * **
C Miss (name of common block) - Missing value.
C VARIABLE:
C MISSING - contains the missing value.
COMMON /Miss/ MISSING
REAL*4	MISSING
c***************************************************************
C Ifname (name of common block) - Geo-EAS input data file name.
C VARIABLE:
C INFIL - contains the Geo-EAS input data file name.
COMMON /Ifname/ INFIL
CHARACTER	INFIL*14
C***************************************************************
C Ofname (name of common block) - Geo-EAS output data file name.
C VARIABLE:
C OUTFIL - contains the Geo-EAS output data file name.
COMMON /Ofname/ OUTFIL
CHARACTER	0UTFIL*14
C***************************************************************
C Titl (name of common block) - Title for graphs.
C VARIABLE:
C TITLE - contains the title description of the Geo-EAS data file.
COMMON /Titl/ Title
CHARACTER	TITLE*70
Geo-EAS Programmer's Guide
3.2-2
April 1990

-------
0***************************************************t******x****
C Flags (name of common block) - Operand flags
C VARIABLES:
c
B1VFLAG -
.true.
if
c
B2VFLAG -
.true.
if
c
B1CFLAG -
.true.
if
c
B2CFLAG -
.true.
if
c
UOVFLAG -
.true.
if
c
UOCFLAG -
.true.
if

COMMON /Flags
/
LOGICAL*!
is
is
is
is
a variable,
a variable,
a constant,
a constant.
UOCFLAG
B1VFLAG,B2VFLAG,B1CFLAG,B2CFLAG,UOVFLAG,
UOCFLAG
Q ****************************************** ****************•*:**~*
C Mflag (name	of common block) - Miscellaneous flags necessary in
C processing.
C VARIABLES:
C NEWVAR -	.true,	if result variable is new.
C BOPERATOR -	.true,	if operation is binary.
C UOPERATOR -	.true,	if operation is unary.
C OLDVAR -	.true,	if result variable already exists.
C CALCOMP -	.tru .	if calculation has been completed.
C NOINFILE -	.true,	if a Geo-EAS input data file has not been accessed.
COMMON /Mflag/	NEVVAR,BOPERATOR,UOPERATOR,OLDVAR,CALCOMP,
+	NOINFILE
L0GICAL*1	NEWAR, BOPERATOR, UOPERATOR, OLDVAR, CALCOMP,
+	NOINFILE
C***************************************** ********** *********"***
C Tmpvar (name of common block) - Declarations to support a
temporary Variable and related
data.
C VARIABLES:
C TMPDATA - temporary array that contains samples for one
Variable.
C TUNITS - contains measurement description of temporary
Variable.
C TMPVNAM - contains name of temporary Variable.
C FVIDTH - contains width field for the output format of a
Variable.
C FDECIMALS - contains decimal field for the output format of a
Variable.
COMMON /Tmpvar/ TMPDATA, TUNITS, TMPVNAM, FVIDTH, FDECIMALS
CHARACTER*10 TMPVNAM, TUNITS
REAL*4	TMPDATA (MAXDATA)
INTEGER*4	FVIDT , FDECIMALS
Geo-EAS Programmer's Guide
3.2-3
April 1990

-------
c******************* ********************************************
C Calcfl (name of common block) - Calcflag for determining if
Nevvar has nev data. The
logical Intro is included in
determining if the Intro screen
is to be displayed.
C VARIABLES:
C MEWDATA - true if new data has been generated and not yet saved
to a Geo-EAS output data file.
C INTRO - If .TRUE, then the Intro screen is to be displayed.
COMMON /Calcfl/ NEVDATA, INTRO
LOGICAL*1	NEVDA A, INTRO
C Pref (name of common block.) - Prefix to file names and the scratch file.
C VARIABLES:
C PREFILE - contains the Prefix affixed to the file name or the
Tfprefix affixed to the scratch file.
C PREFIX - contains the prefix to a file name.
C TFPREFIX - contains the prefix to the scratch file.
COMMON /Pref/	PREFIX, PREFILE, TFPREFIX
CHARACTER*77	PREFILE
CHARACTER*55	PREFIX
HARACTER*55	TFPREFIX
Geo-EAS Programmer's Guide
3.2-4
April 1990

-------
3.2.3 Data Flov and Processing
Data Flov Diagram
Geo-EAS
Input Data
file
User
Input
GZOEAS.SEF
(Syste*
Defaults
File)
File Inputs
TRAMS requires a Geo-EAS Data File for
File, if one exists, for an input file
input. TRANS r=ads the System Default
name and a Iname prefix.
Geo-EAS Programmer's Guide
3.2-5
April 1990

-------
3.2.4 User Interface
The Screens
TRAMS displays tvo screens, an Intro screen and a air. screen. The Intro
screen is defined as Screen 1 in the TRANS.SCR file and the Main screen is
defined as Screen 2. The Intro screen displays a brief intro and no menu
options. The Main screen is the only screen from which the user interacts
vith TRANS.
The menus that appear on the screen are presented beiov along vith the menu
name and the related screen field name (in parentheses) that is used in the
TRANS.SCR file.
The Main menu (ME MAIN):
Prefix Read Title Create Delete Save Quit
The Create menu (MECMAIN):
Nev Variable Old Variable Quit
The Operation menu (MEUBMAIN):
Unary Operation Binary Operation Indicator Transform Quit
The Unary Operand menu (MEUVMAIN):
Constant Variable Quit
The Unary Operation menu (MEUSMAIN):
Operations Quit
The Execute menu (MEUCALC):
Execute Quit
The Binary Operand One menu (ME3VMAIN1):
Constant Variable Quit
The Binary Operation menu (MEBSMAIN):
Operations Quit
The Binary Operand Tvo menu (MEBVMAIN2):
Constant Variable Quit
The Indicator Transform menu (INDTMENU):
Variable Execute Quit
Geo-EAS Programmer's Guide
3.2-6
April 1990

-------
The Menu Hierarchy
The menu hierarchy appears as follows:
Trans	Prefix
Read
Title
Create	JJew Variable	Unary Operation	->
I I
Old Variable—/ |Binary Operation ->
I
[Indicator Transform ->
| Quit
Delete
Save
\Quit
\Quit
-> Unary Operation	Operation	Constant	Execute
I	I I
|Variable—/ \Quit
I
\Quit
\Quit
-> Binary Operation	Constant	Operation	Constant	Execute
Variable—/
\Quit
\Quit
•> Indicator Transform	Variable—Cutoff
IVariable—/ \Quit
I
\Quit
| Execute
I
\Quit
Geo-EAS Programmer's Guide
3.2-7
April 1990

-------
Global Variable/Screen Field Relationships
The fields on the screen have associated screen field names in the TRANS.SCR
file. Some of these fields have their contents assigned to a global variable
and others are assigned to local variables. This becomes evident upon exami-
nation of the source code and comments. The screen fields (described by the
screen label), their associated field names (used in TRANS.SCR file; the
field type is enclosed in parentheses), and the related global variable name
are listed below. The labels are divided into five sections: General, Binary
Operation, Unary Operation, Delete and the Indicator Transform. The Main
screen preceding this discussion should be used for a reference.
SCREEN
LABEL
FIELD NAME
(TRANS.SCR)
GLOBAL VARIABLE (If not global
then 'Local' is entered.)
General
Data File Prefix	PREFIX	(char)
Scratch File Prefix TFPREFIX	(char)
Input File	INFILE	(char)
Output File	OUTFILE	(char)
Title	TITLE	(char)
Result Variable	SVARIABLE	(toggle)
(See Note 1)	NEW VAR	(char)
or
PREFIX
TFPREFIX
INFIL
OUTFIL
TITLE
Local
TMPVNAM
Binary Operation
Operand 1
Operator
Operand 2
B OPERANDI
BOP1CONST
BINARY
B 0PERAND2
B0P2C0NST
(toggle)
(real)
(toggle)
(toggle)
(real)
or
or
Local
Local
Local
Local
Local
Unary Operation
Operator
Operand
UNARY	(toggle)
U OPERAND (toggle)
UOPERCONST (real)
or
Local
Local
Local
Indicator Transform
Operand 1
Operand 2
I OPERAND
CUTOFF
(toggle)
(real)
Local
Local
(continued)
Geo-EAS Programmer's Guide	3.2-8	April 1990

-------
SCREEN
LABEL
FIELD NAME
(TRANS.SCR)
GLOBAL VARIABLE (If not global
then 'Local' is entered.)
Delete Operation
Delete Variable	DVARIABLE	Local
(See Note 2)
Note 1 - The Result Variable does not have a label but is located on the left
hand sided of the ' = ' sign. -The Result Variable can be selected from
a toggle field or existing variable names or specified with a new
name by entering of a character string.
Note 2 - The Delete Variable does not have a label but is located in the same
position as the Result Variable.
3.2.5 Processing
The following is a discussion on the general approach used in processing the
user's menu selection. Specific details are not presented here. Further
understanding of the processing can be achieved by reading the comments in the
source code. Pseudocode for the overall process is resented at the end of
this discussion. Processing is structured along the lines of the menu
hierarchy. Subroutines that display the menus also process the user's menu
selection using IF THEN ELSEIF statements. Some menu options are processed
within the IF THEN ELSEIF block while others are processed in individual
subroutines.
In regards to the screen display only one area of the Main screen changes its
labels (headings) and that is the 'Operation' box where the mathematical
equation (transformation) is displayed. Changes to these headings are made
within the subroutines themselves and not by displaying a new screen as would
be done by calling the subroutine SET SCREEN.
The subroutine calling structure is similar to the layering of the menu
hierarchy. For example, the Main menu is displayed by the Main program. A
specific menu selection results in a call to another subroutine which displays
a sub-level menu. The sub-level menu selection is then processed by another
subroutine. Numerous checks have been inserted to prevent TRANS from termi-
nating abnormally. Error checks are performed when reading data files and
when the user enters data.
In regards to the processing of user specified transformations, logical flags
are used to indicate the operation type (such as binary) and the operand type
(constant, variable). The subroutine PROCESS processes the transformation
depending on how the logical flags are set and 'gets' the operands and
operator specified in the scr en fields. Two operations can cause numeric
overflow and subsequent abnormal termination of TRANS. These operations are
as follows:
Geo-EAS Programmer's Guide
3.2-9
April 1990

-------
Unary operation	- (exp) computing e to the power of X
where	X is an operand.
Binary operation	- (**) raising XI to the power of X2
where	both XI and X2 are operands.
The data from the Geo-EAS data file is stored both internally (in the program
using arrays) and on disk using the scratch file (discussed below). The
variable names, measurement descriptions and output formats are stored in
global character arrays (Varnam, Units, Formats). The sample data is stored
in the scratch file. An index number representing the column (the column in
which the variable's sample data appears in the Geo-EAS data file) of a
variable is used to access the character array elements corresponding to the
variable. This same index is used in the function (GET ELEMENT) and sub-
routine (PUT ELEMENT) calls made to access sample data from the scratch file.
TRANS uses temporary file called a scratch file to store the sample data
read from a Geo-EAS data file. The temporary file is called ZZSCTCH1.FIL.
The Read option in the Main menu reads the Geo-EAS data file and stores the
data in the temporary file. Each time an operation is performed, the required
data is retrieved from the temporary file and the newly generated data is
stored in the temporary file. A list of variable names is displayed on the
screen to indicate which variables reside in the scratch file. If a variable
is deleted using the Delete option from the Main menu, then that data is
deleted from the temporary file. The variable name is also deleted from the
screen. The Save option from the Main menu is used to move the data from the
temporary file to the specified Geo-EAS output data file.
The following pseudocode represents the general flow of processing in TRANS.
The 'Interactive Screen Input' process is performed by the main module and the
subroutine CREATE OPTION.
TRANS
Read System Defaults
Intro Screen
Display Main Screen
Interactive Screen Input
Geo-EAS Programmer's Guide
3.2-10
April 1990

-------
Interactive Screen Input
Display Main Menu - (Screen 2)
10 IF (Menu Choice = 'Quit') THEN
Close Scratch Files
Write System Defaults
EXIT Program
ELSE IF (Menu Choice = 'Prefix') THEN
Get the data file name prefix and the
scratch file name prefix from the user.
ELSE IF (Menu Choice = 'Data') THEN
Get the data file name from the user. Read the data from
the data file and write the sample data to the scratch file.
ELSE IF (Menu Choice = 'Save') THEN
Get the name of the output file from the user and write the
data to it.
ELSE IF (Menu Choice = 'Title') THEN
Get the descriptive title for the output file from the user
and assign to the global variable.
ELSE IF (Menu Choice = 'Create') THEN
Reset the logical flags.
Call the routine CREATE OPTION which begins the transformation process of
a variable. See below for the pseudocode of this routine.
ELSE IF (Menu Choice = 'Delete') THEN
Get the name of variable to be deleted from the user.
Delete this variable via a call to the routine DELETE OPTION.
ENDIF
GO TO 10
Geo-EAS Programmer's Guide
3.2-11
April 1990

-------
SUBROUTINE CREATE OPTION
Display the Create Option Menu
15 IF (Menu Choice = 'Quit') THEN
RETURN to Main Menu.
ELSE IF (Menu Choice = 'New Variable') THEN
Get the name of the new variable from the user.
ELSE IF (Menu Choice = 'Old Var able') THEN
Get the name of an existing variable from the user.
Prompt the user for the name change of the existing
variable and process.
ENDIF
Display the Operation Menu
20 IF (Menu Choice = 'Unary Operation') THEN
Begin the unary operation process via a call to
the subroutine UNARY PROCESS.
ELSE IF (Menu Choice = 'Binary Operation') THEN
Begin the binary operation process via a call to
the subroutine SELECT BINARY OPERAND 1.
ELSE IF (Menu Choice = 'Indicator Transform') HEN
Process this option via a call to the subroutine
INDICATOR OPERATION.
ELSE IF (Menu Choice = 'Quit') THEN
GO TO 15
ENDIF
GO TO 20 (End of CREATE OPTION)
3.2.6 The Outputs
TRANS generates one Geo-EAS Data File containing the results of transfor-
mations performed on the input data. TRANS stores the output file name and
file name prefix into the System Defaults File. If one does not exist, then
TRANS generates one.
Geo-EAS Programmer's Guide
3.2-12
April 1990

-------
3.2.7 Subroutine Structure
The subroutine structure basically is a subroutine calling tree. The calls
displayed will be for only those subroutines whose descriptions appear in the
next subsection 'Subroutine Descriptions'
MAIN -INIT PREFIX
ISAM
|INIT TFPREFIX
jREAD SYSTEM DEFAULTS
j \SAM
jINTRO SCREEN
| \SAM
jCLOSE SCRATCH FILES
| \SAM
|WRITE SYSTEM DEFAULTS
jBUILD PREFIX SCRATCH FILE
| \SAM
|CLEAR VARIABLE BOX
| \SAM
jGET NAME OF FILE
I |SAM
| jBUILD PREFIX FILENAME
| j \SAM
j |CLEAR VARIABLE BOX
|	\SAM
j FILE SET UP~>(1)
j READ NUMERICAL DATA—>(2)
jDISPLAY VARIABLES
j ISAM
| \CLEAR VARIABLE BOX
|	\SAM
jINIT FLAGS
| CREATE OPTION—>(3)
j DELETE OPTION—>(4)
IVRITE TO OUTPUT FILE
ISAM
\BUILD PREFIX FILENAME
\SAM
Geo-EAS Programmer's Guide
3.2-13
April 1990

-------
(1)	—-FILE SET UP
| SAM
jBUILD PREFIX FILENAME
j |SAM
jGET HEADER DATA
| |SAM
j jBUILD PREFIX FILENAME
j j \SAM
j \INPUT FORMAT CHECK
|	\WRITE FORMAT FROM INT TO CHAR
jCLEAR VARIABLE BOX
j \SAM
\LOAD NEW TOGGLE VALUES
\SAM
(2)—	READ NUMERICAL DATA
|SAM
jOPEN SCRATCH FILE
| |SAM
| \BUILD PREFIX SCRATCH FILE
j	\SAM
\BUILD PREFIX FILENAME
\SAM
Geo-EAS Programmer's Guide
3.2-14
April 1990

-------
(3)—	CREATE OPTION
ISAM
jCLEAR OPERATION BOX
j \SAM
j CLOAD NEW TOGGLE VALUES
j \SAM
|DISPLAY VARIABLES
| ISAM
j \CLEAR VARIABLE BOX
j	\SAM
|UNARY PROCESS
| |SAM
| | SELECT UNARY OPERAN—>(6)
j \CLEAR OPERATION BOX
|	\SAM
|SELECT BINARY OPERAND 1
j |SAM
j jCHECK CONSTANT INPUT OVERFLOW
| | \SAM
j j BINARY PROCESS
I	I I SAM
| | \SELECT BINARY OPERAND 2
II	I SAM
| |	|CHECK CONSTANT INPUT OVERFLOW
| j	j \SAM
j j	\CALCULATE
| |	\PROCESS—>(7)
| \CLEAR OPERATION BOX
|	\SAM
\INDICATOR OPERATION—>(5)
\SAM
(4)—DELETE	OPTION
ISAM
| GET ELEMENT
| PUT ELEMENT
| \SAM
jLOAD NEW TOGGLE VALUES
| \SAM
\DISPLAY VARIABLES
| SAM
\CLEAR VARIABLE BOX
\SAM
Geo-EAS Programmer's Guide
3.2-15
April 1990

-------
(5)-—INDICATOR	OPERATION
|SAM
jCHECK CONSTANT INPUT OVERFLOW
j \ SAM
jGET ELEMENT
j VMISS
jPUT ELEMENT
j \SAM
jLOAD NEW TOGGLE VALUES
j \SAM
jCLEAR OPERATION BOX
\SAM
(6)	—SELECT UNARY OPERAND
| SAM
jCHECK CONSTANT INPUT OVERFLOW
j \SAM
\CALCULATE
\PROCESS—>(7)
(7)	— PROCESS
|CLEAR OPERATION BOX
| \SAM
jRANK VAR
j |GET ELEMENT
j \QSORT
jPUT ELEMENT
j \SAM
jLOAD NEW TOGGLE VALUES
| \SAM
|DISPLAY VARIABLES
| \SAM
\MINMAX
ISAM
|GET ELEMENT
\CHECK FOR OUTPUT OVERFLOW
ISAM
jGET FORMAT
j \SAM
\CO VERT INT TO CHAR FORMAT
Library: SAM - Screen Access Management
3.2.8 Subroutine Descriptions
Folloving are each of the subroutines that appear in TRANS. The formal
arguments (if any) are described followed by the local variables and finally a
description of what the subroutine does. The local variables listing may
include global variables that are indicated as such. Further details of the
global variables are included in the TRANS.DEC file.
Geo-EAS Programmer's Guide
3.2-16
April 1990

-------
PROGRAM TRANSFORMATION (main module)
Local Variables:
MENU
MENU CHOICE
TITLE FIELD
CHOICE
NOINFILE
CALCOMP
NEWAR
OLDVAR
variable that contains the screen field name of the main menu.
variable that contains the user's menu selection.
variable that contains the screen field name of the title field.
variable that contains a screen field name.
global logical variable.
global logical variable.
global logical variable.
global logical variable.
TRANS displays two screens, an Intro screen and the Main screen (from which
menus are displayed). These screens are defined in the 'TRANS.SCR' file.
Part of the Main screen, namely the operation box, displays different headings
depending on the operation to be performed. The code reflects this with 'PUT
STR' calls and 'ERASE' calls (routines from the Screen library). These calls
are placed at specific points in the code so that the screen changes
accordingly. Caution must therefore be used when moving or changing these
calls. The main program displays the Main menu and executes the user's
requests by either calling the appropriate subroutine, or by processing the
request within the main program.
SUBROUTINE BINARY PROCESS
Local Variables:
BINARY FIELD
MEBVMAIN1
MENU
MENU CHOICE
VAR
BOPERATOR
UOPERATOR
CALCOMP
contains the screen field name of the binary operation field,
contains the screen field name of the Select Binary Operand 1
menu.
contains the screen field name of the Binary Operation menu,
contains the user's menu selection.
contains the toggle position of item selected by the user,
global logical variable,
global logical variable.
global logical variable indicating if the calculation was
completed.
This routine is called by the routine 'SELECT BINARY OPERAND 1'. BINARY
PROCESS displays a menu that permits the user to pick a specific binary
operation, or to quit (r turn to previous menu). After picking a binary
operation (via a toggle field) the routine 'SELECT BINARY OPERAND 2' is
called.
SUBROUTINE BUILD PREFIX FILENAME (FILE NAME)
Formal Argument:
FILE NAME - Name of file to which the prefix is affixed.
Local Arguments:
PREFIX - Global variable which contains the prefix character string.
PREFILE - Global variable which contains the Prefix + File Name.
Geo-EAS Programmer's Guide
3.2-17
April 1990

-------
This routine concatenates a prefix to a filename.
SUBROUTINE BUILD PREFIX SCRATCH FILE (FILE NAME)
Formal Argument:
FILE NAME - filename to which Tfprefix is affixed.
Local Variables:
PREFILE - global variable that contains the name of the file name with the
Tfprefix affixed.
TFPREFIX - global variable that contains the prefix of the scratch file.
This routine concatenates a prefix to a file name. The file name is passed as
a parameter and the prefix is a global variable.
SUBROUTINE CALCULATE
Local Variables:
MENU	- contains the screen field name of the Calculate menu.
MENU CHOICE - contains the user's menu selection.
Displays a menu permitting the user to proceed with the calculation or to
return to the previous menu via the quit option.
SUBROUTINE CHECK CONSTANT INPUT OVERFLOW (CHOICE, ERROR)
Formal Arguments:
CHOICE - name of the screen field which contains the value to be checked for
overflow.
ERROR - returns .TRUE, if the value causes overflow.
Local Variables:
TMP INPUT - contains the constant value but as a character string.
A value taken from a screen field is examined to determine if it causes
numerical overflow. An internal read statement is used to check if the value
causes overflow.
SUBROUTINE CHECK FOR OUTPUT OVERFLOW (COL, MIN, MAX,
+	NERRORS)
Formal Arguments:
COL	- Variable (column) number used for identifying the specific
variable.
MIN	- Local variable, represents minimum value.
MAX	- Local variable, represents maximum value.
NERRORS - Number of missing val es passed by the calling routine.
Local Variables:
MISSING - Global variable initialized at the beginning of the subroutine
PROCESS.
M	- A real array which contains the min, max and missing values.
Geo-EAS Programmer's Guide	3.2-13	April 1990

-------
This routine prompts the user for an output format and checks if the output
format can print the min, max and missing values (if applicable). If not than
an error message is displayed and the user is prompted for another output
format.
SUBROUTINE CLEAR OPERATION BOX
This subr utine clears the operation box. Calls to ERASE (a Screen library
routine) are made in this routine.
SUBROUTINE CLEAR VARIABLE BOX
This subroutine clears the box that displays the variables.
SUBROUTINE CLOSE SCRATCH FILES
This routine closes the scratch (temporary) scratch file.
SUBROUTINE CONVERT INT TO CHAR FORMAT (COL)
Formal Argument:
COL - variable column used to identify the variable in question.
Local Variables:
FORMATS - global array that contains the output format for each variable.
FWIDTH - global variable that contains the vidth field of an output format.
FDECIMALS - global variable that contains the decimal field of an output
format.
Convert the format output vidth and decimal variables (integer) to character
type and insert into the array 'FORMATS'. The formats always use the Gv.d
format.
SUBROUTINE CREATE OPTION
Local Variables:
MAIN MENU
MENU
MEUBMAIN
MENU CHOICE
VAR
NEVVAR
OLDVAR
VARNAM
UNITS
TMPVNAM
contains the screen field name of main menu,
contains the screen field name of Create Option menu,
contains screen field name of Operation menu,
contains the user's menu selection.
contains the toggle position of the item selected by the user.
global logical variable.
global logical variable.
global array containing variable names.
global array containing measurement descriptions of each
variable.
global variable containing a variable name.
Geo-EAS Programmer's Guide
3.2-19
April 1990

-------
This routine displays the 'Create Option' menu. The user is prompted for
either a current variable or a new variable to contain the results. After the
user's choice is processed the screen displays a new menu that prompts the
user for either a unary operation or a binary operation. The appropriate
subroutine is then called.
SUBROUTINE DELETE OPTION (IVAR, ERROR)
Formal Arguments:
IVAR - This integer identifies the column number of the variable to be
deleted.
ERROR - Return .TRUE, if the data could not be written out to the scratch
f ile.
Local Variables:
MAXVAR - Global variable	that contains the maximum number of variables
permitted in Trans.
NVAR - Global variable	containing the number of variables.
VARNAM - Global array of	names for each variable.
UNITS - Global array of	measurement description s for each variable.
FORMATS - Global array of	output formats for each variable.
This routine deletes a variable by advancing all succeeding variables one
posi tion.
SUBROUTIN DISPLAY VARIABLES
Local Variables:
ROV - contains the row number at which to display the variable name.
COL - contains the column number at which to display the variable name.
VARNAM - global array that contains the variable names.
The subroutine DISPLAY VARIABLES displays up to 48 variable names in six rows,
eight columns.
SUBROUTINE FILE SET UP (ERROR, NVAR TEMP)
Formal Arguments:
ERROR - .TRUE, if any fatal errors occurred in accessing the information
from the file.
NVAR TEMP - number of variables in Geo-EAS input data file.
Local Variables:
TITLE FIELD - contains the screen field name of the 'Title'.
NOINFILE - global logical variable.
INFIL	- global variable that contains the name of the Geo-EAS input data
file.
PREFILE - global variable.
NORMAL	- parameter defined as zero in Screen.str.
Geo-EAS Programmer's Guide	3.2-20	April 1990

-------
This routine prompts the user for a filename. If the file exists then a call
to 'GET HEADER DATA' reads in the the variable number, title, and ariable
names. The Variable box (the area that displays the variable names) is
cleared and the new variables are displayed. The appropriate toggle fields
are 're'loaded. If the file does not exist then a varning is issued
and control returned to the calling subroutine.
REAL*4 FUNCTION GET ELEMENT (DATA UNIT, COL, INDEX, VARNUM)
Formal Arguments:
DATA UNIT - Unit number of scratch file which is always 1.
COL	- variable requested from scratch file.
INDEX - data item requested of 'COL'.
VARNUM - number of variables.
This routine reads a sample from a scratch file corresponding to the requested
variable designated by 'COL' and assigns to Get Element.
SUBROUTINE GET NAME OF FILE (FIELDNAME, FILENAME, ERROR, CHECK)
Formal Arguments:
FIELDNAME - Screen fieldname.
FILENAME - Name of Geo-EAS input data file.
ERROR - .TRUE, if file does not exist.
CHECK - If 1 check, for input file, if 2 check for output file.
Local Variable:
PREFILE - global variable.
This routine prompts the user for the name of the file. Error checking as to
the existence of the file is performed.
SUBROUTINE GET FORMAT (VALUE)
Formal Arguments:
VALUE - This value is displayed in the screen field and used by default as the
width for the FORTRAN output format.
Local Variables:
FVIDTH - global variable that contains the width for FORTRAN output format.
FDECIMALS - global variable that contains the number of decimal places for
FORTRAN output format.
Prompt user for the output format width and decimal size. If input format is
illegal then issue message and use G16.9 as the default.
Geo-EAS Programmer's Guide
3.2-21
April 1990

-------
SUBROUTINE GET HEADER DATA (FILE NAME, ERROR, NVAR TEMP)
Formal Arguments:
FILE NAME - This character string contains the name of the Geo-EAS data input
file.
ERROR - Returns .TRUE, if the file could not be opened or if an error
occurs while reading the data.
NVAR TEMP - Returns the number of variables in the input file.
This routine reads the following data from Geo-EAS data input file:
1.	The title (description) of the file.
2.	The number of variables in an input file.
3.	The variable names.
SUBROUTINE INDICATOR OPERATION
Local Variables:
READY - is a local variable that is .true, if the menu choice 'Variable'
has been selected.
TMPVNAM - is a global variable containing the name of the result variable
assigned earlier.
This routine provides the prompts that the user requires to initiate the
indicator operation. The indicator operation is performed in this routine.
The labels required are also displayed by this routine.
SUBROUTINE INIT FLAGS
Local Variables:
B1VFLAG - global logical variable
B2VFLAG - "	"	"
B1CFLAG
B2CFLAG - "	"	"
UOVFLAG - "
UOCFLAG - "	"
BOPERATOR - "	"	"
UOPERATOR - "	"	"
This subroutine initia izes the logical flags to false. All variables are
global logical variables.
SUBROUTINE INIT PREFIX
This routine initializes the global variable PREFIX to blanks.
SUBROUTINE INIT TFPREFIX
This routine initializes the global variable TFPREFIX to blanks. This is the
only variable in the subroutine.
Geo-EAS Programmer's Guide
3.2-22
April 1990

-------
SUBROUTINE INPUT FORMAT CHECK (COL)
Formal Argument:
COL	- contains an integer value that indicates the variable (column)
index.
Local Variables:
FWIDTH - global contains the w dth field of the output format.
FDECIMALS - global that contains the decimal field of the output format.
FORMATS - global array that contains the output formats for each variable.
C1,C2,C3 - temporary variables that contain one character each.
This routine checks if the format listed in the input file is acceptable. The
acceptable formats are 'F' or 'G' where the width field is not greater than 16
and the decimal positions is not greater than 9. The width field cannot fall
below decimal positions + 1) and the decimal positions cannot fall below 0.
If they do then the default format of G16.9 is used.
SUBROUTINE INTRO SCREEN
This routine displays the Introduction screen and prompts the user to press
any key when finished reading the Intro. Only subroutine calls are made from
this routine.
SUBROUTINE LOAD NEW TOGGLE VALUES
Local Variable:
FLDCHOICE - Name of screen label field.
This routine loads all variable names into the appropriate toggle fields.
SUBROUTINE MINMAX (COL,NERRORS)
Formal Arguments:
COL - This integer identifies the column number of the variable.
NERRORS - Number of missing values noted in the variable. This value is
passed by the calling subroutine.
Local Variables:
MINIMUM - contains	the name of the 'MINIMUM' screen field.
MAXIMUM - contains	the name of the 'MAXIMUM' screen field.
MIN	- contains	the current minimum value.
MAX	- contains	the current maximum value.
COL	- contains	the variable (column) number.
ROW	- contains	the sample item (record number).
NERRORS	- contains	the number of missing values.
This subroutine determines the minimum and maximum values of the data array
and then displays the values in a message that is in reverse video.
Geo-EAS Programmer's Guide
3.2-23
April 1990

-------
SUBROUTINE OPEN SCRATCH FILES
Local Variables:
FILE NAME - contains the name of the scratch file.
PREFILE - is a global variable that contains the prefix and the file name.
The routine 'BUILD PREFIX SCRATCH FILE' assigns the prefix + file
name to 'PR FILE'.
This routine opens a scratch (temporary) file.
SUBROUTINE PROCESS
Local Variables:
RCONSTANT	- temporary real variable.
C0NSTANT1	- temporary real variable.
C0NSTANT2	- temporary real variable.
NERRORS	- counter used to tally number of missing values in a
variable.
CALCOMP	- global logical variable that is .TRUE, vhen the calculation
is complete or vhen an error in processing occurs.
This routine processes the unary and binary operations. All other variables
are fairly obvious in their usage.
SUBROUTINE PUT ELEMENT (DATA UNIT,COL,INDEX,VARNUM,VALUE,ERROR)
Formal Arguments:
DATA UNIT - Unit number of scratch file (which is always 1).
COL	- variable requested from infile.
INDEX - data item requested of 'COL'.
VARNUM - number of variables.
VALUE - value replacement.
ERROR - True if error writing to scratch file.
This routine replaces a sample in the scratch file.
SUBROUTINE RANK VAR (COL)
Formal Arguments:
COL - integer identifying the column number of variable in question.
Local Variables:
NDATA - global variable containing the number of sample records.
TMPDATA - global array containing samples for one variable.
A1 () - read array containing the samples of the variable specified by
'COL'.
P () - an integer array which contains the original positions of
corresponding sample datum.
NVAR - global variable that contains the current number of variables.
MISSING - global variable that contains the missing value.
MA VAR - Global variable that contains the maximum number of variables
permi t ted.
Geo-EAS Programmer's Guide	3.2-24	April 1990

-------
This	JJsa £-anks the variable upon vhich. the operation is performed £?&s
lav to high. Trie result~ir
-------
SUBROUTINE SELECT BINARY OPERAND 1
Local Variables:
MECMAIN - contains the screen field name of the Create New Variable menu.
MENU	- contains the screen field name of the Select Binary Operand 1
menu.
CHOICE	- contains a screen field name.
MENU CHOICE - contains the user's menu selection.
VAR	- contains the toggle position of the item selected by user.
B1VFLAG - global logical variable.
B1CFLAG - global logical variable.
This routine displays a menu permitting the user to chose either a variable or
constant as binary operand 1. After choosing an operand, the routine 'BINARY
PROCESS' is called. If the user decides to quit, the previous menu will be
displayed.
SUBROUTINE SELECT BINARY OPERAND 2
Local Variables:
MEBSMAIN - contains the screen field name of the Binary Operations menu.
MENU	- contains the screen field name of the Select Binary Operand 2
menu.
CHOICE	- contains a screen field name.
MENU CHOICE - contains the user's menu selection.
VAR	- contains the toggle position of the item selected by user.
B2VFLAG - global logical variable.
B2CFLAG - global logical variable.
CALCOMP - global logical variable.
This routine is called by the routine 'BINARY PROCESS'. A menu is displayed
permitting the user to choose either a constant or a variable for the operand.
After the operand choice the routine 'CALCULATE', which begins, the binary
operation, is called. If the user decides to 'Quit' the previous menu is
called.
SUBROUTINE SELECT UNARY OPERAND
Local Variables:
MEUSMAIN
MENU
CHOICE
MENU CHOICE
ERROR
UOVFLAG
UOCFLAG
CALCOMP
VAR
contains the screen field name of the Unary Operation menu,
contains the screen field name of the Select Unary Operand menu,
contains a screen field name,
contains the user's menu selection.
logical that is true if an error occurs in some specific
process.
global logical variable,
global logical variable,
global logical variable.
contains the toggle position of the item selected by the user.
Geo-EAS Programmer's Guide	3.2-26	April 1990

-------
This routine is called by the rou ine 'UNARY PROCESS'. A menu is displayed
permitting the user a choice of the unary operand - variable or constant. If
the user wishes to quit then the previous menu will be displayed. After
deciding upon a unary operand the routine 'CALCULATE', which initiates the
unary operation, is called.
SUBROUTINE UNARY PROCESS
Local Variables:
MENU	- contains the screen field name of the Unary Operation menu.
MENU CHOICE - contains the user's menu selection.
UNARY FIELD - contains a screen field name.
VAR	- contains the toggle position of the item selected by the user.
CALCOMP - global logical variable indicating if the calculation was
completed.
This routine displays a menu that permits the user to quit (return to the
preceding menu) or to pick a unary operation via a toggle field.
LOGICAL*1 FUNCTION VMISS (Rl)
This function determines if 'Rl' is a missing value. If 'Rl' is missing then
VMISS = .true, else VMISS = .false..
SUBROUTINE WRITE FORMAT FROM INT TO CHAR (COL)
Formal Arguments:
COL	- variable (column) identifier.
Local Variables:
VI	- temporary variable equivalent to Fdecimais.
F1	- temporary variable equivalent to Fwidth.
FORMATS - global array containing the output formats for each variable.
This routine converts the integer values in the variables Fwidth and Fdecimais
into a FORTRAN output format. This format is then inserted into the global
'Formats' array element corresponding to the variable indicated by 'Col'.
SUBROUTINE WRITE SYSTEM DEFAULTS
Local Variables:
PREFIX - global variable that contains the name of the Geo-EAS data file
prefix.
OUTFIL - global variable that contains the name of the Geo-EAS output data
file.
This routine writes out a prefix name and an output file name to the
'GEOEAS.DEF' file.
Geo-EAS Programmer's Guide
3.2-27
April 1990

-------
SUBROUTINE WRITE TO OUTPUT FILE
Local Variables:
FMT	- An array which is the output format specifier.
VECT0R48 - Global real array of 48 elements used to store a row of data.
VARNAM - Global array of character strings used to store variable names.
UNITS - Global array of character strings used to store measurement
descriptions of variables.
FORMATS - Global array of character strings used to store variable output
formats.
OUTFIL - Global variable that contains the name of the output file.
NOINFILE - Global variable that is set to .TRUE, if an input file has not
been accessed.
This subroutine prompts the user for the name of an output file. If the file
does not exist, one is opened. The data is then written to that output file.
Geo-EAS Programmer's Guide
3.2-23
April 1990

-------
3.3
STAT1
3.3.1
Software Function
Statl is an interactive program which computes basic univariate statistics and
displays graphs for variables in a Geo-EAS data set. Options are available
for calculating statistics on the natural log of the selected variable, for
specifying a variable to be used as a''weighting factor', and for performing
calculations on subsets of the input data through the use of upper and lower
limits. A 'Batch Statistics' option has been included which will produce a
report of statistics for all variables in the specified data file.
3.3.2
Global Variables/Program Limits
STAT1 reads as well as generates Geo-EAS data files containing a maximum of 48
variables and 10,000 samples. If a file should contain more than 10,000
samples then only the first 10,000 samples are read and processed.
The following is a description of the global variables used in STAT1. The
format is extracted from the declaration file STATS.DEC. The variable
description and the common block declaration follows.
C PARAMETERS:
C MAXDATA	- maximum number of data which can be read by
C program.
C MAXVAR	- "	" " variables.
C MAXCLA S	"	" " histogram class intervals.
PARAMETER (MAXDATA	= 10000)
PARAMETER (MAXVAR	= 48)
PARAMETER (MAXCLASS = 33)
C The following variables are included in the common block /STAT/.
C
-	Array which contains the data for statistics.
-	Array "	"	" weight factor values.
-	Array "	"	" cumulative
percentiles.
-	Minimum data limit - for subset statistics.
-	Maximum data limit " "	"
-	Missing value	"	"	"
C DATA
C WEIGHTS
C CPERCENT
C MINVALUE
C MAXVALUE
C MISSING
REAL*4
REAL*4
REAL*4
DATA (MAXDATA), WEIGHTS (MAXDATA)
CPERCENT (MAXDATA)
MINVALUE, MAXVALUE, MISSING
Geo-EAS Programmer's Guide
3.3-1
April 1990

-------
C The following variables are included in the common block /STA /.
C
MIN	- Data minimum (for data in subset specified
by limits).
MAX
Q1
Q3
MEAN
MEDIAN
VARIANCE
STDEV
COEFVAR
IQRANGE
SKEWNESS
KURTOSIS
WEIGHTSUM
DATASUM
REAL*4
REAL*4
REAL*4
maximum "
1st quartile
3rd quartile
mean	"
median "
variance "
standard deviation
X coefficient of
variation (Stdev/Mean*100)
interquartile range" "
coefficient of skevness"
"	kurtosis"
sum of weights (or number of data if no
weights).
weighted sum of data "	"	" .
MIN,MAX,Q1,Q3,MEAN,MEDIAN,VARIANCE,STDEV
COEFVAR, IQRANGE, SKEWNESS, KURTOSIS
WEIGHTSUM, DATASUM
-k ic-k-k-k-k-k ic-k-k ^-kick-k-k-kie-k-kick ^k'k'k'k'k'kick'k'kie'kiddfic'k'k'^'k'k'k'kieieic'k'k'k'k'k'k'k'k'k'k'kic "kick "kick
C	The following variables are included in the common block /STAT/.
C
C	CUTOFF
C	SUMCLASS
C	SUMWCLASS
C	CLASSAVG
C	MAXCLASSV
C	RFREQ
- array of histogram class cutoffs.
weighted sums for each class,
sum of weights for each class,
class averages,
class maximum value,
relative frequency in class.
REAL*4
REAL*4
REAL*4
REAL*4
CUTOFF (MAXCLASS)
SUMCLASS (MAXCLASS), SUMWCLASS (MAXCLASS)
CLASS AVG(MAXCLASS), MAXCLASSV (MAXCLASS)
RFREQ(MAXCLASS)
C The following	variables are included in the common block /STAT/.
C
C CLASSMIN	- Histogram Minimum value for	first class.
C CLASSMAX	- " Maximum	last class.
C CLASSINC	- " Increment between class cutoffs.
REAL*4
CLASSMIN, CLASSMAX, CLASSINC
Geo-EAS Programmer's Guide
3.3-2
April 1990

-------
C The following variables are included in the common block /STAT/.
C
C
PTR
- array of pointers (sorted in parallel with C data).
c
FREQ
- Histogram frequency counts for each histogram C class.
c
NDATA
- number of data in input file.
c
NVAR
- number of variables in input file.
c
VAR
- index for statistics variable.
c
WAR
- index for weighting factor variables.
c
NCLASS
- number of histogram classes.
c
NKEPT
- number of data used in the computation.
c
NMISS
- number of missing data in the input file.
c
NUMNEG
- number of value <= 0 in input file.
c
FIRSTPTR
- pointer to 1st data value to use in sorted list.
c
LASTPTR
" " last data value " " " " ".
INTEGER*4	PTR (MAXDATA), FREQ (MAXCLASS)
INTEGER*4	NDATA, NVAR, VAR, WAR
INTEGER*4	NCLASS, NKEPT, NMISS, NUMNEG
INTEGER*4	FIRSTPTR, LASTPTR
C The following variables are included in the common block. /STA /.
C
C WEIGHTED	- flag for weighted statistics
C LOG	- flag for log statistics
C RELATIVE	- flag for relative histogram
LOGICAL	WEIGHTED, LOG, RELATIVE
~~Ik****************-*************
C The following	variables are included in the common block /CHARS/.
C
C VARNAM	-	array for variables names.
C UNITS	-	" for measurement units.
C DATA FILE	-	data file name.
C FILE PREFIX	-	prefix for data file name.
C TITLE1-4	-	titles for histogram plot.
CHARACTER*10 VARNAM (MAXVAR), UNITS (MAXVAR)
CHARACTER	DATA FILE*14, FILE PREFIX*50
CHARACTER	TITLE1*60,TITLE2*60,TITLE3*60,TITLE4*60
C /CHARS/ - Common block for variables containing character
C	strings.
COMMON /CHARS/ VARNAM, UNITS, DATA FILE, FILE PREFIX,
+	TITLE1, TITLE2, TITLE3, TI LE4
Geo-EAS Programmer's Guide
3.3-3
April 1990

-------
Q k k kkkkkkkk k k k k k "k kkkkkkkkkk	k k k kkkkkkk k ~*~~~~* * **~~~~~~*~*~~~*~~*~ ~
maximum X device coordinates
n y "	"
(used by GRAFLIB library)
(produced by grafinit)
(from grafinit)
XMAXDEV
YMAXDEV
GMODE
DEVCODE
STARTMODE
ASPECT
XFAC, YFAC
XMIN, XMAX
YMIN YMAX
XTINC, YTINC
MINX, MAXX
MINY, MAXY
NXTIC, NYTIC
RED, WHITE,..
GRAPHICS
graphics mode code
device code
initial video mode
aspect ratio
Factor for real to device coordinates, for X, Y
X axis limits
Y axis limit
X and Y axis tic increments
World coordinate extents (includes space for
margins)
World coordinate extents (includes space for
margins)
Number of X ticmarks, Y ticmarks
Codes for colors
flag set to true if appropriate hardware,
false otherwise
INTEGER*4
REAL*4
REAL*4
REAL*4
INTEGERS
INTEGERS
LOGICAL
XMAXDEV,YMAXDEV, GMODE,DEVCODE,STARTMODE
ASPECT, XFAC, YFAC
XMIN, XMAX, YMIN, YMAX, XTINC, YTINC
MINX, MAXX, MINY, MAXY
NXTIC, NYTIC
RED, WHITE, YELLOW, BLUE, GREEN
GRAPHICS
kk-kkkkkkk-kk k'kit'k'k-k-kkk'k'kkkk'kiek	k-kkkkkkkkkk kick-kit kickkk kkkkifk k-k
C /GRAFCOM/ - Common block for global graphics variables.
COMMON	/GRAFCOM/	XMIN, XMAX, YMIN, YMAX, XTINC, YTINC
COMMON	/GRAFCOM/	NXTIC, NYTIC, MINX MAXX, MINY, MAXY
COMMON	/GRAFCOM/	XMAXDEV, YMAXDEV, XFAC, YFAC, ASPECT
COMMON	/GRAFCOM/	GMODE, GRAPHICS, DEVCODE, STARTMODE
COMMON	/GRAFCOM/	WHITE, RED, YELLOW, BLUE, GREEN
Geo-EAS Programmer's Guide
3.3-4
April 1990

-------
3.3.3 Data Flov and Processing
Data Flov Diagram
Geo-EflS
Input Ca:a
File
User
Input
GX0EAS.3I?
(System
Defaults
File)
File Inputs
STAT1 requires a Geo-EAS Data File for input. STAT1 reads the System Defaul:
File, if one exists, for an input file name and a fi_e name prefix.
Geo-EAS Pr-.r rammer ' s Guide	3.3-5	April 19?'

-------
3.3.4 User Interface
The Screens
STAT1 displays eight different screens, six of vhich are defined in the
STAT1.SCR file anc tvo of which are generated by routines. The Intro screen
displays a brief intro and no menu qptions and is defined as Screen 1. The
Main interactive screen is defined as Screen 2. The Results screen is
screen 3. It contains the univariate statistics. The Examine Data screen is
Screen The Histogram screen is Screen 5. The Histogram Results screen
is screen 6. The Histogram Graph screen is generated by routines PLOT
HISTOGRAM and PLOTSTAT. The Probability Plot screen is generated by routines
PROBABILITY PLOT and PLOTSTAT.
Geo-EAS Programmer's Guide	3.3-6	April 199r.

-------
Global Variable/Screen Field Relationships
The fields on the screen in which the user enters data have associated screen
field names in the STAT1.SCR file. Some of these fields have their contents
assigned to a global variable and others are assigned to local variables.
This becomes evident upon examination of the source code and comments. The
screen fields (described by the screen label), their associated field names
(used in STAT1.SCR file; the field type is enclosed in parentheses), and the
related global variable name are listed below. Only two screens use input
fields, the Main screen and the Histogram (no graph). The Intro screen is
screen 1 and does not use screen fields. The screens preceding this discus-
sion should be used for reference.
SCREEN FIELD NAME GLOBAL VARIABLE (If not global
f.ARF.T.	(STATI.SCR)	then 'Local' is entered.)
Main screen (Screen 2)
File Prefix
Data File Name
Variable
Weight
Log Option
Minimum
Maximum
FILEPREFIX(char)
DATAFILE (char)
FILE PREFIX
DATA FILE
VAR
WAR
LOG
MINVALUE
MAXVALUE
VARIABLE (toggle)
WVARIABLE (toggle)
L0G0PTI0N (to gle)
MINVALUE (real)
MAXVALUE (real)
Histogram screen (Screen 5)
Type
HISTOTYPE (toggle)
RELATIVE
Class Limits
Minimum
Class Width
# Classes
CLASSMIN (toggle)
CLASSINC (real)
NCLASS (integer)
CLASSMIN
CLASSINC
NCLASS
Axes
X Axis(column)
Minimum
Maximum
Tic Spacing
AXISXMIN(real)
AXISXMAX(real)
AXISXINC(real)
XMIN
XMAX
XTINC
Y Axis(column)
Minimum
Maximum
Tic Spacing
AXISYMIN(real)
AXISYMAX(real)
AXISXINC(real)
YTINC
TITLE1
TITLE2
TITLE3
TITLE4
YMIN
YMAX
Main Title
Sub Title
X Axis
Y Axis
TITLEl(char)
TITLE2(char)
TITLE3(char)
TITLE4(char)
Geo-EAS Programmer's Guide
3.3-7
April 1990

-------
3.3.5 Processing
Processing of the user's menu selection is performed in the routine GET SCREEN
FIELDS. Nested IF THEN ELSE IF statements determine which menu option vas
selected for a particular menu. Specific routines are then usually called
that perform the required process.
In cases where a screen field needs to be accessed as a result of a menu
selection, the routine GET FIELD GROUP is called by the routine GET SCREEN
FIELDS. GET FIELD GROUP calls the routine PERFORM PROCESS which processes the
specified screen field. This processing usually entails assigning the con-
tents of the screen field to a variable. In some cases processing is done
immediately, as vhen a data file name is extracted and the file's data is
read.
The routine NEV SCREEN is called whenever a new screen defined in STAT1.SCR is
to be displayed. The screens that display the histogram and probability plot
are not defined in STAT1.SCR but are instead generated by routines. The
routine PLOT HISTOGRAM generates and displays the histogram and the routine
PROBABILITY PLOT generates and displays the probability plot.
The following pseudocode represents the general flow of processing in STAT1.
Processing is structured along the lines of the menu hierarchy and the
subroutine calling tree. The 'Interactive Screen Input' process is performed
by the subroutines GET FIELD GROUP and PERFORM PROCESS.
STAT1
Grafini t
Ini tialize
Read System Defaults
Intro Screen
Interactive Screen Input
Write System Defaults
Interactive Screen Input
5 Display Main Menu - (Screen 2)
20 IF (Menu Choice = 'Quit') THEN
RETURN
ELSE IF (Menu Choice = 'Variable') THEN
Get Field Values.
ELSE IF (Menu Choice = 'Limits') THEN
Get Field Values.
ELSE IF (Menu Choice = 'Batch Statistics') THEN
Process Batch Statistics.
ELSE IF (Menu Choice = 'Execute') THEN
Calculate Statistics.
25 Display Result Screen - (Screen 3)
35 IF (Menu Choice = 'Quit') THEN
RETURN to 5
ELSE IF (Menu Choice = 'Probability Plot') THEN
Calculate and display the probability plot.
Geo-EAS Programmer's Guide
3.3-8
April 1990

-------
ELSE IF (Menu Choice = 'Histogram') THEN
Calculate and display the histogram.
Display the Histogram (no graph) screen - (Screen 5)
IF (Menu Choice = 'Quit') THEN
GO TO 25
ELSE IF (Menu Choice = 'Results') THEN
Display the Histogram Results screen - (Screen 6)
ELSE IF (Menu Choice = 'View Graph') THEN
Calculate and display the histogram.
ELSE
Get field values and process the screen fields.
This includes reading the data field if and when
that field is processed.
ENDIF
ELSE IF (Menu Choice = 'Examine') THEN
Display Examine Data screen - (Screen 4)
GO TO 25
ENDIF
GO TO 35
ELSE
Get field values.
ENDIF
GO TO 20
3.3.6 The Outputs
STAT1 generates basic univariate statistics for any variable in the Geo-EAS
data file and displays graphs of the input data set. The output can be as
follows:
1.)	Batch statistics for all variables (maximum 48) in a given data
set which can be sent to a printer or file.
2.)	Probability Plot which can be computed, viewed, and printed.
3.)	Histogram which can be computed, viewed, and printed.
4.)	A display of a ranked listing of data values.
5.)	A display of a ranked listing of order statistics.
STAT1 stores the input file name and file name prefix (if any) into the System
Defaults File. If one does not exist then STAT1 generates one.
Screen Field Outputs
The following screen fields are used only to output information on the screen.
These fields do not have associated screen field names in the STAT1.SCR file.
Most are displayed by the routine UT STR, which is included in the SCREENE
library, or other routines in the case of graphs or scrolling screens. The
screen fields (described by the screen label), the method used for display
such as a call to PUT STR, and the related global variable name are listed
below. The labels are divided into seven groups, screen 2 through screen 6,
the Probability Plot and the Histogram. The last two screens, Probability
Plot and Histogram (graph) are generated by the routines described below.
Geo-EAS Programmer's Guide
3.3-9
April 1990

-------
SCREE
LABEL
METHOD OF
DISPLAY
GLOBAL VARIABLE (If not global
then 'Local' is entered.)
Main screen (Screen 2)
#
Variables
PUT
SCR
(Note
1)
NVAR
#
Data records
PUT
SCR
(Note
2)
NDATA
#
Missing Data
PUT
SCR
(Note
2)
NMISS
Results screen (Screen 3)
Data File
PUT
SCR
(Note
3)
Local
Variable
PUT
SCR
(Note
3)
Local
Lover Limit
PUT
CR
(Note
3)
MINVALUE
Upper Limit
PUT
SCR
(Note
3)
MAXVALUE
# Observations
PUT
SCR
(Note
A)
NDATA
# Missing Data
PUT
SCR
(Note
A)
NMISS
# Retained
PUT
SCR
(Note
A)
NKEPT
Mean
PUT
SCR
(Note
A)
MEAN
Variance
PUT
SCR
(Note
A)
VARIANCE
Std Deviation
PUT
SCR
(Note
A)
STDEV
Coef. Variation
PUT
SCR
(Note
A)
COEFVAR
Skevness
PUT
SCR
(Note
A)
SKEWNESS
Kurtosis
PUT
SCR
(Note
A)
K.URT0SIS
Sum of Weights
PUT
SCR
(Note
A)
WEIGHTSUM
Minimum Value
PUT
SCR
(Note
A)
MIN
25th Percentile
PUT
SCR
(Note
A)
Q1
Median
PUT
SCR
(Note
A)
MEDIAN
75th Percentile
PUT
SCR
(Note
A)
Q3
Maximum Value
PUT
SCR
(Note
A)
MAX
Examine Data screen (Screen 4)
The scrolling display is performed by the routine PERCENTILE vhich makes a
call to SCROLL WINDOW.
Histogram screen (Screen 5)
Data File
Variable
Lover Limit
Upper Limit
PUT SCR	(Note 3)
PUT SCR	(Note 3)
PUT SCR	(Note 3)
PUT SCR	(Note 3)
Histogram Results screen (Screen 6)
Data File
Variable
Lower Limit
Upper Limit
PUT SCR	(Note 3)
PUT SCR	(Note 3)
PUT SCR	(Note 3)
PUT SCR	(Note 3)
Local
Local
MINVALUE
MAXVALUE
Local
Local
MINVALUE
MAXVALUE
The scrolling display is performed by the routine EXAMINE HISTOGRAM vhich
makes a call to SCROLL WINDOW.
Geo-EAS Programmer's Guide
3.3-10
April 1990

-------
SCREE
LABEL
METHOD OF
DISPLAY
GLOBAL VARIABLE (If not global
then 'Local' is entered.)
Histogram Graph - The histogram is generated by the routine PLOT HISTOGRAM.
The statistical information that appears to the right of the histogram is
displayed by the routine PLOTSTAT. There is no screen defined in the file
STAT1.SCR for the histogram.
Probability Plot - The probability plot is generated by the routine PROBABI-
LITY PLOT. The statistical information that appears to the right of the
probability plot is displayed by the routine PLOTSTAT. There is no screen
defined in the file STAT1.SCR for the probability plot.
Note 1 - The call is made from the routine READ HEADER DATA.
Note 2 - The call is made from the routine READ DATA.
Note 3 - The call is made from the routine DISPLAY HEADER.
Note 4 - The call is made from the routine DISPLAY STATS. The values
displayed were generated by the routine CALCULATE STATS.
3.3.7 Subroutine Structure
MAIN - GRAFINIT	VSTATS
|CINITIALIZE 	 SAM
| READ SYSTEM DEFAULTS — SAM
| INTRO SCREEN	SAM
|GET SCREEN FIELDS
| |SAM
|	| NEW SCREEN	SAM
| | GET FIELD GROUP	XI)
| |BATCH	> ( 2 )
| |CALCULATE STATS
I I ISAM
| | \REAL* 4 FUNCTION INTERP
| | DISPLAY HEADER	SAM
| | DISPLAY STATS	SAM
| |PROBABILITY PLOT 	>(3)
| |DEFAULT HISTOGRAM 	>(4)
I |EXAMINE HISTOGRAM 	>(5)
| |CALC HISTOGRAM
| |PLOT HISTOGRAM 	>(6)
| \PERCENTILE 	>(7)
|WRITE SYSTEM DEFAULTS - SAM
|SETMOD
\S AM
Geo-EAS Programmer's Guide
3.3-11
April 1990

-------
(1	)	GET FIELD GROUP
|PERFORM PROCESS
| |SAM
| | GET FILE NAME	SAM
|	IBLA.VK FILE	SAM
|	|REINITIALIZE
I	I	ISAM
| | \INITIALIZE — SAM
| |READ HEADER DATA - SAM
| |READ DATA
I I	I SAM
|	| \QSORT
| |CALC HIST DEFAULTS
I I	ISAM
| | \NEATAX
| |	\REALM FUNCTION TIC
|	|CALC HISTOGRAM
| \SHOW AXIS FIELDS - SAM
| NEW SCREEN	SAM
\SAM
(2	)	BATCH
|SAM
| READ DATA	QSORT
\CALCULATE STATS
I
|SAM
\REAL * 4 FUNCTION INTERP
(3)	 PROBABILITY PLOT
|NEATAX — REALM FUNCTION TIC
|REAL*4 FUNCTION GINV
|GRFRAME
| |GRAFLIB
| \DRAW
|PAXES
I ISAM
| | GRAFLIB
| |SETFMT
| \REAL*4 FUNCTION GINV
|SAM
IGRAFLI3
| PLUS	GRAFLIB
| BOX PLOT	GRAFLIB
|PLOTSTAT
I ISAM
| \GRAFLIB
\GRWAIT
ISAM
|GRAFLIB
| PGRAPH
\SETTXT
Geo-EAS Programmer's Guide	3.3-12	April 1990

-------
(4	)	DEFAULT HISTOGRAM
ISAM
INEATAX	REAL * 4 FUNCTION TIC
|CALC HISTOGRAM
\CALC HIST DEFAULTS
ISAM
\NEATAX DDD REAL*4 FUNCTION TIC
(5	)	EXAMINE HISTOGRAM
ISAM
|CALC HISTOGRAM
| NEW SCREEN	SAM
|DISPLAY HEADER — SAM
| PUT HRECORD	SAM
\SCROLL WINDOW	LLIBC
(6	)	PLOT HISTOGRAM
|GRFRAME DB GRAFLIB
|	\ DRAW
| AXES	SAM
|	| GRAFLIB
|	| GETWOR
|	\ SETFMT
|BOX PLOT - GRAFLIB
| HBOX	GRAFLIB
| PLOTSTAT— SAM
|	\GRAFLIB
|SAM
|GRAFLIB
\GRWAIT
(7	)	PERCENTILE — PUT PSCREEN
|SAM
\PUT PRECORD — SAM
\ REAL*4 FUNCTION GIT/
SCROLL WINDOW	LLIBC
PUT PRECORD	SAM
SAM
\ REAL*4 FUNCTION GINV
Libraries: SAM - Screen Access Management
GRAFLIB - GRAFLIB Graphics Library
Geo-EAS Programmer's Guide
3.3-13
April 1990

-------
3.3.8 Subroutine Descriptions
PROGRAM STAT1 (main module)
Local Variable:
STARTMODE - global variable that contains the initial video mode.
The STAT1 global variables are initialized. The Intro screen then the Main
screen are displayed. The Main menu options are processed.
SUBROUTINE AXES (TITLEI, XLABEL, YLABEL, TITLE2,
+ XMIN, XMAX, YMIN, YMAX, XTINC, YTINC, DEVCODE)
Formal Arguments:
TITLE1 - contains the histogram heading.
XLABEL - contains the X axis label.
YLABEL - contains the Y axis label.
TITLE2 - contains the histogram sub-heading.
XMIN - global variable containing X axis limits.
XMAX - global variable containing X axis limits.
YMIN - global variable containing Y axis limits.
YMAX - global variable containing Y axis limits.
XTINC - increments on X axis.
YTINC - increments on Y axis.
DEVCODE - device code produced by the routine Grafinit.
Local Variables:
MINX - World coordinate extents (includes space for margins).
MAXX - World coordinate extents (includes space for margins).
MINY - World coordinate extents (includes space for margins).
MAXY - World coordinate extents (includes space for margins).
This routine draws and labels axes for histogram plot.
All routines beginning with a 'V are GRAFLIB graphics calls.
SUBROUTINE BATCH
Local Variables:
TABLE	- 2D array to hold stats calculations before they got to
file/printer.
ITABLE - 2D array that contains the values Nkept, Nmiss and
NumNeg for each variable.
NKEPT	- global variable that contains the number of data
used in the statistics computation.
NMISS	- global variable that contains the number of
missing data in the input file.
NUMNEG - global variable that contains the number of
negative or zero values in the input file.
PRINTER - flag to indicate: use printer.
FEXIST - flag for file existence.
OVERWRITE - flag for file overwrite.
ERROR	- error flag.
Geo-EAS Programmer's Guide
3.3-14
April 1990

-------
KVAR	- temporary index for variables in file.
IPOS	- temporary position.
BATCH FILE - report file name.
FILE NAME - file name with prefix attached.
TNAME	- temporary variable name.
This routine prints batch statistics for STAT1D.
SUBROUTINE BLANK FILE (FIELD NAME, FILE NAME)
Formal Arguments:
FIELD NAME - contains the name of the screen field that displays
the Geo-EAS data file.
FILE NAME - contains the name of the Geo-EAS data file.
This routine blanks a file name and corresponding screen field.
SUBROUTINE BOX PLOT (TMIN, TQ1, TMEDIAN, TMEAN, TQ3,
+	TMAX, HORIZONTAL, POSITION, WIDTH, DELTA!)
Formal Arguments:
TMIN	- Minimum value.
TQ1	- 1st Quartile.
TMEDIAN	- Median Value.
TMEAN	- Average Value.
TQ3	- 3rd Quartile.
TMAX	- Maximum Value.
HORIZONTAL	- Orientation flag.
POSITION	- X, or Y coordinate (depends on Horizontal).
WIDTH	- Width of Box.
DELTAX	- Width of Mean plotting symbol.
This routine plots a boxplot in a horizontal or vertical position.
SUBROUTINE CALC HIST DEFAULTS
Local Variables:
XMIN - global variable containing X axis	limits.
XMAX - global variable containing X axis	limits.
YMIN - global variable containing Y axis	limits.
YMAX - global variable containing Y axis	limits.
This routine calculates the default values for the axes.
SUBROUTINE CALC HISTOGRAM
Local Variables:
CUTOFF - global array of
RFREQ - global array of
SUMCLASS - global array of
SUMVCLASS - global array of
CLASSAVG - global array of
histogram cutoffs,
relative frequency in class,
weighted sums for each class,
sum of weights for each class,
class averages.
Geo-EAS Programmer's Guide
3.3-15
April 1990

-------
FREQ
- global variable containing the frequency counts
for each histogram class.
This routine calcul tes the frequency distribution for STATS1.
SUBROUTINE CALCULATE STATS
Local Variables:
SX	- sum of data.
SX2	- sum squared.
SX3	- sum cubed.
SX4	- sum to the fourth power.
D	- differences betveen mean and individual.
values (squared, cubed, etc.).
QLIM	- Quartile cutoff indices.
SUMU	- Sum of weights.
CUMFREQ	- Cumulative frequency.
CUM	- Cumulative.
VLAST	- temporary.
Ml, M2, M3 - temporary.
INTERP	- Int rpolation function.
This routine generates the statistical computations for STATS and performs the
necessary checks to determine if the data used is within acceptable ranges.
The statistical computations include the mean, variance, standard deviation,
coefficient of variation, coefficient of skevness, coefficient of kurtosis,
sum of weights, minimum value, 25th percentile, median, 75th percentile, and
the maximum value.
SUBROUTINE DEFAULT HISTOGRAM
Local Variables:
TITLES1-4 - titles for histogram plot.
This routine calculates and plots the default histogram for STATS.
SUBROUTINE DISPLAY HEADER
Local Variables:
DATA FILE - global variable that contains the name of the file.
FILE NAME - global variable that contains the file name
prefix (if any) affixed to the file name.
VARNAM - global array that contains the variable names.
VNAME - string that contains the name of the statistic
variable.
CLASSMIN - global histogram minimum value for first class.
CLASSINC - global histogram maximum value for last class.
MINVALUE - global variable that contains the minimum data limit
for subset statistics.
MAXVALUE - global variable that contains the maximum data limit
for subset statistics.
Geo-EAS Programmer's Guide
3.3-16
April 1990

-------
This routine displays file, variable, and limits information on top of the
screen. If the Histogram Results screen (statistics only, no graph) is
displayed then the ClassMin and Classlnc is also displayed.
SUBROUTINE DISPLAY STATS
Local Variables:
RFMT	- internal vrite format.
IFMT	- internal write format.
INUM	- character representation of an integer.
SCRATCH - character representation of a real.
This routine displays the statistics on the Results screen (Screen 3).
Internal write statements are used to convert integer/real values into
character strings.
SUBROUTINE EXAMINE HISTOGRAM
Local Variables:
TOPREC - Record that appears at top of screen.
BOTTOMREC - Record that appears at bot om of screen.
This routine allows scrolling of Histo results on STATS screen by processing
the user's scroll commands. The command is determined using an IF THEN ELSEIF
statement based on keycodes initialized below. The command is then processed
accordingly.
SUBROUTINE GET FIELD GROUP
Local Variables:
SC FIELD NAME - array declared in the file SCREEN. STR and
which contains the screen field names.
MAIN MENU FIELD - contains the field index number of the
Main menu.
MENU FIELD	- contains the field index number of a menu.
This routine gets a group of fields and then performs the processes via a call
to the routine PERFORM PROCESS.
SUBROUTINE GET FILE NAME (FILE NAME, FILE PREFIX,
+	FILE, FEXIST)
Formal Arguments:
FILE NAME - contains the File Prefix + File if a prefix
exis ts.
FILE PREFIX - contains the file name prefix.
FILE	- contains only the name of the file.
FEXIST	- logical that returns .TRUE, if the file with
the specified file name exists.
This routine builds a file name by affixing a file prefix to the beginning of
the file name.
Geo-EAS Programmer's Guide
3.3-17
April 1990

-------
SUBROUTINE GET SCREEN FIELDS
Local Variables:
MAINSCR
RSCREEN
HSCREEN
MAIN MENU
MENU CHOICE
-	contains	the number of the Main screen.
-	contains	the number of the Results screen.
-	contains	the number of the Histogram screen.
-	contains	the screen field name of the Main menu.
-	contains	the user's menu selection.
This routine displays the screen frame/label/fields and then processes the
user's menu selection.
REAL*4 FUNCTION GINV (P)
This routine calculates the Inverse Gaussian distribution function for the the
value P (a percentile).
SUBROUTINE GRAFINIT
Local Variables:
XMAXDEV	- global maximum x device coordinate.
YMAXDEV	- global maximum y device coordinate.
ASPECT	- global aspect ratio.
DEVCODE	- global device code produced by the
routine Grafinit.
GRAPHICS - global logical that is .TRUE, if
hardware is appropriate.
ADAPTOR	- device type.
MODE	- video mode.
RED,WHITE... - global codes for colors.
This routine gets the device type and graphics mode using the C routine VSTATS
and then initializes the graphics parameters.
SUBROUTINE GRFRAME (XMAXD, YHAXD, COLOR)
Formal Arguments:
XMAXD - maximum x coordinate.
YMAXD - maximum y coordinate.
COLOR - color of frame.
Local Variables:
X# - x coordinates.
Y# - y coordinates.
This routine draws a double lined box around the graph using routines appro-
priate for the particular graphics device.
SUBROUTINE GRVAIT
Local Variables:
KEY - key code.
Geo-EAS Programmer's Guide	3.3-18	April 1990

-------
This routine waits for the print screen command or returns.
SUBROUTINE HBOX (XI, 12, Yl, Y2)
Formal Arguments:
XI - minimum value of X coordinate.
X2 - maximum value of Y coordinate.
Yl - minimum value of Y coordinate.
Y2 - maximum value of Y coordinate.
This routine draws a box for the subroutine Plot HistoGram. All routines
beginning with a Z are GRAFLIB (library) graphics calls.
SUBROUTINE INITIALIZE
Local Variables:
VARNAM - global array containing the variable names.
MAXVAR - global parameter containing maximum number of
variables permitted.
This routine initializes the STAT1 global values.
REAL*4 FUNCTION INTERP (Yl, Y2, XI, DX, XO)
Formal Arguments:
Yl - previous datum (sample) belonging to the statistics variable.
Y2 - current datum (sample) belonging to the statistics variable.
XI - Cum (cumulative frequency corresponding to the previous sample).
DX - the weighted variable sample corresponding to the statistics variable
sample.
XO - Quartile cutoff index.
This routine calculates the interpolated quartile values.
SUBROUTINE INTRO SCREEN
This routine displays the screen frame/label/fields for the introductory
screen.
SUBROUTINE NEATAX (MIN, MAX, TINC, NTIC)
Formal Arguments:
MIN - minimum value of axis in question.
MAX - maximum value of axis in question.
TINC - tic mark, spacing.
NTIC - number of tic marks along axis.
This routinely calculates the 'neat' axis parameters. The tic mark spacing is
calculated and then the minimum and maximum values are adjusted to the nearest
tic marks.
Geo-EAS Programmer's Guide
3.3-19
April 1990

-------
SUBROUTINE NEW SCREEN (SCREEN NUMBER)
Formal Arguments:
SCREEN NUMBER - the index of the screen to be displayed.
This routine sets up a new screen.
SUBROUTINE PAXES (TYPE, TTI LE, XLABEL, YLABEL)
Formal Arguments:
TYPE - contains the Plot Title for the probability plot.
TTITLE - contains the Title for the probability plot.
XLABEL - contains the label for the X axis.
YLABEL - contains the label for the Y axis.
Local Variables:
DEVCODE - Device	code produced by the routine Grafinit.
XMIN - Global	variable containing X axis limits.
XMAX - Global	variable containing X axis limits.
YMIN - Global	variable containing Y axis limits.
YMAX - Global	variable containing Y axis limits.
This routine draws and labels the axes for the probability plot.
SUBROUTINE PERCENTILE
Local Variables:
TOPREC - Record that appears at top of screen.
BOTTOMREC - Record that appears at bottom of screen.
NUMPRESSED - Contains a digit (1...9) that determines
the percentile from which the first record
to appear on the screen is selected.
This routine processes the user's scroll commands. The command is determined
using an IF THEN ELSEIF statement based on keycodes initialized below. The
command is then processed accordingly.
SUBROUTINE PERFORM PROCESS (FIELD NAME, ERROR,
+	REPAINT)
Formal Arguments:
FIELD NAME - contains the name of the screen field.
ERROR	- logical variable that is .TRUE, if an error occurs
such as no such data file, data from file cannot be
read and erroneous user input.
REPAINT - logical variable that is always .FALSE, and
indicates if a new screen should be displayed.
Local Variables:
RETURN FIELD - contains the screen field name o£ the next field
to be processed.
NEXT FIELD - contains the # of the next screen field to be processed.
Geo-EAS Programmer's Guide
3.3-20
April 1990

-------
This routine performs application-specific functions for STATS. An IF THEN
ELSEIF statement determines which screen field has been passed to this routine
and then processes that specific screen field accordingly. The process for
most screen fields entails assigning the contents of that field to a variable.
The global variable 'Next Field' is then assigned the next field to be
processed.
SUBROUTINE PLOT HISTOGRAM
Local Variables:
MINX - global variable	containing the	world coordinate extent.
MAXX - " " " "	"	" "
MINY - " " " "	"	" "
MAXY — 11 " l! 11	ft	" 11
XMIN - global variable	containing the	x axis minimum.
XMAX - global variable	containing the	x axis maximum.
YMIN - global variable containing the	y axis minimum.
YMAX - global variable containing the	y axis maximum.
This routine plots the frequency distribution for STATS.
SUBROUTINE PLOTSTAT
Local Variables:
IFMT - internal write format.
RFMT - internal write format.
NULCH - null character.
NUMSTR - string that contains the character representation
of an integer/real value.
This routine displays only the statistics for the probability plot and the
histogram but not the graphs themselves. All routines beginning with a 'Z'
are GRAFLIB graphics calls and are used to plot text. Internal write state-
ments are used to convert integer/real values into character representations
which are then displayed on the screen.
SUBROUTINE PLUS (X, Y, MX, MY, C0L0R1, C0L0R2)
Formal Arguments:
X	- x coordinate.
Y	- y coordinate.
MX - horizontal distance on each side of x that the
dash (-) is drawn.
MY - vertical distance on each side of y that the
line (|) is drawn.
C0L0R1 - color in which the point is drawn.
C0L0R2 - color to which STAT1 is returned to.
This routine plots a plus symbol.
Geo-EAS Programmer's Guide
3.3-21
April 1990

-------
SUBROUTINE PROBABILITY PLOT
Local Variables:
MINX - World coordinate extents (includes space for margins).
MAXX - World coordinate extents (includes space for margins).
MINY - World coordinate extents (includes space for margins).
MAXY - World coordinate extents (includes space for margins).
XMIN - Global variable containing X axis limits.
XMAX - Global variable containing X axis limits.
YMIN - Global variable containing Y axis limits.
YMAX - Global variable containing Y axis limits.
This routine generates and displays the Probability Plot.
SUBROUTINE PUT HRECORD (REC, ROW)
Formal Arguments:
REC - Record number.
ROW - Rov on screen at which to display the record.
Local Variables:
IFMT	- Internal write format.
RFMT1 - Internal write format.
RFMT2 - Internal write format.
SCRATCH - character representation of an integer or real value.
FREQ	- global array which contains histogram frequency
counts for histogram class.
CUTOFF - global array of histogram class cutoffs.
FREQ	- global array of histogram frequency counts for
each histogram class.
SUMWCLASS - global array of sums of weights for each class.
RFREQ - global array of relative frequencies in each class.
MAXCLASSV - lobal array of class maximum values for each class.
CLASSAVG - global array of class averages for each class.
This routine generates and displays a histogram results line for the 'Histo-
gram Results' screen. The histogram results line on the screen consists of:
Upper Limit Freq. Sum Weights Rel F. Max. Value Class Mean
If the frequency is zero for a class then '.' appears in each column of the
row corresponding to that class. Values for each of these columns is
converted from an integer/real value to a character representation via
internal write statements and are then displayed.
SUBROUTINE PUT PRECORD (REC, ROW)
Formal Arguments:
REC - Record number.
ROW - Row on screen at which to display the record.
Geo-EAS Programmer's Guide
3.3-22
April 1990

-------
Local Variables:
IFMT - Internal vrite format.
RFMT1 - Internal vrite format.
RFMT2 - Internal vrite format.
SCRATCH - character representation of an integer or real value.
GINV - a function that calculates the inverse Gaussian
distribution function for the probability plot.
This routine generates and displays a percentiles line for the 'Examine Data'
screen. The percentiles line on the screen consists of:
'Rank Data Value Weight Cumulative Percent Probit RecNo ' .
Values for each of these columns is converted from an integer/real value to a
character representation via internal vrite statements and then displayed.
SUBROUTINE PUT PSCREEN (TOPREC, BOTTOMREC)
Formal Arguments:
TOPREC - Record that appears at top of screen.
BOTTOMREC - Record that appears at bottom of screen.
This routine displays the Percentiles screen. The call to PRecord generates
and displays one Percentiles line on the screen.
SUBROUTINE READ DATA (ERROR)
Formal Argument:
ERROR - Logical that is .TRUE, if a data file could not be
accessed or read.
Local Variables:
FILE NAME - Name of file from vhich to read data.
NVAR	- Global variable that contains the number of variables
in the Geo-EAS input data file.
NDATA - Global variable, the number of data read.
VAR	- Index for statistics variable.
WAR	- Index for veighting factor variable.
IFMT	- format specifier for internal vrite statement.
DATAREC - temporary array used to read a record a sample data
and from vhich samples are extracted.
This routine reads into memory only the samples of the statistic variable and
the veighting factor variable from the Geo-EAS input data file vhose name is
contained in 'File Name'. The statistic variables data are then sorted in
ascending order.
SUBROUTINE READ HEADER DATA (ERROR)
Formal Arguments:
ERROR - logical variable that is .TRUE, if an error occurs such as no such
data file and data from file cannot be read.
Geo-EAS Programmer's Guide
3.3-23
April 1990

-------
Local Variables:
VARNAM - global character array containing variable names.
UNITS	- global character array containing measurement
descriptions of each variable.
NVAR	- global variable that contains the number of
variables in the input data file.
NDATA	- global variable that contains the number of 'sample'
records in the input data file. In this routine it
will be set to zero.
This routine gets the title, number of variables contained in the file and the
variable names from the Geo-EAS input data file.
SUBROUTINE READ SYSTEM DEFAULTS
Local Variables:
FILE PREFIX - global variable that contains the name of the Geo-EAS data file
prefix.
DATA FILE - global variable that contains the name of the Geo-EAS data
file.
This routine reads in the data file prefix name and the input file name (if
they exist) from the 'GEOEAS.DEF' file (if it exists) and assigns these names
to the corresponding variables (character strings).
SUBROUTINE REINITIALIZE
This routine reinitializes STAT1 global values and displays the screen fields
of the Main screen.
SUBROUTINE SCROLL WINDOW (NLINES, R0W1, C0LUMN1,
+	R0W2, C0LUMN2)
Formal Arguments:
NLINES - number of lines to scroll.
R0V1 - the row (lowest numbered sample record) to scroll.
C0LUMN1 - the column number of the variable to appear in the
column furthest to the left on the screen.
R0V2 - the row (greatest numbered sample record) to scroll.
C0LUMN2 - the column number of the variable to appear in the
column furthest to the right on the screen.
This routine scrolls the area defined by upper left (rowl, columnl), to lower
right (row2, column2), by Nlines. If Nlines < 0 - Scroll up., If Nlines > 0 -
Scroll Down.
SUBROUTINE SETFMT (MAX, FMT, WIDTH)
Formal Arguments:
MAX - maximum value along the axis in question.
FMT - the output format for the values along the axis.
WIDTH - number of places required by 'Max'.
Geo-EAS Programmer's Guide
3.3-24
April 1990

-------
This routine returns the output format and vidth for axis labels. Internal
write statements are used to convert integer/real values to character
representations.
SUBROUTINE SHOW AXIS FIELDS
This routine displays the minimum, maximum and tic spacing for each of the
axes (x and y).
REAL*4 FUNCTION TIC (MIN,MAX)
Formal Arguments:
MIN - minimum value of axis.
MAX - maximum value of axis.
This function calculates and returns the tic mark spacing for an axis.
SUBROUTINE WRITE SYSTEM DEFAULTS
Local Variables:
FILE PREFIX - global variable that contains the name of the Geo-EAS data file
prefix.
DATA FILE - global variable that contains the name of the Geo-EAS data file.
This routine writes out the data file prefix name (if any) and the data file
name to the 'GEOEAS.DEF' file.
Geo-EAS Programmer's Guide
3.3-25
April 1990

-------
3.4	SCATTER
3.4.1 Software Function
Scatter produces scatter plots of variables in a Geo-EAS data file. Options
allow for log and semi-log plots and for a regression line to be calculated.
Scaling and numeric tick mark labeling for the axes are computed automati-
cally.
3.4.2 Global Variables/Program Limits
Scatter requires that the input data file contain at least 3 but not more than
48 variables. These should consist of an X and Y coordinate and a third
variable which will be posted. The data file may contain up to 10000 samples.
If the data file contains more than 10000 samples, only the first 10000 will
be used by Scatter.
The following is a description of the global variables used in SCATTER. The
format is extracted from the declaration file SCATTER.CMN.
Qkk'kkkkkkk'k'kk'k'kk'kk'k'k'k'k'k'k'k'kk'k'k'kkkkk'kkkkkkkkk'kkkkkkkkkkkkkk'kk'k'k-k'kkkk'kkk'k'kk'kkkkk
C Description for common blocks and parameter values
C Maxvar	- Maximum number of variables in the data file.
C Maxdata - Maximum number of data records in the data file.
PARAMETER (Maxvar = 48)
PARAMETER (Maxdata = 10000)
CHARACTER*60 Text
CHARACTER*80 Line
Qkkkkkkkkkkkkkkkick'k'k'k'kk'k'kkkkk'k'kk'k'k'k'k'kickk'kkkk'kk'k'kkkkkkkkkic'k'k'k'k'k'k'k kkkkiekkickkkkk
C /FILES/ -	Common block for file names.
C
C File Prefix	- File prefix for file names.
C Data File	- Data file name.
C File Name	- File name including the file prefix.
COMMON /FILES/ Data File, File Prefix, File Name
CHARACTER*14 Data File
CHARACTER*50 File Prefix
CHARACTER*64 File Name
Qkk'k'kkkk'kk'kkkkkkk'kk-k -k-kkk-kk-k-kkkkkkkkkkk kkkkk kkkkkkkkk kkkkkk kickkkkkk kkkkkk-kkkk k
C /DATFIL/	- Common block for the data file.
C
C Nvar	- Number of variables in the data file.
C Ndata	- Number of records in the data file.
C Varnam	- Array of variable names.
C Units	- Array of measurement units for each variable.
C Xarr	- Array of X coordinates for the sample points.
C Yarr	- Array of Y coordinates for the sample points.
Geo-EAS Programmer's Guide
3.4-1
April 1990

-------
C Xmin,Ymin
C Xmax,Ymax
C Nmissing
-	Minimum X and Y coordinate values.
-	Maximum X and Y coordinate values.
-	Number of missing sample values.
COMMON /DATFIL/ Nvar, Varnam, Units, Ndata,
+ 3	Xmin, Xmax, Ymin, Ymax,
+	Xarr, Yarr, Nmissing
CHARACTER*10 Varnam(Maxvar), Units(Maxvar)
REAL*4	Xmin, Xmax, Ymin, Ymax,
+	Xarr (Maxdata), Yarr(Maxdata)
INTEGER*^
Ndata, Nmissing, Nvar

C /SCRSEL/
- Common block for the screen parameters and

C
r
graphics.

V/
C Xpos,Ypos
- Toggle position for the X and Y variables

C Xlog,Ylog
- Logical variables set to true if log scaling
is
C
selected for the X or Y variable.

C Regression
- Indicates whether linear regression is

C
calculated.

C True Scale
- Logical variable set to true if the graph is
to
C
be plotted in true scale.

C Title
- Title for the graph

C Xlabel
- X axis label.

C Ylabel
- Y axis label.

C Intro
- Logical variable set to true if the introductory
C
screen is to be displayed.

C DevCode
- The type of device code.

COMMON /SCRSEL/ DevCode, Xlog, Ylog, Title, Xlabel,
+	Ylabel, Regression, True Scale, Xpos,
+	Ypos, Intro
CHARACTER*60 Title, Xlabel, Ylabel
INTEGER*4 DevCode, Xpos, Ypos
LOGICAL	Xlog, Ylog, Regression, True Scale, Intro
Geo-EAS Programmer's Guide
3.^-2
April 1990

-------
3.4.3 Data Flov and Processing
Data Flov Diagram
File Inputs
SCATTER requires a Geo-EAS data file for input. SCATTER also reads the Systen
Defaults File, if one exists, for a data file name ar.d a file prefix.
Geo-EAS Programmer's Cui.de	3.4-2	April 199',

-------
3.4.4 User Interface
The Screens
SCATTER displays tvo screens, an Introductory screen, and a Main screen. In
the file SCATTER. SCR the Introductory screen is defined as Screen 1 and the
Main screen as Screen 2. The Introductory screen displays a brief introduc-
tion and no menu options. The Main' menu has the options to allov specifi-
cation of the data file name, the selection of the variables to be used and
the options. The menu that appears on the Main screen is presented below with
the menu name and the related screen field name (in parentheses) that is used
in the SCATTER.SCR file.
The Main menu (MAINMENU)
Prefix Data Variables Options Execute Quit
The Menu Hierarchy
Scatter 	 Prefix
| Data
j Variables
Global Variable/Screen Field Relationships
Some of the fields on the screen have associated screen field names in the
screen definition file SCATTER.SCR. All of these fields have their contents
assigned to a global variable and others are assigned to local variables. The
screen fields (described by the screen label), their associated field names
(used in SCATTER. SCR; the field type is enclosed in parentheses), and the
related global variable names are listed below.
SCREEN	FIELD NAME
LABEL	(SCATTER.SCR)	GLOBAL VARIABLE
Main Screen
| Options
| Execute
\ Quit
Data File
File Prefix
PREFIX (char)
DATA FILE (char)
FILE PREFIX
DATA FILE
Variables
X Variable
Log
Y Variable
Log
XVARIABLE	(toggle)
X LOG	(toggle)
YVARIABLE	(toggl3)
Y LOG	(toggle)
XPOS
XLOG
YPOS
YLOG
Options
Regression
Equal Scaling
REGRESS (toggle)
TSCALE (toggle)
REGRESSION
TRUE SCALE
Geo-EAS Programmer's Guide
3.4-4
April 19?r,

-------
3.4.5
Processing
The following pseudocode represents the general flow of processing in SCATTER.
Processing is structured along the lines of the menu hierarchy and the
subroutine calling tree. The 'Interactive Screen Input' process is performed
by the subroutines GET SCREEN FLD and PERFORM PROCESS.
SCATTER
Initialize Graphics
Read System Defaults
Interactive Screen Input
Write System Defaults
Interactive Screen Input
IF Menu Choice = Quit THEN Return
ELSE IF Menu Choice = Data THEN
Read Data File
ELSE IF Menu Choice = Execute THEN
Display graph
ELSE
Get field values
ENDIF
3.4.6	The Outputs
Output Files
SCATTER stores the data file name and the file prefix name and the value of
the global variable INTRO into the Systems Defaults File. If the file does
not exist, Scatter creates one.
Output Screens
The output from SCATTER is a screen containing a scatter plot with an optional
regression line and regression parameters. It is generated when the Execute
menu option is chosen, by the subroutine SCATTERGRAM. See the User Guide for
an example scatter plot.
3.4.7	Subroutine Structure
The following is the subroutine calling tree for SCATTER.
SCATTER	SAM
Grafinit 	
Read System Defaults
Intro Screen 	
Get Screen Fid 	
—	Vstats
—	SAM
—	Get New Screen
|	Display Fids —
|	Perform Process
\	Scattergram 	
SAM
( 1)
( 2 I
\ Write System Defaults
Geo-EAS Programmer's Guide
3.4-5
April 1990

-------
(1) - Perform Process
SAM
Read Header Data
Get Field Group
Toggle Position
\ Get XY Data 	
—	Open File
|	Display Fids -
|	Erase Message
/	SAM
SAM
SAM
—	SAM
—	SAM
—	Open File
|	Toggle Position
|	Erase Message —
\	SAM
SAM
SAM
(2 ) - Scattergram
GRAFLIB
Neatax	Tic
Grframe 			 Hdraw
Axes	GRAFLIB
|	SAM
\ Setfrat
Plus	GRAFLIB
Regress
Plot Regline	Clip	Cliptest
\ GRAFLIB
PlotStat	SAM
\ GRAFLIB
\ Grwait	SAM
\ GRAFLIB
Libraries: SAM	- Screen Access Management
GRAFLIB - GRAFLIB Graphics Library
3.4.8 Subroutine Descriptions
Following is a list of the subroutines that appear in SCATTER. The formal
arguments (if any) are described followed by the local variables and finally a
description of what the subroutine does.
PROGRAM SCATTER (main module)
The main program performs the following:
Reads in the system defaults
Sets up the screen
Calls Get Screen Fid to display the screens and process the
user's requests
Writes to the system default file
Geo-EAS Programmer's Guide
3.4-6
April 1990

-------
SUBROUTINE AXES (TITLE1, XLABEL, YLABEL, TITLE2,
XMIN, XMAX, YMIN, YMAX, XTINC, YTINC, DEVCODE)
Formal Arguments:
TITLE1
TITLE2
XLABEL
YLABEL
XMIN, YMIN
XMAX, YMAX
XTINC
YTINC
DEVCODE
Main title for the graph.
Subtitle for the graph.
X axis label.
Y	axis label.
Minimum coordinates for the graph.
Maximum coordinates for the graph.
X axis tick mark, intervals.
Y	axis tick mark intervals.
Type of graphics device.
This routine draws and labels the tick mark for the axes, then plots the
titles and axes labels for a plot.
SUBROUTINE CUP (XI, Yl, X2, Y2, XMIN, XMAX, YMIN, YMAX)
Formal Arguments:
XI,Yl	- First point on the line.
X2,Y2	- Second point on the line.
XMIN,YMIN - Minimum X and Y coordinates for the boundary
area.
XMAX,YMAX - Maximum X and Y coordinates for the boundary
area.
This routine is for clipping lines. It was taken from pages 133-134 of
"COMPUTER GRAPHICS", by Donald Hearn and M. Pauline Baker (Prentice-Hall,
1986).
LOGICAL FUNCTION CLIPTEST (P,Q,U1,U2)
Formal Arguments:
P,Q - Coordinates of the line.
U1,U2 - The part of the line that lies within the boundary.
This routine determines whether the line can be rejected or the intersection
parameters are to be adjusted. Taken from pages 133-134 of "COMPUTER
GRAPHICS", by Donald Hearn and M. Pauline Baker (Prentice-Hall, 1986).
SUBROUTINE DISPLAY FLDS
This routine displays the current screen fields.
SUBROUTINE ERASE MESSAGE
This routine erases messages displayed in the message area of the screen.
SUBROUTINE GET FIELD GROUP
This routine gets the value for a group of screen fields.
Geo-EAS Programmer's Guide
3.4-7
April 1990

-------
SUBROUTINE GET NEW SCREEN (SCREEN NUMBER)
Formal Arguments:
SCREEN NUMBER - number of screen to display
This routine sets the current screen to screen number and then displays the
frame and labels for that screen.
SUBROUTINE GET SCREEN FLD
Local Variable:
Main Screen
Main Menu
Menu Choice
Exi t
Stores the screen number for the main screen.
Stores the name of the main menu.
Stores the user's menu selection.
Logical variable that is set to true when the
user vants to exit the program.
This routine displays the screen, accesses the menu option selected by the
user and then calls Perform Process to process the screen fields or calls a
routine to process the menu option.
SUBROUTINE GET XY DATA
This routine reads in the values for the variables selected and determines
minimum/maximum values.
SUBROUTINE GRAFINIT
This routine calls Vstats to initialize graphics parameters and sets the
global variable Devcode to the type of graphics device in use.
SUBROUTINE GRFRAME (XMAXD, YMAXD, COLOR, DEVCODE)
Formal Arguments:
XMAXD - Maximum X coordinate for the device.
YMAXD - Maximum Y coordinate for the device.
COLOR - Color to drav the frame.
DEVCODE - Type of graphics device.
This routine draws a double lined box around graph.
SUBROUTINE GRVAIT
This routine waits for the user to enter a 'p' to print the screen, or a 'q
to quit and return.
SUBROUTINE INTRO SCREEN
This routine displays the screen frame/labels/fields for the introductory
screen.
Geo-EAS Programmer's Guide
3.4-8
April

-------
SUBROUTINE NEATAX (MIN, MAX, TINC, NTIC)
Formal Arguments:
MIN	- Minimum coordinate value for the axis.
MAX	- Maximum coordinate value for the axis.
TINC	- Spacing for the tick marks.
NTIC	- The number of tick marks.
This routine calculates the spacing of the tick marks for the axes and adjusts
the minimum and maximum coordinates to the nearest tick mark so that the tick
marks are evenly space.
SUBROUTINE OPEN FILE (NUNIT, NAMFIL, STAT, OPENERR)
Formal Arguments:
NUNIT	-	File unit number.
NAMFIL	-	File name.
STAT	-	File status.
OPENERR	-	Logical variable set to true if error occurs.
This routine opens Nunit with Namfil and Stat parameters and returns Openerr =
0, if successful.
SUBROUTINE PERFORM PROCESS
Local Variables:
Field Name - Stores the screen field name.
Fexist	- Logical variable set to true if the file
exists.
Error	- Logical variable set to true if an error
occurs.
This routine identifies which screen field has been selected, performs any
error checking and then processes the screen field.
SUBROUTINE PLOT REGLINE (X1,Y1,X2,Y2,TXMIN,TXMAX,TYMIN,TYMAX)
Formal Arguments:
XI, Y1	-	Minimum point on the regression line.
X2, Y2	-	Maximum point on the regression line.
TXMIN	-	Minimum X coordinate of the graph.
TXMAX	-	Maximum X coordinate of the graph.
TYMIN	-	Minimum Y coordinate of the graph.
TYMAX	-	Maximum X coordinate of the graph.
This routine calls CLIP to plot the regression line, given the graph limits
graph limits and the equation Y = Slope * X + Intercept.
Geo-EAS Programmer's Guide
3.4-9
April 1990

-------
SUBROUTINE PLOTSTAT (DEVCODE, TXMIN, TXMAX, TYMIN, TYMAX,
NDATA, SLOPE, INTERCEPT, RSQUARED)
Formal Arguments:
DEVCODE	- The type of graphics device.
TXMIN,TYMIN - Minimum X and Y coordinates of the graph.
TXMAX,TYMAX - Maximum X and Y coordinates of the graph.
NDATA	- Number of data values.
SLOPE	- Slope of the regression line.
INTERCEPT - Y-intercept of the regression line.
RSQUARED	- The regression correlation coefficient.
This routine plots the regression statistics for the plot.
SUBROUTINE PLUS (X, Y, MX, MY, C0L0R1, C0L0R2)
Formal Arguments:
X,Y - Coordinates at which to plot the symbol.
MX, MY - Determines the size of the symbol.
C0L0R1 - Color to plot the symbol.
C0L0R2 - Initial color.
This routine dravs a plus at the specified location, in the specified color
using the Zmove and Zplot routine from the graphics library.
SUBROUTINE READ HEADER DATA (ERROR)
Formal Arguments:
ERROR - Logical variable set to true if an error occurs.
This routine reads in the header information from the data file and then sets
the screen fields. If an error occurs while reading the file an error message
is displayed.
SUBROUTINE READ SYSTEM DEFAULTS
This routine reads the system defaults file 'GEOEAS.DEF' and initializes the
system defaults.
SUBROUTINE REGRESS (XDATA, YDATA, NDATA, SLOPE, INTERCEPT,
RSQUARED)
Formal Arguments:
XDATA	- Array of X data values.
YDATA	- Array of Y data values.
SLOPE	- Slope of the regression line.
INTERCEPT - Y-intercept of the regression line,
RSQUARED - Stores the correlation coefficient.
Local Variables:
N	- Number of data values.
Xbar, Ybar - Mean of the X and Y data values.
Sumx, Sumy - Sum of the X and Y data value.
Geo-EAS Programmer's Guide
3.4-10
April 1990

-------
SumXsq,SumYsq - Sum of the X and Y data values squared.
SumXY	- Sum of the X and Y data values multiplied.
This routine calculates the regression line and correlation.
SUBROUTINE Scattergram (TITLE, XLABEL, YLABEL, XARR, YARR,
NDATA, XMIN, XMAX, YMIN, YHAX,3
REGRESSION, TRUE SCALE, DEVCODE)
Formal arguments:
TITLE	- Title for the graph.
XLABEL	- X axis label.
YLABEL	- Y axis label.
XARR	- Array of X coordinates to plot.
YARR	- Array of Y coordinates to plot.
NDATA	- Number of data points to plot.
XMIN, YMIN - Minimum X and Y coordinates for the graph.
XMAX, YMAX - Maximum X and Y coordinates for the graph.
REGRESSION - Indicates whether linear regression is calculated.
TRUE SCALE - Indicates whether to plot the graph in true scale.
DEVCODE	- Type of graphics device.
This routine sets up the graphics, draws and labels the axes, then plots the
data. If the regression option was selected the regression line is drawn.
SUBROUTINE SETFMT (MAX, FMT, WIDTH)
Formal	Arguments:
MAX	- Stores the number of characters to plot.
FMT	- Stores the format description.
WIDTH	- The number of characters in the label.
This routine returns the format and width for the axes labels.
REAL*4 FUNCTION TIC (MIN, MAX)
Formal Arguments:
MIN,MAX - Minimum and Maximum coordinate values for the axis.
This routine calculates the tick mark spacing.
INTEGER*4 FUNCTION TOGGLE POSITION (FIELD NAME)
Formal Arguments:
FIELD NAME - Stores the toggle field name.
This routine returns the toggle position for the specified toggle field.
SUBROUTINE WRITE SYSTEM DEFAULTS
This routine writes the system defaults to the system, default file
'GEOEAS.DEF'.
Geo-EAS Programmer's Guide
3.4-11
April 1990

-------
3.5
PREVAR
3.5.1	Software Function
Prevar is a preprocessor program for the program Vario. All variogram
calculations use the distance and relative direction between pairs of points
in the sampled area. Prevar computes these so that variogram parameters may
be changed and variograms recalculated more quickly in Vario. The output
from Prevar is a 'pair comparison file (PCF)'. The pair comparison file
contains the input data file contents along with distances and relative
directions between pairs of sample points. This information is used by the
program Vario to calculate variogram values. Limits may be imposed on the X
and Y coordinate values or on the distance between points in a pair. If no
limits are specified then all sample points are used for calculation. The
pair comparison file can become quite large if there are many points in the
data file. It is recommended that some limits on the distance between points
be specified.
3.5.2	Global Variables/Program Limits
Due to the storage requirements of Vario, Prevar must impose limits on the
number of sample points in the input file and on the number of pairs for which
distances and directions are computed. The input data file may contain up to
750 samples and 48 variables. If more than 48 variables exist then the data
file may not be used. If more than 750 samples exist then only 750 will be
used. If there are N sample points in an input data file and no limits were
imposed then (N2+N)/2 paired distances and directions would be computed. A
file with several hundred samples would easily generate too many pairs for
Vario. The Limits option is used to restrict the number of pairs computed.
Prevar will compute a maximum of 16384 pairs.
The following is a description of the global variables used in PREVAR. The
format is extracted from the declaration file PREVAR.DEC. The variable
description and the common block declaration follows.
Qk'k-k-k-kkk-k-kie'k'k-k-k'k'kickk-k-k-k •kk-kkkkk-k'kkkkk'k'k-kJfk'k'k'k ~
C MAXDATA - maximum samples allowed
C MAXVAR - maximum variables allowed
C MAXPAIR - maximum pairs allowed
C
PARAMETER (MAXVAR = 48, MAXDATA = 1000, MAXPAIR = 16384)
-kkk-k-k-kk •k-k-kk-k-kk-k-k-k-k-k-k-k-k-k'kk-k'kk-kk-k-k'k'k'k'k'k'k-k-k-k-k-K-x-k'k •k-k-k'k-k'k-k'k-k-kkk'k-k-kkkkk
C The following ariables are included in the common block /CHARS/.
C File Prefix -	prefix for file names
C Varnam	-	array of variable names
C Units	-	array of variable units
C Data File -	input data file
C Pair File -	output pair file
C
CHARACTER VarNam*10 (MAXVAR), Units*10 (MAXVAR),
Geo-EAS Programmer's Guide
3.5-1
April 1990

-------
Data File*14, Pair File*14, File ?refix*50
COMMON /CHAPS/ VarNam, Units. Data File,
*¦	Pair File, File Prafix
C The following variables are included in the common block /INTS/.
C
C Ndata - the number of samples (rovs in matrix)
C Nvar - the number of variables (columns)
C Xvar - column number for x coordinate
C Yvar - column number for y coordinate
C From - per to data for 1st sample in pair
C To	- ptr to data for second sample in pair
C Pair Ptr - holds sorted order index (by distance)
C Npair - the number of pairs written to file
C Seed - random seed used to select pairs
INTEGER £	Ndata, Nvar, Xvar, Yvar, Npair, Seed
INTEGER*2	From (MAXPAIR), To (MAXPAIR)
INTEGER*2	PairPtr (MAXPAIR)
COMMON /INTS/	Ndata, Nvar, Xvar, Yvar, Npair, From, To,
+	PairPtr
C****************7frr*Tr** ************tx***"**************************** ******
C The following variables are included in the common block. /FLOATS/.
C
C
X
- the array of X values
C
Y
- the array of Y values
C
Maxdist
- the maximum interpair distance to use
C
Mindis t
- the minimum interpair distance to use
C
Xmin
- minimum x coordinate value to use
C
Xmax
- maximum ...
C
Ymin
- minimum y ...
C
Ymax
- maximum ...
C
Distance
- distance for each pair
C
Direct
- direction for each pair
C
Missing
- missing value
C
Intro
- Flag for suppressing INTRO Screen
C
Fraction
- value used to subset pairs
REAL*4 X (MAXDATA), Y (MAXDATA),
+	Xmin, Xmax, Ymin, Ymax,
+	MinDist, MaxDist, Missing,
+	Distance (MAXPAIR), Direct (MAXPAIR)
LOGICAL	Intro
COMMON /FLOATS/ X, Y, Xmin, Xmax, Ymin, Ymax,
MinDist, MaxDist, Fraction
Missing, Distance, Direct, I.-.-ro
Geo-EAS Programmer's Guide
3.5-2
April W.

-------
3.5.3 Data Flov and Processing
Data Flow Diagram
Qto-IAZ
Input Data
file
User Input
GZOEAS.DEF
(Syste*
Def aui ts
file)
Pair
Comparison
File
<.PCF)
GZOEflS.DEF
(Syste*
De'aults
File)
File Inputs
PREVAR requires a Geo-EAS Data File containing at leas* three and not more
than 43 variables for input. PREVAR reads the System Defaults File, if one
exists, for an input file name and a file name prefix.
Geo-EAS Programmer's Guide
3.5-3
April 199'

-------
3.5.4 User Interface
The Screens
PREVAR displays an Intro screen and a Main screen. The Intro screen displays
a brief intro and no menu options and is defined as Screen 1. The Main screen
is interactive and is defined as Screen 2. Only one menu appears on the Main
screen and is presented below (the screen field name for the menu appears in
parentheses).
The Main menu (MAINMENU)
Prefix Files Variables Limits Subset Execute Quit
Global Variable/Screen Field Relationships
The fields on the screen in which the user enters data have associated screen
field names in the PREVAR.SCR file. Some of these fields have their contents
assigned to a global variable and others are assigned to local variables.
This becomes evident upon examination of the source code and comments. The
screen fields (described by the screen label), their associated field names
(used in PREVAR.SCR file; the field type is enclosed in parentheses), and the
related global variable name are listed below. Only the Main screen uses
input fields. The Intro screen is defined as Screen 1 and does not use screen
fields. The Main screen preceding this discussion should be used for
reference.
SCREEN LABEL	FIELD NAME	GLOBAL VARIABLE
Main screen (Screen 2)
File Prefix
FILEPREFIX (char)
FILE PREFIX
Files
Data File
Pair Comparison-
File
DATAFILE (char)
PAIRFILE (char)
DATA FILE
PAIR FILE
Variables
X Variable
Y Variable
XVARIABLE (toggle)
YVARIABLE (toggle)
XV AR
YVAR
Limi ts
Minimum X
Maximum X
Minimum Y
Maximum Y
XMIN	(real)
XMAX	(real)
YMIN	(real)
YMAX	(real)
MINDIST	(real)
MAXDIST	(real)
XMIN
XMAX
YMIN
YMAX
Minimum Distance
Maximum Distance
MINDIST
MAXDIST
Subset
Fraction
Seed
FRACTION (real)
SEED (integer)
FRACTION
SEED
Geo-EAS Programmer's Guide
3.5-4
April 1990

-------
3.5.5 Processing
The following is a discussion on the general approach used in processing the
user's menu selection. Specific details are not presented here. Further
understanding of the processing can be achieved by reading the comments in the
source code. Pseudocode for the overall process is presented at the end of
this discussion.
Processing of the user's menu selection is performed in the routine GET SCREEN
FIELDS. Nested IF THEN ELSE IF statements determine vhich menu option was
selected from the Main menu. Specific routines are then usually called that
perform the required process.
In cases where a screen field needs to be accessed as a result of a menu
selection, the routine GET FIELD GROUP is called by the routine GET SCREEN
FIELDS. GET FIELD GROUP calls the routine PERFORM PROCESS which processes the
specified screen field. This processing usually entails assigning the
contents of the screen field to a variable. In some cases processing is done
immediately, as when a data file name is extracted and the file's data is
read. The remaining routines perform specific tasks related to processing the
user's menu selection. The following pseudocode represents the general flow
of processing in PREVAR. The 'Interactive Screen Input' process is performed
by the subroutines GET FIELD GROUP and PERFORM PROCESS.
PREVAR
Ini tialize
Intro Screen
Read System Defaults
Interactive Screen Input
Write System Defaults
Interactive Screen Input
Display Main Menu - (Screen 2)
10 IF (Menu Choice = 'Quit') THEN
RETURN
ELSE IF (Menu Choice = 'Variables') THEN
Get Field Values.
ELSE IF (Menu Choice = 'Limits') THEN
Get Field Values.
ELSE IF (new Choice = 'Subset') THEN
Get Field Values.
Initialize random number generator with seed value.
ELSE IF (Menu Choice = 'Execute') THEN
Compute and write pairs information to the output file.
ENDIF
GO TO 10
Geo-EAS Programmer's Guide
3.5-5
April 1990

-------
3.5.6 The Outputs
The output from PREVAR is a 'pair comparison file (PCF)'. The pair comparison
file contains the input data file contents along with distances and relative
directions between pairs of sample points. It is an unformatted (binary)
file. Refer to the subroutine WRITE PAIRS for more information.
PREVAR stores the input file name an file name prefix (if any) into the
System Defaults File. If one does not exist then PREVAR generates one.
3.5.7
Subroutine Structure
Main - Initialize	SAM
Intro Screen	SAM
Read System Defaults— SAM
Get Screen Fields	SAM
New Screen-
-SAM
Get Field Group—Get Field
\Perform Process — Initialize	SAM
|Calc Possible Pairs-SAM
|Read Header Data	SAM
|Read Coordinates	SAM
| Random
\SA.".
Compute Pair-
\Write Pairs—
write System Defaults
\SAM
— SAM
\Qsort
—AM
3.5.8 Subroutine Descriptions
PROGRAM PREVAR (main module)
The PREVAR global variables are initialized. The Intro screen (if not
suppressed), and then the Main screen are displayed. A call to the routine
Get Screen Fields begins the processing of the menu selections.
SUBROUTINE CALC POSSIBLE PAIRS
Local Variables:
NKEPT	- contains the running total of possible pairs.
NDATA	- global variable that contains the number of 'sample'
records in the input data file.
X	- global array of X values.
Y	- global array of Y values.
This routine calculates the number of possible pairs based upon limits.
Geo-EAS Programmer's Guide
3.5-6
April 1990

-------
SUBROUTINE COMPUTE PAIRS (ERROR)
Formal Arguments:
ERROR - logical variable that is .TRUE, if maximum number of
pairs has been reached and the user does not vish to
write this data to file.
Local Variables:
VARNAM
UNITS
NVAR
NDATA
FROM
TO
IB
PA[BIR
NPAIR
PTR
global character array containing variable names,
global character array containing measurement
descriptions of each variable.
global variable that contains the number of variables
in the input data file.
global variable that contains the number of 'sample'
records in the input data file.
global array of pointers to data for 1st sample in
pair.
global array of pointers to data for second sample
in pair.
- global array that contains sorted order
index (by distance).
global variable that contains the number of pairs
written to a file.
This routine computes the pair comparison information.
SUBROUTINE GET FIELD GROUP
Local Variables:
SC FIELD NAME - array declared in the file Screen.str and
which contains the screen field names.
MAIN MENU FIELD - contains the field index number of the
Main menu.
MENU FIELD	- contains the field index number of a menu.
CURRENT FIELD - global variable declared in Screen.str that
contains the current field of the screen.
This routine gets a group of fields and then performs processes via a call
the routine Perform Process.
SUBROUTINE GET SCREEN FIELDS
Local Variables:
MAIN MENU - contains the screen field name of the Main menu.
MENU CHOICE - contains the user's menu selection.
This routine displays the screen frame/label/fields and then processes the
user's menu selection by getting the screen fields for the main screen.
Geo-EAS Programmer's Guide
3.5-7
April

-------
SUBROUTINE INITIALIZE
Local Variables:
VARNAM - global array containing the variable names.
MAXVAR - global parameter containing maximum number of
variables permitted.
MAXPAIR - maximum pairs allowed.
This routine initializes the PREVAR global values.
SUBROUTINE INTRO SCREEN
This routine displays the screen frame/label/fields for the introductory
screen.
SUBROUTINE NEW SCREEN (SCREEN NUMBER)
Formal Argument:
SCREEN NUMBER - contains the number of the screen to be displayed.
This routine sets up a new screen.
SUBROUTINE PERFORM PROCESS (FIELD NAME, ERROR, REPAINT)
Formal Arguments:
FIELD NAME - contains the name of the screen field.
ERROR	- logical variable that is .TRUE, if an error occurs
such as no such data file, data from file cannot be
read and erroneous user input.
REPAINT - logical variable that is always .FALSE, and
indicates if a new screen should be displayed.
Local Variables:
RETURN FIELD - contains the screen field name of the next field
to be processed.
NEXT FIELD - contains the number of the next screen field to
be processed.
This routine performs application-specific functions for PREVAR. An IF THEN
ELSEIF statement determines which screen field has been passed to this routine
and then processes that specific screen field accordingly. The process for
most screen fields entails assigning the the contents of that field to a
variable. The global variable 'Next Field' is then assigned the next field
to be processed.
REALM FUNCTION RANDOM (SEED)
Formal Arguments:
SEED - random generator seed.
This routine is a random number generator function. If the seed is 0 a random
number is generated, if not a table of random integers will be generated.
Therefore, call this routine first vith a nonzero in:=ger to initialize the
table, then call with a 0 to generate a random number.
Geo-EAS Programmer's Guide
3.5-8
April 1990

-------
SUBROUTINE READ COORDINATES (ERROR)
Formal Argument:
ERROR - logical variable that is .TRUE, if an error occurs
such as no such data file and data from file cannot be
read.
Local Variables:
MAXPAIR - The maximum number of pairs allowed.
MAXDATA - The maximum number of samples allowed.
DATAREC - temporary array that stores one sample for each
variable and from which the Xvar and Yvar samples
are extracted.
FILE NAME - name of data file including the prefix if any.
NVAR	- global variable that contains the number of variables
in the input data file.
NDATA - global variable that contains the number of 'sample'
records in the input data file.
NPAIR - global variable that contains the number of pairs
written to file.
This routine reads the selected X, Y coordinates into memory.
SUBROUTINE READ HEADER DATA (ERROR)
Formal Arguments:
ERROR - logical variable that is .TRUE, if an error occurs
such as no such data file and data from file cannot be
read.
Local Variables:
VARNAM - global character array containing variable names.
UNITS - global character array containing measurement descriptions of each
variable.
NVAR - global variable that contains the number of variables
in the input data file.
NDATA - global variable that contains the number of 'sample'
records in the input data file. In this routine it
will be set to zero.
NPAIR - global variable that contains the number of pairs
written to file.
This routine gets the title, number of variables contained in the file and the
variable names from the Geo-EAS input data file. If an error occurs for any
reason than an error message is displayed.
SUBROUTINE READ SYSTEM DEFAULTS
Local Variables:
FILE PREFIX - global variable that contains the name of the
Geo-EAS data file prefix.
Geo-EAS Programmer's Guide
3.5-9
April 1990

-------
DATA FILE - global variable that contains the name of the
Geo-EAS input data file.
This routine reads in a prefix name and an input file name (if they exist)
from the 'GEOEAS.DEF' file (if it exists) and assigns these names to the
corresponding variables (character strings).
SUBROUTINE WRITE PAIRS (ERROR)
Formal Arguments:
ERROR - logical variable that is .TRUE, if no pairs were
computed or if no pair file name was specified.
Local Variables:
VARNAM - global character array containing variable names.
UNITS - global character array containing measurement
descriptions of each variable.
NVAR - global variable that contains the number of variables
in the input data file.
NDATA - global variable that contains the number of 'sample'
records in the input data file.
FROM - global array of pointers to data for 1st sample
in pair.
TO	- global array of pointers to data for second sample
in pair.
PAIR PTR - global array that contains sorted order
index (by distance)
DISTANCE - global array that contains the distance for
each pair.
DIRECT - global array that contains the direction for
each pair.
NPAIR - global variable that contains the number of pairs
written to file.
DATAREC - temporary array that is used to write variable
samples.
from the data matrix to the pair comparison file.
DUMMY - character string used to read in unwanted character
strings from the data file.
This routine writes the data to the pair comparison file.
SUBROUTINE WRITE SYSTEM DEFAULTS
Local Variables:
FILE PREFIX - global variable that contains the name of the
Geo-EAS data file prefix.
DAT FILE - global variable that contains the name of the
Geo-EAS input data file.
This routine writes out a data file prefix name (if any) and an input file
name to the 'GEOEAS.DEF' file.
Geo-EAS Programmer's Guide
3.5-10
April 1990

-------
3.6	VARIO
3.6.1
Software Function
VARIO was designed to provide interactive computation and modeling of two-
dimensional variograms. The variograms are computed from data in a pair
comparison file created by program PREVAR. This is a binary file containing
data extracted from a Geo-EAS data file along with pair linkage information.
Variogram values are computed from these data for each of up to 24 pair
distance intervals (lags). Parameters are provided to control the number of
pairs used in computation by setting limits on data values, lag upper limits,
and direction. Several graphs of the results may be produced. Pair results
for individual lags may be stored in a Geo-EAS data file for further analysis
by other programs. The computed variogram may be fitted with a model, which
is used later during kriging to produce estimated values.
3.6.2 Global Variables/Program Limits
VARIO requires that the input (pair comparison) file contains no more than 48
variables with 1000 sample values and 16384 pairs. If more than 1000 sample
values exist, only the first 1000 will be used. Up to 2000 pairs may be used
in computations for one lag. The following is a listing of global variable
declarations and descriptions for VARIO. This information is contained in the
file VARIO.DEC. This file is inserted into the source files with an $INCLUDE
compiler metacommand.
C VARIO.dec - global variables for program VARIO
C
************************************** ****************************
C	Description of Global variables and program limits
C
C	MAXDATA
samples allowed
C	MAXVAR
variables allowed
C	MAXPAIR
pairs allowed
C
- maximum
- maximum
maximum
C
C
C
MAXPAIRLAG
MAXCUT0FF
MAXLAG
maximum pairs in a lag
maximum number of lag cutoffs
- maximum
number of lag intervals
C	MAXSTRUC
C	GAM????
type (used with GammaType)
- Maximum number of variogram structures
- Estimator
PARAMETER (MAXCUTOFF	= 25,
PARAMETER (MAXSTRUC	= 4)
PARAMETER (GAMABS2	= 0,
PARAMETER (GAMREL	= 1,
PARAMETER (MAXVAR	= 48 , MAXDATA
PARAMETER (MAXPAIR = 16384, MAXPAIRLAG
= 1000)
= 2000)
MAXLAG = 24)
GAMABS1 = 2)
GAMERGO = 3)
Geo-EAS Programmer's Guide
3.6-1
April 1990

-------

c
c
c
c
c
c
c
File Prefix
Varnam
Uni ts
Data File
Pair File
Title
CHARACTER
+
+
+
COMMON /CHARS/
+
+
prefix for file names
array of variable na.~es
array of variable units
input data file
output pair file
array of titles for variogram plot
VarNam*10 (MAXVAR),
DataFile*14,
FilePre
Title*60 (4)
Uni ts*10(MAXVAR),
Pair File*14,
fix*50,File Name*65,
VarNam,
Pair File,
Units,
File Prefix,
Data File,
File Name,
Title
C****************************************************************************
C	Ndata
C	Nvar
C	Xvar
C	Yvar
C	From
C	To
C	Npair
C	TotalPairs
C	Mtype
C	GammaType
C	NumNeg
C	Current Lag
C	Nmiss
C	Nkept
C	Pairs
C	DiffPtr
the number of samples (rows in matrix)
the number of variables (columns)
column number for x coordinate
column number for y coordinate
ptr to data for 1st sample in pair
ptr to data for second sample in pair
the number of pairs in pair file
the total number of pairs retained
array of type codes for modeling
code for the type of estimator
the number of sample values <= 0.0
current lag number (in lag results)
the number of missing values in data
the number of values used in calcs
an array to hold the $ pairs in a lag
array of pointers to squared diffs.
INTEGER*4 Ndata, Nvar,
INTEGER*4 Npair, TotalPairs,
INTEGER*4 Nkept, NMiss,
INTEGERS Mtype (MAXSTRUC)
INTEGER*4 Pairs (MAXLAG)
INTEGER*2 From (MAXPAIR),
INTEGER*2 DiffPtr (MAXPAIRLAG)
Xvar, Yvar, Var
Nlag, GammaType
NumNeg, Current Lag
To (MAXPAIR)
COMMON /INTS/ Ndata, Nvar, Xvar, Yvar, Var, Npair,
+	Totalpairs, Nlag, GammaType, Nkept, Nmiss,
+	NumNeg, Current Lag, Mtype, Pairs,
+	From, To, DiffPtr
Geo-EAS Programmer's Guide
3.6-2
April 1990

-------
c** ************************** *************************************************
c
Xdata
-
the array of X values
c
Ydata
-
the array of Y values
c
p
Data
-
the array of Data Values
c
Maxdis t
-
the maximum interpair distance used
c
Mindist
-
the minimum interpair distance used
c
VarMin
-
Minimum data value
c
n
VarMax
-
maximum data value to use
c
Xcmin
_
minimum x coordinate value
c
Xcmax
-
maximum ...
c
Ycmin
-
minimum y ...
c
n
Ycmax
-
maximum ...
L/
c
Distance
_
distances for each pair
c
p
Direct
-
directions for each pair
c
Direction
_
direction parameter for calculation
c
Tolerance
-
direction tolerance for calculation
c
p
BandVidth
-
Maximum bandwidth parameter
c
p
Missing
-
missing value
c
Nlag

the number of lag cutoffs
c
LagMinDist
-
First Value for lag cutoffs
c
LagMaxDist
-
Last "
c
LaglncDist
-
Lag Increment Value
c
p
LagCutoffs
-
lag cutoffs array
V
c
for each lag


c
AvgDist
-
mean distance per lag
c
LagData
-
values used in differences
c
Estimate
-
the values retained for modeling
c
Difference
-
array of differences squared
c
Mfrom, Mto
-
mean of FROM pairs, TO pairs
c
Vmin, Vmax
-
squared diff min, max for lag
c
VQ1, VQ3
-
1st and 3rd sq. diff. Quartiles
c
VMean, VMedian
-
squared diff mean, median
c
LagMean
-
mean of all values in the lag
c
LagVariance
-
variance of "
c
VarianceFrom
-
variance of FROM pairs
c
VarianceTo
-
variance of TO pairs
c
GamPowerl
-
Madogram values
c
GamPover2
-
Variogram values
c
GamRelative
-
Relative variogram values
c
p
NonErgodic
-
NonErgodic Variogram Values
c
the variogram model


c
Sill
-
Array of variogram sills
c
Range
-
Array of Variogram Ranges
c
Nugget
-
Variogram Nugget Effect
Geo-EAS Programmer's Guide
3.6-3
April 1990

-------
REAL*4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Nugget,
XCmin,
MinDis t,
VarMin,
Direction,
LagMinDis t,
Xdata
Data
Distance
Difference
LagCutoff
AvgDist
Mf rom
Vmin
VMean
VQ1
LagMean
VarianceFrom
GamPowerl
GamRelative
Sill
YCmax,
Missing,
Variance,
Bandwidth,
LaglncDis t,
Ydata (MAXDATA),
Direct MAXPAIR)
XCmax, YCmin,
MaxDis t,
VarMax, Mean,
Tolerance,
LagMaxDis t,
(MAXDATA),
(MAXDATA),
(MAXPAIR),
(MAXPAIRLAG),
(MAXCUTOFF),
(MAXLAG), Estimate(MAXLAG),
(MAXLAG),M t o (MAXLAG),
(MAXLAG), Vmax (MAXLAG),
(MAXLAG),VMed i an(MAXLAG),
(MAXLAG), VQ3 (MAXLAG),
(MAXLAG), LagVariance(MAXLAG),
(MAXLAG), VarianceTo (MAXLAG),
(MAXLAG), GamPover2 (MAXLAG),
(MAXLAG), NonErgodic (MAXLAG),
(MAXSTRUC), Range
(MAXSTRUC)
COMMON /FLOATS/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Nugget,
XCmin,
MinDist,
VarMin,
Directio
LagMinDist,
Xdata,
Data,
Distance,
Difference,
AvgDist,
Mfrom,
VMean,
LagMean,
VarianceFrom,
GamPowerl,
NonErgodic,
XCmax, Cmin, YCmax,
MaxDist,	Missing,
VarMax, Mean, Variance,
n,	Tolerance,Bandwidth,
Sill,
LagMaxDist,
Ydata,
Direct,
LagCutoff,
Estimate,
Mto, Vmin,
VMedian,
LagVariance,
VarianceTo,
GamPover2,
Range
LaglncDist,
Vmax,
VQ1,	VQ3,
GamRelative,
C Logicals
C
C Log	- the log flag for taking log of data
C Relative	- Flag for relative variograms
LOGICAL	Log,	Relative
COMMON /FLAGS/ Log,	Relative
Geo-EAS Programmer's Guide
3.6-4
April 1990

-------
C******* ********************************************* **************
C Globals for graphics
C
Xmaxdev, Ymaxdev - The maximum device extents
- the graphics mode code (used by GRAFLIB)
-	the device code
-	the video mode at program start
-	number of x and y major tickmarks
-	Aspect ratio
-	World coordinate extents for data window
-	World extents for graph window
-	tickmark intervals
-	logical (.FALSE, if not EGA, HERC, or CGA)
Gmode
Devcode
Startmode
Nxtic, Nytic
Aspect
Xmin, Xmax, .
Minx, Maxx, .
Xtinc, Ytinc
Graphics
INTEGER*^	xmaxdev, ymaxdev, gmode, devcode, Startmode
INTEGER*4	nxtic, nytic
INTEGER*4	Red, White, Yellow, Blue, Green
REAL*4	aspect, xfac, yfac
REAL*4	xmin, xmax, ymin, ymax, xtinc, ytinc
REAL*4	minx, maxx, miny, maxy
LOGICAL	Graphics
COMMON	/GRAFCOM/	xmin, xmax, ymin, ymax, xtinc, ytinc
COMMON	/GRAFCOM/	nxtic, nytic, minx, maxx, miny, maxy
COMMON	/GRAFCOM/	xmaxdev, ymaxdev, xfac, yfac, aspect
COMMON	/GRAFCOM/	gmode, graphics, devcode, Startmode
COMMON	/GRAFCOM/	white, red, yellow, blue, green
Geo-EAS Programmer's Guide
3.6-5
April 1990

-------
3.6.3 Data Floy
The follovi.-.g figure illustrates the inputs and outputs from VrJliO.
Data Flow Diagram
Geo-EAS Programmer ' s Guide
3.6-6
April 19K

-------
3.6.4 User Interface
The user interface for VARIO is managed using the SAM (Screen Access Manage-
ment) utilities. The screens, menus, and program options are all defined in
the file VARIO.SCR. Calls are made to the SAM subroutines to	display and
manage screens, menu choices and program option input.
The Screens
Vario displays seven text screens and seven graph screens. The first is an
introductory screen vhich displays information about the program. The
remaining screens are either for input of program parameters, or for dis-
playing results and graphs. The hierarchy of screens is displayed below.
Each screen in VARIO has a menu at the bottom. Control of these menus is
accomplished in the subroutine GET SCREEN FIELDS. Below is a menu tree
shoving the hierarchy of menus, and options. Above each menu is the screen
name and the screen field name for the menu (used in VARIO.SCR). Refer to t
•screen definition file VARIO.SCR for specifics.
The Screen, Menu, and Options Hierarchy
(MAINMEZtU) - Main Screen
Vano
[- Daca
|- Variable
(- Limits	(VOMENU) - Options Screen
[- Options/Execute 	p Direction
I- Mew Lags
}- Change Lags
|- Post Plot (VTV.E:;UI - Variogram Results Screen
Execute 	r Type
|- Plot
)- BoxPlot
(LRMEHU) - Lag Resuit3 Screen
[¦ Lag Results
¦ Model
T Histogram
f- Scatter Plot
|- Examine
)- Write
L Quit
(MOMEMU) - Vanograa Modeling Screen
— Model
Plot	IGOMENU) - Graph Options Sc:
|- Options —- Titles
|	Tic Spacing
|	]- Limits
|	L Quit
^ Quit
L Quit
Qui".
L Qui:
Geo-EAS Programmer's Guide	3.6-7	April

-------
Global Variable/Screen Field Relationships
All input fields on the screens have screen field names by which the screen
field contents are accessed. Each of these screen fields is associated with a
global variable. When the screen field values are entered by the user, the
subroutine PERFORM PROCESS transfers the appropriate values to the global
variables, using calls to the SET 	 VALUE subroutines in the SAM utilities.
The screen field labels, the associated screen field names (as defined in the
screen definition
file
VARIO.SCR) and 1
the related global variable names
all program inputs
are
listed below:


SCREEN LABEL

FIELD NAME

GLOBAL VARIABLE
Main Screen




File Prefix

FILEPREFIX
(Char)
FILE PREFIX
Data




Pair Comparison
File
PAIRFILE
(Char)
PAIR FILE
Variable




Variable

ZVARIABLE
(Toggle)
VAR, DATA (I)
Log Option

L0G0PTI0N
(Toggle)
LOG
Limi ts




Minimum

MINZ
(Real)
VARMIN
Maximum

MAXZ
(Real)
VARMAX
Options Screen




Direction




Direction

DIRECTION
(Real)
DIRECTION
Tolerance

TOLERANCE
(Real)
TOLERANCE
Max. Bandwidth

BANDWIDTH
(Real)
BANDWIDTH
Lag Spacing




Minimum

LAGMINDIST
(Real)
LAGMINDIST
Maximum

LAGMAXDIST
(Real)
LAGMAXDIST
Increment

LAGINCDIST
(Real)
LAGINCDIST
Lag ... Distance

LAGDIST1..
(Real)
LAGCUTOFF (I)
Results Screen




Vario. Type

VARIOTYPE
(Toggle)
GAMMATYPE (Int)
Lag Results Screen
(prompt on message line)
Variogram Modeling Screen
Model
Nugget
Type
LAGFILE (Char)
NUGGET (Real)
MO TYPE 1 (Toggle)
Local Variable
NUGGET
MTYPE (I)
Geo-EAS Programmer's Guide
3.6-8
April 1990

-------
StTill
Range
MO PARMA 1 (Real)
MO PARMB 1 (Real)
SILL (I)
RANGE (I)
Graph Options Screen
Ti ties
Main Title
TITLE1 (Char)
TITLE2 (Char)
TITLE3 (Char)
TITLE* (Char)
TITLE (1)
TITLE (2)
TITLE (3)
TITLE (4)
Subti tie
X Label
Y Label
Tickmark Spacing
X Tickmark Spacing
Y Tickmark Spacing
XTICSPACE (Real)
YTICSPACE (Real)
XTINC
YTINC
Limi ts
X Axis Minimum
X Axis Maximum
Y	Axis Minimum
Y	Axis Maximum
GMINX
GMAXX
GMINY
GMAXY
XMIN
XMAX
YMIN
YMAX
3.6.5 Processing
Menu Processing
The following pseudocode represents the general sequence of menu processing in
VARIO. Menu processing occurs in GET SCREEN FIELDS. Screen field processing
is controlled through calls to GET FIELD GROUP, vhich in turn calls PERFORM
PROCESS. All application-specific subroutines are called from GETSCREEN
FIELDS, or PERFORM PROCESS. See the subroutine structure chart for more
information. Processing details will be discussed in the sections for
individual subroutines.
VARIO
Determine graphics hardware, initialize graphics
Read system defaults
Initialize global variables
Interactive screen input
Write system defaults
Interactive screen input (GET SCREEH FIELDS)
Display Main Screen and menu, get menu choice
pIF Menu Choice = Quit
| Return to main program, terminate
(-ELSEIF	= Data
| get the data file name, read the header data into memory
[-ELSEIF	= Variable
| get variade choice and log option, read data into memory
[-ELSE IF	= Limits
| get data limits, store into memory
|-ELSEIF	= Options Execute
Geo-EAS Programmer's Guide
3.6-9
April 1990

-------
Display Options Scr?»n and menu, get menu choice
(-IF Menu Choice = Quit
Jump to main menu processing loop
|-ELSEIF	= Direction
Get direction, tolerance, bandwidth, store in memory
[-ELSEIF	= New Lags
Get lag minimum, maximum, increment, display lags
[-ELSE IF	= Change Lags
Get individual lag upper limits
(-ELSEIF	= Post Plot
Display Post Plot screen, wait for a keystroke
ELSEIF	= Execute
Compute Variogram Results
Display Variogram Results Screen + menu, get menu choice
l*IF Menu Choice = Quit
Jump to Options menu processing loop
[-ELSE IF	= Type
Get estimator type, display results for estimator
(-ELSEIF	= Plot
Display Variogram Plot, wait for a keystroke
[-ELSE IF	= BoxPlot
Display BoxPlot, wait for a keystroke
ELSEIF	= Lag Results
Get lag choice from Lag Menu,
Compute Lag Results
Display Lag Results Screen and menu, get Menu Choice
j-IF Menu Choice = Quit
| Jump to Variogram Results menu processing
[-ELSEIF	= Histogram
| Display Lag-Histogram Plot, wait for a keystroke
[-ELSEIF	= Scatter Plot
| Display Lag-Scattergram Plot, wait for a keystroke
[-ELSEIF	= Examine
| Display Examine Lag Results screen, process keystrokes
(-ELSEIF	= Write
| Get Lag Results File name, write lag results
lendif
Loop to get Lag Results menu choice
-ELSEIF	= Model
Display Modeling Screen and menu, get menu choice
rIF Menu Choice = Quit
| Jump to Variogram Results menu processing
[-ELSEIF	a Model
| Get the model parameters, store in memory
[-ELSEIF	= Plot
| Display the Variogram Plot and Model, wait for key
[-EL3EIF	= Options
| Display Graph Options Screen + menu, get Menu Choixv
| [-IF Menu Choice = Quit
| | Jump to Display Modeling Screen
| [-ELSEIF	= Titles
| | I Get titles, store into memory
Geo-EAS Programmer's Guide
3.6-10
April 1990

-------
| |	|	|	|-ELSEIF	= Tic Spacing
| |	|	|	| Get	tickmark spacing info, store into memory
| |	|	|	[-ELSE IF	= Limits
| |	|	|	| Get	axes limits, store into memory
| | | | i-e:idif
| | | | Loop to get Graph Options menu choice
| | | lENDIF
| | | Loop to get Modeling menu choice
| | lENDIF
| | Loop to get Variogram Results menu choice
| lENDIF
| Loop to cat Options menu choice
LENDIF
Loop to get Main menu choice
Error Processing
The majority of error checking is performed by the subroutine PERFORM PROCESS.
This routine checks that the program inputs are correct, and displays error
messages vhen errors occur. Refer to the source code for specific details.
Computation of the Variogram Results
Understanding the computation of variogram results requires a more detailed
explanation of the pair comparison file. This file contains "pair linkage"
information, namely the INTEGER arrays FROM and TO, which contain pointers to
the data matrix (a copy of the original data file) embedded in the file.
These pointers are accompanied by tvo other REAL parallel arrays DISTANCE and
DIRECT, vhich contain the pair distances and directions. DIRECTION is
computed as the trigonometric angle [0-180] betveen the FROM and TO sample
value locations. DISTANCE is the distance betveen sample locations, given by
the X and Y coordinates as specified in PREVAR. These arrays FROM, TO,
DISTANCE, and DIRECTION are all arranged so that DISTANCE is in increasing
order. This allows a binary search to be used for finding the first pair in a
lag. The variogram computation is performed by subroutine COMPUTE. The
following pseudocode describes the computation.
COMPUTE
FOR Each lag defined
Compute Lag Results for that lag
Accumulate total pairs count
ENDFOR
Display total pairs count
END
COMPUTE LAG RESULTS (lag number)
Initialize appropriate local and global variables
Use binary search to locate first pair in distance interval
Store this pair pointer into a temporary called PTR
Process each pair in the lag in the following manner:
Store FROM and TO values to temporaries
Geo-EAS Programmer's Guide
3.6-11
April 1990

-------
Determine if pair direction is within direction tolerance
IF it is, then
Compute difference of values, difference squared
Store a pointer to the differences (used later)
Compute the basic sums, sums squared, cross products
ENDIF
Increment PTR, jump to top of processing loop
Compute Variogram, Madogram, Relative Variogram, and NonErgodic
Variogram from sums (see source code)
Sort the differences (along with pointers) into ascending order
Compute the Minimum, Maximum, Quartiles, and Median Differences
END
The Difference pointers will be used in the Examine Lag Results screen to
display the data values, directions, distances, etc., in order of squared
difference, and by several other subroutines.
3-6.6 Outputs
The Lag Results File
Lag Results Files are the only files output from VARIO. These are Geo-EAS
format data files which are created when the Write option of the Lag Results
menu is chosen. For each pair in the chosen lag, the following information is
written to the file: The "from" and "to" values in the pair, the pair
direction in degrees, the pair distance, the pair difference, and the squared
difference. The user must specify the file name when the option is chosen.
The subroutine SAVE LAG RESULTS performs this task.
Results Screens
VARIO produces several output screens to display numeric variogram results.
These are the Variogram Results Screen and the Lag Results Screen. The
Variogram Results Screen displays the average lag distance (mean of pair
distances in the lag) and the value of the selected estimator (Variogram is
the default) for all lags specified in the options screen. Additional summary
information is displayed at the top of the screen which indicates the param-
eters chosen for computation. If no pairs were found in the specified lag, no
results will be displayed. The subroutines DISPLAY RESULTS, and DISPLAY
RESULTS HEADER produce this output. The Lag Results Screen displays statis-
tics for the specified lag. All 4 estimator values are displayed, along with
univariate statistics for the FROM and TO values, and quartiles for all
values, the differences, and the differences squared. These results are
written to the screen by subroutine VRITE LAG RESULTS.
Graphics Screens
Several graphics screens are displayed by VARIO. The exact appearance of a
graphics screen will depend on the device in use. The variable DEVCODE is
used to store the device code. This variable value is determined by sub-
routine GRAFINIT. Each graphics subroutine determines scaling and labeling
Geo-EAS Programmer's Guide
3.6-12
April 1990

-------
from the graphics device code. Scaling for axes and ticmark information is
determined automatically for all graphics screens. This is accomplished
through calls to subroutine NEATAX, which returns minimum, maximum, and
ticmark interval values for each axis. The axes for all graphs are displayed
by subroutine AXES. The tickmark labeling format is determined in AXES via
calls to SETFMT. The scaling for the Variogram/Model Plot Screen may be
changed through the Graph Options Screen (below the Modeling Menu.) The
following is a description of the graphics screens produced by VARIO: The
Post Plot Screen is accessed from the PostPlot option in the Options Menu.
It displays a graph of sample locations, and is used to determine lag spacing
information. This is accomplished by subroutine POSTPLOT.
The Variogram Plot Screen is generated by the Plot option of the Variogram
Results menu. It displays the computed variogram values. This screen is
generated by subroutine VPLOT. This subroutine is also used to generate the
Variogram/Model Plot Screen. The model curve is superimposed on the variogram
plot through a call to subroutine PLOT VMODEL. On both screens, additional
information is displayed by subroutine PLOT VSTATS.
The BoxPlot Screen is generated by subroutine BoxVplot when the BoxPlot option
of the Variogram Results Screen is selected. This screen displays boxplots
for each lag interval, shoving the range of minimum, 1st quartile, median, 3rd
quartile, mean, and maximum for the squared differences.
The Lag-Scatterplot Screen is generated by the subroutine SCATTER when the
Scatter Plot option is selected from the Lag Results menu. The Scatter Plot
is a graph of FROM values vs. TO values for all pairs in the specified lag,
and is intended to provide a view of correlation between sample values.
Subroutine PLOT LSTATS is called to plot additional information about the lag
on the right of the screen.
The Lag-Histogram Screen is generated by subroutine HISTO when the Histogram
option of the Lag Results menu is chosen. This screen displays a graph of the
histogram of squared differences for the specified lag. The histogram class
intervals are determined automatically by the subroutine NEATAX. Subroutine
PLOT LSTATS is called to display additional information about the lag on the
right side of the screen.
The Examine Screen
The Examine Lag Results screen is displayed when the Examine option of the Lag
Results menu is selected. This screen displays information about each pair in
the specified lag, including the FROM and TO pointers and values, the dis-
tances, the directions, and the squared sample value differences. These are
displayed in ascending order of distance. The subroutine EXAMINE performs
this task. It uses subroutine PUT ERECORD, PUT ESCREEN, and SCROLL to accom-
plish this. The cursor control keys are used to control the scrolling of the
display.
Geo-EAS Programmer's Guide
3.6-13
April 1990

-------
3.6.7
Subroutine Structure
Vario Subroutine Calling Tree:
Vario
GrafInit
Vstats
SAM
SAM
Initialize 	
(- Intro Screen 	
|- Read System Defaults — SAM
|- Get Screen Fields
1	r SAM
(- New Screen 	
(- Display Options Header
|- PostPlot 	
SAM
SAM
Neatax
Axes —
|- Display Results Header
|- Compute 	
Cross, Plus
GRAFLIB
GrWait
SAM
—	Tic
-y GRAFLIB
[SetFmt
—	RAFLIB
Sea rchB
|- Vplot Defaults
\¦ Display Results 	
(¦ Display Model Results
Vplot 	
|- Box Vplot
¦ Histogram
Compute Lag Results 	
Display Result 	 SAM L Retain
Neatax
SAM
Display Result
SAM
Axes
Plus, Cross
Plot Vmodel 	 Gamma
Plot Vstats 	 GRAFLIB
GrWait
Axes
Neatax
Soxplot 	 GRAFLIB
Plot Vstats
GRAFLIB
Grwait
Axes
Neatax
Boxplot
Hbox 	
GRAFLIB
- Scatter
[- Examine
GRAFLIB
GrWait
Axes
Meatax
Plus
Plot Lstats
GRAFLIB
G rWa11
Put Escreen
GPJ.FLIB
?'Jt Erecord
Geo-EAS Programmer's Guide
3.6-14
April 1990

-------
Subroutine Calling Tree (continued)
|	| |- Put Erecord 	 SAM
|	| L Scrol1
|	1- Get Field Group 	 (1)
|- Write	System Defaults
L SAM
(1 ) —j- Get Field (SAM)
L Perform Process
|- Reinitialize
-j- S ATI
L Initialize
f- Read Header Data 	 SAM
|- Read Data 	j- SAM
I	I
|	| Default Lags 	 Set Up Lacs
|	>- Stats
|- Load Results 	 SAM
|- Display Results 	 SAM
|- Vplot Defaults
|- Reset Lags 	 SAM
|- Set Up Lags 	 SAM
f- Display Lag Cutoffs 	 SAM
|- Arrange Lag3 	 Rank
)- Erase Model 	 SAM
L SAM
Libraries: SAM	- Screen Access Management
GRAFLIB - GRAFLIB Graphics Library
The preceding diagram, called a "subroutine calling tree" displays the
subroutine structure for VARIO. This should be used as a reference when
tracing program logic. Calls to utilities which are members of libraries are
shown with abbreviated library names. Several trivial subroutine calls have
been omitted to conserve space. To locate a given subroutine in the source
code. Refer to the file FILES.DOC, which contains for all source file names,
the names and arguments of subroutines in each source code file, and the calls
made from each subroutine.
Geo-EAS Programmer's Guide	3.6-15	April 1990

-------
3.6.8 Subroutine Descriptions
The following section contains descriptions for the individual subroutines for
VARIO. The Subroutine Calling Tree should be used for reference to trace
subprogram calls. To locate the source code for an individual subroutine,
refer to the file FILES.DOC in the source code directory or listings. The
subroutines are listed in increasing alphabetic order. A general description
is included for each subroutine which describes the software function, the
formal arguments (if any), and the subroutine calls made (if any).
PROGRAM VARIO
This is the main module for program VARIO. It accesses the System Defaults
File, initializes variables and calls the main menu processing routine GET
SCREEN FIELDS.
Subroutines Called:
Graflni t
Ini tialize
Read System Defaults
Intro Screen
Get Screen Fields
Write System Defaults
SAM - Setmod
SUBROUTINE Arrange Lags
This module sorts lag cutoff values into increasing order (in case a lag value
cutoff value was entered out of order). This sorting is accomplished with
subroutine RANK. ARRANGE LAGS is called from PERFORM PROCESS. Calls to SAM
are made to set the screen field values and display the sorted field contents.
Subroutines Called:
Rank.
SAM - Set 4Floating Point Value, Display One Field
Geo-EAS Programmer's Guide
3.6-16
April 1990

-------
SUBROUTINE Axes (Titlel, xlabel, ylabel, Title2,
Xmin, Xmax, Ymin, Ymax, Xtinc, Ytinc, DevCode)
Formal Arguments:
TITLE1	- Main title for the graph
XLABEL	- X axis labels
YLABEL	- Y axis label
TITLE2	- Secondary title for graph
XMIN, XMAX - X axis min and max
YMIN, YMAX - Y axis min and max
XTINC, YTINC - X and Y axis tickmark intervals
DEVCODE	- Device type code
Subroutines Called:
GRAFLIB - GetVor, ZyLine, Zlborg, Zlbdir, Zmove, Zplot, Zlabel
SAM - Left Justify
This subroutine displays axes, with labeled tickmarks, axes labels, and two
titles. The numeric tickmark label formats are computed with subroutine
SETFMT. Calls to GRAFLIB are made to draw the graphs and text.
SUBROUTINE Box (X, Y, Mx, My, Colorl, Color2)
Formal Arguments:
X, Y	- The	coordinates of the symbol center
MX, MY	- the	width and height of the symbol
C0L0R1	- the	symbol color
C0L0R2	- the	color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This routine draws a box centered at X, Y, using calls to GRAFLIB
SUBROUTINE Box Plot (TMin, TQ1, TMedian, Tmean, TQ3,
TMax, Horizontal, Position, Width, DeltaX)
Formal Arguments:
TMIN, TMAX
TQ1, TQ3
TMEDIAN, TMEAN
HORIZONTAL
POSITION
VIDTH
DELTAX
The minimum and maximum data values
The 1st and 3rd quartiles
the median and mean
a flag to set the direction of the boxplot
the X (or Y) location for the box center
the width of the box (in X, or Y)
the width of the bar for the mean
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This module draws a boxplot oriented horizontally, or vertically, depending
the logical variable HORIZONTAL. The width, and center position of the box
interpreted as units in X, or Y, depending upon the logical's value.
Geo-EAS Programmer's Guide
3.6-17
April

-------
SUBROUTINE Box Vplot
Subroutines Called:
NeatAx, Axes, Boxplot, Plot Vstats, GrWait
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale, Z^ove, Zplot
SAM - Flash
This routine displays a variogram box plot on the screen and waits for a
keystroke before returning. This is accomplished through calls to GRAFLIB,
and several utility subroutines.
SUBROUTINE Compute
Subroutines Called:
Compute Lag Results, Display Result, PutStr, Erase
This subroutine computes the variogram results for all lags, and displays them
on the Variogram Results screen.
SUBROUTINE Compute Lag Results (I)
Formal Arguments:
I - The lag number for which results are to be computed
Subroutines Called:
Qsort, SearchB
SAM - PutStr, Flash, Erase
This subroutine computes results for an individual lag. A binary search is
performed to determine the first pair in the lag >= to the lag minimum
distance. Then for each successive pair < lag cutoff and within the direction
tolerance statistics are accumulated which are used to compute the spatial
correlation estimators including the Variogram, Madogram, Relative Variogram,
and Non-Ergodic Variogram.
SUBROUTINE Cross (X, Y, Mx, My, Colorl, Color2)
Formal Arguments:
X, Y	- The	coordinates of the symbol center
MX, MY	- the	width and height of the symbol
C0L0R1	- the	symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine draws an 'X' symbol centered at the point X, Y
Geo-EAS Programmer's Guide
3.6-13
April 1990

-------
SUBROUTINE Default Lags
Subroutines Called:
Neatax
Set Up Lags
SAM - Set 4 Floating Point Value
This subroutine sets up default lags the first time the data is read into the
program. These are based upon the minimum and maximum interpair distances.
The minimum, maximum, and lag increment values are computed, then Set Up Lags
is called to load the lag cutoff array with values. SAM routines are called
to load the screen fields with the cutoff values.
SUBROUTINE Display Lag Cutoffs
Subroutines Called:
Display One Field
Erase Field
This subroutine displays the lag cutoffs. It loops from 1 to the maximum
number of lags (24), and either displays the lag cutoff, or erases the field,
in case there are fewer lags than before.
SUBROUTINE Display Model Results
Subroutines Called:
SAM - PutStr
This subroutine displays the variogram results on the Modeling Screen. This
is accomplished with a call to the SAM routine PutStr.
SUBROUTINE Display Options Header
Subroutines Called:
SAM - Write Field, Erase, PutStr
This routine displays summary information at the top of the Options screen.
These are accomplished with calls to the SAM routines.
SUBROUTINE Display Result (K, Np, D, E)
Formal Arguments:
K	- The	number of the lag
NP	- the	number of pairs in the lag
D	- the	average distance for the lag
E	- the	value of the spatial correlation estimator
Subroutines Called:
SAM - PutStr
This routine displays a variogram result for one lag.
Geo-EAS Programmer's Guide
3.6-19
April 1990

-------
SUBROUTINE Display Results
Subroutines Called:
Display Result
This subroutine displays variogram results for all defined lags on the
Variogram Results screen.
SUBROUTINE Display Results Header
Subroutines Called:
PutStr
This subroutine displays summary information at the top of the Variogram
Results screen. Information such as the lag minimum, maximum, and interval,
the direction, tolerance, bandwidth, and tolerances are displayed.
SUBROUTINE Erase Model (Number)
Formal Arguments:
NUMBER	- the number of the structure to erase
Subroutines Called:
SAM - Erase Field
This subroutine is used to erase a row containing a variogram structure when
the variogram type has been set to none in the Model option of the Variogram
Modeling screen. It is called by subroutine PERFORM PROCESS.
SUBROUTINE Examine (LagNum)
Formal Arguments:
LAGNUM	- the number of the lag to be examined
Subroutines Called:
Put Escreen
Scroll Window
Put ERecord
SAM - Flash, GetCha, Erase
This subroutine displays a screen with information about each pair in the lag
specified by LAGNUM. If there are more data than will fit on the screen, the
cursor control keys are used to scroll the display. The subroutine GETCHA
gets the keyboard input. PUT ESCREEN is used to update the entire screen, and
PUT ERECORD is used to update a line on the screen. SCROLL uses the Microsoft
C language interface to call the BIOS screen scrolling function, which will
scroll the screen up or down by one line. On each line, the FROM and TO
pointers and values are displayed along with the dis:ance, direction, and the
squared difference for the pair.
Geo-EAS Programmer's Guide
3.6-20
April 1990

-------
SUBROUTINE Get Field Group
Subroutines Called:
Get Field
Perform Process
Nev Screen
This subroutine is called by GET SCREEN FIELDS to get all field values for a
screen field group. For each field in the group, a GETFIELD call is used to
allow the user to enter the appropriate value or choice, then PERFORM PROCESS
is called to perform error checking and transfer the screen field contents to
global variables.
SUBROUTINE Get Screen Fields
Subroutines Called:
Nev Screen
Get Field Group
Display Options Header
PostPlot
Display Results Header
Compute
Vplot Defaults
Display Results
Vplot
Box Vplot
Display Model Results
Compute Lag Results
Write Lag Results
Histo
Scat ter
Examine
SAM - Put Menu, Get Menu Choice, Set Menu Position
Set Toggle Position
This subroutine does most of the vork for VARIO. It performs the menu
processing, controls display of the options and results screens, and the
graphics screens. The basic processing is outlined in pseudocode in the
previous section on processing, so it will not be repeated here. The SAM
routines are used to perform menu handling and screen display. The routine
GET FIELD GROUP is called, which calls PERFORM PROCESS to handle error
checking and transfer of screen field contents to global variable values.
Geo-EAS Programmer's Guide
3.6-21
April 1990

-------
SUBROUTINE Graflnit
Subroutines Called:
VSTATS
VIDEO
This subroutine is used to determine the device type, and to set the values of
the global graphics variables. The C function VSTATS is used to determine the
device type and several other parameters, through the assembler routine VIDEO.
The device extents, the aspect ratio, and device type code (DEVCODE) are then
set depending upon which (if any) graphics card is identified. The following
are the possible values for DEVCODE:
0	-	OTHER - no supported graphics device found
1	-	HERC - Hercules graphics card found
2	-	CGA - Color Graphics Adaptor found
3	-	EGA - Enhanced Graphics Adaptor
If DEVCODE is returned as 0 (OTHER), the global logical GRAPHICS is set to
.FALSE, and no graphics screens will be generated by the graphics subroutines.
SUBROUTINE Hbox (XI, X2, Yl, Y2)
Formal Arguments:
XI, X2	- The left and right-hand box coordinates
Yl, Y2	- The top and bottom coordinates for the box
This subroutine is called by HISTO to plot a rectangle with lower left corner
at XI, Yl, and upper right corner at X2, Y2.
Subroutines Called:
GRAFLIB - Zmove, Zplot
SUBROUTINE Histo (LagNum)
Formal Arguments:
LagNum	- the number of the lag being plotted
Subroutines Called:
Neatax
Axes
Boxplot
Hbox
Plot Lstats
GrVai t
SAM - Flash, PutStr
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale
Geo-EAS Programmer's Guide
3.6-22
April 1990

-------
SUBROUTINE Initialize
This subroutine initializes the global variable values.
SUBROUTINE Intro Screen
Subroutines Called:
SAM - Set Screen, Display Frame, Display Labels, Locate Cursor
Flash, Erase
This subroutine displays the introductory screen, and vaits for a keystroke
before returning. It is called from the main program module and uses SAM
routines to display the screen.
SUBROUTINE Load Results
Subroutines Called:
Display Result
This subroutine is used to load the appropriate estimator values into their
screen fields for display on the Variogram Results screen. This is called
from PERFORM PROCESS after the Type parameter (type of estimator) has been
changed.
SUBROUTINE Minus (X, I, Mx, Colorl, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
MX, MY	- the width and height of the symbol
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine plots a minus symbol (dash) centered at X, Y
SUBROUTINE Neatax (Min, Max, Tine, Ntic)
Formal Arguments:
Min	- The minimum value for the axis
Max	- the maximum value for the axis
Tine	- the tickmark interval
Ntic	- the number of tickmarks
Function Calls:
Tic
This routine determines "neat" axis scaling parameters. On entry the REAL
variables MIN and MAX should contain the actual minimum and maximum values of
the data to be displayed. These values are changed by NEATAX, so temporaries
should be passed. Because of this, it is extremely IMPORTANT not to pass a
Geo-EAS Programmer's Guide
3.6-23
April 1990

-------
constant value to this routine. The variables TINC and NTIC are computed as
the tickmark spacing and'number of tickmarks for the axis. The changed
values of MIN and MAX should be used for the axis minimum and maximum. The
function TIC is called to determine the "neat" scaling parameters.
SUBROUTINE New Screen (Screen Number)
Formal Arguments:
SCREEN NUMBER - the number of the screen to display
Subroutines Called:
SAM - Set Screen, Display Frame, Display Labels
This subroutine displays the specified screen, frame and fields.
SUBROUTINE Perform Process (Field Name, Error, Repaint)
Formal Arguments:
Field Name	- The name of the screen field
Error	- .TRUE, is an error occurred
Repaint	- Regenerate the screen if .TRUE.
Subroutines Called:
Relni tialize
Read Header Data
Read Data
Load Results
Display Results
Vplot Defaults
Set Up Lags
Display Lag Cutoffs
Arrange Lags
Erase Model
Save Lag Results
SAM - Get Character Value,. Set Character Value,
Set 4 Floating Point Value, Get Toggle Value
Set Toggle Position, Left Justify, Erase Field
Display One Field
This subroutine performs the error checking for VARIO. It is called by
subroutine GET FIELD GROUP, which is in turn called from GET SCREEN FIELDS.
The Screen field name is used to determine the proper action to take. An
IF..ELSEIF block is used to determine which screen field has just been
processed. Error handling logic is included to perform bounds checking on
real and integer variables, and to check the validity of file names. This is
where the screen field contents are transferred to global variables, (if no
error occurs) This is accomplished through calls to Get 	 Value in the
SAM utilities. For screen fields such as file names, the routines are called
to read the input data, through READ HEADER DATA and READ DATA, and to write
results (SAVE LAG RESULTS). See the subroutine calling tree or the source
code for more information.
Geo-EAS Programmer's Guide
3.6-24
April 1990

-------
SUBROUTINE Plot LStats (LagNum, Txmin, Txmax, TyMin, Tymax)
Formal Arguments:
LAGNUM	- the lag number
TXMIN, TXMAX - the minimum and maximum X values for the graph
TYMIN, TYMAX - the minimum and maximum Y values for the graph
Subroutines Called:
SAM - Locate Cursor, Put Characters
GRAFLIB - Zlborg, Zmove, Zlabel
This subroutine displays summary information about the lag on the right side
of the graph. This subroutine is called from SCATTER PLOT and from HISTO. If
the device is a Hercules, GRAFLIB calls are made to display the text, other-
wise SAM routines, (using BIOS) are called, (the BIOS calls put out text
faster.)
SUBROUTINE Plot Vmodel
Subroutine Calls:
GRAFLIB - Zcolor, Zmove, Zplot
FUNCTION Gamma
This subroutine plots the model curve on the graphics screen. It is called
from subroutine VPLOT. Function Gamma is called to compute the variogram
value for a range of discrete distances which match the range of lag values.
GRAFLIB routine are called to plot the model curve.
SUBROUTINE Plot VStats (Txmin, Txmax, TyMin, Tymax)
Formal Arguments:
TXMIN, TXMAX - The X min and max for the graph
TYMIN, TYMAX - the Y min and max for the graph
Subroutines Called:
SAM - Locate Cursor, Put Characters, Right Justify
GRAFLIB - Zlborg, Zmove, Zlabel
This subroutine is called from VPLOT and BOXVPLOT to plot summary information
on the right side of the graphics screen. The coordinate minimums and
maximums are used to determine the location of the text. If a Hercules
graphics card is found, then the GRAFLIB calls are used to plot the text,
otherwise the SAM utilities, using assembler calls to BIOS, are used.
Geo-EAS Programmer's Guide
3.6-25
April 1990

-------
This routine returns the output format and vidth for axis labels. Internal
write statements are used to convert integer/real values to character
representations.
SUBROUTINE SHOW AXIS FIELDS
This routine displays the minimum, maximum and tic spacing for each of the
axes (x and y).
REAL*4 FUNCTION TIC (MIN,MAX)
Formal Arguments:
MIN - minimum value of axis.
MAX - maximum value of axis.
This function calculates and returns the tic mark spacing for an axis.
SUBROUTINE WRITE SYSTEM DEFAULTS
Local Variables:
FILE PREFIX - global variable that contains the name of the Geo-EAS data file
prefix.
DATA FILE - global variable that contains the name of the Geo-EAS data file.
This routine writes out the data file prefix name (if any) and the data file
name to the 'GEOEAS.DEF' file.
Geo-EAS Programmer's Guide
3.3-25
April 1990

-------
SUBROUTINE Qsort (A, P, N)
Formal Arguments:
A - Array of REAL values
P - Array of INTEGER pointers (P (I) = I, for all I = 1,...,N}
N - The number of values in A and P
This subroutine uses the quicksort algorithm to sort the values in A into
ascending order. The values of P are sorted in parallel with the values in A
so that they may be used as pointers to other arrays parallel with A.
SUBROUTINE Qsortl (A,N)
Formal Arguments:
A - Array of REAL values
N - The number of values in A
This subroutine uses the quicksort algorithm to sort the values in A into
ascending order.
SUBROUTINE Rank (A, N)
Formal Arguments:
A - Array of REAL values
N - The number of values in A
This subroutine uses a shell sort to sort A into ascending order.
SUBROUTINE Read Data (Error)
Formal Arguments:
ERROR - error flag
Subroutines Called:
Default Lags
SAM - Set ^Floating Point Value, Display One Field, PutStr
Erase, Beep, Erase Field, Flash
This subroutine reads the data values into memory from the data file. If an
error occurs during file access the variable ERROR is set to .TRUE. A call is
made to DEFAULT LAGS on the first data file read to compute default lag cutoff
values. The SAM routines are used to display pertinent information on the
screen, or to display error messages if any errors occur. The coordinate
values are stored into memory, and the minimum and maximum coordinate values
are determined at this time for use in the Post Plot Screen.
SUBROUTINE Read Header Data (Error)
Formal Arguments:
ERROR - error flag
Geo-EAS Programmer's Guide
3.6-27
April 1990

-------
Subroutines Called:
SAM - Set 4Floating Point Value, Display One Field, PutStr
Erase, Beep, Erase Field, Flash, Load Toggle Values
Flash
This subroutine reads the header data into memory from the data file. If an
error occurs during file access the variable ERROR is set to .TRUE. The
variable names and units are read into memory. The variable names are stored
into toggle fields on the screen. The SAM routines are used to display
pertinent information on the screen, or to display error messages if any
errors occur.
SUBROUTINE Read System Defaults
Subroutines Called:
SAM - Set Character Value
This subroutine is called from the main program module. It accesses the
system defaults file (GEOEAS.DEF) and retrieves the File Prefix and Data File
name. The default PAIR FILE value is constructed by replacing the data file
name extension with '.pcf'. If the file does not exist, no values are given
to these variables. The SAM utilities are used to store these values into
their screen fields.
SUBROUTINE Reinitialize
Subroutines Called:
Ini tialize
Reset Lags
SAM - Set Toggle Position, Set Character Value
Set 4Floating Point Value, Display One Field
This subroutine is used to reset the global variables and screen field
contents to their default values. This routine is called from PERFORM
PROCESS, when a new file is to be read, or a file read error occurred.
SUBROUTINE Reset Lags
Subroutines Called:
SAM - Set Character Value, Erase Field
This subroutine is called by PERFORM PROCESS to reset lag values when the New
Lags option has been called. The screen fields for the lag cutoff values are
erase and displayed through calls to SAM.
SUBROUTINE Save Lag Results (File, Error)
Formal Arguments:
FILE - Lag Results file name
ERROR - set to .TRUE, if an error occurred
Geo-EAS Programmer's Guide
3.6-28
April 1990

-------
Subroutines Called:
SAM - PutStr, Erase
SearchB
This subroutine save the pair information for the specified lag to the speci-
fied Lag Results File. The subroutine SEARCHB is used to find the first pair
in the lag interval. Then all pair data for the lag are written to the file.
This subroutine contains code fragments from the subroutine COMPUTE LAG
RESULT. The same logic is used to access the FROM and TO values, and compute
the differences, and squared differences. For more information about the lag
results file, refer to the previous subsection on program output.
SUBROUTINE Scatter (LagNum)
Formal Arguments:
LAGNUM - the lag number
Subroutines Called:
NeatAx
Axes
Plus
Plot Lstats
GrWait
SAM - Flash
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale, Zmove, Zplot
This subroutine is called from GET SCREEN FIELDS to produce a Lag-Scatterplot.
This is a plot of FROM values vs. TO values. For all pairs in the specified
lag interval. Axes scaling is determined automatically using subroutine
NEATAX. The axes are plotted using AXES. Additional information is displayed
at the right of the screen by a call to PLOT LSTATS.
SUBROUTINE Set Up Lags
Subroutines Called:
SAM - Set ^Floating Point Value, Set Character Value
This subroutine is called by PERFORM PROCESS to load the lag cutoff values
into their screen fields. The SAM utilities are used to accomplish this.
SUBROUTINE Setfmt (Max, Fmt, Width)
Formal Arguments:
MAX - the value to use for determining the format
FMT - the character FORTRAN format specifier for the value
VIDTH - the maximum number of characters in FMT
This subroutine is called from AXES to determine the format to use for
plotting numeric tickmark labels on the X and Y axes. The algorithm works as
follows. The variable VIDTH is used as the format width. The fractional part
of MAX is extracted and multiplied by ten until it becomes a whole number.
Geo-EAS Programmer's Guide
3.6-29
April 1990

-------
The number of times this happens is counted, and this value is used as the
number of digits to the right of the decimal place.
SUBROUTINE Vplot (Type)
Formal Arguments:
TYPE - the type of plot (If 1, then plot model too)
Subroutines Called:
Axes
Plus, Cross
Plot Vmodel
Plot Vstats
GrWai t
SAM - Flash
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale
This subroutine is called from GET SCREEN FIELDS to display the Variogram
Pplot, and the Variogram Plot/Model screens. The routine AXES is called to
display the axes. The plus and cross symbols are plotted to identify
variogram estimates. If TYPE = 1 then the model curve is plotted through a
call to PLOT VMODEL. The routine PLOT VSTATS is used to display summary
information on the right side of the screen. Subroutine GRWAIT is used to
wait for a keystroke. If a 

is pressed a hardcopy of the screen is produced at the printer. GRAFLIB routines are used to do the plotting, and SAM routine to display error messages. SUBROUTINE Vplot Defaults Subroutines Called: NeatAx SAM - Set Character Value, Set 4 Floating Point Value This subroutine is used to compute default scaling values for the variogram plot. This code was isolated because when the type of estimator is changed, new defaults need to be computed. The computed values are loaded into the screen fields in the Graph Options screen so that they may be subsequently modified for re-display during variogram modeling. This is accomplished with calls to the SAM utilities. Geo-EAS Programmer's Guide 3.6-30 April 1990


-------
SUBROUTINE Write Lag Results (I)
Formal Arguments:
I - the number of the lag
Subroutines Called:
SAM - PutStr
This subroutine is used to display lag results for an individual lag. These
are computed by subroutine COMPUTE LAG RESULTS. The screen display is
accomplished with a call to the SAM routine PUTSTR.
SUBROUTINE Vrite System Defaults
This subroutine writes the current values of FILE PREFIX and DATA FILE to the
system defaults file. If this file is not found, it is created. The Data
File name is constructed by taking the current value of PAIR FILE, and placing
a '.dat' file extension on it.
Geo-EAS Programmer's Guide
3.6-31
April 1990

-------
3.7
XVALID
3.7.1	Software Function
The name Xvalid stands for 'cross-validation'. Cross-validation involves
estimating values at each location in a sampled area by kriging the
neighboring sample values. The estimates are compared to the original
observations in order to test if the hypothetical variogram model and
neighborhood search parameters will accurately reproduce the spatial
variability of the sampled observations. The estimated values, associated
kriging errors, residuals, and other useful statistics are displayed on a
summary screen. Scatter plots and histograms may be obtained for a quick
summary of these results. Results may be stored in a Geo-EAS data file for
further analysis.
3.7.2	Global Variables/Program Limits
Xvalid requires that the input data file contains at least 3 but no more than
48 variables. Two of these variables must represent the coordinates of sample
locations. No more than 1000 samples may reside in the data file. If more
than this number are encountered, only the first 1000 values will be used for
cross-validation. The limit for the number of neighbors to be used for
kriging is 64 (the limit on the system of equations is 65x65).
The following is a listing of the file of global variable declarations used in
XVALID. This file is named XVALID.DEC. It is included in XVALID source files
with the $INCLUDE: compiler metacommand.
C	File Xvalid.Dec	- Global variable declarations to be
C SINCLUDED in subroutines of program Xvalid
C
C	Descriptions for	common block and parameter values
C
C	MAXDATA	- Maximum number of rows in input data matrix
C	MAXVAR	- Maximum number of columns in input data matrix
C MAXSTRUC	- Maximum number of nested variogram structures
C	MAXNEIGHBOR	- Maximum number of neighbors in kriging system
C	MAXEQ	- Maximum number of equations in system
PARAMETER (MAXDATA = 1000)
PARAMETER (MAXVAR	= 48)
PARAMETER (MAXSTRUC = 4)
PARAMETER (MAXNEIGHBOR = 64)
PARAMETER (MAXEQ	= MAXNEIGHB0R+1)
Geo-EAS Programmer's Guide
3.7-1
April 1990

-------
C Input data
C
C Data
C Xdata, Ydata
C Ndata
C Nvar
C Xvar, Yvar
C Var
COMMON
COMMON
COMMON
Data vector
Coordinates
Number of rows in File
Number of columns in file
Index of X, Y coordinate variable in file
Index of krige variable in file
Xdata, Ydata, Data, Ndata, Ql, Q2, Q3
Nvar, Var, Xvar, Yvar
Nmiss, NumNeg, NZeroDist
REAL*4	Xdata (MAXDATA), Ydata (MAXDATA)
REAL*4	Data (MAXDATA), Ql, Q2, Q3
INTEGER*4	Ndata, Nvar, Var, Xvar, Yvar
INTEGER*4	Nmiss, NumNeg, NZeroDist
C character variables
C
C
C
C
C
C
Varnam
Units
Data File
Output File
Title
Array of variable names in data matrix
Array of measurement units for each variable
Data file name
Output estimates file name
header for output file, title for graphs
CHARACTER*10 Varnam (MAXVAR), Units (MAXVAR)
CHARACTER* 14 Data File, Output File
CHARACTER Title*70, File Prefix*50
COMMON /CHBLOCK. / Varnam, Units, Data File, Output File
COMMON /CHBLOCK / Title, File Prefix
Geo-EAS Programmer's Guide
3.7-2
April 1990

-------
Qkk'kk'k'kkkk'k'k'k'kkkk'kkkkkkkkkkkkkkkkkkk'kkkk'kk'kkkkkkkkk'kk'kkkk-kkkk-kkk
C variogram models parameters
C
C
C
C
C
C
C
C
C
C
Vrmajor - Array of major variogram ranges for structures
Vrminor - Array of minor variogram ranges for structures
Vrangle - Array of variogram ellipse angles for structures
Sill - Array of variogram sills for model structures
Mtype - Array of model type codes " " "
Nstruc - Array containing the number of structures/model
Mglobal - Global mean for simple kriging
Nugget - nugget effect
REAL*4	Vrmajor (MAXSTRUC), VrMinor (MAXSTRUC)
REAL*4	Vrangle (MAXSTRUC)
REAL*4	Sill (MAXSTRUC)
REAL*4	Mglobal, Nugget
INTEGER** Mtype (MAXSTRUC), Nstruc
COMMON	Vrmajor, Vrminor, Vrangle, Sill, Mtype,
COMMON	Mglobal,Nugget
+Nstruc
Srmajor - Major radius for the search ellipse
Srminor - Minor radius for the search ellipse
Srangle - Angle between X grid axis and major axis
MinDist - Minimum separation from neighbor
Maxp - Maximum number of points in search area
Minp - Minimum number of points in search area
Maxps - Maximum number of points per sector
Nsector - # sectors (1= circle, 4 = quadrants, 8 = octants)
Maxempty- Maximum number of consecutive empty octants
Yvalptr - Pointer list to data (parallel to Sptr)
YValues - List of ascending Y coordinate values
REAL*4	Srmajor, Srminor, Srangle,
REAL*4	Yvalues (MAXDATA), MinDist
INTEGER*4	Maxp, Minp, Maxps, Maxempty, Nsector
INTEGER*4	YvalPtr (MAXDATA), Zptr (MAXDATA)
INTEGER*4	Ktype
COMMON	Srmajor, Srminor, Srangle, Nsector
COMMON	Maxp,Minp,Maxps,Maxempty
COMMON	Yvalptr,Yvalues,Mindist
£ kkkkkkkkkkkkkk kk kkkk-kkkkkkkkkkkk-kkkkkkkkkkk-kkkkkkkk k x kkkkk k "kick k
C Ktype - Code for type of kriging (1 = ordinary, 2 = simple)
INTEGERS Ktype
COMMON Ktype
Geo-EAS Programmer's Guide
3.7-3
April 1990

-------
-kick *	kkkk-k -kk-kkk -kick J? kk"k "kick kkk -kick ~~~ ~	k -kick k -xt kkkk-k ~ ~~ ~ ~
C Missing	- Missing value used by program
LOGICAL
COMMON
Missing
Missing
Qk-k'k-kkkkkkkkkkk-k-k-k-k-k-k-k'k-k'k'k-k'k-k'k'kk'k-k'k'kkk'k'k'k'k'k-k-k-k'k'k'kkkkkkkk'k-k'k'k'k'k'k'k
C	debug flags
C	Debug System	-	Matrix output flag
C	Debug Neighbors	-	Plot of Neighbors
C	Debug Weights	-	List of Neighbors and weights
C	Log	-	Flag for log transform
C	Euclidean	-	Flag for Euclidean or Variogram Distance
LOGICAL	Debug System, Debug Neighbors, Debug Weights
LOGICAL	Log, Euclidean
COMMON	Debug System, Debug Neighbors, Debug Weights
COMMON	Log, Euclidean
Q'k-k-k-kicjfk'k'k k •k-kk'k-k'k'k'kick'k'k'kic JcJckjc "kick ic icicle kick-kick ifk-k-k -k k -kk kkkk k'kick'k'k-kic'k'k
C Minimum, Maximum: used to indicate +/- infinity
REAL*4 Minimum, Maximum
COMMON	Minimum, Maximum
Q'k'k-k'k'k'kk'k-k-kkkk'k'k'k'k'k'k'k-k'k'k'k'k'k'k'k-k'k-k'k'k'k'k'k'k'k'k-k-k'k'k'k-k-k'k'k-k-kkkkkick'kJck'k-k'k'k
C kriging system and related variables
C
C
C
C
C
C
C
W, B, B2
Estimate
Variance
Difference
Zscore
NumEstimate
REAL*4
REAL*4
REAL*4
REAL*4
REAL*4
REAL*4
Kriging system
Estimated values
Error of estimates
(Estimate - data value)
(Difference / Variance)
number of estimates produced
W (MAXEQ, MAXEQ)
B (MAXEQ), B2 (MAXEQ)
Cvv, GamMax, Vk, Sk
Estimate (MAXDATA), StdDev (MAXDATA)
Difference (MAXDATA), Zscore (MAXDATA)
Variable (MAXDATA)
COMMON W, B, B2, Cvv, GamMax
COMMON Variable, Estimate, StdDev, Difference, Zscore
COMMON Zptr, Vk, Sk
Geo-EAS Programmer's Guide
3.7-4
April 1990

-------
Qrrrr-r-xyr'X-rT-xrcx'x-rT'x-x'fmrT
C Giobals for graph
C
C
C
C
C
C
C
C
c
c
c

~ re7r,*,***,rrT?r^r7r,7r7r7r'7rx-rr'T,^±rr"T"rTTT,T'*x'rTr'?r7r,jrr
.CS
Xmaxdev, Ymaxdev
Gmode
Devcode
S car "mode
Nxtic, Nytic
Aspect
Xmin, Xmax. ...
Minx, Maxx. ...
Xtinc, Ytinc
Graphics
INTEGER*4
REAL*4
REAL*4
REAL*4
INTEGER*4
IN7ZGER*4
LOGICAL
-	The maximum device extents
-	the graphics mode code (used by GRAFLI3)
-	the device code
-	the video mode at program star:
-	number o£ x and_y major tickmarxs
-	Aspect ratio
-	World coordinate extents for da:a vindov
-	World extents for graph vindov
-	tickmark intervals
-	logical (.FALSE, if not EGA, HEP.C, or CGA)
Xmaxdev, ymaxdev, gmode, devcode. Startmode
aspect, xfac, yfac
xmin, xmax, ymin, ymax, xtinc, ytinc
minx, maxx, miny, maxy
nxtic, nytic
Red, White, Yellow, Blue, Green
Graphics
COMMON	/GRAFCOM/ xmin, xmax, ymin, ymax, x:inc, ytinc
COMMON	/GRAFCOM/ nxtic, nytic, minx, maxx, miny, maxy
COMMON	/GRAFCOM/ xmaxdev, ymaxdev, xfac, yfac, aspect
COMMON	/GRAFCOM/ gmode, graphics, devcode. Startmoae
COMMON	/GRAFCOM/ white, red, yellow, blue, green
(;*•:***•*¦*'*•*******¦*•*— it*-* *************** ****** ************><•**•**¦* *7r**
C Stats variables V - Variable S - Stdev Z - Zscora
C	E - Estimate D - Difference
INTEGER*^	VNMiss, VN
REAL*4	VMedian, Vmin, Vmax, VQ1, VQ3, VMea.-.. VStd
INTEGER*4	ENMiss, EN
REAL*4	EMedian, Emin, Emax, EQ1, EQ3, EMear.. EStd
INTEGER*4	SNMiss, SN
REAL^4	SMedian, Smin, Smax, SQl, SQ3, SMear.. SStd
INTEGER*4	DNMiss, DN
REAL*,4	DMedian, Dmin, Dmax, DQ1, DQ3, DMea.-., DStd
INTEGER*4	ZNMiss, ZN
REAL*4	ZMedian, Zmin, Zmax, ZQ1, ZQ3, ZMear., ZStd
COMMON	VNMiss, VN, VMean, VStd
COMMON	VMedian, Vmin, Vmax, VQ1, VQ3
COMMON	ENMiss, EN, EMean, EStd
COMMON	EMedian, Emin, Emax, EQ1, EQ3
COMMON	SNMiss, SN, SMean, SStd
COMMON	SMedian, Smin, Smax, SQl. SQ3
COMMON	DNMiss, DN, DMean, DScd
COMMON	DMedian, Dmin, Dmax. DQ1. DO3
COMMON	ZNMiss, ZN, ZMean, ZS"d
COMMON	ZMedian, Zmin, Zmax, ZQ1. ZQ3
Geo-EAS Programmer's Gu;de
3.7-5
April 199r,

-------
3.7.3 Data Flov
The folloving figure illustrates the inputs and outputs from X7ALID.
Data Flov Diagram
Geo-EAS Pr-^ranmer ' s Guide
3.7-6
April W.

-------
3.7.4 User Interface
The user interface for XVALID is managed using the SAM (SCreen Access Manage-
ment) utilities. The screens, menus, and program options are all defined in
the file XVALID.SCR. All screen and menu management is controlled by sub-
routine GET SCREEN FIELDS. From this subroutine, calls are made to the SAM
subroutines to display and manage screens, menu choices and program option
input. The subroutine PERFORM PROCESS does the screen field error checking,
and displays error messages. All application-specific modules are called
from these two subroutines.
The Screens
XVALID displays three text screens and several graph screens. The first is an
introductory screen which displays information about the program. The remain-
ing screens are either for input of program parameters, or for displaying
results and graphs. The hierarchy of screens is displayed below.
Each screen in XVALID has a menu at the bottom. Control of these menus is
accomplished in the subroutine GET SCREEN FIELDS. Below is a menu tree
shoving the hierarchy of menus and options. Above each menu is the screen
name and the screen field name for the menu (used in XVALID.SCR). Refer to
the screen definition file XVALID.SCR for specifics.
The Screen, Menu, and Options Hierarchy
(MAINMENU) - Main Screen
Xvalid 	[- Prefix
}- Data
f- Variables	(OPTIONS) - Options Screen
|- Options/Execute 	p Type
L Quit	(- Search
[- Model	(RESULTS) - Results Screen
(- Execute 	1- Error Map
|- Debug	J- Scatter Plot
L Quit	|- Histogram
|- Write
|- Examine
L Quit
Global Variable/Screen Field Relationships
All input fields on the screens have screen field names by which the screen
field contents are accessed. Each of these screen fields is associated with a
global variable. When the screen field values are entered by the user, sub-
routine PERFORM PROCESS transfers the appropriate values to the global vari-
ables, using calls to the SET 	 VALUE subroutines in the SAM utilities.
The screen field labels, the associated screen field names (as defined in the
screen definition file XVALID.SCR) and the related global variable names for
all program inputs are listed belov:
Geo-EAS Programmer's Guide
3.7-7
April 1990

-------
SCREEN LABEL
FIELD NAME
GLOBAL VARIABLE
Main Screen
File Prefix
FILEPREFIX
(Char)
FILE PREFIX

Data





Data File Name
DATAFILE
(Char)
DATA FILE

Variables





X Coordinate
XVARIABLE
(Toggle)
XVAR, XDATA
(I)
Y Coordinate
YVARIABLE
(Toggle)
YVAR, YDATA
(I)
Variable to Krige
VARIABLE
(Toggle)
VAR, DATA (I)
Log Option
L0G0PTI0N
(Toggle)
LOG

Options Screen





Type





Kriging Type
TY
KRIGE
(Toggle)
KTYPE

Search





R Major
SE
RMAJOR
(Real)
SRMAJOR

R Minor
SE
RMINOR
(Real)
SRMINOR

Angle
SE
ANGLE
(Real)
SRANGLE

Min Dist.
SE
MINDIST
(Real)
MINDIST

Distance Type
SE
DTYPE
(Toggle)
EUCLIDEAN

Num. Sectors
SE
ETYPE
(Toggle)
NSECTOR

Max Pts/Sector
SE
MAXPO
(Toggle)
MAXPS

Min Pts to Use
SE
MINPT
(Toggle)
MINP

Empty Sectors
SE
MAXEMPT
(Toggle)
MAXEMPTY

Model





Nugget
VM
NUGGET
(Real)
NUGGET

Global Mean
VM
MGLOBAL
(Real)
MGLOBAL

Type (1-4)
VM
TYPE 1
(Toggle)
MTYPE (I)

Sill (1-4)
VM
SILL 1
(Real)
SILL (I)

Major Range (1-4)
VM
RMAJOR1
(Real)
VRMAJOR (I)

Minor Range (1-4)
VM
RMIN0R1
(Real)
VRMINOR (I)

Ellipse Angle (1-4)
VM
ANGLE 1
(Real)
VRANGLE (I)

Results Screen





(prompt on message line)
OUTFILE
(Char)
OUTPUT FILE

(prompt on message line) TYPSCATTER (Toggle) Local
Geo-EAS Programmer's Guide	3.7-8	April 1990

-------
3.7.5 Processing
Menu Processing
The following pseudocode represents the general sequence of menu processing in
XVALID. Menu processing occurs in GET SCREEN FIELDS. Screen field processing
is controlled through calls to GET FIELD GROUP, which in turn calls PERFORM
PROCESS. All application-specific subroutines are called from GETSCREEN
FIELDS, or PERFORM PROCESS. See the subroutine structure chart for more
information. Processing details will be discussed in the sections for
individual subroutines.
XVALID
Determine graphics hardware, initialize graphics
Read system defaults
Initialize global variables
Interactive screen input
Writs system defaults
Interactive screen input (GET SCREEN FIELDS)
Display Mam Screen and menu, get menu choice
|-IF Menu Choice = Quit
| Return to main program, terminate
[•ELSEIF = Data
| get the data file name, read the header data into memory
(-ELSEIF = Variables
| get variables choices and log option, read data into memory
[-ELSEIF = Options Execute
| Display Options Screen and menu, get menu choice
| |-IF Menu Choice = Quit
| | Jump to main menu processing loop
| (-ELSEIF =¦ Type
| | Get type of kriging to perform, store in memory
| (-ELSEIF = Search
| | Get search parameters, store in memory
| l-ELSEIF a Model
| | Get variogram model parameters
| (-ELSEIF = Debug
| | Display information about activating the debug displays
| f-ELSEIF = Execute
| | Call the kriging routine KRIGER to perform the kriging
| | Display Results Screen and menu, get menu choice
| | (-IF Menu Choice = Quit
| | | Jump to Options menu processing loop
| | [-ELSEIF	= Error Map
| | | Display the Error Map Plot Screen
| | l-ELSEIF	= Scatter
| | | Get Scatter Plot type, display Scatter Plot Screen
| | [-ELSEIF	= Histogram
| | | Display Histogram Plot Screen
| | l-ELSEIF	= Write
| | | Get file name, call routine to save results
Geo-EAS Programmer's Guide
3.7-9
April 1990

-------
|	|	f-ELSEIF	= Examine
|	|	| Display	the Examine Cross Validations Results Screen
|	|	t-ENDrF
|	|	Loop to get	Results menu choice
| Lendif
| Loop to get Options menu choice
LENDIF
Loop to get Main menu choice
Knger
Determine graph scaling information
Initialize global kriging variables
rIF (EGA-DEVICE) THEN
| Generate Kriging Display (PLOTDATA)
[-ELSE
| Leave the options screen as the kriging display
LENDIF
write the results headings at the bottom of the screen
(-FOR all sample values in the input file DO
| Check the status of the debug keys, set debug variables
| IF the debug keys are off - regenerate default display
| Call the search routine to find the neighbors
| IF (Debug Neighbors) Display neighbors screen
| Call the subroutine to build the system of equations
| IF (Debug System) Display the system of equations screen
| Call the routine to solve the system
| IF (Debug Weights) Display the kriging weights screen
| IF (EGA-DEVICE) erase the sample value symbol and plot
| + the symbol for the estimated value
| Display the results at the bottom of the screen
| Store the results into global arrays
LENDFOR
Compute the statistics for results using STATS
Sort the kriging errors (DIFFERENCES) and pointers ascending
Generate a tone to indicate that kriging is completed
wait for a keystroke
END
Error Processing
The majority of error checking is performed by the subroutine PERFORM
PROCESS. This routine checks that program inputs are correct, and displays
error messages when errors occur. Refer to the source code for specific
details.
3.7.6 Outputs
The Results File
Cross Validation Results Files are the only files output from XVALID. All
other outputs are in the form of test or graphics displays. The Results file
is a Geo-EAS format data file created vhen the Write option is selected from
Geo-EAS Programmer's Guide
3.7-10
April 1990

-------
the Results Menu. It contains the sample coordinate values, the sample
values, the estimates, the differences (estimate-sample value), the kriging
standard deviations, and the normalized error (difference/kriging standard
deviation). These data are saved to a Geo-EAS data file by subroutine WRITE
ESTIMATES. See the source code for more detail.
The Kriging Display
XVALID produces a graphics display when kriging which displays color coded
symbols at the original sample locations, and replaces them with color coded
symbols for the estimates, as each estimate is kriged. Four colors are used.
The color coding is based upon the quartile interval for the sample value or
estimate. This display is only generated when an EGA graphics card is
present. Otherwise, the Options screen is left on the display. The numeric
results are displayed at the bottom of the screen in both cases. These
include the coordinates of the sample value, the estimate, the kriging
standard deviation, and the number of neighbors used to krige the estimate.
When kriging is completed, the display remains active until a  is pressed.
The Debug Displays
The Debug Displays are used to display intermediate information while the
kriging proceeds. These routines are called from subroutine KRIGER. The
subroutine GETSHF is used to determine the status of the keys which activate
these displays. This allows the user to enable and disable the generation of
these displays during kriging. The Caps-Lock key activates the Debug
Neighbors Display. If no graphics card is present, then an alternate text
display is generated. The graphics version of this display shows the sample
locations, and the search ellipse. The neighbors are highlighted with special
symbols. This display allows the user to determine if the search parameters
specified produce an adequate number of neighbors. The Debug System Display
is activated by the Scroll-Lock key. It is a text display showing the
contents of the systems of equations arrays. The Num-Lock key activates the
Debug Neighbors Display. This display shows the kriging weights produced by
the system solver, and several other intermediate results used in computing
the kriged estimate and standard deviation. If any debug display is acti-
vated, the Kriging Display is deactivated. As each Debug Display is gener-
ated, the  key must be pressed to continue. If all debug displays are
subsequently de-activated, the kriging display is regenerated.
The Results Screen
The Results Screen is displayed by subroutine WRITE RESULTS, which is called
from GET SCREEN FIELDS. The display contains the results of the cross vali-
dation. Summary information is displayed at the top of the screen, including
the data file name, the names of the coordinate and kriging variables, the log
option, and the type of kriging. Below the summary information are displayed
the univariate statistics for the sampled values, the estimates, differences,
kriging standard deviations, and zscores. These statistics include the
minimum, 1st quartile, median, 3rd quartile, maximum, mean, standard devi-
ation, and the number of data in each array.
Geo-EAS Programmer's Guide
3.7-11
April 1990

-------
Graphics Screens
Several graphics screens are displayed by XVALID. The exact appearance of a
graphics screen viil demand on the device in use. The '.'ariable DEVCODE is
used to score the device rode. This variable value 13 determined by sub-
routine SEIAFINIT. Each graphics subroutine determir.es scaling and labeling
from the graphics device code- Scaling for axes aiwi ticaark. information is
determined automatically foe all graphics screens. This is accomplished
through calls co subroutine NSATM, vhich returns minimum, maximum., and
cicsnarks interval values for each axis. The axes for all graphs are displayed
by subroutine AXES. The tickmark labeling format is determined in AXES by
calls to SETFMT. The foilaving is a description of the- graphics screens
produced by XVALID:
Error Kap
This display is produced by subroutine FLQTUATft, vith TT?:IFLAG sat to I. It
is called frcm GST SCRStS FIEL35 shea the Krcor Map aptivn on the Results SErt
is sel-ectad. This is a plot vhicfc displays the fcriging error at each sample
location. The Krigin^	is the difference tretvaan the est!nate and the
sample valce. These values are stored in the array DIFFERENCE. ?ositive
differences are marked vit'n a '+' symbol, and negative values are marked with
an 't- Tha size &£ the synfccls is scaled by the magnitude for the differ-
ence, so that large diEEerecces ars si.csf.'ad as lar^e-" syasrls- Univariate
statistics fcr the ditferer.ces are displayed at the right of tiie screen,
through a call to PL0T3TATS.
The Scatter Plot
"This display depicts cr.e of two possible scatter plots, d&p^zditig, on the
user's selection. Ice display is gerveratsd ssfcrcctire 5C*TTSP. ?L0T.
called Eratn fERFOif.*! PROCESS. A variable TTPEFLAG is passed to itjdicaxe t'12
plot type. I £ TYPEFLAG » 0, then the estimates are plotted against the
sample values, otherwise they are plotted against the differences.
The Histogram
"This display is generated by subroutine HISTO, which is called from GUT
SCREEN FIELDS. It depicts a histogram of the differences. The histograms
class limits are determined automatically by the subroutine NEATAX.
Univariate statistics for the differences are displayed at the right of the
screen through a call to PL0T5TA7S.
The Examine Results Display
This display is generated by subroutine ESAHISE, called from subroutine GET
SCBEEN FIELDS, vban the Examine option is selected in the Results Menu. This
screen is a scrolling display containing the kri^ing results for each sample
value. The values displayed include the record positions af the sample values
in the data Eile, the sample valuas. the estimates? tfts differences, the
kriging standard deviation, and the zscores. The cursor control keys may be
used to position the display. These values are sorted by difference, so that
Geo-EkS. 'Prqgrauimfer' 3 Guide
3.7-12
April 1990

-------
the largest kriging errors are at the top of the display. The routines PUT
ESCREEN, PUT ERECORD, and SCROLL VINDOV are called from EXAMINE to control the
scrolling of the display.
3.7.7 Subroutine Structure
Xvalid Subroutine Calling Tree:
Xvalid
GrafInit
Vstats
SAM
SAM
|- Initialize 	
(- Intro Screen 	
(- Read System Defaults — SAM
|- Get Screen Fields 	1- SAM
GRAFLIB
New Screen 	 SAM
|- Write Options Header — SAM
|- Check Parms . . .
Get File Name
|- Build File Mame
[¦ Get Field Group 	 (1)
|- Kriger 	 (2)
|- Write Results 	 SAM
|- Plot Data 	[- Legend 	
L Plus, Cross, Box, Circle — GRAFLIB
|- Axes 	
Plot Value
¦ Histogram
GRAFLIB
GRAFLIB
GRAFLIB
L Plus, Cross, Box
f- Plot Error 	1- GRAFLIB
I	L Plus, Minus, Cross
I- PlotStat 	r SAM
L GRAFLIB
Neatax 	 Tic
(- Axes 	 GRAFLIB
GRAF
L examine
Write System Defaults
L SAM
|- GRAFLIB
|- Hbox 	 GRAFLIB
|- BoxPlot 	 GRAFLIB
f- PlotStat 	[- SAM
L GrWait	L GRAFLIB
-p Put Escreen — Put Erecord
[- Put Erecord — SAM
L Scroll
Geo-EAS Programmer's Guide
3.7-13
April 1990

-------
(1 ) —p Get Field (SAM)
L Perform Process —r Reinitialize
SAM
L Initialize
Read Header Data — SAM
Read Data 	p SAM
|- Qsort
|- Neatax 	
L Stats
Build File Name
Blank File
Erase Model 	
Write Estimates
Scatter 	
SAM
Tic
—	SAM
—	SAM
-p Neatax
|- Axes —
Tic
GRAFLIB
Kriger
L (2) —p Hew Screen
|- SAM
)- Plot Data
(• Get File Name
|- GetShf
(¦ Plot Kriging Grid
I
|- Circle - GRAFLIB
I
[• Search 	
|- Plot Neighbors
|- Show Neighbors
|- Build System —
f- Solve System —
I
|- Show System 	
(- Show Weights —
|- Plot Value 	
|- Stats
|- Finish Beep 	
L GrWait 	
(• Boxplot 	 GRAFLI3
L GrWait
-p GRAFLIB
|- Legend 	 GRAFLXB
(- Plot Value
L Plot Cell
-p Bsearch
|- Insert 	 Bsearch
L Sector
-p Axes 	 GRAFLIB
|- Cross, Plus , Box
(- GRAFLIB
L GrWait
—	SAM
—	Gamma
-p SiaEq
!- SAM
—	SAM
—	SAM
—	GRAFLIB
Sound (SAM)
GRAFLIB
Libraries: SAM	- Screen Access Management
GRAFLIB - Graphics Utilities
The preceding diagram, called a "subroutine calling tree" displays the
subroutine structure for XVALID. This should be used as a reference when
tracing program logic. Calls to utilities which are nembers of libraries are
shown with abbreviated library names. Several trivial subroutine calls have
Geo-EAS Programmer's Guide
3.7-14
April 1990

-------
been omitted to conserve space. To locate a given subroutine in the source
code. Refer to the file FILES.DOC, which contains for all source file names,
the names and arguments of subroutines in each source code file, and the calls
made from each subroutine.
3.7.8 Subroutine Descriptions
The following section contains descriptions for the individual subroutines for
XVALID. The Subroutine Calling Tree should be used for reference to trace
subprogram calls. To locate the source code for an individual subroutine,
refer to the file FILES.DOC in the source code directory or listings. The
subroutines are listed in increasing alphabetic order. A general description
is included for each subroutine which describes the software function, the
formal arguments (if any), and the subroutine calls made (if any).
PROGRAM XVALID
This is the main module for program XVALID. It access the System Defaults
File, initializes variables and calls the main menu processing routine GET
SCREEN FIELDS.
Subroutines Called:
Graflnit
Ini tialize
Read System Defaults
Intro Screen
Get Screen Fields
Write System Defaults
SAM - Setmod, Clear Screen
SUBROUTINE Axes (Titlel, xlabel, ylabel, Title2,
Xmin, Xmax, Ymin, Ymax, Ztinc, Ytinc, DevCode)
Formal Arguments:
TITLE1	- Main title for the graph
XLABEL	- X axis labels
YLABEL	- Y axis label
TITLE2	- Secondary title for graph
XMIN, XMAX - X axis min and max
YMIN, YMAX - Y axis min and max
XTINC, YTINC - X and Y axis tickmark intervals
DEVCODE	- Device type code
Subroutines Called:
GRAFLIB - GetWor, ZyLine, Zlborg, Zlbdir, Zmove, Zplot, Zlabel
SAM - Left Justify
This subroutine displays axes, with labeled tickmarks, axes labels, and two
titles. The numeric tickmark label formats are computed with subroutine
SETFMT. Calls to GRAFLIB are made to draw the graphs and text.
Geo-EAS Programmer's Guide
3.7-15
April 1990

-------
SUBROUTINE Box (X, Y, Mx, My, Colorl, Color2)
Formal Arguments:
X, Y	- The	coordinates of the symbol center
MX, MY	- the	width and height of the symbol
C0L0R1	- the	symbol color
C0L0R2	- the	color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This routine draws a box centered at X, Y, using calls to GRAFLIB
SUBROUTINE Box Plot (TMin, TQ1, TMedian, Tmean, TQ3,
THax, Horizontal, Position, Vidth, DeltaX)
Formal Arguments:
TMIN, TMAX
TQ1, TQ3
TMEDIAN, TMEAN
HORIZONTAL
POSITION
VIDTH
DELTAX
-	The	minimum and maximum data values
-	The	1st and 3rd quartiles
-	the	median and mean
-	a flag to set the direction of the boxplot
-	the	X (or Y) location for the box center
-	the	width of the box (in X, or Y)
-	the width of the bar for the mean
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This module draws a boxplot oriented horizontally, or vertically, depending on
the logical variable HORIZONTAL. The width, and center position of the box is
interpreted as units in X, or Y, depending upon the logical's value.
SUBROUTINE Build System (XO, TO, Neighbors, N,
TNeighbors, TN, ZeroFlag)
Formal Arguments:
XO, YO -	the coordinates of the value to be kriged
Neighbors -	an array of pointers to neighbors
N	-	the number of neighbors found by SEARCH
Tneighbors -	array of pointers to neighbor values (non-missing)
TN	-	the number of neighbors in TNEIGHBORS
ZeroFlag -	the number of zero-distance pairs found
Subroutines Called:
FUNCTION Gamma
This subroutine builds the system of equations used in kriging. It is called
from KRIGER. The function GAMMA is called to fill the kriging matrix.
Geo-EAS Programmer's Guide
3.7-16
April 1990

-------
SUBROUTINE Check Parrns
Subroutines Called:
Get Field Group
SAM - Flash
This subroutine is called from GET SCREEN FIELDS prior to calling KRIGER, to
check, if all parameters have been entered correctly. If this is not the case,
CHECK PARMS calls get field group to force the user to enter all the appro-
priate parameters, before kriging begins.
SUBROUTINE Circle (X, Y, R, Color1, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
R	- the radius of the circle
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine is called from KRIGER to plot a circle symbol vhen an estimate
cannot be produced.
SUBROUTINE Cross (X, Y, Mx, My, Color1, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
MX, MY	- the width and height of the symbol
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine draws an 'X' symbol centered at the point X, Y
SUBROUTINE Erase Model (Number)
Formal Arguments:
NUMBER	- the number of the structure to erase
Subroutines Called:
SAM - Erase Field
This subroutine is used to erase a row containing a variogram structure when
the variogram type has been set to none in the Model option of the Options
screen. It is called by subroutine PERFORM PROCESS.
Geo-EAS Programmer's Guide
3.7-17
April 1990

-------
SUBROUTINE Examine
Subroutines Called:
Put Escreen
Scroll Window
Put ERecord
SAM - Flash, GetCha, Erase
This subroutine generates a display of the results of cross validation which
can be scrolled using the cursor control keys. The routine PUT ESCREEN dis-
plays an entire screen, and the routine PUT ERECORD displays on line of infor-
mation. The routine SCROLL WINDOW is called to scroll the screen up or down
by one line. The sample value, estimate, difference, kriging standard devi-
ation, and the zscore are displayed for each of the sample locations. The
list is ordered by difference (kriging error).
SUBROUTINE Finish Beep
Subroutines Called:
SAM - Sound
This subroutine generates a warbling tone when kriging has been completed. It
is called from subroutine KRIGER.
SUBROUTINE Get Field Group
Subroutines Called:
Get Field
Perform Process
New Screen
This subroutine is called by GET SCREEN FIELDS to get all field values for a
screen field group. For each field in the group, a GETFIELD call is used to
allow the user to enter the appropriate value or choice, then PERFORM PROCESS
is called to perform error checking and transfer the screen field contents to
global variables.
SUBROUTINE Get Screen Fields
Subroutines Called:
Get Field Group
Write Options Header
Check Parms
Kriger
Write Results
PlotData
Histogram
Examine
SAM - Nev Screen, Put Menu, Get Menu Choice
Set Menu Position, Set Toggle Position
Geo-EAS Programmer's Guide
3.7-13
April 1990

-------
This subroutine does most o£ the work for XVALID. It performs the menu pro-
cessing, controls display of the options and results screens, and the graphics
screens. The basic processing is outlined in pseudocode in the previous
section on processing, so it will not be repeated here. The SAM routines are
used to perform menu handling and screen display. The routine GET FIELD GROUP
is called, which calls PERFORM PROCESS to handle error checking and transfer
of screen field contents to global variable values.
SUBROUTINE Graflnit
Subroutines Called:
VSTATS
VIDEO
This subroutine is used to determine the device type, and to set the values of
the global graphics variables. The C function VSTATS is used to determine the
device type and several other parameters, through the assembler routine VIDEO.
The device extents, the aspect ratio, and device type code (DEVCODE) are then
set depending upon which (if any) graphics card is identified. The following
are the possible values for DEVCODE:
0	-	OTHER	-	no supported graphics device found
1	-	HERC	-	Hercules graphics card found
2	-	CGA	-	Color Graphics Adaptor found
3	-	EGA	-	Enhanced Graphics Adaptor
If DEVCODE is returned as 0 (OTHER), the global logical GRAPHICS is set to
.FALSE, and no graphics screens will be generated by the graphics
subroutines.
SUBROUTINE Hbox (XI, 12, Yl, Y2)
Formal Arguments:
XI, X2	- The left- and right-hand box coordinates
Yl, Y2	- The top and bottom coordinates for the box
Subroutines Called:
GRAFLIB - Zmove, Zplot
This subroutine is called by HISTO to plot a rectangle with lower left corner
at XI, Yl, and upper right corner at X2, Y2.
Geo-EAS Programmer's Guide
3.7-19
April 1990

-------
SUBROUTINE Histogram
Subroutines Called:
NeatAx
Grframe
Axes
Boxplot
Hbox
PlotStat
GrVai t
SAM - PutStr
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlborg, Zlocat, Zscale
This subroutine displays a histogram of the kriging error. The histogram
class intervals and all graph scaling is determined automatically, through
calls to NEATAX.
SUBROUTINE Initialize
Subroutines Called:
SAM - Set 4Floating Point Value, Get Toggle Value
This subroutine initializes the global variable values.
SUBROUTINE Insert (Vector, Ptr, Element, ElementPtr, N, MaxN)
Formal Arguments:
VECTOR	-	an array of REALS in which to insert ELEMENT
PTR	-	an array of pointers parallel with VECTOR
ELEMENT	-	the value to insert
ELEMENTPTR	-	a pointer to inset into PTR
N	-	the number of elements in VECTOR, and PTR
MAXN	-	the maximum number of elements in VECTOR and PTR
Subroutines Called:
SearchB
This subroutine is called from SEARCH to insert a distance and a neighbor
pointer into the pointer list. The routine SEARCHB is called to determine
where the element should be inserted in the array.
SUBROUTINE Intro Screen
Subroutines Called:
SAM - Set Screen. Display Frame, Display Labels, Locate Cursor
Flash, Erase
This subroutine displays the introductory screen, and vaits for a keystroke
before returning. It is called from the main program module and uses SAM
routines to display the screen.
Geo-EAS Programmer's Guide
3.7-20
April 1990

-------
SUBROUTINE Kriger (Quit)
Formal Arguments:
QUIT - set to .TRUE, if kriging is prematurely terminated
Subroutines Called:
Neatax
PlotData
GetShf
Search
Plot Neighbors
Circle
Build System
Show System
Solve System
Show Weights
Plot Value
Stats
Qsor t
Finish Beep
GrWait
SAM - NevScreen, Clear Screen, Erase, PutStr, Beep, Flash
Locate Cursor, Put Characters
This subroutine performs the kriging for XVALID. A kriging display is gene-
rated on entry to the routine PLOTDATA, unless a Hercules adpator is present,
in which case the Options screen is displayed. A row at the bottom of the
screen is used to display the individual kriging results. For each variable
value in the input data a search is performed by subroutine SEARCH to identify
the neighbors. Then the system of equations is set up by subroutine BUILD
SYSTEM. Only neighbors whose values are not missing are used (stored into
array TNEIGHBORS by BUILD SYSTEM). The system of equations is solved and the
estimate and kriging standard deviation is computed by subroutine SOLVE
SYSTEM. The routine GETSHF is called to determine the status of the debug
control keys. The routines SHOW SYSTEM, SHOW WEIGHTS, and PLOT NEIGHBORS are
called if these debug keys are activated. The subroutine PLOT VALUE is used
to plot the color-coded quartile symbols corresponding to each estimate. When
kriging is completed, the routine FINISH BEEP is called to signal the user.
The kriging difference (errors) are sorted by routine QSORT, and STATS is
called to produce univariate statistics for the results. GRWAIT is called to
wait for the user's keystroke before returning to the Options menu.
SUBROUTINE Legend (X, I, Mx, My)
Formal Arguments:
X, Y	- Starting point for legend
MX, MY - size of symbols in X and Y direction
Subroutines Called:
Plus, Cross, Box, Cross, Circle
GRAFLIB - Zcolor, Zlbdir, Zmove, Zlborg, Zlabel
SAM - Left Justify
Geo-EAS Programmer's Guide
3.7-21
April 1990

-------
This subroutine is used	to display a legend for the colored quartile symbols
displayed in subroutine	PLOTDATA.
SUBROUTINE Minus (X, Y,	Mx, Colorl, Color2)
Formal Arguments:
X, Y	-	The coordinates of the symbol center
MX, MY	-	the width and height of the symbol
C0L0R1	-	the symbol color
C0L0R2	-	the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine plots a minus symbol (dash) centered at X, Y
SUBROUTINE Neatax (Min, Max, Tine, Ntic)
Formal Arguments:
Min	- The minimum value for the axis
Max	- the maximum value for the axis
Tine	- the tickmark interval
Ntic	- the number of tickmarks
Function Calls:
Tic
This routine determines "neat" axis scaling parameters. On entry the REAL
variables MIN and MAX should contain the actual minimum and maximum values of
the data to be displayed. These values are changed by NEATAX, so temporaries
should be passed. Because of this, it is extremely IMPORTANT not to pass a
constant value to this routine. The variables TINC and NTIC are computed as
the tickmark spacing and number of ticmarks for the axis. The changed values
of MIN and MAX should be used for the axis minimum and maximum. The function
TIC is called to determine the "neat" scaling parameters.
SUBROUTINE Nev Screen (Screen Number)
Formal Arguments:
SCREEN NUMBER - the number of the screen to display
Subroutines Called:
SAM - Set Screen, Display Frame, Display Labels
This subroutine displays the specified screen, frame and fields.
SUBROUTINE Perform Process (Field Name, Error, Repaint)
Formal Arguments:
FIELD NAME
ERROR
REPAINT
Geo-EAS Programmer's Guide
3.7-22
April 1990

-------
Subroutines Called:
New Screen
Relni tialize
Read Header Data
Read Data
Write Estimates
Scat ter
Write Results
SAM - Set 4 Floating Point Value, Get 4 Floating Point Value
Get Toggle Value, Get Character Value, Beep
Set Character Value, Left Justify, Erase Field, Erase
Flash, Display One Field, Display Fields, Write Field
This subroutine performs the error checking for XVALID. It is called by
subroutine GET FIELD GROUP, which is in turn called from GET SCREEN FIELDS.
The Screen field name is used to determine the proper action to take. An
IF..ELSEIF block is used to determine which screen field has just been
processed. Error handling logic is included to perform bounds checking on
real and integer variables, and to check the validity of file names. This is
where the screen field contents are transferred to global variables, (if no
error occurs). This is accomplished through calls to Get 	 Value in the
SAM utilities. For screen fields such as file names, the routines are called
to read the input data, through READ HEADER DATA and READ DATA, and to write
the cross validation results (WRITE ESTIMATES). See the subroutine calling
tree or the source code for more information.
SUBROUTINE Plot Data (StartPoint, TypeFlag)
. Formal Arguments:
STARTPOINT - the starting point for plotting the data
TYPEFLAG - type of plot to produce
Subroutines Called:
Axes
Cross, Box, Plus
GrWai t
Plot Value
Plot Error
Legend
PlotStat
GrWai t
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale, Zmove, Zplot
Zlborg, Zlabel
This subroutine generates the display which is active during kriging, or the
error map. It is called from KRIGER, and from GET SCREEN FIELDS. The vari-
able TYPEFLAG is used to indicate which type of plot is to be generated. If
TYPEFLAG = 0, then the kriging display is generated, otherwise the Kriging
Error Plot is generated. The variable STARTPOINT is used to indicate which
value was most recently kriged, when TYPEFLAG = 0. This is because the screen
must be regenerated after a debug display has been deactivated, and the
routine needs knowledge of when to stop plotting symbols.
Geo-EAS Programmer's Guide
3.7-23
April 1990

-------
SUBROUTINE Plot Error (X, Y, Dx, Dy, I)
Formal Arguments:
X, Y - center o£ symbol
DX, DY - size of symbol in X and Y direction
I	- index to value in DIFFERENCES array (kriging error)
Subroutines Called:
Plus, Cross
This subroutine is called from PLOTDATA to plot the symbol for the kriging
error. The symbol is scaled to be larger for large errors, and smaller for
small errors. A plus is used for positive errors (over estimation), and a
cross for negative errors (under estimation).
SUBROUTINE Plot Neighbors (XO, 10, Neighbors, N, Quit)
Formal Arguments:
XO, Y0 - center of search area
NEIGHBORS - array of pointers to neighbors found in search
N	- number of elements in array
QUIT	- set to .TRUE, if user decides to terminate kriging
Subroutines Called:
Axes
Cross, Box, Plus
GrWai t
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale, Zmove, Zplot
This subroutine is called from KRIGER when the caps lock key is activated. It
is a graph of the sample value locations showing the search ellipse and the
neighbors which were located by subroutine SEARCH.
SUBROUTINE PlotStat (DevCode, TxMin, TxMax, TyMin, TyHax,
Ndata, ZNmiss, ZN, Zmean, Zstd,
Zmin, ZQ1, Zmedian, ZQ3, Zmax)
Formal Arguments:
DEVCODE
The
graphics device code
TXMIN, TXMAX -
The
X extents of the graph
TYMIN, TYMAX -
The
Y extents of the graph
NDATA
The
number of data total
ZNMISS
The
number of missing data
ZN
The
number used in the statistics
ZMEAN
The
mean of the data
ZSTD
The
standard deviation of the data
ZMIN, ZMAX
The
min and max of the data
ZQ1, ZQ3
The
1st and 3rd quartiles of the da'a
ZMEDIAN
The
median of the data
Geo-EAS Programmer's Guide
3.7-24
April 1990

-------
Subroutines Called:
SAM - Locate Cursor, Put Characters
GRAFLIB - Zlborg, Zmove, Zlabel
This subroutine is called from PLOTDATA and HISTOGRAM to display univariate
statistics for the data on the graph. The statistics are plotted on the right
of the screen. If a Hercules graphics card is used, the GRAFLIB routines are
used to plot the statistics, otherwise BIOS calls are made through the SAM
utilities.
SUBROUTINE Plot Value (X, Y, Hx, My, Z, Erase)
Formal Arguments:
X, Y - center of symbol
MX, MY - size of symbol in X and Y direction
Z	- code for quartile (0-4)
ERASE - flag to indicate if symbol is erased or drawn
Subroutines Called:
Plus, Cross, Box, Minus
This subroutine is called from KRIGER, and from PLOTDATA to plot the color-
coded quartile symbol for the sample value or the estimate during kriging.
The variable ERASE is used to indicate if the symbol should be drawn in the
background color. This allows KRIGER to erase the sample value symbol and
replace it with a symbol for the estimate.
SUBROUTINE Plus (I, Y, Mx, My, Colorl, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
MX, MY	- the width and height of the symbol
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine plots a symbol centered at X, Y
SUBROUTINE Put ERecord (Rec, Row)
Formal Arguments:
REC - Pointer to pair difference
ROW - Row to display information
Subroutines Called:
SAM - PutStr
This subroutine is called from EXAMINE, and PUT ESCREIN to display pair
information. The variable REC is a pointer to the sorted array of squared
Geo-EAS Programmer's Guide
3.7-25
April 1990

-------
differences. The values described in subroutine EXAMINE are displayed on the
screen.
SUBROUTINE Put ESCreen (TopRec, BottomRec)
Formal Arguments:
TOPREC	- Pointer to first data values to display
BOTTOMREC - Pointer to the last 'data values to display
Subroutines Called:
Put Erecord
SAM - PutStr
This subroutine is called from EXAMINE to display a screen of data. The
routine PUT ERECORD is called to put out values for each rov on the screen.
SUBROUTINE Qsort (A, P, N)
Formal Arguments:
A - Array of REAL values
P - Array of INTEGER pointers {P (I) = I, for all I = 1,...,N}
N - The number of values in A and P
This subroutine uses the quicksort algorithm to sort the values in A into
ascending order. The values of P are sorted in parallel vith the values in A
so that they may be used as pointers to other arrays parallel with A.
SUBROUTINE Qsortl (A,N)
Formal Arguments:
A - Array of REAL values
N - The number of values in A
This subroutine uses the quicksort algorithm to sort the values in A into
ascending order.
SUBROUTINE Read Data (Error)
Formal Arguments:
ERROR - an error flag
Subroutines Called:
Qsort
Stats
Neatax
SAM - PutStr, Load Toggle Values, Set A Floating Point Value
Display One Field, Beep, Erase Field, Flash
Erase, Left Justify
This subroutine reads the data values into memory from the data file. If an
error occurs during file access the variable ERROR is set to .TRUE. The SAM
routines are used to display pertinent information on the screen, or to
Geo-EAS Programmer's Guide
3.7-26
April 1990

-------
display error messages if any errors occur. The coordinate values are stored
into memory, and the minimum and maximum coordinate values are determined at
this time. The Y coordinate values are sorted by routine QSORT, along with an
array of pointers so that the subroutine SEARCH may proceed more efficiently.
SUBROUTINE Read Header Data (Error)
Formal Arguments:
ERROR - error flag
Subroutines Called:
SAM - Set 4Floating Point Value, Display One Field, PutStr
Erase, Beep, Erase Field, Flash, Load Toggle Values
Flash
This subroutine reads the header data into memory from the data file. If an
error occurs during file access the variable ERROR is set to .TRUE. The
variable names and units are read into memory. The variable names are stored
into toggle fields on the screen. The SAM routines are used to display
pertinent information on the screen, or to display error messages if any
errors occur.
SUBROUTINE Read System Defaults
Subroutines Called:
SAM - Set Character Value
This subroutine is called from the main program module. It accesses the
system defaults file (GEOEAS.DEF) and retrieves the File Prefix and Data File
name. If the file does not exist, no values are given to these variables.
The SAM utilities are used to store these values into their screen fields.
SUBROUTINE Reinitialize
Subroutines Called:
Ini tialize
SAM - Set Toggle Position
This subroutine is used to reset the global variables and screen field con-
tents to their default values. This routine is called from PERFORM PROCESS,
when a new file is to be read, or a file read error occurs.
SUBROUTINE Scatter (TypeFlag)
Formal Arguments:
TYPEFLAG - type of scatter plot
Geo-EAS Programmer's Guide
3.7-27
April 1990

-------
Subroutines Called:
Neatax
Grframe
Axes
Plus, Cross
Boxplot
GrWai t
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlborg, Zlocat, Zscale Zmove, Zplot
SAM - Set Toggle Position
This subroutine is called from PERFORM PROCESS to produce a Scatterplot. The
user selects the type o£ scatter plot from a toggle field. The variable
TYPEFLAG is passed to indicate which type of plot is to be generated. If
TYPEFLAG = 0 the plot will be of the estimates vs. the sample values, other-
wise it will be of the estimates vs. differences. Axes scaling is determined
automatically using subroutine NEATAX. The axes are plotted using AXES.
Additional information is displayed at the right of the screen by a call to
PLOT LSTATS.
SUBROUTINE Scroll Window (Nlines, Rovl, Columnl, Rov2, Column2)
Formal Arguments:
NLINES	- number of lines to scroll
R0W1, R0V2	- top and bottom of scrolling region
C0LUMN1, C0LUMN2 - left and right of scrolling region
Subroutines Called:
LLIBC - INT86 (C library routine to do an 8086 interrupt call)
Interface statements:
INTERFACE TO INTEGERS FUNCTION INT86 [C,ALIAS:'_int86']
(INTRNO,INRGS,OUTRGS)
INTEGERS INTRNO[VALUE], INRGS[REFERENCE], OUTRGS[REFERENCE]
END
This routine scrolls the display by the number of rows given in variable
NLINES. If NLINES < 0 then the region is scrolled upwards, otherwise it is
scrolled downwards. This routine calls the C library function INT86, which
indirectly makes a BIOS interrupt to accomplish the scrolling. Since this is
a machine-dependent function. The scrolling code would have to be replaced
by something else on a non-PC system.
SUBROUTINE Search (X0f 10, Neighbors, N, Failed)
Formal Arguments:
XO, YO - center of search area
NEIGHBORS - array of pointers to neighbors found in search
N	- number of elements in array
FAILED - set to .TRUE, if no neighbors found
Geo-EAS Programmer's Guide
3.7-28
April 1990

-------
Subroutines Called:
Sector
SearchB
Insert
Function Gamma
This subroutine is called by KHIGER to perform the neighborhood search. On
return, the array NEIGHBORS contains pointers to the neighbors found, the
routine SEARCHB is called to locate the nearest Y coordinate value in the
sorted list of YVALUES. Then each of the potential neighbors within the
window defined by the WX	 variables is examined. The distance from the
search center is computed, and if it is found to be within the ellipse, the
distances and the pointers are stored in arrays using routine INSERT. If the
distance measure chosen is Variogram, instead of Euclidean, then the GAMMA
function is called and the return value is stored instead of the euclidean
distance. If the number of neighbors is < MINPT, FAILED is .TRUE, and the
search is ended. Otherwise, depending on the number of search sectors
specified (NSECTOR) the neighbors are classified according to their sector
(quadrant and octant). If only one sector is specified, pointers to the
nearest MAXP neighbors are stored and the search is complete. Otherwise the
sectors arrays are counted to determine if the number of neighbors in a sector
was exceeded. Only the nearest MAXPS neighbors are kept for a given sector.
Finally a determination is made if the number of maximum consecutive empty
sectors (MAXEMPTY) has been exceeded. If this is not the case then search is
terminated successfully, otherwise, FAILED is detail.
SUBROUTINE Sector (Dx, Dy, Quad, Oct)
Formal Arguments:
DX, DY - the distance components (from the search center)
QUAD - the code for the neighbors quadrant
OCT - the code for the neighbors octant
This subroutine returns the quadrant and octant code for a neighbor, given the
distance components. These are used to accumulate counts into the octant and
quadrant counters in subroutine SEARCH.
SUBROUTINE Setfmt (Max, Fmt, Width)
Formal Arguments:
MAX - the value to use for determining the format
FMT - the character FORTRAN format specifier for the value
WIDTH - the maximum number of characters in FMT
This subroutine is called from AXES to determine the format to use for
plotting numeric tickmark labels on the X and Y axes. The algorithm works as
follows. The variable WIDTH is used as the format width. The fractional part
of MAX is extracted and multiplied by ten until it becomes a whole number.
The number of times this happens is counted, and this value is used as the
number of digits to the right of the decimal place.
Geo-EAS Programmer's Guide
3.7-29
April 1990

-------
SUBROUTINE Show Neighbors (XO, YO, Neighbors, N, Quit)
Formal Arguments:
XO, YO - center of search area
NEIGHBORS - array of pointers to neighbors found in search
N	- number of elements in array
QUIT	- set to .TRUE, if user decides to terminate kriging
Subroutines Called:
SAM - Clear Screen, GetCha, Locate Cursor, Put Characters
This subroutine is called from KRIGER when no graphics capability is present,
and the caps-lock key is activated. It displays textual information about the
neighbors which were located by subroutine SEARCH.
SUBROUTINE Show System (10, YO, N, Quit)
Formal Arguments:
XO, YO - center of point, or block kriged
N	- number	of neighbors
QUIT	- set to .TRUE, if user decides to terminate kriging
Subroutines Called:
SAM - Clear Screen, GetCha, Locate Cursor, Put Characters
This subroutine is called by KRIGER to display the system of equations when
the scroll-lock key is activated.
SUBROUTINE Show Weights
Subroutines Called:
SAM - Clear Screen, GetCha
This subroutine is called by KRIGER to display the kriging weights and other
intermediate information used to compute the estimate. It is called when the
Num-Lock key is activated.
SUBROUTINE Simeq (N, Error)
Formal Arguments:
N - the size of the system of equations
ERROR - set to .TRUE, is a system solver error occurs
Subroutines Called:
SAM - Erase, Beep, Locate Cursor, Put Characters, GetKey
This subroutine solves the system of equations. It is called by SOLVE SYSTEM.
The routine uses a modified LU decomposition technique to solve the system.
Geo-EAS Programmer's Guide
3.7-30
April 1990

-------
SUBROUTINE Solve System (Neighbors, N, Error)
Formal Arguments:
NEIGHBORS - an array of pointers to neighbors used by BUILD SYSTEM
N	- the number of elements in NEIGHBORS
ERROR - set to .TRUE, if a system solver error occurs
Subroutines Called:
Simeq
SAM - Beep, Locate Cursor, Put Characters, GetKey
This subroutine is called by KRIGER to solve the system of equations and to
compute the kriging estimate and standard deviation.
SUBROUTINE Stats (Var, Ndata, N, Nmiss,
Min, Ql, Median, Q3, Max, Mean, StdDev)
Formal Arguments:
VAR	- Array of REAL data
NDATA - number of elements in VAR
N	- Number of elements used in the stats
NMISS - Number of missing data in VAR
MIN, MAX - Min and Max values of data in VAR
Ql, Q3 - 1st and 3rd quartiles of data in VAR
MEDIAN - Median of data in VAR
MEAN - Mean of data in VAR
STDEV - Standard deviation of data in VAR
Subroutines Called:
Qsortl
This subroutine is a general-purpose routine for computing univariate stati-
stics for the data in array VAR. It is called by subroutine KRIGER to compute
the statistics for the estimates, differences, kriging standard deviations,
and zscores. The routine QSORT is called to sort the data in a temporary
array for determining the median and the quartiles.
SUBROUTINE Write Estimates (File, Error)
Formal Arguments:
FILE - file name for file of estimates
ERROR - set to .TRUE, if a write or open error occurs
Subroutines Called:
SAM - Erase
This subroutine is called from PERFORM PROCESS. It saves the results to a
Geo-EAS format data file. The original sample values, coordinate values,
estimates, kriging errors, kriging standard deviations, and normalized errors
(zscores) are written to the file.
Geo-EAS Programmer's Guide
3.7-31
April 1990

-------
SUBROUTINE Write Options Header
Subroutines Called:
SAM - Erase, PutStr, Get Toggle Value
This subroutine is used to display summary information at the top o£ the
Options screen. This includes information which was specified on the main
screen, such as the input data file name and the variable selected for
kriging.
SUBROUTINE Write Results
Subroutines Called:
SAM - Beep, PutStr
This subroutine is used to display the cross validation results on the results
screen. The SAM routine PUTSTR is used to place the text on the display.
SUBROUTINE Write System Defaults
This subroutine vrites the current values of FILE PREFIX and DATA FILE to the
system defaults file. If this file is not found, it is created and the values
are saved.
Geo-EAS Programmer's Guide
3.7-32
April 1990

-------
3.8
KRIGE
3.8.1 Software Function
Krige is an interactive program which performs 2-dimensional kriging. A
rectangular grid of kriged estimates is created and stored in a Geo-EAS data
file. Contour plots may be generated from these gridded estimates with the
program CONREC. Options are provided to control the type of kriging, the
neighborhood search area, the grid spacing and extents, and the variogram
model for each variable kriged. Up to 10 estimates may be produced for each
element in the grid. The program parameters may be stored in a parameter file
and retrieved for later use. During the kriging process, debug displays may
be activated or de-activated for the purpose of viewing intermediate kriging
results.
3.8.2 Global Variables/Program Limits
Krige requires that the input data file contains at least 3 but no more than
48 variables. Two of these variables must represent the coordinates of sample
locations. Up to ten variables may be selected for kriging. No more than
1000 samples may reside in the data file. If more than this number are
encountered only the first 1000 values will be used for kriging.
The following is a listing of the file of global variable declarations used in
KRIGE. This file is named KRIGE.DEC. It is included in KRIGE source files
with the $INCLUDE: compiler metacommand.
Qk-kkkkk-kkkk-xkkkk'k-k'kk-kiz'kkkk'k'kic'k'k'k'k'kkkkkkk-kk'kick'k'k'kir'kk'k'kkicifk'k-k'k-kic'k'k
C File Krige.dec - global variable declarations to be SINCLUDED
C	in subroutines of program Krige
C
C Descriptions for common block and parameter values
C	MAXDATA
C	MAXVAR
C	MAXVARK
C	MAXSTRUC
C	MAXXGRID
C	MAXYGRID
C	MAXNEIGHB0R
C	MAXEQ
C	SIMPLE
C	ORDINARY
-	Maximum
-	Maximum
-	Maximum
-	Maximum
-	Maximum
-	Maximum
-	Maximum
-	Maximum
-	code for
-	code for
number of rows in input data matrix
number of columns in input data file
number of variables to krige
number of nested variogram structures
number of columns in kriging grid
number of rows in kriging grid
number of neighbors in kriging system
number of equations in system
simple kriging
ordinary kriging
Geo-EAS Programmer's Guide	3.8-1	April 1990

-------
PARAMETER	(MAXDATA	= 1000)
PARAMETER	(MAXVAR	= 48)
PARAMETER	(MAXVARK	= 10)
PARAMETER	(MAXSTRUC	= 4)
PARAMETER	(MAXXGRID	= 100)
PARAMETER	(MAXYGRID	= 100)
PARAMETER	(MAXNEIGHBOR	= 64)
PARAMETER	(MAXEQ	= MAXNEIGHBOR+6)
PARAMETER	(SIMPLE = 0,	ORDINARY = 1)
-k-k-k-k-k-k-k-k-kifk-k-k
C	/DataB/	- Common block for input data
C
C	Data	- Data array
C	XData, YData - Coordinate data arrays
C	Ndata	- Number of rows read into in Data matrix
C	Nvar	- Number of columns in Data file
C	Q1,Q2,Q3	- Data quartiles
C	KrigVal	- a matrix to hold quartile codes for estimates
COMMON /DataB/ Data, Xdata, Ydata, Ql, Q2, Q3,
+	Ndigits, Ndata, Nvar, KrigVal
REAL*4	Data (MAXDATA, MAXVARK), Ql, Q2, Q3
REAL*4	Xdata (MAXDATA), Ydata (MAXDATA)
INTEGER*4 Ndata, Nvar, Ndigits (MAXVARK)
INTEGER*1 KrigVal (MAXXGRID, MAXYGRID)
kkkkkkkkkkkkkkkk
C	/VarnamB/ - Common block, for variable names and units
C
C	Varnam - Array of variable names in data matrix
C	Units - Array of measurement units for each variable
COMMON /VarnamB/Varnam, Units
CHARACTER*10	Varnam (MAXVAR), Units (MAXVAR)
Geo-EAS Programmer's Guide
3.8-2
April 1990

-------
C* ****** *********************************************************
C	/FilesB/
C
C	File Prefix
C	Iparfile
C	Oparfile
C	Data File
C	OutFile
C	Polyfile
COMMON
- Common block for file names
Prefix for file names
Input parameter file
Output Parameter file
Data file name
Output estimates file name
Polygon file name
/FilesB/ File Prefix, IparFile, OparFile,
Data File, OutFile, PolyFile
CHARACTER*14
+
File Prefix*50, IparFile, OparFile,
Data File, OutFile, PolyFile
C	/GridB/	- Common block for Grid parameters
C
C	Excluded	- Matrix of flags for excluding grid estimates
C	Xvar	- Index of X coordinate variable
C	Xorigin	- X Coordinate for grid origin
C	Xcellsize	- Width of cell size in the X direction
C	Nxcells	- Number of cells in the X direction
C	Yvar	- Index of Y coordinate variable
C	Yorigin	- Y Coordinate for grid origin
C	Ycellsize	- Width of cell size in the Y direction
C	Nycells	- Number of cells in the Y direction
COMMON /GridB/ Excluded, Xvar, Yvar, Xorigin, Yorigin,
+	Xcellsize, Ycellsize, Nxcells, Nycells
L0GICAL*1 Excluded (MAXXGRID, MAXYGRID)
REAL*4 Xorigin, Yorigin, Xcellsize, Ycellsize
INTEGER*4 Xvar, Yvar, Nxcells, Nycells
Geo-EAS Programmer's Guide
3.8-3
April 1990

-------
C /ModelB/
C
C
C
C
C
C
C
C
C
C
C
C
C
C
Vrmajor
Vrminor
Vrangle
Sill
Mtype
Nstruc
Krigvar
Nkvar
Mglobal
Nugget
NkVar
KrigVar
Current Var -
-k'k-kk'kk-k-k'k-k'k'kk'kk'k-kk'kk-k-k'k'kkkkkkk'kk'kkk'kkkkk'k'k'k'kk'k-k
Common block for variogram models parameters
Matrix of major ranges for model structures
Matrix of minor ranges for model structures
Matrix of variogram ellipse angles
Matrix of variogram sills for structures
Matrix of model type codes " " 11
Array containing the # of structures/model
Array of indices of variables to krige
Number of entries in Krigvar
Global means for simple kriging
array of nugget effects for kriging variables
the number of variables to krige
an array of pointers to the variables to krige
the currently selected model for editing
COMMON /ModelB/ Vrmajor, Vrminor, Vrangle, Sill, Mtype
COMMON /ModelB/ Nstruc, Mglobal, KrigVar, NkVar
COMMON /ModelB/ Nugget, Current Var
REAL*4 Vrmajor	(MAXSTRUC, MAXVARK)
REAL*4 Vrminor	(MAXSTRUC, MAXVARK)
REAL*4 Vrangle	(MAXSTRUC, MAXVARK)
REAL*4 Sill	(MAXSTRUC, MAXVARK)
REAL*4 Mglobal	(MAXVARK), Nugget (MAXVARK)
INTEGER*4 Krigvar	(MAXVARK), NkVar, Current Var
INTEGER*4 Mtype	(MAXSTRUC, MAXVARK)
C* -k k-k-kifk-kkk -kkk^k
c
c
c
c
c
c
c
c
c
c
c
c
c
/SearchB/ - neigborhood search parameters
-	Major radius for the search ellipse
-	Minor radius for the search ellipse
-	Angle between X grid axis and major axis
-	Maximum number of points in search area
-	Minimum number of points in search area
-	Maximum number of points per sector
-	Number of sectors (1, 4, 8)
-	Maximum number of consecutive empty octants
-	Flag for Euclidean, or Variogram Distance
-	Pointer list to data (parallel to YValues)
-	List of ascending Y coordinate values
/SearchB/Srmajor, Srminor, Srangle, Nsector,
+	Maxp, Minp, Maxps, Maxempty, Euclidean,
+	Yvalptr, Yvalues
REAL*4	Srmajor, Srminor, Srangle, Yvalues (MAXDATA)
INTEGER*4	Maxp, Minp, Maxps, Maxempty, Nsector
INTEGERS	YvalPtr (MAXDATA)
LOGICAL	Euclidean
Srmajor
Srminor
Srangle
Maxp
Minp
Maxps
Nsector
Maxempty
Euclidean
Yvalptr
YValues
COMMON
Geo-EAS Programmer's Guide
3.8-4
April 1990

-------
c* **************************************************************
C /TypeB/ - Common block for the Type of Kriging and parameters
C
C Ktype - Code for type of kriging (1 = ordinary, 2 = simple)
C Point - Flag for point or block kriging
C Ndiscr - Number of discretization points for block kriging
C
COMMON /TypeB/ Ktype, Point, Ndiscr
INTEGER*4 Ktype, Ndiscr
LOGICAL Point
C /TitleB/ - Common block for title
C
C Title - Character string describing kriging project
C
COMMON /TitleB/ Title
CHARACTER*70	Title
q***************************************************************
C /MissB/ - Common block for missing values parameters
C
C Missing - Missing value used by program
COMMON /MissB/ Missing
REAL*A	Missing
C***************************************************************
C	/DebugB/ - Common block for debug flags
C
C	Debug System - Matrix output flag
C	Debug Neighbors - Plot of Neighbors
C	Debug Weights - List of Neighbors and weights
COMMON	/DebugB/ Debug System, Debug Neighbors,
+	Debug Weights
LOGICAL	Debug System, Debug Neighbors
+	Debug Weights
C***************************************************************
C /MinMax/ - Common block for +/- infinity
COMMON /MinMax/ Minimum, Maximum
REAL*4	Minimum, Maximum
Geo-EAS Programmer's Guide
3.8-5
April 1990

-------
kkk k kkk-kk kkk~ kk'k'kk'kk'kk kk-kk-k-k-k-k-kkk'k'k-k-kkkkkk'k'kk'k'k'kk'kk'k *¦ -r kkkkkkkkk
C	/System/ - kriging system and related variables
C
C	V, B, B2
C	GamMax
C
C	CW
C	Estimate
C	Variance
C	Xa, Ya
C	Na
C	Sv, Sv2
C	SkBar
-	the matrix and arrays for the system of equations
-	array to hold the maximum variogram value, used
for computing covariance
-	array of average block covariances for variables
-	temporary to hold the estimated value
-	""	kriging standard deviation
-	arrays to hold digitized offsets for discretization
-	number of elements in Xa,Ya (determined by Ndiscr)
-	arrays to hold statistics on the variables (unused)
-	holds average kriging standard deviation (unused)
COMMON	/System/ V, B, B2, Cvv, Estimate, Variance
COMMON	/System/ Sv, Sv2, SkBar, GamMax, Xa, Ya, Na
REAL*4	V (MAXEQ, MAXEQ), B (MAXEQ), B2 (MAXEQ)
REAL*4	Sv (MAXVARK), Sv2 (MAXVARK)
REAL*4	Cvv (MAXVARK)
REAL*4	SkBar (MAXVARK), GamMax (MAX7/ARK)
REAL*4	Estimate, Variance
REAL*4	Xa (16), Ya (16)
INTEGER*4 Na
Q'k'k'k'kkkk'k'k'kkkk'k-k'k'k'k'k'k'k'k'k'k'k'k'k'k'k-kk'k'k'k'k'k'kk'k'k'k'k'k'k'k'k'k'k'k'kkkkkkk kkkkkkk
C XmaxDev, YMAxDev
C Gmode
C Devcode
C Startmode
C Nxtic, Nytic
C Aspect
C Xmin, Xmax, . . .
C Minx, Maxx, . . .
C Xtinc, Ytinc
C Graphics
the device extents
the GRAFLIB mode, code
the device code
the video mode at program start
number of x and y major tickmarks
Aspect ratio
Vorld coordinate extents for data window
World extents for graph window
tickmark intervals
logical (.FALSE, if not EGA, HERC, or CGA)
COMMON /GRAFCOM/ xmin, xmax, ymin, ymax, xtinc, ytinc
COMMON /GRAFCOM/ nxtic, nytic, minx, maxx, miny, maxy
COMMON /GRAFCOM/ xmaxdev, ymaxdev, xfac, yfac, aspect
COMMON /GRAFCOM/ gmode, graphics, devcode, Startmode
COMMON /GRAFCOM/ white, red, yellow, blue, green
INTEGER*4 xmaxdev, ymaxdev, gmode, devcode
INTEGER*4 Startmode, nxtic, nytic
INTEGER*4 Red, White, Yellow, Blue, Green
REAL*4 aspect, xfac, yfac
REAL*4 xmin, xmax, ymin, ymax, xtinc, ytinc
REAL*4 minx, maxx, miny, maxy
LOGICA Graphics
Geo-EAS Programmer's Guide
3.8-6
April 1990

-------
3.3.3 Data Flov
The following figure illustrates the inputs and outputs from iCRIGE.
Data Flow Diagram
Geo-EAS Programmer's Guide
3.3-7
April 19?C

-------
3.3.4
User Interface
The user interface for KRIGE is managed using the SAM (Screen Access Manage-
ment) utilities. The screens, menus, and program options are all defined in
the file KRIGE.SCR. All screen and menu management is controlled by sub-
routine GZT SCREEN FIELDS. From this subroutine, calls are made to the SAX
subroutines to display and manage screens, menu choices and program option
input. The subroutine PERFORM PROCESS does the screen field error checking,
and displays error messages. All application - specific modules are called
from these tvo subroutines.
The Screens
ICRIGE displays three text screens and several graph screens. The first is an
introductory screen vhich displays information about the program. The remain-
ing screens are either for input of program parameters, or for displaying
results ana graphs. The hierarchy of screens is displayed belov.
Each screen in KRIGE has a menu at the bottom. Control of these menus is
accomplished in the subroutine GET SCREEN FIELDS. Belov is a menu tree
shoving the hierarchy of menus, and options. Above each menu is the screen
name and the screen field name for the menu (used in KRIGE.SCR). Refer to the
screen definition file KRIGE.SCR for specifics.
The Screen, Menu, and Options Hierarchy
(MAINMENU) - Main Screen
Krige —r
Pref i:<
(• Read Parameters
f- Options/Execute
|- Save Parameters
L Qui t
(OPTIONS) - Options
Data
Polygon
Type
Grid
Search
Variables/Models (VM MENU)
Title	Lr Nev Variable
Execute	(- Edit
Quit	)- Delete
L Quit
Screen
Global Variable/Screen Field Relationships
All input fields on the screens have screen field nar.es by vhich the screen
field contents are accessed. Each of these screen fields is associated with a
global variable. Vhen the screen field values are entered by the user, sub-
routine PERFORM PROCESS transfers the appropriate values to the global vari-
ables, using calls to the SET 	 VALUE subroutines in the SAM utilities.
The screen field labels, the associated screen field names (as defined in the
screen definition file KRIGE.SCR) and the related global variable names for
all program inputs are listed belov:
Geo-EAS Programmer's Guide	3.3-3	April l?9r,

-------
SCREEN LABEL
FIELD NAME
GLOBAL VARIABLE
Main Screen
File Prefix
Input Parameter File
Output Parameter File
Options Screen
Data
Data File
Output File
Polygon
Polygon File
Sample Select
Type
Type of Kriging
Point or Block
Grid
Variable
Origin
Size
Number
Search
R Major
R Minor
Angle
Distance Type
Num. Sectors
Max Pts/Sector
Min Pts to Use
Empty Sectors
FILEPREFIX (Char)
IPARFILE (Char)
OPARFILE (Char)
FILE PREFIX
IPARFILE
OPARFILE
DATAFILE (Char)
OUTFILE (Char)
DATA FILE
OUTFILE
POLYFILE (Char)
TY POLYGON (TOGGLE
POLYFILE
SAMPLING
TY KRIGE (Toggle)
TY PTBLOCK (Toggle)
KTYPE
POINT
GR XVAR
GR YVAR
GR XORG
GR YORG
GR XCSIZE
GR YCSIZE
GR NXCELL
GR NYCELL
(Toggle)
(Toggle)
(Real)
(Real)
(Real)
(Real)
(Integer)
(Integer)
XVAR, XDATA (I)
YVAR, YDATA (I)
XORIGIN
YORIGIN
XCELLSIZE
YCELLSIZE
NXCELLS
NYCELLS
SE
RMAJOR
(Real)
SRMAJOR
SE
RMINOR
(Real)
SRMINOR
SE
ANGLE
(Real)
SRANGLE
SE
DTYPE
(Toggle)
EUCLIDEAN
SE
ETYPE
(Toggle)
NSECTOR
SE
MAXPO
(Toggle)
MAXPS
SE
MINPT
(Toggle)
MINP
SE
MAXEMPT
(Toggle)
MAXEMPTY
Geo-EAS Programmer's Guide
3.8-9
April 1990

-------
SCREEN LABEL
FIELD NAME
GLOBAL VARIABLE
VARIABLE
Variables/Models Screen
Variable
Global Mean
Variogram Model Parameters
Nugget
Type (1-4)
Sill (1-4)
Major Range (1-4)
Minor Range (1-4)
Ellipse Angle (1-4)
KRIGEVAR (Toggle)	KRIGVAR (I)
VM MGLOBAL (Real)	MGLOBAL (I)
VM NUGGET	(Real)
VM TYPE 1 (Toggle)
VM SILL 1	(Real)
VM RMAJ0R1 (Real)
VM RMIN0R1 (Real)
VM ANGLE 1 (Real)
NUGGET (I)
MTYPE (I,	J)
SILL (I,	J)
VRMAJOR (I,	J)
VRMINOR (I,	J)
VRANGLE (I,	J)
Geo-EAS Programmer's Guide
3.8-10
April 1990

-------
3.8.5 Processing
Menu Processing
The following pseudocode represents the general sequence of menu processing in
KRIGE. Menu processing occurs in GET SCREEN FIELDS. Screen field processing
is controlled through calls to GET FIELD GROUP, which in turn calls PERFORM
PROCESS. All application-specific subroutines are called from GETSCREEN
FIELDS, or PERFORM PROCESS. See the subroutine structure chart for more
information. Processing details will be discussed in the sections for
individual subroutines.
KRIGE
Determine graphics hardware, initialize graphics
Read system defaults
Initialize global variables
Interactive screen input
Write system defaults
Interactive screen input (GET SCREEN FIELDS)
Display Main Screen and menu, get menu choice
pIF Menu Choice = Quit
| Return to main program, terminate
|-ELSEIF	= Read Parameters
| get input parameter file name, read the parameters, data
(-ELSEIF	= Options/Execute
| Display Options Screen and menu, get menu choice
| (-IF Menu Choice = Quit
| |	Jump to main menu processing loop
f-ELSEIF
= Data
Get Data file name, read header data, store into memory
Get output file name, check if exists
l-ELSEIF
= Polygon
Get Polygon file name
[-ELSEIF
= Type
Get kriging type, point or block and * disc pts.
J-ELSEIF
= Grid
Get coordinate variables, read coordinates into memory
Get grid spacing parameters
[-ELSEIF
3 Search
Get search parameters, store in memory
j-ELSEIF
= Variables/Models
Display Variables/Models selection screen
Display kriging list, get models menu choice
flF Menu Choice = Quit
| Jump to Options menu processing loop
(-ELSEIF
New Variable
Get variable, add to list, redisplay kriging list
| Jump directly to model parameters input (see Edit)
Geo-EAS Programmer's Guide
3.8-11
April 1990

-------
|	| |-ELSEIF	= Edit
J	| | Get Kriging List variable choice
|	| | Redisplay kriging list
III IF Simple Kriging, get global mean
|	| | Get vanogram model parameters
|	| (-ELSEIF	= Delete
|	| | Get kriging list variable choice
|	| | Redisplay kriging list
|	| | Get confirmation, delete variable
|	| | Redisplay kriging list
|	| t-ENDIF
|	J-ELSEIF	= Title
|	| Get title for the output file
|	[-ELSEIF	= Execute
|	|	Check if all required parameters have been specified
|	| Read the sample value data into DATA
|	| IF POLYFILE not blank, Read Polygon file, process
|	| Call the kriging routine KRIGER to perform the kriging
| LendiF
| Loop to get Options menu choice
[-ELSEIF = Save Parameters
| get output parm file name, write parameters to file
lEMDIF
Loop to get Main menu choice
Kriger
Compute offsets from block center to block discretization pts.
Compute average block Covariances for kriging variables
Compute the quartiles for the 1st variable from the input data
Open the output file, write header information
Initialize debug flags
rIF (GRAPHICS) THEN
| Generate Kriging Display
[-ELSE
| Leave the options screen as the kriging display
lENDIF
Write the results headings at the bottom of the screen
(-FOR all points or blocks in the grid DO
| Check the status of the debug keys, set debug variables
| IF the debug keys are off - regenerate default display
| Call the search routine to find the neighbors
| IF (Debug Neighbors) Display neighbors screen
| Call the subroutine to build the system of equations
| IF (Debug System) Display the system of equations screen
| Call the routine to solve the system
| IF (Debug Weights) Display the kriging weights screen
| Store the coded estimate value into Krigval matrix
| IF (GRAPHICS) plot the symbol for the estimate
| Display the results at the bottom of the screen
| Write the point or block results to the output file
LENDFOR
Generate a tone to indicate that kriging is completed
Geo-EAS Programmer's Guide
3.8-12
April 1990

-------
Wait for a keystroke
Return to the menu processing
END
routine
Error Processing
The majority of error checking is performed by the subroutine PERFORM PROCESS.
This routine checks that program inputs are correct, and displays error
messages when errors occur. Refer to the source code for specific details.
3.8.6 Outputs
The Output File
KRIGE produces a Geo-EAS format data file containing a data record for each
point or block estimate in the defined grid. The coordinate values for the
point, and the estimates and kriging standard deviations for each variable in
the kriging list are written to this file. Variable names for the estimated
values are constructed by placing a before the variable name from the
input data file. Names for the kriging standard deviation variables are
constructed by placing 'KSD' before the first seven characters of the sampled
variable name. These values are written to the output file by subroutine
KRIGER, as each estimate is produced.
The KRIGE Parameter File
KRIGE can read or write a file containing program option values, called a
parameter file. This is an unformatted file. The file is read with READ
PARAMETERS and written with SAVE PARAMETERS. This allows the user to store
options values for later use. See the source code for more detail.
The Kriging Display
KRIGE produces a graphic display when kriging which displays color coded
symbols at the original sample locations. As each point or block is kriged, a
color-coded pattern of rectangles is plotted at the grid location for the
estimate. A legend for the colored symbols is displayed at the right of the
screen. The display is only generated when a supported graphics card is
present. Otherwise, the Options screen remains present during kriging. The
numeric results are displayed at the bottom of the screen in both cases.
These include the coordinates of the grid cell, the estimate, the kriging
standard deviation, and the number of neighbors used to krige the estimate.
When kriging is completed, the display remains active until a  is pressed.
Geo-EAS Programmer's Guide
3.8-13
April 1990

-------
The Debug Displays
The Debug Displays are used to display intermediate information while the
kriging proceeds. These routines are called from subroutine KRIGER. The
subroutine GETSHF is used to determine the status of the keys which activate
these displays. This allows the user to enable and disable the generation of
these displays during kriging. Refer to the section on program XVALID for
more information.
3.8.7 Subroutine Structure
The following diagram, called a "subroutine calling tree" displays the
subroutine structure for KRIGE. This should be used as a reference when
tracing program logic. Calls to utilities which are members of libraries are
shown with abbreviated library names. Several trivial subroutine calls have
been omitted to conserve space. To locate a given subroutine in the source
code. Refer to the file FILES.DOC, which contains for all source file names,
the names and arguments of subroutines in each source code file, and the calls
made from each subroutine.
Rrige Subroutine Calling Tree:
Krige —|- Graflnit 	 Vstats
\- Initialize
[- Intro Screen
SAM
|- Read System Defaults — SAM
|- Get Screen Fields 	r SAM
New Screen
Get File Name
Build File Name
Get Field Group 	 (1)
Select Variable 	 SAM
Display KrigList 	 SAM
SAM
Load VarModel —
Delete VarModel
SAM
Load VarModel 	 SAM
SAM
Read Data 	
Init Grid
Read Polygon File —
L Display KrigLi3t — SAM
- SAM
PtLoc
L Kriger
(2)
|- Write System Defaults
L SAM
Geo-EAS Programmer's Guide
3.8-14
April 1990

-------
	 ( 1 I —T Gec Field (SAM)
*- Perform Process —p Read Parameters
)- Save Parameters
|- Reinitialize 	 Initiali
|- Read Header Data 	 SAM
J- Read Coordinate Values — SAM
|- Assign Screen Fields 	 SAM
)- Build File Name
|- Blank File
|- Erase Structure ¦	 SAM
L SAM
Krige r
L (2)
—p New Screen
(- SAM
|- Digitize
|- CalcW 	
|- Quartiles
|- Get File Name
(- Getshf
|- Plot Kriging Grid
|- Search
|- Plot Neighbors
|- Show Neighbors
f- Build System —
f- Solve System
I
|- Show system -
f- Show Weights
f- Plot Cell 	
|- Finish Beep -
L GrWait 	
Gamma
GRAFLIB
Legend 	 GRAFLIB
Plot Value
Plot Cell
Bsea rch
Insert 	 Bsearch
Sector
Axes 	 GRAFLIB
Cross, Plus, Box
GRAFLIB
GrWait
SAM
Cbar 	 Gamma
Gamma
SimEq
SAM
SAM
SAM
GRAFLIB
SAM (Sound)
GRAFLIB
Libraries: SAM	- Screen Access Management
GRAFLIB - GRAFLIB Graphics Library
Geo-EAS Programmer's Guide
3.8-15

-------
3.8.8 Subroutine Descriptions
The following section contains descriptions for the individual subroutines for
KRIGE. The Subroutine Calling Tree should be used for reference to trace
subprogram calls. To locate the source code for an individual subroutine,
refer to the file FILES.DOC in the source code directory or listings. The
subroutines are listed in increasing alphabetic order. A general description
is included for each subroutine which describes the software function, the
formal arguments (if any), and the subroutine calls made (if any).
PROGRAM KRIGE
This is the main module for program KRIGE. It accesses the System Defaults
File, initializes variables and calls the main menu processing routine GET
SCREEN FIELDS.
Subroutines Called:
Graflni t
Ini tialize
Read System Defaults
Intro Screen
Get Screen Fields
Write System Defaults
SAM - Setmod, Clear Screen
SUBROUTINE Assign Screen Fields
Subroutines Called:
SAM - Set Character Value, Set 4FloatingPoint Value
Set In teger Value, Set Toggle Position
This subroutine transfers the global variable values to their respective
screen fields. It is called from PERFORM PROCESS, after the parameter file is
read.
SUBROUTINE Axes (Titlel, xlabel, ylabel, Title2,
Xmin, Xmax, Ymin, Ymax, Xtinc, Ttinc, DevCode)
Formal Arguments:
TITLE1	- Main title for the graph
XLABEL	- X axis labels
YLABEL	- Y axis label
TITLE2	- Secondary title for graph
XMIN, XMAX - X axis min and max
YMIN, YMAX - Y axis min and max
XTINC, YTINC - X and Y axis tickmark intervals
DEVCODE	- Device type code
Subroutines Called:
GRAFLIB - GetWor, ZyLine, Zlborg, Zlbdir, Zmove, Zplot, Zlabel
SAM - Left Justify
Geo-EAS Programmer's Guide
3.8-16
April 1990

-------
This subroutine displays axes, with labeled tickmarks. axes labels, and two
titles. The numeric tickmark label formats are computed vith subroutine
SETFMT. Calls to GRAFLIB are made to drav the graphs and text.
SUBROUTINE Box (X, I, Mx, My, Colorl, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
MX, MY	- the width and height of the symbol
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This routine draws a box centered at X, Y, using calls to GRAFLIB
SUBROUTINE Build System (XO, YO, Neighbors, N,
TNeighbors, TN, Index)
Formal Arguments:
XO, YO - the coordinates of the value to be kriged
NEIGHBORS - an array of pointers to neighbors
N	- the number of neighbors found by SEARCH
TNEIGHBORS - array of pointers to neighbor values (non-missing)
TN	- the number of neighbors in TNEIGHBORS
INDEX	- the number of the variable being kriged
Subroutines Called:
FUNCTION Gamma
FUNCTION Cbar
This subroutine builds the system of equations used in kriging. It is called
from KRIGER. The function GAMMA is called to fill the kriging matrix.
SUBROUTINE Calc CW
Subroutines Called:
Gamma
This subroutine is called from KRIGER to calculate the average block covari-
ance for the variables to be kriged, based upon the block dimensions and the
variogram model. The average block covariance is stored in the array CW, and
used to compute the kriging standard deviation by SOLVE SYSTEM.
SUBROUTINE Cross (X, Y, Mx, My, Colorl, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
MX, MY	- the width and height of the symbol
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Geo-EAS Programmer's Guide
3.8-17
April 1990

-------
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine draws an 'X' symbol centered at the point X, Y
SUBROUTINE Delete VarModel (Index)
Formal Arguments:
INDEX - index of variable for which model is to be deleted
Subroutines Called:
Load VarModel
Display KrigList
SAM - Set Toggle Position, Set 4FloatingPoint Value
Set Character Value, Display One Field
Set Menu Position, Beep
This subroutine is called from PERFORM PROCESS to delete a variable and
variogram model from the kriging list.
SUBROUTINE Digitize
This subroutine is called once from KRIGER to compute the offsets from a block
center to the discretization points and to store these offsets in the arrays
XA and YA. This is so that the offsets need only be computed once. They are
used by function CBAR to determine the sample to block covariances used in
building the kriging system of equations.
SUBROUTINE Display KrigList
Subroutines Called:
SAM - Erase, PutStr, Set Menu Position
This subroutine displays the current list of variables to krige. The variable
whose model is displayed in the model portion of the Variables/Models Selec-
tion screen is highlighted.
SUBROUTINE Erase Structure (Number)
Formal Arguments:
NUMBER - The number of the structure to erase on the screen
Subroutines Called:
SAM - Set Character Value, Display One Field
This subroutine is called from subroutine PERFORM PROCESS to erase the row
containing a model structure when that structure's type has been set to none.
SUBROUTINE Finish Beep
Subroutines Called:
SAM - Sound
Geo-EAS Programmer's Guide
3.8-18
April 1990

-------
This subroutine generates a warbling tone when kriging has been completed. It
is called from subroutine KRIGER.
SUBROUTINE Get Field Group
Subroutines Called:
Get Field
Perform Process
New Screen
This subroutine is called by GET SCREEN FIELDS to get all field values for a
screen field group. For each field in the group, a GETFIELD call is used to
allow the user to enter the appropriate value or choice, then PERFORM PROCESS
is called to perform error checking and transfer the screen field contents to
global variables.
SUBROUTINE Get Screen Fields
Subroutines Called:
New Screen
Display KrigList
Load VarModel
Select Variable
Delete VarModel
Read Data
Ini tGrid
Get Field Group
Read Polygon File
Kriger
Get File Name, Blank File
SAM - Put Menu, Get Menu Choice, Beep, Flash
Display One Field, Set Menu Position
This subroutine does most of the work for KRIGE. It performs the menu
processing, controls display of the options and results screens, and the
graphics screens. The basic processing is outlined in pseudocode in the
previous section on processing, so it will not be repeated here. The SAM
routines are used to perform menu handling and screen display. The routine
GET FIELD GROUP is called, which calls PERFORM PROCESS to handle error
checking and transfer of screen field contents to global variable values.
SUBROUTINE GrafInit
Subroutines Called:
VSTATS
VIDEO
Geo-EAS Programmer's Guide
3.8-19
April 1990

-------
This subroutine is used to determine the device type, and to set the values of
the global graphics variables. The C function VSTATS is used to determine the
device type and several other parameters, through the assembler routine VIDEO.
The device extents, the aspect ratio, and device type code (DEVCODE) are then
set depending upon which (if any) graphics card is identified. The following
are the possible values for DEVCODE:
0	- OTHER - no supported graphics device found
1	- HERC - Hercules graphics card found
2	- CGA - Color Graphics Adaptor found
3	- EGA - Enhanced Graphics Adaptor
If DEVCODE is returned as 0 (OTHER), the global logical GRAPHICS is set to
.FALSE, and no graphics screens will be generated by the graphics subroutines.
SUBROUTINE Initialize
Subroutines Called:
SAM - Set ^Floating Point Value, Get Toggle Value
This subroutine initializes the global variable values.
SUBROUTINE InitGrid
Subroutines Called:
SAM - PutStr, Erase
This subroutine initializes the matrix of L0GICAL*1 flags used to determine if
a block is excluded from kriging. It sets all the flags in the array EXCLUDED
to .FALSE.
SUBROUTINE Insert (Vector, Ptr, Element, ElementPtr, N, MaxN)
Formal Arguments:
VECTOR - an array of REALS in which to insert ELEMENT
PTR	- an array of pointers parallel with VECTOR
ELEMENT - the value to insert
ELEMENTPTR - a pointer to inset into PTR
N	- the number of elements in VECTOR, and PTR
MAXN	- the maximum number of elements in VECTOR and PTR
Subroutines Called:
SearchB
This subroutine is called from SEARCH to insert a distance and a neighbor
pointer into the pointer list. The routine SEARCHB is called to find where
the element should be inserted in the array.
Geo-EAS Programmer's Guide
3.8-20
April 1990

-------
SUBROUTINE Intro Screen
Subroutines Called:
SAM - Set Screen, Display Frame, Display Labels, Locate Cursor
Flash, Erase
This subroutine displays the introductory screen, and waits for a keystroke
before returning. It is called from the main program module and uses SAM
routines to display the screen.
SUBROUTINE Kriger (Quit, Error)
Formal Arguments:
QUIT - set to .TRUE, if kriging is prematurely terminated
ERROR - set to .TRUE, if too many system errors occur
Subroutines Called:
Digi tize
CalcCvv
Quartiles
NewScreen
Plot Kriging Grid
Search
Plot Neighbors
Show Neighbors
Build System
Show System
Solve System
Show Weights
Plot Cell
Finish Beep
GrWai t
Get File Name
GetShf
SAM - PutStr, Erase, Locate Cursor, Put Characters, Beep
This subroutine performs the kriging for KRIGE. A kriging display is
generated on entry to the routine PLOT KRIGING GRID, unless no compatible
graphics adaptor is present, in which case the Options screen is displayed. A
row at the bottom of the screen is used to display the individual kriging
results. For each point or block in the grid a search is performed by sub-
routine SEARCH to identify the neighbors. Then the system of equations is
set up by subroutine BUILD SYSTEM. Only neighbors whose values are not
missing are used (stored into array TNEIGHBORS by BUILD SYSTEM). The system
of equations is solved and the estimate and kriging standard deviation is
computed by subroutine SOLVE SYSTEM. The routine GETSHF is called to deter-
mine the status of the debug control keys. The routines SHOW SYSTEM, SHOW
WEIGHTS, and PLOT NEIGHBORS are called if these debug keys are activated.
The subroutine PLOT CELL is used to plot the color-coded symbols for each
estimate. When kriging is completed, the routine FIIIISH BEEP is called to
signal the user. GRVAIT is called to wait for the user's keystroke before
returning to the Options menu.
Geo-EAS Programmer's Guide
3.8-21
April 1990

-------
SUBROUTINE Legend
Subroutines Called:
Plot Cell
SAM - Left Justify
GRAFLIB - Zcolor, Zmove, Zlborg, Zlabel
This subroutine is used to display a legend for the colored symbols displayed
in subroutine PLOT KRIGING GRID.
SUBROUTINE Load VarModel
Subroutines Called:
SAW - Clear Fields, Set Toggle Position, Set Character Value
Set ^Floating Point Value, Display One Field
Display Fields
This subroutine loads the variogram model parameters into the screen fields on
the Variables/Models screen for the variable selected from the kriging list.
It is called from GET SCREEN FIELDS and from DELETE VARMODEL.
SUBROUTINE Minus (X, Y, Mx, Colorl, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
MX, MY	- the width and height of the symbol
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine plots a minus symbol (dash) centered at X, Y
SUBROUTINE Neatax (Minf Max, Tine, Ntic)
Formal	Arguments:
Min	- The minimum value for the axis
Max	- the maximum value for the axis
Tine	- the tickmark interval
Ntic	- the number of tickmarks
Function Calls: Tic
This routine determines "neat" axis scaling parameters. On entry the REAL
variables MIN and MAX should contain the actual minimum and maximum values of
the data to be displayed. These values are changed by NEATAX, so temporaries
should be passed. Because of this, it is extremely IMPORTANT not to pass a
constant value to this routine. The variables TINC and NTIC are computed as
the tickmark spacing and number of tickmarks for the axis. The changed values
of MIN and MAX should be used for the axis minimum and maximum. The function
TIC is called to determine the "neat" scaling parameters.
Geo-EAS Programmer's Guide
3.8-22
April 1990

-------
SUBROUTINE New Screen (Screen Number)
Formal Arguments:
SCREEN NUMBER - the number of the screen to display
Subroutines Called:
SAM - Set Screen, Display Frame, Display Labels
This subroutine displays the specified screen, frame and fields.
SUBROUTINE Perform Process (Field Name, Error, Repaint)
Formal Arguments:
FIELD NAME
ERROR
REPAINT
Subroutines Called:
Display KrigList
Erase Structure
Reinitialize
Save Parameters
Read Parameters
Read Header Data
Read Coordinate Values
Assign Screen Fields
Get File Name
Blank. File
SAM - Get 4 Floating Point Value, Set 4Floating Point Value
Get Toggle Value, Get Character Value, Left Justify
Set Character Value, Flash, Write Field, Beep
Get Integer Value, Set Integer Value, Erase Field
Display Fields, Display One Field
This subroutine performs the error checking for KRIGE. It is called by
subroutine GET FIELD GROUP, which is in turn called from GET SCREEN FIELDS.
The Screen field name is used to determine the proper action to take. An
IF..ELSEIF block is used to determine which screen field has just been
processed. Error handling logic is included to perform bounds checking on
real and integer variables, and to check the validity of file names. This is
where the screen field contents are transferred to global variables, (if no
error occurs) this is accomplished through calls to Get 	 Value in the
SAM utilities. For screen fields such as file names, the routines are called
to read the input data, through READ HEADER DATA and READ DATA. See the
subroutine calling tree or the source code for more information.
Geo-EAS Programmer's Guide
3.8-23
April 1990

-------
SUBROUTINE Plot Cell (X, Y, Z, Xwidth, Ywidth)
Formal Arguments:
X, Y - Coordinate values for the cell center
Z	- coded quartile value (-1,0,1,2,3,4)
Xvidth - Width of cell in X direction
Ywidth - Width of cell in Y direction
Subroutines Called:
Box
This subroutine is called from KRIGER and from PLOT KRIGING GRID to plot a
colored symbol for the estimate. The variable Z contains a coded value for
the estimate: -1 means it was excluded, 0 means missing, and 1 to 4 are used
for the quartiles.
SUBROUTINE Plot Kriging Grid (Row, Column)
Formal Arguments:
ROW - The row number of the currently kriged cell
COLUMN - The column number of the current grid cell
Subroutines Called:
Legend
Plot Value
Plot Cell
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale, Zmove
Zplot, Zlborg, Zlabel
This subroutine generates the display which is active during kriging. It is
called from KRIGER. The original sample values are marked by color-coded
symbols, depicting the quartiles of the input data. As each estimate is
kriged, the routine KRIGER calls PLOT CELL to plot a colored box for the
estimate. An integer code is stored in the array KRIGVAL for use when
regenerating the display. The variables ROW and COLUMN are used to indicate
which point or block in the grid was most recently kriged. This is because
the screen must be regenerated after a debug display has been deactivated, and
the routine needs knowledge of when to stop plotting symbols.
SUBROUTINE Plot Value (X, Y, Mx, My, Z)
Formal Arguments:
X, Y - Coordinate values for the cell center
Z	- coded quartile value (-1,0,1,2,3,4)
MX, MY - the size of the symbol to be plotted
Subroutines Called:
Cross
This subroutine plots a color coded 'x' symbol centered at the point X, Y.
The variable Z determines the color of the symbol.
Geo-EAS Programmer's Guide
3.8-24
April 1990

-------
SUBROUTINE Plot Neighbors (XO, TO, Neighbors, N, Quit)
Formal Arguments:
XO, YO - center of search area
NEIGHBORS - array of pointers to neighbors found in search
N	- number of elements in array
QUIT	- set to .TRUE, if user decides to terminate kriging
Subroutines Called:
Axes
Cross, Box, Plus
GrUai t
GRAFLIB - Zsetup, Zcolor, Zlbdir, Zlocat, Zscale, Zmove, Zplot
This subroutine is called from KRIGER when the caps lock key is activated. It
is a graph of the sample value locations showing the search ellipse and the
neighbors which were located by subroutine SEARCH.
SUBROUTINE Plot Value (X, I, Mx, My, Z, Erase)
Formal Arguments:
X, Y - center of symbol
MX, MY - size of symbol in X and Y direction
Z	- code for quartile (0-4)
ERASE - flag to indicate if symbol is erased or drawn
Subroutines Called:
Plus, Cross, Box, Minus
This subroutine is called from KRIGER, and from PLOTDATA to plot the color-
coded quartile symbol for the sample value or the estimate during kriging.
The variable ERASE is used to indicate if the symbol should be drawn in the
background color. This allows KRIGER to erase the sample value symbol and
replace it with a symbol for the estimate.
SUBROUTINE Plus (X, Y, Mx, My, Colorl, Color2)
Formal Arguments:
X, Y	- The coordinates of the symbol center
MX, MY	- the width and height of the symbol
C0L0R1	- the symbol color
C0L0R2	- the color to set before returning
Subroutines Called:
GRAFLIB - Zcolor, Zmove, Zplot
This subroutine plots a '+' symbol centered at X, Y
Geo-EAS Programmer's Guide	3.8-25	April 1990

-------
SUBROUTINE Qsort (A, P, N)
Formal Arguments:
A - Array of REAL values
P - Array of INTEGER pointers {P (I) = I, for all I = 1,...,N}
N - The number of values in A and P
This subroutine uses the quicksort algorithm to sort the values in A into
ascending order. The values of P are sorted in parallel with the values in A
so that they may be used as pointers to other arrays parallel with A.
SUBROUTINE Read Coordinate Values (Error)
Formal Arguments:
ERROR - set to .TRUE, when a read or open error occurs
Subroutine Calls:
Get File Name
Qsort
SAM - PutStr, Flash, Set 4 Floating Point Value
Set Integer Value, Erase, Erase Field
This subroutine reads the coordinate values into the arrays XDATA and YDATA.
It also determines the minimum and maximums. The Y values are sorted
ascending into the array YVALUES, along with a pointer array YVALPTR.
SUBROUTINE Read Data (Error)
Formal Arguments:
ERROR - an error flag
Subroutines Called:
Get File Name
SAM - PutStr, Beep, Erase Field, Flash, Erase
This subroutine reads the data values for the variables to be kriged into the
array DATA. It is called from GET SCREEN FIELDS just prior to calling KRIGER.
The variable NKVAR indicates how many variables values are stored into DATA.
The array of pointers KRIGVAR is used to determine which variables and in
which order they are stored. If an error occurs during file access the vari-
able ERROR is set to .TRUE. The SAM routines are used to display pertinent
information on the screen, or to display error messages if any errors occur.
SUBROUTINE Read Header Data (Error)
Formal Arguments:
ERROR - error flag
Subroutines Called:
SAM - Set ^Floating Point Value, Display One Field, PutStr
Erase, Beep, Erase Field, Flash, Load Toggle Values
Flash
Geo-EAS Programmer's Guide
3.8-26
April 1990

-------
This subroutine reads the header data into memory from the data file. If an
error occurs during file access the variable ERROR is set to .TRUE. The vari-
able names and units are read into memory. The variable names are stored
into toggle fields on the screen. The SAM routines are used to display perti-
nent information on the screen, or to display error messages if any errors
occur.
SUBROUTINE Read Parameters (File Name, Error)
Formal Arguments:
FILE NAME - the name of the file to be accessed
ERROR - set to .TRUE, when a read or open error occurs
This subroutine reads the values in a KRIGE parameter file into their respec-
tive global variables.
SUBROUTINE Read Polygon File (File Name, Error)
-Formal Arguments:
FILE NAME - the name of the file to be accessed
ERROR - set to .TRUE, when a read or open error occurs
Subroutine Calls:
PtLoc
SAM - PutStr, Erase
This subroutine reads the contents of a polygon file. For each polygon
encountered in the file, all grid cells are tested to see if they are inside
or outside the polygon, using subroutine PTLOC. The LOGICAL flags in the
array EXCLUDED are set according to the results of this test. Each Polygon
may be Inclusive, Exclusive, Xinclusive or Xexclusive. All points are assumed
to be excluded initially. An inclusive polygon is one in which all points
inside the boundaries are included. An xinclusive polygon is one in which the
settings for blocks inside the current polygon are reversed and the settings
for blocks outside the polygon are unchanged. An exclusive polygon is one in
which all points inside the boundaries are excluded. An xexclusive polygon is
one in which the settings for blocks outside the current polygon are reversed
and the settings for blocks inside the current polygon are unchanged. The
logical flags in the array IncObs are set according to the rule set by the
polygon file to restrict the sample data to the polygon boundaries. The
logical variable Samplnc allows the user to set such a restriction. The rule
governing the processing of multiple polygons is that no grid cell may be
included once it has been explicitly excluded by previous a polygon. See the
appendices of the user manual, or the source code for details on the format of
this file.
SUBROUTINE Read System Defaults
Subroutines Called:
SAM - Set Character Value
Geo-EAS Programmer's Guide
3.8-27
April 1990

-------
This subroutine is called from the main program module. It accesses the system
defaults file (GEOEAS.DEF) and retrieves the File Prefix and Data File name.
If the file does not exist, no values are given to these variables. The SAM
utilities are used to store the file prefix into a screen field.
SUBROUTINE Reinitialize
Subroutines Called:
Initialize
SAM - Set Toggle Position
This subroutine is used to reset the global variables and screen field con-
tents to their default values. This routine is called from PERFORM PROCESS,
when a new file is to be read, or a file read error occurs.
SUBROUTINE Save Parameters (File Name, Error)
Formal Arguments:
FILE NAME - the name of the file to be accessed
ERROR - set to .TRUE, when an open or write error occurs
Subroutine Calls:
SAM - Flash
This subroutine stores the current set of option values in a KRIGE parameter
f ile.
SUBROUTINE Search (XO, YO, Neighbors, N, MPtr, Pailed)
Formal Arguments:
XO, YO - center of search area
NEIGHBORS - array of pointers to neighbors found in search
N	- number of elements in array
MPTR	- the position of the current variable in KRIGVAR
FAILED - set to .TRUE, if no neighbors found
Subroutines Called:
Sector
SearchB
Insert
Function Gamma
This subroutine is called by KRIGER to perform the neighborhood search. On
return, the array NEIGHBORS contains pointers to the neighbors found. The
routine SEARCHB is called to locate the nearest Y coordinate value in the
sorted list of YVALUES. Then each of the potential neighbors within the
window defined by the WX	 variables is examined. The distance from the
search center is computed, and if it is found to be within the ellipse, the
distances and the pointers are stored in arrays using routine INSERT. If the
distance measure chosen is Variogram, instead of Euclidean, then the GAMMA
function is called and the return value is stored instead of the euclidean
distance. If the number of neighbors is < MINPT, FAILED is .TRUE, and the
Geo-EAS Programmer's Guide
3.8-28
April 1990

-------
search is ended. Otherwise, depending on the number of search sectors
specified (NSECTOR) the neighbors are classified according to their sector
(quadrant and octant). If only one sector is specified, pointers to the
nearest MAXP neighbors are stored and the search is complete. Otherwise the
sectors arrays are counted to determine if the number of neighbors in a sector
was exceeded. Only the nearest MAXPS neighbors are kept for a given sector.
Finally a determination is made if the number of maximum consecutive empty
sectors (MAXEMPTY) has been exceeded. If this is not the case then search is
terminated successfully, otherwise, FAILED is detail.
SUBROUTINE Sector (Dx, Dy, Quad, Oct)
Formal Arguments:
DX, DY - the distance components (from the search center)
QUAD - the code for the neighbors quadrant
OCT - the code for the neighbors octant
This subroutine returns the quadrant and octant code for a neighbor, given the
distance components. These are used to accumulate counts into the octant and
quadrant counters in subroutine SEARCH.
SUBROUTINE Select Variable (VarNum)
Formal Arguments:
VARNUM - the number of the variable selected from the kriging list
Subroutine Calls:
SAM - Get Menu Choice, Erase
This subroutine calls GET MENU	CHOICE so that the user may select a variogram
model to edit or delete. This	routine is called from GET SCREEN FIELDS when
the Edit or Delete options are	selected. The returned value in VARNUM points
to the current Variable/Model.
SUBROUTINE Setfmt (Max, Fmt, Width)
Formal Arguments:
MAX - the value to use for determining the format
FMT - the character FORTRAN format specifier for the value
WIDTH - the maximum number of characters in FMT
This subroutine is called from AXES to determine the format to use for plot-
ting numeric tickmark labels on the X and Y axes. The algorithm works as
follows. The variable WIDTH is used as the format width. The fractional part
of MAX is extracted and multiplied by ten until it becomes a whole number.
The number of times this happens is counted, and this value is used as the
number of digits to the right of the decimal place.
SUBROUTINE Show Screen Storage
Subroutine Calls:
SAM - Clear Screen, Flash
Geo-EAS Programmer's Guide
3.8-29
April 1990

-------
This subroutine displays the amount of screen storage used by an application.
This is used during debug phase to determine if the screen data structures are
large enough.
SUBROUTINE Show Neighbors (XO, YO, Neighbors, N)
Formal Arguments:
XO, YO - center of search area
NEIGHBORS - array of pointers to neighbors found in search
N	- number of elements in array
Subroutines Called:
SAM - Clear Screen, GetCha, Locate Cursor, Put Characters
This subroutine is called from KRIGER when no graphics capability is present,
and the caps-lock, key is activated. It displays textual information about the
neighbors which were located by subroutine SEARCH.
SUBROUTINE Show System (XO, TO, N, Index)
Formal Arguments:
XO, YO - center of point, or block kriged
N	- number of neighbors
INDEX - the index of the current variable being kriged
Subroutines Called:
SAM - Clear Screen, GetKey, Locate Cursor, Put Characters
This subroutine is called by KRIGER to display the system of equations when
the scroll-lock key is activated.
SUBROUTINE Show Weights (XO, YO, Neighbors, N, Vk, Sk, Index)
Formal Arguments: •
XO, YO - the center of the point or block kriged
NEIGHBORS - an array of pointers to neighboring samples
N	- the number of neighbors
VK, SK - the kriged estimate and standard deviation
INDEX - the currently kriged variable's index in KRIGVAR
Subroutines Called:
SAM - Clear Screen, GetCha
This subroutine is called by KRIGER to display the kriging weights and other
intermediate information used to compute the estimate. It is called when the
Num-Lock key is activated.
SUBROUTINE Simeq (N, Error)
Formal Arguments:
N - the size of the system of equations
ERROR - set to .TRUE, is a system solver error occurs
Geo-EAS Programmer's Guide
3.8-30
April 1990

-------
Subroutines Called:
SAM - Erase, Beep, Locate Cursor, Put Characters, GetKey
This subroutine solves the system of equations. It is called by SOLVE SYSTEM.
The routine uses a modified LU decomposition technique to solve the system.
SUBROUTINE Solve System (Neighbors, N, Vk, Sk, Index)
Formal Arguments:
NEIGHBORS - an array of pointers to neighbors used by BUILD SYSTEM
N	- the number of elements in NEIGHBORS
VK, SK - the kriged estimate and standard deviation
INDEX - the currently kriged variable's index in KRIGVAR
Subroutines Called:
Simeq
SAM - Beep, Locate Cursor, Put Characters, GetKey
This subroutine is called by KRIGER to solve the system of equations and to
compute the kriging estimate and standard deviation.
SUBROUTINE Write System Defaults
This subroutine writes the current values of FILE PREFIX and DATA FILE to the
system defaults file. If this file is not found, it is created and the values
are saved.
Geo-EAS Programmer's Guide
3.8-31
April 1990

-------
3.9	POSTPLOT
3.9.1
Software Function
Postplot produces a plot of (2D) sample locations and values for variables in
a Geo-EAS data file. Sample locations may be marked with a symbol, value, or
both. The format for the value to be plotted may be specified by setting a
scaling factor and the number of decimal places to be used in the plotted
value. Options allow control of axes parameters, and titles. A file called a
'metacode' file is created for redisplay or to produce a hardcopy.
Postplot attempts to produce 'true-scale' graphs on the screen, but for some
data configurations, an internal NCAR routine overrides true scaling and
produces a somewhat distorted graph.
3.9.2 Global Variables/Program Limits
Postplot requires that the input data file contain at least 3 but not more
than 48 variables. These should consist of an X and Y coordinate and a third
variable which will be posted. The data file may contain up to 1000 samples.
If the data file contains more than 1000 samples, only the first 1000 will be
used by Postplot.
The following is a description of the global variables used in POSTPLOT. The
format is extracted from the declaration file POSTPLOT.CMN.
C***************************************************************
C PARAMETERS
C Maxvar	- Maximum number of variables in the data file.
C Maxdata - Maximum number of data records in the data file.
PARAMETER (Maxvar = 48)
PARAMETER (Maxdata = 1000)
CHARACTER*3 Stat
CHARACTER*60 Text
CHARACTER*80 Line
C** **************** **************** ***************** ************
C /FILES/
C
C File Prefix
C Data File
C Metacode File
C File Name
Common block for file names.
-	File prefix for file names.
-	Data file name.
-	Metacode file name.
-	File name including the file prefix.
+
COMMON /FILES/ Data File, Metacode File, File Prefix,
File Name
CHARACTER*14 Metacode File, Data File
CHARACTER*50 File Prefix, File Name*64
Geo-EAS Programmer's Guide
3.9-1
April 1990

-------
£**********?
C /DATFIL/
C
C
C
C
C
C
C
C
C
C
C
Nvar
Ndatafile
Varnam
Uni ts
Xarr
Yarr
Parr
Iptr
Cutoff
- Common block, for the data file.
-	Number of variables in the data file.
-	Number of records in the data file.
-	Array of variable names.
-	Array of measurement units for each variable.
-	Array of X coordinates for the sample points.
-	Array of Y coordinates for the sample points.
-	Array of values for the variable to post.
-	Array used for sorting records.
-	Array for the first, second and third quartile
values.
COMMON /DATFIL/ Nvar, Varnam, Units, Ndatafile, Xarr,
Yarr, Parr, Iptr, Cutoff
CHARACTER*10 Varnam(Maxvar), Units(Maxvar)
INTEGER*2 Iptr(Maxdata)
INTEGER*4 Nvar, Ndatafile
REAL*4	Xarr (Maxdata), Yarr(Maxdata),
Parr(Maxdata), Cutoff(3)
C****************************************** ******* **************
C
C
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
/SCRSEL/
Val Sel
Vsize
Sym Sel
Ssize
Seal Sel
Dec Sel
Ax Sel
Xmin, Xmax
Ymin,
Xaxis
Yaxis
Titl
Stitl,Stit2
Xlab, Ylab
Intro
Ymax
Args
Args
Common block for screen parameters.
Indicates whether values are to be plotted.
Size to plot values.
Indicates whether symbols are plotted.
Size to plot symbols.
-	Scale factor.
-	Number of decimal places.
-	Type of axis style.
Minimum coordinates value for the graph.
-	Maximum coordinates value for the graph.
-	Array of tick parameters for the X axis.
-	Array of tick parameters for the Y axis.
-	Title for the graph.
-	Subtitles for the graph.
X and Y axes labels.
Logical variable set to true if the
introductory screen is to be displayed.
COMMON /SCRSEL/ Val Sel, Vsize, Sym Sel, Ssize, Seal Sel,
Dec Sel, Ax Sel, Xmin, Xmax, Ymin, Ymax,
Xaxis Args, Yaxis Args, Titl, Stitl,
Sti12, Xlab, Ylab, Intro
Geo-EAS Programmer's Guide
3.9-2
April 1990

-------
CHARACTER*2
CHARACTER*3
CHARACTER*^
CHARACTER*50
CHARACTER*60
INTEGER*4
REAL*4
LOGICAL
Seal sel, Dec sel
Sym sel, Val sel
Ax sel
Xaxis Args(7), Yaxis Args(7)
Titl, STitl, STit2, Xlab, Ylab
Vsize, Ssize
Xmin, Xmax, Ymin, Ymax
Intro
C /NCAR/	- Common block, for producing the graph.
C
C Xcor	- Array of X coordinates to plot.
C Ycor	- Array of Y coordinates to plot.
C Pval	- Array of sample values to plot.
C Ndata	- Number of sample to plot.
C Pmin,Pmax	- Minimum and maximum value to plot.
C Value	- Stores the value to plot as characters.
C Scaled	- Stores the scale factor as characters to plot.
C Background	- Type of background axes.
C DevCode	- Type of graphics device.
COMMON /NCAR/ Xcor, Ycor, Pval, Pmin, Pmax, Scaled,
+	Background, Value, DevCode, Ndata
CHARACTER*15
CHARACTER*35
Value (Maxdata)
Scaled
INTEGER*2 DevCode
INTEGER*^ Background, Ndata
REAL*4 Xcor(Maxdata), Ycor(Maxdata), Pval(Maxdata),
Pmin, Pmax
Geo-EAS Programmer's Guide
3.9-3
April 1990

-------
3.9.3 Data Flov and Processing
Data Flow Diagram
File Inputs
POSTPLOT requires a Geo-EAS data file £or input. POSTPLOT also	reads the
System Defaults File, if one exists, for a data file r.ame and a	file prefix.
Geo-EAS Programmer's Guide	3.9-4	April 1990

-------
3-9.4 User Interface
The Screens
POSTPLOT displays three screens, an Introductory screen, a Main screen, and a
Graph Options screen. In the file POSTPLOT.SCR the Introductory screen is
defined as Screen 1, the Main screen as Screen 2 and the Graph Options screen
as Screen 3. The Introductory screen displays a brief introduction and no
menu options. The Main screen has the menu options to allov specification of
the data and metacode file names, the selection of the variables to be used
and the options for displaying the posted variable. The Graph Options screen
has the menu options that provide control over the 'graph background param-
eters'. The menus that appear on the screens are presented belov along vith
the menu naj.e and the related screen field name (in parentheses) that is used
in the POSTPLOT. SCR file.
The Main menu (MAINMENU)
Prefix Data Variables Options Graph Options Execute Quit
The Graph Options menu (BG MENU)
Axis Parameters Tick Parameters Graph Limits Titles/Labels Reset Quit
The Menu Hierarchy
Global Variable/Screen Field Relationships
All the fields on the screens have associated screen field names in the
screen definition file POSTPLOT.SCR. The screen fields (described by the
screen label), their associated field names, field type, and the related
global variable names are listed belov.
(MAINMENU)
Postplot —|- Prefix
¦ Data
-	Variables
-	Options
-	Graph Options
—p Axis Parameters
(- Tick Parameters
Graph Limits
(- Titles/Labels
|- Reset
!- Quit
(BG MENU)
- Execute
L Quit
Geo-EAS Programmer's Guide
3.9-5
April 1990

-------
SCREEN
LABEL
FIELD NAME
(POSTPLOT.SCR)
GLOBAL VARIABLE
Main Screen
File Prefix
Data
Metacode File
Variables
X coordinate variable
Y coordinate variable
Variable to Post
Options
Include Values
Size
Scale Factor
# Decimals
Include Symbols
Size
Graph Options Screen
Axes Parameters
Axis Style
Graph Limits
Min
Max
PREFIX (char)
DATA FILE (char)
METACODE (char)
XVARIABLE (toggle)
YVARIABLE (toggle)
PLOTVAR (toggle)
VALUES
VAL SIZE
SCALE
DECIMALS
SYMBOLS
SYM SIZE
(toggle)
(toggle)
(toggle)
(toggle)
(toggle)
(toggle)
AXES (toggle)
MIN X (real)
MIN Y (real)
MAX X (real)
MAX Y (real)
FILE PREFIX
DATA FILE
METACODE FILE
VAL SEL
VSIZE
SCAL SEL
DEC SEL
SYM SEL
SSIZE
AX SEL
XAXIS ARGS(l),
XMIN
YAXIS ARGS(2),
YMIN
XAXIS ARGS(l),
XMAX
YAXIS ARGS(2),
YMAX
Tick. Parameters
Base
TIC
BAS
X
(real)
XAXIS
ARGS(A)

TIC
BAS
Y
(real)
YAXIS
ARGS(A)
Type
TIC
TYP
X
(toggle)
XAXIS
ARGS(3)

TIC
TYP
Y
(toggle)
YAXIS
ARGS(3)
Label
TIC
LAB
X
(toggle)
XAXIS
ARGS(5)

TIC
LAB
Y
(toggle)
YAXIS
ARGS(5)
Fraction
TIC
FRC
X
(real)
XAXIS
ARGS(7)

TIC
FRC
Y
(real)
YAXIS
ARGS(7)
Exponent
TIC
EXP
X
(real)
XAXIS
ARGS(6)

TIC
EXP
Y
(real)
YAXIS
ARGS(6)
Geo-EAS Programmer's Guide
3.9-6
(continued)
April 1990

-------
SCREEN
LABEL
FIELD NAME
(POSTPLOT.SCR)
GLOBAL VARIABLE
Ti ties/Labels
Main Title
Subti ties
TITLE	(char)
SUBTITLE1	(char)
SUBTITLE2	(char)
X LABEL	(char)
Y LABEL	(char)
TITL
STIT1
STIT2
XLAB
YLAB
X Label
Y Label
3.9.5 Processing
The following pseudocode represents the general flov of processing in
POSTPLOT. Processing is structured along the lines of the menu hierarchy and
the subroutine calling tree. The 'Interactive Screen Input' process is
performed by the subroutines GET SCREEN FLD and PERFORM PROCESS.
POSTPLOT
¦Initialize Graphics
Read System Defaults
Initialize Variables
Interactive Screen Input
Write System Defaults
Interactive Screen Input
IF Menu Choice = Quit THEN Return
ELSE IF Menu Choice = Graph Options THEN
Display Graph Options screen
IF Menu Choice = Quit THEN
Display Main screen
ELSE IF Menu Choice = Reset THEN
Reset screen values
ELSE
Get field values
ENDIF
ELSE IF Menu Choice = Data THEN
Read Data File
ELSE IF Menu Choice = Execute THEN
Get Screen values
Determine graph limits
IF values are plotted THEN
Set format for values
ENDIF
Set AUTOGRAPH parameters
Create graph
View graph
ELSE
Get field values
ENDIF
Geo-EAS Programmer's Guide
3.9-7
April 1990

-------
3.9.6 The Outputs
Output Files
POSTPLOT generates a file of metacode instructions before the graph is dis-
played. This file is saved in the user's specified directory for future
viewing. POSTPLOT also stores the data file name, the file prefix name and
the value of the global variable INTRO into the Systems Defaults File. If
the file does not exist, POSTPLOT creates one.
Output Screens
POSTPLOT generates a plot of sample locations. The samples are marked with a
colored symbol to classify sample values. Refer to the User Guide for an
example Post Plot.
3.9.7 Subroutine Structure
The following is the subroutine calling tree for POSTPLOT.
POSTPLOT	r SAM
|- Grafinit 	
f- Read System Defaults
|- Initialize 	
- SAM
T Reset Values
t- SAM
Vstats
|- Intro Screen —
|- Get Screen Fid
-p Get New Screen
(- Display Fids —
)- Reset Values —
[• Perform Process
I- View 	
SAM
SAM
SAM
SAM
(1)
(4)
•- Write System Defaults
Geo-EAS Programmer's Guide
3.9-8
April 1990

-------
(1) - Perform Process
Initialize
Reset Values
I- SAM
(- Read Header Data
I
Open File
|- Display Fids -
|- Erase Message
I- SAM
SAM
SAM
|- Get Field Group
|- Toggle Position
|- Get XY Data 	
SAM
SAM
-j- Open File
|- Toggle Position
|- Erase Massage —
|- Display Fids —
1 SAM
SAM
SAM
SAM
|- Get Screen Args
f-	Set Graph Limits
[-	Set Value 	
|-	Set Params 	
L Create Plot 	
SAM
|- Toggle Position
L Get Axis Args
SAM
Remove Blanks
|- Toggle Position
L SAM
SAM
Qsort
SAM
(2)
(3)
( 2) - Set Params
( 3 )
Create Plot
AUTOGRAPH
f- SAM
L Set Arg
-j- Lencma
|- SAM
L AUTOGRAPH
SAM
|- AUTOGRAPH
|- NCARSPP
(- Bndary
L Plot Blegend
— NCARSPP
—p NCARSPP
L SAM
Libraries: SAM	-	Screen Access Management
AUTOGRAPH	-	NCAR Autograph Package
NCARSPP	-	NCAR System Plot Package
GRAFLIB	-	GRAFLIB Graphics Library
HERSHY	-	Hershey Character Plotting Utilities
Geo-EAS Programmer's Guide
3.9-9
April 1990

-------
3.9.8 Subroutine Descriptions
Following is a list of the subroutines that appear in POSTPLOT. The formal
arguments (if any) are described followed by the local variables and finally a
description of what the subroutine does.
PROGRAM POSTPLOT (main module)
The main program performs the following:
Reads in the system defaults
Initializes program variables
Sets up the screen
Calls Get Screen Fid to display the screens and process the
user's requests
Writes to the system default file
SUBROUTINE BNDARY
This routine draws the frame around the graph.
SUBROUTINE CREATE PLOT
This routine sets up the graph parameters and plots the graph by using calls
to PVRIT, then calls Plot Blegend to plot the legend.
SUBROUTINE DISPLAY FLDS
This routine displays the current screen fields.
SUBROUTINE ERASE MESSAGE
This routine erases messages displayed in the message area of the screen.
SUBROUTINE GET AXIS ARGS (XY)
Formal Arguments:
XY - which axis value to extract.
This routine extracts the screen values for the X and Y axes and stores them
in their global variables.
SUBROUTINE GET FIELD GROUP
This routine gets the value for a group of screen fields.
SUBROUTINE GET NEW SCREEN (SCREEN NUMBER)
Formal Arguments:
SCREEN NUMBER - the screen number.
This routine sets the current screen to screen number and then displays the
frame and labels for that screen.
Geo-EAS Programmer's Guide	3.9-10	April 1990

-------
SUBROUTINE GET SCREEN ARGS
This routine extracts the screen values and store them into their global vari-
ables. It calls Get Axis Args to get the X and Y axis parameters.
SUBROUTINE GET SCREEN FLD
Local Variable:
This routine displays the current screen, accesses the menu option selected by
the user and then calls Perform Process to process the screen fields or calls
a routine to process the menu option.
SUBROUTINE GET XY DATA
This routine reads in the values for the variables selected and determines
the minimum/maximum values
SUBROUTINE GRAFINIT
This routine calls Vstats to initialize graphics parameters and sets the
global variable Devcode to the type of graphics device in use.
SUBROUTINE INITIALIZE
This routine initializes global variables to their default values and then
calls Reset Values to set the screen fields.
SUBROUTINE INTRO SCREEN
This routine displays the screen frame/labels/fields for the introductory
screen.
FUNCTION LENCMA (STRING)
Formal Arguments:
STRING - Character sting.
This routine returns the location of the right-most comma in a string. Used
for parsing Autograph arguments.
Main Screen
Back Screen
Main Menu
Back Menu
Menu Choice
Error
Exi t
the screen number for the main screen.
the screen number for the background screen.
the name of the main menu.
the name of the background menu.
the user's menu selection.
Logical that is set to true if an error occurs.
Logical that is set to true when the user wants to exit the
program.
Geo-EAS Programmer's Guide
3.9-11
April 1990

-------
SUBROUTINE OPEN FILE (NUNIT, NAMFIL, STAT, OPENERR)
Formal Arguments:
NUNIT - File unit number.
NAMFIL - File name.
STAT	- File status.
OPENERR - Logical variable set to true if error occurs.
This routine opens Nunit with Namfil and Stat parameters and returns Openerr
0, if successful.
SUBROUTINE PERFORM PROCESS
Local Variables:
Field Name
Fexist
Error
Overwrite
Stores the screen field name.
Logical variable set to true if the file
exists.
Logical variable set to true if an error
occurs.
Logical variable set to true if the file can
be overwritten.
This routine identifies which screen field has been selected, performs any
error checking and then processes the screen field.
SUBROUTINE PLOT BLEGEND
This routine plots a quartile legend at the bottom of the graph.
SUBROUTINE READ HEADER DATA (ERROR)
Formal Arguments:
ERROR - Logical variable set to true if an error occurs.
This routine reads in the header information from the data file and then sets
the screen fields. If an error occurs while reading the file an error message
is displayed.
SUBROUTINE READ SYSTEM DEFAULTS
This routine reads the system defaults file 'GEOEAS.DEF' and initializes the
system defaults.
SUBROUTINE REMOVE BLANKS (ARG)
Formal Arguments:
ARG - Character string the remove blanks.
This routine checks for blanks in a given argument and shifts to
the left as needed.
Geo-EAS Programmer's Guide
3.9-12
April 1990

-------
SUBROUTINE RESET VALUES
This routine resets the parameters for the graph options menu to their default
values.
SUBROUTINE SET ARG (ARG, XT, INDEX)
Formal Arguments:
ARG	- Indicate which AUTOGRAPH axis parameter to set.
XY	- Axis parameters to set.
Index - Index number of the argument in the array of
axes parameters.
Local Variable:
Acid - Stores	the argument name as a character.
Acval - Stores	the argument value as a character.
Afval - Stores	the argument value as a real number.
This routine set the AUTOGRAPH axes parameters that vere specified by the user
and then set parameters for the top and bottom axes, the number of tick marks
and the character size for the axes labels.
SUBROUTINE SET GRAPH LIMITS
This routine determines the quartile cut off values, then determines which
data points are to be plotted by checking the graph limit.
SUBROUTINE SET PARAMS
This routine sets the AUTOGRAPH parameters for the axes parameters, and titles
and labels. It calls Set Arg to set the X and Y axes arguments.
SUBROUTINE SET VALUE
This routine calculates the scale factor to use, then computes the format to
plot the values, this routine is called only if the user selects to plot the
value.
INTEGER*4 FUNCTION TOGGLE POSITION (FIELD NAME)
Formal Arguments:
FIELD NAME - Stores the toggle field name.
This routine returns the toggle position for the specified toggle field.
SUBROUTINE VIEW (FILE NAME, ERROR, DEVCODE)
Formal Arguments:
FILE NAME	- Name of metacode file to display.
ERROR	- Logical variable set to true if an error
occurs.
DEVCODE	- Type of graphic device in use.
Geo-EAS Programmer's Guide
3.9-13
April 1990

-------
This routine translates NCAR metacode to graphic output on several available
graphics devices. Refer to chapters 4 and 5 of the NCAR document "The NCAR
Graphics System Implementor's Guide" for more information about metacode.
Refer to Section 2 for more information on subroutine VIEW.
SUBROUTINE WRITE SYSTEM DEFAULTS
This routine writes the file system defaults to the system default file
'GEOEAS.DEF'
Geo-EAS Programmer's Guide
3.9-14
April 1990

-------
3.10
XYGRAPH
3.10.1	Softvare Function
Xygraph produces line and/or scatter plots for up to 6 variables in a Geo-EAS
data file. Plots of up to 6 dependent variables with 1 independent variable
can be obtained. Up to 6 colors, symbols, and line types may be used to
identify the data. Options allow a regression line to be calculated and
control of axes parameters and titles. A file called a 'metacode' file is
created for redisplay or to produce a hardcopy.
3.10.2	Global Variables/Program Limits
Xygraph requires that the input data file contain at least 2 but not more than
48 variables. The data file may contain up to 1000 samples. If the data file
contains more than 1000 samples, only the first 1000 will be used by Xygraph.
The following is a description of the global variables used in XYGRAPH. The
format is extracted from the declaration file XYGRAPH.CMN
***********************************************
C	PARAMETERS
C
C	Maxvar - Maximum number of Y variables.
C	Maxvarfile - Maximum number of variable in the data file.
C	Maxdata - Maximum number of data records in the data file.
C	Maxuser - Maximum number of user arguments.
PARAMETER (Maxvar = 6)
PARAMETER (Maxvarfile =48)
PARAMETER (Maxdata = 1000)
PARAMETER (Maxuser = 1)
C
C
CHARACTER XY
CHARACTER*3 Stat
CHARACTER*60 Text
Geo-EAS Programmer's Guide
3.10-1
April 1990

-------
Q-kk-k k kirk kkkkk-k'k'kk'k'k-k-kk'k'kk'k'k'kkkkk'k'kkkkk'kkk'kk-kkkk'kkkkkkkkk'k'k'k-k-kick it
/FILES/
Common block for file names.
File Prefix
Data File
Metacode File
Param File
User Pfile
File Name
-	File prefix for file names.
-	Data file name.
-	Metacode file name.
-	Input parameter file.
-	Output parameter file.
-	File name including the file prefix.
COMMON /FILES/ Data File, Metacode File, Param File,
+	User Pfile, File Prefix, File Name
CHARACTER*14	Param File, Metacode File, Data File,
+	User Pfile
CHARACTER*50	File Prefix
CHARACTER*64	File Name
C /DATFIL/	- Common block for the data file.
C
C Nvar	- Number of variables in the data file.
C Ndatafile	- Number of records in the data file.
C Vname	- Array of variable names.
C Vunit	- Array of measurement units for each variable.
C Xcor	- Array of X coordinates for the sample data.
C Ycor	- Array of Y coordinates for the sample data.
COMMON /DATFIL/ Nvar, Vname, Vunit, Ndatafile,
+	Xcor, Ycor
CHARACTER*10 Vname(Maxvarfile), Vunit(Maxvarfile)
INTEGER*4 Ndatafile, Nvar
REAL*4	Xcor(Maxdata), Ycor(Maxvar,Ma;
-------
C /SCRSEL/
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
c
c
c
c
c
c
c
c
Ind Var
Yvarcod
Lccod
Sccod
Cccod
Scode
Ccode
Regression
Legend Pos
Num Curves
Xmin,Ymin
Xmax,Ymax
Xlog
Ylog
Titl
Stitl, Sti
Xlab, Ylab
Intro
- Common block for screen parameters.
-	X variable selected.
-	Stores the Y variable field name.
-	Stores the line type field name.
-	Stores the symbol type field name.
-	Stores the color field name.
-	Code for the type of symbol.
-	Code for the color.
-	Indicates whether linear regression is
calculated.
ition - Indicates position of the legend.
-	Number of lines to plot.
-	Minimum coordinate values for the graph.
-	Maximum coordinate values for the graph.
-	Logical variable set to true if log scaling
is set for the X variable.
-	Array of logical variables set to true if log
scaling is set for a Y variable.
-	Title for the graph.
t2 - Subtitles for the graph.
-	X and Y axes labels.
-	Logical variable set to true if the
introductory screen is to be displayed.
COMMON /SCRSEL/ Ind Var, Yvarcod, Lccod, Sccod, Cccod,
Scode, Ccode, Regression,
Legend Position,
Xmin, Xmax, Ymin, Ymax, Xlog, Ylog,
Titl, Stitl, Stit2, Xlab, Ylab,
Num Curves, Intro
CHARACTER*3
CHARACTER*6
CHARACTER*8
CHARACTER*10
CHARACTER*60
INTEGER*^
L0GICAL*1
REAL*4
Regression
Scode, Legend Position
Ccode
Ind Var, Yvarcod, Lccod, Sccod, Cccod
Titl, STitl, STit2, Xlab, Ylab
Num Curves
Xlog, Ylog(Maxvar), Intro
Xmin, Xmax, Ymin, Ymax
Geo-EAS Programmer's Guide
3.10-3
April 1990

-------
it* ^-x-r-k-x-k-x-kve	-x-k-x^-x-r-x-fc-k-kir-fey? it-k'T
C /PARFIL/	-	Common block for the parameter file.
C
C Var Args	-	Array of parameters for plotting the data.
C Gen Args	-	Array of general background arguments.
C Xaxis Args	-	Array of tick parameters for the X axis.
C Yaxis Args	-	Array of tick parameters for the Y axis.
C LabLin Args	-	Array of parameters for the titles and axes
C	labels.
C User Args	-	Array of parameters set by the user.
C RPError	-	Logical variable set to true if an error
C	occurred vill reading the parameter file.
COMMON	/PARFIL/ Var Args, Gen Args, Xaxis Args,
+	Yaxis Args, LabLin Args, RPError,
+	User Args
CHARACTER* 2 5
CHARACTER*35
CHARACTER* 50
CHARACTER*80
LOGICAL*!
Gen Args(3)
Var Args(Maxvar,6)
Xaxis Args(8), Yaxis Args(8)
Lablin Args(5,3), User Args(Maxuser)
RPError

c
n
/NCAR/
- Common block for producing the graph.

U
c
Xarr
- Array of X coordinates to plot.

c
Yarr
- Array of Y coordinates for the Y variables to
c

plot.

c
Ndata
- Number of samples to plot.

c
Iptr
- Array used for sorting records.

c
Dshp
- Array of dash line patterns to plot the
line(s).
c
Idpc
- Array of symbols to plot the line(s).

c
Pvr
- Indicates whether line, symbols or both
are to be
c

plotted.

c
Devcode
- Type of graphics device.

COMMON /NCAR/
Ndata, Xarr,
Devcode
Yarr, Dshp, Pvr,Iptr,Idpc,
CHARACTER*6	Idpc(7)
CHARACTER*19	Dshp(Maxvar)
INTEGER*2	Pvr(Maxvar), Iptr(Maxdata), Devcode
INTEGER*4	Ndata
REAL*4	Xarr(Maxdata), Yarr(Maxvar,Maxdata)
Geo-EAS Programmer's Guide	3.10-4	April 1990

-------
3-10-3 Data Flov and Processing
Data Flov Diagram
File Inputs
XYGRAPH requires a Geo-EAS data file for input. XYGPAPH also reads the System
Defaults File, (if one exists) for a data file name ar.d a file prefix and an
input parameter file for the parameter values from a previous XYGRAPH session.
Geo-EAS Programmer's Guide
3.10-5
April 1990

-------
3.10.4 User Interface
The Screens
XYGRAPH displays four screens, an Introductory screen, a Main Screen, an
Options screen and a Graph Options screen. In the file XYGRAPH.SCR the
Introductory screen is defined as Screen 1, the Main screen as Screen 2, the
Options screen as Screen 3 and the Graph Options screen as Screen 4. The
Introductory screen displays a brief introduction and no menu options. The
Main screen has the menu options to allow specification of the input and
output parameter file names. The Options screen has the menu options to allow
specification of the data and metacode file names, the selection of variables,
options for displaying the variables, to compute a regression line, and the
position of a graph legend. The Graph Options screen has the menu options
that provide control over the 'graph background parameters'. The menus that
appear on the screens are presented below along with the menu name and the
related screen field name (in parentheses) that is used in the XYGRAPH.SCR
file.
The Main menu (MAINMENU)
Prefix Read Parameters Options/Execute Save Parameters Quit
The Options menu (EDITMENU)
Data Variables Symbol/Line Regression Legend Graph Options Execute Quit
The Graph Options menu (BG MENU)
Axis Parameters Tick Parameters Graph Limits Title/Labels Reset Quit
The Menu Hierarchy
Xygraph
(MAINMENU)
Prefix
Read Parameters
Options/Execute
- Save Parameters
Quit
(EDITMENU)
Data
Variables
Symbol/Line
Regression
Legend
Graph Options
(BG MENU)
Axis Parameters
Tick Parameters
Graph Limits
- Ti ties/Labels
Reset
L Quit
Execute
Qui t
Geo-EAS Programmer's Guide	3.10-6	April 1990

-------
Global Variable/Screen Field Relationships
All the fields on the screens have associated screen field names in the
screen definition file XYGRAPH.SCR. Some of these fields have their contents
assigned to a global variable and others are assigned to local variables. The
screen fields (described by the screen label), their associated field names
(used in XYGRAPH.SCR; the field type is enclosed in parentheses), and the
related global variable names are listed belov.
SCREEN	FIELD NAME
LABEL	(XYGRAPH.SCR)	GLOBAL VARIABLE
Main Screen
File Prefix	PREFIX (char)	FILE PREFIX
Input Parameter File	PARAMETER (char)	PARAM FILE
Output Parameter File	OPARAMETER (char)	USER PFILE
Options Screen
Data File
Metacode File
Regression
Legend
DATA FILE (char)
METACODE	(char)
REGRESS	(toggle)
LEGEND	(toggle)
DATA FILE
METACODE FILE
REGRESSION
LEGEND POSITION
Variables
X Variable
Y Variables
XVAR	(toggle
Y	VAR CI	(toggle
Y	VAR C2	(toggle
Y	VAR C3 (toggle
Y	VAR C4 (toggle
Y	VAR C5 (toggle
Y	VAR C6 (toggle
IND VAR
YVARCOD
ft
ft
It
rt
it
Symbol/Line Type
Symbol Type
STYPE CI	(toggle
STYPE C2	(toggle
STYPE C3	(toggle
STYPE C4	(toggle
STYPE C5	(toggle
STYPE C6	(toggle
LTYPE CI	(toggle
LTYPE C2	(toggle
LTYPE C3	(toggle
LTYPE C4 (toggle
LTYPE C5	(toggle
LTYPE C6	(toggle
COLOR CI	(toggle
COLOR C2	(toggle
COLOR C3 (toggle
COLOR C* (toggle
COLOR C5 (toggle
VAR ARGS(1,5)
VAR ARGS(2,5)
VAR ARGS(3,5)
VAR ARGS(4,5)
VAR ARGS(5,5)
VAR ARGS(6,5)
VAR ARGS(1,2)
VAR ARGS(1,2)
VAR ARGS(1,2)
VAR ARGS(1,2)
VAR ARGS(1,2)
VAR ARGS(1,2)
VAR ARGS(1,6)
VAR ARGS(1,6)
VAR ARGS(1,6)
VAR ARGS(1,6)
VAR ARGS(1,6)
Line Type
Color
Geo-EAS Programmer's Guide
3.10-7
April 1990

-------
SCREEN
LABEL
FIELD NAME
(XYGRAPH.SCR)
GLOBAL VARIABLE
Graph Options Screen
Axes Parameters
Axis Style
Graph Limits
Min
Max
Scale
Tick. Parameters
Base
Type
Label
Fraction
Exponent
Ti ties/Labels
Main Title
Subtitles
X Label
Y Label
COLOR C6 (toggle)
AXES (toggle)
MIN X (real)
MIN Y (real)
MAX X (real)
MAX Y (real)
SCALE X (toggle)
SCALE Y (toggle)
TIC
BAS
X
(real)
TIC
BAS
Y
(real)
TIC
TYP
X
(toggle)
TIC
TYP
Y
(toggle)
TIC
LAB
X
(toggle)
TIC
LAB
Y
(toggle)
TIC
FRC
X
(real)
TIC
FRC
Y
(real)
TIC
EXP
X
(real)
TIC
EXP
Y
(real)
TITLE (char)
SUBTITLE1 (char)
SUBTITLE2 (char)
X LABEL (char)
Y LABEL (char)
VAR ARGS(lf6)
GEN ARGS(l)
XAXIS ARGS(l),	XMIN
YAXIS ARGS(l),	YMIN
XAXIS ARGS(2),	XMAX
YAXIS ARGS(2),	YMAX
XAXIS ARGS(8),	XLOG
YAXIS ARGS(8),	YLOG
XAXIS ARGS(4)
YAXIS ARGS(4)
XAXIS ARGS(3)
YAXIS ARGS(3)
XAXIS ARGS(5)
YAXIS ARGS(5)
XAXIS ARGS(7)
YAXIS ARGS(7)
XAXIS ARGS(6)
YAXIS ARGS(6)
LABLIN ARGS(1,3),
TITLE
LABLIN ARGS(2,3),
STIT1
LABLIN ARGS(3,3),
STIT2
LABLIN ARGS(4,3),
XLAB
LABLIN ARGS(5,3),
YLAB
Geo-EAS Programmer's Guide
3.10-8
April 1990

-------
3.10.5 Processing
The following pseudocode represents the general flov of processing in XYGRAPH.
Processing is structured along the lines of the menu hierarchy and the subrou-
tine calling tree. The 'Interactive Screen Input' process is performed by the
subroutines GET SCREEN FLD and PERFORM PROCESS.
XYGRAPH
Initialize Graphics
Read System Defaults
Initialize Variables
Interactive Screen Input
Write System Defaults
Interactive Screen Input
IF Menu Choice = Quit THEN Return
ELSE IF Menu Choice = Options/Execute THEN
Display Options screen
IF Menu Choice = Quit THEN
Display Main screen
ELSE IF Menu Choice = Graph Options THEN
Display Graph Options screen
IF Menu Choice = Quit THEN
Display Options screen
ELSE IF Menu Choice = Reset THEN
Reset screen values
ELSE
Get Screen values
ENDIF
ELSE IF Menu Choice = Execute THEN
Create Plot
ELSE
Get Screen values
ENDIF
ELSE
Get Screen values
ENDIF
Create Plot
CALL AUTOGRAPH to create metacode file
CALL VIEV to translate metacode and display graph
Geo-EAS Programmer's Guide
3.10-9
April 1990

-------
3.10.6 The Outputs
Output Files
XYGRAPH generates a file of metacode instructions before the graph is
displayed. This file is saved in the user's specified directory for future
vieving. XYGRAPH also stores the data file name, the file prefix name and
the value of the global variable Intro into the System Defaults File. If the
file does not exist, XYGRAPH creates one. An output parameter file with the
current parameter setting is also created by XYGRAPH.
Output Screens
XYGRAPH generates a screen displaying a line or scatter plot when the Execute
menu option is selected. Refer to the User Guide for an example of this
screen.
3.10.7 Subroutine Structure
The following is the subroutine calling tree for XYGRAPH.
XYGRAPH 	r SAM
[¦¦ Grafinit 	
|- Read System Defaults
\¦ Initialize 	
- SAM
-|- Reset Values
•- SAM
Vstats
f- Intro Screen —
|- Get Screen Fid
- SAM
T Build File Name
)- Get New Screen •
|- Display Fids —
[¦ Reset Values —
|- Perforin Process
L Xyplot 	
SAM
SAM
SAM
(1)
(2)
L Write System Defaults
Geo-EAS Programmer's Guide
3.10-10
April 1990

-------
(1)
Perform Process
Initialize
Reset Values
L SAM
|- Read Param File
[- Build File Name
)- Read Header Data
-p Display Fids
f- SAM
|- Erase Message 	 SAM
|- Get Curve farms - Set Stype
t- Get Plot Parms —r Xaxis Parms
(¦ Vaxis Parms
L SAM
-p Open File
f- SAM
[• Display Fids 	 SAM
L Erase Message — SAM
SAM
SAM
Get Field Group
|- Toggle Position
|- Get Data 	
L Write Parm File
—	SAM
—	SAM
-p Open File
|- Get Stype
f- Get Color
[- SAM
Toggle Position — SAM
[- Erase Message 	 SAM
L Display Fids 	 SAM
T SAM
(- Open File
[• Remove Blanks
|- Set Color
|- Set Stype
Toggle Position —
•- Set Axis Ar=s
- SAM
	[- Remove Blanks
L Toggle Position
lSAM
Geo-EAS Programmer's Guide
3.10-11
April 1990

-------
(2) - Xyplot
— Set Graph Limits
)- Set Params 	
Plot Curves
— Qso rt
AUTOGRAPH
|- SAM
Set LmSym Pat
|- Set Af3 	
I
•- Set User Args
SAM
|- AUTOGRAPH
|- SCARS??
}- Bsdary 	
(- Plat Blegend
!
!
I
(- Plot RIegend
I
L Regress
L View (see Section 2)
— Stype
-j- Lencma
f- SAM
L AUTOGRAPH
AUTOGRAPH
NCARSPP
NCARSPP
j- SAM
L Remove Blanks
T NCARSPP
|- SAM
L Remove Blanks
NCARSPP
)- Remove 31anks
L Clip 	
-p Cliptest
L SCARSPP
Libraries: SAM - Screen Access Management
AUTOGRAPH - NCAR Autograph Package
NCARSPP - NCAR System Plot Package
GRAFLIB - GRAFLIB Graphics Library
HERSHY - Hershey Character Plotting Utilities
Geo-EAS Programmer's Guide
3.10-12
April 1990

-------
3.10.8 Subroutine Descriptions
Following is a list of the subroutines that appear in XYGRAPH. The formal
arguments (if any) are described followed by the local variables and finally a
description of what the subroutine does.
PROGRAM XYGRAPH (main module)
The main program performs the following:
Reads in the system defaults
Initializes program variables
Sets up the screen
Calls Get Screen Fid to display the screens and process the
user's requests
Writes to the system default file
SUBROUTINE BNDARY
This routine draws the frame around the graph.
SUBROUTINE BUILD FILE NAME (NAME1, NAHE2, EXTENSION)
Formal Arguments:
NAME1	- Input file name.
NAME2	- File name with the new file extension.
EXTENSION - The new file extension.
This routine builds a new file name with the specified extension.
SUBROUTINE CLIP (XI, Yl, X2, Y2, XMIN, XMAX, YMIN, YMAX)
Formal Arguments:
XI,Yl	- First point on the line.
X2,Y2	- Second point on the line.
XMIN,YMIN - Minimum X and Y coordinates for the clip area.
XMAX,YMAX - Maximum X and Y coordinates for the clip area.
This routine is for clipping lines. It was taken from pages 133-134 of
"COMPUTER GRAPHICS", by Donald Hearn and M. Pauline Baker, (Prentice-Hall,
1986).
LOGICAL FUNCTION CLIPTEST (P,Q,U1,U2)
Formal Arguments:
P,Q	- Coordinates of the line.
U1,U2 - The part of the line that lies within the boundary.
This routine determines whether the line can be rejected or the intersection
parameters are to be adjusted. Taken from pages 133-134 of "COMPUTER
GRAPHICS", by Donald Hearn and M. Pauline Baker, (Prentice-Hall, 1986).
Geo-EAS Programmer's Guide	3.10-13	April 1990

-------
SUBROUTINE DISPLAY FLDS
This routine displays the current screen fields.
SUBROUTINE ERASE MESSAGE (ROW, COL, LEN)
Formal Arguments:
ROW
COL
LEN
-	Row to start erasing.
-	Column to start erasing.
-	Number of characters to erase.
This routine erases messages displayed in the message area of the screen.
SUBROUTINE GET COLOR (NT, CCODE)
Formal Arguments:
NT - Toggle position.
CCODE - Color code.
This routine returns the NCAR OPTN specification of color based on the
selected toggle position.
SUBROUTINE GET CURVE PARAMS (ERROR)
Formal Arguments:
ERROR - Logical variable set to true if an error occurs.
This routine reads the records 5-10, from the parameter file repetitively as
specified by record 4 (Num curves). The curve parameters are checked and
screen fields are set.
SUBROUTINE GET FIELD GROUP
This routine gets the value for a group of screen fields.
SUBROUTINE GET NEW SCREEN (SCREEN NUMBER)
Formal Arguments:
SCREEN NUMBER - Stores the screen number.
This routine sets the current screen to screen number and then displays the
frame and labels for that screen.
SUBROUTINE GET PLOT PARMS (ERROR)
Formal Arguments:
ERROR - Logical variable set to true if an error occurs.
This routine reads the parameter file for the basic plot parameters and sets
appropriate screen field defaults.
Geo-EAS Programmer's Guide	3.10-14	April 1990

-------
SUBROUTINE GET SCREEN FLD
Local Variable:
Main Screen
Edit Screen
Stores the screen number for the main screen.
Stores the screen number for the options
screen.
Stores the screen number for the background
screen.
Stores the name of the main menu.
Stores the name of the options menu.
Stores the name of the background menu.
Stores the user's menu selection.
Logical variable that is set to true if an error occurs.
Logical variable that is set to true when the
user vant to exit the program.
Back Screen
Main Menu
Edit Menu
Back Menu
Menu Choice
Error
Exi t
This routine displays the current screen and accesses the menu option
selected by the user and then either calls Perform Process to process the
screen fields or calls a routine to process the menu option.
SUBROUTINE GET STYPE (NT, SCODE)
Formal Arguments:
NT - Stores the toggle position.
SCODE - Stores the Hershey character code for the symbol.
This routine gets the HERSHEY character code for the selected symbol based on
the toggle position.
SUBROUTINE GET XY DATA
This routine reads in the values for the variables selected and determines the
minimum/maximum values.
SUBROUTINE GRAFINIT
This routine calls Vstats to initialize graphics parameters and sets the
global variable Devcode to the type of graphics device in use.
SUBROUTINE INITIALIZE
This routine initializes global variables to their defaul: values and then
calls Reset Values to set the screen fields.
SUBROUTINE INTRO SCREEN
This routine displays the screen frame/labels/fields for the introductory
screen.
Geo-EAS Programmer's Guide
3.10-15
April 1990

-------
FUNCTION LENCMA (STRING)
Formal Arguments:
STRING - Character sting.
This routine returns the location of the right-most comma in a string. Used
for parsing Autograph arguments.
SUBROUTINE OPEN FILE (NUNIT, NAMFIL, STAT, OPENERR)
Formal Arguments:
NUNIT - File unit number.
NAMFIL - File name.
STAT	- File status.
OPENERR - Logical variable set to true if error occurs.
This routine opens Nunit with Namfil and Stat parameters and returns Openerr =
0, if successful.
SUBROUTINE PERFORM PROCESS
Local Variables:
Field Name - Stores the screen field name.
Fexist	- Logical variable set to true if the file
exists.
Error	- Logical variable set to true if an error
occurs.
Overwrite	- Logical variable set to true if the file can
be overwritten.
Set Screen - Logical variable set to true if the screen
fields are to be set.
This routine identifies which screen field has been selected, performs any
error checking and then processes the screen field.
SUBROUTINE PLOT BLEGEND
This routine plots a legend at the bottom of the graph.
SUBROUTINE PLOT CURVES
This routine issues final setup calls to NCAR to plot the curves (using PWRIT
or AGCURV) depending on the previously determined combination of line and
symbol types specified. Finally one of the routines to plot the legend is
called if one is desired.
SUBROUTINE PLOT RLEGEND
This routine plots a legend at the right of the graph.
Geo-EAS Programmer's Guide
3.10-16
April 1990

-------
SUBROUTINE READ HEADER DATA (ERROR,SET SCREEN)
Formal Arguments:
ERROR	- Logical variable set to true if an error occurs.
SET SCREEN - Logical variable set to true if the screen fields
are to be set.
This routine reads in the header information from the data file and then sets
the screen fields. If an error occurs will reading the file an error message
is displayed.
SUBROUTINE READ PARAM FILE (ERROR)
Formal Arguments:
ERROR	- Logical variable set to true if an error occurs.
Local Variables:
Signature - Character string to identify the parameter file.
This routine processes the input parameter file and sets the screen field. It
calls Get Curve Parms and Get Plot Parms to process the curve and plot
parameters. If an error occurs a message will be displayed in the message
area.
SUBROUTINE READ SYSTEM DEFAULTS
This routine reads the system defaults file 'GEOEAS.DEF' and initializes the
system defaults.
SUBROUTINE REGRESS (XDATA, YDATA)
Formal Arguments:
XDATA = Array of X data values.
YDATA = Array of Y data values.
Local Variables:
N
Xbar, Ybar
Sumx, Sumy
SumXsq,SumYsq
SumXY
Correlation
Slope
Intercept
Number of data values.
Mean of the X and Y data values.
Sum of the X and Y data value.
Sum of the X and Y data values squared.
Sum of the X and Y data values multiplied.
Stores the correlation coefficient.
Slope of the regression line.
Y-intercept of the regression line.
This routine calculates linear regression then plots the regression line and
the regression coefficients on the graph.
SUBROUTINE REMOVE BLANKS (ARG)
Formal Arguments:
ARG - Character string to remove blanks.
Geo-EAS Programmer's Guide
3.10-17
April 1990

-------
This routine checks for blanks in a given argument and shifts to
the left as needed.
SUBROUTINE RESET VALUES
This routine resets the parameters for the graph options menu to their default
values.
SUBROUTINE SET ARG (ARG)
Formal Arguments:
ARG	- Indicates which AUTOGRAPH axis parameter to set.
Local Variable:
Acid - Stores	the argument	name as a character.
Acval - Stores	the argument	value as a character.
Afval - Stores	the argument	value as a real number.
This routines sets the AUTOGRAPH axes parameters that were specified by the
user.
SUBROUTINE SET AXIS ARGS (XY)
Formal Arguments:
XY - Indicates which axis to process.
This routine extracts the screen values and sets parameter file arguments for
X or Y axis.
SUBROUTINE SET COLOR (LCODE, CCODE, NT)
Formal Arguments:
LCODE - Color code from parameter file.
CCODE - Stores the color code.
NT	- Position to set toggle field.
This routine reads the parameter file specification of color (for CALL to NCAR
subroutine OPTN), adjusts for variable lengths, and returns a code for setting
the toggle position.
SUBROUTINE SET GRAPH LIMITS
This routine determines which data points are to be plotted by checking the
graph limit.
SUBROUTINE SET LINSYM PAT
This routine establishes the plot pattern as a function of the user specified
combination of line and/or symbol types.
Geo-EAS Programmer's Guide
3.10-18
April 1990

-------
SUBROUTINE SET PARAKS
This routine sets the AUTOGRAPH parameters for the graph background, axes
parameters, titles, and labels. It calls Set Arg to set the X and Y axes
arguments.
SUBROUTINE SET STYPE (SCODE, NT)
Formal Arguments:
SCODE - Stores the Hershey character code.
NT	- Position to set toggle field
This routine checks	the Parameter File specification for the symbol type
against the HERSHEY	character code and returns a code for setting the toggle
posi tion.
SUBROUTINE SET USER ARG (ARG)
Formal Arguments:
ARG	- Indicates which AUTOGRAPH axis parameter to set.
Local Variable:
Acid - Stores the argument name as a character.
Acval - Stores the argument value as a character.
Afval - Stores the argument value as a real number.
This routines sets the AUTOGRAPH parameters that were specified by the user.
INTEGER** FUNCTION TOGGLE POSITION (FIELD NAME)
Formal Arguments:
FIELD NAME - Stores the toggle field name.
This routine returns the toggle position for the specified toggle field.
SUBROUTINE VIEW (FILE NAME, ERROR, DEVCODE)
Formal Arguments:
FILE NAME	- Name of metacode file to display.
ERROR	- Logical variable set to true if an error
occurs.
DEVCODE	- Type of graphic device in use.
This routine translates NCAR metacode to graphic output on several available
graphics devices. Refer to Section 2 for more information.
SUBROUTINE WRITE PARAM FILE
Local Arguments:
Signature - Character string to identify parameter file.
Geo-EAS Programmer's Guide
3.10-19
April 1990

-------
This routine extracts the screen field values, checks and formats them, and
then writes them to the parameter file.
SUBROUTINE WRITE SYSTEM DEFAULTS
This routine writes the system defaults to the system default file
'GEOEAS.DEF'
SUBROUTINE XAXIS PARMS
This routine extracts values from X-axis parameter arguments and sets the
appropriate screen fields.
SUBROUTINE XYPLOT
This routine opens the metacode file, then calls the routines to determine the
graph limits, set the AUTOGRAPH parameters, create the plot and display the
graph.
SUBROUTINE TAXIS PARMS
This routine extracts values from Y-axis parameter arguments and sets the
appropriate screen fields.
Geo-EAS Programmer's Guide
3.10-20
April 1990

-------
3.11
CONRJEC
3-11.1 Software Function
CONREC produces contour maps of variables vith gridded values in a Geo-EAS
data file. The data must form a complete grid. A grid is a a set of values
with equally spaced X and Y coordinates which form a rectangle. Individual
grid cells may contain missing values. Default parameter values can be
computed for all options, providing instant results. Options allow control of
contour levels, labeling, and smoothing. Options to control axes labeling and
titles are also available. A file called a 'metacode' file is created for
redisplay or producing a hardcopy.
3.11.2 Global Variables/Program Limits
CONREC requires that the input data file contains at least 3 but not more than
48 variables. These should consist of (at minimum) a X and Y coordinate, and
a third variable which will be contoured. The data file may contain up to
10000 samples. These must form a grid with no more than 100 elements in each
direction. If these limits are exceeded the grid cannot be formed and the
data file cannot be used by Conrec.
The following is a listing of the file of global variable declarations used in
CONREC. This information is in a file named CONREC.DEC. It is included in
CONREC source files with the $INCLUDE: compiler metacommand.
(PARAMETER	MAXVAR	= 48)	- maximum variables in data file
(PARAMETER	MAXDATA	= 10000) - maximum records in data file
(PARAMETER	MAXC0NT0UR	= 16)	- maximum contour levels
(PARAMETER	MAXGRID	= 200)	- max grid cells in X, Y direction
Data File
IParm File
OParm File
File Prefix
Varname (MAXVAR)
Xvar, Yvar, Cvar
Nvar, Ndata
NxGrid, NyGrid
XcellSize, YcellSize
Xmin, Xmax, Ymin, Ymax
MinX, MaxX, MinY, Maxy
Xcenter, Ycenter
XticLsize, YticLsize
XticFmt, YticFmt
NmajorX, NmajorY
NMinorX, NMinorX
Missing
DashPattern, DashCutoff
NdashRep
Title (6)
data file name
Input parameter file name
Output parameter file name
prefix for file names (i.e. directory)
variable names for data file
X, Y, Contour variable column indices
Number of variables, records in file
#	of X and Y grid cells
X and Y grid cell sizes
X and Y grid extents
Graph extents
Centers for Graph axes
Axis tic label sizes
Axis tic label formats
#	Major tickmark divisions
#	Minor tickmark divisions
Missing Value
dash pattern and cutoff for dashed lines
number of repetitions of dashpattern
Main title and subtitles
Geo-EAS Programmer's Guide
3.11-1
April 1990

-------
Clabels (MAXCONTOUR)
Clevels (MAXCONTOUR)
Nclevel
MainJust, SubtJust
XaxisType, YaxisType
AxisType
LabelFlag
SkipFactor
FirstContour
ContourMin
ContourMax
Contourlnc
SizeM, SizeL
CharSize (10)
Intro
Zcontour (MAXGRID, MAXGRID)
X (MAXGRID), Y (MAXGRID)
Labels for contour lines
Levels for contour lines
number of contour levels
Justification flags for main,subtitles
Axis type flags
Graph type (used by GRIDAL, NCAR)
contour labeling flag
Contour level skip factor
First contour level to label
Lowest Contour level
Highest Contour Level
Increment betveen Levels
Label sizes for levels and Minmax
Array of character sizes
Flag to suppress Intro Screen
Array of values to contour
Arrays of X and Y values
CHARACTER	Data File*14, MetaFile*14, File Prefix*50
CHARACTER	Iparmfile*14, Oparmfile*14
CHARACTER	Varname*10 (MAXVAR), Units*10 (MAXVAR)
CHARACTER	Header*60, Title*60 (6)
CHARACTER	Clabel*16 (MAXCONTOUR)
CHARACTER	XticFmt*10, YticFmt*10
CHARACTER	DashSeg*12, Dash Pattern*12
COMMON /CHARS/ File Prefix, Data File,
+ Iparmfile, Oparmfile, MetaFile,
+ Varname, Units, Header,
+ Title, Clabel, XticFmt, YticFmt,
+ Dash Pattern, DashSeg
INTEGER**
INTEGER*4
INTEGER*4
INTEGER*4
INTEGER*4
INTEGER*4
INTEGER*4
INTEGER*4
INTEGER*4
LOGICAL
Xvar, Yvar, Cvar, DevCode
NxGrid, NyGrid, Ndata, Nvar
MainJust, SubtJust
XaxisType, YaxisType, AxisType
NdashRep, AnotFlag, XTicLsize, YTicLsize
SkipFactor, FirstContour
Nclevel, Clabopt
NMajorX, NMajorY, NMinorX, NMinorY
SizeM, SizeL, Tsize (6)
Offset, BackGround, Intro
COMMON /INTS/ Xvar, Yvar, Cvar, DevCode,
+	NxGrid, NyGrid, Ndata, Nvar,
+	MainJust, SubtJust, XaxisType, YaxisType,
+	AxisType, NdashRep, AnotFlag,
+	SkipFactor, FirstContour, Nclevel,
+	NMajorX, NMajorY, NMinorX, NMinorY,
+	SizeM, SizeL, Clabopt, XTicLsize,
+	YTicLsize.
+	Tsize, Offset, BackGround, Intro
Geo-EAS Programmer's Guide
3.11-2
April 1990

-------
?. I A L * 4
?.IAL*4
RIAL*4
R£AL*4
RZAL*4
RZAL*4
RZAL*4
JZAL*4
RZAL*4
CCMMON /FLOATS/
Zcontour (MAXGRID, MAXGRID)
X (MAXGRID), Y (MAXGRID)
Cle'/el (Maxcon tour), Solinelension
Xmin, X^iax, Ymin, Ymax
MinX, MaxX, MinY, Maxy
Xcencer, Ycenter
XcellSizs, YcsllSize
DashCutoff, Missing
CharSize (10)
ContourMin, ContourMax, Contourlnc
OldMax, OldMin, Oldlnc
ScaleFactor
Zcontour, X, Y, Clevel,
Xmin, Xmax, Ymin, Ymax,
MinX, MaxX, MinY, Maxy, Xcsnter,
center,
XcellSiza, YcallSize,
DashCutoff, Missing, CharSize,
ContourMin, ContourMax, Contourlnc,
OldMax, OldMin,Oldlnc.
ScaleFactor, SplineTension
Geo-EAS Pr:rrammer's Guide
3.11-3

-------
3.11.3 Data Ploy
The follovir.g figure illustrates the inputs and outputs from CONREC.
Data Flov Diagram
G?o-ZAS
Data file
Pa|'?«tpr
File
Sus lei
D»f »i
Ppalansl?tnr
SiiKrnn t ine)
ReMs

/
File
Geo-EAS Programmer's Guide
3.11-4
April 19

-------
3.11.4 User Interface
The user interface for CONREC is managed using the SAM (Screen Access Manage-
ment) utilities. The screens, menus, and program options are all defined in
the file CONREC.SCR. All screen and menu management is controlled by subrou-
tine GET SCREEN FIELDS. From this subroutine, calls are made to the SAM
subroutines to display and manage screens, menu choices and program option
input. The subroutine PERFORM PROCESS does the screen field error checking,
and displays error messages. All application-specific modules are called
from these two subroutines.
The Screens
CONREC displays three text screens and one graph screen. The first is an
introductory screen which displays information about the program. The
remaining screens are either for input of program parameters, or for
displaying the contour plot. The hierarchy of screens is displayed below.
Each screen in CONREC has a menu at the bottom. Control of these menus is
accomplished in the subroutine GET SCREEN FIELDS. Below is a menu tree
showing the hierarchy of menus, and options. Above each menu is the screen
name and the screen field name for the menu (used in CONREC.SCR). Refer to
the screen definition file CONREC.SCR for specifics.
The Screen, Menu, and Options Hierarchy
(MAINMENU) - Main Screen
Concoc 	[- Prefix
|- Read Parameters (EDITMENU)	- Options Screen
f- Option/Execute 	r Data
| |- Variables	(BG MENU) - Graph Options Screen
[	(- Graph Options 	1- Axes Parameters
| |	\- Tick Parameters
| |	(- Titles/Labels
| |	|- Annotation
| |	L Quit
I	I
|	|	(CP MENU) - Contour Options Screen
|	Contour Options —j- Sew Levels
|	|	(- Edit Levels
|	I	|- Labeling
|	I	|- Dash Pattern
|	I	|- Annotation
I	I	[-Spline
|	|	L Quit
|	f- Execute
| Quit
)- Save Parameters
L Quit
Geo-EAS Programmer's Guide
3.11-5
April 1990

-------
Global Variable/Screen Field Relationships
All input fields on the screens have screen field names by vhich the screen
field contents are accessed. Each of these screen fields is associated with a
global variable. Vhen the screen field values are entered by the user, sub-
routine PERFORM PROCESS transfers the appropriate values to the global vari-
ables, using calls to the SET 	 VALUE subroutines in the SAM utilities.
The screen field labels, the associated screen field names (as defined in the
screen definition file CONREC.SCR) and the related global variable names for
all program inputs are listed below:
SCREEN LABEL	FIELD NAME	GLOBAL VARIABLE
Main Screen
File Prefix
Input Parameter File
Output Parameter File
Data
Data File
Variables
X Variable
Y	Variable
Contour Variable
Execute
Metacode File
Graph Options Screen
Axes Parameters
X Axis
Y	Axis
Tick Parameters
#	Major Ticmark Div.
#	Minor Divisions/Maj.
Tickmark Label Format
Tickmark Label Size
Ti ties/Labels
Main
Subti ties
FILEPREFIX (Char)
IPARFILE (Char)
OPARFILE (Char)
DATAFILE (Char)
XVARIABLE (Toggle)
YVARIABLE (Toggle)
CVARIABLE (Toggle)
METAFILE (Char)
XAXISTYPE (Toggle)
YAXISTYPE (Toggle)
NMAJORXTIC
NMAJORYTIC
NMINORXTIC
NMINORYTIC
XTICFORMAT
YTICFORMAT
XTICSIZE
YTICSIZE
MAINJUST
SUBTJUST
MAINTITLE
SUBTITLE1
SUBTITLE2
(Integer)
(Integer)
(Integer)
(Integer)
(Char)
(Char)
(Toggle)
(Toggle)
(Toggle)
(Toggle)
(Char)
(Char)
(Char)
FILE PREFIX
IPARFILE
OPARFILE
DATA FILE
XV AR
YVAR
CVAR
METAFILE
XAXISTYPE
YAXISTYPE
NMAJORX
NMAJORY
NMINORX
NMINORY
XTICFMT
YTICFMT
XTICLSIZE
YTICLSIZE
MAINJUST
SUBTJUST
TITLE (1)
TITLE (2)
TITLE (3)
Geo-EAS Programmer's Guide
3.11-6
April 1990

-------
SCREEN LABEL
FIELD NAME
GLOBAL VARIABLE
X Axis
Y Axis
SUBTITLE3 (Char)
SUBTITLE4 (Char)
SUBTITLE5 (Char)
TITLE (M
TITLE (5)
TITLE (6)
Size
MAINTSIZE (Toggle)
SUBTSIZE1-5
TSIZE (1-6)
Annotation
BACKFLAG (Toggle)
BACKFLAG
Contour Options Screen
New Levels
Starting Contour Level
Maximum Contour Level
Contour Level Increment
STARTLEVEL (Float)
LASTLEVEL (Float)
INCLEVEL (FLoat)
CONTOURMIN
CONTOURMAX
CONTOURINC
Edit Levels
Contour Level
Contour Label
Labeling
Labeling Option
Label Skip Factor
First Level to Label
Label Size
CLEVEL1-16 (Float)
CLABEL1-16 (Char)
CLABOPT
CLABSKIP
CLABFRST
CLABSIZE
(Toggle)
(Toggle)
(Toggle)
(Toggle)
CLEVEL
CLABEL
(1-16)
(1-16)
CLABOPT
SKIPFACTOR
FIRSTCONTOUR
SIZEL
Dash Pattern
Dash Pattern
Dash Cutoff
#Rep/Label
DASHPAT (Char)
DASHCUTOFF (Float)
NDASHREP (Toggle)
DASHPATTERN
DASHCUTOFF
NDASHREP
Annotation
Annotation Option
Character Size
ANOTFLAG (Toggle)	ANOTFLAG
MINMAXSIZ (Toggle)	SIZEM
Spline
Spline Tension
SPLINETENS (Float)
SPLINETENSION
Geo-EAS Programmer's Guide
3.11-7
April 1990

-------
3.11.5 Processing
Menu Processing
The following pseudocode represents the general sequence of menu processing in
CONREC. Menu processing occurs in GET SCREEN FIELDS. Screen field processing
is controlled through calls to GET FIELD GROUP, which in turn calls PERFORM
PROCESS. All application-specific subroutines are called from GETSCREEN
FIELDS, or PERFORM PROCESS. See the subroutine structure chart for more
information. Processing details will be discussed in the sections for
individual subroutines.
CONREC
Determine graphics hardwara, initialize graphics parameters
Read system defaults
Initialize global variables
Interactive screen input
Write system defaults
Interactive screen input (GET SCREEN FIELDS)
Display Main Screen and menu, get menu choice
(-IF Menu Choice = Quit
|	Return to main program, terminate
f-ELSEIF	= Read Parameters
|	Gee input parameter file name, read the parameters
f-ELSEIF	= Options/Execute
|	Display Options Screen and menu, get menu choice
|	f-IF Menu Choice = Quit
|	|	Jump to mam menu processing loop
|	f-ELSEIF	= Data
|	|	Get Data file name, read header data, store into memory
|	|	Get Variables
|	(-ELSEIF => Variables
|	|	Get X,'/,Contour Variables
|	|	Read Grid
|	[-ELSEIF	= Graph Options
|	|	Display Graph Options screen
|	|	Display Graph Options Menu, get aanu choice
|	| |-IF Menu Choice = Quit
|	| | Jump to Options/Execute menu processing loop
|	| [-ELSEIF	= Axes Parameters
|	| | Select full, half, or grid style for X and Y axes
|	| f-ELSEIF	= Tick Parameters
|	| | Get Tickmark spacing, label format and size
|	| |-ELSEIF	= Titles/Labels
|	| | Get titles, size parameters
|	| f-ELSEIF	= Annotation
|	| | Get annotation flag (suppresses all but contours)
|	| LEHDIF
|	|-ELSEIF	= Contour Options
J	|	Display Contour Options screen
|	|	Display Contour Options ".enu, get menu choir?
Geo-EAS Programmer's Guide
3.11-8
April 1990

-------
| | [-IF Menu Choice = Quit
| | | Jump to Options/Execute menu processing loop
I I |-ELSEIF	= new Levels
I | I Get start level, maximum, and increment
I I I Setup individual levels, labels, fill fields
I I l-ELSEIF	= Edit Levels
I I I Get individual contour level/label values
| | l-ELSEIF	= Labeling
| | | Get contour labeling options
| | (-ELSEIF	= Dash Pattern
| | | Get dash pattern, cutoff level, and repeat factor
| | (-ELSEIF	= Annotation
| | | Get option for plotting min/max
| | |-ELSEIF	= Spline
| | | Get spline tension factor for contour smoothing
| | Lendif
| l-ELSEIF	= Execute
| |	Get Metacode file name
| |	Generate Metacode file
| |	View Metacode File
| LENDIF
| Loop to get Options menu choice
(-ELSEIF	= Save Parameters
| get output parm file name, write parameters to file
LENDIF
Loop to get Main menu choice
Read Grid
Read file, store unique coordinate values
Sort X, Y values
Read file, determine grid position, store
Generate Metacode File (Subroutine GENERATE I
Open Metacode file
Generate graph background (axes, titles, etc.)
Set up scaling for CONREC
CALL NCAR CONREC subroutine to plot contour lines
for X, Y
Z value in grid arrav
Error Processing
The majority of error checking is performed by the subroutine PERFORM PROCESS.
This routine checks that program inputs are correct, and displays error
messages when errors occur. Refer to the source code for specific details.
3.11.6 Outputs
The Metacode File
CONREC produces an NCAR metacode file. This is an unformatted file which
contains encoded plotting instructions. See the NCA?. documentation for a
description of file and plot instruction format. This file is subsequently
Geo-EAS Programmer's Guide
3.11-9
April 1990

-------
read by subroutine VIEW, where the plotting instructions are translated and
plotted at the screen.
The CONREC Parameter File
CONREC can read or vrite a file containing program option values, called a
parameter file. This is an unformatted file. The file is read with READ
PARAMETERS and written with SAVE PARAMETERS. This allows the user to store
options values for later use. See the source code for more detail.
3.11.7 Subroutine Structure
The following diagram, called a "subroutine calling tree", displays the
subroutine structure for CONREC. This should be used as a reference when
tracing program logic. Calls to utilities, which are members of libraries,
are shown with abbreviated library names. Several trivial subroutine calls
have been omitted to conserve space. To locate a given subroutine in the
source code, refer to the file FILES.DOC, which contains all source file
names, the names and arguments of subroutines in each source code file, and
the calls made from each subroutine.
Conmain —j- Graflnit
Vs tats
SAM
SAM
f- Initialize ———
J- Intro Screen 	
|- Read System Defaults — SAM
[¦ Get Screen Fields 	p SAM
(• New Screen	; SAM
|- Get File Name	Display Grid Limits — SAM
|- Build File Name
[¦ Get Field Group — (1)
|" Generate Metafile — (2)
I		 (3)
\- Write System Defaults — SAM
L SAM
Geo-EAS Programmer's Guide
3.11-10
April 1990

-------
— (1) —r Get Field (SAM)
r
Read Parameters ——
r
Read
Header Data
b
Save Parameters
I-
Read
Grid
1

h
Load
Parameters —
1

L
SAM

1
Read Header Data —

SAM

b
Read Grid 	
T
MPos

1

h
Rank

1

L
SAM

b
Reset Levels

SAM

b
Set Up Levels 	
1
SetFmt
1

h
Display Levels 	
1

L
SAM

b
AutoCalc ——
T
Clgen

Build File Name

I
¦ SetFmt
b
Blank File
L
SAM

b
.Display Grid Limits
-
SAM

L
SAM



— (2) —p SAM
J- Get AxisType
(¦ Sat ( NCARSPP )
[• LabMod (NCARSPP)
f- Gridal (NCARSPP)
b Pwrit (NCARSPP)
L Conrec 	r Reset
f- DashD (NCARDASH)
(- Option (NCARSPP)
f- StLine 	 DrLine —f LastD (NCARDASH)
)- WriteB (NCARSPP)	|- FirstD (NCARDASH)
I- MinMax	L VectD (NCARDASH)
T HERSHY




J- Mclnit —
T
GRAFLIB


b SAM
L
HERSHY


|- Getl6 	

Finish —

GrWait
J- Four 	
—r
Getl6


1
L
Plot 	
r
GRAFLIB
y Two	

Plot
L
HERSHY
L Multi 	
1
PlotCh —
—r
GRAFLIB

b
Finish
L
HERSHY

b
McOption
r
Getl6

I

b
Dash 	 Gatl6

1

b
HERSHY

L
Getl6
L
Color 	 GRAFLIB
Libraries: SAM	- Screen Access Management
NCARSPP	- NCAR System Plot Package
NCARDASH	- NCAR Dashed Line Routines
GRAFLIB	- GRAFLIB Graphics Library
HERSHY	- Hershey Character Plotting Utilities
Geo-EAS Programmer's Guide
3.11-11
April 1990

-------
3.11.8
Subroutine Descriptions
The following section contains descriptions for the individual subroutines for
CONREC. The Subroutine Calling Tree should be used for reference to trace
subprogram calls. To locate the source code for an individual subroutine,
refer to the file FILES.DOC in the source code directory or listings. The
subroutines are listed in increasing alphabetic order. A general description
is included for each subroutine which describes the software function, the
formal arguments (if any), and the subroutine calls made (if any).
PROGRAM CONREC
This is the main module for program CONREC. It accesses the System Defaults
File, initializes variables and calls the main menu processing routine GET
SCREEN FIELDS.
Subroutines Called:
Graflni t
Initialize
Read System Defaults
Intro Screen
Get Screen Fields
Write System Defaults
SAM - Setmod, Clear Screen
SUBROUTINE Autocalc
Formal Arguments: None
Subroutines Called:
SetFmt
Clgen
SAM - Set Integer Value, Set Character Value, Set 4 Floating
PutStr, LeftJustify, Erase
This subroutine computes default values for several CONREC parameters, such as
the number and format of ticmark labels for the axes, the number and values
for contour levels, and default titles and labels for the graph.
SUBROUTINE Clgen (Z, Mx, Nxf Ny, Clo, Chi, Cine,
+	Nla, Nlm, Cl, Ncl, Icnst)
Geo-EAS Programmer's Guide
3.11-12
April 1990

-------
Formal Arguments:
z
- array of grid values
Mx
- X dimension o£ Z
Nx
- number of X elements in Z
Ny
- number of Y elements in Z
Clo
- starting contour level
Chi
- maximum contour level
Cine
- increment for contour levels
Nla
- number of levels
Nlm
- maximum number of levels
CI
- array of contour levels
Ncl
- number of levels in array
Icnst
- flag to indicate if a constant field was found
Subroutines Called: None
This subroutine generates default contour levels. It is an NCAR routine which
previously vas called from CONREC. It was isolated and changed to be called
from ReadData, so that default levels could be changed interactively.
SUBROUTINE Conrec (Z, L, M, N, Flo, Fhi, Fine, Nset, Nhi,
+	Dashpat, Clabel, CI, Ncl, Cutoff, Iskip, Ifirst
+	Clabopt, Clabsiz, SizMinHax, Ndashrep, Tension)
Formal Arguments:
Z
L, M, N
Flo, Fhi, Fine
Nset, Nhi
Clabel, CI, Ncl
Cutoff
Iskip, Ifirst
Clabopt
Clabsiz
SizMinMax
Ndashrep
Tension
Array of Grid Values
Maximum Dimension of Z, # of X and Y elements
Start level, Maximum, level increment
flags to indicate scaling and minmax option
Contour labels, levels, # levels
dash pattern cutoff level
contour skip factor, # to label first
contour labeling option
contour label size
character size for MinMax markers
dash pattern repetition factor
spline tension factor
Subroutines Called:
StLine
MinMax
NCARSPP - Reset, Set, Perim, Option, VriteB
NCARDASH - DashD
This subroutine is a modified version of the NCAR CONREC subroutine. It calls
the NCAR system plot package and dashed line routines to generate the contour
levels. It was modified to allow contour labels to be passed along with
contour levels, and to implement a dash cutoff level.
Geo-EAS Programmer's Guide
3.11-13
April 1990

-------
SUBROUTINE Display Grid Limits (Screen)
Formal Arguments:
Screen	- index of screen in which to display grid limits
Subroutines Called:
SAM - PutStr
This subroutine displays the grid limits computed by subroutine Read Grid. It
is called by Nev Screen, whenever a new screen is generated.
SUBROUTINE Display Levels
Formal Arguments: None
Subroutines Called:
SAM - Display One Field, PutStr
This subroutine displays the contour levels and labels in their respective
locations on the contour options screen.
SUBROUTINE Drline (X, L, Mm, Nn)
Formal Arguments: See NCAR CONREC source code
Subroutines Called:
NCARDASH - FirstD, LastD, VectD
This subroutine follows a contour line through the grid of values. It is an
NCAR CONREC subroutine. Refer to the source code for more information.
SUBROUTINE Generate Metafile (File Name, Error)
Formal Arguments:
File Name - Metacode file name
Subroutines Called:
Get AxisType
Conrec
NCARSPP - Set, Labmod, Gridal, Pvrit
SAM - LeftJustify, Putstr, Erase, Flash
This subroutine generates the graphic metafile, using calls to NCAR. The
graph background is generated with calls to LabMod, Gridal, and Pwrit. The
contour lines are generated with a call to Conrec.
SUBROUTINE Get Axis Type (XaxisType, YaxisType, AxisType)
Formal Arguments:
Xaxistype - flag	to indicate type for X axis
Yaxistype - flag	to indicate type for Y axis
Axis type	- NCAR	flag for X and Y axes
Geo-EAS Programmer's Guide
3.11-14
April 1990

-------
Subroutines Called: None
This subroutine converts the tvo axis type codes to a single code to be used
by NCAR. The NCAR codes are documented under subroutine Gridal.
SUBROUTINE Get Field Group
Subroutines Called:
Get Field
Perform Process
New Screen
This subroutine is called by GET SCREEN FIELDS to get all field values for a
screen field group. For each field in the group, a GETFIELD call is used to
allow the user to enter the appropriate value or choice, then PERFORM PROCESS
is called to perform error checking and transfer the screen field contents to
global variables.
SUBROUTINE Get Screen Fields
Subroutines Called:
Get Field Group
New Screen
Generate Metafile
View
SAM - Get 	 Value, Left Justify, Build File Name
Erase, Put Menu, Get Menu Choice, Flash, Beep
This subroutine does most of the work for CONREC. It performs the menu
processing, controls display of the options and results screens, and the
graphics screens. The basic processing is outlined in pseudocode in the
previous section on processing, so it will not be repeated here. The SAM
routines are used to perform menu handling and screen display. The routine
GET FIELD GROUP is called, which calls PERFORM PROCESS to handle error
checking and transfer of screen field contents to global variable values.
SUBROUTINE GrafInit
Subroutines Called:
VSTATS
VIDEO
This subroutine is used to determine the device type, and to set the values of
the global graphics variables. The C function VSTATS is used to determine the
device type and several other parameters through the assembler routine VIDEO.
The device extents, the aspect ratio, and device type code (DEVCODE) are then
set depending upon which (if any) graphics card is identified. The following
are the possible values for DEVCODE:
Geo-EAS Programmer's Guide
3.11-15
April 1990

-------
0	- OTHER - no supported graphics device found
1	- HERC - Hercules graphics card found
2	- CGA - Color Graphics Adaptor found
3	- EGA - Enhanced Graphics Adaptor
If DEVCODE is returned as 0 (OTHER), the global logical GRAPHICS is set to
.FALSE, and no graphics screens will be generated by the graphics
subroutines.
SUBROUTINE Initialize
Subroutines Called:
SAM - Set 	 Value, Get 	 Value
This subroutine initializes the global variable values.
SUBROUTINE Intro Screen
Subroutines Called:
SAM - Set Screen, Display Frame, Display Labels, Locate Cursor
Flash, Erase
This subroutine displays the introductory screen and waits for a keystroke
before returning. It is called from the main program module and uses SAM
routines to display the screen.
SUBROUTINE Load Parameters
Formal Arguments: None
Subroutines Called:
SAM - Set 	 Value, Left Justify
This subroutine sets the values of the screen fields based upon the values of
the global variables.
SUBROUTINE MinMax (Z, L, Mm, Nn, Ssizem, Aash, JoffDt)
Formal Arguments:
Z, L, Mm, Nn -	Grid Array, Max dimension, Nx, Ny
SsizeM	-	Character size for H, L symbols
Aash	-	Variable with info on label scaling
JoffDt	-	Flag to control normalization of label numbers
Subroutines Called:
NCARSPP - Encode, Pwrit
This subroutine finds and labels local minima and maxima in the grid of
values. The minima are marked with an 'L', the maxima with an 'H'. SizeM
determines the size of these labels.
Geo-EAS Programmer's Guide
3.11-16
April 1990

-------
SUBROUTINE Neatax (Min, Max, Tine, Ntic)
Formal Arguments:
Min	-	The minimum value for the axis
Max	- the maximum value for the axis
Tine	- the tickmark interval
Ntic	- the number of tickmarks
Function Calls: Tic
This routine determines "neat" axis scaling parameters. On entry the REAL
variables MIN and MAX should contain the actual minimum and maximum values of
the data to be displayed. These values are changed by NEATAX, so temporaries
should be passed. Because of this, it is extremely IMPORTANT not to pass a
constant value to this routine. The variables TINC and NTIC are computed as
the tickmark spacing and number of tickmarks for the axis. The changed values
of MIN and MAX should be used for the axis minimum and maximum. The function
TIC is called to determine the "neat" scaling parameters.
SUBROUTINE New Screen (Screen Number)
Formal Arguments:
Screen Number - the number of the screen to display
Subroutines Called:
Display Grid Limits
SAM - Clear Screen, Set Screen, Display Frame, Display Labels
Vrite Field, Erase
This subroutine displays the specified screen, frame and fields.
SUBROUTINE Perforin Process (Field Name, Error, Repaint)
Formal Arguments:
Field Name - Name of current screen field
Error	- error flag
Repaint	- flag to regenerate current screen
Subroutines Called:
Get File Name
Read Parameters
Save Parameters
Read Header Data
Read Grid
Display Grid Limits
AutoCalc
Reset Levels
Set Up Levels
SAM - Get 	 Value, Set 	 Value, Blank File
Display One Field, Erase, Left Justify, PutStr, Flash
Get File Name, Build File Name
Geo-EAS Programmer's Guide
3.11-17
April 1990

-------
This subroutine performs the error checking for CONREC. It is called by
subroutine GET FIELD GROUP, which is in turn called from GET SCREEN FIELDS.
The Screen field name is used to determine the proper action to take. An
IF..ELSEIF block is used to determine which screen field has just been
processed. Error handling logic is included to perform bounds checking on
real and integer variables, and to check the validity of file names. This is
where the screen field contents are transferred to global variables, (if no
error occurs). This is accomplished through calls to Get 	 Value in the
SAM utilities. For screen fields such as file names, the routines are called
to read the input data, through READ HEADER DATA and READ DATA. See the
subroutine calling tree or the source code for more information.
SUBROUTINE Rank (A, N)
Formal Arguments:
A	- array of values to rank
N	- number of values in A
This subroutine ranks the first N elements of A into ascending order.
SUBROUTINE Read Grid (Error)
Formal Arguments:
Error	- error flag
Subroutines Called:
Rank
SAM - PutStr, Erase
This subroutine reads the data file and loads the coordinate and variables
values into memory. Error checking is performed to ensure that a regular grid
is found.
SUBROUTINE Read Header Data (Error)
Formal Arguments:
Error	- error flag
Subroutines Called:
Get File Name
SAM - Load Toggle Values, PutStr, Flash, Display One Field
This subroutine reads the header data into memory from the data file. If an
error occurs during file access the variable ERROR is set to .TRUE. The
variable names and units are read into memory. The variable names are stored
into toggle fields on the screen. The SAM routines are used to display
pertinent information on the screen, or to display error messages if any
errors occur.
Geo-EAS Programmer's Guide
3.11-13
April 1990

-------
SUBROUTINE Read Parameters (File Name, Error)
Formal Arguments:
FILE NAME - the name of the file to be accessed
ERROR - set to .TRUE, when a read or open error occurs
Subroutines Called:
Read Header Data
Read Grid
SAM - Flash
This subroutine reads the values in a CONREC parameter file into their
respective global variables. It then reads the header data, and the grid
data.
SUBROUTINE Read System Defaults
Subroutines Called:
Get File Name
Read Header Data
Read Grid
Load Parameters
SAM - Display One Field, Set Character Value
Flash, Erase Field
This subroutine is called from the main program module. It accesses the
system defaults file (GEOEAS.DEF) and retrieves the File Prefix and Data File
name. If the file does not exist, no values are given to these variables.
The SAM utilities are used to store the file prefix into a screen field.
SUBROUTINE Reset Levels
Formal Arguments: None
Subroutines Called:
SAM - Set Character Value, Erase, Erase Field
This subroutine sets all contour levels to 0 and contour labels to blanks.
SUBROUTINE Save Parameters (Error)
Formal Arguments:
Error	- error flag
Subroutines Called:
SAM - Set Character Value, Left Justify
This subroutine stores the current set of option values in a CONREC parameter
file.
Geo-EAS Programmer's Guide
3.11-19
April 1990

-------
SUBROUTINE Set Up Levels
Formal Arguments: None
Subroutines Called:
SetFmt
Display Levels
SAM - Set Character Value, Set 4 Floating Point Value
This subroutine stores the contour levels and labels into screen fields using
calls to Set 	 Value.
SUBROUTINE Setfmt (Max, Fmt, Width)
Formal Arguments:
MAX - the value to use for determining the format
FMT - the character FORTRAN format specifier for the value
WIDTH - the maximum number of characters in FMT
This subroutine is called from AXES to determine the format to use for plot-
ting numeric tickmark labels on the X and Y axes. The algorithm works as
follows. The variable WIDTH is used as the format width. The fractional part
of MAX is extracted and multiplied by ten until it becomes a whole number.
The number of times this happens is counted, and this value is used as the
number of digits to the right of the decimal place.
SUBROUTINE Stline (Z, LI, Mm, Nn, Conv)
Formal Arguments: See NCAR CONREC source code
Subroutines Called:
NCARDASH - DrLine
This CONREC subroutine determines the starting point for a contour level and
move the "pen" to that location. Drline is called to follow the contour line.
SUBROUTINE View (File Name, Error, DevCode)
Formal Arguments:
File Name - Name of Metacode file
Error	- Error flag
DevCode	- Graphics device code
0	- OTHER	- no supported graphics device found
1	- HERC	- Hercules graphics card found
2	- CGA	- Color Graphics Adaptor found
3	- EGA	- Enhanced Graphics Adaptor
This is the main	subroutine for the metacode translator software. The
metacode file is	read. The instructions are de-coded and appropriate calls to
GRAFLIB are made	to generate the graph on the screen. Refer to Section 2 for
more information	about VIEW.
Geo-EAS Programmer's Guide
3.11-20
April 1990

-------
SUBROUTINE Write System Defaults
This subroutine writes the current values of FILE PREFIX and DATA FILE to the
system defaults file. If this file is not found, it is created and the values
are saved.
Geo-EAS Programmer's Guide
3.11-21
April 1990

-------
3.12	VIEW
3.12.1 Softvare Function
Visv displays on the screen the graphs contained in r.etacode files. The
graphs can be displayed on a EGA, CGA, or Hercules graphics system. Color
graphs are vieved on EGA systems. CGA and Hercules systems vill display in
monochrome only.
3-12.2 Global Variables/Program Limits
The follovir.g is a description of the global variables used in VIEW. The
format is extracted from the declaration file VIEW.CMN.
C /FILES/	-	Common block for file names.
C
C File Prefix	-	File prefix for file names.
C Metacode File	-	Metacode file name.
C Data File	-	Data file name for system defaults file.
C File Name	- File name including the file prefix.
COMMON /FILES/ Metacode File, File Prefix, File Name,
+	Data File
CHARACTER*1^ Metacode File, Data File
CHARACTER*50 File Prefix
CHARACTER*65 File Name
Q ***	A'*******'**'*'***** -x-k-xirir-x-x-x-x ir ¦**~*•¦***¦» ttit********
C /SCRSEL/	- Common block for screen parameters.
C
C True Scale	- Logical variable set to true if t.-.a graph is
C to be plotted in true scale.
C DevCode	- The type of graphics device.
COMMON /SCRSEL/ DevCode, True Scale
INTEGER*2 DevCode
LOGICAL True Scale
Geo-EAS Programmer's Guide
3.12-1
April 199C

-------
3-12.3 Data Flov and Processing
Data Flov Diagram
U
N
A
L
File Inputs
VIEV requires a inetacode £ila for ir.put. Vi£w also reads the System Default;
File, if on; exists, for the file prefix and the vai- = of the global variable
INTRO.
Geo-EAS P.~zrammer's Guide
3.12-2
April 19 9C

-------
3-12.4 User Interface
The Screens
VIEW displays two screens, an Introductory screen, and a Main screen. In the
file VIEW.SCR the Introductory screen is defined as Screen 1 and the Main
screen as Screen 2. The Introductory screen displays a brief introduction and
no menu options. The Main screen and menu has the options to allow specific-
ation of the metacode file name and the type of plotting area. The menu that
appears on the Main screen is presented below along with the menu name and the
related screen field name (in parentheses) that is used in the VIEW.SCR file.
The Main Menu (MAINMENU)
Prefix File Scale Execute Quit
The Menu Hierarchy
(MAINMENU)
V.iew —|- Prefix
-	File
-	Scale
-	Execute
L Quit
Global Variable/Screen Field Relationships
All the fields on the screen have associated screen field names in the screen
definition file VIEW.SCR. These fields have their contents assigned to a
global variable. The screen fields (described by the screen label), their
associated field names (used in VIEW.SCR; the field type is enclosed in
parentheses), and the related global variable names are listed below.
SCREEN	FIELD NAME
LABEL	(VIEW.SCR)	GLOBAL VARIABLE
File Prefix	FILE PREFIX (char)	FILE PREFIX
Metacode Filename	METACODE (char)	METACODE FILE
Scale	SCALE (toggle)	TRUE SCALE
3.12.5 Processing
The following pseudocode represents the general flow of processing in VIEW.
Processing is structured along the lines of the menu hierarchy and the
subroutine calling tree. The 'Interactive Screen Input' process is performed
by the subroutines GET SCREEN FLD and PERFORM PROCESS.
VIEW
Initialize Graphics
Read System Defaults
Interactive Screen Input
Write System Defaults
Geo-EAS Programmer's Guide
3.12-3
April 1990

-------
Interactive Screen Input
IF Menu Choice = Quit THEN Return
ELSE IF Menu Choice = Execute THEN
Translate metacode, display graph on screen
ELSE
Get field values
ENDIF
3.12.6	The Outputs
Output Files
VIEW stores the file prefix name and the value of the global variable INTRO
into the System Defaults File. If the file does not exist, View creates one.
Output Screens
View displays a graph on the screen when the Execute option is selected.
Refer to the User Guide for an example graph screen.
3.12.7	Subroutine Structure
The following is the subroutine calling tree for VIEW.
View 	1- Grafinit 	 Vstats
f- Read System Defaults 	 SAM
(¦ Intro Screen 	 SAM
|- Get Screen Fid 	p Get New Screen 	 SAM
[- Display Fids 	 SAM
|- Perform Process —[- SAM
|	L Toggle Position 	 SAM
L Main View (same as subroutine VIEW
see section 2.0 for more information)
L Write System Defaults
Libraries: SAM	- Screen Access Management
GRAFLIB - GRAFLIB Graphics Library
HERSHY - Hershey Character Plotting Utilities
3.12.8 Subroutine Descriptions
Following is a list of the subroutines that appear in VIEW. The formal
arguments (if any) are described followed by the local variables and finally a
description of what the subroutine does.
Geo-EAS Programmer's Guide
3.12-4
April 1990

-------
PROGRAM VIEW (main module)
The main program performs the following:
Reads in the system defaults
Sets up the screen
Calls Get Screen Fid to display the screens and process the
user's requests
Writes to the system default file
SUBROUTINE DISPLAY FLDS
This routine displays the current screen fields.
SUBROUTINE GET NEW SCREEN (SCREEN NUMBER)
Formal Arguments:
SCREEN NUMBER - Stores the screen number.
This routine sets the current screen to screen number and then displays the
frame and labels for that screen.
SUBROUTINE GET SCREEN FLD
Local Variable:
Main Screen
Main Menu
Menu Choice
Error
Exit
-	Stores the screen number for the main screen.
-	Stores the name of the main menu.
-	Stores the user's menu selection.
-	Logical variable that is set to true if an
error occurs.
-	Logical variable that is set to true when the
user wants to exit the program.
This routine displays the screen, accesses the menu option selected by the
user and then calls Perform Process to process the screen fields or calls a
routine to process the menu option.
SUBROUTINE GRAFINIT
This routine calls Vstats to initialize graphics parameters and sets the
global variable Devcode to the type of graphics device in use.
SUBROUTINE INTRO SCREEN
This routine displays the screen frame/labels/fields for the introductory
screen.
Geo-EAS Programmer's Guide
3.12-5
April 1990

-------
SUBROUTINE MAINVIEV (FILE NAME, ERROR, DEVCODE, TRUE SCALE)
Formal Arguments:
FILE NAME	- Name of metacode file to display.
ERROR	- Logical variable set to true if an error
occurs.
DEVCODE	- Type of graphic device in use.
TRUE SCALE - Indicates whether the graph is displayed in
true scale.
This routine translates NCAR metacode to graphic output on several available
graphics devices. It is identical to the subroutine VIEW, documented in
Section 2. The programs XYGRAPH, CONREC, POSTPLOT, and VIEW all use this
version of subroutine VIEV.
SUBROUTINE PERFORM PROCESS
Local Variables:
Field Name - Stores the screen field name.
Fexist	- Logical variable set to true if the file
exis ts.
Error	- Logical variable set to true if an error
occurs.
This routine identifies which screen field has been selected, performs any
error checking and then processes the screen field.
SUBROUTINE READ SYSTEM DEFAULTS
This routine reads the system defaults file 'GEOEAS.DEF' and initializes the
screen fields for the file prefix.
INTEGER** FUNCTION TOGGLE POSITION (FIELD NAME)
Formal Arguments:
FIELD NAME - Stores the toggle field name.
This routine returns the toggle position for the specified toggle field.
SUBROUTINE WRITE SYSTEM DEFAULTS
This routine writes the file prefix to the system default file 'GEOEAS.DEF'.
Geo-EAS Programmer's Guide
3.12-6
April 1990

-------
3.13	HPPLOT
3.13.1	Softvare Function
Kpplot translates the device independent plotting instructions in metacode
files into a file of HPGL plotting commands. The output file can be routed
a HP plotter by setting up the serial port (C0M1) by running the batch file
HPSETUP.BAT and then using the DOS PRINT command to sand the file to the
plotter. The HP plotters supported are: HP 7470 - 2 pen plotter
HP 7475 - 6 pen plotter
HP 7450 - 8 pen plotter
If the HP 7470 is used for plotting the graph will be plotted in two pen
colors, the program does not prompt for pen changes.
3.13.2	Global Variables/Program Limits
The following is a description of the global variables used in HPPLOT. The
format is extracted from the declaration file HPPLOT.CMN.
C Description for common blocks
CHARACTER* 60 Text
£:r*:r*'X7r'r*'Txx-r**',**x,jr,?rx,5«r,rr******************************T''**********
C	/FILES/	- Common block for file names.
C
C	File Prefix	- File prefix for file names.
C	Data File	- Data file name for system defaults file.
C Metacode File	- Metacode file name.
C	HP File	- Name of the plotter file.
C Input File	- Metacode file name with the file prefix added.
C Output File	- HP file name with the file prefix added.
COMMON /FILES/ Metacode File, HP File, File Prefix,
+	Input File, Output File, Data File
CHARACTER*14 Metacode File, HP File, Data File
CHARACTER*50 File Prefix
CHARACTER*65 Input File, Output File
C* ********** ******T****************?r**************7r?TT-T?r *********
C /SCRSEL/	- Common block for screen parameters.
C
C Intro	- Logical variable set to true if introductory
C	screen is to be displayed.
C True Scale	- Logical variable set to true if the graph is
C	to be plotted in true scale.
COMMON /SCRSEL/ Intro, True Scale
LOGICAL Intro, True Scale
Geo-EAS Programmer's Guide
3.13-1
April 19

-------
3.13.3 Data Flov and Processing
Data Flov Diagram
File Inputs
HP PLOT trecu i res a metacode file for input. Hpplot s.30 reads the Systen
Defaults "lie, if one exists, for the file prefix ar.z the value of the global
variable liiTRO.
Geo-EAS?rogramr,er's Guide	3.13-2	April 11 r .

-------
3.13.4 User Interface
The Screens
HPPLOT displays two screens, an Introductory screen, and a Main screen. In
the file HPPLOT.SCR the Introductory screen is defined as Screen 1 and the
Main screen as Screen 2. The introductory screen displays a brief introduc-
tion and no menu options. The Main screen has the option to allow specifi-
cation of the metacode and output file names, and the plotting area. The menu
that appears on the screen is presented below along with the menu name and the
related screen field name (in parentheses) that is used in the HPPLOT.SCR
file.
The Main menu (MAINMENU)
Prefix File Scale Execute Quit
The Menu Hierarchy
HPPLOT
(MAINMENU)
-	Prefix
-	File
Scale
-	Execute
-	Quit
Global Variable/Screen Field Relationships
All the fields on the screens have associated screen field names in the screen
definition file HPPLOT.SCR. These fields have their contents assigned to a
global variable. The screen fields (described by the screen label), their
associated field names (used in HPPLOT.SCR; the field type is enclosed in
parentheses), and the related global variable names are listed below.
SCREEN
LABEL
FIELD NAME
(HPPLOT.SCR)
GLOBAL VARIABLE
File Prefix
Input Filename
Output Filename
Scale
FILE PREFIX (char)
METACODE (char)
HP FILE (char)
SCALE	(toggle)
FILE PREFIX
METACODE FILE
HP FILE
TRUE SCALE
Geo-EAS Programmer's Guide
3.13-3
April 1990

-------
3.13.5 Processing
The following pseudocode represents the general flow of processing in HPPLOT.
Processing is structured along the lines of the menu hierarchy and the subrou-
tine calling tree. The 'Interactive Screen Input' process is performed by the
subroutines GET SCREEN FLD and PERFORM PROCESS.
HPPLOT
Read System Defaults
Interactive Screen Input
Write System Defaults
Interactive Screen Input
IF Menu Choice = Quit THEN Return
ELSE IF Menu Choice = Execute THEN
Create output file
ELSE
Get field values
ENDIF
3.13.6	The Outputs
Output Files
HPPLOT generates a file of HPGL plotter instructions. This file is saved in
the user's specified directory for future plotting. HPPLOT also stores the
file prefix name and the value of the global variable INTRO into the System
Defaults File. If the file does not exist, HPPLOT creates one.
3.13.7	Subroutine Structure
The following is the subroutine calling tree for HPPLOT.
Hpplot	p Road System Defaults
|- Intro Screen —
|- Get Screen Fid ——
L Write System Defaults
SAM
SAM
SAM
[• Get New Screen -
|- Display Fids 	
L Perform Process
SAM
SAM
SAM
|- Build rile Name
(• Toggle Position — SAM
L MHpplo. 	 (1)
Geo-EAS Programmer's Guide
3.13-4
April 1990

-------
(1) - MHpploC
-p HEP.SHY
I- lb 1 -s
(- Open.-nc
Frame
Getl6
• Four
¦ Tvo
L Multi
Iwo rd2
L Finish
L HPLIB
-p HPLIB
|- SAM
[• Grwait 	 SAM
L Init 	p HERSHY
L HPLIB
-p Iword2
L Finish
-p Ibits
|- Getl6
L Plot
Ibits
L Plot
-p Ibits
|- Plotch
| Getlfi -
I
I
|- Finish
I
L Option
-p SAM
!- HPLIB
-p Iword2
•- Finish
-p HPLIB
L HERSHY
HPLIB
L HERSHY
-p HPLIB
|- HERSHY
|- Ibits
I- Getl6 -
Iword2
L Finish
SAM
L HPLIB
T HERSHY
|- Ibits
|- Color
}- Dash -
SAM
L HPLIB
-p Iword2
*- Finish
-p SAM
L HPLIB
SAM
!- HPLIB
HPLIB
Getl6
— Iword2
L Finish
-p SAM
L HPLIB
I- Gatl6
-p Iword2
L Finish
— SAM
L HPLIB
Geo-EAS Programmer's Guide
3.13-5
April 1990

-------
Libraries: SAM - Screen Access Management
HERSHY - Hershey Character Plotting Utilities
HPLIB - HPGL plotter library
3.13.8 Subroutine Descriptions
Following is a list of the subroutines that appear in HPPLOT. The formal
arguments (if any) are described foil-owed by the local variables and finally a
description of what the subroutine does.
PROGRAM HPPLOT (main module)
The main program performs the following:
Reads in the system defaults
Sets up the screen
Calls Get Screen Fid to display the screens and process the
user's requests
Writes to the system default file
SUBROUTINE BUILD FILE NAME (NAME1, NAME2, EXTENSION)
Formal Arguments:
NAME1	- Input file name.
NAME2	- File name with the new file extension.
EXTENSION - The new file extension.
This routine builds a new file name with the specified extension.
SUBROUTINE COLOR (LETTER)
Formal Arguments:
LETTER	- Color to set.
Local Variables:
COLORS	- Character string of the colors available.
ICOLOR	- Array of integers representing the colors.
This routine identifies the color to set and then calls Zcolor to change pen
colors.
SUBROUTINE DASH
This routine converts a NCAR binary dash pattern into a PLOT 10 decimal dash
pattern.
SUBROUTINE DISPLAY FLDS
This routine displays the current screen fields.
Geo-EAS Programmer's Guide
3.13-6
April 1990

-------
SUBROUTINE FINISH (ISTAT)
Formal Arguments:
ISTAT	- Indicates status.
This routine terminates plotting. A message is issued if the metacode file
was not properly formatted or not properly closed.
SUBROUTINE FOUR (IWORD)
Formal Arguments:
IVORD	- Metacode instruction to process.
This routine processes a four-byte (absolute position) metacode instruction
getting the X and Y coordinates and the pen control values, then moving or
drawing to the specified position.
SUBROUTINE FRAME (OUTPUT FILE, TRUE SCALE)
Formal Arguments:
OUTPUT FILE - Name of the HPGL file.
TRUE SCALE - Indicates whether the graph is in true scale.
This routine advances to the next metacode frame.
SUBROUTINE GET16 (IVORD)
Formal Arguments:
IWORD	- Metacode instruction to process.
This routine gets the next 16 bits of metacode instructions to process.
SUBROUTINE GET NEV SCREEN (SCREEN NUMBER)
Formal Arguments:
SCREEN NUMBER - Stores the screen number.
This routine sets the current screen to screen number and then displays the
frame and labels for that screen.
SUBROUTINE GET SCREEN FLD
Local Variable:
Main Screen
Main Menu
Menu Choice
Exi t
Stores the screen number for the main screen.
Stores the name of the main menu.
Stores the user's menu selection.
Logical variable that is set to true when the
user wants to exit the program.
This routine displays the screen, accesses the menu option selected by the
user and then calls Perform Process to process the screen fields or calls a
routine to process the menu option.
Geo-EAS Programmer's Guide
3.13-7
April

-------
SUBROUTINE GRVAIT
This routine waits for a keypress after a frame has been plotted.
FUNCTION IBITS (IWORD, ISTART, NBITS)
Formal Arguments:
IWORD	- Metacode instruction.
ISTART	- Position to start.
NBITS	- Number of bits.
This routine extracts from IWORD the bits from ISTART, to ISTART+NBITS-1.
SUBROUTINE INIT (TRUE SCALE)
Formal Arguments:
TRUE SCALE - Indicates whether the graph is in true scale.
This routine initializes the plotting routines.
SUBROUTINE INTRO SCREEN
This routine displays the screen frame/labels/fields for the introductory
screen.
INTEGER*2 FUNCTION IVORD2 (IBITE1, IBTTE2)
Formal Arguments:
IBYTE1,IBYTE2 - Metacode instructions.
This routine combines two bytes (IBYTE1,IBYTE2) into an INTEGER*2 word (IBYTE2
will be in bits 0-7).
SUBROUTINE MHPPLOT (INPUT FILE, STAT, OUTPUT FILE, TRUE SCALE)
Formal Arguments:
INPUT FILE - Name of the metacode file.
STAT	- Indicates the status of the input file.
OUTPUT FILE - Name of the HPGL file to be created.
TRUE SCALE - Indicates whether or not the graph is in true
scale.
This program translates NCAR metacode to graphic output on one of the HP
family plotters.
SUBROUTINE MULTI (IWORD)
Formal Arguments:
IWORD	- Metacode instruction to process.
This routine processes a multi-byte (control function)
metacode instruction.
Geo-EAS Programmer's Guide	3.13-8	April 1990

-------
SUBROUTINE OPENMC (FILE NAME, STAT)
Formal Arguments:
FILE NAME - Name of the metacode file.
STAT	- Status of the metacode file.
Opens and checks the status of the metacode file.
SUBROUTINE OPTION
This routine processes a "set option" metacode instruction.
SUBROUTINE PERFORM PROCESS
Local Variables:
Field Name - Stores the screen field name.
Fexist	- Logical variable set to true if the file
exists.
This routine identifies vhich screen field has been selected, performs any
error checking and then processes the screen field.
SUBROUTINE PLOT (MX,MY,IPEN)
Formal Arguments:
MX, MY	- Coordinates of the position.
IPEN	- Line pattern.
This routine processes an "absolute position" metacode instruction.
SUBROUTINE PLOTCH (NCHAR)
Formal Arguments:
NCHAR - Number of characters.
This routine plots the specified number of characters. The characters are
packed two per 16-bit metacode word.
SUBROUTINE READ SYSTEM DEFAULTS
This routine reads the system defaults file 'GEOEAS.DEF' and initializes the
system defaults.
INTEGER*4 FUNCTION TOGGLE POSITION (FIELD NAME)
Formal Arguments:
FIELD NAME - Stores the toggle field name.
This routine returns the toggle position for the specified toggle field.
Geo-EAS Programmer's Guide
3.13-9
April 1990

-------
SUBROUTINE TVO (IWORD)
Formal Arguments:
IVORD - Metacode instruction to process.
This routine processes a tvo-byte (relative position) metacode instruction.
SUBROUTINE WRITE SYSTEM DEFAULTS
This routine writes the system defaults to the system default file
'GEOEAS.DEF'.
Geo-EAS Programmer's Guide
3.13-10
April 1990

-------
SECTION 4
SYSTEM MAINTENANCE PROCEDURES
4.1	Compiling and Linking
The Geo-EAS programs vere developed using the Microsoft 4.01 FORTRAN compiler,
the Microsoft 4.0 C compiler, and the Microsoft macro-assembler (MASM). All
compilers, assemblers and libraries are assumed to reside in the C:\MSF0RT
subdirectory.
Compiling
All Geo-EAS source files should include the $LARGE compiler metacommand. The
following command line is used to compile most of the source files:
FL /c /4Ns /4Nt /4Yb /0d /FPc 
Some NCAR source is compiled using the \4Y6 compiler option (FORTRAN 66
conventions). Each source code subdirectory has a "batch" (.BAT) file which
contains commands to compile all files. This batch file is named C0MPIL.BAT
(or sometimes F0RALL.BAT). Refer to this file, or the MAKE file for specific
details. Refer to the Microsoft FORTRAN User Guide for specific details about
compiler options.
Linking
Geo-EAS object modules should be linked to the "Large Model" libraries. The
FORTRAN library is a Large-Model, C-Compatible library with floating point
emulation routines. It is named CLIBFORE.LIB. The Large Model C library
named LLIBC.LIB must also be present for linking. The following command line
serves as an example of a typical link:
LINK \E \N0D , , nul,
+\MSFORT\CLIBFORE+\MSFORT\LLIBC;
where  is a list of object files,
 is the name of the executable file, and
 is a list of program-specific libraries.
Each program source directory contains a "Linker Response File" with the
extension ".LNK" which contains the appropriate responses to link the program
successfully. A batch file named "L.BAT" resides in each directory which will
automatically create the executable, assuming all objects have been prepared.
"Overlay capability" is used in most Geo-EAS programs to allow efficient use
Geo-EAS Programmer's Guide
4-1
April 1990

-------
of RAM. The overlay structure is specified in the linker response file using
parentheses to group objects together. See the linker response files for more
specific information. Refer to your Microsoft documentation for specific
information about linker options.
Using the MAKE Utility
The Microsoft MAKE utility was used for development of Geo-EAS programs. This
is a software maintenance utility which uses a file containing information
about compiler directives, source files, objects, and linker commands to com-
pile or link automatically. If a change was made to the source code in a
particular module, MAKE will recognize that this file must be recompiled, and
will take appropriate action to recreate the executable. It is recommended
that the MAKE utility be used during program maintenance, as it will save time
and effort. The MAKE utility receives its information from a "Make File".
Each program source subdirectory contains such a file. The files are named
with the program name as a prefix, and ".MAK" as the file extension. To com-
pile and link a program, set the directory to the appropriate location and
type MAKE .mak. For example, to recreate the VARIO executable, type
the following commands:
CD NGEOEASWARIO
MAKE VARIO.MAK
Refer to the Microsoft documentation on the MAKE utility, and the individual
"Make Files" for specific information.
4.2	CodeView
CodeView is a source-level debugging utility provided with the Microsoft
compilers which may be used as a tool for understanding and fixing program
errors. To execute a program under control of CodeView, the program source
files must be compiled with the /Zi compiler directive, and linked with the
/CO linker option. The the program may be executed by typing: CV program-
name. This may not work with many Geo-EAS programs the first time because
they require too much memory for CodeView to operate correctly. If this
problem occurs while trying to use CodeView, the solution is to reduce the
limits of global arrays in the SINCLUDE file of global variables. The source
files must subsequently be recompiled and linked. The linker response file
must be modified to replace the /E option with /CO. Generally, a program must
leave 250Kb of memory for CodeView, or CodeView will not work. See the
Microsoft documentation on CodeView for more specific information.
4.3	Screen Definition Files
"Screen Definition Files" are used by the screen management utilities to
perform screen, menu and input field processing for an application. These
utilities reside in the C:\GEOEAS\SCREEN subdirectory. A Screen Definition
File is a file which contains information about the user interface for a
program. This includes information about the labels, boxes and lines, input
fields, and messages for each screen displayed by a program. Each program was
developed with such a file. The files are named with the program name as the
prefix and a file extension of ".SCR". During program development, the screen
Geo-EAS Programmer's Guide
4-2
April 1990

-------
definition file is read into the screen data structures via a call to the
screen management utilities subroutine READ STRUCTURE. A user interface may
be developed and debugged in this manner without having to recompile source
code. Once the user interface has been tested and is stable, the screen
management utilities program BLOCKDAT.EXE is used to create a "BLOCKDATA
SUBPROGRAM" which can be compiled and linked into the executable. To modify
the screens or menus for a program, the screen definition file must first be
modified and debugged. All programs have a subroutine called "PERFORM
PROCESS" which performs error checking. In addition to modifying the . :'CR
file for a program, typically this subroutine and the subroutine INITIALIZE
(which sets up default values) must also be modified. Since no user interface
is totally independent of the application, it is prudent to search all source
for screen-dependent code before performing such modifications. The screen
definition file is a convenient format for describing a set of screens, menus,
and field groups. It is also useful for understanding the user interface for
a program. Refer to the S.A.M (Screen Access Management) utilities User
Guide for specific information about constructing screen definition files.
4.4	Making a Block Data Screen Subprogram
The program BLOCKDAT.EXE is used for creating BLOCKDATA subroutines from a
screen definition file. This program resides in the C:\GEOEAS\SCREEN sub-
directory. To execute this command, the directory should be changed to the
appropriate source directory location and typing: \GEOEAS\SCREEN\BLOCKDAT
The program will prompt the user for the name of the screen definition file,
and the name of the blockdata subprogram file. The convention for Geo-EAS
programs is to name this file "BLOCK.FOR" The MAKE command files assume that
this is the source file name. Assuming that no errors are encountered while
reading the ".SCR" file, a file with the given name will be created in the
default subdirectory. This program reads the screen definition file and
creates a group of DATA statements which assign the screen data structures to
the appropriate values. It is important that the ".SCR" files contain no
single quote (apostrophe) characters, as this is used to delimit character
strings in the DATA statements.
4.5	NCAR Test Programs
The following section briefly describes several programs developed at NCAR for
the purpose of testing the System Plot Package and Autograph plotting
utilities. Refer to the NCAR documentation or the source code for more
detail.
4.5.1 System Plot Package Test Programs
The following programs were designed for testing the System Plot Package when
rehosting the software. The programs may be found in the subdirectory
\GEOEAS\NCAR\NCARSPP, with file extensions of '.FOR'. The programs described
below should be compiled and linked with the following command lines:
FL /c /4Y6 /4Yb /Od /FPc 
LINK /E /NOD , , nul, NCARSPP;
Geo-EAS Programmer's Guide
4-3
April 1990

-------
For more specific information on a test program, refer to the source code
comments and the System Plot Package documentation.
Program TESTPLOT
Program TESTPLOT was designed to test the metacode generation capability of
the lower-level System Plot Package routines. It produces an ASCII listing of
the metacode, which can be compared to a listing of the correct output which
appears in the source code comments.
Program TEST12
Program TEST12 was designed to test the lower-level machine-dependent
(locally implemented) portions of the System Plot Package. Several tests are
performed, and messages are written to the screen to indicate the results and
success or failure of each test. The source code comments contain more
detailed information.
Program TESTSPP
Program TESTSPP tests all upper-level System Plot Package routines. Messages
are generated to indicate success or failure of a test. A metacode file is
generated which contains several graphs which test line and text drawing
capabilities of the Plot Package. The metacode generated should be input to
metacode translators to verify proper operation of each tested routine, and
proper operation of the translator program. The NCAR documentation contains
examples of the correct graphical hardcopy.
4.5.2 Autograph Test Programs
Program TAUTOGRP
The following program was designed for testing the Autograph plotting utili-
ties when rehosting the software. The program may be found in the subdirec-
tory \GEOEAS\NCAR\AUTOGRAP, with a file extensions of '.FOR'. It should be
compiled and linked with the following command lines:
FL /c /4Yb /Od /FPc TAUTOGRP.FOR
LINK /E /NOD TAUTOGRP+\NCAR\AUTOGRAP\BLOCK, TAUTOGRP,
nul, NCARSPP+AUTOGRAP;
Program TAUTOGRAP tests all upper-level Autograph subroutines. Messages are
generated to indicate success or failure of a test. A metacode file is
generated which contains several graphs which test line and text drawing
capabilities of Autograph Package. The metacode generated should be input to
metacode translators to verify proper operation of each tested routine, and
proper operation of the translator program. The NCAR documentation contains
examples of the correct graphical hardcopy. For more specific information on a
test program, refer to the source code comments and the Autograph documenta-
tion .
Geo-EAS Programmer's Guide
4-4
April 1990

-------
4.6
Hershey Character Plotting
- Test Programs
The Hershey character plotting test programs are located in the subdirectory
\GEOEAS\HERSHY. Two programs are available named HCTEST and HCTYPE. Both
programs test the character plotting capabilities of routines in HERSHY.FOR.
Program HCTEST plots several fonts on the screen. Program HCTYPE allows the
user to type character strings with embedded "special characters" (for font
selection, superscripting, etc.) and will display the plotted test on the
screen. The GRAFLIB library is used for screen display. Refer to the source
code for more information. These programs should be compiled and linked using
the following command lines:
FL /c /4Nt MNs /4Yb /Od /FPc HERSHY.FOR
FL /c /4Nt MNs /4Yb /Od /FPc 
LINK /E /NOD +Hershy, , nul, GRAFLIBE;
For more specific information on a test program, refer to the source code
comments and the System Plot Package documentation.
Geo-EAS Programmer's Guide
4-5
April 1990

-------
APPENDIX A
NCAR Documentation
Geo-EAS Programmer's Guide
April 1990

-------
NCAR-TN/162XIA
NCAR TECHNICAL NOTE

May 1983
The System Plot Package
Editor: Gregory R. McArthur j !
Contributors: Bob Cher/in \
Fred Clara \ \\
Edward Gflraty \
Lofton Henderson \
Scientific Computing Division

NATIONAL CENTER FOR ATMOSPHERIC RESEARCH
BOULDER. COLORADO


-------
THE SWLiK PUTT PNZXK33
ISGU CP QCRZ9RS
IWMJUJLT1CN		1
Scaling		2
SET		2
SETI		2
FL2IOT		2
Plotting		2
FRSTPT		2
VECTOR		2
PliDTIT		2
LINE		2
POUTT		2
POINTS		2
CURVE		2
Writing		2
WRIT		2
Control				2
FIXJSH		2
FRAME		2
OPTN		7
SETCND		2
Status		2
GK1UND				2
GETSI		2
GETOPT		2
GETSET		2
MXMY		3
Backgrounds			
GRID (GRIDL)
PERIM (PEEUML)			
HALFAX	
GRIDAL	
TICK4	
LABMDD	
Instruction Manipulation	
FLASH1	
FIASH2	
		
FIASH4	
i

-------
Other Routines		3
Control		3
FLUSl ar*l FRMffi		3
Coordinates						4
SCALING		6
SET		6
Purpose				6
FORTRAN CALL		7
SFTI		9
PUTDOSe		9
FORTRAN Call		9
FL2D7T		9
Purpose				9
FORTRAN Call		9
PLOTTING		10
FRSTPT		10
Purcose		10
FORTRAN Call			10
VECTOR		10
Purpose		10
FORTRAN Call		10
PLCTIT		10
Purpose		10
FORTRAN Call				10
LINE		11
Purpose		11
FORTRAN Call		11
POINT			11
Purpose	•			11
FORTRAN Call		11
il

-------
POINTS		11
Purpose				11
FDHXUAN Tall		11
CURVE		12
Purpose		12
FORTRAN Call	,			12
WRITING		13
WRIT		13
Purpose		13
FORTRAN Call		13
CONTROL		14
FRAME			14
Purpose		14
FORTRAN Call		14
FLUSH		14
Purpose				14
FORTRAN Call		14
OPTO		14
Purpose		14
FORTRAN Call			14
SETCND		14
Purpose.				14
FORERAN Call		14
STATUS		16
GETCND		16
Purpose						16
FORTRAN Call	.		16
GETOPT				16
Purpose								16
FORTRAN Call....		16
GETSETT				16
Purpose							16
FORTRAN Call.....		16
GETSI							16
Purpose									16
FORTRAN Call				16
MM		16
Purpose					16
FORTRAN Call			 16
BACKGROUNDS			17
Cannon Argunents	 17
iii

-------
GRID			19
Purpose,		ig
FORTRAN Call				',9
Description				33
GRJDL									18
Purpose										L8
Call.			,		19
PERBf............					19
Purpose				19
TORTRAN Call			13
FEFUKL								19
Purpose.		15
FORTRAN Call	..	13
HALFftX		10
Purpose					13
FORTRAN Call				13
GRIDAL.				19
Purnose									.,...	19
FORTRAN Call			19
T1CK4				,		2:
Purpose					20
FORTRAN Call		20
LABMDO. 									20
Purpose				*				20
FORERAN Call		20
PICT DBmJCTICN KSKIPJlAnCN		23
FLASU									23
Purpose.								23
FORTRAN Call		23
			23
Purpose..........							23
roETHAN Call			23
FLA313	
Purpose	
FORERAN Call
FLASR4	
P^irpose	
FDRTRAH Call
iv

-------
THE SISDM HOT PBCKMX
mniuumn A System Plot Package is defined to be that group of rou-
tines used to form primitive plotter instructions. Onlv
the most basic routines for scaling and plotting line
segments, character strings, and annotated axes are in-
cluded in this group. More ocmplicated capabilities are
available through the use of utility routines which use
the System Plot Package. The utility routines are
described in The SCD Graphics Utilities.
The Systran Plot Package being used depends upon which
computer the job is running on, but the applications pro-
gram interface is unvarying. The Diccmed filjn and fiche
recorders are run on-line and a metacode-producing plot
package must be used for than. On the CRAY-1, metacode
is always produced and the target plotting device is
selected for the generated metafile by using appropriate
JCL cccrmands. Users needing special capabilities, such
as remote graphics or graphic-^device independence, can
produce a System Plot Package tailored to their cwn needs
(contact a member of the Graphics Project).
The plotter is assumed to have seme finite resolution,
which, by default is 1024 by 1024 addressable positions.
This can be changed by the user, using the SETT I subrou-
tine described below. This document uses the default
2io x 2io
resolution in its examples. Users should bear this in
mind when interpreting the examples.
Tine System Plot Package routines are divided into general
categories. They are:
Scaling
Plotting
Writing
Control
Status
Backgrounds
Instruction Manipulation
Each of these general categories is explained belcw.
May 1983
1-1
The System Plot Package

-------
Scaling
* iJL'L' LjLabL Lolled	Ccuii usee ouocdlnates to plotter
coordinates.
SET* Changes the integer resolution of the plot package.
FL2H7T Coordinate conversion based on SET mapping, without plot-
ting.
Plotting
> FRSTFT Pen UP move
2 VECTOR pen DCWN move
PLOTIT Pen UP or DON move using high resolution integer coordi-
nates.
^ LINE Connects two points with a line.
POINT Draws a point at a given coordinate pair.
POINTS Draws a point or a character at each of a given set of
points, optionally connecting them with line segments.
CURVE Draws straight line segments through a sequence of
points, forming a polygonal path.
Writing
-^EWRIT Draw3 character strings on the plotter.
Control
FLUSH Flushes instructions internally buffered by the System
Plot Package to the plotter.
FRAME advances plotter to next picture.
OPTO Sets (generally hardware) options on the plotter.
dh'iuJD Sets non-plotting conditions (such as metacode output
unit).
Status
GETCND Returns status of conditions set using SEICND.
GETSET Returns nest recent SET call parameters.
The System Plot Package
1-2
May 1983

-------
Qk k kkkkk-kkkkkkkkkk-kkkkkkkkkkkkkkkkkkkkkk kit kick kkkkkkk-xkkk-kkkk kit-kk
C /FILES/
C
c
c
c
c
c
c
Common block for file names.
File Prefix
Data File
Metacode File
Param File
User Pfile
File Name
-	File prefix for file names.
-	Data file name.
-	Metacode file name.
-	Input parameter file.
-	Output parameter file.
-	File name including the file prefix.
COMMON /FILES/ Data File, Metacode File, Param File,
User Pfile, File Prefix, File Name
CHARACTER*14
CHARACTER*50
CHARACTER*64
Param File, Metacode File, Data File,
User Pfile
File Prefix
File Name
Qickkk'k'klc'kkkkkk-k'k-k'k'k'k'k'k'k'kir'k'k'k-k'k'kk'k'kkkkkkkkkiek'kkkkkkkkkkkkkk-kk-k-k'k'k
C /DATFIL/	- Common block for the data file.
C
C Nvar	- Number of variables in the data file.
C Ndatafile	- Number of records in the data file.
C Vname	- Array of variable names.
C Vunit	- Array of measurement units for each variable.
C Xcor	- Array of X coordinates for the sample data.
C Ycor	- Array of Y coordinates for the sample data.
COMMON /DATFIL/ Nvar, Vname, Vunit, Ndatafile,
+	Xcor, Ycor
CHARACTER*10 Vname(Maxvarfile), Vunit(Maxvarfile)
INTEGER*4 Ndatafile, Nvar
REAL*4	Xcor(Maxdata), Ycor(Maxvar,Maxdata)
Geo-EAS Programmer's Guide
3.10-2
April 1990

-------
FLUSH and FRAME This procedure has two potential disadvantages. First,
when the program terminates execution, there may be in-
structions left in the array which will not reach the
plotter unless a specific request is made to send them
there. The routines FLUSH and FRAME (which calls FLUSH
after generating the frame advance instruction) will
clear the array.
NOTE: Any program using the System Plot Package should
have as its last call either FUJSH or FRAME.
Failure to perform this call can lead to loss of
parts of the last picture of a production run.
NOTE: To maintain the correct order, a FLUSH or FRAME
call should precede each change frcn System Plot
Package calls to PRINT or WRITE instructions.
Coordinates Coordinate arguments of a System Plot Package routine mav
be either floating point (X and Y), or integer (MX and
MY) . If the user supplies floating point values, they
are assumed to be user coordinates. If the user supplies
integer values, they are assumed to be plotter coordi-
nates in the range 1 to 1024 (unless the resolution has
been changed by a SETFI call}. Zero Is always considered
a floating point number.
Si a^ilei
POINT may be called In any oE thc?ie waym
CALL POINT (X,Y) CALL POIOT (X,MY)
CALL POINT (MX,Y) CALL POHTT (MX,MY)
The alternate arguments MX and MY anply to the X and Y
coordinates of the following routines:
FRSTPT	CURVE
VECTOR	PWRIT
POINT	HALFAX
LINE	AXES
POINTS	GRIDAL
The System Plot Package
1-4
May 1983

-------
C /PARFIL/
C
C
c
c
c
c
c
c
c
c
Var Args
Gen Args
Xaxis Args
Yaxis Args
LabLin Args
User Args
RPError
'x-x7r'rrT?r-^-krrTr-^-^ir'k'xre-^-X7errif-x-x'X'xir'k'kifi(if7rif'X'T'r^reie'kiT-k'k7rif7f,r
Common block for the parameter file.
Array of	parameters for plotting the data.
Array of	general background arguments.
Array of	tick parameters for the X axis.
Array of	tick parameters for the Y axis.
Array of	parameters for the titles and axes
labels.
Array of	parameters set by the user.
Logical variable set to true if an error
occurred	vill reading the parameter file.
COMMON /PARFIL/ Var Args, Gen Args, Xaxis Args,
Yaxis Args, LabLin Args, RPError,
User Args
CHARACTER* 25
CHARACTER*35
CHARACTER*50
CHARACTERS 0
LOGICAL*!
Gen Args(3)
Var Args(Maxvar,6)
Xaxis Args(8), Yaxis Args(8)
Lablin Args(5,3), User Args(Maxuser)
RPError
I**************'* **********************
C
c
/NCAR/
- Common block for producing the graph.

c
Xarr
- Array of X coordinates to plot.

c
Yarr
- Array of Y coordinates for the Y variables to
c

plot.

c
Ndata
- Number of samples to plot.

c
Iptr
- Array used for sorting records.

C Dshp
- Array of dash line patterns to plot the
line(s).
c
Idpc
- Array of symbols to plot the line(s).

c
Pvr
- Indicates vhether line, symbols or both
are to be
c

plotted.

c
Devcode
- Type of graphics device.

COMMON /NCAR/ Ndata, Xarr, Yarr, Dshp, Pvr,Iptr,Idpc,
Devcode
CHARACTER*6
CHARACTER*19
INTZGER*2
INTEGER*4
REAL*4
Idpc(7)
Dshp(Maxvar)
Pvr(Maxvar), Iptr(Maxdata), Devcode
Ndata
Xarr(Maxdata), Yarr(Maxvar,Maxdata)
Geo-EAS Programmer's Guide
3.10-4
April 1990

-------
does no plotting.
This scaling will be in effect foe all subsequent
plotting until changed by another call to SET,
FORTRAN CALL CALL SET (XA,XB ,YA,YB,XC,XD,YC,YD,LTYFE)
XA,XB,YA,YB (floating)
Numbers between 0. and 1. defining the portion of the
plotter to be used. (0.,1.,0.,1.) specifies the entire
area. The follcwing restrictions apply:
0. < XA < XB < 1.
0. < XA < ffi < 1.
Alternate arguments MXA.MXB,MYA,MYB may be used. These
specify plotter addresses.
XC,XD,YC,YD (floating)
Numbers indicating minimum and maximum values of the
array to be plotted in the plotter area specified by
arguments 1-4.
XC maps to XA
XD maps to XB
YC maps to YA
YD maps to YB
The only restrictions are that
Linear mapping
Log mapping
XC f XD
XC + XD JC,XD > 0
YC f YD
YC t YD YC ,YD > 0
Ttiat Is, XD may be larger or smaller than XCf similarly,
YD may be larger or smaller than YC.
LTYPE (integer)
Flag indicating log or linear mapping
LTYPE
x Direction
Y Direction
1
lLnear
linear
2
1inear
log
3
log
linear
4
log
log
The System Plot Package
1-6
May 1983

-------
3.10.4 User Interface
The Screens
XYGRAPH displays four screens, an Introductory screen, a Main Screen, an
Options screen and a Graph Options screen. In the file XYGRAPH.SCR the
Introductory screen is defined as Screen 1, the Main screen as Screen 2, the
Options screen as Screen 3 and the Graph Options screen as Screen 4. The
Introductory screen displays a brief introduction and no menu options. The
Main screen has the menu options to allow specification of the input and
output parameter file names. The Options screen has the menu options to allow
specification of the data and metacode file names, the selection of variables,
options for displaying the variables, to compute a regression line, and the
position of a graph legend. The Graph Options screen has the menu options
that provide control over the 'graph background parameters'. The menus that
appear on the screens are presented below along with the menu name and the
related screen field name (in parentheses) that is used in the XYGRAPH.SCR
file.
The Main menu (MAINMENU)
Prefix Read Parameters Options/Execute Save Parameters Quit
The Options menu (EDITMENU)
Data Variables Symbol/Line Regression Legend Graph Options Execute Quit
The Graph Options menu (BG MENU)
Axis Parameters Tick Parameters Graph Limits Title/Labels Reset Quit
The Menu Hierarchy
(MAINMENU)
Xygraph —r Prefix
-	Read Parameters (EDITMENU)
-	Options/Execute —p Data
-	Variables
-	Symbol/Line
-	Regression
-	Legend
-	Graph Options
(BG MENU)
-	Axis Parameters
-	Tick. Parameters
-	Graph Limi ts
-	Titles/Labels
-	Reset
-	Quit
-	Execute
-	Quit
-	Save Parameters
-	Quit
Geo-EAS Programmer's Guide
3.10-6
April 1990

-------
SETT
Purpose ScTTI changes the resolution of the plotter for use of in-
teger coordinate input.
roRHWl Call CALL SETI (LX,LY)
After calling SCTI, all integer coordinates are assumed
to be in the range:
1 < MX < 2^
1 < m < "P-
Thus, SETI can be used to make the plot package compa-
tible with software written for any resolution plotter.
CALL SETI {10,10) returns the plot package to its ori-
ginal state.
NOTE; Restriction on the range is 1 £ LX,LY <_ 15,
FL23HT
Purpose FL2IOT maps floating point numbers into integer plotting
space without plotting.
FORTRAN Call CALL FL2INT (X,Y,MX,MY)
For Input floating mordtnnfnn (X,Y) , nn Int^jnr r*v»r-
dinata (MX,MY) In r^btrnrvl qlvlrr) Hin ptnt-hr-r	lo-
cation of (X,Y) hnnM mi ttu* imnt rnn»ut nw nil .
Nothing la plotted. MX arxJ MY are in the ranqe U to
32,767 regardless of any SE7TI call.
The System Plot Package
1-8
May 1983

-------
SCREEN
LABEL
FIELD NAME
(XYGRAPH.SCR)
GLOBAL VARIABLE
Graph Options Screen
Axes Parameters
Axis Style
Graph Limits
Min
Max
Scale
Tick Parameters
Base
Type
Label
Fraction
Exponent
Ti ties/Labels
Main Title
Subti ties
X Label
Y Label
COLOR C6 (toggle)
AXES (toggle)
MIN X (real)
MIN Y (real)
MAX X (real)
MAX Y (real)
SCALE X (toggle)
SCALE Y (toggle)
TIC
BAS
X
(real)
TIC
BAS
Y
(real)
TIC
TYP
X
(toggle)
TIC
TYP
Y
(toggle)
TIC
LAB
X
(toggle)
TIC
LAB
Y
(toggle)
TIC
FRC
X
(real)
TIC
FRC
Y
(real)
TIC
EXP
X
(real)
TIC
EXP
Y
(real)
TITLE (char)
SUBTITLE1 (char)
SUBTITLE2 (char)
X LABEL (char)
Y LABEL (char)
VAR ARGS(1,6)
GEN ARGS(l)
XAXIS
ARGS(l),
XMIN
YAXIS
ARGS(l),
YMIN
XAXIS
ARGS(2),
XMAX
YAXIS
ARGS(2),
YMAX
XAXIS
ARGS(8),
XLOG
YAXIS
ARGS(8),
YLOG
XAXIS
ARGS(4)

YAXIS
ARGS(4)

XAXIS
ARGS(3)

YAXIS
ARGS(3)

XAXIS
ARGS(5)

YAXIS
ARGS(5)

XAXIS
ARGS(7)

YAXIS
ARGS(7)

XAXIS
ARGS(6)

YAXIS ARGS(6
LABLIN ARGS(1,3),
TITLE
LABLIN ARGS(2,3),
STIT1
LABLIN ARGS(3,3),
STIT2
LABLIN ARGS(4,3),
XLAB
LABLIN ARGS(5,3),
YLAB
Geo-EAS Programmer's Guide
3.10-8
April 1990

-------
LINE draws a line frcm (XA,YA) to (XB,YB).
CALL LINE (XA,YA,XB,YB)
XA,YA (floating or integer)
Coordinates o£ the first point (see Coordinates,
above).
XB,YB (floating or integer)
Coordinates of end point (see Coordinates, above).
KURT
Purpose POINT plots a point at (X,Y).
FORTRAN Call CALL POINT (X,Y)
X and Y are ooordinates of point to be plotted. X and
Y may be either floating point or integer (see Coordi-
nates , above).
POOBS
Purpose POIOTS draws a series of points or characters at a set of
points specified in the arguments. The point\i mny ra-
tionally be connected with lines. Integers may be usf?d
in the arrays, but they will be plotted without scaling
(see Coordinates, above).
FORTRAN Call CALL POINTS (X,Y,N,ICHAR,IPEN)
X (floating or integer)
An array of X coordinates
Y (floating or integer)
An Mr ay of Y coordinates
N (integer)
The number of elements in X and Y
LOTS
Purpose
FORTRAN Call
ICHAR (character or integer)
If 0, points are drawn at th* points	x .ir*!
Y. Otnprwl?"», TniAP i«* fh"	f-n hr> r?r«wn n>-
*ach point. Thus, If	n pin-* will ^ rlr.iwn
at each of the polnt3.	jjr
The System Plot Package
1-10
May 1983

-------
IFEN (integer)
If 0, only the points or characters are drawn. If I,
straight line segments are drawn connecting the coordi-
nates using the current dash pattern.
CUHVK
Purpose curve draws a series of straight line segments connecting
the points specified in the arguments. Integers may be
used in the arrays, but they will be plotted without
scaling (see Coordinates, above).
FORTRAN Call CALL CURVE (X,Y,N)
X (floating or integer)
An array of X coordinates
Y {floating or integer)
An array of Y coordinates
N (integer)
The number of points on the curve
1983
1-11
The System Plot Package

-------
MRXTXZG
WIT
Pucpooe PWIUT writes characters on the plotter,
FORTRAN Call CALL FWRIT |X,Y,ICHARS,N,ISIZ(IOR(ICENT)
X,Y (floating or integer)
Coordinates of the point at fchich the character are to
be written; see I CENT, belcw (see Coordinates, above).
ICHABS (character]
The characters to be written
N (integer)
The number of characters to be written. IC31AKS should
be dimensioned appropriately if more characters are to
be written.
ISIZ
Character width in plotter address units in the current
plotter integer resolution, except if less than or
equal to 3, Then the following widths ace selected:
ISIZ
WIDTH* (215. in resolution)
0
8
1
12
2
16
3
24
* Adjusted automatically by PttRIT for different resolu-
tions.
IOR
Character string orientation in degrees counter7
clockwise frcru the horizontal integer.
ICENT
Centering ootion
-1 (X,Y) is the center of the left edge of the
first character
0 (X,Y) is the center of the entire string
+1 (X,Y) is the center of the right edge of the
last character
The System Plot Package
1-12
May 1933

-------
oaraa' The System Plot Packaqe has an instruction buffer which
holds plotter instructions. This buffer is normally
dumped to the output file only when full. FLUSH forces
this buffer to dump to the output file when it is not
full. FUJSH or FRAME must be called at the end of plot-
ting in any proqram to make sure all calculated instruc-
tions actually reach the plotter.
FEME
Purpose FPAME advances the plotter one frame. On non-plotter
display devices, it triggers whatever action is apDropri-
ate for termination of the current picture and initiation
of the next picture. Since FPAME calls FLUSH, it also
forces the System Plot Packaqe buffer to dunp to the out-
put file. The plotter options accessed by OPTN and
GETOPT (q.v., below) are all reset to default values by
FPAME.
FORTRAN Call CALL FRAME
Purpose FLUSH sends all calculated but unexecuted plotter in-
structions to the plotter.
FORTRAN Call call FLUSH
Purpose OFIN sets plotter options (generally hardware}.
FORTRAN Call CALL OPTO (IWHIO!,IOPVAL)
rwnicH
The option to be set? a character string (see the fol-
lowing table).
IOPVAL
The value to which the option Is to be set (see the
following table).
NOTE: All of these options are not supported on ALL
graphics devices at NCAR. Any not supported on a given
device is ignored by that device.
Purpose to set nort-plotting conditions in the package.
1983
1-13
The System Plot Package

-------
bUKlKAN Call gall SKICND (ICND, IVAL)
IQID A two-character keyword specifying the condition to
be set (see the following table).
IVAL The value to which the condition is to be set (see
the following table).
CCNDITICN
ICND
IVAL
DEFAULT
Metacode
MI
Any legal logical
$PLT on the CFAY-lAs
cxitput unit

unit number or



dataset name

Two other conditions which can be specified using SETCND
are discussed in the documentation for support routine
INIT in the Iirolementor's Guide.
The System Plot Package
1-14
May 1983

-------
OPTION
to be set
Character
case
Intensity
Character
string
orientation
Dash pattern
Character Size
Font
Spot size
CoLor
IWHICH
Character
Eonrrt
CASE
INTENSITY
ORIENTATION
DPATTEEN***
CSIZE
FOTT
SSIZE**
CDLOR
IOFVAL
Range (end Meaning)
0	(upper case)
1	(lower case)
0 through 255
'LCKT, 'HlGH't
0 through 365
(angle counter clock-wise
in degrees fran
horizontal")
J) through 216-1
(see description fcelcw)
0 through 32767
metacode units
0	(block print)
1	(italics)
0 through 32767
metaoode units
'REDVBl/CRVBUUE', etc.|
Default
HIGH
SOLID
129
0
8
0
f Only the first two characters of IWIICH are examine*!.
For color, the first three characters of IOPV&L are exam-
ined, and for intensity, the first tw. The following
are equivalent:
CALL OPTO (5HCOLCR, 7HMPGENTA)
CALL OPTO (2HOO,3HMM)
** Corresponds also to line width, measured in metacode
address units.
+** When setting the dash pattern, 1 means line parts are
drawn, 0 tneans they are not. Thus,
11111111111111112
is a solid lineiand
10101010101010io2
has the shortest possible dashes.
Hay 1983
1-15
TTie Bynttm Plot Pack*<-|»»

-------
saaas
QBOPT
Purpose GETOPT returns the state of a particular option
FORTRAN Call CALL GETOPT (IWH3EB,I0PVAL)
WHICH is supplied by the user and specifies which ac-
tion value is wanted. IOFVAL Ls returned by GcTTOFT,
and is an integer for all options but COLOR, for which
three characters are returned. Note that this requires
that the user supply a two-word array on two-character-
per-wsrd machines. (See description of OPTO entry
point.)
Gsauu
Purpose GSPCND returns the value3 of the conditions set by SEICMD
calls.
FORTRAN Call CALL GSICND rrj»* 1 < MY -
ion, 1 < Hrr ' 1034. if rrrt	••?»»
range will be different.
The System Plot Package
1-15
May 1983

-------
BKSGR3HB Ttie following routines are convenient for drawing grach
paper, axes, and other backgrounds. They may use linear-
linear, linear-log, or log-log scaling depending on hew
SET is called. Arguments 1-4 of SET specify the area
over which the backgrounds are to be drawn.
GRIDAL, GRID, GRIDL, PERIM, PERIML, and HALFAX have argu-
ments MAJRX,MINRX,MAJK£,MINRY which control the number of
major and minor divisions in the graph paper or periine-
ter. The number of divisions refers to the holes between
lines rather than the lines themselves. This means that
there is always one more major division line than the
number of major divisions. Similarly there is one less
minor division line than minor divisions (per major divi-
sion) .
Major division lines, or tick marks, are drawn in high
intensity and minor lines or ticks in lew intensity. A.11
background routines leave the plotter in high intensity.
Ojmm ai Arguments The meaning of arguments in the log case is ocmpletely
different than in the linear case, as follcws:
Argument
Linear

MAJRX
The number of
Spacing between co-
MAJRY
major divisions
ordinate values at

along the x- or
major divisions is

y-axis.
10**MAJRX (Y).


For normal log paper


MAJRX(Y) is ore,


meaning a major


division for each


log cycle.
MINRX
Hie number of
If MINRX(Y) < 10
KINKY
minor divisions
and MPJRX (Y) <

per major divi-
1, the eight

sion. See
normal sub-cycle

corments above.
divisions will


be drawn. If


MINRX(Y) > 10 or


MAJRX (Y) > 1,


these subdivi-


sions will be


suppressed.
May 1983
1-17
Hie System Plot Package

-------
GRID
Purpose
FORTRAN Call
Descr iption
GRIDL
Purpose
FORTRAN Call
PBQM
Purpose
FORTRAN Call
HBRDC*
Purpose
FORTRAN Call
HACFNC
rjrpos#
FORTRAN Call
GRID draws graph paper.
CALL GRID (MAJRX ,MINRX , MAJRY ,MINRY)
For definitions, see Cannon Arguments, above. MAJRX,
MXNRX, MAJRY and MINRY are type integer.
This routine will draw graph lines in the portion of the
plotter specified by a SET call with the number of major
and minor divisions specified by the arguments.
Same as GRID, but each major division is marked with its
numerical value.
CALL GRIDL (MAJRX ,MINRX,MAJRY,MINRY)
For definitions, see Cannon Arguments, above.
Same as GRID, but interior lines are replaced with tick
marks along the edges.
CALL PERIM (MPJRX ,MINRX ,MAJRY ,MINRY)
For definitions, see Ccimun Arguments, above.
Same as PERIM, but each majoc division Is mnckcnl with Itn
numerical value.
CALL PERIML (MAJRX fMTNRX,MATRY,MTNRY)
Foe definitions, see Camon Arguments, above.
IU\I/"AX	.vn»* lnt*t	.it
with tick marks according to *?VJRX, MINRX, MAJRY, and
MINFY. These may optionally be labelled.
CALL HALFAX (MAJRX,MINRX,MAJRY,MINRY,X,Y,IXLAB,IYIAB)
MAJRX,MINRX,MAJRY,MINRY (integer)
See Camon Arguments, above.
X,Y
The intersection point of the X and Y axes. See Coordi-
nates, above.
IXLAB,IYLAB (Integer)
The System Plot Package
1-18
May 1983

-------
Flags for axes labels:
IXLAB = -1 No X-axis drawn
No X-axis Labels
- 0 X-axis drawn
No X-axis labels
= 1 X-axis drawn
X-axis labels
IYLAB = -1 No Y-axis drawn
No Y-axis labels
= 0 Y-axis drawn
No Y-axis labels
= 1 Y-axis drawn
Y-axis labels
GBmL
Purpose GRIDAL presides a general entry point for all backgrounds
with the option of line labelling on each axis.
FORTRAN Call CALL GRIDAL (MAJHX ,MINRX ,MAJHY ,MINRy, IXLAB, IYLAB, IGFH, X, Y)
HAJRX,MTNRX,MAJRY,MINRY (integer)
See Cannon Arguments, above.
IXLAB,IYLAB
Flags for line value labels along axes:
IXLAB » -1 No X-axis drawn* no X-axis labels
¦	0 X-axis drawn? no X-axis labels
• 1 X-axis drawn? X-axis labels
IYLAB ¦ -1 No Y-axis drawn? no Y-axis labels
¦	0 Y-axes drawn? no Y-axis labels
«¦ 1 Y-axis drawn? Y-axis labels
1983
1-19
The System Plot Package

-------
IGPH
Flag for background type:
IGPH
X-Axis Background
Y-Axi3 Backqrcund
0
GRID
GRID i
1
GRID?-
PERIM 0
2
GRID^
HALFAX I
4
FERIMl)
GRID Ql
5
PERIM U
PERIM 0
6
PERIM "
HALFAX I
a
HALFAX I
GRID 1
9
HALFAX !
PERIM V
10
HALFAX \
HALFAX \
X,Y
Location of intersection of axes if IGPH = 10.
TICX-4
Purpose TICK4 cillows program control of tick mark length in PER-
IM, PERIML, GRIDAL, and HALF AX. LMATX and IMAJY are ini-
tially set to 12, and IKENX and LMINY to 8.
FORTRAN Call CALL TICK4 (LM?JX,MINX it onLy presets
paranetera for the graphing routines.
NOTE; LAEMCO trust be called before the background rcu-
tines for which it is presetting paranetera.
FORTRAN Call
CALL LABMCD (15MrX,IEWry,NUMX,NUMY,ISI2X,ISIZY,IXDBC,IYDn:fIXDn)
IFWTX, IFMTY
A Hollerith format specification for X- or Y-axis nu-
merical labels in GRIDL, PERIML, GRIDAL, or HALFAX.
The specification rust start with a left parenthesis
enrl wlvh rlihf- pr»ronf-he
-------
IFMTY=7H (E10.0) are permissable.
NUMX,NUMY (integer)
The number of characters specified by IFT-TTX and IF^TTY.
For the above examples, these would be NUMX=8 and
NUMY=10 (not 6 and 7).
ISIZX,ISIZY
Character si2e oodes for the labels. Codes are the
same as in WRIT.
IXDEC
The decrement in plotter address units fran the MINX
position (specified by the first argument of SET) to
the nearest X-address of the label specified by IFMTY,
NUMY, and ISIZY. For example, if the first argument of
SET is .1, MINX is 102 (.1*1024). If IXDEC is 60, the
label will start at 42 (102-60). The following conven-
tions are used:
•	If IXDEC = 0, it is autanatically reset to proper-
ly position the Y-axis labels to the left of the
left Y-axis, IXDEC = 20.
•	If IXDEC = 1, y-axis labels will go to the right
of the graph, IXDEC = -20.
When either HALFAX or GRIDAL is called to draw nn nxH,
IXDEC is the distance frcm the axis rnthcr thnn frun
MINX.
IYDEC
The decrement in plotter address units from the MINY
position (specified by the third argument of SETT) to
the nearest Y-address of the label specified by IFWTX,
NUMX, and ISIZX. For example, if the third argument of
SFT is .2, MTNY in .2*1024 - 705. If IYTW7 » 10, f-ho
label will end at 205 - 30 • 175. The foLLcwlng con-
ventions are used:
•	If IYDEC = 0, it is autanatically reset to prcper-
ly position X-axis labels along the bottan, IYDEC
- 20.
•	If IYDEC - 1, X-axis labels will go along the top
of the graph, IYDEC ¦ -20.
May 1983
1-21
The System Plot Package

-------
IXDR {integer)
Orientation of the X-axia labels.
IXDR =0 +X (horizontal)
=1 +Y (vertical)
In normal orientation the actual number of nonblank
digits is centered under the line or tick to which it
applies.
The System Plot Package
1-22
May 1983

-------
FIOT iftyiw-JJ-lw The FLASH routines (FLASHl, FLASH2, FLASH3, and FLASH4i
WaHHIUCnai permit plotting of repetitive data, such as complicated
grids, on demand without recalculating the plotter in-
structions each time. This is particularly useful for
movie applications. Up to eleven separate blocks of in-
structions can be created and regenerated at any time
during the program.
FUSSI
Purpose FLASHl initiates storage of plotter instructions in the
array IFIELD. Instructions following a FLASHl call are
not sent to the plotter, but are stored in IFIELD.
FORTRAN Call CALL FLASHl (IFIELD .MAXLEN)
IFIELD (integer)
The name of an array in the program that is to receive
plotter instructions.
MAXLEN (integer)
The maximum number of words in IFIELD that may be used
{normally the dimension of IF1EUJJ.
FUES2
Purpose FLASH2 terminates the process started by FLASHl. After a
FIASH2 call, plot instructions go to the plotter. All
instructions between FLASHl and FLASH2 calls are stored
in IFIELD.
FORTRAN Call CALL FLASH2 (IP0IOT,LEN(7IH)
IPOINT (integer?
A user-specified Integer between 0 and 10 which In urwl
to identify the block o£ instructions thi3 FLASH se-
quence has qeneratedj the user will supply this "label
to subsequent FLASH3 calls.
LEH3IH (integer)		
The actual number of words in IFTEUD that have been
filled. This is returned in LENGIH.
FUSQ
Purpose FIASH3 sends the instructions generated between a partic-
ular set of FLASHl and FLASH2 calls to the plotter.
PORIEAN Call CALL FLASH3 (IPOINT)	, ,
An integer between 0 and 10 (used in FLA5J12) to desig-
nate the particular block of instruction*.
May 1983
1-23
The System Plot Package

-------
NOTE: A call to FLASH3 does not reestablish the SET scal-
ing- parameters in effect between the corresponding FLASK1
and FLASH2 calls. Depending on the contents of the FLASH
buffer, the existing state of plotter options (see OPTN)
at the tine FLASH3 is called may be altered by the call.
FLASB4
Purpose FLASH4 establishes the necessary parameters for 'use by
FLASH3 for plotter instructions which have not been gen-
erated by FLASH1 and FLASH2 in the program being run.
FORTRAN Call CALL FLASH4 (IEVlA,LWA,IFOItn?)
IFWA (integer)
The first word of a block of plotter instructions not
generated by a FLASHl and FLASH2 sequence in the pro-
gram being run.
LWA (integer)
The last word of the block.
IHHNT (integer)
An integer between Q and 10 designating which block of
instructions is to be used in FLASH3 calls.
The System Plot Package
1-24
May 1983

-------
AUTOGRAPH
THE UNABRIDGED WRITE-UP
NCAR/TN-245~IA
ncar technical note
January 1985
Author: David J. Kennison
1 (C7TT)
• l.t	¦ I* III	| —
•t.a • i •.« . 4 ..i i ,| .4	,f
ci*mi i
SCIENTIFIC COMPUTING DIVISION
NATIONAL CENTER FOR ATMOSPHERIC RESEARCH
BOULDER.COLORADO

-------
AUTOGRAPH
THE UNABRIDGED WRITE-UP
NCAR{TN•24S + I A
NCAR TECHNICAL NG7H
January 1985
Author: David J. Kennison
SCIENTIFIC COMPUTING DIVISION
	
NATIONAL CENTER FOR ATMOSPHERIC RESEARCH
BOULDER. COLORADO

-------
AUTOGRAPH - THE UNABRIDGED WRITE-UP
CONTENTS
1.	INTRODUCTION	:	.		l
2.	OVERVIEW		2
2.1	HOW TO DRAW A GRAPH	!!!.!.	2
2.2	A SIMPLER WAY TO DRAW A GRAPH	"...	2
2.3	THE AUTOGRAPH CONTROL PARAMETERS		2
2.4	CONTROL PARAMETER NAMES		3
2.5	CONTROL PARAMETERS ARE FLOATING-POINT		3
2.6	USE GF PARAMETER-ACCESS ROUTINES		4
2.7	SIDE EFFECTS OF PARAMETER-SETTING		4
2.8	SAVING AND RESTORING DEFAULTS		4
2.9	SPECIAL VALUES 'NULL/1.' AND 'NULL/2.'		4
2.10	THE GRAPH WINDOW		5
2.11	THE GRID WINDOW		5
2.12	THE GRID COORDINATE SYSTEM		6
2.13	THE USER COORDINATE SYSTEM		6
2.14	HOW TO GRAPH "X AS A FUNCTION OF Y"		7
2.15	WHAT A BACKGROUND CONSISTS OF		7
2.16	THE EOUR AXES		7
2.17	ABBREVIATED FOFM OF AXIS-PARAMETER NAMES		7
2.18	THE PARAMETER 'AXIS/s/CONTROL.'		8
2.19	THE PARAMETER 'AXIS/s/LINE.'		8
2.20	MOVING AN AXIS		8
2.21	THE "LABEL COORDINATE SYSTEM" ALONG AN AXIS		8
2.22	POSITIONING OF MAJOR TICK MARKS CN AN AXIS		9
2.23	APPEARANCE OF MAJOR TICK W\RKS		10
2.24	POSITIONING/APPEARANCE OF MINOR TICK MARKS		10
2.25	NUMERIC LABELS ON AN AXIS		10
2.26	TYPES OF NUMERIC LABELS		11
2.27	ORIENTATION CF NUMERIC-LABELS		11
2.28	POSITIONING OF NUMERIC LABELS		11
2.29	CHARACTER SIZES IN NUMERIC LABELS		12
2.30	INFORMATIONAL LABELS	:		12
2.31	THE PREDEFINED LABELS		13
2.32	THE PARAMETER GROUP 'LABEL.'		14
2.33	THE PARAMETER GROUP 'LINE.'		14
2.34	ACCESSING A LABEL EEFINITION		15
2.35	ACCESSING A LINE DEFINITION		16
2.36	THE LABEL BOXES		17
2.37	BACKGROUND OVERLAP PROBLEMS		17
2.38	DASHOLINE PATTERNS EOR CURVES			18
2.39	THE PARAMETER GROUP 'DASH.'		18
2.40	PATTERNS USED BY EZY, EZXY, EZMY, AND EZMXY		19
2.41	WINDOWING OF CURVES	
2.42	USE OF JWRITX BY AUTOGRAPH		20
2.43	VARYING INTENSITIES, COLORS, ETC		20
2.44	NON-STANDARD NUMERIC LABELS				21
2.45	SCATIERGRAMS AND HISTOGRAMS		21
- i -

-------
2.46 GRS CCNSIDEPATICNS		21
1. FOJTINES		22
3.1	E2Y (YDRA/NPTSrGLAB)		23
3.2	EZXY(XDRA,YDRA,NPTS,GLAB)			24
3.3	EZJff (OTHA,IDXYfMftNY,NPTS,GLAB)		25
3.4	EZMXY (XDRA,YDPA,IDX£,MANY,NPTS,GLAB)		26
3.5	ANCTAT(XLAB,YLABrIBAC,LSET,NDSH,DSHC)		27
3.6	DIS?LA(LFRA,LPCW,LTYP)		29
3.7	/GScT?(TPQJ,FURA,LURA)						30
3.8	2GSETF (TPGN, FUSR)		32
3.9	?GSETI(TPQJ,IUSR)		33
3.10	AjSETC (TPGSJ, CUSR)		33
3.11	JGGETP (TPGN,FURA#LURA)		34
3.12	*GGETF(TPQ1,FUSR)		34
3.13	MGETI(TPGNrIUSR)		35
3.14	AGGEIC (TPGN ,CUSR)		35
3.15	/CSlTJP(XDRAfNVIX#IIVX»NEVX»in2(#...)		36
3.16	PCZPCK		38
3.17	AGCUHV(XVEC,IIEX/YVEC,I]£Y/NEXY,KDSH)		38
3.18	i^SAVE(IFNO)				39
3.19	AGRSTR(IFNO)	'.				40
3.20	AGBNCH(IDSH)			40
3.21	AGDSHN(IDSH)					40
3*22 AGUTOL(IAXSf FUNS/IDMA,VINP/VOIP)		41
3.23	fflCHAXUFIGflAXS/IPRT/VlLS)		41
3.24	AGCHCU(IFLG,KDSH)			42
3.25	*GCHIL(IFLG,I2NM,LNN0)		43
3.26	*GCHNL(IAXS,VILS,anW,JC3M,t*:iM,...)		43
3.27	AGJWRT(XFQS,YPOS,CHRS/NCHS/ISIZ,IORI/ICEll)		44
4. PARAMETERS				45
4.1	'PRIMARY.'		46
4.2	'FRAME.'		46
4.3	'SET.'				46
4.4	'ROT.'		47
4.5	'INVERT.'		48
4.6	'WINDOW.'		48
4.7	'BACKGROUND.'		49
4.3 'NULL.'		50
4.9	'NULL/1.'		50
4.10	'NULL/2.'		50
4.11	'GRAPH.'		51
4.12	'GRAPH/LEFT.'		51
4.13	'GRAPH/RIGTT.'		51
4.14	'GRAPH/BCTICM.'				52
4.15	'GPAPH/IDP.'		52
4.16	'GRID.'		52
4.17	'GRID/LEFT.'								52
4.18	'GRID/RIGHT.'		53
4.19	'GRID/BCmCM.'		53
4.20	'GRID/TOP.'		53
4.21	'GRID/SHAPE.'		53
- ii -

-------
54
55
55
55
56
56
56
57
57
57
57
58
53
53
58
59
59
59
59
60
60
61
61
61
62
62
62
63
63
64
64
64
65
65
66
66
66
67
67
67
67
68
72
72
72
73
73
73
74
74
74
74
7!
'X.'	
'X/MINIMJM. *	
'X/ttAXIMJM.'	
'X/LOGARITHMIC.'	
'X/ORDER.'	
'X/NICE.'	
'X/SMALLEST.'	
'X/LARGEST.'		
'Y.'	
•'Y/MINIMIM. '	
'Y/VAXIMJM.'	
'Y/LOGARTIHMIC.'	
'Y/ORDER.'	
'Y/NICE.'		
. 'Y/SMALLEST.'	
'Y/LARGEST.'		
'AXIS.'		
' [AXIS/] 3.'	
" [AXIS/] s/OCNTROL.'		
' [AXIS/] s/LINE. '	
' [AXIS/] s/ItflERSBCTCCN.'	
' [AXIS/] s/INTERSECTION/GRID.'		
*	[AXIS/] s/IOTERSBCTICN/USER.'		
' [AXIS/] s/FUNCTION.'		
' [AXIS/] s/TICKS.'		
' [AXIS/] s/[TICKS/] MAJOR.'		
- [AXIS/] s/[TICKS/]MAJOR/SPACING.'		
[AXIS/] s/lTICKS/]MAJOR/[SPACING/]TYPE.'...
A ' [AXIS/]s/[TICKS/]MAJOR/[SPACING/]BASE.'..,
' [AXIS/] s/[TICKS/] MAJOR/[SPAC ING/]CCXJNT.'..
' [AXIS/] s/[TICKS/] MAJOR/PATTERN.'		
' [AXIS/] s/[TICKS/] MAJOR/LENGTH •'		
' [AXIS/] 3/[TICKS/] MWOR/ [LENGTH/] OUTWARD.' ,
' [AXIS/] s/ [ TICKS/] MAJOR/ [ LENGTH/ ] I WARD.'.,
' [AXIS/] s/[TICKS/]MINOR.'		
' [AXIS/] s/[TICKS/]MINOR/SPACING.'		
' [AXIS/] s/[TICKS/]MINOR/PATTERN.'		
' [AXIS/]s/[TICKS/]MINOR/LENGTH.'		
' [AXIS/] 3/[TICKS/] MINOR/ [LENGTH/] OUTWARD.'.
' [AXIS/] s/[TICKS/]MINDR/[LENGTH/] INWASD.'.,
*	[AXIS/] s/NUMERIC. *	-
X" [AXIS/1 s/lNUMERIC/] TYPE.'		
r ' [AXIS/] 3/[NUMERIC/] EXPONENT.'		
X ' [AXIS/] s/[NUMERIC/] FRACTION.'		
' [AXIS/] s/[NUMERIC/] ANGLE.'	
' [AXIS/] s/[NUMERIC/l ANGLE/1 ST.'		
' [AXIS/] s/[NUMERIC/] ANGLE/2ND.'		
' [AXIS/] s/tNUMERIC/] OFFSET.'	
' [AXIS/] s/[NUMERIC/]WIDTH.'	
' [AXIS/] S/ [ NUMERIC/] WIDTH/MANTISSA.'	
' [AXIS/] 3/[NUMERIC/1 WIDTH/EXPONENT.'	
'DASH.'	
'DASH/SELECTOR.'	
- iii -

-------
4.75	'DASH/LENGTH.'		75
4.76	' DASH/CHARACTER.'		76
4.77	' DASH AX3LLAR-QU0TE.'	;				76
4.78	'DASH/PATIERN5.'			76
4.79	'DASH/PATIERNS/n.'		77
4.80	'LABEL.'		77
4.81	' IABEL/CONTROL.'		77
4.82	'LABEL/BUFFER.'		78
4.83	'lABEL/BUFFER/LENGTH.'	 . 73
4.84	'LABEVBUFFER/CONTEJJTS.'		73
4.85	'LABEL/BUFFER/NAMES.'			'		80
4.86	'LABEVttAME.'		80
4.87	'LABEL/DEFINITION.'		81
4.88	' LABEL/ [ DEFINITION/] SUPPRESSION. *		81
4.89	' LABEL/ [DEFINITION/ ] BASEFOINT.'		81
4.90	'LABEL/fDEFINITTON/JBASEPOINT/X.'	;		82
4.91	' LABEL/[DEFINITION/]BASEPOINT/Y.'		82
4.92	'LABEV [DEFINITION/] OFFSET.'		82
4.93	'LABEL/ [DEFINITION/] OFFSET A-'		82
4.94	'LABEL/[DEFINITION/] OFFSETA-'			83
4.95	'LABEL/[DEFINITION/] ANGLE.'		83
4.96	' LABEL/ [ DEFINITION/] OMTERING.'		83
4.97	'LABEL/lDEFINITION/] LINES.'		83
4.98	'LAEEL/[DEFINITION/] INDEX.'		84
4.99	'LINE.'		84
4.100	'LINE/MAXIMJM. '		84
4.101	'LINE/EC. *		85
4.102	'LINE/BUFFER.'		85
4.103	'LINE/BUFTER/LENGTH.'		85
4.104	' LINE/BUFFER/OONTENIS.'		86
4.105	'LINE/NUMBER.'		87
4.106	'LINE/DEFINITION.'				87
4.107	'LINE/ [DEFINITION/] SUPPRESSION.'		88
4.108	' LINE/ [DEFINITION/] CHARJCIER.'		88
4.109	'LINE/ [DEFINITION/] TEXT.'		88
4.110	' LINE/ [ DEFINITION/] LENGTH.'			89
4.111	'LINE/[DEFINITION/] INDEX.'		89
4.112	.'SECONDARY.'		89
4.113	' SEO0NDARY/GRAPH.'		89
4.114	'SECONDARY/USER.';		90
4.115	'SECONDARY/CURVE.'		90
4.116	' SECONDARY/DIMENSIONS.'		90
4.117	' SECONDARY/AXIS.'		91
4.118	'SBOONDARY/[AXIS/]s.'		91
4.119	' SECONDARY/ [ AXIS/] s/POS ITICN.'		91
4.120	' SECONDARY/ [AXIS/] S /TICXS. 		91
4.121	'SECONDARY/[AXIS/] s/NUMERIC.'		92
4.122	'SECONDARY/LABEL.'				92
4.123	'SEOONDARY/LABEL/b.'		93
5. EXAMPLES		95
5.1	EXAMPLE 1				96
5.2	EXAMPLE 2				98
- iv -

-------
5.3 EXAMPLE 3.
ICO
5.4	EXPMPLE 4	.		1Q-
5.5	EXAMPLE 5			1Q4
5.6	EXAMPLE 6	*	107
5.7	EXAMPLE 7	'//	1U
5.8	EXAMPLE 8	'	116
5.9	EXAMPLE 9	"	119
5.10	EXAMPLE 10	[	124
5.11	EXAMPLE 11	]	L3Q
5.12	EXAMPLE 12.	;		132
5.13	A FINAL EXAMPLE		135
6. MESSAGES						138
- v -

-------
AUTOGRAPH - THE UNABRIDGED WRITE-UP
January, 1985
David J. Kennison
NCAR, P.O. Box 3000, Boulder, Colorado 80307
l. nraoxcncN
This is the unabridged write-up of AUTOGRAPH - a graphics package enabling the
user to draw graphs, each with a labelled background and each displaying one
or more curves.
This write-up is divided into several major sections: The section "OVERVIEW"
presents the philosophy of the package and should eventually be read by any
serious user of AUTOGRAPH. The section "ROUTINES" describes the various rou-
tines in the package and how to call them. The section "PARAMETERS" describes
the "control parameters" which govern the behavior of AUTOGRAPH. The section
"EXAMPLES" contains a set of graphs produced by AUTOGRAPH and the programs
which produced them. The section "MESSAGES" describes the messages that
accompany the possible error exits.
Each major section is divided into titled paragraphs, which are further
divided into untitled paragraphs. In general, phrases like "the preceding
paragraph" or "the following paragraph" are to be interpreted to refer to a
titled paragraph.
Readers who wish only to quickly draw a siinple graph may want to skip to the
descriptions of the routines EZY, EZXY, EZM2f, and EZMXY, in the section "ECU-
TINES". Others may wish to look first at the examples.
AUTOGRAPH
- 1 -
INTRODUCTION

-------
2. OVHftTEW
This section describes the philosophy of AUTOGRAPH.
2.1	HCW TO DRAW A GRAPH. Tb draw a graph, a user program executes, directly
or indirectly, a series of calls to AUTOGRAPH routines, typically as follows:
1.	The routines AGSETP, AGSETT\ AGSETI, and/or AGSETC are called to reset
"primary control parameters" having unsatisfactory values.
2.	The routine AGSTUP is called to perform "set-up" tasks (thus the name).
It canputes appropriate values for the "secondary csntrol parameters".
3.	The routine AGBAOC is called to draw a background.
4.	The routine AGCURV is called cne or more times (crce per curve) to draw
the desired curves.
5.	The system-plot-package routine FRAME is called to advance to a new
frame.
Tb draw the next graph, all five steps are repeated; step 1 may, of course, be
abbreviated or emitted entirely.
2.2	A SIMPLER WAY TO DRAW A GRAPH. Each of the routines EZY, EZXY, EZMY, and
EZMXY performs a sequence of calls like that described above. A user program
-nay call EZY to graph a single curve defined by the points (I,Y(I)), for I
.ran 1 to N, EZXY to graph a single curve defined by the points (X(I),Y(I)),
for I frcm 1 to N, EZJC to graph the M curves defined by the points
(I,Y(I,J)), for I fran 1 to N and J from 1 to M* and EZMX? to graph the M
curves defined by the points (X(I) ,Y(I,J)) or (X(I,J) ,Y(I,J)) / for I frcm 1 to
N and J frcm 1 to M.
See the descriptions of these routines, in the section "ROUTINES". See also
examples 1 through 4, in the section "EXAMPLES".
2.3	THE AUTOGRAPH QGNTOQL PARAMETERS. The labeled carmen block AGCCNP con-
tains the AUTOGRAPH "control parameters", each of which controls seme aspect
of the package's behavior. Th^re are two types of these: "primary control
parameters" and "secondary control parameters".
Each primary control parameter has a default value and is subject to change by
a user program to produce a desired effect.
Each secondary oontrol parameter is computed by AUTOGRAPH itself and is not
normally subject to direct change by a user program. The values computed for
seme of the secondary control parameters may be of interest.
Access to all of the control parameters is provided by the routines AGSETP,
AGSETF, AGSETI, AGSETC, AGGETP, AGGETF, AGGETI, and AGGETC. (The routines
AICIM and DISPIA provide access to a limited subset of the control parameters
d are provided principally for historical reasons; they are of interest
-iinly to users of the routines EZY, EZXY, EZMY, and EZMXY.)
OVERVIEW
- 2 -
AUTOGRAPH

-------
In the following discussion, the long phrase "primary control parameter" will
usually be shortened to just "parameter".
2.4	GCX7IPCL PARAMETER NAMES. There are many groups of parameters. Each
group has a keyword associated with it - like BACKGROUND or GRAPH or AXIS.
Those graaps which contain more than one parameter are divided into subgroups,
each of vrfiich also has a keyword"associated with it. The subgroups may be
further subdivided in the same manner.
Group keywords are used to make up names of parameter groups and, ultimately,
of individual parameters. This is done by stringing together the grouD ke-. -
words, in descending order, separated by slashes and terminated by a period.
For example, the name 'AXIS.' refers to a group of 92 parameters describing
the four axes, the name 'AXIS/LEFT.' to a subgroup of 23 parameters describing
the left axis, the name 'AXIS/LEFT/NUMERIC.' to a further subgroup of 8 param-
eters describing the numeric labels on the left axis, and the name
'AXIS/LZTT/NLMERIC/TYPE.' to a single parameter describing the type of numeric
labels on the left axis.
Parameter-group names are used as arguments in calls to parameter-access rou-
tines to identify the parameter (s) whose values a user program wishes to "set"
or "get". For example/ the statement
CALL AGSETP ('AXIS/IZFT/NUMERIC/TYPE.',1.)
is used to set the value of the parameter specifying the type of numeric
labels to be used cn the left axis to "1.".
Parameter-group names may be shortened considerably, both by abbreviation of
the keywords and by emission of seme keywords; for example, the name shewn
above may be shortened to 'LE/TY.'.
Complete information about the control parameters and their names is given
below, in the section "PARAMETERS".
2.5	aanSGL PARAt£3SS ARB FLOATING-POINT. All of the control parameters are
floating-point - even those which serve as type specifiers, control flags,
itsn counts, list pointers, and the like - for which integer variables would
normally be used. This was done because of a portability problem which arose
in implementing the parameter-access routines.
Those parameters which may only have discrete integral values are referenced
internally using the FORTRAN function IFIX. For example: The parameter
'X/NICE.' corresponds to a variable in the cannon block AGCONP named QCEX,
which may have any of the values "-1.", "0.", or "+1.". The function
IFIX (QCEX) is used by AUTOGRAPH to recover the integer value.
Conceptually, sane parameters have character-string values; for example, the
parameter 'DASH/PATIERNA-' may, conceptually, have the value '$$$$$1$$$$$'.
Obviously, one must ccme up with a scheme which will allow any possible char-
acter string to be represented as a floating-point number. At one time, the
floating-point equivalent of the memory address of the character string was
used as the actual value of the parameter. This approach led to portability
AUTOGRAPH
- 3 -
CVEiv/IZW

-------
otcc'ier.s and has been abandoned in favor of the fcllrvi.-g: A character string
is tc beccrse the conceptual value cz a parameter is stashed in a
chacactec-string array inside AUTOGEAJE £nd a floating-point identifier which
will enable later retrieval of the string is stored as the actual value of the
psraretec. As it happens, such identifiers ire always negative; positive
values may therefore have other uses. For exairpLe, If 'ZfiSR/ZhTTESM/I.' has a
negative value, a character-stxiivg dash pattern is iinplied/ but, if it has a
positive value, a 15-bit binary dash, pattern is implied.
2.6 DSE CP EMftKEfflaa-ftOCSSS HXTTISCS. ssutzne AGStrP (AGGaTP) js called
by a user program to "set" {"get*) the floating-point values of a specified
group of related parameters.
The routine A.GSHTC Is -used to store a floating-point number as the value of a
single specified parameter, the routine AGGSTF to retrieve the floating-point
value of a sin?le specified parameter.
The routine AGSEIS is used to store the floating-point equivalent of an
integer as the value of a single specified parameter, the routine AGGETI to
retrieve the integer equivalent of the value of a single specified parameter.
the routine ASSEX is used to stoce a character string as the {conceptual]
value of a single specified parameter, the routine M3SJC to retrieve the
[conceptual} character-string value of a single specified parameter.
T.7 SIDE TSTEdS CP HftEWdER-SETTlHS. Setting certain individual parameters
results, as a side effect, in •special action" Zjy the routine AGSSTP. For
ax3izple, vrffeen ""BK3GR0UND.* i3 $iven a new value, other parameters are also
chanced to create the desired background. These side effects occur whether
&GSE2P is reached directly fran the user program or indirectly, hy way of a
call to cos of the routines AGSHTF, AGSZTI, oc WSSETC. 'They do not occur when
AGSKE is asis&d to set one of the paras>eters in question as part of a jrailfci-
parameter gresip, only irfien it is asked to set that parameter individually-
2,3 SAVING AND EESITDRI2JG 0&3CL35. Parameters whose values have beer, changed
by the user do not automatically revert to theit default values- Re-creating
the default state of MTOGBWS by resetting individual parameters can become
quite tedious, routines AGSAVE, which saves the current state of flfJTO-
GSAPH on a file, and AGRSTRr which restcces a sa%*ed state of AUTOGBAFK fran a
file, shcold be used instead. These routines axe described in the section
"scansES",
2.9 SPECIAL WHS 'TSBLLfl." AND 'NDLL/2.'. Zte parameters 'NULL/1.' and
'HULL/2.' define the special values "null 1" and "null 2", which have the
default values "1.E36* and "2.E3S", respectively. These special values are
used in a ocuple of ways:
• Certain paraaieters ray 
-------
"null 2".
Example: 'Y/KTNIMJM.', which specifies the minimum y coordinate, has
the default value "null 1", specifying that, for each graph, AUTOGRAPH is
to choose (by examining the data) an appropriate minimum y. This parame-
ter may be given an actual (non-null) value, thus imposing a desired
minimum y, or it may be given the value "null 2", specifying that AUTO-
GRAFH is to choose an appropriate minimum y for the next graph and then
use that value for following graphs.
• The value "null 1" is used in x/y coordinate data to signal missing
points.
Note: If your x/y coordinate data might include the values "1.E36" or
"2.E36", your program's first action should be to change the values of
'NULI/1.' and "NULL/2." to values which cannot possibly occur in the data.
2.10	TEE GRAPH WXMXW. The parameters 'GRAPH/LETT.', 'GRAPH/RIOT.',
'GRAPH/BOT*ICM.', and 'GRAPH/TOP.' serve to locate the edges of a rectangular
"graph window" within the plotter frame. The first two are stated as frac-
tions of the frame width, the seoond two as fractions of the frame height.
These parameters have the default values "0.", "1.", "0.", and "1., respec-
tively, specifying a graph windcw which fills the entire plotter frame.
The graph window is the area in which a graph, including labels, is to be
drawn. A user program may limit a graph to any selected portion of the
plotter frame. For example, changing the values of the parameters in the
group 'GRAPH.' to "0.", ".5", "0.", and ".5", limits a graph to the lower
left-hand quarter of the frame.
See example 6, in the section "EXAMPLES".
2.11	THE GRID WUCCW. The parameters 'GRID/LEFT.', 'GJUD/RIOTT.',
'GRID/BonCM.', and 'GRID/TOP.' serve to locate the edges of a rectangular
area within the graph windcw; the parameter 'GRID/SHAPE.' specifies the shape
of a "grid window", to be centered in, and made as large as possible in, this
area. The positions of the left and right edges are stated as fractions of
the graph-window width and have default values ".IS" and ".95"; the positions
of the bottcra and top edges are stated as fractions of the graph-window height
and also have default values ".15" and ".95". The parameter 'GRID/SHAPE.' has
the default value "0.", specifying a grid windcw which completely fills the
area specified by the other parameters. Other values allow one to specify a
grid windcw of any desired rectangular shape or of a shape implied by the x
and y coordinate data.
The grid window is the portion of the graph windcw along the edges of which
the axes are to be drawn and within which curves are to be drawn. Numeric and
informational labels are ordinarily placed in the portion of the graph windcw
which is outside the grid windcw. Various positioning parameters are stated
in a "grid coordinate system" based on the grid windcw and curve-point coordi-
nates are given by the user in a "user coordinate system1* which maps into the
grid window. If 'WINDCW.' has the value "1.", only those curve portions which
lie inside the grid windcw are drawn. Character sizes and label-offset
AUTOGRAPH
- 5 -
CVEF7TIW

-------
distances are specified as fractions of the smaller dimension of the grid win-
jw, so as to be in scale with the rest of the graph.
See example 7, in the section "EXAMPLES".
2.12	TEE GRID C0QTOINA32 SYSTH4. Internally, AUTOGRAPH makes use of a "grid
coordinate system"; the user also makes use of this system at times in setting
certain parameter values. The origin of the grid coordinate system is at the
lower left-hand corner of the grid window. X coordinates nan linearly fran
"0." to "1." horizontally, and y coordinates linearly from "0." to "1." verti-
cally, in the grid window. Note that coordinate values outside the range
(0., 1.) may be used to reference points outside the grid window.
2.13	TEE USHl COORDINATE SYSTEM. Curve-defining points are stated by a user
program in the "user coordinate system". Fourteen parameters specify how that
user coordinate system is mapped into the grid window. (The parameter
'INVERT.', described below, might be considered a fifteenth.)
The first seven of the fourteen, named 'X/KTNIMLM.', 'X/fcAXIMUM.',
'X/LOGARITHMIC.', 'X/OFDER.', 'VNICE.', 'X/SMALLEST.', and 'X/LAEGEST.',
specify how user x coordinates are to be mapped onto the horizontal axis of
the grid window. The default values of these parameters are such that the
routine AGSTUP is forced to:
*	Canpute, fran the user's x-coordinate data, minimum and maximum values Xm
and XM.
*	Compute "nice" (rounded) values an' and XM' such that the interval
(Xm,XM) is oanpletely contained in the interval (Xm',XM').
•. Map Xn' to the left edge, and XM* to the right edge, of the grid window.
The mapping is linear.
The other seven parameters, named 'Y/famiMUM.', "Y/MAXIMUM.', etc., specify
how user y coordinates are to be napped onto the vertical axis of the grid
window. The default values specify a mapping analogous to that of x coordi-
nates.
By changing the values of these fourteen parameters appropriately, a variety
of desirable ends may be achieved:
*	Values of Xn, XM, YSn, and/or YM may be specified, thus limiting the graph
to a particular range of interest and/or forcing consistent scaling of a
group of graphs. If the selection of these values is left up to AUTO-
GEAPH, a range of acceptable values may be specified.
*	Either or both mappings may be made logarithmic. (The logarithms of
coordinate values are mapped linearly onto the axis.)
*	Either or both mappings may be flipped end-for-end. X coordinates may be
made to decrease fran left to right", y coordinates to decrease fran bot-
tan to tcp.
CVEHVTEW
- 6 -
AUTOGRAPH

-------
• The rounding process for either or both mappings may be suppressed, forc-
ing curves to be plotted full-scale.
See examples 6, 7, and 8, in the section "EXAMPLES".
2.14	acw TO ©APH "X AS A FUNCTION CF Y*. The parameter 'INVEST.' has the
default value "0.". If it' is set to "1." by a user program, the routines
AGS TOP and AGCURV will behave as if their x and y arguments had been inter-
changed. In sane sense, this provides a way of plotting "x as a function of
y".
T*us parameter is of principal interest to the users of EZY, EZXY, EZMY, and
EZMXY; those users who call the routines AGSHJP and AGCURV directly should
probably leave the parameter zeroed.
See example 8, in the section "EXAMPLES".
2.15	WHAT A BflCXGRCQD CCNSISTS CP. A background drawn by the routine AGBACX
consists of four axes and up to eight informational labels, each of the latter
having ncne or more lines of text; the total number of such lines must not
exceed sixteen. Each of these entities is defined by a group of parameters
and may be modified in a variety of ways.
2.16	THE ECOR AXES. The four axes are positioned along the edges of the grid
window. There are a left y axis, a right y axis, a bottan x axis, and a top x
axis. Each of the axes consistS"of a line, major tick marks, minor tick
marks, and numeric labels. Numeric labels are placed at major-tick-mark posi-
tions.
T^e axes are defined by the parameter group named 'AXIS.', which has subgroups
'AXIS/LEFT.', 'AXIS/RIGHT.', 'AXIS/BOTTOM.', and 'AXIS/TOP.'. Each'of these
subgroups contains 23 parameters defining one of the four axes. These 23
parameters fall into six further subgroups, having the associated keywords
CONTROL, LINE, INTERSECTION, FUNCTION, TICKS, and NUMERIC.
The default values of the axis parameters specify a "perimeter" background:
All four axes are drawn; each has short, inward-pointing major and minor
ticks; the left axis and the bottom axis have numeric labels (placed outside
the grid window); the right-axis and top-axis numeric labels are suppressed.
See examples 1 through 4, in the section "EXAMPLES".
A "half-axis" background is created by suppressing the right axis and the top
axis completely. A "grid" background is created by extending the left-axis
and bottan-ax is ticks all the way across the grid window and suppressing the
ticks on the other two axes. The parameter 'BACKGROUND.' allows the user to
create these standard backgrounds easily; whenever its value is changed by a
user-program cadi to AGSETP, AGSETF, or AGSETI, parameters in the group
'AXIS.' are modified to create the desired background. See examples 5, 6, and
8, in the section "EXAMPLES".
2.17	ABBREVIATES HTRK CF AXIS-EARAMETER NAMES. In the ensuing discussions of
the various parameters in the group 'AXIS.', the character "s" is used to
stand for any one of the keywords "LEFT", "RIGHT", "BOTTOM", or "TOP". For
AUTOGRAPH
- 7 -
OVERVIEW

-------
oxairole, "AXIS/s/LINE.' stands for any one of 'AXIS/LEFT/LINE.',
iXlS/RIGHT/LINE.'/ etc. This form is shorter and makes it clear that four
fferent parameters or groups of parameters are being described at once.
2.18 nre PARAMETER 'AXXS/s/CXNTPCL.'. This parameter may be given any
integral value frcn "-1." to "+4.".
•	The value "-1." specifies that cnly the line portion of the axis speci-
fied by "s" is to be drawn.
•	The value "0." specifies that no portion of the axis is to be drawn.
•	A value from "1." to "4." specifies that all portions of the axis are to
be drawn and tells AUTOGRAPH what liberties it may take in attempting to
ccpe with numeric labels which will not fit along the axis without over-
lapping .
The precise meanings of each value are described in the section "PARAMETERS".
2.Id TEE PARAMETER 'AXIS/s/LDE.'. This parameter has the default value
"0.". Setting it to a "1." causes the line portion of the axis specified by
"s" to be suppressed. Tick marks and/or numeric labels may still be drawn.
2.20	JCVING AN AXIS. Both of the parameters
'AXIS/s/INTERSECTICN/GRID.'
'AXIS/s/INIERSrCTICN/USER.*
have the default value "null 1", specifying that the axis "s" is to be drawn
in its normal position, along the edge of the grid window. If either parame-
ter is given a non-null value, the axis "s" is moved away frcra its normal
position in such a way as to intersect the sides of the grid which are perpen-
dicular to it at a point specified by that non-null value. Tb move an x axis,
a y coordinate is specified; to move a y axis, an x coordinate is specified.
The coordinate may be specified in the grid coordinate system or in the user
coordinate system, depending on which parameter is used. If both parameters
are given non-null values, the user-system value takes precedence.
No axis may be moved outside the graph window. Attempting to do so moves the
axis as far as the edge, but no farther.
See example 8, in the section "EXAMPLES".
2.21	TEE "LABEL COORDINATE SYSTEM" ALCNG AH AXIS. Each of the four axes has
associated with it a "user" coordinate system (as described above, in the
paragraph "THE USER COORDINATE SYSTEM") and a "label" coordinate system. The
routine AGUTOL defines the relationship between the two coordinate systems for
each of the four axes.
Tick marks are positioned at "nice" values in the label coordinate system,
^apped to the user coordinate system, and then mapped onto the axis. Numeric
xabels axe associated with major ticks and provide values in the label
OVERVIEW
- a -
AUTOGRAPH

-------
coordinate system.
The default version of AGUTOL defines the label system cn each axis to be
identical with the user system; a private version may be substituted in oiace
of the default in order to change the label coordinate system for any one or
more of the four axes.
Example: Suppose that the y-ooordinate data is in miles/hour and it is desired
that the left y axis be tick-marked and labeled in meters/second. The user
program must include a subroutine AGUTOL with five arguments (four input, one
output) / as follows:
1.	the number of the axis being drawn (1, 2, 3, or 4, implying the left,
right/ bottan, and top axes, respectively).
2.	the value of 'AXIS/s/TUNCnCN.' for that axis.
3.	an integer specifying whether to map from the user system to the label
system (+1) or vice-versa (-1).
4.	an input value in one coordinate system.
5.	an output value in the other system.
The user routine must/ for the left axis only, multiply the input value by the
appropriate constant and return the result as the output value; for all other
axes, it must return an output value equal to the input value.
It is recommended that the default value of "AXIS/s/FUNCTICN.' (zero) be used
to imply that AGCJTOL should do the identity mapping for the axis "s"; other
values may be used to select desired mappings. This gives a way to "turn off"
the use of a special mapping for a given axis.
Note that the tick-marking and labeling of one x (y) axis of a graph may be
canpletely different fran that of the other x (y) axis of the graph. For
example, the left y axis could be made to indicate "height in kilometers" and
the right y axis "pressure in millibars".
See example 7, in the section "EXAMPLES".
2.22 POSITIONING CP MAJOR TICK MBKS CM AN AXIS. The parameter group named
' AXIS/s/TICXS/toAJOR/SPACING.'
contains three parameters, with associated keywords TYPE, BASE, and COUNT.
These parameters are described in detail in the section "PARAMETERS". Major
tick marks may be spaced linearly or logarithmically in the label coordinate
system along the axis specified by "s", or suppressed altogether. Each of the
TYPE and BASE parameters has the default value "null 1", allowing AUTOGRAPH to
position major tick marks as it sees fit.
See examples 7 and 8 and the final example, in the section "EXAMPLES".
ALTTOGPAPH
- 9 -
CVE-7TZW

-------
2.23 APPEARANCE CF MAJOR TICK MftRKS. The parameter
"AXIS/s/nC
-------
2.26	TYPES OP NCMERIC UMBELS. The parameter naned 'AXIS/sNUMERICAV?e:.' ma^
be given any integral value £ccro "0." to "3." oc one of the values "null*I" cr
"null 2".
•	The value "Q." suppresses numeric labels cn the axis specified by "s".
•	The values *1.", "2.", and "3." specify the use of "scientific notation",
"exponential notation", and "no-exponent notation", respectively.
•	A null value gives AUTOGRAPH the freedom to use one of the values "1.",
"2.", or "3." - whichever is most consistent with the label coordinate
system along the axis.
The exact nature of the labels produced by a given value depends cn the three
parameters
" AXIS/s/TICKS/MAJOR/SPACItJG/TYPE .'
'AXIS/s/ttMMC/tXPCNENT. *
' AXIS/s/MJMERIC/FBACnCN.'
See example 7 and the final example, in the section "EXAMPLES".
2.27	QRianailCH a? HWERJC UEELS. The parameters
'AXIS/s/t04ERIC/ANGL2/lST.'
'AXIS/S/^UKERIC/ANGLE/2HD.'
may have integral values "0.", "9Q.", "180.", or "270.". They specify the
user's first and second choices for the orientation of numeric labels on th^
axi3 specified by "s". AUTOGSAPH will attempt to use the first choice
(default value - "0.* foe all axes); if that leads to overlap problems and
shrinking the labels either doesn't help or is not permitted and rotation is
permitted (by the setting of 'AXIS/s/CONTROL.'}, AUTOGRAPH may try the second
choice (default value - "90." for all axes).
The values given represent angles measured in degrees counter-clockwise from
horizontal.
2.2a rcsmcHING CP WMERIC LABELS. The parameter
' AXIS/s/*TOKEaiC/CETS2r.'
specifies cn which side of the axis specified by "s" the numeric labels are to
lie and the size of the gap to be left between the axis line and the numeric
labels.
•	A negative value specifies labels inside the grid window.
•	A zero value specifies labels centered on the axis, suppresses the Line
portion of the axis, and moves the inward-pointing and cutward-pointing
portions of ticks out away frcra the axis so as to leave room for the
labels.
AUTOGRAPH
- 11 -
CVe»-.v

-------
® A positive value specifies labels outside the grid window.
The magnitude of the value specifies the distance fran the axis to the nearest
portion of the label, stated as a fraction of the smaller side of the grid
window.
The default value for all axes is ".015".
2.29 CHARACTER SIZES IN NCMERIC IAEEXS. The parameters
' AXIS/s/NUMEMCATIDTHAIANTISSA. '
' AXlS/s/tOlERIC/toTH/EXPCNENT.'
specify tr.e widths of characters in the mantissa and exponent portions of the
numeric labels on the axis specified by "s", stated as fractions of the
smaller dimension of the grid window.
The sizes specified are those desired by the user. If an overlap problem
arises and 'AXIS/s/CONTROL.' is set so as to allow AUTOGRAPH to shrink the
numeric labels, the characters may end-up smaller than desired. No character
is shrunk to less than the minimum readable'size, however.
These parameters have default values ".015" and ".010", respectively, for all
axes.
?.30 IHTOIWATICNAL IAEELS. As many as m informational labels may be defined
at arty one time; normally, m * 8. The informational labels form a part of the
background produced by a call to the routine AGBA3C. Each of the informa-
tional labels is defined as follows:
•	Each label has a name - a short character string which uniquely identi-
fies the label.
•	Each label has a "suppression flag", which may be set to enable or dis-
able plotting of the label.
•	Each label is positioned relative to a "basepoint", whose x and y coordi-
nates are specified in the grid coordinate system. Normally, the
basepoint lies on ere edge - but not at a corner point - of the grid win-
dew.
•	Enanating from the label basepoint is an "offset vector", whose x and y
components are specified as signed fractions of the smaller dimension of
the grid window. Normally, the offset vector is used to specify the size
of the gap to be left between an informational label and the edge of the
grid window. The presence or absence of an axis alcng that edge of the
grid window is ignored when specifying this gap; see the paragraph "BACK-
GROUND OVERLAP PHCBLE*S", below.
•	Bnanating fran the end of the offset vector is a "baseline", whose direc-
tion is specified as an angle in degrees ("0.", "90.", "180.", or "270.",
measured counter-clockwise from horizontal). The text lines of a label
are written parallel to, and in the same direction as, the baseline.
OVERVIEW
- 12 -
AUTOGRAPH

-------
•	A centering option for each label determines whether the left edges, the
centers/ or the right edges# of the text lines are aligned with the end
of the offset vector.
Each label may contain cne or more text lines {cr none). The total number of
text lines in all labels must not exceed n - normally, n a 16. Each of the
text lines is defined as follows:
•	Each text line has an integral position number which distinguishes it
frcm every other line in the same label. Multiples of "100." are recom-
mended. Lines with positive position numbers axe drawn above the label
baseline, lines with negative position numbers below the label baseline.
A line with position number "0." is centered en the label baseline.
"Above" and "below" are defined here from the viewpoint of a reader of
the label. The position numbers of the lines in a label specify the
order in which the lines appear - strictly decreasing frcm top to tot tan
- but do not determine the interline spacing, which is set by AUTOGRAPH
itself.
•	Each line has a "suppression flag"/ which may be set so as to enable or
disable drawing of the line.
•	Each line has a character-width specifier, stated as a fraction of the
smaller dimension of the grid window.
•	The text of each line is defined by a character string and a count of the
number of characters in the string - normally determined by AUTOGEAPH
itself.
Note: The (EDITOR-style) string replacements
* FLI2 (10,3) * =»"FLLB (10 ,m)'
¦*QBIM / 8.'-'QBIH / m.'
where m is greater than or equal to 5, may be applied to the AUTCGFAPH source
file to provide foe a maximum of m labels. Similarly, the string replacements
'FLLN(6,16) '»'FLm(6,n) *
"QNIM / 16.'-'QNIM / n.'
where n is greater than or equal to 5, may be applied to the AUTCGFAPH source
file to provide for a maximum of n lines.
2.31 TEE PSEtETOCD LABELS. The section "PAFAMETEFS" describes in detail
four "predefined* labels, named 'R', 'L', 'B', and 'T*. Each of these labels
lies along one of the four edges of the grid window - the left edge, the right
edge, the bottan edge, or the top edge.
The predefined labels greatly simplify the task of -jsnerating labels along the
edges of the grid window. For example, if you want a "header label" above the
grid window, you need only specify the desired^character string to define the
text of line number "100." of the label named 'T*.
AUTOGRAPH
- 13 -
CVErVIEW

-------
"^.e default definitions of the predefined labels specify a label reading "x"
low the grid window and a label reading "Y" to the left of the grid window.
.e examples 5 and 7 and the final example, in the section "EXAMPLES".
2.32	THE PARAMETER GROGP 'IABEL-'. The parameter group 'LABEL.' contains
lCm+3 parameters - normally, m =* 8. Together with the parameters in the group
'LIME.", they define the informational labels to be drawn by a call to the
routine AG3AC<. The parameters in the group "LAREL." are as follows:
•	The parameter "LABEL/CONTROL." may be given the value "-1." to delete all
currently-defined labels, the value "0." to temporarily disable the draw-
ing of labels, the value "1." to enable the drawing of labels and prevent
the shrinkage of labels when overlap problems arise, or the value "2." to
enable the drawing of labels and allow shrinkage. The default value is
"2.". See examples 5 and 6, in the section "EXAMPLES".
•	The parameter 'LABEL/BUFFER/LENGTH." should not normally be set by a user
program. Its value is in, the maximum number of labels AUTOGRAPH can han-
. die.
•	The subgroup 'IJ®EL/BUFET3/ODNTI2JTS.'' consists of 10m words, in which the
label definitions are stored. Normally, a user program should not
attanpt to store values in this block directly. See the paragraph "HOW
TO ACCESS A LABEL DEFINITION", below.
•	The parameter 'LABEL/NAME.* is used in the process of accessing a label
definition. It functions as a switch, pointing to the label definition
currently being accessed.
See examples 5 and 7 and the final exanple, in the section "EXAMPLES".
See the section "PARAMETERS" for further information about these parameters.
2.33	TEE EARAMETER GRCGP 'LINE.*. The parameter group 'LINE.* contains 6n+4
parameters - normally, n » 16. They define the lines belonging to the various
labels. The parameters -in the group "LINE.* are as follows:
•	The parameters *LINE/*4AXIMUM.* and *LINE/END.' define the assumed maximum
line length (default - 40 characters) and the line end character (default
- '$'}. These parameters cane into play when a user program defines the
text of a line. The character string tendered by the user is assumed to
be of maximum length? if it is really shorter than that, it must be fol-
lowed by the line end character. See example 8 and the final example, in
the section "EXAMPLES".
•	The parameter 'LINE/BUFFER/LZUGTH.' should not normally be set by a user
program. Its value is n, the maximum number of lines AUTOGRAPH can han-
dle.
•	The subgroup 'LINE/BUFFEF/CCNTIOTS.' consists of 6n words, in which the
line definitions are stored. Normally, a user program should not attempt
to store values in this block directly. See the paragraph "HCW TO ACCESS
OVERVIEW
--14 -
AUTOGRAPH

-------
A LINE DEFINITION", below.
® The parameter LIJ,iE/NtS,iHER, is ussd In the process cf accessing a. "re
definition, it functions as a switch* painting to the line definition
currently being accessed.
See the section "PARAMETERS" for further information atcut tbsss pacemetsrs.
See examples 5 and 7 ar.d the final example, in the section "EXAMPLES".
2,34 WC2SS33C A USSEL EEFTNXTICN. lb access a label definitionf a user pro-
gram nuat first execute an AGSETC call to stoce the name of the label as the
value of 'LASZL/TfflME.J. Such a call does not actually store the name as the
value of that parameter. Instead/ it causes the label buffer to be searched
for the definition of the named label. If that definition is not found, a
default definition is made up and inserted in the label buffer. In any case,
the index of the definition is floated and stored as the value of the parame-
ter "LAEEVUAME. '.
Cnce "LflEEI/ilAiME.** has been sat in this manner> the parameter group name
' LABEL/DEFINITION.' and subgroup names of the form 'LRBEL/DEFINITICN/. *. * may
be used to access the parameters defining the label. These parameters are as
fellows;
*	The parameter 'LABEI/EEFINlTTOJJ/St.TPBESSICN. * nay be given the value *-
2." to delete the label and all of its lines, the value "-l." to delete
the lines of the label but leave the label itself defined, the value "0."
to enable drawing of the label, and the value *1.* to temporarily
suppress drawing of the label. It has the default value *0.". when a
label is deleted, 'LfiBEL/toAME.* and 'LD-E/MUMBER.' hectare undefined;
similarly, when the lines of a label are deleted, 'LINE/WJMBE-LJ becanes
undefined.
•	The parameters "LABEL/EE?INITICH/BA5EP0IOT/X.' and	specify the
coordinates, in the grid coordinate system, of the label's basepoint.
Hie default basepoint is (.5,.5).
*	the parameters *I^EL/DEFINIT1CN/C£TSET/X.' and "...Y.* specify the com-
ponents of the label's offset vector, as signed fractions of the smaller
dijnension of the grid window, The default vector has zero ccmponents.
•	The parameter ¦'LflBEI/DEFINrTTCN/AMGLE.¦" specifies the angle	"90.",
"180.*, or "270.") at which the label's baseline emanates fran the end of
its offset vector. The default angle is "O.".
•	The parameter 'LASEI/DEFINiTlCM/CHSrrER.' has the value "-1." to align the
left ends, the value "0." to align the centers, and the value "+1-" to
align the eight ends, c£ the lines of the label with the end of its
offset vector, the default value is w0.".
*	The parameters 'W£EI/CEFINITICtf/UNES.' and 'I^BEL/DEFINITICN/UCO.'
are not normally set by a user program; they are 'maintained by "AUTOGRAPH.
The fomer specifies the number of lines belonging to the label and the
AUTOGRAPH
- 15 -
OVERVIEW

-------
latter specifies the index Un the line bytffes'j of the definition of the
first ILis belonging to tee label. A default label has no lines - both
of these parameter's are zerced.
Se^ the -section "rAErtMECESS" for further information about these piranetsts.
See examples 5 and 7 and the final example, in the section *ZXRMFLES".
2.35 JPOC2SS3NG A LEE flEFXHrTICH. Tc access the -definition of cne of the
lines of a label, a user prccrant must first access tfce label definition by
setting	as described above. Then, it must execute an AGSET?
 call to store the number of the desired Line as the value of
"LINE/NUFEER.' * Such a call does not actually store the specified nuirber as
the value of that parameter. Instead, it causes the line buffer to be
searched for the definition of the desired line. It that definition is not
found, a default definition is made upr ir.se rsei £& the line buffer, and added
to the linked list of definitions of lines belonging to the label. In any
case, the index cf the definition is floated and stored as the value of
'LDE/KBfiER.J.
Cncs *LI^4?UfS£3. "* has been set in this mann.ee, the parameter group narce
' LTKE/EEPINOTCN. * and subgroup nanes of the form 'LINE/DEFINITION/..may be
used to access the parameters defining the line, these parameters are as fel-
lows;
« The parameter 'LIJffi/KFIlirriCK/SUPFESSStaH.' say be given the value "-i."
tt> delete the line# the value "0," to enable drawing of the line, and i\s
value	to tasorarilj- disatis- dialing cf ting lire. It has the
default valce "0. ". Hhen a lijse is deleted, "XJMEVM3KBE3L' beecnes ortge-
fined-
*	The parameter 'LIHE/DEFIvrmOT/CHAI^n^-J^rDW,' specifies the desired
width of each character in the line, stated as a fraction of the smaller
dimension ct the grid window. SS.e default width is **015*-
*	The parameter ""LIHE/QEFrtriTlCK/lExr.'' identifies the character string
caaprising the text of the label. Ihs default value is a single blanfc.
*	The parameter 'Lns/tSEFINITICtf/LaJGIH.* specifies the length of the char-
acter string, me default value is a *1.*.
*	The pacarastsE "LINE/EEFINmON/TtC£X." is not normally set by a user ore-
gran. It is maintained by flETCGRAPH and specifies the index (in the line
buffer) of tie next tine belonging to the label.
See the section. "PfcSAMETERS* for further information about these parameters.
See exanples 5 and 7 and tfce final example, in the section •EXAMPLES".
Itotef As a ccswertience to the user, an AGSETC call to set
'LIt£/I^IMnTGt.7!EX?.' sets both the parameters defining the te*t of the
afcel - "...TEXT." and *...LENGTH."* - the latter being computed by examining
-he string. The string mst be no longer than the length specified by the
/alue of "LINE/MAZIIEK."' and, if shorter, it must be followed by the
OTEWiHW
-Li *
fllTOGHAPH

-------
"JISE/Q©-" character.
2,35 TEE LABEL BOXES. Each informational label is considered to lie in one
of six "label boxes*, as follows;
•	3c* 1 lies to the left of the grid window. It contains all labels which
have a baseooint en the left edge of the grid window and a leftward-
pointing offset vector-
•	Bo* 2 lies to the right of the grid window, it contains all labels which
have a fcasecoint cn the right edge of the grid window and a rightward-
pointing offset vector.
•	Box 3 lies below the grid vi/x?cw. It contains ail labels which have a
basspoint on the cotton edge of the grid window and a downward-pointing
offset vector.
•	Bo* 4 lies above the grid window. It contains all labels which have a
basepoint on the tcp edge of the grid window and an upward-pointing
offset vector.
•	Box S lies in the interior of the grid window. It contains all labels
which have a basepoint an same edge of the grid window and an inward-
pointing offset vector.
•	Box S savers the entire grid window and contains all of the remaining
labels.
Three restrictions rmst be observed by the user: First, no label's basepoinfc
may have coordinates (Q.,Q.|# (Q.,1.), (l.,Q.)r or	these corner
points aast be avoided. Second, no portion of any label in boxes 1 through 4
may lie inside: the grid window. Third, no portion of any label in box 5 may
lie outside the grid windev.
The label-bo* concept is important in handling overlap problems, which are
discussed in the next paragraph.
2.37 SKXGKXXC OfZZLAP PROBLEMS, ^.e responsibility for avoiding background
cverlap problems might reasonably have been placed squarely cn the shoulders
of the user, except far one unpleasant fact: numeric labels are unpredictable
critters- Accordingly* 3JJTCGFUJPH accepts a part of the burden-
In attesting to Keep the numeric labels cn a given axis fraa overlapping each
other, AUTOGRAPH may shrink and/or reorient them. Either or both of these
actions nay be suppressed by the user by resetting 'AXIS/s/CCWTPOL.'. I£ a
prcblen still exists, seme of the labels may be emitted - perhaps leaving enly
every seocrd or.e, every third one, every fourth one, etc.
Informational labels are positioned by the user alcr.g the edges of the grid
window as if numeric labels did not exist. AUTOGRAPH takes the follcvirg
actions in attempting to prevent the informational labels fran eve clapping the
numeric labels on any axis:
AUTOGRAPH
- 17 -
avtss/isw

-------
1.	Box 1 labels (to the left of the grid window) are roved leftward, box 2
labels (to the right of the grid window) are moved rightward, box 3
labels (belew the grid window) are moved downward, box 4 labels (above
the grid window) are roved upward, and box 5 labels (inside the grid win-
dow) are moved inward. Box 6 labels are not roved.
2.	If, during step 1, a label is shoved outside the graph window by the
numeric labels on seme axis, those numeric labels may be shrunk and/or
re-oriented, as allowed by the user's setting of 'AXIS/s/CCNTROL.'.
3.	If one or more of the labels in a given box still lies partly outside the
graph window, the labels in that box may be shrunk, depending on the
current setting of 'IABEL/CONTROL. *. Each label in the box shrinks
toward the end of its offset vector.
4.	If one or rore of the labels in boxes 1 through 4 still lies partly out-
side the graph window, all of the labels in that box may be moved inward,
shoving numeric labels-ahead of them - onto, and perhaps across, an axis.
The algorithms used to do all of this are not perfect; if pushed too severely,
they may fail to produce an esthetically pleasing or even minimally acceptable
qraph. In such cases, the user must take remedial action.
Note: None of the actions described above modify any of the parameters except
'AXIS/s/NUMERIC/ANGLE/lST. *, which may. be negated by subtracting a multiple of
''360.". Also, no label is shrunk to less than a readable size.
.38 DASHED-LINE EAl'liltNS FOR UJKVtS. The subroutine fCZUHV draws curves
(one per call). It does this by issuing calls to the routines DASHD, FRSTD,
VECTD, and IASTD, in the DASHCHAR package. Each curve may thus be drawn using
its own particular dashed-line pattern. One of AGCUKVs arguments, called
KDSH, specifies the dashed-line pattern to be used for a given curve:
•	If KDSH is zero, the caller is assumed to have done his own call to
DASHD. AGCUKV does not call it.
•	If KDSH is non-zero, A3CUFV calls DASHD.
•	If KDSH is positive, its'value (modulo n) specifies one of n "user" pat-
terns, defined by the parameter group named 'DASH.'. See example 7, in
the section "EXAMPLES".
•	If KDSH is negative, its absolute value (modulo 26) specifies one of 26
"alphabetic" patterns. The curve is drawn using a solid line which is
interrupted periodically by the selected letter of the alphabet. See
example 8, in the section "DCAMPLES".
The nature of the "user" set of dashed-line patterns is discussed in the next
paragraph.
!.39 THE PARAMETER GMJUP 'DASH.'. The following parameters all belong to the
roup 'DASH.':
OVERVIEW
- 18 -
AUTOGRAPH

-------
•	The parameter 'DASH/SELECTOR. * specifies the type of dashed-line pattens
to be used by the routines EZMY and EZMXY (E2Y and EZXY always use the"
First of the "user" patterns). If the value of 'DASH/SELECTOR.* is zero
or negative, the alphabetic set of (26) dashed-line patterns will be
used; if its value is positive and has magnitude "n", then the first "n"
of the "user" patterns will be used. The default value is "1.".
•	The parameter 'DASH/LENGTH.' specifies the assumed length of character-
string dashed-line patterns; it must be set to the proper value prior to
any AGSETC call setting ore of the "user" dashed-line patterns
'DASH/PATIERN/n.'. The default value is "8.".
•	The parameter 'DASH/CHARACTER.' specifies the curve length devoted to a
character other than a dollar sign or a quote in a character-string
dashed-line pattern, stated as a fraction of the snaller side of the grid
window. The default value is ".010".
•	The parameter 'DASH/DOLLAR-CU3TE.' specifies the curve length devoted to
a dollar sign {a solid section of the line) or a quote (a gap in the
line), stated as a fraction of the snaller side of the grid window. The
default value is ".010".
•	Each of the parameters 'DASH/PATTERN/1.', 'DASH/PATTERN/2.', etc., up to
'DASH/PATliIKN/26.' defines cne of .the dash patterns in the "user" group.
Either of the routines AGSETI or AGSETT may be used to give cne of these
parameters a positive integral value between 0. and 65535., inclusive, in
which case the low-order 16 bits of it are interpreted as a dash pattern;
the 0 and 1 bits represent "pen-up" and "pen-down" segments three plotter
units long. The routine AGSETC may be used to (in effect) store a char-
acter string (of the length specified by 'DAST£/LENGTH.') as the value of
one of these parameters. In such a character string, a quote represents
a "pen-up" segment, a dollar sign represents a "pen-down" segment, and
every other character is simply drawn as a part of the line. The default
value of all 26 parameters is "65535.".
See examples 7 and 8, in the section "EXAMPLES".
2.40	PATTERNS	BY EZY, EXT, EZXB, AND EMCf. Each of the routines EZY
and EZXY, which draw cne curve per call, calls AOCUHV with KDSH equal to 1,
specifying the use of the first of the "user-defined" set of dashed-line pat-
terns (default - a solid line) for the single curve to be drawn.
Each of the routines EZMY and EZMXY, which draw cne or more curves per call,
calls AGCUEV with KDSH equal to ISI(2l(I,IDSH), where I is the number of the
curve being drawn and IDSH is the integral value of 'DASH/SELECTOR.'. This
parameter has the default value "1.", specifying the use of the "user" set of
dashed-line patterns (default - solid lines); the value "-1." specifies the
use of the "alphabetic" set.
2.41	WINDOWING CP CORTES. The parameter 'WINDOW.' has the default value
"0.". If it is set to a "1." by a user program, corves subsequently drawn by
the routine AGCUHV are "windcwed". This means that only those portions lying
inside the grid window are drawn; the effect is as if one were viewing the
AUTOGRAPH
- 19 -
CVERVTEW

-------
rjrve through an actual window,
ee example 7, in the section "EXAMPLES".
2.42	USE CP EWRITX BY ADTOGRAPH. Normally, the routine PWRIT is used for all
characters drawn by AUTOGRAPH. Actually, a routine AGEWET is called; the
default version of that routine just passes its arguments cn to EWRIT. Trying
to use FWRTTX instead poses sane problems. Because "function oodes" may be
used in a text string passed to EWRITX, the length of the string cannot be
taken to match the actual number of characters to be drawn; moreover, PWRITX
dees not use the same plotter width for each character in a string. Thus,
AUTOGRAPH cannot properly predict where ch a graph a label drawn by EWRITX
lies, which interferes with its handling of overlap problems; also, strings
which are positioned relative to an end-point may not be properly aligned.
Nevertheless, there is a way to use EWRITX. The XLIB file AGUFWRITX contains'
a version of AGFWKT which does it. A string which is centered relative to a
given position (like the "x-axis label", the "y-axis label", or the "graph
label") is drawn directly, in its entirety, by EWRITX, and may therefore con-
tain function codes to get Greek characters, subscripts, superscripts, etc. A
string which is positioned relative to cne end (which includes all numeric
labels) is drawn by passing one character at a time to EWRITX, so that the
same plotter width will be used for each; function oodes uust not be included
in such strings. The results, while not as pleasing as cne would normally
expect frcm PWRITX, are more than just acceptable.
">n the Cray, use the follcwing JCL to get the source for this version of
aGEWRT and compile it, so that it will replace the default version:
GETS PC, LIB=XLIB, FILE»AGUFWRITX, L=UFWRTX.
CrT,I=UPWm,L=0.
In my opinion, the "duplex" character set of PWRITX is far superior to the
"oanplex" set. At present, one uses it by incorporating the following oode at
the beginning of one's program, prior to any call to EWRITX (directly or
indirectly):
CCM-EN /PUSER/ MJDE
• • •
• • •
JODE - 1
2.43	VARYING INEH6ITIES, COLORS, ETC.. Three routines - AGCHAX, AGCHCU, and
AGCHIL (the default versions of which do nothing) - are provided solely to be
replaced by the user; the replacement versions may change intensities, line
widths, colors, line styles, etc., for selected portions of a graph. Each is
called just before an object is to be drawn and again just after it has been
drawn, with arguments enabling the user version to completely identify what
the current situation is and to make the appropriate calls. AGCHAX handles
objects which are parts of axes, AGCHCU handles curves, and AGCJIL handles
informational labels.
«e the descriptions of these routines, in the section "2CUTINES".
OVERVIEW
- 20 -
AUTOGRAPH

-------
2.44	mf-STSNDAKD NUMERIC LABELS. The routine AOCHNL (the default version of
which does nothing) is called just after the character form of a numeric label
has been constructed and just before it is to be drawn. The user may sucply a
version of this routine to transform selected tumeric labels in any desired
fashion and return then to AUTOGRAPH. This feature may be used to label an
axis with the names of the months, Reman numerals, etc.
See the description of the routine AGCHNL, in the section "RXTTNES" and exam-
ple 10, in the section "EXAMPLES".
2.45	SCMTEflGRAtS AND HISTOGRAMS. Scattergrams, histograms, and other such
specialized "graphs* are not directly provided for by AUTOGRAPH. Standard
procedure is to suppress the advancing of the frame and the drawing of curves
by EZ..., call EZ... with the appropriate x and y data to generate the back-
ground, draw the desired objects an that background, and then advance the
frame.
See examples 11 and 12, in the section "EXAMPLES".
2.46	GKS CCNSIDERATICNS. Fran the user's point of view, the GKS version of
AUTOGRAPH is identical to the NSPP (NCAR System Plot Package) version; in
fact, they are very nearly identical fran the implementor's point of view.
The GKS version depends cn the SPPS {System Plot Package Simulator); as of
this writing, it has not been determined whether or not the use of SPPS will
require special JCL in the user's program. Check with a consultant to deter-
mine the current situation.
Hie examples given in the section "EXAMPLES* must be modified slightly to run
with the GKS version of AUTCGSAPH. Each program must start by executing a
call to OPNGKS and end by executing a call to CLSGKS. In example 11, the
fourth argument in the call to POINTS must be modified; I recoirmend changing
it from a to a -2.
AUTOGRAPH
- 21 -
GVEFT/IEW

-------
"3. PCOTTNES
.nis section describes all of the AUTOGRAPH routines of interest to the user,
rtfith two exceptions; they are subroutines rather than functions.
The subroutines EZY, EZXY, EZI-ET, and EZMXY provide a quick-and-dirty graph-
drawing capability. The appearance of a graph drawn by ere of these routines
may be changed drastically by changing the values of primary control parame-
ters.
The subroutines ANOTAT and DISPLA are provided principally for historical rea-
sons. Each allows the user to provide new values for certain primary control
parameters. These parameters nay also be set by calls to lower-level rou-
tines.
Hie subroutines AGSETP, AGSETF, AGSETI, and AGSETC allow the user to set the
values of parameters.
The subroutines AGGETP, AGGETF, AGGETI, and AGGETTZ allow the user to get the
current values of parameters.
The subroutine AGSTUP must be called prior to calling AGBJO or AGCURV, both
initially arid after making any change in the primary control parameters. It
examines the primary control parameters for consistency and computes the
values of required secondary control parameters.
ie subroutine AC2ACK is called to draw a background.
ihe subroutine AGCUKV is called to draw a single curve.
The subroutines AGSAVE and AGRSTR are called to save/restore the current state
(commonly the default state) of AUTOGRAPH.
The function AGSNCH may be used to obtain the 16-character dash pattern which
is equivalent to a specified 16-bit integer dash pattern.
The function AGDSHN may be used to obtain the 16-character name of a particu-
lar specified dash-pattern parameter.
The subroutine AGUTOL is called by AUTOGRAPH to do the mapping frcro the user
system to the label system (or vice-versa) along the four axes. The default
version may be replaced by the user to obtain a desired mapping.
The subroutines AGCHAX, AGCHCU, and A0CHIL are called by AUTOGRAPH just before
and just after drawing a particular element of a graph. The default do-
nothing versions may be replaced by a user in order to obtain desired effects
(color, different line styles, etc.).
The subroutine AGCHNL is called by AUTOGRAPH just after the character
representation of a numeric label has been generated and just before it is to
e drawn. The default do-nothing version may be replaced by a user in order
i change the numeric labels in a desired way (to get names of months, Ranan
merals, etc.).
POJTINES
- 22 -
AUTOGRAPH

-------
The subroutine AGJWKT is called by AUTOGRAPH to draw a character string. The
default version just calls the plot-package routine PWRIT. This routine may
be replaced by a user version which calls EWRITX, FWRITTf, or sane other
character-drawer.
Note: User versions of AGUTOL, AGCHAX, AQCHCU, AGCHIL, K3C3NL, and AGWRT
should not call any other AUTOGRAPH routine. Na such call will have a useful
effect, and, at worst, an infinite loop may result.
3.1 EZY n£DRA,NPrI5 ,GLAB). Draws, in a manner determined by the current values
of the control parameters, a canplete graph of a single curve through the
points (1,YT3RA(I)), far I fran 1 to NETS. The argument GLAB may be used to
specify a "graph label", to be placed at the top of the graph.
3.1.1	EZT - ESAGB. If the default values of the parameters are unchanged,
calling E2Y produces a graph having the follcwing appearance: A "permeter"
background outlines a grid window which is 8/10 the width and 8/10 the height
of the plotter frame arid positioned slightly above and to the right of center
within it. Each edge of the perimeter has short inward-pointing major and
minor tick marks, with major tick marks occurring at the ends of each edge.
Numeric labels belcw major tick marks cn the bottom edge of the perimeter,
increasing in value frcra left to right, show the linear mapping of values of I
onto the horizontal (x) axi3 of the graph? below them is the label "X".
Numeric labels to the left of major tick marks cn the left edge of the perime-
ter, incraasing in value fran bottom to top, shew the linear mapping of values
of YDRA(I) onto the vertical (y) axis of the graph; to the left of them is the
label *Y". Above the perimeter is the label specified by "GLAB", if any. The
curve itself is drawn as a solid line within the perimeter. A frame advance
is done after the graph is drawn.
See exanple 1, in the section •EXAMPLES".
The appearance of a graph drawn by EZY may change greatly in response to
parameter changes- See the routines ANCTAT, DISPLA, and AGSETP, belcw, and
the section "PARAMETERS".
3.1.2	EZY - AHG®£»IS. REAL YDRA(NPTS); INTEGER NPTS; CHARACTER* {*) GLAB.
YDFA is a cre-dimensional array of NPTS floating-point numbers, each of which
defines the user coordinates of a point (FLGAT(I) ,YDRA(I)) on the desired
curve. The current value of 'NULL/1." (default value "1.E36") may be used in
YD PA to signal missing points? curve segments on either side of a missing
point are emitted.
NPIS is the number of curve points defined by the array YDRA.
GUB is a character expression defining a new "graph label". (If the first
character of this expression is "CHRR(O)", no new "graph label" is defined;
the current cne will continue to be used.) A character string defining a new
graph label must either be of the exact length specified by the current value
of 'LINE/MAXLMLJM.' (default - 40 characters), or shorter; if shorter, it must
AUTOGRAPH
- 23 -
POJTINES

-------
be terminated by the character defined by the current value of 'LINE/END.'
'default - a '5'). The string beacmes the new text of line number 100 of the
Label named "T".
3.2 EXT(XDRA,IDRA,NPTS,GIAB) • Draws, in a manner determined by the current
values of the control parameters, a complete graph of a single curve through
the points (XDRA(I) ,YDRA(I)), for I fran 1 to NPTS. The argument GLAB may be
used to specify a "graph label", to be placed at the top of the graph.
3.2.1	E5XY - US3G2. If the default values of the parameters are unchanged,
calling E2TI produces a graph having the following appearance: A "perimeter"
background outlines a grid windcw which is 8/10 the width and 8/10 the height
of the plotter frame and positioned slightly above and to the right of center
within it. Each edge of the perimeter has short inward-pointing major and
minor tick marks, with major tick marks occurring at the ends of each edge.
Numeric labels below major tick marks on the bottom edge of the perimeter,
increasing in value from left to right, show the linear mapping of values of
XDFA(I) onto the horizontal (x) axis of the graph; below then is the label
"X". Numeric labels to the left of major tick marks on the left edge of the
perimeter, increasing in value frcm bottcm to top, show the linear mapping of
values of YDFA(I) cnto the vertical (y) axis of the graph; to the left of them
is the label "Y". Above the perimeter is the label specified by "GLAB", if
any. The curve itself is drawn as a solid line within the perimeter. A frame
advance is done after the graph is drawn.
-ee example 2, in the section "EXAMPLES".
The appearance of a graph drawn by EZXY may change greatly in response to
parameter changes. See the routines ANOTAT, OISFLA, and AGSETP, below, and
the section "PAPAML'illHS".
3.2.2	EZXT - ARGUMENTS. PEAL XDRA(NPTS), YDRA(NPTS); INIEGER NPTS; CHARAC-
TER* (*) GLAB.
XDPA is a cne-dimensional array of NPTS floating-point numbers, defining the x
coordinates of points cn the curve.
TORA is a cne-dimensional array of NPTS floating-point numbers, defining the y
coordinates of points cn the curve.
The points on the curve have coordinates (XDRA(I) ,YDRA(I)), for I from 1 to
NPTS. The current value of "NULL/1." (default value "1.E36") may be used to
signal missing data in these arrays. If either coordinate of a point is miss-
ing, the point is considered to be missing; curve segments cn either side of a
missing point are not drawn. Note: Because all non-missing coordinates are
used in figuring the minimum and maximum user values along a given axis, it is
safest to mark both coordinates as "missing".
IPTS is the number of curve points defined by the arrays XDRA and YDRA.
ROUTINES
- 24 -
AUTOGRAPH

-------
GZAB is a character expression defining a new "graph label". (IE the first
character of this expression is BC-0VR(0)", no new "graph label" is defined^
the current cne will continue to be used.) A character string defining a~rtew
graph label must either be at the exact length specified by the current value
of "LINE/VAXIMLM." (default - 40 characters), or shorter; if shorter, it irust
be terminated by the character defined by the current value of 'LINE/EUD.'
(default - a '$'). Hie string becomes the new text of line number 100 of the
label named 'T*.
3.3 SZMFCZDRArlDXriKRNrfNPTSfGIAB). Draws* in a manner determined by the
current values of the control parameters, a complete graph of one or more
curves, each defined by a set of points (I,YDRA{I,J)) (or (I,YDRA(J,I)),
depending on the current value of 'KM.'), for I frcm 1 to NETS. The curve
number J runs frcnt 1 to MftNY. The argument GLAB may be used to specify a
"graph label", to be placed at the top of the graph,
3.3.1	EZMJ - ESftGE. If the default values of the parameters are unchanged,
calling EZJflf produces a graph having the following appearance: A "perimeter"
background outlines a grid window which is 8/10 the width and 8/10 the height
of the plotter frame and positioned slightly above and to the right of canter
within it. Each edge of the perimeter has short inward-pointing major and
minor tick marks, with major tick marks occurring at the ends of each edge.
Numeric labels belcw major tick marks an the fcottcm edge of the perimeter,
increasing in value frcm left to right/ show the linear rapping of values cf I
onto the horizontal (x) axis of the graph; belcw them is the label "X".
Numeric labels to the left of major tick marks cn the left edge of the perime-
ter, increasing in value frcm bet ten to top, show the linear mapping of values
of YDRA(I,J) onto the vertical (y) axis of the graph; to the left of them is
the label "Y". Above the perimeter is the label specified by "GLAB", if any.
The curves themselves are drawn as solid lines within the perimeter. A Ersme
advance is done after the graph is drawn.
See example 3, in the section "EXAMPLES".
The appearance of a graph drawn by EZMf may change greatly in response to
parameter changes. See the routines ANOTAT, DISPLA, and AGSETP, below, and
the section "PARAMETERS".
3.3.2	Ear - AK3MNIS. SEAL YDFAtTDXY,MANY} or YTDRA(IDXY,NPT5) (depending
on the current value of 'SOW.'); ETCK2X IDXY, MANY, NPTS; CHAWCIER*(*) GLAB.
YDRA is a two-diaiensional array of curve-point y coordinates. The current
value of 'NULL/1." (default value "1.E36") may be used In YDRA to signal miss-
ing points; curve segments on either side of a missing point are emitted.
If 'SOW.' is positive (the default), the first subscript of YDflA is a point
number and the second is a curve number. If "HOT.* is negative, the order of
the subscripts is reversed ("row-vise", as opposed to "column-wise", storage).
HH7 is the first dimension of the array YEFA, required by EZMSf in order to
index the array properly.
AUTOGRAPH
- 2S -
KXJTIIiES

-------
If 'PCW.' is positive (the default), IDXY mast be greater than or equal to
7IS; otherwise, IDXY must be greater than or equal to MANY.
/©NY is the number of curves to be drawn by EZMY.
NPTS is the number of points defining each curve to be drawn by EZMY.
GL2B is a character expression defining a new "graph label". (If the first
•character of this expression is "CHAR(O)", no new "graph label" is defined;
the current one will continue to be used.) A character string defining a new
graph label must either be of the exact length specified by the current value
of 'LINE/MAXIMJM.' (default - 40 characters), or shorter; if shorter, it must
be terminated by the character defined by the current value of 'LINE/END.'
(default - a '$'). The string becanes the new text of line number 100 of the
label named "f.
3.4 EZMXY(XDRA,YDRA, IDXY,MANY,NPTS ,GI^B). Draws, in a manner determined by
the current values of the control parameters, a complete graph of cne or more
curves, each defined by a set of points (XDRA(I) ,YDRA(I,J)) (or
(XDRA(I) ,YDRA(J,I)) or (XDFA(I,J) ,YDRA(I,J)) or (XDRA(J, I) ,YDRA(J, I)), depend-
ing on the current value of "FCW."), for I fran 1 to NPTS. The curve number J
runs fran 1 to MANY. The argument GLAB may be used to specify a "graph
label", to be placed at the top of the graph.
.4.1 EZMXY - BS2GZ. If the default values of the parameters are unchanged,
ailing EZMXY produces a graph having the following appearance: A perimeter
background outlines a grid windcw which is 8/10 the width and 8/10 the height
of the plotter frame and positioned slightly above and to the right of center
within it. Each edge of the perimeter has shorr inward-pointing major and
minor tick marks, with major tick marks occurring at the ends of each edge.
Numeric labels below major tick marks cn the bottcxn edge of the perimeter,
increasing in value fran left to right, show the linear mapping of values of
XDRA(I) onto the horizontal (x) axis of the graph; below them is the label
"X". Numeric labels to the left of major tick marks cn the left -.-ige of the
perimeter, increasing in value fran bottan to top, show the linear mapping of
values of YDFA(I,J) onto the vertical (y) axis of the graph; to the left of
them is the label "Y". Above the perimeter is t;:a label specified by "GLAB",
if any. The curves themselves are drawn as solid ".ines within the perimeter.
A frame advance is done after the graph is drawn.
See example 4, in the section "EXAMPIZS".
The appearance of a graph drawn by EZMXY may change greatly in response to
parameter changes. See the routines ANOTAT, DISPLA, and AGSETP, below, and
the section "PARAMETERS".
3.4.2 EZMXY - ARGUMENTS. REAL XDFA(NPTS) or XDRA( IDXY, MANY) or
XDPA(IDXY,NPTS), depending cn the current value of "RCW.'; REAL
"DBA(IDXY,MANY) or YDRA(IDXY,NPTS), dspending cn the current value of 'RCW.';
TEGER IDXY, MANY, NPTS; CHARACTER*(*) GLAB.
BOJTCNES
- 26 -
AUTOGRAPH

-------
XERA is a aae-d Luensional or two-dimensional array of carve-point x coordi-
nates. The current value of 'NULL/1.' (default value "1.E36") may be used in
XDRA to signal missing points; carve segments cn either side of a missing
point are not drawn. Note: Because all non-missing coordinates are used in
figuring the minimum and maximum user values along a given axis, it is safest
to mark both coordinates as "missing".
If 'EOf.' has the absolute value "1." (the default), XDRA is singly-
dimensioned. It is subscripted by point number.
If 'FCW.' has the absolute value "2." or greater, XDPA is doubly-dijnensioned.
It is subscripted by point number and curve number/ in that order if "RCW.' is
positive (the default), in the reverse order if 'RCW.' is negative.
XDRA is a L*nensional array of curve-point y coordinates. Hie current
value of 'NULLA-' (default value "1.E36") may be used in YDBA to signal miss-
ing points? curve segments cn either side of a missing point are not drawn.
Note: Because all ncn-missing coordinates are used in figuring the minimum
and maximum user values along a given axis, it is safest to mark both coordi-
nates as "missing".
If 'HCW.' is positive (the default), YDRA is subscripted by point number and
curve number, in that order; otherwise/ YDBA is subscripted by curve number
and point number, in that order.
HJXr is toe first dimension of the arrays XDRA (if it is doubly-dimensioned)
and YDRA (unconditionally), required by EZMXJf in order to index these arrays
pccperly.
If 'SCW.' is positive (the default), IDXY must be greater than or equal to
NETS; otherwise, IDXY must be greater than or equal to MANy.
MMET is the number of curves to be drawn by EZMXf.
NETS is the number of points defining each curve to be drawn by EZMEf.
is a character expression defining a new "graph label*. (If the first
character of this expression is "OJAR(O)", no new 'graph label" is defined;
the current cne will continue to be used.) A character string defining a new
graph label must either be of the exact length specified by the current value
of "LINE/HAXXMJM." (default - 40 characters), or shorter; if shorter, it must
be terminated by the character defined by the current value of 'LINE/DID.'
(default - a . The string becomes the new text of line number 100 of the
label named 'T*.
3.5 AN7ERT(XLA8rYIA8,LEUC:,LSET/NDSH/DSaC). Changes the values of certain
primary control parameters, purportedly having to do with "annotation" of a
graph.
AUTOGRAPH
- 27 -
FCLTIJES

-------
3.5.1	AHTTM* - CSAGE. Tfte subroutine AMOTAT is provided principally for his-
¦ical reasons. Each of the parameters referenced by its argument list can
^ set individually by means of the routines AGSZTP, AGSETT, and/or AGSETT.
,n fact# ANOTAT is implemented using calls to these routines.
See example 8, in the section "EXAMPLES".
3.5.2	ANOTKT - ARGDMENIS. INTEGER LBAC, LSET, NDSH; CHARACTER*^) XLAB,
YLAB, DSnC(NDSH) .
HAB is a character expression defining a new "x-axis label". (If the first
character of this expression is "CHAR{0)", no new "x-axis label" is defined;
the current cne will continue to be used.) A character string defining a new
x-axis label must either be of the exact length specified by the current value
of 'LINE/T4AXIMJM.' (default - 40 characters), or shorter; if shorter, it must
be terminated by the character defined by the current value of 'LINE/END.'
(default - a '$'). The string becomes the new text of line number -100 of the
label '3".
TIAB is a character expression defining a new "y-axis label". (If the first
character of this expression is "CHAR(O)", no new "y-axis label" is defined;
the current one will continue to be used.) A character string defining a new
y-axis label must either be of the exact length specified by the current value
of 'LINE/MAXIMJM.' (default - 40 characters), or shorter; if shorter, it must
be terminated by the character defined by the current, value of 'LINE/END."
(default - a '$'). The string becomes the new text of line number 100 of the
bel 'L'.
*22C, if non-zero, has the integer value 1, 2, 3, or 4, the floating-point
equivalent of which is to became the new value of 'BACKGROUND.'. (If LBAC is
zero, no change is to be made in the current value.) The value "1" specifies
a perimeter background, the value "2" a grid background, the value "3" a half-
axis background, and the value "4" no background at all.
See the discussion of 'BACKGROUND.', in the section "PARAMETERS".
LSET, if non-zero, is an integer having the absolute value 1, 2, 3, or 4, the
floating-point equivalent of which is to be stored (by means of a call to
AGSETI) as the new value of 'SET.'. If LSET is zero, no change is to be made
in the current value of "SET.".
See the discussion of 'SET.', in the section "PARAMETERS".
NDSH, if zero, specifies that no change is to be made in the parameters which
specify the dashed-line patterns to be used for curves. If NDSH is non-zero,
it specifies an integer value whose floating-point equivalent is to be stored
as the new value of 'DASH/SELECTDR.' (which has the default value "1.").
If NDSH is negative, 'DASH/SELECTDR.' is set negative, forcing EZMf and EZMXY
to use internally-defined "alphabetic" patterns for the MANY curves drawn {"A"
for the first, "B" for the second, ..., "Z" for the 26th, "A" for the 27th,
¦tc.). The routines EZY and EZXY are unaffected.
ROUTINES
- 28 -
AUTOGRAPH

-------
IE NDSH is greater than zero, it must be less than or equal to 26, and the
next argument, DSHC, must contain NDS3 dashed-line oatterr.s comprising the new
"user" set of patterns. The fact that 'CASH/SELECTOR is set positive forces
EZJQT and EZMXY to use this set at patteens»	routines EXt and EZXY always
use the first pattern in this set.) The contents of the array DSHC are ccpied
to storage local to AUTOGEAPH and pointers to them are installed as the values
of 'DASK/PATTEENSA-',	etc.
See the discussion of 'DASH.', in the section "PARAMETERS".
DSBS is meaningful cnly when NDSH is greater than zero. In this case, it must
be an array of NDSH character strings, each oi the length specified by the
currant value of "DASH/LENGTH.". Each character string represents a dashed-
line pattern; dollar signs mean "pen down", quotes mean "pen up", and other
characters mean "draw me*.
See the discussion of 'DASH.', in the section "PASAMETERS".
3*6 DISPTAlI^AfUCW.urS?}. Changes the values of certain primary control
parameters, purportedly having to do with the "display" of a graph.
3.6.1	DISPIA - CESG2. The subroutine DISPIA is provided principally for his-
torical reasons. Each of the parameters referenced by its argument list can
be set individually by means of the routines AGSETP and/or AGSETI. In fact,
DISPIA is implemented using calls to these routines.
See the final exaiqple, in the section "EXAMPLES".
3.6.2	DISPIA - AHGMNTS. INTEGER LFHA, LRCW, LT&*
LFBA, if non-zero, has an integer value, the floating-point equivalent of
which is to became the new value of 'FRAME.*. If IxEA is zero, no change is
to be made in the current value of 'FRAME.'.
The default value of 'FRAME.' is "1.", specifying that each of the routines
EZY, EZXY, EZMJf, and EZMJff is to do a frame advance after drawing a graph.
The value "2." specifies that these routines should do no frame advance, the
value "3." that they should do a frame advance before drawing a graph.
LH39, if non-zero, has an integer value, the floating-point equivalent of
which i3 to beccroe the new value of '3CW.'. If L3CM is zero, no change is to
be made in the current value of 'SOW.'.
This parameter affects the way in which the routines EZMST and EZMXX interpcet
the arguments XD8A and YDHA, as follows:
If 'ROW.* is positive, the first subscript of YDFA is a point nuntoer and the
second subscript is a curve number. If 'K2W." i3 negative? the order of the
subscripts is reversed (row-wise, rather than colunn-wise, storage}.
AUTOGRAPH
- 29 -
SCOT^ES

-------
If the absolute value of 'RCW.' is "1.", XDRA is singly-subscripted; its sub-
script is a point number. If the absolute value of 'RCW.' is "2." or greater,
XDRA is doubly-subscripted; the order of the subscripts is the same as for
£ERA.
The default value of 'RCW.' is "1.", specifying that XDRA is singly-
subscripted by point ntrrber and that YD$A is doubly-subscripted by point
number and curve nuinber, in that order.
LTYP, if ncn-zero, is an integer specifying new values for 'X/LOGARTIHMIC.'
and "Y/LCGARITKMIC.'. If LTYP is zero, no change is to he made in the current
values.
The parameter 'X/LOGARTIHMIC.' has the default value "0.", specifying a linear
mapping of user x coordinates cnto the horizontal axis of the grid window; it
may be given either of the two values "-1." or "+1." to specify a logarithmic
mapping. The value "-1." protects it frcm being reset as a side effe.:. of
setting 'SET.'. DISPLA generates the value "0." or "-1.".
Hie parameter 'Y/LOGARTraMIC.' is defined similarly and affects the mapping of
user y coordinates cnto the vertical axis of the grid window.
A non-zero LTYP resets these values, as follows:
LTYP 'X/LOGARITHMIC.'
1	linear
2	linear
3	logarithmic
4	logarithmic
'Y/LOGARITIIMIC.
linear
logarithmic
linear
logarithmic
3.7 flGSET(TPQl,EURA,IXlRA). Allcws a user program to reset the values of a
group of parameters containing cne or more elements.
3.7.1 AGSET - TEaas. The subroutine AGSETP is called with a character
string identifying a group of parameters (possibly a single parameter), an
array containing new values of those parameters, and the length of the array,
as arguments. It transfers the new values into the appropriate locations in
the labeled common block AGCONP, thus mcdifying the effect of subsequent calls
to other AUTOGRAPH routines.
If a single parameter is being set, one of the routines AGSETT, AGSZTI, or
Agsetc (which see, below) may be used instead.
When certain parameters are set individually, AGSETP takes further "special"
action. For example, - if 'BACKGROUND.' is set, thereby requesting one of the
standard types of backgrounds, AGSETP changes a number of other parameters in
xrder to achieve the desired effect. The parameters which imply such special
~^.ion are as follows:
ROUTINES
- 30 -
AUTOGRAPH

-------
'SET.'
'RAOtGRCUND. '
'NULL/1.' and 'NULL/2.'
'LABEL/CONTROL.'
'LABEL/NAME.'
' LABEL/DEFINOTCN/SUPPRESSICN.'
'LINE/NLMEER.'
' LINE/DEFINITICN/SUPPKESS ICN.'
' LINE/DEF IN ITICN/TEXT.'
See the section "PARAMETERS" for descriptions of the parameters whose values
may be set.
3.7.2 fCSBn? - AHGDMENTS. CHARACTER*(*) TPQI; HEAL FURA(LURA) ; INTEGER LURA.
TFGI is a character string of the form 'k(l) A(2)/.. .k(n).', where each of the
k(i)'s is a keyword. The keyword k(1) specifies a group of parameters, k(2) a
subgroup of that group, k(3) a subgroup of that subgroup, etc. The whole
string is the name of seme group of parameters the user wishes to set.
For example, 'AXIS.' is the name of a 92-word grcup of parameters describing
the four axes, 'AXIS/RIGHT.' is the name of a 23-word subgroup describing the
right y axis,
'AXIS/RIGHT/INTERSECTION.'
is the name of a 2-word further subgroup describing the intersection of the
right y axis with the bottom of the grid window, and
' AXIS/RIOfT/INTERSECnON/USER.'
is the name of a single parameter specifying the point of intersection of the
right y axis with the bottom of the grid window as an x coordinate in the user
coordinate system.
Obviously, these names can sometimes become rather long. There are various
ways in which they may be shortened. First, since the fifth and following
characters of each keyword are ignored, they may be omitted; this would shor-
ten
'AXIS/RIGfT/INTERSBCTICN/USER.'
to
' AXIS/RIGH/INTE/USER.'
Even fewer characters may be used, as long as no ambiguity of interpretation
arises. Tto be completely safe, use at least the first three characters of the
group keyword and at least the first two characters of each subgroup keyword;
this would shorten the example above to 'AXI/RI/IN/US.'. Moreover, certain
group and subgroup keywords may be emitted entirely; for example,
'AXI/RI/IN/US.' may be shortened to 'RI/IN/US.'.
AUTOGRAPH
- 31 -
ROUTINES

-------
Names may also be lengthened in various ways in order to improve their reada-
bility. Blanks may be used as desired cn either side of a keyword. Any
jequence of characters not including a slash or a period may be inserted after
a keyword, separated frcm it by at least cne blank. For example, the name
'DASH PATTERN / G2ARPCTER WIDTH
is equivalent to, and considerably more meaningful than,
'DAS/CH.' (or even "DASH/CHARACTER.")
A complete list of the parameters may be found in the section "PARAMETERS",
below.
FURA is a user array (of length LURA) containing, the new values of the parame-
ters in the group specified by TPQJ, in the same order as they appear in the
group.
All parameters have floating-point values (because of a portability problem
which arose in implementing AGSETF). Those which represent intrinsically
integral quantities have a value of the form "FLOAT(n)where "n" is the
integral quantity being represented. Sane parameters intrinsically take on
character-string values; the floating-point quantity stored as the value of
such a parameter is typically an identifier allcwing for later retrieval of
the character string frcm a character storage area inside AUTOGRAPH. The rou-
tines AGSEIC and AGGETC may be used to set/get the character-string values of
such parameters.
.ERA is the length of FURA (the number of floating-point elements in it). Its
value may be less than, equal to, or greater than, the length of the parameter
group specified by TPQI. The number of values transferred frcm FURA is the
minimum of the two (but not less than cne). This means that if, for example,
you cnly wish to set the first two parameters of a 100-parameter group, you
may do so by using LURA * 2.
3.8 AGSETF (TPQI ,FOSR). Allows a user program to store a floating-point
number as the value of a single parameter.
3.8*1 AGSETF - OSAGE. This subroutine transfers the value of FUSR to a local
array FURA, dimensioned 1, and executes the statement
CALL AGSETP (TPGN,FURA,1)
See the description of AGSETP, above. The "special actions" described there
may result fran a call to AGSETF.
3.8.2 AGSETF - ARGDMQnS. CHARACTER*(*) IPGN; REAL FUSR.
'H'GM is an parameter identifier, as described for AGSETP, above. If a group
3f more than cne parameter is specified, only tl.e first element of that group
ill be affected by the call.
ROJTINES
- 32 -
AUTOGRAPH

-------
FUSR is the floating-point value to be given to the.parameter specified by
TPQJ.
3.9	(TPGN,IDSRJ. Allows a user program to store the floating-point
equivalent of an integer as the value of a single parameter.
3.9.1	SGSEIT - CSA3. This subroutine stores the value FLOAT(IUSR) in a
local array FURA, dimensioned 1, and then executes the statement
CALL £GSEIP (TPGN,FCJRA,1)
See the description of AGSETP, above. The "special actions" described there
may result fran a call.to AGSETI.
3.9.2	AGSSTI - AR3MENTS. CHAMCTER* (*) TPQI; INTEGER IUSR.
TPGN is a parameter identifier, as described for AGSETP, above. If a group of
more than one parameter is specified, only the first element of that group
will be affected by the call.
IUSR is the integer equivalent of the floating-point value to be given to the
parameter specified by TPGN.
3.10 MS2IC('I$IGN,CI3SR). Allows a user program to (in effect) store a charac-
ter string as the value of a specified single parameter.
3.10.1	JGSETC - USftGB. This subroutine stores the character string CUSR in
an internal string storage space, generates a floating-point identifier allow-
ing for later retrieval of the character string, stores that identifier in a
local array FURA, dimensioned 1, and then executes the statement
CALL PGSETP (TPQ^FURA,!)
See the description of AGSETP, above. The "special actions" described there
may result fran a call to AGSEIC.
3.10.2	AGSBIC - AHGWanS. CHARACTER*(*) TPGtf, CUSR.
TPQf is a parameter identifier, as described for AGS2TP, above. The specified
parameter must be one of those which intrinsically have values of type charac-
ter: "LINE/aaj.*, 'LABEL/NAME.', 'UNE/TEXT.or 'DASlV^ATTEBN/n.'
CUSR is a desired character string.
If 'LINE/END.' is being set, only the first character of CUSR will be used.
If 'LAHELAlAME.' is being set, the length of CUSR will be taken to be
"MAXO (1, LIN (CUSR) ) ".
ALTTCGRAPH
- 33 -


-------
If the t&xt of -a Label is being set, CUSP, rust either be of the exact length
sj^citied by 'LlNE/MAXIil.'M.* {40 characters, by default) or shorter; if
hotter, it must be terminated by the character defined by 'LIN2/H2-D.*
{default - a '5').
If a dash pattern is being set, the length of CUSR will be taken to be the
miniwunv of* "IZS \C-'SR) " ar-d the value specified by 'CASK/L3-K1H.'.
3.3.1 SGtSTEPiTSGSfFCSA.IXJaAi . Allows a user program to get the values of a
group of paramete:s containing one or more elejnents-
3.11.1 MSB? - OSfltS. The subroutine MGETP is called with a character
string identifying a grcup of pacanetacs ^possibly a single parameter J, an
at cay tc receive the values of those parameters, and the length of the array,
as arguments. It transfers values frajt the appropriate locations in the
labeled ocrrnon block A£XXOT to the user array.
If a single parameter is being retrieved, ana of the routines A3GETF, AGGETI,
oc AGGCTC {which see* below) may be used instead. Ma "special"' action is
laplied for any single parameter [as is the case for AGSTTP),
See the section. "FAPAKEm?JS" fcr descriptions of parameters whose values may
be retrieved.
".11.2 3G3EIP - MGCMEWIS. CSABACTER*J*) 1PGN/ REAL FU?A(UiRA}; EfESS
JEA-
J?®l is a character string of the fens *k(l)/kt2}/...	»£er* each of th&
Jtrji'-s is a fce£V3c2. Ifie keyword kCLJ specifies a group of parameters, fc{2) a
subgroup of that group. It(3) a subgroup cf that subgroup, etc. Ihe iAsole
string is the name of sane group of parameters the user wishes to get.
See the AGSEIP argument UGM, above, foe an exarple and additional carments.
FERA is a user array (of length LEKA) into which the floating-point values of
the parameters in the group specified by TPGN are to be transferred, in the
same order as they appear JLn the group.
See the AGSETP argument TUBA, above, for additional ccnroents.
LOTA is the length of FUR&. Its value ffay be less than, equal to, or greater
than, the length of the group specified by TPGN, The number of values
transferred into FQHfc is the neiniinum of the two (but not less than one). You
nay, for example, get the first two parameters of a 100-parameter group by
using LURA ® 2.
3.12 SGREIf(TPSHrPySiU . Allows a user program to retrieve the floating-point
*lue of a single rarameter.
3XTLSES
- 34 -
HTTOGSAPH

-------
3.12.1	AGGZTY - OSAGE. This subroutine executes the statement
CALL A3GETP (TPQJ,FUFA,1)
where FURA is a local array, dimensioned 1, and then sets FUSR equal to
FURA(l).
See the description of AGGETP, above.
3.12.2	AGCZTF - AIGOffiinS. CHABfiCTER* {*) TPQJ; REAL FUSR.
TPC2I is a parameter identifier, as described for AGGETP, above. If a group of
more than cne parameter is specified, only the first element of that group
will be retrieved by the call.
FOSR receives the floating-point value of the parameter specified by TPQ4.
3.13 MGBn CnQfrlDSR) • Allows a user program to retrieve the integer
equivalent of the floating-point value of a single parameter.
3.13.1	iGQETI - OS?£Z. This subroutine executes the statement
CALL AGGETP (TPGN,FURA,1)
where FURA is a local array, dimensioned 1, and then sets IUSR equal to
IFIX(FURA(1)). .
See the description of AGGEIP, above.
3.13.2	JG3ZTT - ABQDManS. GJAKOZR* (*) TPQl; INTEGER IUSR.
TPGI is a parameter identifier, as described for fCGEKP, above. If a group of
more than one parameter is specified, only the first element of that group
will be retrieved by the call.
ITER receives the integer equivalent of the floating-point value of the param-
eter specified by TPQl.
3.14 Aazi£(TF(2i,CDSR). Allows a user program to retrieve (in effect) the
character-string values of certain single parameters.
3.14.1 H1SSJM - 0SAG3. This subroutine executes the statement
CALL £GGETI> (TPG1,FURA,1)
where FURA is a local array, dimensioned 1. It then retrieves, from
AUTOGRAPH'S character storage space, the character string identified by
FURA(l), and returns that string as the value of CUSR.
AUTOGRAPH
- 35 -
HOUTIJES

-------
See the description of AGGETP, above.
1.14.2 AGGETC - AHGCMENTS. CHAR2CTER*(*) TPQI, CUSR.
TPGN is a parameter identifier, as described for KJGETP, above. The specified
parameter must be cne of those which intrinsically have values of type charac-
ter: 'LINE/END.', 'LABEL/NAME.', 'LINE/TEXT.', or 'DA£K/PATIEHN/n.'
CDSR receives the desired character string.
3.15 ?CSTOP(XDRA,NVTX,IIVXfNEVX,IIEX,...). (The remaining arguments are
YDFA, NVTY, IIVY, NEVY, and IIEY.) Performs "set-up" tasks required before
AGBACK and AGCUHV may be called. Basically, AGSTUP examines the current
values of the primary control parameters for errors and computes frcm them and
fran its arguments the values of secondary control parameters. The primary
and secondary control parameters together determine how the routines AGSACK
and AGCUKV will behave.
3.15.1	MSTDP - DSftGB. The subroutine AGSTUP is normally called once per
graph, just prior to the sequence of calls ho AGSACK and/or AOCUKV which actu-
ally draws the graph.
Hie call to AGSTUP may be emitted enly if (1) no primary control parameters
have been changed since the last time AGSTTJP was called and (2) the position
of the grid window and the mapping of user x/y coordinates into the grid win-
'cw would be unaffected by the AGSTUP call. The routine must be called at
'.east cnce, for the first graph; for succeeding graphs, if the call can be
omitted, it should be, since the routine is rather time-consuming.
Note that each of the routines EZY, EZXY, EZMY, nd EZMXY unconditionally exe-
cutes a call to AGSTUP (via a routine called AGEZSU) before calling AGBACX
and/or AGCUEV.
An appropriate call to the plot-package routine SET is executed by AGSTUP.
3.15.2	MSICP - AKXMQflS. PEAL XDRA(*) ,YDFA(*); JNIBGER NVIX, IIVX, NEVX,
IIEX, NVIY, IIVY, NEVY, IIEY.
The first five arguments o£ AGSTUP are meaningful only if at least cne of
'X/ttTNIMUM.' and 'X/ttAXIMUM.' has the value "null 1" or "null 2", specifying
that AUTOGRAPH is to determine for itself the minimum and/or maximum x coordi-
nate in the user's data. Similarly, the second five argunents are meaningful
only if at least one of "Y/KTNIMJM.' and 'Y/HAXIMUM.' has the value "null 1"
or "null 2".
XDRA is an array of user x coordinates.
NVTX is the nurJber of "vectors" of data frcm XDRA to be considered in comput-
ing the minimum and/or maximum x values.
ROUTINES
- 36 -
AUTOGRAPH

-------
IIVX is the index increment between two "vectors" in XDPA. The first element
of the first vector is XDRA(l), the first element of the second vector is
XDRA(1+IIVX), the first element of the third vector is XDRA(1+IIVX*2), etc.
NEVX is the number of elements of each vector in XDRA to be considered in con-
puting the minimum and/or maximum x values.
IIEX is the index increment between two consecutive elements of a vector in
XDRA. Hie second element of the first vector is XDPA(1+IIEX), the third ele-
ment of the first vector is XDRA(1+IIEX*2), etc.
If IIEX has the value 0, the contents of XDRA are ignored completely; the
minimum and maximum x values are considered to be "1." and FLOAT(NEVX),
respectively.
YDRA, NVIY, I IVY, NEVT, and I IE? are treated analogously, but define the user'
y coordinates.
Sane examples:
X array
Data to be used
XDRA
NVIX
IIVX
NEVX
IIEX
X(100)
(all data)
X(l)
1

100
1

(X(I),1*1,99,2)
X(l)
1
-
50
2

(X(I),1-51,99,2)
X(51)
1
-
25
2
X(10,10)
(all data)
X(l,l)
10
10
10
1


X(l,l)
1
-
100
1

((X(I,J),1-1,10),






J«l,6)
X(l,l)
6
10
10
1


X(l,l)
10
1
6
10


X(l,l)
1
-
60
1

((X(I,J),1-3,7),






J=3,9))
X(3,3)
7
10
5
1


X(3,3)
5
1
7
10

((X(I,J),1-3,7,4),






J-3,9,3)
X (3,3)
3
30
2
4
{ncne)
1., 2., ••• 62.
-
-
-
62
0
Note: The character is used above to indicate an argument which is
ignored and may be given a dumny value.
Normally, the x and y coordinate data tendered to AGSTOP is the same data
which will later be used to draw curves. Hcwever, this need not be the case.
For example, one could call AGSTOP with a two-word XDRA (setting NVTX=1,
IIVX-1, NEVX=2, and IIEX=1) containing a desired minimum and maximum to be
used, disregarding the real data.
If 'INVERT.' is given the value "1." (in place of its default value "0."),
AGSTOP will behave as if its first five arguments had been interchanged with
its last five, so that x-coordinate values refer to vertical distances, and y-
coordinate values to horizontal distances, on the graph. This parameter
affects AGCURV in a similar manner, thus allowing one to plot "x as a function
AUTOGRAPH
- 37 -
ROUTINES

-------
of y".
3.16 XSfCZ. Draws the background specified by the current values of the
control parameters - the primary parameters with default values or with values
supplied by the user/ and the secondary parameters with values ocmputed by
AGSTUP.
3.16.1	AC2KX - OSAGE. Just call it. See the section "PARAMETERS" for
descriptions of the parameters which affect the appearance of a background
drawn by AGBACK. See also the description of AGSTUP, above.
An appropriate call to the plot-package routine SET is executed by AG3ACK.
3.16.2	HSfCR - ARGUMEWIS. None.
3.17 ACUJW(XVEC,IIEX,YVH:,IIET'/NExr,KDSH). Draws a curve in a manner speci-
fied by the current values of the control parameters - the primary parameters
with default values or with values supplied by the user, and the secondary
parameters with values computed by AGSTTJP.
3.17.1	AGCDR7 - DSSffi. The subroutine AGCURV, given the x and y coordinates
of a set of data points, draws the curve defined by those points, using a
'ashed-line pattern selected by the final argument.
Jee the section "PARAMETERS" for a description of the parameters which affect
the behavior of AGCUKV. One parameter of particular interest is "WINDO*.',
which has the default value "0.". If "WINDOW." is given the value "1.", any
portion of a curve which lies outside the grid window is emitted. No distor-
tion of any curve segment results; the effect is exactly as if the curve were
viewed through a window. There is an additional advantage in setting 'WIN-
DO*.' to "1.": if either the x coordinates, or the y coordinates, or both,
are mapped logarithmically into the grid window and zerc or negative values
occur in the data, AGCUKV treats those values as missing-point signals, rather
than bcmbing with an ALOGIO error.
3.17.2	AGCQBV - ARGCMENTS. REAL XVEC(*) ,YVEC(*) ; INTEGER IIEX, IIEY, NEXY,
KDSH
XVEC, when IIEX is non-zero, is a singly-subscripted array containing NEXY x-
coordinate data - curve point 1 has x coordinate XVEC(l), curve point 2 has x
coordinate XVEC(1+IIEX), curve point 3 has x coordinate XVEC(1+IIEX*2), etc.
when HEX is zero, the array XVEC is ignored - curve point 1 has x coordinate
"1.", curve point 2 has x coordinate "2.", etc.
If the value of any x coordinate matches the current value of 'NULL/1.'
(default - "1.E36"), the corresponding point is considered to be missing -
curve segments on either side of that point are not drawn.
ROUTINES
- 38 -
AUTOGRAPH

-------
IIEC, if non-zero, is the index increment between cne x coordinate in XVEC and
the next. If IIEX is zero, the array XVEC is ignored, as described above.
YVEC is just like XVEC, but provides y coordinate data.
I IE? is just like IIEX, but describes the use (or non-use) of YVEC.
NEXT is the number of curve points - the number of x/y coordinate pairs to be
used.
Note: If 'INVEST.' is given the value "1." (in place of its default value
"0."), AGCUKV will behave as if the arguments XVEC and HEX had been inter-
changed with the arguments YVEC and IIEY, so that x-coordinate values refer to
vertical distances, and y-ooordinate values to horizontal distances, on the
graph. This parameter affects AGSTUP in a similar manner, thus allowing cne
to plot "x as a function of y".
KDSH specifies the dashed-line pattern to be used in drawing the curve.
(Since the routines DASHD, FRSTD, VBCTD, and LASTD, in the package DASHCHAR,
are used to draw the curve, it may have its own particular dashed-line pat-
tern.)
If KDSH is zero, the user is assumed to have done his own call to DASHD;
AGCUKV will do no such call.
If KDSH is non-zero and negative, the function M3D(-KDSH-1,26.)+1 determines
which of 26 "alphabetic" patterns is to be used; each of these generates a
solid line interrupted by cne of the letters of the alphabet. The value 1
implies that an "A" will be used, the value 2 that a "B" will be used, ...
the value 27 that an "A" will be used again, etc.
If KDSH is non-zero and positive, the function MDD(KDSH-l,n)+l determines
which of n "user" patterns is to be used; these n patterns are defined by the
parameters in the group- named 'DASH.' - the default values specify cne solid-
line pattern.
Note: The routines EZY and EZXY, which draw cne curve per call, always call
AGCUKV With KDSH = 1. The routines EZMY and EZMXY, which draw cne or more
curves per call, call AGCUKV with KDSH 3 ISIC3l(p,q), where p is the number of
the carve being drawn (p is between 1 and MANY, inclusive) and q is the
current integral value of 'DASH/SELECTOR.'.
3.18 AGSAVE(mD). Saves the current state of AUTOGRAPH for later restora-
tion by AGRSTR.
3.18.1 AGSAVZ - EEMZ. Calling AGSAVE saves the current state of AUTOGRAPH
(frequently the default state) by writing, on the unit specified by IFNO, the
current values of all the parameters and the contents of the character storage
space referenced by certain of those parameters.
AUTOGRAPH
- 39 -
FCLTINES

-------
3.18.2 AGSAVE - AK33MEJTTS. INTEGER IFNO.
3TO is the number of a unit to which a single unformatted record is to be
written. It is the user's responsibility to position this unit. AGSAVE does
not rewind it, either before or after writing the record.
3.19 AGSSTR(IFtO). Restores a saved state of AUTOGRAPH.
3.19.1	AGRSTO - CSAGE. Calling AGRSTR restores AUTOGRAPH to a previously
saved state (frequently the default state) by reading, frcm the unit specified
by IITJO, values of all the parameters and the contents of the character
storage space referenced by certain of those parameters.
3.19.2	AG3STR - ARQDMEHTS. INTEGER IFNO.
UIO is the number of a unit frcm which a single unformatted record is to be
read. It is the user's responsibility to position this unit. AGRSTR does not
rewind it, either before or after reading the record.
3.20 A3H3(IDSH). Provides an easy way to convert binary dash patterns into
character dash patterns.
3.20.1	&23NC9 - USAGE. AGBNCH is a function, of type CHARACTER*!6, and must
>e declared as such in a user program referencing it:
CHARACTER* 16 AGBNCH
The value of ACSNCH(IDSH), where IDSH is an integer in the range 0 to 65535
(2**16-1) representing a 16-bit binary dash pattern, is the equivalent charac-
ter dash pattern.
3.20.2	AGBNCB - ARGUMENTS. INTEGER IDSH.
IDSH is an integer in the range 0 to 65535, -inclusive.
3.21 AGDSHN (IDSH). Provides an easy way to generate the names of parameters
in the group 'DASH/SATTERN.', for use in calls to AGSETC and AGGETC.
3.21.1 AGOSHN - USAGE. AGDSHN is a function, of type CHARACTER* 16, and must
be declared as such in a user program referencing it:
CHARACTER*16 ACDSHN
The value of AGDSHN (IDSH), where IDSH is an integer "n" in the range 1 to 26,
is the name of the nth dash-pattern parameter - that is to say, it is the
character string TASH/PATTERN/n.'*.
ROUTINES
- 40 -
AUTOGRAPH

-------
3.21.2 AGDSHN - ARGUMENTS. INTEGER IDSH.
IESH is an integer in the range 1 to 25, inclusive.
3.22 PajiuLi(IAJG/iTjrci,xli^A,VlnP,Vv/u'). Provides a way for the user to change
the user-system-to-label-system mapping for ere or more of the four axes.
3.22.1	AGOTDL - DSSGZ. This routine is not called by the user program, but
by AUTOGRAPH itself. It defines the user-system-to-label-system mapping for
all four axes. The default version makes the label system match the user sys-
tem an all fcur axes. The user may supply his own version to change the map-
ping cn one or more of the axes. Mappings defined by the subroutine must be
continuous and monotonic.
Note: A user version of AGUTOL should not call any other AUTOGRAPH routine.
3.22.2	MDTOL - ARGCMHfES. INTEGER IAXS, IDMA; HEAL FUNS, VINP, VOTP.
IAS is the number of the axis. The values 1, 2, 3, and 4 imply the left,
right, bottom, and tcp axes, respectively.
FUNS is the value of 'AXIS/s/FUNdTON.', which may be used to select the
desired mapping function for the axis IAXS. It is reccnmended that the
default value (zero) be used to specify the identity mapping. The value may
be integral ("1.", "2.", etc.) and serve purely to select the code to be exe-
cuted or it may be the value of an actual parameter in the equations defining
the mapping.
U29l specifies the direction of the mapping. A value greater than zero indi-
cates that VINP is a value in the user system and that VOTP is to be a value
in the label system, a value less than zero the opposite. The mappings in cne
direction must be the mathematical inverses of the mappings in the other
direction or AUTOGRAPH will probably go bananas.
VINP is an input value in cne ooordinate system.
VGTCP is an output value in the other coordinate system.
3.23 flGCHAX(IFLG,IAXS,IPRr,VTLS). Provides a way for the user to change the
color, intensity, line style, etc., of various portions of the axes.
3.23.1 MC2AX - CSKZ. This routine is not called by the user program, but
by AUTOGRAPH itself, just before and just after each of the objects making up
an axis is drawn. The default version does nothing. The user may supply his
own version to change the color, intensity, line style, etc. of selected por-
tions of the axis.
Note: A user version of W3CHAX should not call any other AUTOGRAPH routine.
AUTOGRAPH
- 41 -
PCU7INES

-------
3.23.2 AGC2AX - ARGUMENTS. INTEGER IFLG, IAXS, IPRT; PEAL VILS.
TFLG	is zero if a particular object is about to be drawn, non-zero if it has
just	been drawn.
IAXS	is the number of the axis being drawn. The values 1, 2, 3, and 4 indi-
cate	the left, right, bottan, and top axes, respectively.
IPET	indicates the part of the axis being drawn. Possible values are as fol-
lows:


1
implies
the line of the axis.
2
implies
a major tick.
3
implies
a minor tick.
4
implies
the mantissa of a numeric label.
5
implies
the exponent of a numeric label.
VIIS is the value in the label system at the point where the part is being
drawn. For IPKT ¦ 1, VILS is zero.
3.24 AGCSCD(IFLG,KESa). Provides a way for the user to change the color,
Intensity, line style, etc., of curves drawn by AUTOGRAPH.
3.24.1	MCEEG - USAGE. This routine is not called by the user program, but
by AUTOGSAPH itself, just before and just after each curve is drawn. The
default version does nothing. The user may supply his own version to change
the color, intensity, line style, etc. of selected curves.
Note: A user version of AGCBCU should not call any other AUTOGSAPH routine.
3.24.2	AR3D8^2^CS. IKTBGER XJr, KDSH.
HTX5 is zero if a particular object is about to be drawn, non-zero if it has
just been drawn.
KESH is the value of A3CUKV"s last argument, as follows:
AGCUKV called by
Value of KDSH



E2Y
1



EZXY
1



EZMJf
"n" or "-n"? n
is
the curve
number
EZMXY
"n" or m-am; n
is
the curve
number
the user program
the user value



ROUTINES
- 42 -
AUTOGRAPH

-------
3.25 MC3IL(IFI£#IJBWrLNN0) • Provides a way fee the user to change the
coloc, intensity, text style, etc./ of the interactional labels.
3.25.1	AGCHTL - OSA®. This routine is not called by the user program, but
by AUTCGlRAPH itself, just before and just after each inforaiaticnal-label line
is drawi. The default version does nothing, The user may supply his own ver-
sion tc change the appearance of selected lines of text.
Uote: A user version of AGC3IL should not call any other AUTOGRAPH routine.
3.25.2	ftCTHTT, - MGGMDTCS. I^nSXR ITLG, tMOj O&awnER*[*) LENM.
HTG is zero L£ a particular object is about to be drawn, ncn-zero if it has
just been drawn.
ISMS is a character variable containing the name of the label being drawn,
LHND is the master of the line being drawn.
3.26 fiG^SHLfrWS/VILofCHIW/MCIM/fCIM,...}. {The remaining arguments ace
I5XM, CH5£, VCTB, and NCTE.) Provides a way for the user to substitute arbi-
trary character strings for the numeric labels generated by ffiTORAPH.
3.26.1	&3C3NE. - OSftSS. this routine is not called by the user program, but
by AUTCGSAPH itself, ju3t after the character string representing each numeric
label has beer, generated and just before it is written on the graph. The user
may change the character string in any desired way. Axes may thereby fce
labeled using trie nanes of the [tenths, Bcman numerals, etc.
Note: A user version of 5GCHNE, should not call any other ACTOGPAPH routine.
3.26.2	AGCBNL - MCCHBKES. INTEGER IAXS, MCLM, 5CIM, IPXM, MCIS, NCI2; REAL
VILa; CHARACTER* (*) CHEM, CHRE.
IMS is the nurrfcer of the axis being drawn. The values 1, I, 3, and 4 Luply
the Xeftf right# bottom, and top axes, respectively.
VXLS is the value to be represented by the numeric label, in the label system
for the aacis. The value of VXLS must not be altered.
CEDM, on entry, ia a character string containing the mantissa of the numeric
label, as it will appear if AGCENL makes no changes. If the numeric label
includes a "times' symbol, it is represented by a blank in CKEM. (See ipxm,
below.) CHEM my be modified-
MC3M ia the length of CHRM - the maximum number c£ characters that it will
hold. The value of fCIM mist not be altered.
NCIX, crs entry, is the nmaber of meaningful characters in CHSM. If Q®M is
changed, HCIM*should be changed accordingly.
fiUTOGRWS
- « -


-------
IPXM, on entry, is zero if there is no "times" symbol in CHFM; if it is non-
zero, it is the index of a character position in CHRM. If AGCHNL changes the
position of the "times" symbol in CHRM, removes it, or adds it, the value of
CPXM mist be changed.
C2FE, on entry, is a character string containing the exponent of the numeric
label, as it will appear if AGCHNL makes no changes. CERE may be modified.
MC3E is the length of CHRE - the maximum number of characters that it will
hold. The value of MZIE must not be altered.
NCIE, on entry, is the number of meaningful characters in <3RE. If CHRE is
changed, NCIE should be changed accordingly.
3.27 AGPWRT (XPOS, YPOS, CHRS, NCBS, ISIZ, IORI, ICEN). Provides a way for the user
to change the style of all text strings drawn by AUTOGRAPH.
3.27.1 AGFWKT - tBS£Z. This routine is not called by the user program, but
by AUTOGRAPH itself, to draw a numeric label or an informational label on the
graph. The default version just calls the plot-package routine WRIT. The
user may supply a replacement version. For example, the XL IB file AGUIWRITX
contains, a version of AGPWKT which calls WRITX, which produces ouch nicer-
look iog labeling.
*totes A user version of AGSV/KT should not call any other AUTOGRAPH routine.
.27.2 usma - ARGCMENTS. PEAL XPOS, YPOS; CHARACTER*(*) CHRS; INTEGER
NCHS, ISIZ, IORI, ICEM.
XPOS is the x ooordinate of a point relative to which the text string is to be
positioned.
IPOS is the y ooordinate of a point relative to which the text string is to be
positioned.
GSRS is the text string to be drawn.
NCES is the length o£ CHRS - the number of characters in the text string.
ISIZ specifies the size of the characters to be used. The values 1, 2, 3, and
4 imply character widths of 8, 12, 16, and 24 plotter units, respectively.
Larger values specify the character width directly.
IORI is the orientation angle of the text string, measured in degrees counter-
clockwise from a vector which is horizontal and pointing to the right.
IOBN is the centering option. The value "-1" implies that the text is to be
written with (XPOS,YPOS) in the center of the left edge of the leftmost char-
acter, the value "0" that (XPOS,YPOS) is to be .in the center of the entire
¦string-, and the value "+1" that (XPOS,YPOS) is to be in the center of the
\ght edge of the rightmost character.
ROJTINES
- 44 -
AUTOGRAPH

-------
4. PftRH®IERS
Hie AOTDGJ&PH central parameters reside in the 1 abeled ocrnxn block nsoCiir.
There are -cuccentl'/ 435 of ther.. c-f wh.ch -j3S ate '"prunary" and 149 ace
"secondary"- Primary control parameters have default values and are subject
to change by a user program to produce seme desired effect an the behavior'sf
ACTOGKAPH and/or en the nature of a graph being drawn- Secondary control
parameters are computed by AUTOGRAPH itself and are not normally subject to
change by a user progcam.
User access to these parameters is'provided fay the routines AGSETP, RGSETF,
AGcETI, ^Cbt'iUr AGGSTPr AGGETF, MGETI, and A3GETC (all of which are described
in the section "ROUTINES", above). The first argument in a call to one of
these routines is a character string naming a grcup of parameters (perhaps
containing enly a single parameter) which the user wishes to "set" or "get".
Each such string has the form
'k(l}A(2)/. ..k(n)
where k(l) is a keyword identifying a najor group cf parameters, k{2) is a
keyvord identifying a subgroup of that ^tiajor group, it (3} is a key-ord identi-
fying a further subgrcup of that subgroup, and so*can. Only the first three
characters of kfl) and the first two characters of the others need be used;
also, certain keywords may be omitted.
Because of certain portability considerations, all of the parameters have
floating-point values. The routine PGS2TP may be used to set the floating-
point values of the parauieters in any group, the routine AGGETP to retrials
these values. The routine AGSET? (A3GETF) may be used to set (get) the
floating-point value of any single parameter.
Seme parameters may only take ai discrete integral values (like "0.", "1.",
6,1*, qc "S5535.") and are used in roles for hiaicti integers -would normally be
used. The routine AGSOT (ACGOT) may be used to set {get) the integer value
of any single parameter of this type.
Other parameters intrinsically represent character strings; the floating-point
value of the parameter is an identifier, generated when the character string
is passed to AUTOGRAPH and enabling the character string to be retrieved frcre
AUTCGRftPH's character storage space when it is needed. The routine AGSETC
(AGGETC) must be used to set .get) the character-string value associated with
any single parameter of this type.
Many parameters have a limited range of acceptable values. What generally
happens when a parameter is given an cut-of-range value is that WIUGPAFH
(usually the routine ftGSTUP) resets that value to the value at the nearer end
cf the actsptable range.
Setting certain parameters iindividually, rather than as part of a culti-
paraxneter group) insplies, as a side effect, "special action" by the routine
AGSETP (which may be called directly by the user oc indirectly by way of a
user call to AGSETT, ftGSETI, or AGSETC). Foe example, setting the parameter
'HACKGICUND.' to request a particular background type causes a number o£ other
X.TCGJRAPH
45 -
PAi?AMETc?-S

-------
parameters to be changed in order to achieve the desired result.
ach of the named parameter groups is described below. Square brackets are
ised to mark portions of a name which may be emitted; the notation
'k(l)A(2)/...(k(i)/]...k(n).'
indicates that the keyword k(i) and the following slash may be emitted. In
each description, the simplest form of the name is given. If a multi-
parameter grcup is named, its subgroups are listed, in the order in which they
occur in the grcup. If a single parameter is named, the default value of that
parameter is given and any "special action" by AGSEIP is described.
4.1 'PRIMARY.'.
Simplest form of name: 'PRI.'
This group oonsists of all 336 primary control parameters, in the order in
which they appear below. It was originally provided to give users the capa-
bility of saving and restoring the state of AUTOGRAPH. The routines AGSAVE
and AGRSTR (which see) should now be used for this purpose.
4.2 'FRAME.*.
Jimplest form of name: 'FRA.'
An integral floating-point number specifying when a frame advance is to be
done by the routines EZY, EZXY, EZMJf, and EZMXY and having one of three possi-
ble values:
•	The value "1." specifies a frame advance after drawing a graph.
•	The value "2." specifies no frame advance at all.
9 The value "3." specifies a frame advance before drawing a graph.
Default value: "1." (frame advance after drawing graph).
4.3 'SET.-.
Simplest form of name: 'SET.'
An integral floating-point number specifying whether or not the arguments of
the last call to "SET" are used to determine the linear/log nature of the
current graph, the position of the grid window and/or the x/y minimum/maximum
values.
PARAMETERS
- 46 -
AUTOGRAPH

-------
(Note: The rcutine SET is part of the system plot package. Its first four
arguments specify a portion of the plotter frame, its next four arguments
specify the minimum and maximum x and y coordinate values to be mapped to that
portion, and its ninth argument specifies the linear/log nature of the map-
ping. The routine GETSET, which is also a part of the system plot package, is
used to retrieve the arguments of the last call to SET.)
Giving 'SET." a value (individually, rather than as part of a group) has both
an immediate effect and a delayed effect. The immediate effect, which occurs
in the routine AGSETP, is to return most of the parameters in the groups
'GRID.', 'X.', and 'Y.' to their default values. (Exceptions are
"X/l£GARITHMIC•" and 'Y/LCGARITJiMIC.', which may have values making them
immune to such resetting.) The delayed effect, which occurs in the routine
AGSTUP, depends cn the value given to 'SET.'.
There are eight acceptable values of 'SET.', four of which are just the nega-
tives of the other fcur. Using a negated value suppresses the drawing of
curves by the routines EZY, EZXY, EZMY, and EZMXY. Acceptable absolute values
of 'SET.' are as follows:
•	The value "1." means that the arguments of the last SET call are not to
be used by A3STUP.
•	The value "2." means that 'X/LAGARITKMIC.' and 'Y/LOGARITHMIC.' are to be
given values ("0." or "-1.") consistent with the ninth argument of the
last SET call and that parameters in the group 'GRID.' are to be given
values oonsistent with the first four arguments of the last SET call.
•	The value "3." means that 'X/LOGARITHMIC.' and 'Y/LOGARITWUC.' are to be
qiven values ("0." or "-1.") consistent with the ninth argument of the r
last SET call and that the other parameters in the groups 'X.' and 'Y.'
are to be given values oonsistent with the fifth through eighth arguments
of the last SET call.
•	The value "4." means a aanbination of the actions specified by the values
"2." and "3.".
Default value: "1." (no arguments of last SET call used).
Special action by AGSETP: As described above, if 'SET.' is set (individually,
rather than as part of a group) to any value by an AGSETP call, the parameters
in the groups 'GRID/, 'X.', and 'Y.' are reset to their default values. The
parameter 'X/LOGARITOMIC.' is reset to its default value ("0.") only if it has
the value "+1."; a value of "-1." is not changed; 'Y/DOGARTIHMIC.' is treated
similarly.
4.4 'KM.'.
Simplest form of name: 'ROf.'
AUTOGRAPH
- 47 -
PARAMETERS

-------
An integral flcating-point number specifying the assumed dimensioning o£ x ar.c
v coordinate data arrays used in calls to the routines EZM* and EZMCf. Thera
\re four possibilities:
•	The value "-2." means that both x and y arrays are subscripted by curve
nujrber and point nuircer, in that order.
•	The value "-1." means that y arrays are subscripted by curve number and
point miT-ber, in that order, but that x arrays are subscripted by point
nur.bet cnly. (The same x-coocdinate data is used for ail the curves.}
•	Either c£ the values "0." or *1." means that y arrays are subscripted by
point nujr.ber and curve number, in that order, but that x arrays are sub-
scripted by point number only. (The sane x-coordinate data is used for
all of the curves.)
•	The value "+2." means that both x and y arrays are subscripted by point
number and curve nurrber, in that order.
Default value: "1." (y by point and curve numbers, x by point number cnly).
4.5 "INVERT.*.
Simplest form of name: 'INV.'
Vn integral floating-point number having the value "0." or *1."; giving it the
value "1.* causes the routines AGSTUP and AGCUKV to behave as if arguments
defining x-coordinate data had been interchanged with arguments defining y~
coordinate data, thus, in sane sense, allowing one to graph "x as a function
of y". This parameter is principally intended for users of the rcctines EZY,
EZXY, E2MT| and E2MXY.
Default value: "0." (no inversion of x and y arguments).
4.6 "WINDOW.'.
Simplest form of name: "WI3.'
An integral floating-point number having the value "0.* or *1.*? giving it the
value "1." causes the routine AGCUHtf to use the subroutine AGCUH7, rather than
AGKURV, for drawing curves. The result is that curve portions falling outside
the grid window are emitted. See the description of the r cm tine 2CCUKV,
above.
Default value: "0." (no windowing of curves).
PARAMETERS
- 43 -
AUTOGEAFH

-------
4.7 'BflOOCDND.'.
Simplest form of name: 'BAC.'-
An integral floating-point number specifying the type of background to be
drawn by AGBACX. There are four acceptable values:
•	The value "1." specifies a "perimeter" background.
•	The value "2." specifies a "grid" background.
•	The value "3." specifies a "half-axis" background.
•	The value "4." specifies no background at all.
Default value: "1." (a "perimeter" background).
Special action by AGSETP: If 'BACKGROUND.' is set (individually, rather than
as part of a group) by a call to AGSETP, the desired background is created by
changing the following parameters:
' [AXIS/1 s/CCNTSOL.'
'[AXIS/] s/[TTGSS/] MAJOR/[LE2JGTO/] INWARD.'
' [AXIS/] s/[TTCKS/]MINOR/[LEUGTH/] INWARD.'
'LABEL/CONTROL.'
where "s" stands for "LEFT", "RIC2TT", "BOTTOM", and "TOP". This determines
which of the axes are plotted/ hew long the inward-pointing portions of major
and minor tick marks are to be, and whether or not informational labels are to
be plotted. Values used are as follows:
The value "1." (perimeter background) sets:
's/CONTROL.' to "4." for all s;
's/ttAJOR/INWARD.' to ".015" for all s;
's/HTNOR/INWARD.' to ".010" for all s;
'LABEL/CONTROL.' to "2.".
The value "2." (grid background) sets:
's/CONTSOL.' to "4." for "s" = "LEFT" and "BOTTOM",
's/CONTSOL.' to "-1." for "s" » "RIGHT" and "TOP";
's/fcAJOR/INWARD.' to "1." for all s;
's/talNOF/INWAFD.' to "1." for all s;
'LABEL/CONTROL.' to "2.".
The value "3." (half-axis background) sets:
's/CONTSCL.' to "4." for "S" = "LEFT" and "BOTTOM",
's/OCNTPOL.' to "-1." for "s" 3 "RIGHT" and "TOP";
's/MAJOR/INWARD.' to ".015" for all s;
's/teIM3R/INWARD.' to ".010" for all s;
'LABEL/CONTROL.' to "2.".
AUTOGRAPH
- 49 -
PArA'
-------
Hie value "4." (no background) sets:
"s/CONTPOL." to "0." for all s;
"s/MAJOR/INWAFD." to ".015 for all s;
"s/MINOR/INWARD." to ".010" for all s;
"LABEL/CONTROL." to "0.".
The default values of these thirteen parameters oorrespcnd to the default
value of "BACKGROUND.'. Note that, if they are changed directly, the value of
'BACKGROUND." may not reflect the actual nature of the background defined by
them.
4.8 'NULL.'.
Simplest form of name: "NUL."
This group contains the two "nulls" (or "special values") "NULL/1." and
"NULL/2.".
4.9 "HHI/L.*.
Simplest form of name: "NUL/1."
floating-point number "null 1", used in the follcwing ways by AUTOGRAPH:
•	Certain parameters have by default, or may be given, the value "null 1",
specifying that the routine AGSTUP is to choose values for them. The
value chosen for a given parameter is not back-stored in place of the
"null 1"; thus, a unique value will be chosen for each graph drawn.
•	If a curve point specified by the user has x and/or y coordinates equal
to "null 1", that curve point is ignored. It is not used in computing
minimum and maximum values. Curve segments cn either side of it are not
drawn.
Default value: "1.E36" (an arbitrary value).
Special action by ASSET?: If "NULL/1." is changed (individually, rather than
as part of a group) by an AGSETP call, the entire list of primary parameters
is scanned - any value equal to the old "--11 1" is replaced by the new one.
4.10 "NCLI/2.".
Simplest form of name: "NUL/2."
A floating-point number "null 2". Certain parameters may be given the value
null 2", specifying that the routine AGSTUP is to choose values for them.
PARAMETERS
- 50 -
AUTOGRAPH

-------
Hie value chosen for a given parameter is back-stored in place of the "null
2"; thus, a unique value may be chosen for the first graph of a series and
then used for all remaining graphs in the series.
Default value: "2.E36" (an arbitrary value).
Special action by AGSETP: If 'NULL/2.' is changed (individually, rather than
as part of a group) by an AGSETP call, the entire list of primary parameters
is scanned - any value equal to the old "null 2" is replaced by the new cne.
4.11 'GRAPH.'.
Simplest form of name: 'GPA
A group of four parameters describing the position of the "graph window"
within the plotter frame. A graph drawn by AUTOGRAPH (including labels) is
forced to lie entirely within this window. Subgroups and the number of param-
eters in each are as follcws:
'GPAPH/LEFT.'	(1)
'GRAPH/RIGHT.'	(1)
"GRAPH/BCnCM."	(1)
' GRAPH/TOP •'	(1)
4.12 'GaAPg/lZET.'.
Siinplest form of name: 'GRA/LE.'
A floating-point number between "0." and "1." specifying the position of the
left edge of the graph window as a fraction of the distance fran the left edge
to the right edge of the plotter frame.
Default value: "0." .(left edge of plotter frame).
4.13 'GRftpg/teicsr.'.
Simplest form of name: 'GRA/RI.'
A floating-point number between "0." and "1." specifying the position of the
right edge of the graph window as a fraction of the distance frcm the left
edge to the right edge of the plotter frame.
Default value: "1." (right edge of plotter frame).
AUTOGRAPH
- 51 -
PAflAiVITERS

-------
4.14 'GRAP3/B0TICM.
'implest fonn of name: 'GRA/BO.'
,-v floating-point number between "0." and "1." specifying the position of the
bottom edge of the graph window as a fraction of the distance from the bottom
edge to the top edge of the plotter frame.
4
Default value: "0." (bottom edge of plotter frame).
4.15 'GRAPH/IDP.'.
Simplest form of names 'GRA/IO.'
A floating-point number between "0." and "1." specifying the position of the
top edge of the graph window as a fraction of the distance fran the bottom
edge to the top edge of the plotter frame.
Default value: "0." (top edge of plotter frame).
4.16 'GRID.'.
Simplest form of name: "GRI."
. group of five parameters describing the position and shape of the "grid win
dew" within the graph window. Subgroups and the number of parameters in each
are as follows:
'GRID/LEFT-'
(1)
'GRID/RIGHT.'
(1)
'GRID/BOTTOM.'
(1)
'GRID/TOP.'
(1)
'GRID/SHAPE.'
(1)
4.17 'QUD/LZFT.'.
Simplest form of name: "GRI/LE."
A floating-point number between "0." and "1." specifying the position of the
left edge of the area in which the grid windew is to be placed, stated as a
fraction of the distance frcm the left edge to the right edge of the graph
window.
Default value: ".15".
PARAMETERS
- 52 -
AUTOGRAPH

-------
4.18 "GRID/RIGar.'.
Simplest form of name: 'GRI/RI.'
A floating-point number between "0.* and "1." specifying the position of the
right edge of the area in which the grid window is to be placed, stated as a
fraction of the distance from the left edge to the right edge of the graph
windcw.
Default value: ".95".
4.15 'GRID/BCrTDOL *,
Simplest form of name: 'GRI/BO. *
A floating-point nunifcer between "0." and "1." specifying the position of the
bottom edge of the area in which- the grid window is to be placed, stated as a
fraction of the distance fran the bottern edge to the top edge of the graph
window.
Eefault value: ".15*.
4.20 'GRID/ICP.*.
Simplest form of name: 'GSI/TO.'
A floating-point nunfcer between "0.* and "1." specifying the position of the
top edge of the area in which the grid windew is to be placed, stated as a
fraction of the distance fran the tottcm edge to the top edge of the graph
window.
Default value: ".951".
4.21 'GRID/SHME.*.
Simplest form of name: 'GRI/SH.'
A floating-point nunfeec specifying the shape cf the grid window. The grid
window, whatever Its shape, is centered in, and made as large as possible in,
the area specified by the first four parameters in the group 'GRID."'. Ibe
value of 'GRID/SHAPE."* falls in one of four possible ranges, as follows:
• A value less than "0." specifies the negative of the desired ratio of the
grid window's width to its height. For exyrple, the value "-2.n speci-
fies a grid window sfiich is twice as wide as it is high.
AUTOGHA2H
- 53 -


-------
•	The value "0." specifies a grid window of exactly the same shape as the
area specified by the first four parameters in the group 'GRID*.'. The
grid window therefore fills that area completely.
•	A value "s" between "0." and "1." specifies a grid window whose shape is
determined by the range of the user s coordinate data, reverting to the
shape of the area specified by the first four arguments in the group
'GRID.' if the ratio of the shorter side of the grid window to the longer
side of the grid window vrould thereby be made less than "s". For exam-
ple, if "s" were given the value ".5" and the user x coordinate data
ranged in value frcra "0." to "10." and the user y coordinate data ranged
in value frcm "0." to "15.the grid window would be made two-thirds as
wide as it was high; however, if the y coordinate data ranged in value
from "0." to "100."/ the grid window would not be made cne-tenth as wide
as it is high, but would instead be made to fill the entire area speci-
fied by'the first four arguments of the group 'GRID.'.
•	A value "s" greater than or equal to "1." specifies a grid window whose
shape is determined by the range of the user's coordinate data, reverting
to a square if the ratio of the longer side of the grid window to the
shorter side of the grid window would thereby be made greater than Bs".
Note that, if 'GRID/SHAFE.' is given a value greater than "0.", AUTOGRAPH
assumes that the user's x and y coordinate data have the same units (both in
inches, for example) and that the outline of a real two-dimensional object is
to be graphed without distortion. The grid window is shaped in such a way as
to acocmplish this. This feature should not be used when either
'X/LOGARITHMIC.' or 'Y/I£GARITHMIC.' has a non-zero value; doing so will yield
strange results.
Note that either of the values "-1." or "+1." produces a square and that the
value "-1.61803398874989" produces a golden rectangle.
Default value: "0.".
4.22 'X.'.
Simplest form of name: "X."
A group of seven parameters specifying the mapping of the user's x-coordinate
data cnto the horizontal axis of the grid window. Subgroups and the number of
parameters in each are as follows:
'X/MINIMUM.'
(1)
'X/ttAXIMUM.'
(1)
'X/L0GARITHMIC.'
(1)
'X/OFDER.'
(1)
'X/NICE.'
(1)
'X/SMALIZST.'
(1)
'X/LARGEST.'
(1)
PARAMETERS
- 54 -
AUTOGRAPH

-------
See also 'SET.' and 'INVERT.', accve.
4-23
Simplest form of name: 'X/Ml.'
A floating-point number specifying the minimum usee x coordinate to be con-
sidered. This parameter normally has the value "null 1", specifying that the
routine AGSTUP shculd examine the user's x-coordinate data and find the
minimum value for itself.
If the value "null 2" is used, it will be replaced, the next time AGSTUP is
called, by an actual minimum value cctnputed by AGSTUP,
If a non-null value is used, AGSTOP will not examine the user's x-coocdinate
data; the given value will be considered to be the minimum.
If both "X/MINIMJM.' and 'X/MAXIMH.' are given non-null values, the fonder
should have a lesser value than the latter.
Default value: "1.236" ("null 1").
4.24 "XAaraCM.'.
Simplest form of name: "X/taA.*
Analogous to 'X/MINIMUM.', above; it specifies the way in which the maximum x
coordinate is to be determined.
Default value: "1.E36" ("null 1").
4.25 'X/LOGARITHMIC-*.
Silkiest form of name: 'X/LO.'
An integral floating-point number having ere of the values "-1.", "0.", or
"+1>".
•	The value "0." specifies that the mapping of user x coordinates onto the
horizontal axis of the grid window is*to be linear.
•	Ihe values "-1." and "+1." specify that the mapping is to be logarithmic,
in which case all user x-ccocdinate data trust be greater than zero. The
value *~1." is immune to change when 'SET.' (which see, above) is reset;
the value •+!." is not.
AUTOGRAPH
- 55
PARAMETERS

-------
Default value: "0." (linear x mapping).
4.26 'X/CKCER.'.
Simplest form of name: 'X/OR.'
An integral floating-point number having cne of the values "0." or "1.".
•	The value "0." specifies that the values of user x coordinates mapped to
the horizontal axis of the grid window should increase frcm left to
right.
•	The value "1." specifies that user x coordinates should decrease from
left to right.
Default value: "0." (increase frcm left to right).
4.27 'X/KIC2.'.
Simplest form of name: 'X/NI.'
An integral floating-point number having ere of the values "-1.", "0.", or
"+1.".
•	The value "-1." specifies that user x-coordinate data are to be mapped
onto the horizontal axis of the grid window in such a way as to force
major-tick positions at the endpoints of the bottom x axis.
•	The value "+1." specifies that user x-coordinate data are to be mapped
onto the horizontal axis of the grid windew in such a way as to force
major-tick positions at the endpoints of the top x axis.
•	The value "0." specifies that the x-coordinate data are to be mapped so
as to range frcm the left edge of the grid window to the right edge of
the grid window; major-tick positions are not forced at the ends of
either x axis.
Default value: "-1." (bottom axis "nice").
4.28 'I/SJMIZST.'.
Simplest form of name: 'X/SM."
This parameter ccmes into play when AGSTUP is called upen to compute the
minimum x coordinate (when 'X/KDHMUM.' has a null value); if the value of
'X/SMALLEST.' is ncn-null, values less than it will not be considered in the
"mputation.
PARAMETERS
- 56 -
ALLOGRAPH

-------
Default value: "1.E36" ("null 1").
4.29 'X/LAK2ST.'.
Simplest form of name: 'X/IA.'
This parameter ceres into play when AGSTUP is called upon to oenpute the max-
imum x coordinate (when 'X/^AXIWJM.' has a null value); if the value of
'X/LAFGEST.' is non-null, values greater than it will not be considered in the
computation.
Default value: "1.E36" ("null 1").
4.30 *1.*.
Simplest form of name: 'Y.'
A group of seven parameters specifying the mapping of the user's y-coordinate
data crto the vertical axis of the grid window. Subgroups and the number of
parameters in each are a3 follows:
Y/fclNIMUM.'
(1)
Y/MAXEUM.'
(1)
Y/LOGARITOMIC.'
(1)
Y/ORDER.'
(1)
Y/NICE.'
(1)
Y/SMALLEST.'*
a)
Y/LAPGEST.'
(i)
See also 'SET.' and 'INVEST.*, above.
4.31 "Y/MIN3M31. *.
Simplest focm of name: . "Y/MI.'
Analogous to 'X/KTNXMjM.' , above; it specifies the way in which the minimum y
coordinate is to be determined.
Default value: "1.E36" ("null 1").
\
4.32 'Y/tftXDCK.".
Simplest focm of name: 'Y/faA.'
AUTOGRAPH
- 57 -
PARAMETERS

-------
Analogous to X/^^AXE'U^. , above; it specifies the way in which the maximum y
coordinate is to be determined.
Default value: -"1.E36" ("null 1").
4.33 T/rDGARTIHKIC-".
Simplest form of name: 'Y/LO.'
Analogous to 'X.-IXGARrTSilC.', above; it specifies whether the mapping oc y
coordinates is inear or logarithmic*.
Default value: "0." (linear y).
4.34	'Y/DHEEL'.
Simplest form of name: 'Y/OR.'
Analogous to "X/ORDER.above; it specifies whether y-coordinates increase or
decrease from bottcm to top.
Default value: "0." (increase frcm bottom to top).
4.35	'Y/NICZ.'.
Simplest form of name: 'Y/NI.'
Analogous to "x/NICS.'', above; it specifies whether the left y axis, the
right y a^.is# or neither, is to be "nice".
Default value: "-1." (left axis "nice").
4.36 'I/9ftII2ST/.
Simplest form of name: 'Y/SM.'
Analogous to 'X/SMALLEST.'/ above; canes into play when AGSTUP is called upon
to cnnpute the minimum y coordinate.
Default value: "1.E36" ("null 1").
PARAMETEP5
- S3 -
AUTOGRAPH

-------
4.37 'Y/1AKEST.'.
Simplest form of name: 'Y/LA.'
Analogous to 'X/LAPGEST.', above; canes into play when AGSTUP is called upon
to compute the maximum y coordinate.
Default value: "1.E36" ("null 1").
4.38 'AXIS.'.
Simplest form of name: 'AXI.'
A group of 92 parameters describing four axes: the left axis, the right axis,
the bottom axis, and the top axis. Subgroups and the number of parameters in
each are as follows:
'[AXIS/]LEFT."	(23)
'[AXIS/] RIGHT.'	(23)
'[AXIS/] BOTTOM.'	(23)
'[AXIS/]TOP.'	(23)
The elements of the subgroups are interleaved in the group; that la to say,
the first elements of the four subgroups constitute elements 1 through 4 of
the group, the second elements of the four subgroups constitute elements 5
through 8 of the group, and so on.
4.39 '[AXIS/]s.'.
(where "s" means "any one of the keywords LEFT, RIGHT, BOTTOM, or TOP".)
Simplest form of name: 's.'
A group of 23 parameters describing the axis specified by "s". Subgroups and
the number of parameters in each are as follcws:
'[AXIS/] s/CONTROL.'
(1)
'[AXIS/]s/LINE.'
(1)
' [AXIS/]s/INTERSECTION.'
(2)
' [AXIS/] S/FUNCTION.'
(1)
' [AXIS/]s/ITCKS.'
(10)
' [AXIS/] S/ttUMERIC.'
(8)
4.40 .' [AXIS/] s/tTNTHDL.'.
AUTOGRAPH
- 59 -
PARAMETERS

-------
Simplest form of name: 's/CO.'
An integral flcating-point number having crte of the values "-1.", "0.", "1.",
*2.", "3.", or "4." and controlling certain aspects of the drawing of the axis
specified by "s", as follows:
•	The value "-1." specifies that cnly the line portion of the axis may be
drawn; tick marks ar.d numeric labels are suppressed.
•	The value "0." specifies that no portion of the axis may be drawn.
•	A positive value specifies that all portions of the axis may be drawn and
specifies what actions AUTOGRAPH may take to prevent numeric-label over-
lap problems, as follows:
•	The value "1." specifies that numeric labels may not be shrunk or
rotated.
•	The value "2." specifies that numeric labels may be shrunk, but not
rotated.
•	The value "3." specifies that numeric labels may be rotated, but not
shrunk.
•	The value "4." specifies that numeric labels may be both shrunk
and/or rotated.
Default value: "4." for all "a* (all axes drawn, numeric labels may be shrunk
and/or rotated).
4.41 '[AXIS/]s/UNE.*.
Simplest form of name: 's/LI.'
An integral floating-point number having cne of the values "0.* or "1.".
•	The value "0." specifies that the line portion of the axis specified by
"s" nay be drawn".
•	The value "1." suppresses the line portion of the axis specified by "s".
Default value: "0." for all "s" (line portions of all axes may be drawn).
4.42 ' [AXIS/] s/DnSRSECTICN. '.
Simplest form of name: 's/IN.'
A group of two parameters .
PARAMETERS
- 60 -
AUTOGRAPH

-------
' [AXIS/] s/INTERSECTI ON/GRID.'
' [AXIS/] s/INTERSECTION/USER.'
each having the default value "1.E36" ("null 1"). Giving either of them a
non-null value causes the axis specified by "s" to be moved away from its nor-
mal position cn one edge of the grid window. If both are given non-null
values, '.../USER.' takes precedence over '.../GRID.'.
If the left y axis or the right y axis is moved, it remains vertical, but
intersects the bottan of the grid window at a specified x coordinate. Simi-
larly, if the bottan x axis or the top x axis is moved, it remains horizontal,
but intersects the left edge of the grid at a specified y coordinate.
No axis may be moved outside the current graph window; if an attempt is trade
to do so, the axis is moved as far as the edge and no farther.
4 . 43 ' [AXIS/] s/INIERSBCTICN/GRID.'.
Simplest form of name: 's/IN/GR.'
A floating-point number which, if not equal to the current "null 1", speci-
fies, in the grid coordinate system, the x coordinate (if "s" » "i£FT" or
"RIGHT") or the y coordinate (if "s" = "BOTTOM" or "TOP") of the point of
intersection of the axis specified by "s" with the perpendicular sides of the
grid window.
Default value: "1.E36" ("null 1") for all "s" (axes lie cn the edges of the
grid window).
4.44 ' [AXIS/] s/H7IHSECnON/OSER. '.
Simplest form of name: 's/IN/TJS.'
A floating-point number which, if not equal to the current "null 1", speci-
fies, in the user coordinate system, the x coordinate (if "s" » "LEFT" or
"RIGHT") or the y coordinate (if "s" = "BOTTOM" or "TOP") of the point of
intersection of the axis specified by "s" with the perpendicular sides of the
grid window.
Default value: "1.E36" ("null 1") for all "s" (axes lie cn the edges of the
grid windcw).
4.45 ' [AXIS/] s/FTjNCTION. '.
Simplest form of name: 's/FU.'
AUTOGRAPH
- 61 -
PARAMETERS

-------
A floating-point nurrber, passed as an argument to the subroutine &3JT0L; this
subroutine defines the usec-system-to-label-system mappings, and thus the
label coordinate systsris, for all the axes. The default version of AGUTCL
defines the identity mapping for all axes; a user version may be substituted
to define any desired set of mappings. It is intended that 'AXIS/s/FUNCTICN.'
be used within a user version of AGUTOL as a function selector. It is further
reconriended that the value "0." select the identity mapping, thus providing a
way to re-create the default situation.
Tick marks en the axis specified by "s* are positioned in the label coordinate
system. Numeric labels cn the axis give values in the label coordinate sys-
tem.
See the description of 2£UTCL in the section "POUTINES"; see also example 7.
Default value: "0." for all "s" {identity mapping for all axes).
4.46 'lAXIS/ls/TracS.*.
SLuplest form of name: 's/n.'
A group of ten parameters describing the tick marks, if any, which are to be a
part of the axis specified by "s*. Subgroups and the number of parameters in
each are as follows:
' [AXIS/] S/ [TICKS/1 MAJOR.' (6)
* [AXIS/1 s/[TICKS/1 MINOR.' (4)
4.47 " [AXIS/1 s/lTiaCS/]MMDlL'.
Simplest form of name: "s/faA.'
A grcup of six parameters describing the major tick marks, if any, which are
to be a part of the axis specified by "s". Subgroups and the number of param-
eters in each are as folios:
' [AXIS/1 s/[TiatS/l8ffluOR/S?flCING.' (3)
' [ AXIS/1 s/ [TICKS/1 MfcJOR/PATIERtJ. * (1)
' [AXIS/1 s/lTICTS/1 MAJOR/LENGTH.' (2)
4.48 " [AXIS/1 s/[TICKS/1 WJOR/SPACQC.'.
Simplest forru of name: "s/MA/S?.'
PARAMETERS
- 62
AUTOGRAPH

-------
A group of three parameters describing the way in which major tick marks, if
any, are to be spaced along the axis specified by "s". Subgroups and the
number of parameters in each are as follows:
' [ AXIS/] s/[TICKS/] MWOR/t SPACING/] TYPE.' (1)
' [AXIS/]s/[TICKS/] MAJOR/[SPACING/] BASE.' (1)
' [AXIS/]S/[TICKS/]MAJOR/[SPACING/]COUNT.' (1)
4.49 ' [AXIS/] s/[TICKS/] MWOR/[SPACING/] TYPE. '.
Simplest form of name: 's/ttA/IY.'
A floating-point number specifying where major tick marks are to be placed
along the axis specified by "s" (that is to say, at what values in the label
coordinate system along that axis). Let "b" represent the value of the param-
eter '.../BASE.' (described next) and "k" represent an arbitrary integer.
Then, there are six acceptable values of '.../TYPE.':
•	The value "0." specifies that no major tick marks are to be drawn on the
axis.
•	The value "1." specifies major tick marks at values of the form plus or
minus b times k.
•	The value "2." specifies major tick marks at values of the form plus or
minus b times 10 to the pcwer k.
•	The value "3." specifies major tick marks at values of the form plus or
minus b to the pcwer k.
•	The value "null 1" specifies that AUTOGRAPH shculd use a value "1.",
"2.", or "3." - whichever it oonsiders best.
•	The value "null 2" specifies that AUTOGRAPH should use a value "1.",
"2.", or "3." - whichever it oonsiders best - and replace the "null 2" by
that value.
Notice that major tick marks on a linear axis may be spaced logarithmically
and that major tick marks on a logarithmic axis may be spaced linearly; this
is sometimes useful.
Default value: "1.E36" ("null 1") for all "s" (AUTOGRAPH spaces major tick
marks as it sees fit).
4.50 ' [AXIS/] s/[TT(3S/]MWOR/[SPACING/]BASE.'.
Simplest form of name: 's/toA/BA.'
AUTOGRAPH
- 63 -
PARAMETERS

-------
A floating-point number which, if greater than zero and non-null, specifies
the base value {"b", in the preceding parameter description) used in spacing
major tick marks in the label coordinate system along the axis specified by
"s". A negative or zero value suppresses major tick m^rks cn the axis. A*
null value causes ALJTCGRAPH to pick an appropriate base value and, if the null
was a "null 2", to backstore that value in place of the "null 2".
Default value: "1.E36" ("null 1") for all "s" (AUTOGRAPH picks the base
values).
4.51 ' [AXIS/]s/1TICXS/]MAJOR/[SPACING/]CDCUTT.'.
Simplest form of name: 'sAA/CO.' ~
A floating-point number, having an integral value "n" greater than or equal to
0. A negative value is treated as if it were a zero. The value n is cnly
used when major tick marks are to be spaced linearly and the base value ("b",
in the preceding parameter descriptions) is to be chosen by AUTOGRAPH. In
this case-, n is a rough estimate of the minimun number of major tick marks to
be placed cn the axis specified by "s". The actual number used may vary
between "n+2" and "^n/^M" (approximately).
Default value: "6." foe all "s" (somewhere between 8 and 19 major tick marks
per linear axis).
4.52 " [AXIS/] s/tTICXS/lJAJCR/PATIEEN.'.
Simplest form of name: 's/taA/PA.*
A floating-point number specifying the dashed-line pattern to be used for
major tick marks cn the axis specified by "s". Normally, its integer
equivalent is a 16-bit integer in which "0" bits specify "pen-up" segments
(gaps) 3 plotter units long and "1" bits specify "pen-dewn" segments (solids)
3 plotter units long. The value "0.* turns off the major tick marks, the
value "65535." (decimal) * "177777." (octal) makes them solid lines. If the
value "null 1" is used, the next call to AGSTUP resets it to "65535."
(decimal).
Default value: "1.E36" ("null 1") for all "s" (solid-line patterns).
4.53 '[ AXIS/] s/[TIC3S/]i®JDR/mCT.'.
Simplest form of name: "s/MA/LE.'*
A group of two parameters determining the length of the aitward-pointing and
inward-co in ting portions of the major tick marks cn the axis specified by "s".
Subgroups and the number of parameters in each are as follows:
PARAMETERS
- 64 -
AUTOGRAPH

-------
'[ AXIS/] s/[TICKS/] MAJOR/1UENGTO/] OUTWARD.' (1)
' [AXIS/]s/[TICKS/]MAJOR/[LENGTH/] INWARD.' (1)
4.54 " [AXIS/1 s/[ TICKS/] MAJOR/[LJENTEB/lOCTIWARD.' .
Simplest form of name: 's/fr!A/CU.'
A floating-point number specifying the length of the outward-pointing portion
of each major tick mark cn the axis specified by "s". The value must be of
the form "e", "l.+e", or "-e", where "e" is greater than or equal to "0." and
less than "1." and represents a fraction of the smaller dimension of the grid
window.
Note: "Outward" is defined relative to the normal position of the axis "s",
even when that axis has been moved away from its noraal position.
•	When a value "e" is used, each major tick mark extends outward "e" units
fran the axis.
•	When a value "l.+e" is used, each major tick mark extends outward to the
farther edge of the grid window and then "e" units beyond that edge. (If
the axis is not moved away fran its normal position, "l.+e" has the same
effect as "e".)
•	When a value "-e" is used, the first "e" units of the inward-pointing
portion of each major tick mark are erased. (This can be used to create
off-axis major tick marks - for whatever that may be worth.)
Default value: "0." for all "s" (all major ticks point inward).
4.55 ' [AXIS/] s/I"naCS/]»JCP/Il^H7IH/] D«AHD.'.
Simplest form of name: "s/^A/IN."
A floating-point number specifying the length of the inward-pointing portion
of each tick mark cn the axis specified by "s". The value mist be of the form
"e", "l.+e", or "-e", where e is greater than or equal to "0." and less than
"1." and represents a fraction of the smaller dimension of the grid window.
Note: "Inward" is defined relative to the normal position of the axis "s",
even when that axis has been moved away fran its normal position.
•	When a value "e" is used, each major tick mark extends inward "e" units
fran the axis.
•	When a value "l.+e" is used, each major tick mark extends inward to the
farther edge of the grid window and then "e" units beyond that edge.
This feature is used to create grid backgrounds.
AUTOGRAPH
- 65 -
PARAMETERS

-------
• When a value "-e" is used, the first "e* units of the outward-pointing
portion a£ each major tick mark are erased.
Default value: ".015" for all "s" (ail major ticks point inward).
4.56 ' [AUS/] 2/[TICKS/] munch. '.
Simplest form of name: "a/Hi."'
A grcup of fcur parameters describing the ainoe tick macksr if any, vihLch are
to be a part of the axis specified by "s*. Subgroups and the number of param-
eters in each are as follows:
' [AXIS/Is/ITICXS/]MDCR/S?RCING. * (1)
' [AXIS/] s/[ TICKS/]MINDiVPATTEJW. " (1J
' lAXIS/l3/l«na!S/]MINDVl2NGIB.'' (2)
4.57 * I AXIS/] s/[TICSS/lKIiCR/'SPBCIlC* * »
Simplest form of name: "s/KT/SP."
A floating-point number specifying the desired number of minor tick marks to
be distributed between each pair of major tick marks cn the axis specified by
¦s*. Acceptable values are as follows:
•	A value less than *1.* suppresses minor tick marks completely.
•	A value greater than or eqsal to "I.* vfcich is ncn-r-li shculd be
integral; iz specifies the nucfcer of mir.cr tick marrts directly.
•	The values "null 1* and "null 2" specify L-at ISTQCWH is to choose a
teascn=bla integral valuer if a *null 2" is specified, Lt is replaced by
the integral value chosen.
The minor tick marks, if any, are spaced linearly in the label coordinate sys-
tem along the axis specified by "a" * '.tote that the appropriate value for the
usual sort of logarithmic axis is "8."; this causes the minor tick marks
between two major tick marks at label-system values lG*#n and 10**(ri+l) to be
placed at the label-system values 2*10**n, 3*10**n, 4*10**n, ..., 9#10**n.
Default value: "1.E36* ("null 1") for all "s* (AlTICGSAFH chooses appropriate
values).
4.5a *lAES/1 a/[TICKS/] KHCR/PAITESN-J .
PARAMETERS	- 65 -
MJTCGPArH

-------
Simplest form of name: "s/tol/PA."
A floating-point number specifying the dashed-line pattern to be used for
minor tick marks cn the axis specified by "s"; analogous to
' [AXIS/]s/[TICKS/]MRJ0R/PATIT3N.', described above.
Default value: "1.236" ("null 1") for all "s" (solid-line patterns).
4.59 AXIS/] s/[ TICKS/] MINDP/LENGTB.'.
Simplest form of name: 's/Ml/LE.'
A group of two parameters determining the length of the outward-pointing and
inward-pointing portions of the minor tick marks on the axis specified by "s".
Subgroups and the number of parameters in each are as follows:
* I AXIS/] s/ [ TICKS/] MINOR/1 LENGTH/] (XJTWARD. * .(1)
" [AXIS/]s/[TICKS/]MINOR/[LENGTH/] INWAED.' (1)
*4.60 * [AXIS/]s/[TICKS/]MINOR/ [LENGTH/]CUIViAFD.'.
Simplest form of name: "s/tO/CO./
A floating-point number specifying the length of the outward-pointing portion
of each minor tick mark cn the axis specified by "s"; analogous to
MAJOR/[LENGTH/]OUTWARD.', described above.
Default value: "0." foe all •3" (all minor ticks point inward).
4.61 '[AnS/]s/lTICXS/]MDCR/tLaCTH/]DWAPD.'.
Simplest form of name: 's/VH/TR.*
A floating-point number specifying the length of the inward-pointing portion
of each minor tick mark cn the axis specified by "s"; analogous to
'...MAJOR/[LENGTH/]IJWARD.', described above.
Default value: *.010" for all "s" (all minor ticks point inward).
4.62 * [AXIS/] s/NDHERIC. '.
Sinplest form of name: "s/NU.'
AUTOGHAPH
PARAMETERS

-------
A group of eight parameters describing the numeric labels, if any, which are
to be a part of the axis specified by "s". Subgroups and the number of param-
eters in each are as follows:
' [AXIS/] s/[NUMERIC/] TYPE."	(1)
"* (AXIS/] s/[NUMERIC/] EXPONENT.' (1)
' [AXIS/1 s/lNUMERIC/] FRACTION.' (1)
' [AXIS/Is/[NUMERIC/]ANGLE,' (2J
' iMCIS/la/lNGMERIC/lOFFSEr." (1)
' [AXIS/Is/tSlUMERiq/lWimH." (2)
4. S3 'lAZIS/ls/tHtMKIC/lTZPS.'.
Simplest fora of name: "s/IY-"
The three parameters
- [ AXIS/] s/ [NUMERIC/] TYPE* "*
" [ AXIS/I s/1 NUMERIC/1 EXPONENT.'
* [AXIS/] s/[NUMERIC/] FRACTION.'
will be described together, because they are so closely interdependent. They
specify the type of numeric labels to be used (at snajoc-tick positions) on the
axis specified by "s*. A fourth parameter,
' [AXIS/] s/ [TICKS/] MATOIV'tSPflCIMQ/'lTSSE.',
described above, also affects the type of numeric labels to be used. I shall
rafer to these four parameters in the .ensuing discussion using short forms of
their names I's/TYPE.', 's/EXPO.*, 's/FRtC.', and 's/MAJOR/TYPE.' , respec-
tively) .
All four have the default value "null 1" (except for the first, which has the
default value "0." for "s" » "RIGHT" and "TOP"), leaving AUTOGRAPH free to
choose values which axe consistent with each other and with other parameters
describing the axis specified by *s". Any one or icoce of them may be given
the value "null 2" {in which case an actual value chosen by AUTCGRAPH is back-
stored ever the "null 2") or an actual integral floating-point value. Accept-
able actual values are as follows:
•	Setting "s/TWE." to "0." turns off the numeric labels cn the axis speci-
fied by "s". The other three parameters are then ignored.
*	Setting *s/T£PE.J to "1.* selects "scientific* notation. Each numeric
label is written in the form
I-] Cil U Cf! x 10 e
where brackets enclose portions which may be independently present or
absent and "e" is a superscript exponent.
parameters
- sa -
AUTOGRAPH

-------
The parameter 's/EXPO.' specifies the length of "i" (the number of char-
acters) / thus also specifying the value of the exponent "e". If
"s/EXPO." has a value less than or equal to zero, "i" is emitted. If
's/EX?0.' is less than zero and has the integral absolute value "n", the
fraction "f" is forced to have "n" leading zeroes.
The parameter 's/TRPC." specifies the length of "f" (the number of char-
acters). If 's/TRPC." is less than or equal to zero, "f" is emitted. If
's/FRPC.-* is less than zero> the decimal point is emitted.
If "til [.] [fl" has the value "1.", the first part of the label is emit-
ted, leaving only "10 e".
If the entire label has the value "0.", the single character "0" is used.
The value of 's/MAJOR/TYPE.' is immaterial.
• Setting 's/TXFE." to "2." selects "exponential" notation, the exact
nature of which depends cn the value of 's/ttAJOR/TYPE.', as follows:
•	If 'sAlAJOR/TyPE.' has the value "1." (all major ticks at values of
the form plus or minus b times k), each numeric label is written in
the form
[-1 til U If] x 10 e
where brackets enclose portions which nay be independently present
or absent and "e" is a superscript exponent.
The parameter 's/EXBO.' specifies the integral value of the exponent
"e".
The parameter 's/FRAC." specifies the length of "f" (the number of
characters). If 's/FRAC.' is less than or equal to zero, f is emit-
ted. If 's/TRAC.' is less than zero, the decimal point is emitted.
If the label value is exactly zero, the single character "0" is
used.
•	If 's/toAJOR/TXPE."' has the value "2." (all major ticks at values of
the form plus or minus b times 10 to the pewer k), each numeric
label is written in the form
H til (.1 If] x 10 e
where brackets enclose portions which may be independently present
or absent and "e" is a superscript exponent.
The parameter "s/BtPO." specifies the integral value of the exponent
"e" when "k" equals "0." The value of "e" is "s/BOO." plus "k".
The parameter 's/TR2C.' specifies the length of "f" (the number of
characters). If 's/TRfC." is less than or equal to zero, "f" is
AUTOGRAPH
- 69 -
PARAMETERS

-------
emitted. If 's/FRPC.' is less than zero, the decimal point is cnr't-
ted.
If the label value is exactly zero, the single character "0" is
used.
If 's/MfiJOP/TYPE.' has the value "3." (all major ticks at values of
the form plus or minus b to the pewer k), each numeric label is
written in the form
H [i] I.) If] e
where brackets enclose portions which may be independently present
or absent and "e" is a superscript exponent.
The parameter 's/EXPO.' is ignored. The value of "e" is "k".
The parameter 's/FFAC.' specifies the length of "fB (the number of
characters). If 's/FRPC.' is less than or equal to zero,."f" is
emitted. If 's/TRAC.' is less than zero, the decimal point is emit-
ted.
Note that "[i] [.] tfl" expresses the value of "b".
• Setting 's/TYFE.' to *3." selects "no-exponent" notation, the exact
nature-of which depends en the value of s/MAJOR/TYPE.', as follcws:
•	If "s/t^JOP/TYPE. * has the value "1." (all major ticks at values of
the form plus or minus b times k), each numeric label is written in
the form
i-i m [.] [fi
where brackets enclose portions vAich may be independently present
or absent.
Ihe parameter "s/EXPO." is ignored.
The parameter 's/tWC.' specifies the length of "f" {the number of
characters). If 'g/TRAC.' is less than or equal to zero, "fi" is
emitted. If 's/FMC.' is less than zero, the decimal point is emit-
ted.
If the label value is exactly zero, the single character "0" is
used.
•	If 's/^QUDR/TYPE.' has the value "2." (all major ticks at values of
the form plus or minus b times 10 to the power k), each numeric
label is written in the form
H IiJ U tf]
where brackets enclose portions which may be independently present
PARAMETERS
- 70 -
AimXLRPiFH

-------
c: absent.
Ihe parameter 's/EXPO." is ijnored.
Tt» iersgtfr of "f" '.tre nursser of clr.sractaxs} is specitiea tav the
fur.cticn
HAXC*S/?3flC.',C} - x
if this quantity is greater than zero, and
MH4('S /?S2C.',V)
otherwise. 3his atay appear sar.ewnat foczidahln, but it produces 4
simple, desirable iss^iit. Suppose, fee kiample, that 's/FRAC.' «
*1.*, "b" * "3.5", and "k." ranges Scot V3" to *+3"; the lacels ?ri>-
duced axe
.0036, .036. .36, 3.6, 36., 36EL, ard 3«50.
The parameter *s/TBfC.'' may be viewed es specifying the length c£
"f" wien "s* is lero. If the* Sanction value i.s less than or equal
to 2ecot *£" is acitted; if it is lass than zero, the dectinal point
is emitted.
* If 's/MAJGR/TvpE-' has the value "3." (all major tides at values of
the form plus or minus b to the g&iec k) i each rjaracic label is
written in the form
H HI [-] {«
if •51" is greater than or equal to zero, and in the for®
H 1/ U3 U) MJ
if *5t" is less than tsro. Brackets enclose pactions which may fee
independently present or absent.
The parameter 'a/EXPO,' is ignored.
the lesgth oC "£" (the nunijec of ctiacactets) is specified by the
function
's/IWC/ * JffiS{k)
if "fc* is nan-aero, ot
if "k™ is zero. Aqarn, this Sssvcticn prcfiuces a siirple result.
Supccse that 's/TSAC-' * "l.", *b" * "1.1", and "is* ranges ficnt "-3"
to *+3"; the labels produced are
flCXOGBKPH
- 71 -
FARWTK®

-------
1/1,331, 1/1*21, 1/1-1, 1., 1.1, 1.21, and 1.331
The carametsr *s/FMC.* my be viewed as specifying thfl length of
"t" vhen "** is equal to 1. If the function value is less than or
equal to zero, "f* is emitted; if it is less than zero, the deci-iva!
point ia emitted.
Another exixple: suppose 's/TRPC.' **	"b" » "2.", and wk"
carvges frcra "-4" to V**; tJie labels produced are
L/1S, I/Bf 1/4, 1/2/ lt 2, 4, Qf and Iff
Default value: "1.E3S* ("null 1") for all three for all *s* (AUTDGEAFH
chooses values to use), except foe
J RIGHT/flCVE3HC/J TYPE.' and
"TOP/lHUMEaiC/lTlffE.*,
which are zeroed to suppress the numeric labels cn the right and top axes.
4.64 ' [MIS/1 S/ [HOMERIC/] 23CPCKENT.*.
Simplest form of name: "s/EX."
See the discussion, of * I AXIS/] 3/ [NUKERIC/1 TYPE. *, ±ove.
4.65 " I-AXIS/l s/ [ IfMSZC/l FXfidTQK. '.
Simplest Ecra cf name? 's/FS**
Se« the discission cf * [JjaS/Os/lNUMESIC/lTYPE.'*, above.
4.66 'LKCS/]a/Il«KEUC/]M)GtZ.'.
Sijnplest form of name: *s/AN.'
A group of two integral floating-point nunfcecs specifying the orientation
angle c£ numeric labels cn the axis	specified by "s". Subgroups ami the
number of parameters in each are as follows:
' [AXIS/1 s/tWMEHC/1 RNGLEAST.'	(1)
' f AXIS/] s/tKLMERIC/J AWGLS/2M?. ' /2J
PARAMETERS
- 72 -
RLTOGSAPH

-------
4.67 '[AXIS/] s/[NO^ERIC/]ANGLE/lST.'.
Simplest form of name* 's/AN/lS.'
An integral floating-point number having one of the values "0.", "90.",
"130.", or "270." (plus or minus a small multiple of "360."), specifying the
user's first choice for the orientation angle of numeric labels on the axis
specified by "s". The value is stated in degrees oounter-clockwise fran a
left-to-right horizontal vector.
The routine AGSTUP decides whether the first choice or the second choice is to
be used. The second choice is used cnly when the first choice leads to over-
lap problems and the current value of '[AXIS/ls/CONTroL." is a "3." or a "4."
and the second choice works out better than the first. If AGSTUP decides to
use the first choice, it leaves the first-choice parameter with a positive
value; if it decides to use the second choice, it leaves the first-choice
parameter with a negative value. Values are made positive or negative by
adding and subtracting multiples of "360.".
Default value: "0." for all "s" (horizontal labels preferred cn all axes).
4.68 * [AXIS/]s/lNOMERIC/]AHGLEV2M3.'.
Simplest form of name: 's/AN/2N.'
An integral floating-point number having cne of the values "0.", "90.",
"180.", or "270." (plus or minus a snail multiple of "360."), specifying the
user's second choice for the orientation angle of numeric labels ai the axis
specified by "s". The value is stated in degrees counter-clockwise fran a
left-to-right horizontal vector. See the description of the preceding parame-
ter.
Default value: "90." for all "s" (vertical labels, readable fran the right,
on all axes).
4.69 ' [AXIS/] s/[NCMERIC/] OFFSET.'.
Simplest form of name: 's/QF.'
A floating-point number specifying the desired position of numeric labels
relative to the axis specified by "s".
If the value is positive, numeric labels are to be placed tcward the cutside
of the grid. If the value is negative, numeric labels are to be placed tcward
the inside of the grid. In either of these two cases, the magnitude of the
value specifies the distance from the line portion of the axis to the nearest
part of any numeric label, stated as a fraction of the smaller dimension of
the grid window. Note: "Inside" and "outside" are defined relative to the
normal position of the axis "s", even when that axis has been moved away fran
AUTDGBAPH
- 73 -
PARAMETERS

-------
its normal position.
If the value is exactly zero, each numeric label is centered cn the axis. In
this case, the line portion of the axis is suppressed and major and minor tick
marks are moved outward so as not to overlap the numeric labels.
Default value: ".015* for all "s" (all labels outside the grid) .
4.70 ' [AXIS/] 3/ [iCMERIC/1 WIDTH. ".
Simplest form of name: 's/Vfl.*
A group of two floating-point parameters	specifying the widths of characters
to be used in numeric labels cn the axis	specified by "s". Subgroups and the
number of parameters in each are as follcws:
' [AXIS/] s/[NUMERIC/]WIDTH/MANTISSA.'	. (1)
" [AXIS/] s/tNlJMERIC/lWID'IH/EXPCNENT.'	(1)
4.71 ' [AXIS/] a/[JCFERIC/]WimH/MftNTISSA. '.
Simplest form of name: 's/Vl/MA.'
A floating-point number specifying the width of characters to be used in the
"mantissa" of each numeric label cn the axis specified by "sn, expressed as a
fraction of the snaller dimension of the grid window.
Default value: ".015" for all "s".
4.72 '[AXIS/13/[HCHERIC/lWnnH/EXPCHEOT.'.
Simplest form of name: *s/Wl/EX.*
A floating-point number specifying the width of characters to be used in the
exponent of each numeric label cn the axis specified by "s", expressed as a
fraction of the snaller dimension of the grid window.
Default value: ".010" for all "s".
4.73 'HASH.'.
Sinrplest form o£ name: ""DAS.'
PARAMETERS
- 74 -
AUTCGPAFH

-------
A group of thirty parameters, the first of which determines what dashed-line
patterns are to be used by the routines EZJtf and E2MXY and the cest of which
describe the "user" set of dashed~lir.e patterns fas opposed to the "alpha-
betic" set, which is defined by cede in the subroutine AGCUHV and is not sub-
ject to change by the user]. Subgccups and the number of parameters in each
are as followst
'DASH/SELECTOR.'
11)
'DASH/LENGTH."
(U
'd^/ckawcsr.'
(1)
"I^Ea'trLIAft-CUCTE."
tt)
"DASH/PATTERNS.'
(25)
4.74 'DASB/SffiBCTCSL*.
SIurplest fa cm of name: 'D6S/SE.*
The parameter 'DASH/SELECTOR.' is given a ^ecativs integral value to specify
that the routines SStt and ESKOf should use the "alphabetic" set of 26 dashed-
line patterns for the curves they draw and a positive integral value "n", less
than or equal to 26, to specify that EZf-Ef and EZMH should use the first "n™
patterns in the "user" set of dashed-line patterns, as defined by the current
values of the remaining parameters in the group 'MSB.',
Each of the patterns in the "alphabetic" set specifies a solid line inter-
rupted periodically by a letter of the alphabet. Sach of the patterns in the
"user" set is as defined by th% user, The default "user" set produces all
solid lines.
Hie rcutines ESY and EZX3, which draw but cne curve per call, always use the
first of the patterns in the "user" set; they are unaffected by the value of
'DASH/SEL2CIDH.'.
The selected pattern set is used In a circular fashion. For example, if
'DASH/SELSC7GR.' has the value "3." and EZMT is us«d to draw nine curves, pat-
tern 1 is used for curves 1, 4, and 7, pattern 2 foe curves 2, 5, and 8, and
pattern 3 for curves 3/ 6, and 9.
Default valuer "+•!.• (The first element of the "user" set of dashed-line
patterns is to be used by E2MST and E2MXY.J
4.75 'DftS^AadH-'.
Simplest fcen of -arc: 'DAS/LE.'
An integral floating-point ntmber specifying bow Icrsg character-string dashed-
line patterns are expected to be. In a user call to AMOTAT with a positive
fifth argument {Implying that the sixth argument U an array o£ chafacter-
MJTOGRAPH
- 75 -
PARAMETERS

-------
string dashed-line patterns) or in a usee call to AGSEic setting
'DASH/PAITESN/n.' {in which case the second argument is such a pattern), the
specified character strings must be. of the length specified by the current
value of 'DASH/LENGTH.".
Default value: "3." (dashed-line patterns are expected to be eight characters
long) .
4.76 'DASSASfti^CIHL'.
Sidlest form of name: "DAS/CH."
A floating-point number specifying the width of each character (other than a
dollar sign or a quote} which is drawn along a curve as directed by a
character-string dashed-line pattern (whether from the "alphabetic" set or
fran the "user* set). This width is expressed as a fraction of the smaller
dimension of the grid windew.
Default value: ".010*
4.77 'DASg/lXZIAR-QOOTE.'.
Si-nplest form of name: 'DftS/DO.'
A floating-point number specifying the line length corresponding to a dollar
sign (solid) or a quote (gap) in a character-string dashed-line pattern,
expressed as a fraction of the snaller dimension of the grid window.
Default value: ".010"
4.78 'QAS3/PA2TE3C. ".
Simplest form of names 'DAS/PA.'
A group of 26 parameters defining the "user" set of dashed-line patterns.
Subgroups and the number of parameters in each are as follows:
' DASH/PATEESNS/1. * (1)
' DASH/PATTEENS/2.' (1)
*
*
"* DASH/PAITESNS/2 6. * (1)
PARAMETERS
76 -
alitcgkaph

-------
4.79 'EASa/PATIEFNS/n . *.
Simplest form of name: 'DAS/PA/n.*
(The symbol "n" represents an integer between "1" and "26", inclusive.) An
integral floating-point number defining the "n"th dashed-line pattern in the
"user" set.
If the value is positive, it must be between "0." and "63535.", inclusive, and
is interpreted as a 16-bit binary pattern in which each "0" bit specifies a
"pen-up" gap segment 3 plotter units long and each "1" bit specifies a "pen-
down" solid segment 3 plotter units long. Such a pattern may be defined by a
user call to AGSETI or AGSETF.
If the value is negative, it serves as an identifier, allowing AUTOGRAPH to
retrieve, frcm its character storage space, a character string in which each
single quote specifies a "pen-up" gap segment, each dollar sign specifies a
"pen-down" solid segment, and each other character is simply to be drawn as a
part of the line. Such a pattern nay be defined by a user call to AGSETC.
Note that the function "AGDSHN" allows a user to easily generate the name of
the "n"th dash pattern.
Default'values: "65535." for all "n" (solid lines).
4.80 'LNBEL.'.
Simplest form of name: ''LAB."
A group of 3+10*n parameters, where "n" is the current value of
'LABEL/T3UFFER/LDJGTH.' (8, by default) describing up to "n" informational
labels. These labels are a part of the background drawn by a call to the rou-
tine A(3PCK. Subgroups and the number of parameters in each are as follows:
- LABEL/CONTROL. *	(1)
'LABEL/BUTFER/LENCTIH.'	(1)
'LABEL/BUFFER/OONTENIS.'	(10*n)
'LABEL/NAME.'	(1)
4.81 'LamvocwnoL.'.
Simplest form of name: 'LAB/00.'
An integral floating-point number having the value "0.", "1.", or "2.".
Values greater than "2." are changed to a "2." by the next AGSTUP call.
Values less than "0." are changed to a "0." by the next AGSTUP call? negative
values have a special use, however (see belcw).
AUTOGRAPH
- 77 -
PARAMETERS

-------
• The value "0." disables the drawing of informational labels. They regain
defined, hc-rever.
*	The value "1." enables the drawing of informational labels and specifies
that they ray not be shrunk in response to overlap problems.
•	The value "2." enables the drawing of informational labels and specifies
that they may be shrunk in response to overlap problems.
Default value: "2." {labels enabled, shrinkable).
Special action by AGSFIP: fln flCSETP call which sets this parameter (individu-
ally, rather than as part of a group) to a negative value results in the dele-
tion of all currently-defined labels. Note that the negative value is changed
to a 2ero by the next AGSTUP call; thus* the drawing of informational labels
is disabled until re-enabled by the user.
4.82 'LRBEVBGFSEa.'.
Simplest form of name: "IAB/BU."
A group of l+lG*n parameters, where "n" is the current value of
*LABEL/BUFFEP/ISKTIH.* <8, by default). Subgroups and the number of parame-
ters in each are as follows:
'LftBEVBUFFEHASXJIH.' (1)
" LAEE3VBUFEILVCONTENTS.' (lfl*nj
4.33 'IJffiEVBOiTEa/LESGIH.'.
Simplest form of name: "LAB/BC/LE.*
An integral floating-point number specifying the number of 10-word label
definitions the label buffer-will hold. A user program may need to retrieve,
but mast not set, the value of this parameter, since its value must match the
second dimension of the label buffer.
Increasing the size of the label buffer requires modifying the AUTOGRAPH
source code. See the paragraph "mTOFtMIONAL LABELS", in the section "OVER-
VIEW".
Default value: "8.".
4.34 'LAEEL/BUFEES/OaNTTircS.'.
PARAMETERS
- 73 -
AUTOGRAPH

-------
Simplest form of name: 'LAB/BU/CO.'
This parameter group may be thought of as an array FLL3, dimensioned lOxn,
containing up to n 10-word label definitions. For a second subscript j,
•	FLLB(l,j) is either a floating-point "0.", saying that no label is
defined by this 10-word block, or it is non-zero, in which case it iden-
tifies a character string in AUTOGSAPH's character-string storage area;
the character string serves as a name for the label defined by this 10-
word block. When FLLB(l,j) is non-zero:
•	FLIB(2,j)- is either a "0.", to enable drawing of the label, or a "1.", to
disable drawing of the label,
•	FLLB(3,i) and FLLB{4,j) are the x and y" coordinates of the label's
"basepolnt", in the grid coordinate system,
•	FLIB(5,j) and FLI£(6,j) are the x and y components of the label's "offset
vector", stated as signed fractions of the snaller dimension of the grid
window,
•	FLLB(7,j) is an integral floating-point number "0.", "90.", "180.", or
"270.", specifying the angle at which the label's "baseline" emanates
frcra the end of its offset vector,
•	FLLB(8,j) is an integral floating-point number specifying hew the lines
of the label are to be positioned relative to the end of the offset vec-
tor ("-1." to line up the left aids, "0." to line up the centers, or
"+1." to line up the right ends),
•	FU£(9,j) is an integral floating-point count of the number of lines
belonging to the label, and
•	FLLB(10,j) is an integral floating-point pointer specifying the second
subscript (in the line buffer) of the first line of the label (the cne
having the largest line number), or, if no lines belong to the label, a
"0.".
It is not reccnmended that a user program change the contents of this buffer
directly. Label definitions should be accessed indirectly by means of the
parameters 'LABEL/NAME.' and 'LABEL/[DEFINITION/]...'.
Default valuesi The label buffer contains four pre-defined labels, correspond-
ing to the four edges of the grid windew. Hiey ate AS follewat
AUTOGRAPH
- 79 -
PARAMETERS

-------
Name:
Suppression flag
Basepoint x:
Base point y:
Offset x:
Offset y:
Baseline angle:
Centering cction
Line count:
First-line index
'V 'R'	'3*	'r
0.0 0.0	0.0	0.0
0.0 1.0	0.5	0.5
0.5 0.5	0.0	1.0
-0.015	+0.015	0.0	0.0
0.0 0.0 -0.015 +0.015
90.0 90.0	0.0	0.0
0.0	0.0	0.0	0.0
1.0	1.0	1.0	1.0
1.0	2.0	3.0	4.0
The description of 'LINE/BUFFER/CONTENTS.', telcw, gives the default values
for the definitions of the lines which belong to these labels.
4.85 'IAEErvBCFFEVKAMES.'.
Simplest form of name: "LAB/BU/NA."
This group is a subset of the previous cne. It provides a way of retrieving
the names of all currently-defined labels.
4.86 'IABEVNAME.'.
Simplest form of name: 'IAB/NA.'
An integral floating-point pointer which# if non-zero, specifies a particular
label in the label buffer - the cne which is to be referenced by the parameter
group 'LABEL/DEFINITION/ (which see# belcw).
Setting 'LABEL/NAME.' is the required-first step in accessing a particular
label definition.
Default value: "0." (undefined).
Special action by AGSETP: Tb access the definition of a particular label, one
must first call AGSETC with "LABEL/NAME." as the first argument and the name
of the label cne wishes to access as the second argument. This causes AGSETP
(which is called by AGSEIC) to search for the definition of the desired label
in the label buffer. If that definition is not found, a new cne is made up
and inserted in the label buffer. In either case, 'LABEL/NAME.' is given a
floating-point value whose integer equivalent specifies the second subscript
of the label definition in the label buffer.
The definition of a new label has the name specified by the user, a suppres-
sion flag "0.", a basepoint (.5,.5), an offset vector (0.,0.), a baseline
angle "0.", a centering option "C.", a line count "0.", and a first-line index
"0."
PARAMETERS
- 80 -
AUTCGRAFH

-------
4.87 "LABEL/EEFi^lTlCN.'.
Supplest form of name: 'LAB/DE.'
A set of nine parameters defining the label specified by the current value of
LABEL/NAME. • If LABEL/NAME, has the value "0.", referencing this grouo or
a parameter in it causes an error exit. Subgroups and the number of parame-
ters in each are as follows:
'LABEL/[DEFINITION/1 SUPPRESSION.'	(1)
'LABEL/[DEFINITION/] BASEPOINT..'	(2)
'LABEL/[DEFINITION/] OFFSET.'	(2)
'LABEL/[DEFINITION/] ANGLE.'	(1)
'LABEL/[DEFINITION/] CENTERING.'	(1)
' LABEL/ [DEFINITION/] LINES.'	(1)
'LABEL/[DEFINITION/] INDEX.'	(1)
4.88 'IABEL/[DEFTNTnCK/] SUPPRESSION. '.
Simplest form of name: 'IAB/SU.'
An integral floating-point "suppression flag" having the value "0." or "1."
and specifying whether drawing of the label specified by 'IABEL/ttAME.' is
enabled ("0.") or disabled ("1.").
Default value for a new label: "0." (label enabled).
Special action by AGSETP: If a user program attenpts to set this parameter
(individually, rather than as part of a group) to a negative value, the lines
of the label specified by "LABEL/NAME." are deleted and 'LINE/DUMBER.' is
zeroed, if the negative value is less than "-1.", the label is deleted as
well and 'LABEL/NAME.' is zeroed. (Deleting a label means that its name cell
Is set to "0.".)
4.89 'LAHEVlDQTINnTCN/JBASEPOINr.'.
Simplest form of name: 'LAB/BA.'
A set of two parameters specifying the x and y coordinates of the basepoint of
the label specified by 'LABEL/NAME.', in the grid coordinate system. The
label is positioned relative to this basepoint. Subgroups and the number of
parameters in each are as follows:
' LABEL/ [ DEFINITICN/IBASEPOINT/X.' (1)
'LABEL/[DEFINITICN/lBASEPOINT/y.' (1)
AUTOGRAPH
- 81 -
PARAMETERS

-------
4.90 'IABElVtDEFINITICN/]BASEPOINTA.'.
Simplest fonn of name: 'LAB/EA/X.'
The x coordinate of the basepoint of the label specified by 'IABEL/NAME.'.
The value "0." refers to the left edge of the grid window/ the value "1." to
the right edge of the grid window.
Default value for a new label: ".5" (centered).
4.91 'LAraVtEEyiNITICN/lBASEPOINTA.' •
Simplest form of name: 'LAB/3A/Y.'
The y coordinate of the basepoint of the label specified by "LABEL/NAME.".
The value "0." refers to the bottom edge of the grid window, the value "1." to
the tcp edge of the grid window.
Default value for a new label: ".5" (centered).
4.92 'LAFSKT/IayiNlTlCN/lCFFSZT.'.
Simplest form of name: TAB/OF.'
A set of two parameters specifying the x and y components of the offset vector
of the label specified by "IABEL/NAME.", as signed fractions of the snaller
dimension of the grid windcw. The offset vector has its basepoint at the
label basepoint. Subgroups and the number of parameters in each are as fol-
lows:
' LABEL/ [ DEFINITION/ ] OFFSET/X. * (1)
'LABEL/ [DEFINITION/] OFFSETA*' tl)
4.93 'LABEL/lDEETNITICN/]0FFS2TA-'-
Simplest form of name: 'LAB/OF/X.'
The x canponent of the offset vector of the label specified by 'LABEL/NAME.' -
negative toward the left edge, positive toward the right edge, of the grid
windcw. The magnitude represents a fraction of the snaller dimension of the
grid window.
Default value for a new label: "0." (zero-length vector).
PARAMETERS
- 82 -
AUTOGRAPH

-------
4.94 'IAEEI/lDEFINITICN/lGFPSBTA''.
Simplest form of name: 'IAB/OF/Y.*
The y component of the offset vector of the label specified by 'LABEL/ttAME.' -
negative toward the bottom edge, positive toward the top edge, of the grid
window. The magnitude represents a fraction of the smaller dimension of the
grid window.
Default value for a new label: "0." (zero-length vector).
4.95 'Lftaer/iDSTumGN/iMdZ.'.
Simplest form of name: "LAB/AN."
An integral floating-point number having one of the values "0.", "90.",'
"180.", or "270."/ and specifying the direction in which the baseline of the
label specified by 'LABEL/NAME.' emanates frcm the end of its offset vector,
measured counter-clockwise from a left-to-right horizontal vector. All the
lines of a label are written parallel to its baseline and in the direction of
the baseline.
Default value for a new label: "0." (horizontal, left to right).
4.96 "IAEEL/[DE5rENTnCN/]C2inERING.''.
Simplest form of name: 'LAB/CE.'
An integral floating-point number specifying the alignment of the lines of the
label specified by 'IABEL/NAME.' with the end of its offset vector. A nega-
tive value aligns the left ends* a zero value the centers, and a positive
value the right ends, of the lines.
Default value for a new labelt "0." (centers aligned) •
4.97 'LAffiL/tEEb'lNlTlCR/1 LINES. '.
Simplest form of name: 'LAB/LI.'
An integral floating-point number specifying the number of lines in the label
specified by 'LABEL/NAME.'.
This parameter is updated by AUTOGRAPH as lines are added to or deleted frcm
the label and should not be set-by a user program.
Default value for a new label: "0." (no lines).
AUTOGRAPH
- 83 -
PARAMETERS

-------
4.98 'LABEVlDBmCTICN/lmiEX.'.
Simplest form of name: "LAB/IN.'*
An integral floating-point number specifying the second subscript (in the line
buffer) of the first line belonging to the label specified by 'LABEL/NAMS.' -
a zero if no line belongs to the label.
This parameter is updated by AUTOGRAPH as lines are added to or deleted fran
the label and should not be set by a user program.
Default value for a new label: "0." (no lines).
4.99 'LHE.*.
Simplest form of name: "LIN."
A group-of 4+6*n parameters, where "n" is the current value of
'LINE/BUFFEP/LENGTH.' (16, by default) describing up to "n" lines, each of
which is a part of sane informational label. Subgroups and the number of
parameters in each are as follows:
UNE/ttAXUCM.*
(1)
LINE/QID.
U)
LINE/BUFFE3/LENGTE.'
(1)
LINE/BUFFEH/CCNTE^TS.'
(6*n)
LINE/NUMBER.'
(1)
4.100 'LINE/ftAXJHM. *.
Simplest form of name: "LIN/toA."*
An integral floating-point number specifying the assumed maximum length of a
character string delivered to AUTOGRAPH for use as the text of a label line.
Such a character string may occur as the first argument of a call to ANOTAT
(defining the text of line "100." in the label 'V), as the second argument of
a call to ANOTAT (defining the text of line "-1QQ." in the label 'B'), as the
last argument of a call to one of the routines EZY, EZXY, EZM3f# or EZMJCf
(defining the text of line "100." in the label *T), or as the second argument
of a call to AGSE7C whose first argument is
"LINE/[DEFINITION/] TEXT.'
(defining the text of any line). Ir each of these cases, the character string
must be of the length specified by ' LINE/MAX LMLM."* or shorter. ^If it is
shorter, its last character must be the character specified by LINE/END. ,
PARAMETERS
- 84 -
AUTOGRAPH

-------
described below.
This parameter nay be given any desired non-negative integral value.
Default value: "40.".
4.101 'UNE/ao,*.
Simplest form of name: "LIN/EN.'
A character string whose first character is the ere used to mark the end of a
character string defining the text of a label line (in calls to ANOT^T, E2Y,
EZXY, EZMf, EZMSfr and AGSETC)» when that character string is shorter than the
current maximum specified by * LINE/MAX IM5M.' (as described above}.
¦fte tern in'tor character does not become a part of the text of the line- It
is stripped off, so that only the preceding characters constitute the text of
the line.
Default value:
4.102 'LBE/SCFFER.'.
Simplest form of nareei 'UH/BU.'
A group of l+6*n parameters, where "n" is the current value of
'LIKE/BUFFES/tSJGTH. * (16, by default}. Subgroups and the number of paranie-
ters in each are aa fcllcvs.:
' LlNEyBTJFESIVHSGTH. * . {I)
'LI^/SUmB/CCWrSNTS/ (S*ni
4.103 'ttXZ/BBZFEb/VBSSSiS.
Simplest form of name: 'LIN/W/ZE. *
fin integral floating-point number specifying the number af 6-wocd line defini-
tions the line buffer will held. A user program may need to retrieve, but
must not set, the value of this parameter, since its value must match the
second dimension of the line buffer.
Increasing the size of the line buffer requires mcdifjing the AUUXSJAFH source
cede. See the paragraph *INPORMATIDKAL LABELS", in the section "OVERVIEW".
Default value: "16.".
AUTOGRAPH
- 85 -
PARAMETERS

-------
4.104 'LDE/BCTTES/tCtfronS.'.
Simplest form of name: 'LIN/T3U/CO.'
This group may be thought of as an array FLLN, dimensioned 5xn, containing up
to n 6-word line definitions. For a second subscript j,
•	FLLN(l,j) is either a floating-point "null 1", saying that no label line
is defined by this 6-word block, or an integral floating-point "line
number", saying that it does define a label line, in which case:
•	FLLN(2,j) is either "0.", to enable drawing of the line, or "1.", to dis-
able drawing of the line.
•	FLLN(3f j) is the floating-point width of each character of the line,
stated as a fraction of the snaller dimension of the grid window.
•	FLLN(4,j) is an integral floating-point number serving as the identifier
of the character string defining the text of the line and enabling it to
be retrieved frcm AUTOGRAPH"s internal character storage space.
•	FLLN(5,j) is an integral floating-point ccunt of the number of characters
in the text of the line.
•	FLI^(6,j) is an integral floating-point number specifying the second sub-
script (in the line buffer) of the next line of the label to which this
line belongs {that one of the remaining lines in the chain with the larg-
est line number) or, if there is no next line, a "0.".
It is not reccmnended that a user program change the oontents of this buffer
directly. Line definitions should be accessed indirectly by means of the
parameters 'LINE/NUKHER.' and 'LINE/[DEFINITION/]...'.
Default values: The line buffer contains four pre-defined lines, each of
which belongs to cne of the four pre-defined labels. They are as fallows:
Name:
*L*

'B*
-r
Line number:
+1£J0.0 -100.0 ¦
-100.0
+100.0
Suppression flag:
0.0
0.0
0.0
0.0
Character width:
0.015
0.015
0.015
0.020
Text pointed to:
-r

'X'
+ +
Text length:
1.0
0.0
1.0
0.0
Next-line index:
0.0
0.0
0.0
0.0
The description of 'IABEL/BUFEER/CCWTEJJTS.', above, gives default values for
the definitions of the four labels which oontain these lines.
PARAMETERS
- as -
AUTOGRAPH

-------
4 .105 'LINE/teHEER.* .
Simplest form of name: 'LIN/NU.'
An integral floating-point pointer which, if non-zero, specifies a particular
line in the line buffer'- the one which is to be referenced by the parameter
group ' LINE/DEFINITION." (which see, below).
Setting this parameter is the required first step in accessing a particular
line definition.
Default value: "0." (undefined).
Special action by AGSETP: Tb access the definition of a particular line of a
particular label, one nust ensure that 'LABEL/ttAME.' (which see, above) is
set. Then, one nust call AGSETI with 'LINE/NUMBER.* as the first argument and
the number of the line cne wishes to access as the second argument. This
causes AGSET? (which is called by AGSETI) to search the line buffer for the
definition of a line belonging to the label specified by the current value of
'LABEL/NAME.' and having the desired line number. If no such definition is
found, a new one is made up, inserted in the line buffer, and linked into the
proper place in the chain of lines belonging to the label. In either case,
"LINE/NUMBER." is given an integral floating-point value specifying the second
subscript of the line definition in the line buffer.
The definition of a new line has the number specified by the user, a suppres-
sion flag "0.", a character width ".015", a pointer to the text string
and a text length "1.".
Note: The "line numbers" are used to identify the lines of a label and to
specify their positions relative to each other and to the baseline of the
label. Lines having positive line numbers are drawn above the label baseline,
lines having zero line numbers are drawn along the label baseline, and lines
having negative line numbers are drawn belcw the label baseline. A line hav-
ing a greater line number than another line is drawn above that line.
("Above" and "below" are used here fran the viewpoint of saneone reading the
label.) The magnitudes of the line numbers in no way affect inter-line spac-
ing, which is determined by AUTOGRAPH itself.
4.106 "LUE/EEFINrnCU. *.
Simplest form of name: 'LIN/DE.'
A group of five parameters defining the line specified by "LINE/DUMBER.'. If
"LINE/NUMBER." has the value "0.", referencing a parameter in this group
causes an error exit. Subgroups and the number of parameters in each are as
follows:
AUTOGRAPH
- 87 -
PARAMETERS

-------
LI®/ [ DEr INITICN/ISCPPSESSICW.
LIME/ IDETISITtCM/ ] CHMtACTEa.'
(I)
(1)
aj
(13
a)
LINE/ [DEFWinCN/] TEXT.'
LINE/ [DEFINITION/] LENGTH.'
LH3E/lDEF^I*nCN/] INDEX.'
A *107 "IZK/(DUVltUT±CH/l SDFFHESSICH.*.
Simplest fora of name: 'UN/SD."
An integral floating-point number having the value "0." or "1." and specifying
whether drawing of the line specified 'LIHE/H3K3ES.* is enabled	or
disabled ("1-"}.
Default value foe a new linei "0," (line enabled).
Special action by ASSET?: If a user program attempts to set this parameter
(individually, rather than as a part of a grocpj to a negative value, the line
specified by 'LINE/NUMEER.* is deleted and 'in-E/VUKEE??.' is reset to *3.*.
(Deleting a lir.e means that ic is unlinwd fraa the chain of lines belonging
to its label and that its number call is set to "null 1".)
4,128 'uwrizramroVlcsuyciEH-'.
Simplest fora of nane: "LIN/CB*'
A floating-point number specifying the desired width of each character of the
line specified by 'LINE/ttt&EEa.*/ stated as a fraction of the snaller dimen-
sion of the grid window.
Default value for a new line: ".015".
4.109 'USE/[nEFJKEIICH/] TEST.
Simplest form of name: 'UN/IE,,*
An integral floating-point nuRber servir-? as an identifier for a character
string stored sway in WTXGSAfiH's internal character storage space.
Default value fee a new line: *"
Special action by flCSSTP: When this parameter is set by a call to MSTTC, the
character string appearing as the second argument of AGSETC is stored in a
character storage array inside AZTTOC-RnPH, an identifier allowing for later
retrieval of the stsing is generated, and die value of that identifier is
stored {by AGSET?, which is called by JCSTTC) as the parameter value. At that
PARAMETERS
- S3 -
AUTOGRAPH

-------
time, the length of the string is determined and 'LINE/tDEF INITION/] LQKHH.'
is set. See 'LINE/MAXIttJM.' and 'LINE/TERMINATOR.', above.
4.110 'LXNE/IUKKINiTlGH/lLENGTB.'.
Simplest form of name: 'LIN/LE.'
An integral floating-point oount of the number of characters in the text of
the line specified by 'LINE/DUMBER.'. Setting this parameter less than or
equal to zero suppresses the drawing, of the line. See also the description of
'LINE/[DEFINITION/]TEXT.', above.
Default value for a new line: "1." (one character - a blank).
4.111 ' LINE/[ CEP 1MLT10N/1M2EX.'.
Simplest form of name: 'LIN/IN.'
An integral floating-point number specifying the second subscript (in the line
buffer) of the next line of the label - a zero if there is no next line.
This parameter is updated by AUTOGRAPH as lines are added to or deleted fran
the label and should not be set by a user program.
4.112 'SBOGNDAKZ.*.
Simplest form of name: 'SBC.'
A group of 149 "secondary" control parameters. These are not normally set by
a user program, but are computed by AUTOGRAPH itself (the routine AGSTUP).
Their values may be of use in 9cme applications. Subgroups and the number of
parameters in each are as follows:
'SECONDARY/GRAPH.'
(4)
' SECONDARY A3SER.'
(4)
' SECONDARY/CURVE.'
(4)
' SECONDARY/DIMENSIONS.'
(3)
'SECONDARY/AXIS.'
(80)
' SECONDARY/LABEL.'
(54)
4.113 'Sa0CNEAK?/t3APH.'.
Simplest form of name: 'SBC/GR.'
AUTOGRAPH
- 89 -
PARAMETERS

-------
A group of four floating-point numbers specifying the x coordinates of the
left and right edges of the graph window and the y coordinates of the bottom
and top edges of the graph window, in the grid coordinate system. These
values are used by AUTOGRAPH to determine whether a point whose coordinates
are expressed in the grid coordinate system lies inside or outside the graph
window.
If the parameters in the group 'GRID.' have their default values (".15",
".95", ".15", ".95", and "0."), these four parameters will be given the values
"-.1375", "1.0625", "-.1875", and "1.Q625". Note that -.1375 » (0.-.1S)/(.95-
.15) and that 1.0625 » {l.-.15)/{.95-.15).
4.114 'SacCNDAKr/OSESL*.
Simplest form of name: "SBC/US."
A set of four floating-point numbers specifying the * coordinates of the left
and right edges of the grid window and the y coordinates of the bottom and top
edges of the grid window# in the user coordinate systea. These values are
used in mapping user curve points into the grid window. The routines AGSTUP,
AGEAO, and AQCURV use these four numbers as arguments 5 through 8 in calls to
the system-plot-package routine SET.
4.115 'SBCONEAEf/tURVE. *.
Simplest form of name: "SEC/CU."
A group of four floating-point numbers specifying the z coordinates of the
left and right edges of the grid (curve) window and the y coordinates of the
bottom and top edges of the grid (curve) window. The x coordinates are stated
as fractions of the distance frcm left to right, and the y coordinates as
fractions of the distance frcm bottan to top, in the platter frame. The rou-
tines AGSTTJP, AG£?C5C, and AGCUKV use these four numbers as arguments 1 through
4 in calls to the system-plot-package routine SET. If the parameters in the
groups "GBAPH." and 'GRID.' have their default values, these four parameters
are given the values ".15", m.95n, ".IS", and ".95".
4.116 'SHGCNDAOT/tolMeNSICHS.'.
Simplest form of name: "SEC/DI."
A group of three floating-point numbers, the first b» of which specify the
width and height of the grid window and the third of which is equal to the
smaller of the first two. Each is stated as a number of plotter units. If
the parameters in the groupr 'GEAPH.' and 'GRID.' have their default values
and the plotter being used has 1024x1024 addressable positions, then each of
these three parameters will be given the value 818.4 = (.95-. 15) * 1023.
PARAMETERS
- 90 -
AUTOGRAPH

-------
4.117 "SBXNDAFY/AXIS.'.
Simplest form of name: 'SEC/AX.'
A group of eighty parameters having to do with the drawing of the four axes.
Subgroups and the number of parameters in each are as follows:
"SECONDARY/[AXIS/] LEFT."	(20)
"SECONDARY/[AXIS/] RIGHT."	(20)
" SECONDARY/ [AXIS/] BOTTOM."	(20)
"SECONDARY/ [AXIS/] TOP."	(20)
The parameters fran the subgroups are interleaved in the group; that is to
say, the first elements of the subgroups ca uprise elements 1 through 4 of the
group, the second elements of the subgroups ootnprise elements 5 through 8 of
the group, and so en.
4.118 "SECCNDAPY/[AXXS/]s.".
Simplest form of name: "SEC/s."
A group of twenty parameters having to do with the drawing of the axis speci-
fied fcy "S\ where "s" is one of the keywords "LETT", "RIOT", "BOTTOM", or
"TOP". Subgroups and the number of parameters in each are as follows:
' SECONDARY/ [AXIS/] s/POSITICN~ ' (6)
" SECONDARY/ [AXIS/] s/ITCKS.' (3)
" SECONDARY/ [AXIS/] S/ttUMERIC. "* (11)
4.119 "SaCONDARY/lAXIS/]s/POSITICN.'.
Simplest form of name: "SEC/s/PO."
A group of six floating-point numbers, the first three of which describe a
point at the beginning of axis "s" and the last three of which describe a
point at the end of axis "s". The first two numbers of each triplet are the x
and y coordinates of the point, in the grid ooordinate system. The third
number of each triplet is a user-system x or y ooordinate (an x coordinate for
a horizontal axis, a y axirdinati for a vertical axis) of the point.
4.120 " SBXNDAKY/ [AXIS/] s/TICXS. '.
Simplest form of name: "SEC/s/n."
AUTOGRAPH
- 91 -
PARAMETERS

-------
P. grcujr of three floating-point lumbers, specifying tile values, MJTCG?A?H has
chosen to use for the primary parameters
' [AXIS/13/ [TICKS/1 MATCP/ \SFPC rJG/1 TiTE. '
' I ?:X/U£S2,S.
Siirtolast £ucia cf rvainet "SEC/LA."
P&RWETEBS
- 92 -
AU*ICG?A?H

-------
A group of fifty-four parameters describing the six "label boxes", each of
which provides a mechanism for moving and/or shrinking a particular group of
labels in attempting to keep any label in that group frcm overlapping an axis
or extending outside the current graph window. Subgroups and the number of
parameters in each are as follows:
'SIHDNDARYAABELAEFT.'	(9)
' SH3DNDARY/IABEL/RIGHT.'	(9)
' SEOONDAHY/IAEEL/BOTICM.'	(9)
'SECONDAKY/LABEL/TOP.'	(9)
' SBCENDARY/IABEL/CENTER.'	(9)
' SECONDARY/LABEL/GRAPH. "*	(9)
The parameters of the subgroups are interleaved in the group. The first ele-
ments of the subgroups form elements 1 through 6 of the group, the second ele-
ments of the subgroups form elements 7 through 12 of the group, and so cn.
4.123 'SBCCNDARy/LABEVb. ".
Simplest form of name: "SEC/IA/b."
where the keyword "b" specifies the label box, as follows:
•	If "b" =» "LEFT", label box 1 is specified. It contains all labels having
a basepoint 
-------
the grid window.
Prior to a call to AGSTUP, the nine parameters in this croup are undefined.
Following an AGSTUP call, but preceding an PGEPCX call, they have what I shall
call "interim" values. Following an AG3ACK call, they have what I shall call
"final" values.
The first parameter in the group is a "reduction factor" for the widths of
characters in the labels in box "b". This parameter may have the interim
value "0.", specifying that no actual value has yet been computed, or "1.",
specifying that the user has prohibited shrinkage of labels in box "b" (by
giving 'LABEL/GONTPOL.* the value "1."). Hie final value of the reduct.jn
factor may be "-1.", specifying that minimun-sized labels were used, bu; even
they led to overlap problems, or a value between "0." and "1.", specifying the
actual reduction factor applied when the labels drawn.
The next four parameters in the grcup specify the grid-system x coordinates of
the left and right edges, and the grid-system y coordinates of the bottom and
top edges, of label box "b". The interim values specify the box in which the
labels must be made to fit in order to avoid overlap, the final values the box
in which the labels were actually made to fit.
The last four para-neters in the group specify the grid-system x coordinates of
the left and right edges, and the grid-system y coordinates of the bottom and
top edges, of the label box "b" which would result if all the labels were
reduced to minimis size. The interim values specify an unmoved box, the final
values a (possibly) moved box.
PARAMETERS
- 94 -
ALITCGPAPH

-------
5. EXAMPLES
This write-up contains the FORTRAN text and Dicaned output from thirteen jobs
using AUTOGRAPH to produce graphs. These graphs illustrate many of the capa-
bilities of AUTOGRAPH.
The duplex character set of EWRITX was used for all labelling. See the para-
graph "USE OF EWRITX BY AUTOGRAPH", in the section "OVERVIEW".
Additions to this set of examples will be gratefully accepted. Of particular
interest are examples illustrating pitfalls of AUTOGRAPH and the manner in
which they may be avoided, examples showing creative solutions to graphing
problems which are apt to be encountered frequently by others (examples 9 and
11 are additions of this sort), and, last but not least, examples of graphs
which just "look neat".
AUTOGRAPH
- 95 -
EXAMPLES

-------
5.1 EXBMPIZ 1. "Hiis example illustrates a sitfiple use of EZY. Note that
ACJTCGPAPH chose to use exponential left-axis numeric'labels, since ncn-
expcnential labels wsuld have retired more characters.
EXAMPLE 1 (EZY)
PRCGEAM E^PLl
C
C Define the-data array.
C
REAL YLRA(lQOl)
C
C Fill the data array.
C
EXAMPLES	- 96 -	AUTOGRAPH

-------
DO 101 1=1,1001
X=FLOAT(I)/20.
YDRA(I) =10. * (X-l.) * (X-ll.) * (X-21.) * (X-31.) * (X-41.) *
+	(X-51.) +2.E7* (FRAN () - . 5)
101 CONTINUE
C
C Draw a boundary around 'the edge of the plotter frame.
C
CALL BNDAHY
C
C Draw the graph, using EZY.
C
CALL EZY (YDFA, 1001,'EXAMPLE 1 (EZY)?')
C
STOP
C
EUD
FUNCTION FRANO
C
C Randan-number generator.
C
Dm X / 2.7182818 /
SAVE X
X=AMDD(9821.*X+.211327,1.)
FRAN=X
RETURN
END
SUBROUTINE BNDAKY
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RETURN
END
AUTOGRAPH
- 97 -
EXAMPLES

-------
5.2 EOMPU: 2. This exan^le illustrates a siiTtple use of ZZXY. Note that x
coordinates used need not be mcnotcnically increasing".
PBOGWH EXHPL2
C
C Define the data arrays.
C
REAL XDRA(4Q01) ,YDRA(4001)
C
C Fill the data arrays.
C
DO 101 1-1,4001
EXAMPLES.
- 98 -
AUTOGRAPH

-------
THETA=.0015707963267949*FLOATd-l)
RKO=SIN (2. *THETA) +. 05*SIN (64.
XDRA(I)=HKO*OOS(1HETA)
YDRA(I) =SHO*SIN(THETA)
101 CONTINUE
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAKf
C
C Draw the graph, using EZXY.
C
CALL EZXY (XDRA,YDRA,4001 /EXAMPLE 2 (EZXY)$')
C
STOP
C
END
SUBROUTINE BNDARY
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RETURN
END
AUTOGRAPH
- 99 -
EXAMPLES

-------
5.3 E2SMPI2 3. This example illustrates a simple use of E2MY. A remarkably
uninteresting graph.
EXAMPLE 3 (EZMY)
PROGRAM EXMPL3
C
C Define the data array.
C
REAL YDPA(100,2)
C
C Fill the data array.
C
DO 101 1-1,100
EXAMPLES
- 100 -
AUTOGRAPH

-------
YDRA(I,1) =COS(3.14159265358979*FLOAT(I)/25.) *
+	FLOAT(I) **2
YDRA(1,2) =CDS (3.14159265353979*FLOAT(I) /25.) *
+	10.** (.04*FLOAT(I))
101 CONTINUE
C
C Draw a boundary arcund the edge of the plotter frame.
C
CALL BNDARY
C
C Draw the graph, using EZMf.
C
CALL EZMY (YDRA, 100,2,100, "EXAMPLE 3 {EZJEf)
C
STOP
C
RID
SUBROUTINE BNDARY
C
C Routine to draw the plotter-frame edge.
C
CALL PL0TIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RETOFN
END
AUTOGRAPH
- 101 -
EXAMPLES

-------
5.4 E©MFI£ 4, This example illustrates a sinple 'use of E2MXY - nested
ellipses.
EXAMPLE 4 (EZWXY)
PSOGFAM EXMPL4
C
C Define the data arrays.
C
FEAL XDHA(201) ,YBRA(201,1Q)
C
C Fill the data arrays.
C
DO 102 1-1,201
EXAMPLES
. 1(12 -

-------
XBFA(I)=-l.+.02*FLOAT(I-l)
IF (I.GT.101) XDFA(I)=2.-XDRA(I)
DO 101 J=l,10
YDFA (I, J) =FLOAT (J) *
+ SQRT(1.000000000001-XDRA(I)**2)/10.
IF (I.GT.101) YDFA(I,J)=-YDRA(I,J)
101	CONTINUE
102	CONTINUE
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAHY
C
C Draw the graph, using EZMXif.
C
CALL EZMXY (XDRA,YDRA, 201,10,201, 'EXAMPLE 4 (EZMXY)
C
STOP
C
EUD
SUBROUTINE HNDARY
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RETCJFN
END
AUTOGRAPH
- 103 -

-------
5.5 EfflMFt£ 5. This example illustrates a relativel'/ sifltpls use oE
generating the data requires using sane csally fascinating numeric constants.
Essentially/ six circles are drawn; t%o snail portions of each are blanked out
tv salting in sane "null l's" ll.E26"s). U:e result is a possibly recognis-
able ccrmercial logo.
CXAUPIZ 5 (£2MXY)
mitt, boot, ano fuvo*
PROGRAM EXMPL5
C
C Define the data arrays.
C
HEAL XDRA{401,6),YDRAf401,6)
C
EXAMPLES
- 104 -


-------
C Compute required constants.
C
PI=3.14159265358979
PH)200=PI/200.
pitiwc=2.*pi
PIT2D3=2.*PI/3.
PIT4D3=4.*PI/3.
RADOSC=SQRT(3.)/3.
PADOLC=SQRT(3.)/2.
BSSCLL=ATAN (SQPT (12.) /6.)
BSSCUL=ATAN (SQKT (143.) /7.)
BSLCLL=ATAN (SQRT (143.) /17.)
BSLCUL=ATAN(SQRT(2.0))
C
C Fill the data arrays.
C
DO 101 1-1,401
THETA=PID2QO*FLOAT(I-1)
XDRA(I/1)3 -.5+RADOSC*COS(THETA)
YDRA(1,1) =	RADOSC*SIN(THETA)
IF (ABS (THETA	) .GE.BSSCLL. AND.
+ ABS (THETA	) .UE.BSSCUL) XDRA(I,1) =1.E36
IF (ABS(THETA-PITIWO) .GE.BSSCLL.AND.
+ ABS(THETA-PITIW3) .LE.BSSCUL) XDRA(I,1) =1.E36
XDRA(I,2) = .5+RADOSC*COS(THETA)
YDRA(I,2) =	PADOSC*SIN(THETA)
IF (ABS (THETA-PIT2D3) .GE.BSSCLL. AND.
+ ABS(THETA-PIT2D3) .LE.BSSCUL) XDRA(I,2) =1.E36
XDRA(I,3)=	RADOSC*OOS(THETA)
YDRA (1,3) =RAEOLC+RAEOSC*SIN (THETA)
IF (ABS(THETA-PIT4D3) .GE.BSSCLL.AND.
+ ABS(THETA-PIT4D3) .LE.BSSCUL) XDRA(I,3) =1.E36
XDRA(1,4) = -.5+RADOLC*COS(THETA)
YDRA (1,4) =	FADOLC*SIN (THETA)
IF (ABS (THETA	) .GE.BSLCLL. AND.
+ ABS (THETA . ) .LE.BSLCUL) XDRA(I,4) «1.E36
IF (ABS (THETA-PITIWO) .GE.BSLCLL.AND.
+ ABS (THETA-PITIWO) .LE.BSLCUL) XDRA(I,4)»1.E36
XDPA (1,5) = . 5+RADOLC*COS (THETA)
YDRA(I,5)»	FADOLC*SIN (THETA)
IF (ABS (THETA-PIT2D3) .GE.BSLCLL.AND.
+	ABS(THETA-PIT2D3).LE.BSLCUL) XDPA(1,5) =1.£36
XDRA (1,6)»	RADOLC*OOS (THETA)
YDRA (1,6) »RADOLC+RADOLC*SIN (THETA)
IF (ABS(THETA-PIT4D3) .GE.BSLCLL.AND.
+ ABS(THETA-PIT4D3) .LE.BSLCUL) XDRA(I,6) =1.E36
101 CONTINUE
C
C Specify subscripting of XDRA and YDRA.
C
CALL AGSETT ('ROW.',2)
C
C Set up grid shape to make 1 unit in x = 1 unit in y.
AUTOGRAPH
- 105 -
EXAMPLES

-------
c
CALL AGSETF {'GRID/SHAPE,2.}
C
C Turn off background, then turn labels back an.
C
C\LL AGSETF ('2ACSGaQ0ND.' , 4.)
CALL SGSZTI ('LAEEL/CONTRCL. * , 2)
C
C TUrn off left label.
C
CALL ftC-STIC ("LABEL/NAME.J, 'IS)
CALL flGSETI <*LA3SL/SUP?FESSICN FLP£.',1)
C
C Change text o£ tottan label.
C
CALL PCSzTZ: ('L?EEL/HP.ME.','3')
CALL ASSETT {'LIME/MiMEER.',-100)
CALL AGSEIC {'LINE/EXT. ', 'PURITY, BODY, AND FLAVORS"}
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAKf
C
C Qcav the gcaoh, using EZMSCf.
C
CALL EZMXY (XDRArYESA, 401,6,4Q1, "EXAMPLE 5 (E2MCOS"}
C
STOP
C
END
sushxttihe sndahy
c
C Routine to draw the plotter-frame edge.
C
CALL PISTIT ( 0, 0,0)
CALL PKJTIT (32767, 0,1)
CALL' PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,11
RETURN
E3D
EXAMPLES
- 106 -
ai/uogpa^h

-------
5.6 EXAMPI2 6. This example illustrates the use of the graph window and the
four principal types of backgrounds cne can use: perimeter, grid, half-axTs,
and "none". Note that I have cheated a bit and turned the labels back on for
the last of these. This example also illustrates the use of linear and loga-
rithmic x and y mappings..
irumi «-< (ttCMTm atatcMuio)
iu«»u «•> ion i*oioaeuMe)
(urn (• i	uesanuNO)
TOO
>00
10'
to*
I0»







i
i

i i

i









1














—i








/



y
>









N

t


/





1


)


*—»—








\



(



i




\
\










ri





•<
\
\





~
/
/




















s too no mo «oo mo we too
tuimx »'* (w uato»ou*o)
PROGRAM EXMPL6
C
C Define the data arrays.
C
REAL XDRA(501),YDRA(501)
C
AUTOGRAPH
- 107 -
EXATCLES

-------
C Define the graph-window parameter array.
C
REAL <5iND (4,4)
C
DATA (GWND(I,1),1=1,4) / 0.0 , 0.5 , 0.5 , 1.0 /
DATA (GWND{I,2),1=1,4) / 0.5 , 1.0 , 0.5 , 1.0 /
DATA (GWND(I,3),1=1,4) / 0.0 , Q;5 , 0.0 , 0.5 /
DATA (GWND(I,4),1=1,4) / 0.5 , 1.0 , 0.0 , 0.5 /
C
C Define variables used in setting up informational labels.
C
CHARACTER*35 GLAB
CHARACTER*23 BACK (4)
CHARACTER* 12 LHI£<4)
C
DATA EJSCXd) / '(PERIMETER BACKGROUND) $' /
DATA BACK{2) / ' (GRID BAZKGrC'UND) $ ' /
DATA BACK (3) / '{HALF-AXIS BACKGROUND) $' /
DATA EPO(4) / '(NO BACKGROUND)$	' /
C
DATA LMLG(l) / 'LINEAR?" /
DATA LMLG(2) / 'LOGARITHMIC?' /
C
C Fill the data arrays.
C
DO 101 1-1,501
THETA».031415926535a98*FLQAT(I-l)
XDEA(I) =500. + .9*FL3AT{I-l) *C0S(THETA)
YDPA(I] =500. +. 9*FL0AT(I—1) *SIN{THETA)
101 CONTINUE
C
C Suppress the frame advance.
C •
CALL flGSETI ('FRAME.',2)
C
C Do four graphs cn the same frame, using different
C backgrounds.
C
DO 102 IGPF » 1,4
C
C Position the graph window.
C
CALL AGCT? ('GSAPH WINECW.',GWD (1, IGPF) ,4)
C
C Declare the background type.
C
CALL AGSETC ('BACKGROUND TYPE.',IGPF)
C
C Setting the background type may have turned informational
C labels off. In that case, turn the.n back cn.
C
I? (IGPF.EQ.4) CALL ££SETI ('IAEEL/CCN7ROL.', 2)
C
EXAMPLES
- 108 -
AirmrrPASu

-------
C Set up parameters determining linear/log nature of axes.
C
ILLX=(IGRF-1)/2
ILLY=MOD(IGBF-1,2)
C
C Declare the linear/log nature of the graph.
C		
CALL PGSETI ('X/LOGARITHMIC.' , ILLX)
CALL AGSETI ('Y/LOGARITHMIC.', ILLY)
C
C Change the x- and y-axis labels to. reflect the linear/log
C nature of the graph.
C
CALL AGSETC ('LABEL/NAME. VB')
CALL A3SETC ('LINE/NUMBER.',-100)
CALL AGSETC ('LINE/TEXT.',LNLG(ILLX+1))
C
CALL PCSUTC ('LABEL/NAME.','L")
CALL PGSET1 ('LINE/NUMBER.' ,100)
CALL AGSETC ('LINE/TEXT.\LNLG(ILLY+1))
C
C Set up the label for the top of the graph.
C
WRITE (GIAB/1001) IGRF,BACK (IGRF)
C
C Draw the graph, using EZXY.
C
CALL EZXY (XDRA,YDRA,501,GLAB)
C
102 CONTINUE
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAKY
C
C Advance the frame.
C
CALL FRAME
C
STOP
C
C Format for encode.
C
1001 FORMAT ('EXAMPLE 6-',Il,' ',A23)
END
SUBROUTINE BNDAKY
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
AUTOGRAPH
- 109 -
EXAMPLES

-------
CALL PLCTIT ( 0, 0,1)
RETUHN
END
EXAMPLES
- no -
ALrrnr:sAPK

-------
5.7 EXAMPLE 7. This example illustrates several features. It shews how to
define informational labels. It shows how label coordinate systems along an
axis are defined. Windowing is used to prevent the curves frcm running wild.
The "user" set of dashed-line patterns is employed. ("Incrudescsnce" is a
word that I invented, by the way.)
EXAMPLE 7 (EZWXY)
LINES OF CONSTANT INCRUDESCENCE
distance mow equator (uilcs)
• 5000 <4000 *MM >2000 >1000 9 1000 2000 3000
PROGRAM EXMPL7
C
C Define the data arrays and the dash-pattern array.
C
REAL XDRA(lOl),YDRA(101,9)
CHARACTER*28 DSHP(9)
AUTOGRAPH
- Ill -
EXAMPLES

-------
c
C Declare the type of the dash-pat tern-name generator.
C
CHARaCE3*16 AGu-SHN
c
C Fill the data arrays and the dash pattern array,
c
DO 101 >1,101
XDRA(I) =-90. +1. 8*FLQAI(I-1)
101	CONTINUE
c
DO 103 J»L,9
WRITS (CSHP{J),1001) J
FJ»J
CO 102 I»l,101
YDRA(I,J) = 3. *FJ-(rj/2700. > *XDRA (I) **2
102	GCNTINUE
103	CONTINUE
C
C Ttirn en windowing.
C
CALL KSTn 0?XK2CHXHG.'il)
C
C Jtive the edges of the curve window t^cidl .
C
CALL flGSTTT Cgsid/left. ' ,.10}
CALL PGSZTF {'GRID/RIGHT.' ,.90}
CALL PCSETF ('GHID/BCfTTCM.',. 10)
CALL A3SETF ('GRID/IDP.' ,.85)
C
C Set the x and y sLiniraun and maximum.
C
CALL 5GSETF rX/MINIMK.",-90.)
CALL ACSETF (' X/MAXmJM.", +90 -)
CALL AGSETF ('V/MIMIW3K.', 0.)
CALL PGSZIT CY/MAXIMM.', IS.)
C
C Set left axis parameters.
C
C\LL f£SETI I'LETr/HMOa/TlfPE- * ,1)
CALL &3SETF ('l23T/WfiJ0R/BASE. ',3.)
CALL PCSSTI (*LZ3T/MIlCR/SPflCING.*,2)
C
C Set right axis parameters.
C
CALL JSGSE7I ('RISir/FUKCnCN. M)
CALL AGSETF (' RIGHT/MM3HC/TYPE.', 1 • £36}
C
C Set tottcm axis parameters.
C
CAIi J-GcETI rBCrrrCH^MMOR/rfPE. *, 1)
CALL £GSETF ("30TTCM/VAJCP/BASE. * r15.)
CALL ££SETT CSGmM/>lIJClE/S?M:iNG.',2)
EXAMPLES
- 112 -
AUTOGRAPH

-------
c
C Set top axis parameters.
C
CALL A3SETT	("TUP/FUNCTION. *, 2)
CALL AGSETF	{'TOP/NUMERIC/TYFE. ' ,1.E36)
C
C Set up the dash	patterns to be used.
C
CALL PGSETI	('DASH/SELECTOR.' ,9)
CALL 2GSETT	('DASH/LENGTH.',28)
DO 104 1-1,9
CALL ?GSETC (AGDSHN(I) ,DSHP(I))
104 CONTINUE
C
C Set up the left	label.
C
CALL MSETC	('LABEL/NAME. ','L')
CALL rGSETI	('LINE/NUMBER.',100)
CALL SGSETC	('LINE/TEXT.','HEIGHT (KILOMETERS) $')
C
C Set up the right label.
C
CALL &3SETC	('LABEL/NAME.' ,'R')
CALL flGSETI	('LIME/NUMBER.', -100)
CALL AGSE1C	{'LINE/TEXT.',
+	'PRESSURE (ICNS/SQUARE FURLCNG)$*)
C
C Set up the bottan labels.
C
CALL JSGSETC	('LABEL/NAME.' ,'B']
CALL AGSETT	(' LINE/NUMBER.', -100)
CALL J5GSFIC	('LINE/TEXT.'/LATITUDE (DEGREES)?')
C
CALL i=GSETC	('LABEL/NAME. VS?')
CALL AGSETF	('LABEL/BASEFOINT/X*",.000001)
CALL AGSETF	{'LABEL/BASEPOINT/Y.', 0.)
CALL AGSETF	(' IABEL/OFFSETA-', -. 015)
CALL AGSETI	{'LINE/NUMBER.',-100)
CALL £GSETC	('LINE/TEXT. VS?$')
C
CALL 2GSETC	('LABEL/NAME.','NP')
CALL AGSETF	('LABEL/BASEPOIOT/X.'999999)
CALL AGSETF	(' IABEL/BASEPOINTA •' / 0.)
CALL PGSETF	(' LABEL/OFFSET ft.015)
CALL PGSETI	('LINE/NUMBER.',-100)
CALL PGSETC	('LINE/TEXT.','NP$')
C
C Set up the tcp label.
C
CALL AGSETC	('LABEL/tJAME. ' ,"F)
CALL AGSETI	('LINE/NUMBER.',30)
CALL AGSETC ('LINE/TEXT.',
+	'DISTANCE FRCM EQUATOR (MILES) $')
AUTOGRAPH
- 113 -
EXAMPLES

-------
CALL A3SETT CLrTIE/NljMB£R.',9G)
CALL £GSETU ('LINE/TEXT. V ?')
CALL AGSETI {'LINE/NljKBER.' ,100}
CALL KS2TC CLUE/tEXT.*,
+	"LINES OF CONSTANT IHCBUnESGEMCES')
CALL AC-SETT ('LUE/tTCMBER. ' ,110)
CALL PCScTJZ ('LIME/TEXT-.'" ,'EXAMPLE 7 (Z2MX?) $"J
C
C Set up cantarsd (box 6] label.
C
CALL flGSETC ( ' LAEEL/MAME. ' , 'EQUATOR")
CALL AGSETT ('LABEL/ANGLE.', 90)
CALL ASSET! ('LINE/NUMEER.',0)
CALL PCSEZC ('LLME/TEXT.', "EQUATORS")
C
C Draw a boundary arour.d the edge of the plotter frame.
C
CALL BtCATOf
C
C Draw the graph, using EZMXf.
C
CALL EZMJCf (XL FA, YCFA, 101,9,101,0)
C
STOP
C
C Ebrmat for encode above.
C
1001 fOIWAT
C
END
SUBROUTINE AGUTDL (IAXS,FUNS,IDMA,VINP,'VC'IP)
C
C Mapping for the right a*is.
C .
IF (PUNS.EQ.l.) THEN
IP (IEMA.GT.0) *T7IP=ALOG10(20.-VINP}
IF (IDMA.LT.0} VCT?»20.-10.**VINP
C
C Harping for the top axis.
C
ELSE IF (FUNS.EC.2J THEN
IF (IDMA.GT.O) VCTP=70.136*VTNP
IF (IEKA.LT.0) VCTP-VINP/70.13S
C
C Default (identity) xiapoing*
C
ELSE
vuTP^vmp
end if
c
C Dene.
C
RETURN
EXAMPLES
- 114 -
ADTCGRAPH

-------
c
END
SUBROUTINE BNDARY
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RETURN
END
AUTOGRAPH
- 115 -
EXAMPLES

-------
5.8 EXRMFIZ 8. This example is i somewhat ugly graph .demonstrating that cr.e
can plot."x as a faction of y", that label values can run "backwards" along
an axis, and that axes need not have major tick marks at their ends. The
"alphabetic" set of dashed-line patterns is used. Major tick marks en the x
axis are extended in both directions.
EXAUPU 8
PS0G3AM EXKPL8
C
C Define the data arrays.
C
REAL XDRA(lQl) ,YTRA (4,101)
C
EXAMPLES
- 116 -
AUTCGEAPH

-------
C Fill the data arrays.
C
DO 101 1=1,101
XDFA(I)=-3.14159265358979+
+	.062831853071796*FLQAT(I-1)
101	CONTINUE
C
DO 103 1=1/4
FLTI=I
BA£E=2.*FLTI-1.
DO 102 J=l,101
YDRA(I,J)=BASE+.75*SIN(-3.14159265358979+
+	.062831853071796*FLTI*FLQAT(J-1))
102	CONTINUE
103	CONTINUE
C
C Change the line-end character to a period.
C
CALL A3SETC ('LINE/M.'.')
C
C Specify labels for x and y axes,
C
CALL ANOTAT ("SINE FUNCTIONS OF T.','T.',0,0,0,0)
C
C Use a half-axis background.
C
CALL AGSETI ('BACKGROUND.' ,3)
C
C Mave x axis to the zero point an the y axis.
C
CALL PGSETF ('BCTTOfVlNTERSECTION/USER.', 0.)
C
C Specify base value for spacing of major ticks crt x axis.
C
CALL PGSETF ('BCTTCM/MAIOR/BASE.' ,1.)
C
C Rm major ticks cn x axis to edge of curve window.
C
CALL ?GSETF ('BOTTOM/MAJOR/INWARD.' , 1.)
CALL AGSETF ('BOTTOtVMAJOR/OU'IWARD.' ,1.)
C
C Position x axis minor ticks.
C
CALL AGSETI ('BCriTCrvHBCR/SPACING.', 9)
C
C Rjn the y axis backward.
C
CALL PGSETI ('Y/ORDER.',l)
C
C Run plots full-scale in y.
C
CALL 2GSFTI ('Y/NICE.' ,0)
C
AUTOGRAPH
- 117 -
EXAMPLES

-------
C Have AUTCGRAPH scale x and y data the saine.
C
CALL AGSETF ('C2ID/SKAPE.',.01)
G
C Use the alphabetic set of dashed-line patterns.
C
CALL ASSZTI ('DASH/SELECTOR." , -1)
C
C Tell AtTTCGRArH how the data arrays are dimensioned.
C
CALL AGSZTI I'SC
C
C Reverse the roles of die x and y arrays.
C
CALL AGSETT {'INVEST.',1)
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAKf
C
C Draw the curves.
C
CALL EZJOCf (XDBAfYDBA,4/4,101,''EXAMPLE 8.')
C
STOP
C
END
SUBROUTINE BNDAKf
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PIOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RETURN
END
EXAMPLES
- 113 -
AUTCGPAPH

-------
5.9 E»MPL2 9. This example shows how to create a hybrid logarithmic axis
with positive values cn cne end and negative values cn the other; a line of
discontinuity separates the two. The routine AGC3NL is replaced by a version
which forces the numeric label in the middle of the left axis to be blank.
10'
EXAMPLE 9
10'
10*
o
5
S
S5
2
I
•10"
X
.jg' P' ' I I I I I I I hfc-
0 .1 .2 >J	• 9
X
T	1	1	'	1	r
.! 1.0
PP0GPAM EXMPL9
C
C Define the data arrays.
C
DIMENSION XDAT(400) ,YDAT(400)
C
C Fill the data arrays.
AUTOGRAPH	- H9 "	EXAT4FLES

-------
c
DO 101 1=1,400
XDAT(I) *(FLOAT(I)-l.) /399.
101	CONTINUE
C
CALL GENDAT (YDATf 1) ,200,200,1,3,3,+.01,+10.)
CALL GEMDAT (YDAT(201) ,200,200,1,3,3,-10. ,-.01)
C
C The y data ranges ever both positive and negative values.
C It is desired that both ranges be represented on the same
C graph and that each be shown logarithmically, ignoring
C values in the range -.01 to +.01, in which we have no
C interest. First we map each y datian into its absolute
C value (.01 if the absolute value is too snail). Then we
C take the base-10 logarithm, add 2.0001 (so as to be sure
C of getting a positive number), and re-attach the original
C sign. We can plot the resulting y data cn a linear y axis.
C
DO 102 1=1,400
¦ YBAT(I) 3SI(2J (ALCG1Q (AMAXl (ABS (YDAT(I)) , .01))+2.0001,
+	YDAT(I))
102	CONTINUE
C
C In order that the labels cn the y axis should show the
C original values of the y data, we change the user-system-
C to-label-systsm mapping cn both y axes and force major
C ticks to be spaced logarithmically in the
C label system (which will be defined by the subroutine
C AGUTCL in such a way as to re-create numbers in the
C original range).
C
CALL SGSETI ('LETT/FUNCTION.' ,1)
CALL ACSETI (' LEFT/MAJOR/TYPE. ', 2)
C
CALL AGSETI (^GJT/FUMCTICN.',1)
CALL SGSETI (' RIGJT/MWOR/TYPE.' ,2)
C
C Change the left-axis label to reflect what's going cn.
C
CALL AGSETC ('LABEL/NAME. VL")
CALL AGSETI ("LINE/NUMBER.',100)
CALL PCSEVC ('LINE/TEXT.',
+	'LOG SCALING, POSITIVE AND NEGATIVES')
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAHY
C
C Draw the curve.
C
CALL EZXY (XDAT,YDAT, 400,'EXAMPLE 9$')
C
STOP
EXAMPLES
_ i?n -

-------
c
END
SUBROUTINE AGUTOL (IAXS,FUNS, IDMA,VTNP,VOTP)
C
C Left or right axis.
C
IF (FUNS.EQ.l.) THEN
IF (IEMA.LT.O) THEN
VOTP=SIQJ (ALOG10 (AMAXl (ABS (VINP) , .01)) +2.0001, VINP)
ELSE
VOTP=SIGN (10. ** (ABS (VINP)-2.0001) ,VINP)
END IF
C
C All others.
C
ELSE
VOTP=VTNP
END IF
C
C Dene.
C
RETURN
C
END
SUBROUTINE AGCHNL (IAXS,VILS>CHRM,M:iM,NCIM,IPXM/
+	G3ee,m:ie,ncie)
c
CHARACTER* (*) CHFM,CHRE
C
C Modify the left-axis numeric label marking the value "0.".
C
IF (IAXS.EQ.1.AND.VILS.EQ.0.) THEN
CHFM(1:1)»* '
NCIM=1
IPXM=0
NCIE=0
END IF
C
C Dene.
C
RETURN
C
EHD
SUBROUTINE GENDAT (DATA,IDIM,M,N/MLCW,MHO,DLCW,DHGH)
C
C This is a routine to generate test data for two-dimensional
C graphics routines. Given an array "DATA", dimensioned
C "IDIM,1", it fills the sub-array ((DATA(I,J) ,I=1,M) ,J»1,N)
C with a two-dimensional field of data having approximately
C "MLOW" lows and "MHGH" highs, a minimum value of exactly
C "DLOW" and a maximum value of exactly "DHGH".
C
C "MLCW" and "MHGH" are each forced to be greater than or
AUTOGRAPH
- 121 -
EXAMPLES

-------
C equal to 1 and less than or equal to 25.
C
C The function used is a sum of exponentials.
C
DIMENSION DATA(IDIM,1) ,CCNT(3,50)
C
P0VM-9./FIQAT(M)
PCJVN-9. /FLOAT (N)
C
NLCW=MAX0 (1,MIN0 (25,MLCW})
NEGH=MAXQ (1,MIN0 (25,MHC2))
NQ3T=NLCW+NHC31
C
DO 101 K=1,NCNT
CCNT(1,K) =1. +(FLOAT (M)-1.) *FRAN()
CCNT(2,K) =1.+(FLOAT(N)-l.) *FRAN()
IF (K.LE.NLCW) THEN
CCNT(3,K)=-1.
ELSE
CCOT(3,K)«+1.
END IF
101	CONTINUE
C
CMIN=+1.E36
CMAX=-1.E36
CO 104 J=1,N
CO 103 1=1,M
DATA (I, J) =.5* (DLCW+DHGH)
CO 102 K=1,NG7P
DATA{I,J} =DATA{I, J) +. 5 *(CHGH-DLCW) *CCOT(3,K)*
+	EXP (- ((FOVM* (FLOAT (I) -CCNT(1,K))) **2+>
+	(FOVN* (FLCAT(J) -CQTr(2,K))) **2))
102	CONTINUE
EMIN=AMINl (DMIN, DATA (I, J))
DMAX=AMAXl (EMAX, DATA (I, J))
103	CONTINUE
104	CONTINUE
C
CO 106 J»1,N
DO 105 1*1,M
DATA (I, J) = (DATA (I, J) -CMIN) / (EMAX-CMIN) *
+	(EEO-DLCW) +DLCW
105	CONTINUE
106	CONTINUE
C
HETUFN
C
END
FUNCTION FPAN()
C
C Pandan-nuirber generator.
C
DATA X / 2.7182918 /
EXAMPLES
- 122 -
AUTOGFAPH

-------
SAVE X
X=AfCD (9821. *X+. 211327,1.)
FRAN=X
RETURN
END
SUBROJTINE ENDARY
C
C Routine to draw the plotter-frame edge.
C
CALL PLCTIT ( 0, 0,0)
CALL PLCTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLCTIT ( 0, 0,1)
RETURN
END
AUTOGRAPH
- 123

-------
5.10 EfflMPLS 10. This example shows hew to creata nen-standard numeric
labels on the axes. The bottom x axis is labelled with the nanves of the
months, and the left y axis with Penan numerals. '
EXAMPLE 10 (MODIFIED NUMERIC LABELS)
PSDG5AM XMPL10
C
C Define the data arrays.
C
REAL XDFAU201) ,YDRA(1201)
C
C Fill the data arrays. The independent variable represents
C tire during the year (a hypothetical year with equal-length
EXAMPLES
- 124 -
AUTOGRAPH

-------
C months) and is set up so that minor ticks can be lengthened
C to delimit the months; the major ticks, though shortened to
C invisibility, still determine where the labels go.
C
DO 101 1=1,1201
XDRA(I) =FLOAT(1-51)
YDKA (I) =C0SH (FLOAT (1-601) /202.)
101 CONTINUE
C
C Change the labels cn the bottom and left axes.
C
CALL ANOTAT ("MONTHS OF THE YEARS',
+	'SOMAN NUMERALS$",0,0,0,0)
C
C Fix the minimum and maximum values cn both axes and prevent
C AUTOGRAPH frcm using rcunded values at the ends of the axes.
C
CALL SGSETF ("X/MIN.' ,-50.)
CALL AGSETF ("X/t4AX." ,1150.)
CALL AGSETI ('X/NICE.',0)
C
CALL AGSETF
CALL AGSETF ("Y/*1AX.',10.)
CALL AGSETI ("Y/NICE.' ,0)
C
C Specify the spacing between major tick marks cn all axes.
C Note that the AUTOGRAPH dummy routine AGCHNL is supplanted
C (below) by cne which supplies dates for the bottom axis and
C Ranan numerals for the left axis in place of the numeric
C labels cne would otherwise get.
C
CALL AGSETI (' IZFT/MAJOR/TYPE.', 1)
CALL AGSETI (' RIGHT/^AJOP/IYPE.',1)
CALL AGSETI ('BCTTCK/MAJOR/IYPE.' ,1)
CALL AGSETI (' TOP/MAJOR/IYFE.",1)
C
CALL AGSETF (' LEFT/MAJOR/BASE.', 1.)
CALL AGSETF (' RIOTT/MWOR/BASE.', 1.)
CALL AGSETF ('BOTICfVMAJOR/BASE.',100.)
CALL A3SETF (' TOP/MAJOR/BASE.MOO.)
C
C Suppress minor ticks cn the left and right axes.
C
CALL AGSETI (' LEFT/MINOR/SPACING." ,0)
CALL AGSETI (' RIGTT/MINOR/SPACING.' ,0)
C
C Cn the bottcm and top axes, put cne minor tick between each
C pair of major ticks, shorten major ticks to invisibility,
C and lengthen minor ticks. The net effect is to make the
C minor ticks delimit the beginning and end of each month,
C while the major ticks, though invisible, cause the names of
C the months to be where want them.
C
AUTOGRAPH
- 125 -
EXAMPLES

-------
CALL PCSUTI ('BOITCtVMItCH/SPW:iNG.',l)
CALL 2GSETI {' TOP/MINOR/SPACING.',1)
C
CALL PCSoTT ('BOTIT2VMAJ0F/INWARD. ',0.)
CALL rCSETF ('BOTICfV^n^OS/INWARD. ',.015)
CALL PGSETF (' TCP/MAJOR/INWASD. ',0.)
CALL AGSZTF (' TOP/MIICR/INWARD. ',.015)
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAKf
C
C Draw the graph, using EZXf.
C
CALL EZXY (XDFA,YDRA,12Q1,
+	'EXAMPLE 10 (MODIFIED NUMERIC LABELS)?')
C
STOP
C
END
subroutine mcknl {iaxs,vils,chbm/m:im,ncim/ipxm,
+	<33RE,m:ie,ncie)
c
CHARACTER* (*} CHFM,CHRE
C
C Define the nairss of the months for use cn the bottan axis.
C
CHARACTER* 3 MDNS (12)
DATA CONS / 'JAN', 'FEB', 'MAR', 'APR','MKT,'JUN',
+	'JUL','AUG'/SEP','OCT/NOV,'DEC'/
C
C Modify the numeric labels cn the left axis.
C
IF {IAXS.EQ.1) THEN
CALL M3G3PN (IFIX(VILS)/C3!FM,NCIM)
IPXM=0
NCIE=0
C
C MDdify the numeric labels cn the bottan axis.
C
ELSE IF (IAXS.EQ. 3) THEN
IMDN-IP1X (VTLS+.5)/IQQ+l
CHFJ!(1:3) =f©NS (IMDN)
NCr';=3
NCIE=0
END IF
C
C Dene.
C
RETURN
C
END
EXAMPLES
- 125 -
AUTOGRAPH

-------
SUBROUTINE PGCORN (NTGR,BCRN,NCRN)
c
CHARACTER* (*) BCRN
C
C This routine receives an integer in NTCR and returns its
C Ronan-nuneral equivalent in the first NCRN characters of
C the character variable B£RN. It only works for integers
C within a limited range and it does seme rather unorthodox
C things (like using zero and minus).
C
C ICHl, IC-iS, and IC10 are character variables used for the
C single-unit, five-unit, and ten-unit symbols at a given
C level.
C
CHARACTER* 1 ICHl, ICH5, IC10
C
C Treat numbers outside the range (-4000,+4000) as infinites.
C
IF (IABS(NTGR) .GE.4000) THEN
IF (NTGR.GT.O) THEN
NCRN=5
BCRN(1:5)='(INF)'
ELSE
NCRN=6
BOW (Is 6) (-INF) "
END IF
RETURN
END IF
C
C Use a '0' for the zero. The Rctnans never had it so gocd.
C
IF (NTCR.EQ.O) THEN
NCRN=1
BON (1:1)-'O'
RETURN
END IF
C
C Zero the character counter.
C
NCRN=0
C
C Handle negative integers by prefixing a minus sign.
C
IF (NTGR.LT.O) THEN
NCRN=NCRN+1
BCRN (NCRN:NCRN)
END IF
C
C Initialize constants. We'll check for thousands first.
C
BCD=10000
IDIV=1000
IOUVM'
AUTOGRAPH
- 127 -
EXAMPLES

-------
c
C Find cut hew many thousands (hundreds, tens, units) there
C are and jump to the proper code block for each case.
C
101	INTC=M3D (LABS (NTGR) , IMDD) /IDIV
C
GO TO (107,104,104,104,102,103,103,103,103,106),INTG+1
C
C Four - add IOl followed by ICH5.
C
102	NCRN=NCHN+1
BCRN(NC3iI:NCPN) =ICH1
C
C Five through eight - add ICH5, followed by INTG-5 ICHl's.
C
103	M3N=NC3N+1
BCSN(NCSN:NCRN) =ICH5
C
IP (INIG.LE.0) GO TO 107
C
C Cne through three - add that many ICHl's.
C
104	DO 105 I»1,INTG
tONstON+1
ECSN(NON:10N) =1(31
105	CONTINUE
C
GO TO 107
C
C Nine - add ICHl, followed by IC10.
C
106	NC3N=NCSN+1
BCRN(NCEN:NCRN) »ICHl
NCHNaNCPN+1
BCSN(NCRN:.NCHN) »IC10
C
C If vre're dene, exit.
C
107	I? (IDIV.BQ.l) PETUPN
C
C Otherwise, tool up for the next digit and loco back.
C
IMDI>IMjD/10
IDIV-IDIV/10
ICl 0» IOl
c
IF (IDrV.EQ.100) THEN
ICH5»'D'
Idl=*'C*
ELSE IF (IDr/.SQ.10) THEN
ICH5='L'
Idl a * X"
EXAMPLES
- 128 -
AUICGRAFH

-------
ELSE
IC-:5»'V
ioi-'r
END IF
C
GO TO 101
C
END
SUBROUTINE BNDAKf
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RE1TON
END
AtnCGPAPH
- 129

-------
5.11 EXAMFIZ 11. This example shews hew to create a scattergram.
1 .•

EXAMPLE 11 (SCATTERGRAM)
1.4
1 i r
i I 1 I > I i I i | ¦ -i	1 i | i	J	r

1.2

•
•

1.0
-
1
# .
1
• • « •

.1

1% . •
•
*
• . .
• • • •



•. '
• • jlv. . 1

.4
• • \* '
• • I 9 _

.2
•.
• • * •
•* « •
• • #
	 i •

0
-
i
• t9
•4

-.2
-
/
• •

- .4
i •
1 • •
• . -
t
« •
| 1 1 1 * » * ' » I . 1 J_.. L —1	1	1	1	1	


.• -.4
..2 0 .2 .4 .t .1 1.0 1.2 1.4 1
X
.1
PROGRAM XMPLll
C
C Create a scattergram.
C
HEAL XDRA(500),YDPA(500)
C
C Fill the data arrays.
C
DO 101 1=1,500
XDRA(I)=.5+{2.*(FRAN()-.5))**5
EXAMPLES
- 130 -
AITTOGPAFH

-------
YDRA(I) = .5+(2.*(FRAN()-.5)) **5
101 CONTINUE
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAKY
C
C Suppress the frame advance.
C
CALL £GSETI ('FRAME.',2)
C
C Suppress the drawing of curves by the EZ... routines.
C
CALL A3SETT ('SET.',-1)
C
C Draw the background, using EZXY.
C
CALL EZXY (XDRA,YDRA,500,'EXAMPLE 11 (SCATTERGRAM) $')
C
C Put a plus sign at each of the x-y positions.
C
CALL POINTS (XDRA,YDRA,500,'+',0)
C
C Advance the frame.
C
CALL FRAME
C
STOP
C
END
FUNCTION FRAN ()
C
C Rand an-number generator.
C
DATA X / 2.7182818 /
SAVE X
X=AMDD (9821. *X+. 211327,1.)
FRAN=X
RETURN
END
SUBROUTINE BNDAR?
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0, 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0,' 0,1)
RETURN
END
AUTOGRAPH
- 131 -
EXAMPLES

-------
5.12 EXAMPLE 12. This example shews hew to create the effect of a histogram.
Shading is done by an XLI3 utility called FILL.
EXAMPLE 12 (HISTOGRAM)
f.l 	1	s	r
1	r
1.0

¦ i 1 i ¦ i • r

Hp
III
III
III
ill
III
III
III
mi
hi
1.0
PPOGRAM XMPL12
C
C Create a sort of histogram.
C
PEAL XDRA(249),YDRA(249) ,W0BK (204) , IWBK (204)
C
C Fill the data arrays. First, we define the histogram
C outline. This will be used in the call to FILL which
C fills in the area under the histogram.
EXAMPLES
- 132 -
ALTTCGPAFH

-------
c
XDHA(l) =0.
YDRA(l) =0.
C
DO 101 1=2,100,2
XDRA(I )=XDRA(I-1)
YDRA(I ) =EXP(-16.*(FLOAT(1/2) /50.-.51)**2)+.1*FRAN()
XDRA(I+1) =XDRA(I-1)+.02
YDFA(I+1)=YDFA(I)
101	CONTINUE
C
XDFA(102) =1.
YDHA(102) =0.
C
C Define lines separating vertical boxes from each other.
C
NDRA=102
C
DO 102 1=3,99,2
XDRA(NDRA+1)=1.E36
YDRA (NDFA+1) »1.E36
XDFA(NDFA+2)=XDFA(I)
YDFA(NDRA+2)=0.
XDFA(NDRA+3)=XDRA(I)
YDRA (NDPA+3) =AMIN1 (YDFA (I) ,YDRA(I+1))
NDRA3NDRA+3
102	CONTINUE
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAPY
C
C Suppress the frame advance.
C
CALL flGSETI ("FRAME.",2)
C
C Draw the graph, using EZXY.
C
CALL EZXY (XDRA, YPRA, 249, 'EXAMPLE 12 (HISTOGPAM) $')
C
C Use the XLIB routine FILL to fill the area defined by the
C data. Note that FILL is not part of the AUTOGRAPH package.
C
CALL FILLOP ("AN",45)
CALL FILLOP ("SP",128)
CALL FILL (XDRA,YDRA,102,WOFK,204,IWFK,204)
C
C Advance the frame.
C
CALL FRAME
C
STOP
C
AUTOGRAPH
- 133 -
EXAMPLES

-------
END
FJNcnctf rswo
c
C Kandcm-nLSiber generator.
C
CATA X / 2.7132313 /
SAVE X
XsMGDOSZl. *X+. 2U327,1. J
FSAK=X
HETOSfif
EHD
SUBH3Jm£ BfQAKi
C
C Routine to 5caw the plctfcec-fcarae edge.
C
OH. PLOTTT ( . 0, 0,0)
CALL 5LOTIT (32767, 0,1)
CALL FLOTir (32767,32767/1)
CALL PLOTIT { 0,32767,1)
CALL PLOTIi { 0, 0,1)
SSTCBN
END
EXAMPLES
- 134 -
AUTCGPAPK

-------
5.13 A FXNMi SXRMPIZ- The final example conveys an appropriate message. It
demonstrates two of the peculiar types of numeric labels which may be gen-
erated. (There are others.) It also derxsr\strates the use of dashed minor
ticks (a hellishly tiM-consuming-business which sometimes produces a nice
effect).
FINAL EXAMPLE
M
z
£
s
1/U
ri 2'»
3'
(.OCATTHUIC. »ASt 2. OPOHtHTUU. IABCL3
PFCG3AM EOSPLF
C
C Define the data array.
C
DIMENSION MECDU26)
C
JMJTCGPAPH
- 135 -
EXAMPLES

-------
C Fill the data array.
C
READ 1001 , XYCD
C
CO 101 1=1,226
IF OBCD(I) .EQ.1.E36) GO TO 101
XYCD(I)=2.**((XYCD(I)-15.)/2.5)
101 CONTINUE
C
C Specify log/log plot.
C
CALL DISPLA (0,0,4)
C
C Bump the line-maximum parameter past 42.
C
CALL AGSETI (*LINE/*1AXIM2M.',50)
C
C Soecify x- and y-axis labels, grid background.
C
CALL ANOTATC LOGARITHMIC, BASE 2, EXPONENTIAL LABELS?
+	'LOGARITHMIC, BASE 2, ND-EXPCNENT LABELS?
+	2,0,0,0)
C
C Specify the graph label.
C
CALL AGSEIC ('LABEL/NAME.VT)
CALL A3SETI ('LINE/NUMBER.',100)
CALL A3SEIC ('LINE/TEXT.','FINAL EXAMPLE?')
C
C Scecify x-axis ticks and labels.
C
CALL SGSETI ('BCTIt>V^AJOR/m>E.' ,3)
CALL flCSETF ('BOTTOVMAJOR/BASE.',2.)
CALL £GSETI ('BOTTOVNUMERIC/TYPE.',2)
CALL PCSSTI ('BOTICM/ttlNOH/SPACING.', 4)
CALL AGSETI ('BOTiaV>IINOR/PATIERN.',12S2S2B)
C
C Specify y-axis ticks and labels.
C
CALL PGSETI ' ('LEFT/MAJOR/IYPE.' ,3)
CALL PCSETF ('LEFT/MfiJOR/BASE.',2.)
CALL PGSOT ('LEET/NUMERIC/TYFE.' ,3)
CALL PCSUTL ('LEFT/MINOR/SPACING.' ,4)
CALL ?CSZTZ ('LETT/MINOR/PATTEEN.' ,1252523)
C
C Canpute secondary control parameters.
C
CALL SGSTOP (XYCD(l) ,1,0,113,2,XYCD(2) ,1,0,113,2)
C
C Draw the background.
C
CALL PGBPCZ.
C
EXAMPLES
- 136 -

-------
C Draw the curve twice to make it darker.
C
CALL 2GCUHV (XYCD(l),2,XYCD(2) ,2,113,1)
CALL POCim UOCD(l) ,2,XYCD(2) ,2,113,1)
C
C Draw a boundary around the edge of the plotter frame.
C
CALL BNDAKY
C
C Advance the frame.
C
CALL FRAME
C
STOP
C
C Fbnnat.
C
1001 POFMAT (14E5.0)
C
END
SUBROUTINE BNDARY
C
C Routine to draw the plotter-frame edge.
C
CALL PLOTIT ( 0r 0,0)
CALL PLOTIT (32767, 0,1)
CALL PLOTIT (32767,32767,1)
CALL PLOTIT ( 0,32767,1)
CALL PLOTIT ( 0, 0,1)
RETUEN
END
AUTOGRAPH
- 137 -
EXAMPLES

-------
6. hBSSXSS
AUTOGRAPH routines detect certain errors and, in response, <-aii the routine
SZTER, which is an adapted version of a PORT error handler. Currently, all
such errors are treated as being fatal and cause termination of the job. An
error message is legged before the job is terminated. Each such message
includes the name of the routine which detected the error and may be accon-
panied by supplementary information aimed at allowing the user to easily iden-
tify the call that caused the error. The possible error messages are as fol-
lows (in alphabetical order);
AGZXAX (CALLED BY AGSTTJP) - USER-SYSTEM-TO-LABEL-SYSIHI
MAPPING IS NOT MDNQTCNIC
This probably means that you have replaced the default routine AGUTOL with a
version of your own, and you've blown it.
AGGZTC - PARAMETER TO GET IS tOT HfTSINSICALLi OF TYPE CHAWCIZR
Hie argunent TP® specifies a parameter which is not intrinsically of type
character. See the description of ACGETC, in the section "ROUTINES".
AGGETP OR fCc&TP - ATTEMPT TO tCCESS LABEL ATTRIBUTES HEEORE
SETTING LABEL NAME
The parameter 'LABEL/MA-ME." must be set prior to the call which gave the error
message, specifying which label's attributes are being referenced.
AGGETP OR /CSET? - ATTEMPT TO PCCISS LIKE ATTRIBUTES BEFORE
SETTING LINE NUMBER
The parameter 'LIN£/Via<£ER.' must be set prior to the call which gave the
errcr message, specifying which label lire's attributes are being referenced.
AGGETP CR ASSET? - ILLEGAL KEWDHE LTZD 114 PARAMETER HEtPTIFIZR
The argument TPGN contains an unrecognizable Keyword.
AGXUHV - tJUfflES. OF POINTS IS .L£. 0
The argument lOY, in a call to AQCUK7, is less than or equal to zero. The
MESSAGES	- 130 -	AUTOGRAPH

-------
routine AGKURV is called by AGCURV to draw un-windowed curves.
AGNUM3 - MANTISSA TOO LONG
AGNUM8 - EXPONENT TOO LARGE
AGNUMB - ZERO-LENGTH MANTISSA
£GNUMB is called by AGAXIS to generate a character string expressing the value
of a floating-point number. You should not be able to generate any of
AGNUMB's error messages. If you do, see the AUTOGRAPH specialist.
AGQUKV " NUMBER OF POINIS IS .IE. 0
The argument NEXY, in a call to AGCURV, is less than or equal to zero. The
routine AGQUKV is called by AGCUHV to draw windowed curves.
AGRSTR - ERROR CN READ
AGRSTR - ENEH3F-FILE CN READ
*Probably the unit specified by IFNO was not positioned properly.
AGSAVE - ERROR CN WRITE
A system error has occurred as a result of the attempted "WRITE".
AGSETC ~ PARAMETER TO SET IS NOT INTRINSICALLY OF TXFE CHARACTER
This means that the argument TPQJ specifies sane parameter other than one of
the acceptable possibilities. See the description of AGSETC in the section
"ROUTINES".
AGSETP - ATTEMPT TO DEFINE LINE OF NDN-EXISTENT LABEL
The user has attempted to define a line of a label without first specifying
which label; 'LABEL/NAME.' mast be set prior to the call which gave the error
message.
AGSETP - LABEL LIST OVERFLOW - SEE AUTOGRAPH SPECIALIST
The user has attempted to define more labels than AUTOGRAPH can handle; a
AUTOGRAPH	- 139 -	MESSAGES

-------
modification of AUTOGRAPH is esquired. See the paragraph "INFORMATIONAL
LABELS", in the section "OVERVIEW", or talk to the AUTOGRAPH specialist.
AGSET? - LINE LIST CVE?iT£W - SEE AUTOGRAPH SPECIALIST
The user has attempted to define more label lines than AUTOGRAPH can handle; a
modification of AUTOGRAPH is required. See the paragraph "INFORMATIONAL
LABELS", in the section "OVERVIEW, or talk to the AUTOGRAPH specialist.
AGSTCH - CHARACTER-STRING BUFFER CVERFLCW - SEE CONSULTANT
The routine AGSTCH is called by AGSETC to stash the character string in
AUTOGRAPH'S character storage space. The available storage space has been
exhausted. See the consultant.
AGSTCH - CHARACTER-STRING INDEX OVERFLOW - SEE. CONSULTANT
The routine AGSTCH is called by AGSETC to stash the character string in
AUTOGRAPH'S character storage space. Tbo many such strings have been stored.
See the consultant.
AGSTUP - GRAPH WINDOW IMPROPERLY SPECIFIED
The parameters in the group named 'GRAPH.' have ijnprcper values.
AGSTUP - GRID WINDOW IMPROPERLY SPECIFIED
The parameters in the group named 'GRID.' have ijnprcper values. This is most
likely to cccur when 'STT.' has the value "2." or "4.", specifying that the
edges of the grid window are to be as implied by the last call to the plot
package routine SET. Check to make sure that the portion of the plotter' frame
specified by the last SET call is within the current graph windew.
AGSTUP - s LABELS IMPROPERLY SPECIFIED
where "s" = "LEFT", "RIGHT", "BOTTOM", "TOP", or "INTERIOR".
Re-read the paragraph "THE LABEL 30XES", in the section "OVERVIEW". You have
defined a label with a basepoint cn cr.a edge of the crid window and an offset
vector pointing outward, sane part of .nich extends inside .the grid window (or
vice-versa). This is not allowed.
MESSAGES
- 140 -
AUTOGRAPH

-------
APPENDIX B
GRAFLIB SUBROUTINE DESCRIPTIONS
GeoEAS Program's Guide
April 1990

-------
c	
C filename: GRAFLIB.DOC	(descriptions of subroutines contained in
C	the library GRAFLIB.LIB).
C
C**********************************************************************
SUBROUTINE ZXFACT (XVAL, IVALUE)
Formal Arguments:
XVAL - (REAL*A)
IVALUE - (INTEGER*2)
This is an internal routine that converts X-axis scale units to GRAPHICS
uni ts.
SUBROUTINE ZYFACT (YVAL, IVALUE)
Formal Arguments:
YVAL - (REAL**)
IVALUE - (INTEGER*2)
This is an internal routine that converts Y-axis scale units to GRAPHICS
uni ts.
SUBROUTINE ZSETGU
Sets the co-ordinate addressing to GRAPHICS units.
SUBROUTINE ZSETSU
Sets the co-ordinate addressing to SCALE units.
SUBROUTINE MAKEGU (XVAL, YVAL, GXVAL, GYVAL, IERR)
Formal Arguments:
XVAL, YVAL	- (REAL*4)
GXVAL, GYVAL, IERR - (INTEGER*2)
This is an internal routine that converts scale values to GRAPHICS UNITS.
SUBROUTINE FLTASC (FNUMBR, FBUF, NFRAC, NDIGIT)
Formal Arguments:
FNUMBR	- (REAL*4)
FBUF	- (DECLARED as CHARACTER*1 FBUF (*))
NFRAC, NDIGIT - (INTEGER*2)
This is an internal routine that converts a floating point number to ASCII
characters.
GeoEAS Program's Guide
April 1990

-------
SUBROUTINE INTASC (INUMBR, IBUF, NDIGIT)
Formal Arguments:
INUMBR, NDIGIT - (INTEGER*2)
IBUF	- (DECLARED AS CHARACTER*1 IBUF (*))
This is an internal routine that converts integer numbers to ASCII characters.
SUBROUTINE ZCLEAR
Clears the graphics screen.
SUBROUTINE ZCOLOR (COLCOD)
Formal Argument:
COLCOD - (INTEGER*2) Color to be used for drawing lines or
plotting labels.
Selects user-specified color.
SUBROUTINE ZMOVE (XVAL, YVAL)
Formal Arguments:
XVAL, YVAL - (REAL*4) Coordinates of the new position to which the cursor is
to be moved.
Moves the graphics cursor to a new position.
SUBROUTINE ZPLOT (XVAL, YVAL)
Formal Arguments:
XVAL, YVAL - (REAL*4) X and Y co-ordinate values of a point to which a line
segment is to be drawn from the current position.
Plots a line from the current position to a new position specified by (XVAL,
YVAL).
SUBROUTINE ZNLABL (FNUM, NFRAC)
Formal Arguments:
FNUM - (REAL*4) Floating point number to be labeled.
NFRAC - INTEGER*2) Number of fractional digits to be labeled.
Converts the given floating point number to the appropriate form as specified
by NFRAC, then proceeds to labels in previously specified direction and
orientation.
GeoEAS Program's Guide
April 1990

-------
SUBROUTINE ZLABEL (LARRAY)
Formal Argument:
LARRAY - (CHARACTER*1 LARRAY(*)) Text of ASCII characters.
Labels the given text in the previously specified direction and orientation.
SUBROUTINE SETTXT
Sets screen to text mode.
SUBROUTINE GHODE (MODE, IERR)
Formal Arguments:
MODE - (INTEGER*2)
IERR - (INTEGER*2)
This is an internal routine that sets the screen to graphics mode for the
Hercules graphics card.
SUBROUTINE ZXAXIS (XMIN, XMAX, TINT, TICSPC)
Formal Arguments:
XMIN - (REAL*4) X-coordinate value assigned to the start of the X-axis.
XMAX - (REAL*4) X-coordinate value assigned to the end of the X-axis.
YINT - (REAL*4) Y-coordinate of X-axis.
TICSPC - (REAL*4) Tic spacing.
Draws the horizontal axis. Tics are placed at an interval of TICSPC.
SUBROUTINE ZYAXIS (YMIN, YMAX, XINT, TICSPC)
Formal Arguments:
YMIN - (REAL*4) Y-coordinate value assigned to the start of the Y-axis.
YMAX - (REAL*4) Y-coordinate value assigned to the end of the Y-axis.
XINT - (REAL*4) X-coordinate of Y-axis line.
TICSPC - (REAL*4) Tic spacing.
Draws vertical axis. Tics are placed at an interval of 'TICSPC' .
SUBROUTINE ZGTLOG (XVAL, YVAL, LXVAL, LYVAL, IERR)
Formal Arguments:
XVAL - (REAL*4)
YVAL - (REAL*4)
LXVAL - (REAL*4)
LYVAL - (REAL*4)
GeoEAS Program's Guide
April 1990

-------
IERR - (INTEGER*2)
This is an internal routine that converts plot points to logarithmic values if
log scale(s) are specified.
SUBROUTINE ZXTICK
Plots a vertical tic at the current cursor location on a horizontal (X-axis)
line.
SUBROUTINE ZYTICK
Plots a horizontal tic at the current cursor location on a vertical (Y-axis)
line.
SUBROUTINE GETVOR (XMIN, XMAX, THIN, YMAX)
Formal Arguments:
XMIN - (REAL*4)
XMAX - (REAL*4)
YMIN - (REAL*4)
YMAX - (REAL*4)
Returns global world coordinate extents as set by the routine ZSCALE.
SUBROUTINE GETDEV (MINX, MAXX, MINY, HAXY)
Formal Arguments:
MINX - INTEGER*2
MAXX - INTEGER*2
MINY - INTEGER*2
MAXY - INTEGER*2
Returns device extents.
SUBROUTINE PGRAPH
Prints current graphics screen to EPSON compatible dot matrix printer.
SUBROUTINE ZASPCT (ASPECT)
Formal Argument:
ASPECT - (REAL*4) Aspect ratio X to Y, used for drawing arcs and circles.
GeoEAS Program's Guide
April 1990

-------
Specifies aspect ratio for drawing arcs and circles. Aspect is the ratio of
X-axis to Y-axis. As the row and column spacing of the graphics screen is not
equal, the aspect ratio is used to create smoother looking arcs and circles.
SUBROUTINE ZCHORD (ANGLE)
Formal Argument:
ANGLE - (REAL*4) Chord angle to be used for generating arcs or circles.
Specifies chord angle for drawing arcs and circles. Chord angle governs the
smoothness of the arc or circle. Small chord angle produces smooth arcs and
circles. Conversely a large chord angle produces coarse arcs and circles.
SUBROUTINE ZCURVE (XARRAY, YARRAY, NPOINT)
Formal Arguments:
XARRAY, YARRAY - (ARRAYS OF REAL*4) Coordinates of points through which a
curve is to be drawn.
NPOINT	- (INTEGER*2) Number of points in (XARRAY, YARRAY).
Draws a curve through a given set of data points.
SUBROUTINE ZCIRCL (XCENTR, YCENTR, IRAD)
Formal Arguments:
XCENTR, YCENTR - (REAL*4) Coordinates of center of a circle in current units
(i.e. SCALE or GRAPHICS units).
IRAD	- (INTEGER*2) Radius of the circle specified in GRAPHICS
uni ts.
Draws a circle of specified radius. The center of the circle is located at
(XCENTR, YCENTR).
SUBROUTINE ZCMOVE (NCHAR)
Formal Argument:
NCHAR - (REAL*4) Number of character spaces.
Moves the graphics cursor by a specified number of character spaces.
SUBROUTINE ZHOME
Moves the cursor to HOME position (lower left corner of the screen).
GeoEAS Program's Guide
April 1990

-------
SUBROUTINE ZLBDIR (DANGLE)
Formal Argument:
DANGLE - (REAL*4) Label direction, specified in degrees.
Specifies the angle at which subsequent labels will be drawn.
SUBROUTINE ZLBORG (DCODE)
Formal Argument:
DCODE - (INTEGER*2) Label origin. The value of DCODE ranges from 1 to 9.
Sets the label origin.
SUBROUTINE ZLOCAT (XMIN, XMAX, YMIN, YMAX)
Formal Arguments:
XMIN, XMAX - (INTEGER*2) Horizontal plotting boundary limits in GRAPHICS
uni ts.
YMIN, YMAX - (INTEGER*2) Vertical plotting boundary limits in GRAPHICS units.
Defines the plotting boundary within the graphics screen's absolute limits.
SUBROUTINE ZLSLIN (XVALS, YVALS, NPOINT)
Formal Arguments:
XVALS, YVALS - (ARRAYS OF REAL*4) Coordinates of points used for computing a
least-squares line.
NPOINT	- (INTEGER*2) Number of points in (XVALS, YVALS).
Draws a least-squares line using the (XVALS, YVALS) data points.
SUBROUTINE ZLXSC (XMIN, XMAX, YMIN, YMAX)
Formal Arguments:
XMIN, XMAX - (REAL*4) Horizontal scale minimum and maximum.
YMIN, YMAX - (REAL*4) Vertical scale minimum and maximum.
Specifies the logarithmic scale for the X-axis and a linear scale for the Y-
axis.
SUBROUTINE ZLXYSC (XMIN, XMAX, YMIN, YMAX)
Formal Arguments:
XMIN, XMAX - (REAL*4) Horizontal scale minimum and maximum.
YMIN, YMAX - (REAL*4) Vertical scale minimum and maximum.
GeoEAS Program's Guide
April 1990

-------
Specifies logarithmic scales for X and Y axes.
SUBROUTINE ZLYSC (XMIN, XHAX, YHIN, YMAX)
Formal Arguments:
XMIN, XMAX - (REAL*4) Horizontal scale minimum and maximum.
YMIN, YMAX - (REAL*4) Vertical scale minimum and maximum.
Specifies the linear scale for the X-axis and a logarithmic scale for the Y-
axis.
SUBROUTINE ZRCABS (XCENTR, YCENTR, ARCANG)
Formal Arguments:
XCENTR, YCENTR - (REAL*4) Center coordinates of the circle that contains the
arc.
ARCANG	- (REAL*4) Size of the arc in degrees.
Draws an arc of the given angle from the current cursor position by ARCANG
degrees.
SUBROUTINE ZRCREL (XCENTR, YCENTR, ARCANG)
Formal Arguments:
XCENTR, YCENTR - (REAL*4) Center coordinates of a circle that contains the
arc.
ARCANG	- (REAL*4) Size of the arc in degrees.
Draws an arc of a given angle from the current position by ARCANG degrees.
SUBROUTINE ZRLINE (XARRAY, YARRAY, NPOINT)
Formal Arguments:
XARRAY, YARRAY - (ARRAYS OF REAL*4) Relative positions of points. The very
point is relative to a previous point.
NPOINT	- (INTEGER*2) Number of relative points in XARRAY, YARRAY.
Draws line segments as specified by the relative positions (XARRAY, YARRAY).
SUBROUTINE ZRMOVE (XVAL, YVAL)
Formal Arguments:
XVAL, YVAL - (REAL*4) Relative position of the new point with reference to
current cursor location.
Moves the cursor to a new position (relative to the current cursor position).
GeoEAS Program's Guide	April 1990

-------
SUBROUTINE ZRPLOT (XVAL, TVAL)
Formal Arguments:
XVAL, YVAL - (REAL*4) Relative coordinates of a point to which a line is to be
dravn.
Draws a line from current cursor position. The size of the line is specified
by (XVAL, YVAL).
SUBROUTINE ZSCALE (XMIN, XMAX, YMIN, YMAX)
Formal Arguments:
XMIN, XMAX - (REAL*4) Horizontal scale minimum and maximum.
YMIN, YMAX - (REAL*4) Vertical scale minimum and maximum.
Specifies user scale units for the area defined by the 'ZSCALE' routine.
SUBROUTINE ZSLOPE (XI, Yl, X2, Y2, ANGLE)
Formal Arguments:
XI, Yl - (REAL*4) Starting point of line segment whose slope is to be
computed.
X2, Y2 - (REAL*4) Ending point of line segment whose slope is to be computed.
ANGLE - (REAL*4) Slope of line segment drawn from (XI,Yl) to (X2,Y2) in
degrees.
Calculates the slope of a line segment in degrees.
SUBROUTINE ZTCSIZ (ITPOS, ITNEG)
Formal Arguments:
ITPOS - (INTEGER*2) Size of the tic to be drawn on the positive side of the X-
axis or Y-axis.
ITNEG - (INTEGER*2) Size of the tic to be drawn on the negative side of the X-
axis or Y-axis.
Specifies tick size in GRAPHICS units(pixels).
SUBROUTINE ZVHERE (XVAL, YVAL)
Formal Arguments:
XVAL - (REAL*4) X-coordinate of the current cursor location.
YVAL - (REAL*4) Y-coordinate of the current cursor location.
Gets the current location of the cursor in current units (i.e., GRAPHICS or
SCALE units).
GeoEAS Program's Guide
April 1990

-------
SUBROUTINE ZXLGlO (SCLINE)
Formal Argument:
SCLINE - (INTEG£R*2) Sub-cycle flag.
1	= plot sub-cycle lines.
2	= plot major lines only.
Draws a set o£ logarithmic (Base 10) horizontal lines.
SUBROUTINE ZYLG10 (SCLINE)
Formal Argument:
SCLINE - (INTEGER*2) Sub-cycle flag.
1	= plot sub-cycle lines.
2	= plot major lines only.
Draws a set of logarithmic (Base 10) vertical lines.
SUBROUTINE ZXLINE (XMIN, XMAX, TINT)
Formal Arguments:
XMIN - (REAL*4) Starting X-coordinate value of a horizontal line.
XMAX - (REAL*4) Ending X-coordinate value of a horizontal line.
YINT - (REAL*4) Y-coordinate value of a horizontal line.
Dravs a horizontal line. The values can be given either as GRAPHICS units or
as SCALE units.
SUBROUTINE ZYLINE (YMIN, YMAX, XINT)
Formal Arguments:
YMIN - (REAL*4) Starting Y-coordinate value of a vertical line.
YMAX - (REAL*4) Ending Y-coordinate value of a vertical line.
XINT - (REAL*4) X-coordinate value of a vertical line.
Draws a vertical line as specified by YMIN, YMAX and XINT values. The values
are interpreted in current units (i.e., GRAPHICS or SCALE units).
SUBROUTINE ZXYLIN (XARRAY, YARRAY, NPOINT)
Formal Arguments:
XARRAY, YARRAY - (ARRAYS OF REAL*4) Coordinates of points through which line
segments are to be drawn.
NPOINT	- (INTEGER*2) Number of points in XARRAY and YARRAY.
Connects given array of points with line segments.
GeoEAS Program's Guide
April 1990

-------
c*********************************************************************
Assembler routines:
The following are lowlevel routines which should not
be called by the applicationm program.
GPRINT ASM
Called from Pgraph
C	
CHRPLT ASM
Plots a string on a color monitor
C	
VMODE ASM
Sets video mode
C	
DRAW ASM
Draws a line on a color monitor
C	
INKEY ASM	- gets a key from the keyboard
CHARACTER*1 KeyChr - character typed
INTEGER*2 KeyCod - scan code for character
CALL Inkey (KeyChr, KeyCod)
C	
HGC	ASM
Sets hercules card in graphics mode
C	
SETPAL ASM
Sets pallette for color graphics card
C	
PLOTCHAR ASM
Plots a character on a color monitor
Qk'k'k-kkkk-k-k-kkk-k'k'k'k-k'k'k'k'k'k'k'k'k^k'k'klc'kk-kk-kklck'k'k'k'k'k'k'k'klc'k'k'k'kkk'k'k'k'k'k'kkk-k'k'k'k'k'kk'k'k
C Language Routines:
The routines HDRAV and HCHPLT are C language replacements for the routines
given in the LIBRARIAN (written in assembly). They mimic the functions of
these routines correctly.
(the previous routines did not work)
GeoEAS Program's Guide
April 1990

-------
These routines were compiled using the following:
cl -c -AL -FPc herc.c hdrav.c hchplt.c hstring.c 
lib herclibe+herc+hdrav+hchplt-hstring 
To use this library with a FORTRAN program that needs to use any of the
graphics routines use the following compile statement:
f1 -AL -FPc tes t.for
The appropriate Interface statements must appear in the FORTRAN Source code.
To link the code to graflib, a C-compatible FORTRAN Large-model library,
(CLIBFORE.LIB) and associated C large-model library (LLIBC.LIB) must also be
present for the linker. For more info, see the MSFORTRAN reference manual on
'calling C functions'
The convention for ROW and COL used is as follows:
Row 0 - 719 (from left to right on screen)
Col 0 - 347 (from top to bottom on screen)
C	
Functions:
interface to integer*2 function init[C]()
end
INIT ()
- Initialize Hercules graphics mode
C	
interface to integer*2 function reset[C]()
end
RESET ()
-	Reset Hercules to text mode
C	
PUTPIX (SCREEN, X, Y)
-	Plot points in Video Memory
C	
SET_CHAR (SCREEN, CH, X, Y)
-	Plot character in Video Memory
C	
interface to integer*2 function hstring[C]
1	(string[reference],len,row, col,dir,page)
character*80 string
integer*2 len, row, col, dir, page
end
GeoEAS Program's Guide
April 1990

-------
HSTRING (STR, LEN, ROW, COL, DIR, PAGE)
- Plot a string of characters in graphics mode
Str	- Character String
Len	- number of characters to plot
Row	- starting row position
Col	- starting column position
Dir	- direction in degrees (0, 90, 180, 270)
Page - graphics page (0, 1)
C	
interface to integer*2 function hdrav[C]
1	(xl, yl, x2, y2, page)
integer*2 xl, yl, x2, y2, page
end
HDRAW (XI, Yl, X2, Y2, PAGE)
- Draw line (use Bresenham Algor.)
XI - Starting column position
Yl - Starting row position
X2 - Ending column position
Y2 - Ending row position
Page - Graphics page
C	
interface to integer*2 function hchplt[C]
1	(chars, row, col, dir, page)
character*l chars
integer*2 row, col, dir, page
end
HCHPLT (CHARACTER, ROW, COL, DIR, PAGE)
- plot a character on video Page at Row, Col
Character - character to plot
Row	- starting row position
Col	- starting column position
Dir	- direction in degrees (0, 90, 180, 270)
Page	- graphics page (0, 1)
GeoEAS Program's Guide
April 1990

-------
APPENDIX C
Screen Access MaNAGEMENT (SAM) USERS GUIDE
GeoEAS Program's Guide
April 1990

-------
I3M PC SCREEN ACCESS MANAGEMENT (SAM) UTILITIES
USER'S GUIDE
Prepared for
Environmental Monitoring Systems Laboratory
U.S. Environmental Protection Agency
Las Vegas, Nevada 89193-3478
Prepared by
Computer Sciences Corporation
Environmental Monitoring Systems Laboratory
944 East Harmon
Las Vegas, NV 89119
Under EPA Contract No. 68-01-7176
August 1987

-------
REVISIONS
Revision MumVigy	Data	Reason
1	September 1988	To document routines
added to the utility.

-------
USER'S GUIDE
TABLE OF CONTENTS
Paae
Section 1 - Introduction . . 			
1.1	Summary Overview 		1-1
1.2	History	1-1
1.3	Environment	1-1
1.4	Document Organization 		1-1
Section 2 - system Overview 		2-1
2.1	How to Start	2-1
2.2	How to Compile and Link Your Program	2-1
2.2	• System Description	2-2
2.3	Screen Definition File	2-3
2.3.1	Input Field Block 		2-5
2.3.2	Label Block	2-8
2.3.3	Frame Block			2-8
2.3.4	Screen Block	2-3
2.4	Attribute	2-9
2.5	Field Types	2-10
2.6	System Routines	2-11
2.7	System Variables 		2-17
2.8	Key Check Routine	2-20
2.9	Blockdat Utility 		2-21
Section 3 - Examples	3-1
3.1	Basic Example	3-1
3.2	Advanced Example 	 3-3

-------
USTR'S GPiaC
SECTION 1 - INTRODUCTION
1.1	SUHKAS-'f OVERVIEW
This system is a collection of FORTRAN routines that create
.screens for data fintry, verification and editing. By including
the screen declarations, specifying screen parameters, and
calling the SAy. utility routines, programmers can incorporate the
system into any FORTRAN application program.
1.2	HISTORY
In conjunction with the development of screen, processing on the
MicroVAX, the Screen Access Management (SAW) System vas
developed- This system was then ported to the IBM PC by
replacing all references to structures and records with parallel
arrays. The system has been modified and enhanced while being
used in various other applications.
1.3	ENVIRONMENT
The systas requires an I3M PC or compatible. A Microsoft FORTRAN
version 4.01 compiler, C compatible large model FORTRAN library
with coprocessor emulation (CLI3F0R£) version 4.C and a large
r.odel c library (LLI3C} version 4.0 were used to create the
utilities library.
1.4	DCCUKZNT CR0AS13ATI0H
This doc.i3.ent is intended for use by experienced FORTRAN
pre graders. A thorough knowledge of the FORTRAN language and
its use in developing software applications is assumed. As
nearly as practicable, E?A documentation standards were followed
as described in the ADP System Documentation Standards, January
1386.
1-1

-------
SECTION 2 - SYSTEM OVERVIEW
2.1	HOW TO START
The first step is to copy the files from the distribution
diskette i.-.to the appropriate directory usir.g the COPY command.
Note that the distribution diskette contains two subdirectories:
\SCREIN\ASM contains the machine dependent routines used (See
Appendix A for a listing of these routines) and \SCREEN\EXAMPLZ
contains the files for the advanced example (See Section 3.2 for
more information about the advanced example).
2.1	KQW TO COMPILE AND LINK YOUR PROGRAM
When you have written your program, you will need to compile it
using the following command:
FL /c /4Ns /4Nt /Od /Fpc filename
Use a command similar to the following to link your compiled
program with the screen routines:
LINK /NOD /E MYPRQG, ,MYPROG,SCREENE. LIB, CLI3F0R2.LIB, LLIBC. LIB
In every program you write that accesses either SAM routines or
SAM variables, ycu will have to include the screen declarations.
Each of ycur routines should contain the. following statement:
$ INCLUDE : 1 SCREEN. STR1
Example programs are provided in Section 3. Refer to them often
as supplements to this manual.
2-1

-------
2 . 2
SYSTEM DESCRIPTION
The SAM utilities are designed to provide you with the tools to
display screens, position the cursor on the screen, and allow
entry of various types of data. It does a minimum amount of
error checking, mostly to disallow non-nuxeric characters in
numeric fields. Your programs must process the data once it has
been entered into variables.
The system routines are described in detail in Sub-section 2.6.
Variables used by the system can be useful, and are listed in
Sub-section 2.7. You must specify how the screen will look, what
crder data will be entered, and information about the data by
creating a Screen Definition File. This file has a specific
format which is explained in Sub-section 2.3.
2-2

-------
2.3	SCREEN DEFINITION FILE
The following is a diagram of the different sections, or blocks,
cf the Screen Definition File. The information must appear in
the order indicated in the diagram. All ENDs must be present fcr
each screen, and the last line in the file is always an ENDFILE.'
Comment and blank lines are allowed. Comment lines contain a 1 c1
or 'c' in the first column.
Starting Input Field Name
/			\
| Input Field Name & Information ]
[ Members Info (if any)	| -> INPUT FIELD BLOCK
| Messages	(if any)	j
\	/
( Input Field Blocks repeat for every input field )
END ( of input fields )
/	\
| Label Field Information & Text | -> LABEL BLOCK
\	/
( Label Blocks repeat for every label )
END ( of label fields )
I Frame Commands & Information | -> FRAME BLOCK
( Frame Blocks repeat for desired boxes or lines )
END ( of frame fields )
\			/
I
-> SCREEN BLOCK
( Screen Blocks repeat for each screen (up to 10 screens) )
ENDFILE
\			/
2-3

-------
The Starting Input Field Name references the input field name
that will be selected when the screen is first displayed. This
field naaa is the only thing on the line and begins in column
two. It can be up to ten characters long, and must appear as an
input field naae in one of the lines of the input: field block.
2-4

-------
2.3.1	Input Field Block:
The input fields are described completely in this block.
Information on the labels to identify the fields is placed in tr.e
Label Block, as outlined in Sub-subsection 2.3.2. The following
table shows the format of each input field name and information
line. Listed is the beginning column for each entity, its
ler.g-h, and a description of the entity. All information in this
line is in integer format except the variable name, which is
character data.
Col Len Description
2 10 Variable Name for the field.
12 4 Length of the field (number of characters) .
17 3 Row position on the screen (0-23 tcp-bottom) .
21 3 Column position on the screen (0-79 left-right) .
25 2 Attribute: how the field appears on the screen.
See Sub-section 2.4 for more on attributes.
2 3 2 Chosen Attribute: how the field appears on the screen
when chosen or selected. See Sub-section 2.4
for more on attributes.
31 2 Field Type: the type of data to entered into the field.
See Sub-section 2.5 for more on field types.
34 2 Next: if 0, a carriage return is required to go to the
next field; if 1, when the maximum length of the
field has been reached during data entry, the next
field will be selected without a carriage return.
37 3 Carriage Return: an index to what field the cursor will
go to when done entering data in the current field.*
41 3 Up Arrow: an index to what field the cursor will go to
when the up arrow is pressed.*
45 3 Down Arrow: an index to what field the cursor will go
to when the down arrow is pressed.*
49 3 Left Arrow: an index to what field the cursor will go
to when the left arrow is pressed.*
53 3 Right Arrow: an index to what field the cursor will go
to when the right arrow is pressed.*
57 3 Members: the number of toggle field or menu values
available. This number is ignored when Field Type
< 3. Member names are listed below the line. See
next table in this Sub-subsection.
* Indexing is based on an input field's relative position in the
Screen Definition File.
-n: refers n positions backwards
0: doesn't move from the field position
+n: refers n positions forward
2-5

-------
€1 2 Position: used only for Field Type of 3 or 5, otherwise
ignored. This denotes which member of the menu
values will take on the Chosen Attribute,or which
toggle field will be displayed when the screen is
first displayed. For more information on how
position numbers are assigned, see Sub-section 2.5.
3 Message: the number of message lines to be displayed
when the field is selected. Messages are listed
below Member names (if any). See table after next
in this Sub-subsection.
65
In the examples in Section 3, header comment lines are placed
above the firs- input information line to be used as guides.
This can prove to be helpful when writing the Screen Definition
File. The comment lines are as shown below:
C	Ler. Row Col At CA Typ Nx CH Up Dn Lf Rt Mem Pos Mes
" / / r / t ~~~~ I —— I	I ~I	I	,
The following table describes the information found when the
Members entity is greater than zero and the Field Type is 5, a
toggle field (explained in Sub-section 2.5). If the Members
entity is greater than zero and the Field Type is 3 or 4 (menu
fields), this table does not apply. See Sub-section 2.5 for
information on this case.
Basically, the number of members is how many different selections
a user can choose from. Below the input field information line
all the toggle field values are listed. The table shows the
beginning column number, the length of each toggle field value,
and a description of how the toggle field values are listed. Ail
toggle field values are read in as characters.
Col Len Description
12 * List of toggle field values, separated by commas (or
any character)
* The length of each toggle field is the number in the input field
information line that describes the length of the field.
2-6

-------
The next table describes the information f-ound vhen the Keas-sags
entity is greater than sera. This Indicates the number of
messages that vill appear -when the field is chosen. The message
information appears below the Members information line if there
is one, cr directly below the input fiald information line if
there are no Kertbers. There is one line of information for each
Message. All data in the line is integer except for the message
text.
Col
Len
Description
12
2
Sow position of the'message on the screen.


(0-23 top-bottom)
15
2
Column. position of th.e message on the screen.


(0-79 left-right)
IS
1
Attribute of the message on the screen.


See sub-section 2.4 for more on attributes.
20
*
The message text to be displayed-
* Messages can be up to SO cha.ract.ars long, or lass, depending
on where they are placed on the screen. They should all be the
same Isngth otherwise the semicolon vill appear as a part cf
the message on the shorter message lines.
NOTE: Do not use the TAB key when typing in the screen definition
file.
2-7

-------
2.3.2	Label Block
The label block contains text that usually describes input fields
for data entry. However, you can use labels anywhere on the
screen. The format for a single label information line is in the
following table. Information is in integer format.
Col Len Description
1 4 Row position of label (0-23 top-bottom)
7 2 Column position of label (0-79 left-right)
11 1 Attribute of the label on the screen.
See Sub-section 2.4 for more on attributes.
2.3.3	Frame Block
The frame block allows boxes and lines to be drawn on the screen.
The following table shows the format for the frame information
line. The commands are character format, the rest are integers.
Col
Len
Descriation

4
Command, either BOX or LINE, depending on which


want to draw on the screen.
6
1
Type, 1 for single line, 2 for double lines
3
3
Row at which to start (0-2 3 top-bottom)
12
3
Column at which to start (0-79 left-right)
16
3
Row at which to end.
20
3
Column at which to end.
24
3
Attribute of the drawing characters.
See Sub-section 2.4 for more on attributes.
The rows and columns that describe the box are the starting and
ending coordinates. On a vertical line, the starting and ending
columns must be the same. Similarly, on a horizontal line, the
starting and ending rows must be the same.
2.3.4	Screen Block
Up to ten screens may be described in a Screen Definition File.
They are selected in the order that they appear in the Screen
Definition File. Screens are numbered from 1-10.
2-3

-------
2.4
ATTRIBUTES
AtcriSsifca values d¬e how t^e characters are displayed, on the
screen. Tha possible values ace listed fcelow:
o
Warrsal
1
Bold
2
Reverse
4
alinking
3
Underline
Thesa can be coobined by adding values tc^etfra;:. For exanpis, %
would denote both Bold and aiinking- Sorae places in the Screen
Definition File only allow ons character for specifying the
attributes, so you must be sura you can put in a two-character
specificati.cn if you will be cambining attributes.
2-3

-------
2.5	FIELD TYPES
There ara six different types of input fields allowed in the
Screen Definition File. They are listed below with their codes:
0	Character
1	Integer
2	Floating Point
3	Mertu
4	Menu Values
5	Toggle
Character fields accept any printable characters as input.
Integer fields are for those numbers without decimals. Floating
point (or real) numbers can contain decimal points, signs, and
exponential (or scientific) notation.
Toggle fields ara assigned specific possible values that a
variable can have, so that the user can display each, in turn, in
the field by pressing the space bar, and select one using the
enter (or return] key. Each value that a toggle field can have
is assigned a position number. The positions are in the order
the values are listad in the Screen Definition File and start
with 0 for the first value. The position listed on the line for
the toggle field information is the one that will be displayed on
the screen first- The position value is updated to reflect the
choice made by the user. See Sub-subsecticn 2.3.1 for
information on the Screen Definition File and position entity.
The Menu field types ars similar to toggle fields except that ail
of the values that a variable car. have are displayed, and the
user presses the arrow keys to make a selection. Each block of
menu field selections starts with a Menu type (3) line in the
Screen Definition File. This input field name and information
line need only contain information on Field Type, Members, and
Position. The number of members denoting how many values the menu
field has to choose from- The position denoting which menu value
will be shown as the chosen attribute vhen the screen is first
displayed. Following the Menu type line are Members number of
Menu Values lines. These are in the same format as any other
field name and information line, except that the text to be
displayed is added after the message entity starting at column
70. The Menu Values lines do not have to denote a Position.
Each value that a menu field can have is assigned a position
number automatically. The menu field is assigned position 0, and
the menu values are numbered consecutively starting at 1. The
position number is updated to reflect the choice made by the
user.
2-10

-------
2 . 6
SYSTEM ROUTINES
The follcving SA24 utility routines are available for the user.
They are listed in alphabetical order. Functions are identified
as such, if not stated, the routine is a subroutine. There are"
other routines in the package that are used internally by the
utility ar.d are not intended for the user. They are listed after
the user-available routines.
Clear Fields
Clears the input fields of the current screen to blanks.
Clear Screen
Clears the entire screen.
Beep
Beeps.
Display Fields
Displays the input fields of the current screen.
Display Frame
Displays the boxes and lines of the current screen.
Display Labels
Displays the labels of the current screen.
Display One Field (Field_Name)
CHARACTER*(*) Field_Name
Displays the specified field.
Erase Characters (Row, Column, N)
INTEGZR*4 Row, Column, N
Erases N characters beginning at Row, Column.
Flash (Row, Column, Message)
CHARACTER*(*) Message
INTEGER*4 Row, Column
Flashes a message in reverse video, then waits for a single
keystroke.
2-11

-------
Get Character Value (Wane, Value)
CHARACTER*(*) Name
CHARACTER*(*) Value
Gets the character value of the variable referenced by
'Name'.
Get Field
Gets the next field to be processed. This routine used to
obtain all information from the screen. It determines the
type of field to get, from the Screen Definition File value
for Field Type.
Get Floating Point Value (Name, Value 3)
CHARACTER* ( + J Name
REAL*8	Value 8
Gets the double precision value of the variable referenced
by 'Name1.
Get 4 Floating Point Value (Name, Value 4)
CHARACTER*(*) Name
REAL*4	value 4
Gets the single precision value of the variable referenced
by 'Name1.
Get Integer value (Name, Value)
CHARACTER* ( * ) Name
INTEGER*4	Value
Gets the integer value of the variable referenced by 'Name1
Get Key (Character)
INTEGER*4 Character
Gets the next character typed. -'Character' contains the
ASCII value of the character typed.
Get Menu Choice (Menu Name, Menu Choice)
CHARACTER* (*) Menu Name, Menu Choice
Returns string containing chosen time.
Get Menu Value (Name, Position, Value)
CHARACTER* ( *) Name
INTEGER*4	Position
CHARACTER* ( *) Value
Gets the ccsition and value of the menu field referenced by
'Name'. See Sub-section 2.5 for information about position

-------
Get Seres- Fields
Displays the screen frame, labels, and fields and gets the
screen fields for the current screen. This routine makes
several assumptions which are:
1.	The starting field name for a screen always points
to a menu field which begins the program.
2.	Menu choices are 'linked' either to other menus in
other screens, sub-menus (on current screen), or
screen fields, where options are chosen.
3.	SUBROUTINE New Screen (1) has been called just prior
to entry into this routine.
Get Toggle Value (Name, Position, Value)
CHARACTER* ( *) Name
INTEGZR*4	Position
CHARACTER* (*) Value
Gets the position and value of the toggle field referenced
by 'Name' . For example, if there are five members of the
toggle field, and the second one has been chosen by the
user, position will be 1 (since it starts at zero) and the
value will be the characters displayed.
Get Yes No (Row, Column, Prompt)	(LOGICAL*! function)
CHARACTER* (*) Prompt
INTEGZR*4	Row, Column
LOGICAL*1 Get Yes No
Returns .TRUE. or .FALSE, after getting a yes or no answer
to Prompt at Row, Column.
Left Justify (String)
CHARACTER* (*) String
Left justifies a string.
Lenstr (String)	.	(function)
CHARACTER* (*) String
INTEGER	Lenstr
Returns actual length of String (position of last non-blank
character).
Load Toggle Values (Name, Length, Member Total, Variable List,
Toggle Position)
CHARACTER*(*) Name, Variable List(l)
INTEGER*4	Length, Member Total, Toggle Position
Loads toggle members into a toggle field where
Name:	name of toggle field
Length:	maximum length of a meaber
2-12

-------
Member Total: maxiaua number of teggle meabers peraittac*
Variable List: list of toggle members' values
Toggle Position: toggle position after returning from
call (0 is the first position]
* Must be greater than the declared length.
Locate Cursor (Rav, Column)
INTEGERS Row
IHTEGER*4 Column
Locates the cursor on the screen at tha row and ccluar,
specified. Rows are numbered from 0 to 23 top to bottom,
coluans from 0 to 79 left to right.
New Screen (Screen Number)
INTSSER*4 Screen Number
Sets up a new screen.
Put Characters (Characters, Length, Attribute)
CHARACTER*(*) Characters
INTEGSR*4	Attribute, Length
Puts the character string at "the current cursor position cr.
the screen. (You may specify the string length if you do r.ct
wish to display the entire character string bat this will
require a modification of the subroutine itself.] This
routine uses a BIOS call to put out characters. It is
slower than subroutine PutStr . See Sub-sec-ion 2.4 for
indorsation about attributes.
Put Menu (Menu Name)
CHARACTER* (*} Menu Wane
Displays menu fields. This routine assumes that tha menu
occupies cne horizontal row on the screen.
Put str (Ch, Len, Bov, Col, Att)
CHARACTER*^)
INTEGERS	Len, Row, Col, Att
Places a character string, Ch, of length, Len, at Row, Col
with attribute, Att. This is faster than using Locate Cursor
and Put Characters because it writes directly to video
manor*/ using a C function.
Read Structure (Screen File)
CHARACTER*(*) Screen File
This routine reads the specified Screen Definition File into
memory and initializes all information about the screen and
its variables and attributes. This mus~ be done before
calling any other SAiM routines except for 'Set Up Screen1.
2-14

-------
Reset Scrssn
This routine returns the screen to its initial state (as it
is before the call to Set Up Screen). It deletes the
virtual keyboard, virtual display and the pasteboard.
SCnurnber (Field)	(INTEGER*4 function)
IN7I ~-ZR* 4 Field, Scnumber
Returns the screen number for a given field index.
Set Character Value (Name, Value)
CHARACTER* (*) Name
CHARACTER* (*) Value
Assigns the given value to th.e variable referenced by
'Name'.
Set Floating Point Value (Name, Value 8, Decimals)
CHARACTER*(*) Name
REAL*3	Value 3
INTEGER*4	Decimals
Assigns the double precision value to
referenced by 'Name1 using 'Decimals'
places for display on the screen.
Set 4 Floating Point Value (Name, Value 4,
CHARACTER* (*) Name
REAL*4	Value 4
INTEGER*4	Decimals
Assigns the single precision value to
referenced by 'Name' using 'Decimals'
places for display on the screen.
Set Integer Value (Name, Value)
CHARACTER* (*) Name
INTEGER*4 Value
Assigns the integer value to the variable referenced by
1 Name'.
Set Menu Value (Name, Position, Value)
CHARACTER*(*) Name
INTEGER*4	Position
CHARACTER* (*) Value
Assigns the menu value of t&e menu field referenced by
•Name' and 'Position'. See Sub-section 2.5 for information
about position.
Set Screen (Screen Number)
INTEGER*4 Screen Number
Assigns the number of the screen to be used next.
the variable
number of decimal
Decimals)
the variable
number of decimal
2-15

-------
Set Tcccle Position (Name, Position)
CHARACTER * (*) Naae
INTEGER*4	Position
Sets the position of the named toggle field.
Set Tccgle Value (Name, Position, Value)
CHARACTER * (*) Name
INTEGER*4	Position
CHARACTER* (*) Value
Assigns the value of the toggle field referenced by 'Kane'
and 'Position1. See Sub-section 2.5 for information about
position.
Set Up Screen
Sets up the screen for use. It sets up the virtual keyboard
and the virtual display. This rcutina is an initialising
routine and must be called before any of the other SAM
sera en utility calls are made.
Toggle (Field Name)	(INTEGER*4 function)
CHARACTER* (*) Field Nane
INTEGER*4
Gets toggle value and returns toggle position.
The following routines are used internally by the SAM utilities,
so the names should be avoided by any user-written routines.
Erase Messages (Field)
"Id Index (Name)	(INTEGER*4 function)
Get Line (Screen Fields, Line)	(INTEGER*4 function)
Right Justify (Buffer, Max Length)
Str Len (Line)	(INTEGER*4 function)
Write Fiald (Field, Attribute)
Write Messages (Field)
2-16

-------
2 . 7
SYSTEM VARIA3LES
The follcving SAM utility system variables are available for the
usar. They are listed in alphabetical order. There are other
system variables in the package zha~ are used internally by the
utility and are not intended for the user. They are listed after
the user-available system variables. It is important that the
values of these variables not be changed. Any user-written
routine that includes the SCREEN.STR file. can access the system
variables.
Character	INTEGER*4
Contains the ASCII value of the last character that was
entered from the keyboard.
Current Screen	INTEGER*4
The number of the currently salacted screen. First screen
is 1. Can be set by calling Set Screen.
Debug Screen	L0GICAL*1
Setting Debug Screen to TRUE in your calling program will
generate additional output which will help debug the screen
definition file.
Next Field	INTEGZR*4
The number of the next field to be read. When processing
fields, process while Next Field is less than or equal to
the Number of Input Fields.
Number of Input Fields INTEGER*4
The total number of input fields in the current screen.
Total Number of Screens INT2GER*4
The total number of screens in the Screen Definition File
that were read.
The following variables are used internally by the SAM utilities,
so the names should be avoided by any user-written routines.
Begin Frame()	INTEGER*4 Array
Begin Label{)	INTEGER*4 Array
Begin Screen(}	INTEGER*4 Array
Blink	INTEGER*4	PARAMETER - 4
Block	COMMON ELOCK Name
2-17

-------
Bold
Currant Field
Debug Screen
Er.d Frame [)
End Label ()
Er.d Screen ()
FR Command
FR Type
FR Rowl
FR Columr.l
FR Rov2
FR Columr.2
FR Attribute
Key Continue
Key Error
Key Exit Screen
Key Ignore
Label Fields
LB Pointer
L3 Length
LB Row
L3 Column
LB Attribute
Kain Field
Max Screens
Normal
Record Array()
INTEGER*4
PARAMETER =» 1
INTEGER*4

LCGICAL*1

INTEGER*4
Array
INTEGER*4
Array
INTEGER*4
Array
INTEGER*4
box/line command
INTEGER*4
single/double line
INTEGER*4
top-left row
INTEGER*4
top-left column
INTEGER*4
bottoa-right row
INTEGER*4
bottom-right column
INTEGER*4
attribute for box/line
INTEGER*4
PARAMETER = 3
INTEGER*4
PARAMETER = 0
INTEGER*4
PARAMETER = 2
INTEGER*4
PARAMETER = 1
INTEGER*4

INTEGER*4
Pointer for label
INTEGER*4
Length for label
INTEGER*4
Row for label
INTEGER*4
Column for label
INTEGER*4
Attribute for label
INTEGER*4
Kain menu field
INTEGER*4
PARAMETER - 10
INTEGER*4
PARAMETER =» 0
CHARACTER
Used vith Record
2-13

-------
Record
CHARACTER*2 5 5
Equivaienced with Record
Array
Record Le-gth
INTEGER*4
PARAMETER = 1QQQQ
Reverse
INTEGER*4
PARAMETER = 2
SC Dimension
INTEGER*4
PARAMETER - 500
SC Field Name
CHARACTER*10
Field Name array
SC Pointer
INTEGER*4
Pointer into Record
SC Length
INTEGER*4
Length of field
SC Row
INTEGER*4
Raw of field
SC Column
INTEGER*4
Column of field
SC Attribute
INTEGER*4
Attribute of field
SC Chosen Attribute
INTEGER*4
Attribute of field when
chosen
SC Field Type
INTEGER*4
Type of field
SC Next
INTEGER*4
1 if it goes to the next
field when the field :
filled, 0 otherwise
SC Carriage Return
INTEGER*4
Relative field for CR
SC Up
INTEGER*4
Rel field for Up arrow
SC Down
INTEGER*4
Rel field for Down arrow
SC Left
INTEGER*4
Rel field for Left arrow
SC Right
INTEGER*4
Rel field for Right arrow
SC Members
INTEGER*4
# of members for menu
SC Position
INTEGER*4
Position for sub-menu
SC Message
INTEGER*4
# of message for field
SC M Pointer
INTEGER*4
Pointer for Message
SC M Length
INTEGER*4
Length of each message
Starting Field(}
INTEGER*4 Array
Underline
INTEGER*4
PARAMETER - 8

-------
2.3	KEY CHUCK RCITTIME
This routine can b« used by yaur applications program to trap
keystrokes.
The source cede for the routine is one of the files in the systas
diskatta so that you- can add to it or create your own keystroke
trapping routine that vill work vith the SAM Utilities. Yau -;.ust
a.d<± the following stateaent to any of your routines that make use
of KTYCS2CX:
5INCLUDE: 'KEYCHECX.INC1
2-20

-------
2.9
HLOCXDAT UTILITY
aiOCKEA^.EXS is a program to ccnvert a scrssn definition file into
a Slccfc data subprogram. When a program is under development,
the screen definition file contains the description of screen ar.d
aenu fields. It is accessed through a call to Read Structure.
aLOCKDAT.IXS is used after the user interface has beea debugged,
It elisiratss the . SCE file and aliens the user interface
caranetsrs to be ecnpiled into the executable.
To "Ass type \SC32EN\BL0CKDAT at the DOS prompt/ you will be
prompted for the name of the .SCR file, and the name of the
FORTRAN output file.
2-21

-------
SECTION 3 - EXAMPLES
3.1	BASIC EXAMPLE
The following code represents a minimum usage of the SAM
utilities. First, the source code is shewn (MINIMUM.FOR), then
the Screen Definition File (MINIMUM.SCR).
PROGRAM Minimum
$ INCLUDE: 'SCREEN.STR1
CALL Read Structure ('MINIMUM.SCR1)
CALL Clear Screen
CALL Set Screen (1)
CALL Display Frame
CALL Display Labels
CALL Display Fields
10	IF (Next Field . LE. Number of Input Fields) THEN
CALL Get Field
GO TO 10
ENDIF
¦croutine to process data>
CALL Clear Screen
STO?
END
C This is MINIMUM.SCR - A Screen Definition File
c Following is the starting input field name
c
IFIELD
C	
C	Len Row Col At CA Typ Nx CR Up Dn Lf Rt Mem Pos Kes
IFIELD	10, 5, 15,0,2,0, 0, 1, 0, 0, 0, 0, 1, 0, 1
21,03,0,Show this message;
END (of input fields)
		
C Screen Label definitions
c
CRow Col Md Label
C	,				
5, 5, 0, Label
END (of label fields)
		
C Screen frame section
C
3-1

-------
C Typ Rev Col Row Col At
C	,	,	,	,	,	
BOX 1, 0, 29, 2, 49, 0
END (of frame fields)
ENDFILZ

-------
3 . 2	ADVANCED EXAMPLE
The files EXAMPLE, FOR and EXAMPLE. SCR should have been copied
into your directory when you copied the SAM utilities. If not
refer to Section 2.1 for instructions on where to find these
files.
This exanple is the user interface for a program that produces
scatter plots. It demonstrates several features of the utility:
how to use menus, how to input and retrieve data from the screen
fields and hew to perform error checking.
Attached is a listing of the EXAMPLE.FOR and EXAMPLE.SCR files.
Note the routine to actually produce a scatter plot is not
included.
3-3

-------
Icntsnts.dcc - a listing of files and ccntant3 for \geoeas\scraen
\SM\*. * - assembler subdirectory - ASM rcutir.es (and c cbjects)
called from levlevel
LZ\*. * ~ Example subdirectory - Source files fcr IXAMPLI. IXZ
.SAT files:	f	-	batch file for compiling a single source file
c-mnil	—	"""""""""""i'11"""11"""'|"'i"'| all filas
maklib	-	»»»"•"""•»			 building the library
printall	- »»«>•»"»»••••'•<>»¦"• printing the source
DOC files:	contents - this file
files - a listing of source file contents
EXE files:	blockdat - program to. convert screen definition file
into a block data subprogram. When a program
is under development, the screen definition
file contains the descipticn of screen and menu
fields. It is accessed through a call to
Read Structure (in screen!. for) . 31ockdat.exe
is used after the user interface has
been debugged. It eliminates the .SCR file
and allows the user interface parameters to
be 'locked in' (compiled into) the executable.
FOR files:	added - routines added for use by GeoEAS programs
blcckdat - source for BLOCXDAT.EXE (dascibed above)
keycheck - key validation routine which may be
customized for special key processing. It
has been reduced to a 'do-nothing' routine
and compiled into the screen library,
lcwlevel - lowlevel (machine-dependant) routines
screenl - upper level routines - file 1
screen2 - upper level routines - file 2
INC files:	keycheck - include file for keycheck routine
LI3 files:	screene - library [compiled for /Fpc (coprocessor
emulation), /HA (huge mcdel, $LARGE) code]
STR files: screen - global screen variables (include file)
MAX files:	screen - MAKE command file for re-building the
screen utilities library,
blockdat - MAKE command file for compiling BLOCXDAT.EXE

-------
A:\SCRIIN>lf
.?•" files:
files:
.Ea^ files:
•FOR files:
• INC files:
•LIB files:
.M-AX files:
.STR files:
A:\SCRZZN>cd asa
A:\SCRZZN\ASM>lf
ccmpil
contents
blockdat
added
kaycheck
screene
blockdat
screen
.ASM files:
,C
, DOC
, INT
.OBJ
files:
files:
files:
files:
putcur
putvmen
asa
putvaea
gatcha
sataod
f
files
maklib printall
blockdat keycheck lowlevel screenl scraer.2
screen
getcha
putvch
getshf
sound
¦ga^pjn
setaod
«cr*3ei.*
getshf
sound
putcur
-kJodslj
putvch
putvaen
A:\SCR£ZN\ASM>

-------
ASM.DCC : nachir.e-dependent routines used by the SAM utilities.
The following is a description of the assembly language routines
used by the PC Screen Attribute Management (SAM) Utilities.
These routines isa!
-------
SUBROUTINE FUTCUR - put video cursor at page, rov, colur.n
INTSGE?.*2	PAGE, ROW, COL
PAGE - vid^o paga
RCW - cursor raw
COL - cursor coluan
CALL PUT CUR (PAGE, ROM, COL*
TITLE	PUTCUR
NAME	PUTCUR.asm
PUTCUR_TEXT	SEGMENT BYTE PUBLIC 'CODE'
PUT CUR_T EXT	ENDS
_DATA	SEGMENT HORD PUBLIC 'DATA'
_OATA	ZNtiS
CONST	SEGMENT WORD PUBLIC 'CONST'
CONST	ENDS
_3SS	SEGMENT WORD PUBLIC 'ESS'
_5SS	ENDS
CGRCUP	GROUP CONST, _BSS/ DATA
ASSUME	CS: PUTCUR_TSXT, DS; GGROCP, SS: CGROUP, ES: DGROUP
?UTCUR_TEXT	SEGMENT
t
PUBLIC	PUTCUR
FUTCUR PP.OC FAR
push	bp
ecv	bp, sp
/
ncv	aia, 02
"
les	bx, fbp+S]
i!cv	dl, es:[bx]
?
lag	bx, [bp+10]
ncv	dh, easlbx]
las	bx, [bp+14]_
mcv	ch, ea:[bxj
ncv	bh, cb
f
int	16
/
pep	bp
rat	12
PUTCUR ENDP
PUT CUR_TEXT	ENDS
END
2

-------
3.	SUBROUTINE PUTVCH - put a character out at the current cursor
position.
INTEGER*2	PAGE, CHAR, ATT, NC
PAGE - video page
CHAR - ascii character code
ATT - video attribute (see reference)
NC - number of characters
CALL PUTVCH (PAGE, CHAR, ATT, NC)
TITLE	PUTVCH
NAME	PUTVCH.asm
?UTVCK_TIXT	SEGMENT BYTE PUBLIC 'CODE'
?UTVCH_TIXT	ENDS
_DATA	SEGMENT WORD PUBLIC 'DATA'
_DATA	ENDS
CONST	SEGMENT WORD PUBLIC 'CONST'
CONST	ENDS
_BSS	SEGMENT WORD PUBLIC ' BSS»
_3SS	ENDS
DGRCUP	GROUP CONST, _BS3, DATA
ASSUME	CS: PUTVCH_TEXT, DS: DGROUP, SS: DGROUP, ES: DGROU?
?UTVCH_TZXT	SEGMENT
PUBLIC	FUTVCH
PUTVCH PP.OC FAR
push	bp
aov	bp,sp
eov	ah, 09
7
las	bx, [bp+6]
ecv	cx, es:[bx]
t
les	bx, [bp+10]
ecv	dl, es:[bx]
les	bx, [bp+14]
ncv	al, es:[bx]
Iss	bx, [bp+18]
ecv	dh, es:[bxj
/
nov	bx, dx
$
1ST	16
/
pep	bp
ret	16
PUTVCH ENDP
PUTVCH_TEXT	ENDS
END
3

-------
4 -	SUBROUTINE GETCHA - Get a character from the keyboard
::j7Sge?.*2
SCAN, KEY
SCAN - Scan Cede for keyboard
KEY""- ascii character code
GZTCHA
GETCHA
_DATA '
_DATA
CONST
CONST
_SSS
_3SS
DGROU?
GZTCHA TEXT
- nota: the routine will wait far a single keystroka
CALL GZTCHA (SCAN, KEY)
TITLE GETCHA
NAME GETCHA.asm
TEXT	SEGMENT BYTE PUBLIC 'CODE'
"text ends
SEGMENT WORD PUBLIC 'DATA'
ENDS
segment word public 'const*
ENDS
SEGMENT WORD PUBLIC 'BSS'
ENDS
GRCU? CONST, _ESS, DATA
ASouMZ CS: GETCHA_TEXT, DS: DGRCUP, SS: DGROUP, ES: DGr.CU?
'-vm	SEGMENT
PU3LIC GETCHA
GZTCHA PROC r AS
push bp
GETCHA
GETCHA
END
¦acv
BCV
ir.t
las
acv
las
acv
acv
pep
rat
ENDP
TEXT
bp, sp
ah, 00
22
bx, [bp+6]
es:[bx], al
bx, [bp+10]
es:[bx], ah
sp, bp
bp
8
ENDS
4

-------
5 •	SU2R0UTIMZ SOUND — pu~ cut a tone through the soeaker
INTZGER*2	FREQ, DURAT
FRZQ - frequency of tone (MUST BZ >= 10)
DtJRAT - duration (dependant on processor)
CALL SOUND (FRZQ, DURAT)
3I0S_DATA SEGMENT AT 4OH
ORG 6CH
TIMER_LCW LABEL WORD
BIOS DATA ENDS
TITLE	SOUND
NAME	SOUND.asm
SCUNDJTZXT	SEGMENT BYTE PUBLIC 'CODE'
SOUND_TZXT	ENDS
_DATA	SEGMENT WORD PUBLIC 'DATA'
_DATA	ENDS
CONST	SEGMENT WORD PUBLIC 'CONST'
CONST	ENDS
_3SS	SEGMENT WORD PUBLIC 'BSS'
_BSS	ENDS
DGROU?	GROUP CONST, _BSS, _DATA
ASSUME	CS: SCUND_TEXT, DS: DGROU?, SS: DGROU?, ES: DGROU?
SOUND_TEXT	SEGMENT
7
PUBLIC	SOUND
SOUND FROC FAH
push	bp
ncv	bp,sp
push	si
push	di
push	ds
bx, [bp+10]
cx, es:[bx]
Sio:
les
mcv
CM? CX,0
JE SIO
MOV DX,12H
MOV AX,34DCH
DIV CX
PUSH AX
CALL SPEAKERON
FOP AX
les bx, [bp+6]
nov	cx, es:[bx]
CM? CX,0
JI S30
MOV AX,5I0S_DATA
MCV DS,AX
ASSUME DS:3I0S DATA'
Get Frequency
(first argument - lowest on stack)
IF FREQUENCY IS 0 -> REST
DON'T TOUCH SPEAKER AND COUNT DELAY
PASS PARAMETER TO SUBROUTINE CALLED
CLEAR STACK OF PARAMETER
Get Duration
(last arguaent)
I? 0 DURATION, TURN OFF SPEAKER &
SET UP DATA SEGMENT TO BIOS FCR ADD
5

-------
S20:
S3 0:
MCV AX,TIMER_LOW
CM? AX j TIMER_LOW
JE S2Q
INC AX
LCOP 32 0
push c:<
C.UL SPZAXERON
POP cx
; DONE, RETURN si, di, bp
pep	da
; WAIT UNTIL TIMER COUNTER 13
/INCREMENTED => ONE TICK
; LOOP UNTIL ONE TICK
; INC TIMER TICK TOR NEXT LOC? I-~
/LOOP FOR CX TICKS	"*
; COUNTER = 0 EITHER FROM COUNTDOWN C-
;S2 0 LOO? OR PASSED PARAMETER. FASS""
;PARAMETER TO TURN Or? SPEAKER
SOUND
pep
pep
pep
rat
ZNDP
di
si
bo
a*
THIS SUBROUTINE EITHER TURKS THE SPEAKER ON OR OFF. TO TURN
IT CN, IT IS PASSED A FREQUENCY DIVISOR WHICH IS PASSED
TO THE SYSTEM TIMER TO CONTROL THE SPEAKER.
IT IS CAIiED AS FOLLOWS:
SPEAKERON(7REQ DT7) f
WHERE:
UNSIGNED FRZQ DIV; - DIVISOR TO PLACE IN
SYSTEM TIMER TO BE USED TO CONTROL SPEAKER
SPZAKERON	PROC NEAR
PUSH B?	; STANDARD SETUP
HOV BP, S?
IN AL,61H	,'GZT CURRENT PORT SETTING
AND AL, OFCH	;SETTING TO TURK OFF SPEAKER
OUT 6 IK, AL	;TURN OFF SPEAKER
MOV AL,101101108
CUT 43H,AL
i GET FREQUENCY DIVISOR
;IS IT - 0?
;I? YES, JUST EXIT
,* OUTPUT LOW ORDER BYTE TO PORT FIRST
;PREPARE KICK ORDER BYTE FOR OUT INSTRUCTION
; OUTPUT HIGH ORDER BTTE TO TIMER PORT
; GET CURRENT PORT SETTING
;TURN ON TWO LOW ORDER BITS FOR SPEAKER ON
; UNDER CONTROL OF TIMER PORT
;TURN SPEAKER ON
KOV AX,[3F+4]
CMP AX, 0
JE SP10
OUT 4 2H,AL
MCV AL,AH
OUT 42H,AL
IN AL,61H
OR AL,3
SP10:
OUT 61H,AL
POP BP
RET
SPEAKERON ENDP
SOUND_TEXT
END
ENDS
6

-------
SUBROUTINE PRTSCR - causes the text screen ts be sent tc L
ncte - the printer must be online and. ready
CALL PRTSCR
TITLE	PRTSCR
NAME	PRTSCR. asm
PRTSCRJTEXT	SEGMENT BYTE PUBLIC 'CODE'
PRTSCRJTEXT	ENDS
_DATA	SEGMENT WORD PUBLIC 'DATA'
_DATA	ENDS
CONST	SEGMENT WORD PUBLIC 'CONST'
CONST	ENDS
_3SS	SEGMENT WORD PUBLIC 'BSS'
_BSS	ENDS
DGROUP	GROUP CONST, _BSS, _DATA
ASSUME	CS: PRTSCR TEXT, DS: DGROUP, SS: DGROUP, ES:
PRTSCRJTEXT	SEGMENT
PUBLIC	PRTSCR
PRTSCR FROC FAR
push	bp
nov	bp,sp
; CALL PRINT SCREEN INTERRUPT
7
INT	05
7
mov	sp, bp
pep	bp
ret
PRTSCR ENDP
PRTS CRJTEXT	ENDS
END

-------
7. INTE3IR*2 ~JNCTION PutVmem. (String, Nchars, Rom, Col, Attr)
- puts a character string directly to video memory
String -	character string to put on screen
Nc^.ars -	the number of characters to usa in string
Rev -	the starting row position (0-24)
Col -	the starting column position (0-79)
Attr -	the videp attribute (see Norton text)
Example Call:
C INTERFACE STATEMENTS (Must be in caller's FORTRAN Source]
interface to ir.tager*2 function cutVuiam[C]
1	(strpreference] ,r.chars,row,
1	col,attr)
character*30 str
integer*2 nchars,row,col
integer*! attr
end
CHARACTER String*
INTEGER*2 Return Code, Nchars, Row, Col, Attr
Return Cade =¦ PUT/MEM (String, Nchars, Row, Col, Attr)
nets - if Nchars -r Col > 79, the remaining portion of the string
will be wrapped around to successive screen rows.
char far *cga buf «¦ (char far *)0xb8000000;
char far *:nono_buf ¦ (char far *) OxbOOOOOOO;
char far *mem_aicde =» (char far *)0x00400049;
putvmem(str, nchar3, row, col, attr)
char str[];
int nchar3;
int row;
int col;
char attr;
(
ir.t i;
char far *p;.
if (*Taea_mode I* 7) —
p =¦ (cga_buf + (row * 160) + col*2);
else
p - (mono_buf + (row * 160) + col*2) ;
for (i=0;i
-------
SUBROUTINE Read Structure (Screen File)
CALL. Get Kay (Character)
S OUTINE Get -laid
CALL Get Kay (Character)
CALL Write Field (Current Field, Attribute)
CALL Writa Messages (Current Field)
CALL Lccata Cursor (Rev, Column)
CALL Put Charactars (CHAR (Character) , 1, Attribute)
CALL Beep
CALL Right Justify (Buffer, Max Length).
CALL Erase Messages (Current Field)
CALL Put Str (Buffer (2:Max Length), Max Length - 1,
SUBROUTINE Righc Justify (3uffer, Max Length)
SUBROUTINE Set Screen (Screen Number)
SUBROUTINE	Disolav Labels
CALL PutStr (
-r	Record (L3 Pointer (i) :
-	L3 Pointer (i) + LB Length (i) - 1) ,
-	L3 Length (i) ,
+	L3 Row (i), LB Column (i),
-	LB Attribute (i))
SUBROUTINE Diselay Fields
CALL Write Field (i, SC Attribute (i))
S .OUTINS Display One Field (Field Name)
CALL Writa Field (i, SC Attribute (i))
SUBROUTINE Clear Fields
scraen2.for Subroutines:
SUBROUTINE Set Character Value (Name, Value)
SUBROUTINE Get Character Value (Name, Value)
SUBROUTINE Set Integer Value (Name, Value)
SUBROUTINE Get Integer Value (Name, Value)
SUBROUTINE Set Floating Point Value (Name, Value 8, Decimals)
SUBROUTINE Get Floating Point Value (Name, Value 8)
SUBROUTINE Set Toggle Value (Name, Position, Value)
SUBROUTINE Get Toggle Value (Name, Position, Value)
SUBROUTINE Set Mer.u Value (Name, Position, Value)
Sl/^.CUTINE Get Mer.u Value (Name, Position, Value)
SUBROUTINE Write Field (Field, Attribute)

-------
CALL	Locate Cursor (SC Raw (Field), SC Column (Field))
CALL PutStr (
-	Record (Pointer :
+	Pointer + SC Length (Field) - 1),
+	SC Length (Field) ,
+	SC ?.cv (Field), SC Column (Field),
+	Att)
SUBROUTINE Write Messages (Field)
CALL Pu-Str (Record • (Pointer+3 : Pointer+Length-1) ,
+	Length-3,
+	Row, Column, Attribute)
SUBROUTINE Erase Messages (Field)
CALL Erase (Rev, Column, Length - 3)
lowlevel.for Subroutines:
INTERFACE STATEMENT FOR C FUNCTION Put Vine a
interface to irvteger*2 function putvmem[C]
1	(str[reference],nchars, rcw,
1	col,attr)
characterise str
integer*2 nchars,row,col
integer*! attr
end
SUBROUTINE Display Frame
CALL Draw*Line (Matrix, Attribute, i,
+	FR Rowl(i), FR Columnl(i),
+	FR Row2(i), FR Column2(i))
SUBROUTINE Draw Line (Matrix, Attributa, f,
+	Rowl, Columnl, Row2, Column2)
CALL Draw Char (Matrix, Attribute,
+	Rowl, Columnl, 1, Line Type, att)
SUBROUTINE Draw Char (Matrix, Attribute,
+	rcw, col, ch, Line Type, att)
CALL PutStr (Box Chars (Matrix (row, col)),
+	1, Row, Col, Attribute (row, col))
SUBROUTINE Clear Screen
CALL SETMCD (HFIX(3))
SUBROUTINE Get Key (Character)
CALL GETCHA (Scan, Ascii)
SUBROUTINE Locate Cursor (Row, Column)
CALL PUT CUR (HJIX (0), HFIX (Row), HFIX (Column))
SUBROUTINE Put Characters (Characters, Nchar, Attribute)
CALL FUTVCH (INT2 (0), INT2 (Ch) , I NT 2 (Att), INT2 (1))
SUBROUTINE Beep
CALL SOUND (INT2 (20), INT2 (10))
SUBROUTINE Set Up Screen

-------
cevcheck. for Subroutines :
INTEGER*4 FUNCTION" Key Check (Dummy)
added.for Subroutines:
INTZGZ?.*4 FUNCTION LanStr (String)
SUBROUTINE Erase (Row, Column, N)
CALL PutStr (Blanks, N, Row, Column, 0)
SUBROUTINE FLASH (Row, Column, Message)
CALL PutStr (Message, LEN (Message) , Row, Column, 2)
CALL Gat Kay (Key)
CALL Erasa (Rcw, Column, LEN(Message))
SUBROUTINE Get Mer.u choice (Menu Name, Menu Choice)
CALL Gatfiald
CALL Gat Xar.u Value (Menu Name, Position, Menu Choice)
SUBROUTINE Put Mer.u (Menu Name)
CALL Erasa (22, 1, 73)
CALL Erasa (23 , 1, 78)
CALL Writa Field (Field, SC Attribute(Field))
SUBROUTINE Left Justify (String)
L' TAL*I FUNCTION Get Yes No (Row, Column, Prompt)
CALL PutStr (Promtst, LEN (Prompt) , Row, Column, 0)
CALL Gat Kay (Key)
CALL Erase (Rcw, Column, LEN (Prompt))
INTEGER*4 FUNCTION Toggle (Field Name)
CALL Get Field
CALL Gat Toggle Value (Field Name, Position, Dummy)
SUBROUTINE Load Toggle Values (Name, Length, Member Total,
CALL Set Toggle Value (Name, Position, Value (l:Langth))
SUBROUTINE Put Str (Ch, Len, Row, Col, Att)
Return Code =¦
+	PutVmem (Ch, INT2 (Len), INT2 (Row), INT2 (Col), A)
CNTEGER*4 FUNCTION SCnuiaber (Field)
SUBROUTINE Set Toggle Position (Name, Position)
SUBROUTINE Erase Field (Name)
CALL Erase (SC Row (Field), SC Column (Field),
+	SC Length (Field))
SUBROUTINE Set Mer.u Position (Name, Position)
SI iUTINE Build rile Name (Nam.el, File Name, Extension)
SUBROUTINE Get Fila Name (File Name, File Prefix,
CALL Left Justify (File)

-------
;U3R0UTi:rS Blank rile (Field Name, File Name)
CALL Set Character Value (Field Name, File Name)

-------
Cor.tants.doc - a listing of files ar.d csr.-snts fcr \scrasn\axampla
.BAT files:	f	- batch file for compiling a single source file
.fMN files:	exaaple - global variable declarations
	T files:	example - data file
.DOC files:	content - this file
.EXZ files:	example - executable for example
.FOR files:	exaaple - FORTRAN source file
. LNK files:	example - linker response file for linking example
.MAX files:	example - MAXZ command file to build example.exe
•SCR files:	exaaple - screen definition file

-------
c	
C SCAT"!I?, scrasr. definition file
c
C First screen
_NT?.CMI?ru
c	
C Ir.*r3
C	
c
c	
INTP.OMINU 0^ aj Q, 2, Q, 3, a,
EMC (of intra scraen label fields)
C	
C Screen Label definitions
c
C Sew col Hd Lacal
Ker.u grrup
Len 5cw Col At CA Typ tfx CR Up Dn Lf Rt Hem Pes Mes
"" / '
0,
0, 0, 0, 0, 0, 0,
nam scraen
SCATTER (Version 1.0) -Introduction;
SCATTER will produce scatter plots of variables frem a;
Gec-ZAS (Geostatistical Environmental Assessment Software)
(For more information, refer to the Geo-EAS reference mar
-	A log option provides log and semi-log plots.;
-	A regression option provides a regression line and coefficients
-	Scaling and nuneric tiefcnark. labeling is computed automatical"-'.
-	A hardcopy of the plot may be obtained on a dot matrix pr"
0,
12,
2,
2,
2,
o,
3,
2,
0,
4,
2,
0,
s,
2,
0,
a,
2,
0,
10,
2,
0,
12,
2,
0,
15,
2,
0,
is,
2,
0,
17,
2,
0,
3,
2,
0,
Thi
.nte
s software was developed for the U.S. EPA Environmental Mc
Corrc
of
outa
Systems Laboratory in Las Vegas, Nv. by Computer Sciences
in cooperation with the Applied Earth Sciences department
University. It i3 in the PUBLIC DOMAIN and may be distri
(of intro scraen label fields)
C Screen fraae section
c
C Typ Row Col Rev Col At
BOX 2, 0, 0, 21, 79, 0
LINE 2,	19, 0, 19, 79, 0
LINE L,	14, 0, 14, 79, 0
END (of	intro frartes section)
Len Row Col At CA Typ Nx CR Up Dn Lf Rt Mem Pos Mes
0,
1/
6,
1,
1,
0,
0
5,
C Second scraen -aain
C
MAINMSNU
C	
C
c	
KAZNMSNU 0 \ q] o't 2, 0] 3* o] o'r 0, o] 0,
MZ PRZFIX 6, 22, 2, 0, 2, 4, 0, 6, 0, 0, 5,
23, 2,0,Specify the file prefix
11,42,0,	Prefix
13,42,0, Use this option to enter a prefix
14,42,0, which is used to build file nanes
15,4 2,0, used by the program.
ivr" FILE	4, 22, 10, 0, 2, 4, 0, 6, 0, 0, -1,
23, 2,0,Specify the input data file
11,42,0,	Data
13,42,0, Use this option to specify the
14,42,0, Data File Name.
Prefi*
1, 1, 0, 4, Ca-.2

-------
MZ
VAP.

S, 22, 16, 0, 2, 4, 0, S, 0, 0, -i, 1,
1,
o,
6,
Va:


23
2,0, Select variables






10
42,0, Variables ;






12
4 2,0, Use this option to specify the ;






13
42,0, variable to be used for the X ar.d ;






14
42,0, Y coordinates and the variable to ;






15
42,0, post.




MI
OPT

7, 22, 27, 0, 2, 4, 0, 9, 0, 0, -i, 1,
1,
0,
6,
°?


23
2,0, Select options ;






10
4 2,0, ' Options ;






12
42,0, Use this option to specify that ;






13
4 2,0, linear regression be calculate, ;






14
42,0, and to allow for true scaling. ;






15
4 2,0, alor.g with the correlation ;




MZ
zxzc

7, 22, 36, 0, 2, 4, 0,999, 0, 0, -1, 1,
1,
0,
4,
Ex


23
2,0,Generate the plot ;






11
4 2,0, Execute ;






13
4 2,0, Use this option to create the ;






14
4 2,0, plot. -- ;




MZ
QUIT

4, 22, 45, 0, 2, 4, 0,-53, 0, 0, -1, -5,
1,
0,
3,
Qu


23
2,0,Exit the program ;






11
4 2,0, Quit






13
42,0,Use this option to exit the program;




C File Prefix
		
C	Len ?.ov Col At CA Typ Nx CR Up Dn Lf Rt Mem Pos Mes
C																
t	f	I	I	f ! f	t	I	I	t	f	t	f
PREFIX	50, 4, 15, 0, 2, 0, 0, -6, 0, 0, 0, 1, 1, 0, 9
20, 2,0,Enter the file prefix
10,42,0,	This character string is used to
11,42,0,	build a file name for accessing
12,42,0,	or creating files. Anything can
13,4 2,0,	be entered here, but if it does not
14,42,0,	help to form a valid file name cr
15,42,0,	directory, you will see an error
16,42,0,	message when the file is accessed.
13,4 2,0, (Press the  key to exit)
Data File name
Len Row Col At CA Typ
Nx
CR
Up Dn Lf
Rt Mem Pos Mes
DATA FILE 14, 6, 14, 0, 2, 0,
20, 2,0,Enter the name
t
o,
of
t
'1,
the
iii
0, 0, 0,
data file
1 H
1 O
1 H
1 H
: Variable Selection
Len Row Col At CA Typ
NX
CR
Up Dn Lf
Rt Mem Pos Mes
i i i i i i
9
9
t 9 t
9 9 9
XVARIABLE lo', ll' is' o', 2, 5^ Q, 1, o', 2, 0, l) 48^ o' 1
20, 2,0,Select the X variable (use  bar) ?
X LOG	3, 11, 34, 0, 2, 5, 0, 1, 0, 2, -1, 0, 2, 1, 1
On , Off
20, 2,0,Indicate whether to perform legging (use  bar);
V	'IABLE 10, 12, 16, 0, 2, 5, 0, 1, -2,-11, 0, 1, 43, 0, 1
ii>>i
20, 2,0,Select the Y ccordi.-.ate variable (use  bar) ;
Y	LOG	3, 12, 34, 0, 2, 5, 0,-12, -2,-12, -1, 0, 2, 1, 1

-------
Cn , Cff
20, 2,0, Indicate whether to perform lcccing (use  bar) ;
___ _ 	__ __ _ _ _
v.									 		—						—			 	 	
C Regression cp-icn
r	'	*	
Ler. ?.cv Col At CA Typ Nx CR Up Dn Lf Rt Mem Pog Hes
RZGRZSS	3, 17, 13, 0, 2, 5, 0, 1, 0, 1, 0, 0, 2, 1, 1
No, Yes
20, 2,0, Indicate whether to include regression (use  bar)
c			1	
C True Scale
		
C	Lan Rev Col At CA Typ Nx CR Up
C	
TSCALZ
Dn Lf Rt Mem Pos Mes
0, o, 2, 0,
»	>	f t ) i t r	9 t
3, 13, 13, 0, 2, 5, 0,-14, -1,-14,
No, Yas
20, 2,0, Indicate whether plot in true scaling (use  ba:
END (of raain screen label fields)
C	
C Screen Label definitions - main screen
C
C Raw Col Md Label
C-
/
0,
27,
t
2,
SCATTER (1.
2,
17,
o,
A prograa for produc
4,
2,
o,
File Prefix:;
6,
2 ,
0,
Data Pile: ;
6,
41,
0,
# Data records :;
" ,
41,
0,
# Missing data :?

2 ,
0,
Variables ;
*r
2 ,
0,
X Variable :;
ii,
23,
0,
Leg : :
12,
2,
0,
Y Variable :;
12,
23 ,
0,
Leg : ;
15,
2 ,
0,
Options ;
17,
2 ,
0,
Regression :;
13,
2,
0,
Equal Scaling :;
END (of siain scraen label fields)
C	
c Screen frame section
C
C Typ Row Cal Rev Col At
C-————, — ~t •••,
0,
EOX 2,
LINE 2,	19,
LINE 1,	5,
LINE 1,	8,
LINE 1,	14,
0,	21,	79,
0,	19,	79,
0,	5,	79,
0,	8,	79,
0,	14,	39,
0
0
0
0
0
LINZ 1, 5, 39, 19, 39, 0
END (of main frames section)
ENDFILE

-------
' 1GE
L „****** + ***«*¦»»*********************************¦»*********•****
c + "* File Nase: EXAMPLE. FOR (Source code fcr the program EXAMPLE)
PROGRAM EXAMPLE
$INCLUDE: 1 EXAMPLE.can'
$INCLUDE:'SCREEN.STR'
CHARACTER*1 Answer
LOGICAL Exists
INQUIRE (FILE = ' EXAMPLE. SCR' , EXIST = Exists)
IF (.NOT. Exists) THEN
CALL Clear Screen
WRITE (*, 10)
CALL FLASK (20, 2, 'Press any key to continue ... ')
ELSE
CALL Clear Screen
WRITE (*,*) 'Do you wish to DE3UG the screen definition'//
+	'file (Y/N) ?'
READ (*,•(Al) ') Answer
IF (Answer .EQ. 'Y' .OR. Answer .EQ. *y1) THEN
Debug Screen = .TRUE.
ENDIF
CALL Read Structure (' EXAMPLE. SCR')
CALL Clear Screen
CALL Set Up Screen
CALL Intro Screen
CALL Initialize
CALL Gat Screen Fid
CALL Clear Screen
ENDIF
10	FORMAT (' EXAMPLE cannot operata without the file EXAMPLE.SCR
+ /,/, ' This file could-not be located in the default ',
+ /,	' directory. Please copy this file into the current',
+ /,	' directory and try again.',//)
END
C****** ************************************************** *************
C SUBROUTINE DISPLAY FLDS
C
c This routine displays the current screen fields,
c
SUBROUTINE Display Fids
IMPLICIT INTEGER*4 (A-Z)
$7 UDE:'screen.str'
INTEGERS Main Menu Field, Menu Field
PARAMETER (Main Menu Field = 3)
PARAMETER (Menu Field	= 4)

-------
+	End Screen (Current Screen)
I? (SC Field Type (i) .NE. Main Menu Field .AND.
+	SC Field Type (i) .NE. Menu Field)
+	CALL Write rield (i, SC Attribute (i))
IP	CONTINUE
RETURN
end
c* ******************************************************** *********
C SUBROUTINE ERASE MESSAGE
C
C This routine erases messages displayed in the message area of the
C screen.
r
SUBROUTINE Erase Message
IMPLICIT INTEGER*4 (A-Z)
DO 10 RCW = 9,13
CALL Erase (ROM,42,35)
10 CONTINUE
RETURN
END
2 SUBROUTINE GET FIELD GROUP
: . is routine gets the value for a group of screen fields.
SUBROUTINE Get Field Group
IMPLICIT INTEGER*4 (A-Z)
PARAMETER (Main Menu Field - 3)
PARAMETER (Menu Field	- 4)
$INCLUDE:1 screen.str'
10	CALL Get Field
IF (SC Field Tvoe (Next Field) .NE. Main Menu Field .AND.
+	SC Field Type (Next Field) .NE. Menu Field) GOTO 10
RETURN
END
2	SUBROUTINE GET NEW SCREEN (SCREEN NUMBER)
Z	Formal Arguments:
- SCREEN NUM3ER - Stores the screen number.
Z	This routine sets the current screen to screen mirier and then displays
Z	t' frame and labels for that screen.
SU3ROUTINE Get New Screen (Screen Number)

-------
IMPLICIT INTEGZRM (A-Z)
INTZGZR*-; Screen Number
CALL Clear Screen
CALL Set Screen (Screen number)
CALL Display Frame
CALL Display Labels
P. Z TURN
END
C************ a*************************************.******************
C SU3R0UTINZ GET SCREEN FLD
C
C Local Variable:
C Main Scraen - stores the screen number for the main screen.
C Main Menu	- Stores the name of the main menu.
C Menu Chcica - Stores the user's menu selection.
c Exit	- Logical variable that is set to true when the user
C	wants to exit the program.
C
C This routine displays the screen, accesses the =; zenu option
C selected by the user and then call3 Perform Process to process
C the screen fields or calls a routine to process the menu ootion.
C
SUBROUTINE Gat Screen Fid
IMPLICIT INTEGER*4 (A-Z)
$t"^lUDE: ' SCREEN. STR'
$ LUDE: 'EXAMPLE. OOP
INTEGER*4
CHARACTER*10
CHARACTER*12
LOGICAL*!
Main Screen
Main Menu
Menu Choice
GetYesNo, Exit
DATA Main Menu / 'MAINMENU •/
DATA Main Screen /2/
Regression » .TRUE.
True Scale = .FALSE.
C *** Display main menu
CALL Get New Screen (Main Screen)
10	CALL Put Menu (Main Menu)
CALL Display One Field ('PREFIX ')
CALL Get Menu Choice (Main Menu, Menu Choice)
C *** Quit - main menu
IF (Menu Choice .EQ. 'Quit	') THEN
Exit = GetYesNo (20, 2, 'Do you really war.t to QUIT?  ')
IF (Exit) THEN
CALL Clear Screen
RETURN
ELSZ
GOTO 10

-------
1 Data	' t
( 'DATA nLZ ')
; *** Prefix - main menu
ZL52 I; (Kanu Che tee ,feQ. 'Prefix	'J THSJf
CALL ?«rfcr"a Process
GOTO 1£
1 ~" Exacute - r.ain menu
ZLSl XT (Kenu Chcics . EQ. 'Execute	TKEH
1? (JTvar .EQ. 0 .03* Ndata .EQ. OJ TESIf
CALX" Beep
Taxz = 'E3S0H - Variables not specified'
ai; Flash {20,2,Text)
GOTO 10
I LSc
Z	Call the routine to produce the scattar plot.
call Get New Screen (Main Screen)
CALL Disolay Fids
GOTO 10
2ND 17
^ All athar aain menu options
SLS2
I? (Hvar .EQ. 0 ) T32H
CALL Seep
Text - 'E3RCR - Data file not specified'
CAL1 Flash {50,2,Text} ~
0010 10
£LS3
CALL Perform Process
GOTO 10
ESDI?
SKDIF
RSTTJSS
END
SU3BOOT-JIB GIT TZ DATA
This routine reads in the values for the variables selected and
determines the ainiaua/aaxiaum values.
SUBROUTINE G^t XT Data
IMPLICIT I:t-5GS3M (A-2)
5T UDS; * S:tAMPLE. QGf •
CHA3ACTE?. Blanks*z-0, Duaniy*75, Scratch*;, Z'r.t*4

-------
?.ZAL*4	Data (Maxvar) , Missing
DATA Ifzit / 1 (15) */
CALL Putstr ('Reading Data Values ... ',25,20,2,2)
Z *** Determine ccsticn of variables
Xsos = Toggle Position ('X LOG	')
Ypos =¦ Toggle Position'"('Y LCG	')
IF (xpos .2Q. 0) THEN
XIog - .TRUE.
ELSE
Xlog = .FALSE.
e:tdif
IF (ypos .13. 0) THEN
Ylog » .TRUE.
ELSE
Ylog » .FALSE.
ENDIF
Xpcs = Toggle Position ('XVARIA3L2 ') + 1
Ypos =• Toggle Position ('YVARIA3LE ') +1
: Get File Name
IF (File Prefix .HZ. Blanks) THEN
la = Lenstr(File Prefix) •
File Naae = File Prefix(l:la)//Data File
ELSE
File Naae = Data File
ENDIF
; *** open input file
Nunit = 10
Stat =¦ 'OLD'
CALL Open File (Nunit, File Name, Stat, Openerr)
IF (Openerr .NZ. 0) THEN
Text » 'Problem opening data file1
CALL Flash (20, 2, Text)
GOTO 999
ENDIF
*** Read header 3tring into default title
READ (Nunit, 1 (A) 1 , ERR - 999, END - 999) Dummy
*** Get Number of variables in file
READ (Nunit, *, ERS= 999, END - 999) Nvar
*** Get variable names for each variable in file
DO 20 i a 1, Nvar
READ (Nunit, ' (2A10) 1 , ERR » 999, END = 955) Dummy, Dummy
20 CONTINUE
Read variable values
Ndata = 0
Nrecords = 0

-------
Nmissir.g = 0
Missir.c = 1.13 1
Xmin = 1.130
Xaax = -1.E3 0
Ymin = 1.E3 0
Yaax = -1.E30
.LZ. 0.0 )
« Missing
ALOG(Data(Xpos))
Data(Xpos)
,LZ. 0.0)
» Missing
THEN
30
C ***
DO 30 j = 1, MaxData
READ (Nunit, *,E3R=999,END <
Nrecords = Nrecords + 1
I? (Data(Xpos) .LT. Missing
k	Data(Ypcs) .LT. Missing
Ndata =» Ndata + 1
17 (Xlog) THEN
I? (Data(Xpos)
Xarr(Ndata)
ELSE
Xarr(Ndata)
ENDI?
ELSE
Xarr(Ndata)
ENDI?
I? (Ylcg) THEN
I? (Data(Ypos)
Yarr(Ndata)
ELSE
Yarr(Ndata)
ENDI?
ELSE
Yarr(Ndata) =
ENDI?
I? (Xarr (Ndata)
Xain =• AMIN1
Xmax =• AMAX1
ENDI?
I? (Yarr (Ndata)
Ymin = AMIN1
Ymax =» AMAX1
ENDI?
ELSE
Nmissing = Nmi3sing
ENDI?
CONTINUE
write (*,*) Xain, Xaax, Ymin,Ymax
Check if mere then MaxData records
READ (Nunit, *, E3H - 999, END - 900)
900) (Data(i), i=>l,Nvar)
.AND.
) THEN
THEN
ALOG(Data(Ypos))
Data(Ypos)
.LT. Missing) THEN
(Xarr(Ndata), Xain)
(Xarr(Ndata), Xaax)
.LT. Missing) THEN
(Yarr(Ndata)
(Yarr(Ndata)
+ 1
Yain)
Yaax)
CALL Been
CALL Putstr
CALL Putstr
CALL Putstr
CALL Putstr
CALL Putstr
CALL Putstr
CALL Flash (20
CALL Erase Message
(Data(i), i»l,Nvar)
The number of records in the data
file exceeds the program limits.
Only the maximum number of allowed
cf coordinate values have beer,
stored in memory, the rest will
not be used...
2, 'Press any key to continue ')
,35,10,42,2)
,35,11,42,2)
,35,12,42,0)
,35,13,42,0)
,35,14,42,0)
,35,15,42,0)

-------
CALL Fu
CALL F
CALL Pu
CALL Pu
CALL PU
CALL
CALL
CALL Er
CALL F1
CALL Er
Ndatafi
Nvar =
Ndata =»
CALL Er
RETURN
END
and that the
artdard data
Manual for sore
file foraat.
tstr ('Check the file name,
tstr ('file named has the s
.str ('file format,
ts-r ('Consult the User3
-srr (1 information about
asa Field ('XVARIA3LS ')
asa Field (1^VARIABLE ')
asa Field ('DATA FILE ')
ash (20,2, ' Press and key to exit'}
asa (20,2,75)
19 =¦ Q
0
0
ase Message
,33,13,43,0)
,33,11,43,0)
,33,15,43,0)
,33,15,43,0)
,33,17,43,0)
C INTEGER* 4 FUNCTION TCGGLZ POSITION (FIELD NAME)
C
C Forsal Arguments:
C FIELD NAME - Stores the toggle field name,
c
C This routine returns the toggle position for the specified toggle
C field.
C
INTEGZR*4 FUNCTION Toggle Position (Field Name)
IMPLICIT INTZGER*4 (A-Z)
:> —CLUDE: 1 screen. str'
CKARACTIP.no Field Name
f =» Fid Index (Field Name)
Toggle Position ** SC Position (f)
RETURN
END

-------
IMPLICIT INTEGZRM (A-Z)
$ INCLUDE: 1 scrsar.. 3tr'
5 * *LUDE : 'EXAMPLE.CMN1
CHARACTER*3 Stat
LOGICAL*! Error
CALL Putstr ('Heading Header Data ',20,20,2,2)
C *** Open input file
Nunit =* 10
Stat = 'OLD'
CALL Open File (Nunit, File Name, Stat, Open.err)
IF (Oper.arr . NZ. 0) THEN
Text = 'Problem opening data file'
CALL Flash (20, 2, Text)
GOTO 999
INDIF
C *** Read header string into default title
RZAD (Nunit, ' (A) 1 , ERR - 999, END - 999) Taxt
C *** Get Number of variables in file
READ (Nunit, *, ERR= 999, END =¦ 999) Nvar
IF (Nvar . LT. 3) THEN
Text = 'Too few variables in file (press any key) '
CALL Flash ( 20, 2, Text)
GOTO 999
ELSE IF (Nvar .G7. Maxvar) THEN
Text = 'Too many variables in file (press any key) '
CALL Flash ( 20, 2, Text)
GOTO 959
ENDIF
C *** Get variable names for each variable in file
DO 20 i » l, Nvar
READ (Nunit, » (2A10) ERR - 999, END » 999)
+	Vamaa(i), Units(i)
20 CONTINUE
C *** Load variable names into toggle fields
CALL Load Toggle Values ('XVARIABLE ', 10, Nvar, Varnam, 0)
CALL Load Toggle Values ('^VARIABLE ', 10, Nvar, Varnam, 1)
C *** Display screen fields
CALL Display Fids
CLOSE (Nunit)
RETURN
999 Error = .TRUE.
CLOSE (Nur.it)
CALL Heap
CALL Putstr ('	ERROR readir.g data file ... ', 3 3 , 9 , 43 , 2)
CALL Putstr ('An ERROR was encountered in tha ',33,11,43,0)
CALL Futstr ('header section cf the data file. ',33,12,43,0)

-------
ELSE IT ("laid frame . EQ. ' X7ARIA3LE ») THEN
CALL Ge" Field Group
CALL Gat XY Data
IF (Nr.issing .EQ. Ndata) THEN
CALL Beep
Text = ' ERROR - No data values. '
CALL Flash (20,2,Text)
Nda~a = 0
CALL Erase Field (Field Name)
CALL Erase Field (1YVARIABLE *)
return
ELSE
IF (XLOG) THEN
1 =» Lenstr (Varnam (Xpos))
Xlabel =» 'LN ('//Varnam(Xpos) (1:1) //•)'
ELSE
Xlahel = Varnam(Xpos)
EUDIF
IF (YLCG) THEN
1 » Lanstr (Varnam (Ydos) )
Ylahel = 1 LN ('//Varnam(Ypcs) (1:1) //1) 1
ELSE
Ylahel - Varnam(Ypos)
ENDIF
END IF
CALL Erase (20,2,75)
C *** Set Regression ontion
ELSE I? (Field* Name .EQ. 'REGRESS ') THEN
CALL Get Field Group
pos = Toggle Position (Field Name)
I? (pos .EQ. 0) THEN
Regression = .FALSE.
ELSE
Regrassion » .TRUE.
END IF
pos = Toggle Position ('TSCALE	')
IF (pos .EQ. 0) THEN
True Scale « .FALSE.
ELSE
True Scale » .TRUE.
ENDI?
ELSE
CALL Get Field
ENDIF
RETURN
END
C* ********** ******************************************************
C SUBROUTINE READ HEADER DATA (ERROR)
C
C Formal Arguments:
C ERROR	- Logical variable set to true if an error occurs,
c
C TV, is routine reads in the header information from the data file
C then sets the screen fields. If an error occurs will reading
C' u..e file an errcr message is disclavsd.
C
SUBROUTINE Read Header Data (Error)

-------
c
C Lccal Variables:
C Field Kane	- Stores the screen field name.
C "exist	- Logical variable 3et to true if the file exists.
C Error	- Logical variable set to true if an error occurs.
C
C ..iis routine identifies which screen field has been selected, performs
C any error checking and then processes the screen field.
C
SUBROUTINE Perfora Process
IMPLICIT INTZGZRM (A-Z)
SINCLUDE:'screen.str'
$INCLUDE:'ZXAMPLZ. CMN ¦
CHARACTER Field Name*10 ,_31ank3*50
INTZGER*4 rid Index
LOGICAL*! Fexist, Error
C *** Initialize flag3
Error - .FALSE.
Fexist = .FALSZ.
C *** Identify fields, check for errors, perfora process
5 CALL Get Field
Field Naae = SC Field Name (Current Field)
C *** Set value for prefix (directory name)
IF (Field Name .ZQ. 1 PREFIX ') THZN
CALL Gat Character Value (Field Name, File Prefix)
C *** open data file, read in header information
ELSE IF (Field Name .ZQ. 'DATA FILZ ') THZN
CALL Erase (6, 58, 5)
CALL Erase (7, 58, 6)
CALL Get Character Value (Field Name, Data File)
IF (File Prefix .NE. Blanks) THEN
la = Lenstr(File Prefix)
File Name =» File Pre£ix(l:la)//Data File
ZLSZ
File Name «¦ Data File
ENDIF
INQUIRE (FILZ - File Name, EXIST = Fexist)
IF (. NCT. Fexist) THEN
Text = 'ERROR - data file not found'
CALL Flash. ( 20, 2, Text)
ERROR - .TRUE.
CALL Erase Field (Field Name)
ZLSE
CALL Read Header Data (Error)
ZNDIF
Title = 'from data file '//Data file
IF (.NCT. Error) THEN
CALL Set Menu Position ('KAINMZNU ',5)
Next Field = Fid Index ('XVARIA3LE ')
GOTO 5
ENDIF
r *** Set value for variables

-------
Q^,-,-ki,i,iti,******-tt**i,************************************it***^***-k******-,-,
C SUBROUTINE I1TT?.0 SC3ZIH
C
c tils routine displays the screen frame/laoels/fields for the
C introductory screen.
c
SviBaGUTIKI Intro Screen
CALL Cleir Screen
CALL Sat Screen£1)
CALL Display Frame
CALL Display Labels
CALL Flash (20, 2, 'Press any kay to begin the program ')
P.ZTTTR.N
E1CD
C S'uEP.OOTXyZ 0PI.V TILE (KTOIT, SAMFIL, STAT, QPEHtPJ.)
C
C Tonal Arguments:
C jruwiT	- rile unit number.
C NAKFIL - File naze.
C STAT	- File status.
C CPENZRR - Logical variable sat to true if an error occurs,
c
C This routine opens Nun.it with Haaiil and Stat paraaeterss and returns
C Ccer.err = 0, if successful,
c
SUSP.ccninz Open Tile (tfunit, STamfil, Stat, Openerr)
IMPLICIT INTEGER*4 (A-2)
CHA^ACTIS Kamfil*(*), Stat*3
Ocenerr » 0
I? (Stat .SQ, 'OLD') TKZX
CSEH (UNIT = Hunit,
¦*•	FILE =» Haafil,
+	STATUS » Stat,
+	ERR - 99)
ELSE
OPEN (UNIT » Nunit,
+	FILE » Kamfil,
+	STATUS « Stat,
+	sas - 99)
EJfDIF
RETURN
93 Openerr = 1
RETUHJT
EHD
<2* ****************** ^ -k 1, ********************************** *
C SUBROUTINE PiP.FCRK PROCESS

-------
SCO
CLOSE (Kur.it)
C * * * Display screen values
WRITE (Scratch, I fat) Nreccrds
CALL Purser (Scratch, 5, 6, 53, 0)
DO 40 i = 1, Ndata
I? (Xarr(i) .EQ. Missing .OR. Yarr(i) .EQ. Missing) THEN
Nmissing = Nraissi,ng + 1
Ndata = Ndata - 1
ENDIF
4 0	CONTINUE
WHITE (Scratch, Ifat) Nmissing
CALL Purs-r (Scratch, 6, 7, 53, 0)
RETURN
999 CLOSE (Nur.i
CALL Beeo
CALL Futst:
CALL Puts-:
CAjj-l, Puts*'
CALL Putst
CALxi Puts*:
CALL Putst:
CALij Putst:
CALii Puts*:
CATi>i Erase
CALL Erase
CALL Flash
CALL Erase
Nracords =»
Nvar =¦ o
Ndata =» 0
Naiissing =»
CALL Erase
it)
'	ERROR reading data file ...
'An ERROR was encountered while
•reading the data file.
'Check the file name, and that the
1 file named has the standard data
' file foraat.
'Consult the Users
' information about
Field ('XVARIABLE ')
Field ('YVARIABLE •)
(20,2, ' Press and key to exit')
(20,2,73)
0
Manual for
file format.
more
,33,9,43,2)
,33,11,43,0)
,33,12,43,0)
,33,13,43,0)
,33,14,43,0)
,33,15,43,0)
,33,15,43,0)
,33,17,43,0)
Message
RETURN
END
C****** ****************************************************************
C SUBROUTINE INITIALIZE
C
C This routine initializes global variables to their default values and
C then sets any corresconding screen fields
C
SUBROUTINE Initialize
IMPLICIT INTEGER*4 (A-Z)
$INCLUDE: 'EXAMPLE. CMN '
File Prefix = * '
Data File = 'Example.Dat'
CALL Set Character Value ('PREFIX ',File Prefix)
CALL Set Character Value ('DATA FILE ',Data File)
RETURN

-------