## GSLIB Help Page: File Formats

Data Files:

- Although users are strongly encouraged to customize the programs, workable main programs are useful starting points. The main programs read and write data with a format similar to the menu-driven Geo-EAS package. The format, described below, is a simple ASCII format with no data compression or alphanumeric characters.

- The data file format is a simplified Geo-EAS format, hence with no allowance for the user to specify explicitly the input format. The data values are always read with free format. The accessibility of the source code allows this to be easily changed.
- The following conventions are used by the ``simplified Geo-EAS format'' used by GSLIB data files:
  - The first line in the file is taken as a title and is possibly transferred to output files.
  - The second line should be a numerical value specifying the number of numerical variables nvar in the data file.
  - The next nvar lines contain character identification labels and additional text (optional) that describe each variable.
  - The following lines, from nvar+3 until the end of the file, are considered as data points and must have nvar numerical values per line. Missing values are typically considered as large negative or positive numbers (e.g., less than -1.0e21 or greater than 1.0e21). The number of data will be the number of lines in the file minus nvar+2 minus the number of missing values. The programs read numerical values and not alphanumeric characters; alphanumeric variables may be transformed to integers or the source code modified.

      Clustered 140 primary and secondary data

      5

      Xlocation

      Ylocation

      Primary

      Secondary

      Declustering Weight

      39.5 18.5   .06   .22 1.619

       5.5  1.5   .06   .27 1.619

      38.5  5.5   .08   .40 1.416

      20.5  1.5   .09   .39 1.821

Grid Definition:

- Regular grids of data points or block values are often considered as input or output. The conventions used throughout GSLIB are:
  - The X axis is associated to the east direction. Grid node indices ix increase from 1 to nx in the positive x direction, i.e., to the east.
  - The Y axis is associated to the north direction. Grid node indices iy increase from 1 to ny in the positive y direction, i.e., to the north.
  - The Z axis is associated to the elevation. Grid node indices iz increase from 1 to nz in the positive z direction, i.e., upward.
- The user can associate these three axes to any coordinates system that is appropriate for the problem at hand. For example, if the phenomenon being studied is a stratigraphic unit, then some type of stratigraphic coordinates relative to a marker horizon could make the most sense. The user must perform the coordinate transformation; there is no allowance for rotation or stratigraphic grids within the existing set of subroutines.
- The coordinate system is established by specifying the coordinates at the center of the first block (xmn,ymn,zmn), the number of blocks/grid nodes (nx,ny,nz), and the size/spacing of the blocks/nodes (xsiz,ysiz,zsiz).
- Sometimes a special ordering is used to store a regular grid. This avoids the requirement of storing node coordinates or grid indices. The ordering is point by point to the east, then row by row to the north, and finally level by level upward, i.e., x cycles fastest, then y, and finally z. The index location of any particular node ix,iy,iz can be located by:
  loc = (iz-1)*nx*ny + (iy-1)*nx + ix
  Given the above one-dimensional index location of a node the three coordinate indices can be calculated as
  iz = 1 + int( (loc-1)/(nx*ny) )
  iy = 1 + int( (loc-(iz-1)*nx*ny)/nx )
  ix = loc - (iz-1)*nx*ny - (iy-1)*nx

Parameter Files:

- The default driver programs read the name of a parameter file from standard input. If the parameter file is named for the program and has a ``.par'' extension, then simply keying a carriage return will be sufficient (e.g., the program `gam` would automatically look for `gam.par`). All of the program variables and names of input/output files are contained in the parameter file. A typical parameter file:

                             Parameters for GAM

                             ******************

      START OF PARAMETERS:

      ../data/true.dat       \file with data

      2   1   2              \   number of variables, column numbers

      -1.0e21     1.0e21     \   trimming limits

      gam.out                \file for variogram output

      1                      \grid or realization number

      50   0.5   1.0         \nx, xmn, xsiz

      50   0.5   1.0         \ny, ymn, ysiz

       1   0.5   1.0         \nz, zmn, zsiz

      2  10                  \number of directions, number of lags

       1  0  0               \ixd(1),iyd(1),izd(1)

       0  1  0               \ixd(2),iyd(2),izd(2)

      1                      \standardize sill? (0=no, 1=yes)

      2                      \number of variograms

      1   1   1              \tail variable, head variable, variogram type

      1   1   3              \tail variable, head variable, variogram type

- The user can have as many lines of comments at the top of the file as desired, but formatted input is started immediately after the characters ``START'' are found at the beginning of a line. Some in-line documentation is available to supplement the detailed documentation provided in this electronic help and the actual book.