uvkrig: a fortran-77 program for universal kriging

26
Computers & Geosciences Vol. 16, No. 2. pp. 211-236. 1990 0098-3004/90 $3.00 + 0.00 Printed in Great Britain. All rights reserved Copyright '~ 1990 Pergamon Press pie UVKRIG: A FORTRAN-77 PROGRAM FOR UNIVERSAL KRIGING JAMES R. CARR Department of Geological Sciences, Mackay School of Mines, University of Nevada-Reno, NV 89557, U.S.A. (Received 4 April 1989; accepted 6 June 1989) Abstract--The application of universal kriging to weakly stationary data is difficult for three reasons: (1) it is difficult to estimate the variogram for the weakly stationary data; (2) the order of drift for weakly stationary random function must be modeled; and (3) equation solution differs for universal kriging from that for simple or ordinary kriging. UVKR1G, a FORTRAN-77 computer code presented herein, offers a cross-validation procedure to help resolve the first two difficulties. A relatively simple maximum pivot search Gauss elimination algorithm is used to solve universal kriging equations. Application of UVKRIG to a weakly stationary data set for cross-validation and gridding is described. Key Words: Universal kriging, Cross-validation, Gridding, Contouring, FORTRAN-77, Gauss elimina- tion. INTRODUCTION Universal kriging (UK) was developed by Goldberger (1962) and described by Matheron (1969) for treat- ment of weakly stationary data with drift in spatial interpolation. The application of UK to weakly sta- tionary data is difficult, however, for three reasons: (1) the variogram of the component that conforms to the intrinsic hypothesis of the weakly stationary ran- dom function may not be known or easily calculated; (2) the order of drift for the weakly stationary random function must be modeled; and (3) equation solution differs for universal kriging from that for simple or ordinary kriging. These difficulties, however, are not insurmountable. A FORTRAN-77 computer algorithm, UVKRIG, is presented herein for punctual universal kriging. This program results from research involving estima- tion ofearthquake ground motion (Carr and Roberts, 1989). The intent of this program is to implement UK in a simple, yet correct algorithm. Then, the applica- tion of this algorithm is discussed for cross-validation and gridding. Formulation of UK equations and ap- proaches to the solution of these equations are em- phasized in this discussion. This computer algorithm is intended to be applied to data that are weakly stationary with drift (Myers, 1989). That is, the random function, Z(x), is weakly stationary with drift and Z(x) = Y(x) + re(x), where Y(x) satisfies the intrinsic hypothesis and E[Z(x)] = re(x). Note that m(x) is a function of posit- ion and is repLesented as a linear combination of known linearly independent functions (Myers, 1989). EQUATIONS Ordinary kriging consists of the following covari- ance system of equations: [Co%1 {).,} = {Cov0+} (la) where each Cov,j entry is the covariance between known sample locations, i and j; each Cov0i entry is the covariance between the estimation location, 0, and the ith known location; and {2} is the solution vector. This equation describes ordinary kriging if you con- sider {2} represents both the kriging weights and the Lagrangian multiplier and the constraint that the weights sum to unity is included in the matrix system. In expanded form, this is written: "Cov,, COV,N I COVN I COVNN l 1 1 0 vill (lb) where N is the number of nearest surrounding loca- tions used to estimate a data value at location 0. To effect UK, Equation (lb) is expanded to in- clude functions of position coordinates. This is writ- ten (e.g. Journel and Huijbregts, 1978, p. 319): 211

Upload: james-r-carr

Post on 29-Aug-2016

236 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: UVKRIG: A FORTRAN-77 program for universal kriging

Computers & Geosciences Vol. 16, No. 2. pp. 211-236. 1990 0098-3004/90 $3.00 + 0.00 Printed in Great Britain. All rights reserved Copyright '~ 1990 Pergamon Press pie

UVKRIG: A FORTRAN-77 PROGRAM FOR UNIVERSAL KRIGING

JAMES R. CARR

Department of Geological Sciences, Mackay School of Mines, University of Nevada-Reno, NV 89557, U.S.A.

(Received 4 April 1989; accepted 6 June 1989)

Abstract--The application of universal kriging to weakly stationary data is difficult for three reasons: (1) it is difficult to estimate the variogram for the weakly stationary data; (2) the order of drift for weakly stationary random function must be modeled; and (3) equation solution differs for universal kriging from that for simple or ordinary kriging. UVKR1G, a FORTRAN-77 computer code presented herein, offers a cross-validation procedure to help resolve the first two difficulties. A relatively simple maximum pivot search Gauss elimination algorithm is used to solve universal kriging equations. Application of UVKRIG to a weakly stationary data set for cross-validation and gridding is described.

Key Words: Universal kriging, Cross-validation, Gridding, Contouring, FORTRAN-77, Gauss elimina- tion.

INTRODUCTION

Universal kriging (UK) was developed by Goldberger (1962) and described by Matheron (1969) for treat- ment of weakly stationary data with drift in spatial interpolation. The application of UK to weakly sta- tionary data is difficult, however, for three reasons: (1) the variogram of the component that conforms to the intrinsic hypothesis of the weakly stationary ran- dom function may not be known or easily calculated; (2) the order of drift for the weakly stationary random function must be modeled; and (3) equation solution differs for universal kriging from that for simple or ordinary kriging. These difficulties, however, are not insurmountable.

A FORTRAN-77 computer algorithm, UVKRIG, is presented herein for punctual universal kriging. This program results from research involving estima- tion ofearthquake ground motion (Carr and Roberts, 1989). The intent of this program is to implement UK in a simple, yet correct algorithm. Then, the applica- tion of this algorithm is discussed for cross-validation and gridding. Formulation of UK equations and ap- proaches to the solution of these equations are em- phasized in this discussion.

This computer algorithm is intended to be applied to data that are weakly stationary with drift (Myers, 1989). That is, the random function, Z(x), is weakly stationary with drift and Z(x) = Y(x) + re(x), where Y(x) satisfies the intrinsic hypothesis and E[Z(x)] = re(x). Note that m(x) is a function of posit- ion and is repLesented as a linear combination of known linearly independent functions (Myers, 1989).

EQUATIONS

Ordinary kriging consists of the following covari- ance system of equations:

[Co%1 {).,} = {Cov0+} (la)

where each Cov,j entry is the covariance between known sample locations, i and j; each Cov0i entry is the covariance between the estimation location, 0, and the ith known location; and {2} is the solution vector. This equation describes ordinary kriging if you con- sider {2} represents both the kriging weights and the Lagrangian multiplier and the constraint that the weights sum to unity is included in the matrix system.

In expanded form, this is written:

"Cov,, COV,N I

COVN I COVNN l

1 1 0

vill (lb)

where N is the number of nearest surrounding loca- tions used to estimate a data value at location 0.

To effect UK, Equation (lb) is expanded to in- clude functions of position coordinates. This is writ- ten (e.g. Journel and Huijbregts, 1978, p. 319):

211

Page 2: UVKRIG: A FORTRAN-77 program for universal kriging

212

Covn Covls 1 xl Y l . - .

Cov vl Cov v.~ 1 x,v y,~, •

1 1 0 0 0

xl x.v 0 0 0

Yl Y,v 0 0 0

AI C°v01

ci°

J. R. CARa

[A]{2} + [B r]{•} = {R} (3b)

[81 {;.} + [01 {~,} = { s } . (3c)

This provides two equations for the solution of two unknowns, {2} and {#}. The following sequence of manipulations will yield a solution for {2} and {p}:

(1) From Equation (3b):

(2)

The system of Equation (2) is shown explicitly for UK in which linear drift is modeled; higher order drift models are shown implicitly in this system. For exam- ple, to account for a second-order drift x 2, x y , and y2 terms must be added to the equation system (see, for example, David, 1977, p. 271).

EQUATION SOLUTION

It is noted that the expansion of the ordinary kriging system to accommodate position coordinates expands the number of null entries in the lower right- hand corner of the intersample covariance matrix [Cov,j]. Many computer algorithms for ordinary krig- ing use an efficient form of Gauss elimination wherein the maximum pivot values are assumed to be entered on the diagonal of the square, symmetric intersample covariance matrix. This form of Gauss elimination algorithm is incorrect for the solution of UK equa- tions because all pivots no longer occur on the dia- gonal of the intersample covariance matrix.

Several algorithms are available which provide a solution for the UK equation system for all drift orders. One is a method given by Davis and Culhane (1984). In this method, Equation (2) is written:

['"' >1= >1 (3a, t81 t01 j ( { , } J [ { s } j

This system may be rewritten as:

{;.} = [a]-~ [{R} - [ s q {~} 1;

(2) Substituting this in Equation (3c) yields:

[81 [ [A1-' [ {r} - [8 ~1 {~} 11 = {s}

which is rearranged and written:

lIB] [a]-' {R} ] - {s} = [[8] [a]-' IS T] {~,} ]; (3) Let [W] = [[B] [A]-' [B r] ]; then

{#} = [ W ] - t [ [ [ B ] [ A ] - I { R } ] - { S } ] .

The following is a summary of the steps followed to calculate {p}:

(1) Calculate [A] -I and store the result; (2) Calculate [B] [A]-I; let the result be termed [C]; (3) Calculate [W] = [C] [Br]; (4) Calculate [C] {R}; let the result be termed {P}; (5) Calculate {P} - {S}: let the result be termed

{r}; (6) Calculate [W] -I and store the result; (7) Calculate {#} = [W] -~ {T}.

Once {p} is calculated, its substitution back into Equation (3b) yields the solution for {2}:

(8) Calculate [B r] {p}; let the result be termed { V}; (9) Calculate {R} - { V}; let the result be termed

{Y}; (10) Calculate {2} = [al-' {Y}.

It is observed that this method for solving UK equa- tions involves computing two matrix inversions at steps 1 and 6, six multiplications at steps 2, 3, 4, 7, 8, and 10, and two subtractions at steps 5 and 9. This is a difficult and computationally expensive algorithm to implement in a computer code. This procedure, however, is developed to allow contouring of large data sets, a task for which this algorithm is well suited.

Solution of Equation (2) can be obtained alter- nately by using a maximum pivot search algorithm for Gauss elimination. This is tantamount to rearranging the rows of Equation (2) to reposition null values off the diagonal. This is the equation solution algorithm used in UVKRIG.

OVERVIEW OF UVKRIG

UVKRIG is listed in its entirety in Appendix 1. This listing also provides a User's Guide to data input at the beginning of the program. This program con- sists of the following modules/subroutines, listed in the order they occur in Appendix 1.

(1) Main program (includes User's Guide; reads then selects the option for cross-validation or gridding);

Page 3: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program

(2) CROSS (subroutine which controls the cross- validation option);

(3) EUKRIG (forms the ordinary kriging or univ- ersal kriging system of equations, depending on option selection);

(4) XGAM (a function; for spherical variogram calculation);

(5) SOLN3 (maximum pivot search Gauss elim- ination equation solver):

(6) GRID (subroutine which controls the gridding option);

(7) ECHO (prints the input data for a check); (8) REDAT (subroutine which controls the input

of spatial data: data, y, x); (9) REOPT (subroutine which controls the input

of initialization data, including variogram par- ameters);

(10) HEAP (subroutine for heap sorting nearest neighboring data from closest to farthest; taken from Press and others, 1986, p. 231).

In its present form, UVKRIG has the following limi- tations:

(I) 500 known data locations, maximum; (2) Three orders of drift (linear, quadratic, cubic)

can be modeled; (3) Spherical variogram model only (no provisions

for nested models); (4) Punctual estimation only.

AN APPLICATION OF UVKRIG

Earthquake ground motion data are associated with weakly stationary behavior, especially beyond particular lags (Carr and Glass, 1985). Moreover, these data may be sampled poorly. Ground motion is measured directly only at locations associated with a recording instrument (accelerograph). These instru- ments usually are placed in arrays parallel or or- thogonal to faults primarily to study the behavior of these structures during earthquakes. Ground motion also can be measured subjectively, but only at loca- tions associated with observers. Hence, spatial sam- pling of earthquake ground motion may be hap- hazard. Most samples coincide with population cen- ters or with geologic structure, specifically faults. Maps of earthquake ground motion generated using ordinary kriging may not seem to be correct because of this manner in which ground motion is sampled. Moreover, because ordinary kriging does not model directly nonconstant trends, such maps may not show adequately the correct negative trend (decay) in

for universal kriging 213

ground motion value away from an earthquake source. Earthquake ground motion is used simply as an example for the application of UVKRIG to weakly stationary data.

Ground motion accelerations for the 1983 Coa- linga, California (U.S.A.) earthquake are listed in Appendix 2. This Appendix shows a complete data listing for the cross-validation option using UK for quadratic drift. A complete comparison of cross-vali- dation applications of OK, UK for first-order drift, UK for second-order drift and UK for third-order drift is presented in Appendix 3; this comparison is reviewed in Table 1. From this application, OK seems to be the superior estimator based on cross-validation e r r o r s .

Cross-validation errors, alone, provide insufficient information for judging estimation superiority in ap- plications to earthquake ground motion (Carr and Roberts, 1989). Scatter plots of true vs estimated value provide additional information for judging es- timation performance. Scatter plots for the results presented in Appendix 3 are shown in Figures I--4; such plots may be used to show estimation perform- ance (e.g. Journel and Huijbregts, 1978, p. 466; Boufassa and Armstrong, 1989). The scatter plot shown in Figure 3 for universal kriging in which second-order drift is modeled seems to show superior performance, with the exception of one grossly over- estimated value.

It is noted that cross-validation is a quantitative summary of estimation accuracy. Whereas this analy- sis might provide a clue to the superior performance of one estimation method relative to another, cross- validation is a technique primarily used to aid in the modeling of variograms. In addition to cross-valid- ation, visual comparison of two or more estimators can be used to determine preference.

Gridding, an option in UVKRIG, is used for this purpose as a prelude to contouring. Three contour maps are included to provide visual comparison based on gridding results. Ordinary kriging applied to grid the Coalinga earthquake data yields the contour map shown in Figure 5. In comparison, universal kriging for first-order drift applied for gridding yields the contour map shown in Figure 6. Second-order drift is modeled in Figure 7. The contours resulting from the application of UK in which second-order drift is modeled show more closure and are elliptical. These characteristics are more typical of published maps of earthquake ground motion (e.g. Scholl and Stratta, 1984). Two characteristics, contour closure and shape,

Table 1. Summary of cross-validation results for 1983 Coalinga, California (U.S.A.) earthquake acceleration data

Drift order Mean error Mean square error Mean krig. var.

0 - 1.49 1980 1530 1 -0.25 2000 1640 2 0.30 2360* (2245)t 2040 3 2.96 3690* (2865)~ 2210

* With negative estimates. tWithout negative estimates.

Page 4: UVKRIG: A FORTRAN-77 program for universal kriging

214 J. R. CARR

280

240

2OO

.~ 160

o 120

0 8 0

40

0 0 - 0

I I I l I I I 40 80 120 160 200 240 280

True value

Figure I. Scatterplot showing true vs estimated value result- ing from application of ordinary kriging to ground motion data from 1983 Coalinga, California (U.S.A.) earthquake.

> D

280

240

200

160

120

80

40

° °

O 0 O D

C 0 ~_ O

U

C 0 0 0

I 4 0 80 120 160 2 0 0 240 280

True value

Figure 2. Scatterplot showing true vs estimated value result- ing from application of universal kriging to ground motion

data from Coalinga earthquake; linear drift is modeled.

280

240

200

160

120

80

4 0

0 C 0 "~ _-

: r m @

/ I I I I I t I

40 80 120 160 200 240 280

True value

Figure 3. Scatterplot showing true vs estimated value result- ing from application of universal kriging to ground motion data from Coalinga earthquake; quadratic drift is modeled.

28° / 240 ~ --

2OO

! 60 t~

,~ 120 I : I

4 0

0 40 80 120 160 200 240 280

True value

Figure 4. Scatterplot showing true vs estimated value result- ing from application of universal kriging to ground motion

data from Coalinga earthquake: cubic drift is modeled.

max = 100

S oo, i ym,n= 70

Ordinary krlging for Coatlnga ecr'.~quoke

Figure 5. Contour map of 1983 Coalinga, California (U.S.A.) earthquake accelerations using ordinary, punctual kriging. Contoured amounts have units of cm/sec/sec (gal). Maximum and minimum grid dimensions have units of

kilometers.

describe the differences between Figures 5 and 7. Moreover, Figure 8 is included showing actual data locations and ground motion values. This figure allows for the assessment of contouring accuracy in Figures 5-7. By comparing Figure 8 to Figures 5 and 7, for example, it is apparent that universal kriging for which second-order drift is modeled provides a better fit to the data compared to ordinary kriging.

With universal kriging, negative estimates oc- casionally are encountered. The program, UVKRIG, normalizes coordinate values to form the intersample and point-sample covariance matrix system. In the cross-validation option, x and y coordinate values are normalized by dividing by the maximum x and y coordinate values for the data set. In the gridding option, the maximum x and y values used for nor- malization are set equal to the maximum x and y grid

Page 5: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program for universal kriging 215

m e , - 100

-j / 1

y m m = 7 0

L i n e a r U K fo r CoaLinga e o r t h q u a k e

Figure 6. Contour map of Coa]inga earthquake accelera- tions using punctual, universal kriging for first-order (linear) drift. Contoured amounts have units of gal; grid dimensions

are expressed in kilometers.

1 0 0

9 5

9 0

o = :D

~5 >.

8 0

7 5

7 0 4 0

S a m p l e l o c a t i o n s

129 = 85 51 r- 130 93 r- 120 '~ r-'

5~ ~ 71 - 79 [3

119 '~ 148

82 87 [] t 60 []

133 [] 122 94 - 132 _ [] ,-

73 [] 140 46

3 36 67 89 [] E3 109 C3

130 ~

99 [] [ ]

4 6 [3

I I I I I __

4 5 .50 55 6 0 6 5

x Direc t ion

Figure 8. Data locations and ground motion values are mapped in this figure to allow assessment of contouring accuracy in Figures 5-7. Ground motion values are ex-

pressed in gal.

¥ma~ = 100

~; Oo

y m m = 7 0

Q u a d r a t i c U K fo r CoaLincje e a r t h q u a k e

Figure 7. Contour map of Coalinga earthquake accelera- tions using punctual, universal kriging for second-order (quadratic) drift. Contoured amounts have units of gal; grid

dimensions are expressed in kilometers.

dimensions. Normalization is performed to minimize instability in equation solution. In modeling third- order drift, for example, coordinate values are cubed. If not normalized, such operation on coordinate val- ues can result in large entries in the intersample co- variance matrix relative to the covariance entries. This instability can cause negative estimates. Normaliza- tion, however, does not avoid the type of negative weight which occurs even with ordinary kriging (e.g. Herzfeld, 1989).

For example, in generating the map shown in Fig- ure 7, the minimum contour value is 60cm'sec/sec. The regions of this map associated with negative esti-

mates are shown in Figure 9. Note that these negative estimates occur at the boundary of the grid (i.e. out- side the region within which data are sampled). Nega- tive estimates can be avoided by restricting gridding or cross-validation to the inside of the sampled re- gion.

To produce Figures 5-7, the Golden Software* program, TOPO, was used. This program expects gridded output in a particular format. Documenta- tion for this package includes a BASIC program for this conversion. A BASIC program based on this algorithm, but modified for U V K R I G grid output, is

o

E

max = 100

• .-.-:X:X;X::~::;.:::~X~:::I'::Z

yrmn = 70

O u a d r o t i c U K to s h o w region of neg est

Figure 9. Shaded area shows region in Figure 7 associated with negative estimates.

* Not an endorsement; for information only•

Page 6: UVKRIG: A FORTRAN-77 program for universal kriging

216 J. R. CARR

given in Appendix 4. This is an interactive program. To execute this program, simply load the program, type RUN, and respond to a few interactive com-

mands generated by the program.

CONCLUSION

U VKRIG, a FORTRAN-77 computer alogirthm, provides a simple, two-dimensional approach to universal kriging. Application of U V K R I G through gridding to earthquake ground motion demonstrates visually the differences between ordinary kriging and universal kriging. Inspection of Figure 7 underscores the statement that universal kriging is the merger of two interpolation techniques: simple kriging of re- siduals and trend-surface fitting by ordinary kriging.

U V K R I G relies on a simple Gauss elimination, maximum pivot search algorithm for equation solu- tion. A detailed description was presented for an alternate algorithm given by Davis and Culhane (1984). Appendix 5 presents this algorithm. The enti- rety of Appendix 5 can be substituted for SOLN 3 in

U V K R I G if desired.

Acknowledgments--UVKRIG was developed in research sponsored by the Research Advisory Board (RAB), Uni- versity of Nevada-Reno. Sincere appreciation is expressed to two anonymous reviewers whose comments greatly im- proved this manuscript.

REFERENCES

Boufassa, A., and Armstrong, M., 19S9. Comparison bet- ween different kriging estimators: Jour. Math. Geology, v. 21, no. 3, p. 331-346.

Carr, J. R., and Glass, C. E., 1985. Treatment of earthquake ground motion using regionalized ~ ariabIes: Jour. Math. Geology, v. 17, no. 3, p. 221-241.

Carr, J. R., and Roberts, K. P.. 1989, Application of univer- sal kriging for estimation of earthquake ground motion: statistical significance of results: Jour. Math. Geology, v. 21, no. 2, p. 255-265.

David, M., 1977, Geostatistical ore reserve estimation: El- sevier, Amsterdam, 364p.

Davis, M., and Culhane, P., 1984, Contouring very large data sets using kriging, in Verly. G. and others eds., Geostatistics for natural resources characterization, Part 2: D. Reidel, Dordrecht, Netherlands, p. 599-619.

Goldberger, A. S., 1962, Best linear unbiased prediction in the generalized linear regression model: Jour. Am. Stat. Assoc., v. 57, no. 298, p. 369-375.

Herzfeld, U. C., 1989, A note on programs performing kriging with nonnegative weights: Jour. Math. Geology, v. 21, no. 3, p. 391-394.

Journel, A. G., and Huijbregts, Ch. J., 1978, Mining geo- statistics: Academic Press, London, 600p.

Matheron, G., 1969, Le krigeage universeh Les Cahiers du Centre de Morphologie Mathematique, Fasc. No. I, ENSMP, Paris, 82p.

Myers, D. E., 1989, To be or not to b e . . . stationarity? That is the question: Jour. Math. Geology, v 21, no. 3, p. 347-362.

Press, W. H., Flannery, B. P., Teukolsk.~, S. A., and Vetted- ing, W. T., 1986, Numerical recipes: Cambridge Univ. Press, New York, 818p.

Scholl, R. E., and Stratta, J. L., eds., 1984, Coalinga, Cal- ifornia, earthquake of 2 May 1983: reconnaissance re- port: Earthquake Engineering Research Inst. Rept. no. 84-03, 300p.

A P P E N D I X 1

UVKRIG Listing

C C C C C C C C C C C C C C C C C C C C C C C C

PROGRAM UVKRIG

THIS PROGRAM PERFORMS ORDINARY PUNCTUAL KRIGING OR UNIVERSAL PUNCTUAL KRIGING (FOR THREE ORDERS

OF DRIFT).

PROGRAM AUTHOR: JAMES R. CARR DEPT. OF GEOLOGICAL SCIENCES UNIVERSITY OF NEVADA-RENO RENO, NEVADA 89557

PROGRAM CAPABILITIES:

i. CROSS-VALIDATION 2. GRIDDING

A. OUTPUT FILE CREATION (GRID.OUT)

PROGRAM LIMITATIONS:

]. 500 DATA I.OCATIONS 2. THREE DRIFT ORDERS (LINEAR, QUADRATIC,

OR CUBIC) 3. ONE VARIOGRAM MODEL (SPHERICAL)

(NO PROVISION FOR NESTED MODELS) 4. PUNCTUAL ESTIMATION ONLY

c

c c GUIDE TO DATA INPUT

C

Page 7: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program for universal kriging 217

C

C C ALL DATA INPUT IS CONROLLED BY FREE-FORMAT

C READ STATEMENTS C C LINE 1: ISELECT C C READ(5,*) ISELECT

C C = I (CROSS-VALIDATION) C = 2 (GRIDDING)

C C LINE 2: VARIOGRAM PARAMETERS:

C C READ(5,*) CO,SILL,RANGE,ANGLE,HORIZ C C CO = NUGGET VALUE FOR VARIOGRAM C SILL = SILL OF VARIOGRAM C RANGE = RANGE OF SPATIAL STRUCTURE C ANGLE = DIRECTION (0 TO 360) FOR MAJOR AXIS C OF ANISOTROPY (ANGLE = 0.0 FOR C ISOTROPIC CASE) C HORIZ = RATIO OF MAJOR AXIS/MINOR AXIS FOR C ANISOTROPY (HORIZ = 1.0 FOR ISOTROPIC CASE)

C C LINE 3: ESTIMATION PARAMETERS

C C READ(5,*) N,RADIUS

C C N = NUMBER OF CLOSEST NEIGHBORS USED FOR ESTIMATION C RADIUS = SEARCH WINDOW RADIUS

C C LINE 4: STATIONARITY OPTION:

C C READ(5,*) ISTAT

C C = 0 (STATIONARITY)

C C = 1 (IST ORDER NON-STATIONARITY) C = 2 (2ND ORDER NON-STATIONARITY) C = 3 (3RD ORDER NON-STATIONARITY)

C C LINES 5 - ?: SPATIAL DATA: C C READ (5,*) DATA VALUE, Y-COORDINATE, X-COORDINATE

C

C C NOTE: IF ISELECT = 2 FOR GRIDDING, THEN A LINE OF C DATA INPUT MUST BE ADDED BETWEEN LINES 4 AND 5

C ABOVE: C C IF (ISELECT = 2) THEN: C C LINE 4A: GRID DEFINITION: C C READ(5,*) NROW, NCOL, GYMAX, GXMAX, DIMY, DIMX

C C NROW = TOTAL NUMBER OF ROWS IN GRID C NCOL = TOTAL NUMBER OF COLUMNS IN GRID C GYMAX AND GXMAX ARE THE COORDINATES OF THE UPPER C RIGHT HAND CORNER OF THE GRID C DIMY IS THE DISTANCE IN Y BETWEEN ADJACENT GRID ROWS C DIMX IS THE DISTANCE IN X BETWEEN ADJACENT GRID C COLUMNS C

C C~**~***~**~*~*~**~**~**~**** ~k*~***~**~**

OPEN(5, FILE = ' ')

C READ SELECTION OPTION FOR CROSS-VALIDATION OR GRIDDING

READ(5,*) ISELECT IF (ISELECT .EQ. i) THEN

CALL CROSS ELSEIF (ISELECT .EQ. 2) THEN

Page 8: UVKRIG: A FORTRAN-77 program for universal kriging

218

C C C

46

90

J. R. CARR

CALL GRID ENDIF STOP END SUBROUTINE CROSS COMMON /VARGAM/ CO,SILL,RANGE,ANGLE,

HORIZ,XCOS,XSIN COMMON /UKRIG/ Y(500),X(500),XDATA(500) COMMON /UMAX/ XMAX, YMAX DIMENSION B(2),DIS(50},IHOL(50),WT(50),XMEAS(50),

ERR(500),AKRIG(500)

REAL JACK(500)

INITIALIZE VARIABLES

ASE = 0.0 SQE = 0.0 SVK = 0.0 NKOUNT = 0

READ VARIOGRAM PARAMETERS AND OPTIONS

CALL REOPT(N,ISTAT,KSTAT,RADIUS)

READ SPATIAL DATA

CALL REDAT(NKOUNT)

ECHO THE INPUT DATA

CALL ECHO(NKOUNT,N,RADIUS,ISTAT)

ITITIALIZE THE ESTIMATION PROCEDURE

ANGLE = 0.017453292 * ANGLE XCOS = COS(ANGLE) XSIN = SIN(ANGLE)

START THE UNIVERSAL KRIGING: CROSS-VALIDATION MODE

WRITE(*,46) FORMAT(//,IX,'LOC',9X,'Y',9X,'X',5X,'VALUE',

2X,'ESTIMATE',5X,'ERROR',5X,'JNIFE',2X,'VAR',//)

DO i00 II = I,NKOUNT DATI = XDATA(II) B(1) = X(II) B(2) = Y(II)

FIND THE N CLOSEST LOCATIONS TO LOCATION II

2

KK = 0

DO 90 JJ = I,NKOUNT IF (JJ .EQ. If) GO TO 90 DX = B(1) - X(JJ) DY = B(2) - Y(JJ) DIST = SQRT((DX*XCOS + DY*XSIN)**2 + HORIZ*

(DY*XCOS - DX*XSIN)**2) IF (DIST .GT. RADIUS) GO TO 90 KK = KK + 1

IHOL(KK] = JJ DIS(KK) = DIST IF (KK .GT. I) THEN

IF (KK .LE. N) THEN SORT DISTANCE VALUES SMALLEST TO LARGEST CALL HEAP(IHOL,DIS,KK)

ELSEIF( KK .GT. N) THEN KK = N

IF (DIST .LT. DIS(N)) THEN DIS(N) = DIST IHOL(N) = JJ CALL HEAP(IHOL,DIS,KK)

ENDIF ENDIF

ENDIF CONTINUE

Page 9: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program for universal kriging 219

95

96

98 100 C C C

200

201

205

IF (KK .LE. KSTAT) GO TO i00 CALL EUKRIG (IHOL,B,KK,WT,XMEAS,ISTAT,KZ)

EST = 0.0 DUMI = 0.0 DUM2 = 0.0 DO 95 KI = I,KK LL = IHOL(KI) EST = EST + WT(KI) * XDATA(LL) DUMI = DUMI + WT(KI) * XMEAS(KI)

CONTINUE DO 9G JI = I,KZ K2 = KK + JI DUM2 = DUM2 + WT(K2) * XMEAS(K2)

CONTINUE IF (ISTAT .EQ. 0) DUM2 = WT(KK+I) XKRIG = SILL - DUMI - DUM2 ERR(If) = DAT1 - EST AKRIG(II) = XKRIG JACK(If) = ERR(II) ** 2 / AKRIG(II)

XA = X(II) YA = Y(II) WRITE(*,98) II,YA, XA, XDATA(II),EST,ERR(II),

JACK(II), AKRIG(II)

FORMAT(IX, I4,7E10.3) CONTINUE

PRINT THE SUMMARY STATISTICS FOR ESTIMATION

XMERR = 0.0 AJMEAN = 0.0 VJMEAN = 0.0 DO 200 I = I,NKOUNT XMERR = XMERR + ERR(1) ASE = ASE + ERR(1) ** 2 SVK = SVK + AKRIG(I) AJMEAN = AJMEAN + JACK(I) CONTINUE XMERR = XMERR / FLOAT(NKOUNT) ASE = ASE / FLOAT(NKOUNT) SVK = SVK / FLOAT(NKOUNT) AJMEAN = AJMEAN / FLOAT(NKOUNT) ASS2 = 0.0 DO 201 I = I,NKOUNT ASS2 = (ERR(1) - XMERR) ** 2 + ASS2 VJMEAN = VJMEAN + (JACK(1) AJMEAN) ** 2

CONTINUE ASS2 = ASS2 / FLOAT(NKOUNT - i) VJMEAN = VJMEAN / FLOAT(NKOUNT - i) WRITE(*,205) XMERR, ASE, SVK, ASS2, AJMEAN, VJMEAN FORMAT(IH0, 10X, 'AVERAGE ERROR = ',E15.3,/,

IH0, 10X, 'AVERAGE SQUARE ERROR = ', E15.3,/, IH0, 10X, 'AVERAGE KRIGING VAR. = ',E15.3,/, 1H0, 10X, 'VARIANCE OF ERR. = ',E15.3,/, IH0, 10X, 'JACK KNIFE MEAN = ',E15.3,/, IH0, 10X, 'JACK KNIFE VARIANCE = ',E15.3)

RETURN END SUBROUTINE EUKRIG(IHOL,B,KK,WT,XMEAS,ISTAT,KZ) COMMON /VARGAM/ CO,SILL,RANGE,ANGLE,

HORIZ,XCOS,XSIN COMMON /UKRIG/ Y(500), X(500), XDATA(500) COMMON /UMAX/ XMAX,YMAX DIMENSION IHOL(50),B(2),WT(50),XMEAS(50),

A(50,50),PI(2),P2(2),U(50),TEMP(50)

THIS SUBROUTINE FORMS THE INTERSAMPLE COVARIANCE MATRIX AND THE POINT-SAMPLE COVARIANCE VECTOR AND CONTROLS SOLUTION OF THE KRIGING WEIGHTS

KKI = KK + 1

FORM INTERSAMPLE COVARIANCE MATRIX PORTION

DO 5 I = 1,50 DO 5 J = 1,50

CAI;~O 15:2-F

Page 10: UVKRIG: A FORTRAN-77 program for universal kriging

220

10

15

20

30

J. R. C ~ R

A(I,J) = 0.0

CONTINUE DO 15 K = I,KK JJ = IHOL(K) PI(1) = X(JJ) PI(2) = Y(JJ) K I = K + I IF (KI .LE. KK) THEN

DO i0 J = KI,KK

LL = IHOL(J) P2(1) = X(LL) P2(2) = Y(LL) GAM = XGAM(P1,P2) A{K,J) = SILL - GAM A(J,K) = A(K,J) CONTINUE

ENDIF A(K,K) = SILL GAM = XGAM(B,PI) U(K) = SILL - GAM A(K,KKI) = 1.0 A(KKI,K) = 1.0 CONTINUE U(KKI) = 1.0 A(KKI,KKI) = 0.0

ADD INFORMATION FOR NONSTATIONARITY MODELING

IF DESIRED (I.E., ISTAT .GT. 0)

IF(ISTAT .GT. 0) THEN IF (ISTAT .EQ. i) THEN

IST ORDER DRIFT IS MODELED

KK2 = KK + 2 KK3 = KK + 3 DO 20 K = I,KK JJ = IHOL(K) A(K,KK2) = X(JJ) / XMAX A(KK2,K) = A(K,KK2) A(K,KK3) = y(JJ) / YMAX A(KK3,K) = A(K,KK3) CONTINUE U(KK2) = B(1) / XMAX U[KK3) = B(2) / YMAX

KZ = KK + 3 ELSEIF(ISTAT .EQ. 2) THEN

2ND ORDER DRIFT IS MODELED

KK2 = KK + 2 KK3 = KK + 3 KK4 = KK + 4 KK5 = KK + 5 KK6 = KK + 6 DO 30 K = I,KK JJ = IHOL(K) A(K,KK2) = X(JJ) / XMAX A(KK2,K) = A(K,KK2) A(K,KK3) = y(JJ) / YMAX A(KK3,K) = A(K,KK3) A(K,KK4) = X(JJ) * X(JJ) / (XMAX * XMAX)

A(KK4,K) = A(K,KK4) A(K,KK5) = X(JJ) * y(JJ) / (XMAX * YMAX)

A(KK5,K) = A(K,KK5) A(K,KK&) = y(jj) * y(JJ) / (YMAX * YMAX)

A(KK6,K) = A(K,KK6) CONTINUE U(KK2) = B(1) / XMAX U(KK3) = B(2) / YMAX U(KK4) = B[I) * B(1) / (XMAX * XMAX) U(KK5) = B(1) * B(2) / (XMAX * YMAX) U(KK&) = B(2) * B(2) / (YMAX * YMAX)

KZ = KK + 6 ELSEIF( ISTAT .EQ. 3) THEN 3RD ORDER DRIFT IS MODELED

KK2 = KK + 2 KK3 = KK + 3 KK4 = KK + 4

Page 11: UVKRIG: A FORTRAN-77 program for universal kriging

40

50

C C C C

C

FORTRAN-77 pro~am ~runiversalkfi~ng

KK5 = KK ~ 5

KK6 = KK + 6

KK7 = KK ÷ 7

KK8 = KK + 8

KK9 = KK + 9

KKI0 = KK + i0

DO 40 K = I,KK

JJ = IHOL(K) A(K,KK2) = X(JJ) / XMAX

A{KK2,K = A(K,KK2) A(K,KK3 = y(JJ) / YMAX

A(KK3,K = A(K,KK3) A(K,KK4 = X(JJ) * X(JJ) / (XMAX ** 2)

A(KK4,K = A(K,KK4) A(K,KK5 = X(JJ) * Y(JJ) / (XMAX * YMAX)

A(KKS,K = A(K,KK5) A(K,KK6 = y(JJ) * y(JJ) / (YMAX ** 2)

A(KK6,K = A(K,KK6) A(K,KK7 = X(JJ) ** 3 / (XMAX ** 3)

A(KK7,K) = A(K,KK7) A(K,KK8) = X(JJ) * X(JJ) * y(JJ) / (YMAX*XMAX**2)

A(KKS,K) = A{K,KKS) A(K,KK9) = X(JJ) * y(jJ) * y(JJ) / (XMAX*YMAX**2)

A(KK9,K) = A(K,KK9) A(K,KKI0) = Y(JJ) ** 3 / (YMAX ** 3)

A(KKI0,K) = A(K,KKI0)

CONTINUE U(KK2) = B(1) / XMAX

U(KK3) = B(2) / YMAX U(KK4) = B(1) * B(1) / (XMAX*XMAX)

U(KK5) = B(1) * B(2) / (XMAX*YMAX)

U(KK6) = B(2) * B(2) / (YMAX**2)

U(KK7) = B(1) ** 3 / (XMAX**3) U(KKS) = B(1) * B(1) * B(2) / (YMAX*XMAX**2) U(KK9) = B(1) * B(2) * B(2) / (XMAX*YMAX**2)

U(KKI0) = B(2) ** 3 / (YMAX ** 3)

KZ = KK + 10

ENDIF

ENDIF IF (ISTAT .EQ. 0) KZ = 1

IF (ISTAT.EQ.I) KZ = 3

IF (ISTAT.EQ.2) KZ = 6 IF (ISTAT.EQ.3) KZ = I0

NNN = KK + KZ CALL SOLN3(A,U,WT,NNN)

KB = KK + KZ

DO 50 I = I,KB XMEAS(I) = U(1)

CONTINUE

RETURN

END FUNCTION XGAM(A,B) COMMON /VARGAM/ CO,SILL,RANGE,ANGLE,

HORIZ,XCOS,XSIN

DIMENSION A(2), B(2)

SPHERICAL VARIOGRAM FUNCTION. XGAM IS A VARIOGRAM VALUE. THIS IS USED TO

CALCULATE A COVARIANCE VALUE IN SUBROUTINE EUKRIG.

DX : A(1) - B(1) DY = A(2) B(2) DIST = SQRT((DX*XCOS + DY*XSIN)**2 + HORIZ *

(DY*XCOS - DX*XSIN)**2)

IF (DIST .LT. RANGE) THEN

C = SILL - CO DUMI = CO + C*((I.5*DIST/RANGE) - 0.5 *

(DIST**3/RANGE**3))

XGAM = DUMI ELSEIF (DIST .GE. RANGE) THEN

XGAM = SILL

ENDIF RETURN

END SUBROUTINE SOLN3(A,B,C,N) DIMENSION A(50,50),B(50),C(50),TEMP(50,51)

221

Page 12: UVKRIG: A FORTRAN-77 program for universal kriging

222

i0

20

40

50 I00

200

C C C

C C C

C C C

J.R. CARR

DIMENSION LOC(50),CK(50)

MAXIMUM PIVOT METHOD GAUSS-ELIMINATION EQUATION

SOLVER.

DO I I = I,N CK(1) = 0.0 CONTINUE M P = N + I DO i0 I = I,N DO I0 J = I,N TEMP(I,J) = A(I,J) DO 20 I = I,N TEMP(I,MP) = B(1) CONTINUE DO i00 I = I,N I P = I + I AMAX = 0.0 DO 2 K = I,N IF (AMAX - ABS(TEMP(K,I)}) 3,2,2

IF (CK(K)) 4,4,2 LOC(I) = K AMAX = ABS(TEMP(K,I)) CONTINUE CK(LOC(I)} = 1.0 L = LOC(I) DO 50 J = I,N IF (L - J) 6,50,6 F = - TEMP(J,I) / TEMP(L,I)

DO 40 K = IP,MP TEMP(J,K) = TEMP(J,K) + F * TEMP(L,K)

CONTINUE CONTINUE DO 200 I = 1,N L = L O C ( 1 ) C ( I ) = T E M P ( L , M P ) / T E M P ( L , I ) CONTINUE RETURN END SUBROUTINE GRID COMMON /UMAX/ XMAX,YMAX COMMON /VAROAM/ C O , S I I . L , R A N G E , A N G L E ,

H O R I Z , X C O S , X S I N COMMON / U K R I G / Y ( 5 0 0 ) , X ( 5 0 0 ) , X D A T A ( 5 0 0 ) DIMENSION B ( 2 ) , D I S ( 5 0 ) , I H O L ( 5 0 ) , W T ( 5 0 ) , XMEAS(50)

THIS SUBROUTINE CONTROLS GRIDDING. AN OUTPUT F I L E IS FORMED: GRID.OUT OPEN(I,FILE = 'GRID.OUT',STATUS = 'NEW')

READ VARIOGRAM PARAMETERS AND OPTIONS

CALL REOPT(N,ISTAT,KSTAT,RADIUS)

DEFINE THE GRID

READ(5,*) NROW, NCOL, GYMAX, GXMAX, DIMY, DIMX

READ SPATIAL DATA

CALL REDAT(NKOUNT)

ECHO DATA INPUT

CALL ECHO(NKOUNT,N,RADIUS,ISTAT)

START GRIDDING

YMAX = GYMAX XMAX = GXMAX ANGLE = 0.017453292 * ANGLE XCOS = COS(ANGLE) XSIN = SIN(ANGLE) WRITE(*,2000) XBEGIN = (GXMAX - FLOAT(NCOL) * DIMX) -- 0.5 * DIMX YBEGIN = GYMAX + 0.5 * DIMY

Page 13: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program for universal kriging 223

DO 1000 II = 1,NROW B(2) = YBEGIN - FLOAT(II) * DIMY

DO i000 IJ = I,NCOL B(1) = XBEGIN + FLOAT(IJ) * DIMX

FIND THE N CLOSEST POINTS TO (B(1),B(2))

KK = 0

DO 90 JJ = I,NKOUNT DX = B(1) - X(JJ) DY = B(2) - Y(JJ) DIST = SQRT((DX*XCOS + DY*XSIN)**2 * HORIZ *

2 (DY*XCOS - DX*XSIN)**2) IF (DIST .LE. RADIUS) THEN

KK = KK + 1 IHOL(KK) = JJ DIS(KK) = DIST IF (KK .GT. i) THEN

IF (KK .LE. N) THEN CALL HEAP(IHOL,DIS,KK)

ELSEIF (KK .GT. N) THEN KK = N IF (DIST .LT. DIS(N)) THEN

DIS(N) = DIST IHOL(N) = JJ CALL HEAP(IHOL,DIS,KK)

ENDIF ENDIF

ENDIF ENDIF

90 CONTINUE IF (KK .GT. KSTAT) THEN

CALL EUKRIG(IHOL,B,KK,WT,XMEAS,ISTAT,KZ)

EST = 0.0 DUMI = 0.0 DUM2 = 0.0 DO 95 KI = I,KK LL = IHOL(KI) EST = EST + WT(KI) * XDATA(LL) DUMI = DUMI + WT(KI) * XMEAS[KI)

95 CONTINUE DO 96 JI = I,KZ K2 = KK + JI DUM2 = DUM2 + WT(K2) * XMEAS(K2)

96 CONTINUE IF (ISTAT .EQ. 0) DUM2 = WT(KK+I) XKRIG = SILL - DUMI - DUM2 WRITE(*,3000) II,IJ,B(2),B(1),EST,XKRIG WRITE(I,*) II,IJ,B(2),B(1),EST, XKRIG

ENDIF I000 CONTINUE 2000 FORMAT(IHI, 10X, 'GRID RESULTS',//,

2 6X,'ROW',TX,'COL',SX,'Y-COORD', 3 8X,,X-COORD,,TX,'ESTIMATE',2X,'EST.VARIIkNCE',//)

3000 FORMAT(2110,4EI5.4) RETURN END SUBROUTINE ECHO(NKOUNT,N,RADIUS,ISTAT) COMMON /VARGAM/ CO, SILL,RANGE,ANGLE,

2 HORIZ,XCOS,XSIN COMMON /UKRIG/ Y(500), X(500), XDATA(500)

COMMON /UMAX/ XMAX, YMAX

C C THIS SUBROUTINE PRINTS INPUT INFORMATION

C WRITE(*,100) CO,SILL,RANGE,ANGLE,HORIZ

WRITE(*,200) N,RADIUS,ISTAT DO 50 I = I,NKOUNT WRITE(*,300) XDATA(I), Y(1), X(I)

50 CONTINUE WRITE(*,400) XMAX,YMAX

C C C I00

FORMATS FOLLOW

FORMAT(IH0, 10X, 'VARIOGRAM PARAMETERS',//,

Page 14: UVKRIG: A FORTRAN-77 program for universal kriging

224

2 3 4 5 6

200 2 3 4 5 6

300 400

2

C C C I0

20 C C

C

40

J. R. CARR

10X, 'NUGGET = ',E15.4,/, 10X, 'SILL = ',E15.4,/,

10X, 'RANGE = ',E15.4,/, 10X, 'ANGLE OF ANIS. = ',E15.4,/, 10X, 'RATIO OF RANGES = ',E15.4,/)

FORMAT(IH0, 10X, 'ESTIMATION PARAMETERS',//, 10X, '# CLOSE NEIGHBORS = ',I15,/, 10X, 'SEARCH RADIUS = ',E15.4,/, 10X, 'DRIFT ORDER(ISTAT)= ',I15,///,

1HI, 10X, 'SPATIAL DATA',//, 15X,'VALUE',I4X,'Y',I4X,'X',//)

FORMAT(SX,EI5.4,2EI5.4) FORMAT(IH0,9X,'MAX. X-COORD = ',E15.4,/,

10X,'MAX. Y-COORD = ',E15.4,/) RETURN END SUBROUTINE REDAT(NKOUNT) COMMON /UKRIG/ Y(500], X(500), XDATA(500) COMMON /UMAX/ XMAX, YMAX

SUBROUTINE TO READ SPATIAL DATA

READ(5,*,END=20) DUMI, DUM2, DUM3 NKOUNT = NKOUNT + 1 XDATA(NKOUNT) = DUM1 Y(NKOUNT) = DUM2 X{NKOUNT) = DUM3 GO TO I0 CONTINUE

FIND COORDINATE MAXIMA

XMAX = -73057.0 YMAX = XMAX DO 40 I = 1,NKOUNT IF (X(1) .GT. XMAX) XMAX = X(1) IF (Y(1) .GT. YHAX) YMAX = Y(1) CONTINUE RETURN END SUBROUTINE REOPT(N,ISTAT,KSTAT,RADIUS) COMMON /VARGAM/ CO,SILL,RANGE,ANGLE,

HORIZ,XCOS,XSIN

SUBROUTINE FOR VARIOGRAM AND OPTION DEFINITION

READ VARIOGRAM PARAMETERS

READ(5,*) CO,SILL,RANGE,ANGLE,HORIZ

READ ESTIMATION PARAMETERS

READ(5,*) N,RADIUS IF (N .GT. 30) N = 30

READ NON-STATIONARITY PARAMETER:

ISTAT = 0 = STATIONARITY 1 = FIRST ORDER NON-STATIONARITY 2 = 2ND ORDER NON-STATIONARITY 3 = 3RD ORDER NON-STATIONARITY

READ(5,*) ISTAT KSTAT = ISTAT * ISTAT + 2 IF (N .LT. KSTAT) N = KSTAT + 1 RETURN END SUBROUTINE HEAP(RB,RA, N)

FROM: PRESS, ET. AL., NUMERICAL RECIPES PAGES 231 & 232 [SUBROUTINE SORT2]

THIS SUBROUTINE SORTS AN ARRAY, RA, INTO ASCENDING NUMERICAL ORDER USING THE HEAPSORT ALGORITHM, WHII.E ALSO REARRANGING RB.

Page 15: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program for universal kriging 225

10

20

DIMENSION RA(50), RB(50) INTEGER RB,RRB

L=0.5*N+I IR = N

CONTINUE IF (L .GT. i) THEN

L = L - 1 RRA = RA(L) RRB = RB(L)

ELSE RRA = RA(IR) RRB = RB(IR)

RA(IR) = RA(1) RB(IR) = RB{I)

IR = IR - 1

IF (IR .EQ. i) THEN RA(1) = RRA RB(1) = RRB RETURN

ENDIF ENDIF t = L J=L÷L IF (J .LE. IR) THEN

IF (J .LT. IR) THEN IF (RA(J) .LT. RA(J+I))

ENDIF IF (RRA .LT. RA(J)) THEN

RA(1) = RA(J) RB(1) = RB(J) I = J J = J + J

ELSE J=IR÷I

ENDIF GO TO 20 ENDIF RA(1) = RRA RB(1) = RRB

GO TO I0 RETURN END

J = J +

APPENDIX 2

Example Data Listing

1 600.0,2340.0,10.0,0.0,1.0 20,100000.00 2 172.9,108.399,48.281 223.80,107.101,46.473 87.70,103.764,45.577 86.30,102.836,44.976 135.60,102.283,42.259 54.30,100.431,40.756 62.60,97.835,39.856 73.60,95.426,36.237 92.50,97.279,60.390 79.60,93.945,59.645 81.70,89.867,54.978 132.80,88.016,53.169 93.50,87.271,50.149 72.60,85.607,47.284 67.40,82.084,45.028 71.0,95.056,64.926 148.20,92.647,66.444 87.30,89.867,64.944 121.900,87.645,63.444 45.60,85.049,67.984 36.20,83.198,66.479 89.20,81.90,65.578

Page 16: UVKRIG: A FORTRAN-77 program for universal kriging

226 J. R. CARR

109.]0,80.789,64.222 96.0,80.048,63.471 128.50,79.305,62.415 67.90,78.750,61.660 137.10,77.452,60.456 130.40,75.971,59.704 98.70,74.487,57.896 45.70,70.967,54.429 178.70,102.466,49.504 188.40,102.466,47.091 268.0,100.431,49.207 109.70,100.057,51.626 85.10,99.503,54.343 129.40,98.205,52.081 50.50,97.279,49.820 130.40,97.279,56.312 119.70,96.537,54.049 55.30,95.426,52.392 118.60,92.647,55.118 160.30,88.941,59.209 131.90,87.088,61.178 140.30,84.309,63.151

APPENDIX 3

Cross-Validation Results for Drift Orders." O, 1, 2, and 3

UVKRIG A:COALING.DAT

VARIOGRAM PARAMETERS

NUGGET = .6000E*03 SILL = .2340E+04 RANGE = .I000E+02 ANGLE OF ANIS. = .0000E+00 RATIO OF RANGES = .1000E~01

ESTIMATION PARAMETERS

# CLOSE NEIGHBORS = 20 SEARCH RADIUS = .1000E~06 DRIFT ORDER(ISTAT)= 0

SPATIAL DATA

VALUE Y X

.1729E+03

.2238E+03

.8770E+02

.8630E+02

.1356E+03

.5430E+02

.6260E+02

.7360E+02

.9250E+02

.7960E+02

.8170E+02

.1328E+03

.9350E+02

.7260E+02

.6740E+02

.7100E+02 1482E+03 8730E+02 1219E+03 4560E+02 3620E+02 8920E+02 I091E+03 9600E+02 1285E+03

.I084E+03

.I071E+03

.I038E+03

.I028E+03

.I023E+03

.I004E+03

.9783E+02

.9543E+02

.9728E+02

.9394E+02

.8987E+02 8802E+02 8727E+02 8561E+02 8208E+02 9506E+02 9265E+02 8987E+02 8764E+02 8505E÷02 8320E+02 8190E+02 8079E+02 8005E+02 7931E+02

.4828E+02 4647E+02 4558E+02 4498E+02 4226E+02 4076E+02 3986E+02 3624E+02 6039E+02 5965E+02 5498E+02 5317E+02 5015E+02

.4728E+02

.4503E+02

.6493E+02

.6644E+02

.6494E+02

.6344E+02

.6798E+02

.6648E+02

.6558E+02

.6422E+02

.6347E+02

.6242E+02

Page 17: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program for universal kriging 227

.6790E+02

.1371E+03

.1304E+03

.9870E+02

.4570E+02

.1787E+03

.1884E+03

.2680E+03

.I097E+03

.8510E+02

.1294E+03 5050E+02 1304E+03 I197E+03 5530E+02 I186E+03 1603E+03 1319E+03 1403E+03

MAX. X-COORD MAX. Y-COORD

.7875E+02

.7745E+02

.7597E+02

.7449E+02

.7097E+02

.I025E+03

.I025E+03

.I004E+03

.1001E+03

.9950E+02

.9821E+02

.9728E+02

.9728E+02

.9654E+02

.9543E+02

.9265E+02

.8894E+02

.8709E+02

.8431E+02

.6166E+02

.6046E+02

.5970E+02

.5790E+02

.5443E+02

.4950E+02

.4709E+02

.4921E+02

.5163E+02

.5434E+02 5208E+02 4982E+02 5631E+02 5405E+02 5239E+02 5512E+02 5921E+02 6118E+02 6315E+02

= .6798E+02 = .1084E+03

LOC Y X

1 2 3 4 5 6 7 8 9

i0 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 4O 41 42 43 44

.I08E~03

.I07E+03

.I04E+03

.I03E+03

.I02E+03

.100E+03

.978E+02

.954E+02

.973E+02

.939E+02

.899E+02

.880E+02

.873E+02

.856E+02

.821E+02

.951E+02

.926E+02

.899E+02

.876E+02

.850E+02 832E÷02 819E+02 808E+02 800E+02 793E+02 788E+02 775E+02 760E+02 745E+02 710E+02 I02E+03 I02E+03 I00E+03 100E+03 995E÷02 982E+02 973E*02 .973E+02 .965E÷02 .954E+02 .926E+02 .889E+02 .871E+02 .843E+02

483E÷02 465E+02 456E+02 450E+02 423E+02 408E+02 399E~02 362E+02 604E+02 596E+02 550E+02 532E+02 501E+02 473E+02 450E+02 649E+02 664E~02 649E+02 634E+02 680E+02 665E+02 656E+02 642E÷02

.635E+02

.624E+02

.617E+02

.605E+02

.597E+02

.579E+02

.544E+02

.495E+02

.471E+02

.492E÷02

.516E+02

.543E+02 521E+02 498E+02 563E+02 540E+02 524E+02 551E+02 592E+02 612E+02 632E+02

AVERAGE

VALUE

173E+03 224E+03 877E+02 863E+02 136E+03 543E+02 626E+02 736E+02 925E+02 796E+02 817E+02 133E+03

.935E÷02

.726E+02

.674E+02

.710E+02

.148E+03

.873E+02

.]22E+03

.456E+02

.362E+02

.892E+02

.I09E+03

.960E÷02

.129E÷03

.679E+02 137E÷03 130E+03 987E+02 457E+02 179E+03 188E+03 268E+03 IIOE÷03 851E+02 129E+03 505E÷02 130E+03 120E÷03 553E+02 119E+03 160E+03 132E+03 140E+03

ERROR =

ESTIMATE ERROR JNIFE

.164E+03

.135E+03

.150E+03

.133E+03

.767E+02

.939E+02

.821E+02

.948E+02

.I06E+03

.IIOE+03

.128E+03

.919E+02

.I03E+03

.935E+02

.873E+02 I13E+03 841E+02 I19E+03 I15E+03 762E+02 817E÷02 788E+02 957E+02 I09E+03 952E÷02 127E+03 I07E+03 I09E+03 101E+03 947E+02 184E+03 151E+03 125E÷03 149E+03 130E+03 I04E+03

.140E÷03

.966E+02

.898E÷02

.969E+02

.929E+02

.I12E+03

.136E+03

.986E+02

.882E+01

.890E+02 -.625E+02 -.462E+02 .589E+02

-.396E+02 -.195E+02 -.212E+02 -.133E+02 -.302E+02 -.465E+02

409E+02 - 917E+01 - 209E+02 - 199E÷02 - 422E+02

641E+02 - 320E+02

687E+01 - 306E+02 - 455E+02

I04E+02 134E÷02

- 127E+02 333E+02

-.589E+02 .302E+02 .214E+02

-.279E+01 -.490E÷02 -.578E÷01 .376E+02 .143E+03

-.391E+02 -.446E+02 .250E+02

-.896E+02 .338E÷02 .299E+02

-.416E+02 .257E÷02 .479E+02

-.381E÷01 .417E+02

-.149E+01

427E-01 502E+01 325E+01 177E+01 228E+01 102E+01 216E÷00

.195E+00

.947F-01

.526E+00

.145E+01

.104E+01

.494E-01

.237E+00

.177E+00

.986E+00

.242E+01

.652E+00

.337E-01

.529E+00

.159E÷01

.880E-01

.157E+00

.147E+00

.]02E÷01

.305E+01 722E+00 339E+00 459E-02 999E+00 235E--01 1lIE+01 155E÷02 II8E+01 133E÷01 516E+00 513E+01 778E÷00 706E+00 122E+01 422E~00 140E+01 998E-02 II4E+01

VAR

.182E+04

.158E+04

.120E+04

.121E+04

.152E÷04

.]53E+04

.177E÷04

.230E+04 186E+04 174E+04 149E+04 160E÷04 170E+04 184E+04 225E÷04 180E+04 170E+04 157E+04 140E~04 177E+04 130E+04 124E+04 I14E+04 IIOE+04 I09E+04 I14E+04 126E+04 135E+04 169E+04 240E+04 142E+04 128E+04 132E~04 129E+04 149E+04 121E+04 157E+04 147E+04 126E÷04

.142E+04

.]56E~04

.165E+04

.145E+04

.153E+04

AVERAGE SQUARE ERROR = .198E+04

Page 18: UVKRIG: A FORTRAN-77 program for universal kriging

228

Stop

J R CARR

AVERAGE KRIGING VAR.

VARIANCE OF ERR.

JACK KNIFE MEAN

JACK KNIFE VARIANCE - Program terminated.

UVKRIG A:COALING.DAT

VARIOGRAM PARAMETERS

NUGGET = SILL = RANGE = ANGLE OF AN IS. = RATIO OF RANGES =

ESTIMATION PARAMETERS

# CLOSE NEIGHBORS = SEARCH RADIUS DRIFT ORDER(ISTAT)=

SPATIAL DATA

VALUE Y

1729E+03 2238E+03 8770E+02 8630E+02 1356E+03 5430E+02 6260E+02 7360E+02 9250E+02 7960E+02 8170E+02 1328E+03 9350E+02 7260E+02 6740E+02 7100E÷02 1482E+03 8730E+02 1219E+03

.4560E+02

.3620E+02

.8920E+02

.I091E+03

.9600E+02

.1285E+03

.6790E+02

.1371E+03

.1304E+03

.9870E+02

.4570E+02

.1787E+03

.1884E+03

.2680E+03

.I097E+03

.8510E+02

.1294E+03

.5050E+02

.1304E+03

.I197E+03

.5530E+02

.I186E+03

.1603E+03

.1319E+03

.1403E+03

.I084E+03

.I071E+03

.I038E+03

.1028E+03

.I023E+03

.I004E+03

.9783E+02

.9543E÷02

.9728E+02

.9394E+02

.8987E+02

.8802E+02

.8727E+02

.8561E+02

.8208E+02

.9506E+02

.9265E+02

.8987E÷02

.8764E+02

.8505E+02

.8320E+02 8190E÷02 8079E+02 8005E+02 7931E+02 7875E+02 7745E+02 7597E+02 7449E+02 7097E+02 I025E+03 I025E+03 I004E+03 I001E+03 9950E+02 9821E+02 9728E+02 9728E÷02 9654E+02 9543E+02 9265E+02 8894E÷02 8709E+02 8431E÷02

.153E+04

.202E+04

.13SE+01

.614E+01

.6000E+03

.2340E+04

.1000E+02

.0000E+00

.1000E+01

20 .1000E+06

1

X

.4828E+02 4647E÷02 4558E+02 4498E+02 4226E+02 4076E+02 3986E+02 3624E+02 6039E+02 5965E+02 5498E+02 5317E+02 5015E+02 4728E+02 4503E+02 6493E+02 6644E+02 6494E+02 6344E+02 6798E+02 6648E+02 6558E+02 6422E+02 6347E+02 6242E+02 6166E+02 6046E+02 5970E+02 5790E+02 5443E+02 4950E+02 4709E+02 4921E+02 5163E+02 5434E+02 5208E+02 4982E+02 5631E+02 5405E+02 5239E+02 5512E+02 5921E+02 6118E+02 6315E+02

MAX. X-COORD = .6798E+02 MAX. Y-COORD = .I084E+03

Page 19: UVKRIG: A FORTRAN-77 program for universal kriging

LOC

1 2 3 4 5 6 7 8 9

I0 ii 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3O 3] 32 33 34 35 36 37 38 39 4O 41 42 43 44

Stop -

FORTRAN-77program ~runiversalkdging

X VALUE ESTIMATE ERROR

I08E÷03 I07E+03 I04E+03 I03E+03 I02E+03 100E+03 978E+02 .954E+02 .973E+02 .939E+02 .899E+02 .880E+02 .873E÷02 856E~02 821E+02 951E+02 926E+02 899E+02 876E+02 850E+02 832E+02 819E+02 808E+02 800E+02

.793Et02

.788E÷02

.775E÷02

.760E+02

.745E+02

.710E÷02

.I02E÷03

.I02E+03

.100E÷03

.100E+03

.995E+02

.982E+02

.973E+02

.973E÷02

.965E+02

.954E+02

.926E+02

.889E+02

.871E+02

.843E+02

.483E+02

.465E+02

.456E+02

.450E+02

.423E+02

.408E+02

.399E+02

.362E+02 604E÷02 596E+02 550E+02 532E+02 501E÷02 473E+02 450E+02 649E+02 664E+02 649E+02

.634E+02

.680E÷02

.665E+02

.656E+02 642E+02 635E+02 624E+02 617E+02 605E+02 597E+02 579E+02 544E+02 495E+02 471E~02 492E+02 516E+02 543E+02 521E+02 498E+02 563E+02

.540E+02

.524E+02

.551Et02

.592E+02

.612E+02

.632E+02

.173E+03

.224E+03

.877E+02

.863E+02

.136E+03

.543E+02 626E÷02 736E+02 925E+02 796E+02 817E+02 133E+03 935E+02 726E+02 674E+02

.710E+02

.148E+03

.873E+02

.122E+03

.456E+02

.362E+02

.892E+02

.109E+03

.960E+02 129E+03 679E+02 137E+03 130E+03 987Et02 457E+02 179Et03 188E+03 268E+03 110E+03 851Et02

.129E+03

.505Et02

.130E+03

.120E+03

.553E+02

.I19E÷03

.160E+03

.132E÷03

.140E+03

.215E+03 -.424E+02

.148E+03 .756E+02

.152E+03 -.642E~02

.133E+03 -.469E+02

.783E+02 .573E+02

.944E+02 -.401E+02

.746E+02 -.120E+02

.600E+02 .136E+02

.I04E+03 -.1lIE÷02

.IIOE+03 -.302E+02

.128E+03 -.462E+02

.902E+02 .426E+02

.998Et02 -.628E+01

.864E+02 -.138E+02

.511E+02 .163E+02 I09E+03 -.377E+02 658E+02 .824E+02 I17E+03 -.298E+02 I15E÷03 .671E+01 710E+02 -.254E+02 790E÷02 -.428E~02 766E+02 .126E+02 946E+02 .145E+02 108E+03 -.I17E+02 945E÷02 .340E÷02 126E+03 -.582E+02 105E÷03 .319E÷02

.106E+03 .239E+02

.977Et02 .965E.00

.979E+02 -.522E+02

.191E+03 -.120E÷02

.150E+03 384E+02

.125E+03 143Et03

.155E+03 - 456E+02

.133E÷03 - 478E+02 I04E+03 257E+02 135E÷03 - 847E+02 974E+02 330E+02 899E+02 298E+02 961E+02 - 408E+02 932E+02 .254E+02 I12E+03 .478E+02 136E÷03 -.444E+01 100E+03 .400E+02

AVERAGE ERROR = -.251E+00

AVERAGE SQUARE ERROR =

AVERAGE KRIGING VAR. =

VARIANCE OF ERR. =

JACK KNIFE MEAN =

JACK KNIFE VARIANCE = Program terminated.

.200E+04

.164E+04

.204E+04

.135E+01

.592E÷01

JNIFE

.775E÷00 345E+01

.343E+01 183E+01 210E+01 103E+01 797E-01 534E-01 618E-01 526E+00 143E+01 .II2E÷01 .228E-01 .102E+00 .987E-01 .718E+00 .367E+01 .564E+00 321E-01 316E+00 139E÷01 128E+00 184E+00 125E+00 106E+01 298E+01 802E+00 417E+00 533E-03 715E+00 102E*00

.II6E+01

.154E+02

.159E+01

.151E+01

.546E÷00

.454E+01

.739E+00

.702E÷00

.II7E+01

.415E+00

.139E+01

.136E-01

.104E+01

229

V ~

.232E+04

.166E+04

.120E+04

.121E+04

.156E+04

.156E+04 .180E+04 .348E+04 .199E+04 .174E+04 .149E+04 .161E+04 173E÷04 187E+04 268E+04 198E+04 185E+04 158E+04 140E+04 203E~04 132E+04 125E+04 I14E+04 1fIEf04 I09E+04 I14E+04 127E÷04 137E+04

.175E÷04

.381E+04

.143E÷04

.128E+04

.132E+04

.130E+04

.152E+04

.121E+04

.158E÷04

.148E+04

.126E*04

.142E+04

.156E*04

.165E+04

.146E+04

.153E+04

C:\~

UVKRIG K:COALING.DAT

VARIOGRAM PARAMETERS

NUGGET = SILL = RANGE = ANGLE OF ANIS. = RATIO OF RANGES =

.6000E+03

.2340E+04

.1000E+02

.0000E+00

.1000E÷01

ESTIMATION PARAMETERS

Page 20: UVKRIG: A FORTRAN-77 program for universal kriging

230 J. R. CARR

# CLOSE NEIGHBORS = SEARCH RADIUS DRIFT ORDER(ISTAT)=

SPATIAL DATA

VALUE Y

20 .1000E+06

2

X

1729E+03 2238E+03 8770E~02 8630E+02 1356E+03 5430E+02

.6260E+02

.7360E+02

.9250E+02

.7960E+02

.8170E+02

.1328E+03

.9350E+02 7260E+02 6740E+02 7100E+02 1482E+03 8730E+02 1219E+03 4560E+02 3620E+02 8920E÷02 I091E+03

.9600E+02

.1285E+03

.6790E+02

.1371E+03

.1304E+03

.9870E+02

.4570E+02

.1787E+03

.1884E+03

.2680E~03

.[097E+03 8510E+02 1294E+03 5050E+02 1304E+03 I197E+03 5530E+02 I186E+03 1603E÷03

.1319E+03

.1403E+03

MAX. X-COORD = MAX. Y-COORD =

I084E+03 I071E+03 I038E+03 I028E+03 I023E+03 1004E+03 9783E+02 9543E+02 9728E+02 9394E÷02 8987E+02 .8802E+02 8727E+02 8561E+02 8208E+02 9506E+02 9265E+02 8987E+02 8764E+02 8505E+02 8320E+02 8190E+02 8079E+02 8005E÷02 7931E+02 7875E+02 7745E+02 .7597E÷02 .7449E+02 .7097E+02 .I025E+03 .I025E+03 .I004E+03 .1001E+03 .9950E+02 .9821E+02 9728E+02 9728E+02 9654E+02 9543E+02 9265E+02 8894E÷02 8709E+02

.8431E+02

.4828E+02

.4647E+02

.4558E+02

.4498E÷02

.4226E+02

.4076E+02

.3986E+02

.3624E+02

.6039E+02 5965E+02 5498E+02 5317E+02 5015E+02 4728E+02 4503E+02 6493E+02 6644E+02 6494E÷02 6344E+02 6798E+02 6648E+02 6558E+02 .6422E+02 .6347E+02 .6242E+02 .6166E*02 .6046E+02 5970E+02 5790E+02 5443E+02 4950E+02 4709E+02 4921E+02 5163E+02 5434E+02 5208E+02 4982E+02 5631E+02 5405E+02 5239E+02

.5512E+02

.5921E+02

.6118E+02

.6315E+02

.6798E+02

.]084E÷03

LOC Y X

]

2 3 4

5 6 7 8 9

I0 11 12 13 14 15

.108E÷03

.I07E+03

.I04E+03

.I03E+03

.102E+03

.100E÷03

.978E~02

.954E+02

.973E+02

.939E+02"

.899E+02

.880E+02

.873E+02

.856E+02

.821E+02

.483E+02

.465E+02

.456E~02

.450E+02

.423E÷02 408E÷02 399E+02 362E+02 604E+02 596E+02 550E+02 532E+02 501E+02 473E÷02 450E+02

VALUE

173E403 224E+03 877E+02 863E+02 ]36E÷03 543E+02 626E+02 736E+02 925E+02 .796E+02 .817E÷02 .133E+03 .935E+02 .726E+02 .674E÷02

ESTIMATE

.273E+03

.144E+03

.153E+03

.134E+0]

.804E+02

.983E+02

.642E~02 -.I19E+02 .876E+02 I16E+03 130E+03 987E+02 933E+02 814E+02 667E,02

ERROR

-.]00E÷03 .798E+02

-.650E~02 -.472E+02 .552E+02

-.440E~02 -.163E+01 .855E+02 .485E÷01

-.367E+02 -.480E+02 ,341E+02 .211E÷00

-.885E+01 .675E+00

JNIFE

247E+01 353E+01 348E~0] 184E+01 183E+01 11BE+01

.137E-02

.851E+00

.I03E-01

.733E÷00

.152E+01

.682E+00

.246E-04

.393E-01

.I03E-03

VAR

.407E~04

.181E+04

.121E÷04

.121E+04

.166E~04

.164E+04

.193E+04

.859Et04 228E÷04 184E+04 151E+04 170E+04 180E÷04 199E+04 444E+04

Page 21: UVKRIG: A FORTRAN-77 program for universal kriging

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 4O 41 42 43 44

Stop

FORTI~-~N-77 program for universal krigmg

.951E+02

.926E+02

.899E+02

.876E+02

.850E+02

.832E+02

.819E+02

.808E+02

.800E+02

.793E+02

.788E+02

.775E+02

.760E+02

.745E+02

.710E+02

.I02E+03

.I02E+03

.100E+03

.100E+03

.995E+02

.982E+02

.973E+02 973E+02 965E+02 954E+02 926E+02 889E+02 871E+02 843E+02

.649E+02

.664E+02

.649E+02

.634E+02

.680E*02

.665E+02

.656E+02

.642E+02

.635E+02 624E+02 617E+02 605E+02 597E+02 579E+02 544E+02 495E+02 471E+02 492E+02 516E+02 543E+02 521E+02 498E+02 563E+02 540E+02 524E+02 551E+02 592E+02 612E+02 632E+02

710E+02 148E+03 873E+02 122E+03 456E+02 362E+02 892E+02 109E+03 960E+02 129E+03 679E+02 137E+03 130E+03 987E+02 457E+02 179E+03 188E+03 268E+03 IIOE+03 851E+02

.129E+03

.505E+02

.130E+03

.120E+03

.553E+02

.119E+03

.160E+03

.132E÷03

.140E+03

131E+03 585E+02 121E+03 117E+03 466E+02 752E÷02 697E+02 926E+02 I06E+03

.954E+02

.131E+03

.I12E+03

.I05E+03

.112E÷03

.622E+02

.191E+03

.148E+03

.126E+03

.155E+03 -

.134E+03 -

.I04E÷03

.136E+03 -

.928E+02

.913E+02

.952E+02 -

.883E+02

.I18E+03

.146E+03 -

.I13E+03

-.602E÷02 .897E+02

-.342E+02 .503E+01

-.104E+01 -.390E+02 .195E+02 .165E+02

-.970E+01 .331E+02

-.632E+02 .250E÷02 .257E+02

-.135E÷02 -.165E+02 -.122E+02

401E+02 142E+03 457E+02 487E+02 253E+02 853E+02 376E+02 284E+02 399E+02 303E+02 421E+02 137E+02 270E+02

AVERAGE ERROR = 302E+00

AVERAGE SQUARE ERROR = 236E+04

AVERAGE KRIGING VAR. = 204E+04

VARIANCE OF ERR. = 241E+04

JACK KNIFE MEAN ]38E+01

JACK KNIFE VARIANCE = - Program terminated.

582E+01

153E+01 383E+01 717E+00 176E-01 394E-03 I13E+01 295E+00 236E+00 843E-01 100E+01 349E+01 489E+00 469E+00 102E+00 286E-01 101E+00

.124E+01

.151E+02

.160E+01

.150E+01

.525E+00

.437E+01

.945E+00

.634E+00

.109E+01

.575E+00

.105E+01

.124E+00

.432E+00

236E÷04 210E*04 163E+04 144E+04 273E+04 134E+04 128E+04 I16E÷04 I12E+04 I09E+04 I14E+04 128E+04 141E+04

.179E+04

.949E+04

.146E+04

.130E~04

.134E+04

.131E+04

.158E÷04

.122E÷04

.166E+04

.149E+04

.127E+04

.147E÷04

.160E+04

.169E+04

.151E+04

.168E÷04

23

C:\>

UVKRIG COALING.DAT

VARIOGRAM PARAMETERS

NUGGET = SILL = RANGE = ANGLE OF ANIS. = RATIO OF RANGES =

.6000E+03

.2340E+04

.1000E+02

.0000E+00

.1000E+01

ESTIMATION PARAMETERS

# CLOSE NEIGHBORS = SEARCH RADIUS = DRIFT ORDER(ISTAT)=

SPATIAL DATA

20 .1000E+06

3

VALUE Y X

1729E+03 2238E+03 8770E+02 8630E+02 1356E+03 5430E~02 6260E+02 7360E+02

1084E+03 I07]E+03 I038E+03 I028E÷03 I023E+03 I004E+03 9783E+02 9543E+02

.4828E+02 4647E+02 4558E+02 4498E÷02 4226E+02 4076E+02 3986E+02 3624E+02

Page 22: UVKRIG: A FORTRAN-77 program for universal kriging

232

.9250E+02

.7960E+02

.8170E+02

.1328E+03

.9350E+02

.7260E+02

.6740E+02

.7100E+02

.1482E+03

.8730E+02

.1219E+03

.4560E+02

.3620E+02

.8920E+02

.I091E+03

.9600E+02

.1285E+03

.6790E+02

.1371E+03

.1304E+03

.9870E+02

.4570E+02

.1787E+03

.1884E+03

.2680E+03

.1097E+03

.8510E+02

.1294E+03

.5050E+02

.1304E+03

.1197E+03

.5530E+02

.I186E+03

.1603E+03

.1319E+03

.1403E+03

MAX. X-COORD = MAX. Y-COORD =

J. R. CA~,R

.9728E+02

.9394E+02 8987E+02 ,8802E+02 8727E+02 8561E+02 8208E+02 9506E+02 9265E+02 8987E+02 8764E+02 8505E+02 .8320E+02 .8190E+02 .8079E+02 .8005E+02 .7931E+02 .7875E+02 .7745E+02 7597E+02 7449E+02 7097E+02 1025E+03 1025E+03 1004E+03 .1001E+03 .9950E+02 .9821E+02 .9728E+02 .9728E+02 .9654E+02 .9543E+02 .9265E+02 .8894E+02 .8709E+02 .8431E+02

.6039E+02 5965E+02 5498E+02 5317E+02 5015E+02 4728E+02 4503E+02

.6493E+02

.6644E+02

.6494E+02

.6344E+02

.6798E+02

.6648E+02

.6558E+02

.6422E+02

.6347E+02

.6242E+02

.6166E+02

.6046E+02

.5970E+02

.5790E+02

.5443E+02

.4950E+02

.4709E+02 4921E+02 5163E+02 5434E+02 5208E+02 4982E+02 5631E+02 5405E+02 5239E+02 .5512E+02 .5921E+02 .6118E+02 .6315E+02

.6798E+02

.I084E+03

LOC Y X VALUE ESTIMATE ERROR JNIFE VAR

1 I08E+03 .483E+02 .173E+03 .262E+03 -.888E+02 .198E+01 .397E+04 2 I07E+03 .465E+02 .224E+03 .172E+03 .519E+02 .161E+01 .167E+04 3 I04E+03 .456E+02 .877E+02 .154E+03 -.659E+02 355E÷01 .122E+04 4 I03E+03 .450E+02 .863E+02 .131E+03 -.450E+02 164E+01 .124E+04 5 I02E+03 .423E+02 136E÷03 .258E+02 .IIOE+03 483E+01 .249E+04 6 100E+03 .408E+02 543E+02 .I02E+03 -.474E+02 143E+01 .157E+04 7 978E+02 .399E~02 626E+02 .360E+02 .266E+02 279E+00 .254E+04 8 .954E+02 .362E+02 736E+02 -.I16E+03 .189E+03 261E+01 .137E+05 9 .973E+02 .604E+02 925E~02 .716E+02 .209E+02 .184E+00 .237E+04

i0 .939E+02 596E+02 796E+02 .I18E+03 -.384E+02 .794E+00 .186E+04 ii .899E+02 550E+02 817E+02 .129E~03 -.469E+02 .146E+01 .151E+04 12 .880E+02 532E+02 133E+03 987E+02 .341E+02 .625E+00 .186E+04 13 .873E+02 501E+02 .935E+02 887E+02 .484E+01 .132E-01 .177E+04

14 .856E+02 473E+02 .726E+02 15 .821E÷02 450E+02 .674E+02 16 .951E+02 649E+02 .710E+02 17 .926E÷02 664E+02 .148E+03 18 .899E+02 .649E+02 .873E+02 19 .876E+02 .634E+02 122E+03 20 .850E+02 .680E+02 456E+02 - 21 .832E+02 .665E+02 22 .819E+02 .656E+02 23 .808E+02 .642E+02 24 .800E+02 .635E+02 25 .793E+02 624E+02 26 .788E+02 617E+02 27 .775E+02 605E+02 28 .760E+02 29 .745E+02 30 .710E+02 31 .I02E+03 32 .I02E+03 33 .100E+03

165E+03 -.923E+02 547E~01 .156E+04 326E+02 .348E+02 288E+00 .421E+04 141E+03 -.698E+02 213E+01 .228E+04 519E+02 .963E+02 451E+01 .206E+04 130E+03 -.425E+02 107E+01 .169E+04 126E+03 -.413E+01 II4E-01 .149E+04 339E+02 .795E+02 201E+01 .314E+04

362E+02 757E+02 -.395E+02 .II6E+01 135E+04 892E+02 .724E+02 .168E+02 .218E+00 129E+04 I09E+03 .930E+02 .161E+02 .225E+00 I16E+04 960E+02 .I06E+03 -.I02E+02 .936E-01 I12E+04 129E+03 .960E+02 .325E÷02 .965E+00 IIOE+04 679E+02 .132E+03 -.636E+02 .353E+01 I15E+04 137E+03 .I13E+03 .243E÷02 .469E+00 .126E+04

597E+02 130E+03 .I13E+03 .171E+02 .166E+00 .175E+04 579E+02 .987E+02 .I15E+03 -.162E+02 .143E+00 .184E+04 544E+02 .457E+02 .673E+02 -.216E+02 .450E-01 .I03E+05 495E+02 .179E+03 .190E+03 -.I17E+02 .943E-01 .145E+04 471E+02 .188E+03 .146E+03 .420E+02 .131E+01 .135E+04 492E+02 .268E+03 .122E+03 .146E+03 .157E+02 .135E+04

Page 23: UVKRIG: A FORTRAN-77 program for universal kriging

34 .100E+03 35 .995E+02 36 .982E+02 37 .973E+02 38 .973E+02 39 .965E+02 40 .954E+02 41 .926E+02 42 .889E+02 43 .871E+02 44 .843E+02

FORTRAN-77 program for universal kriging

.516E+02

.543E+02

.521E+02

.498E+02

.563E+02 540E+02 524E+02 551E+02 592E+02 612E+02 632E+02

IIOE+03 851E+02 129E+03 505E+02 130E+03 120E+03 553E+02

.I19E+03

.160E+03

.155E+03 -.448E+02 .154E+01

.129E+03 - 437E+02 .130E+01

.I04E*03 254E+02 .529E+00

.144E+03 - 933E+02 .581E+01

.906E+02 398E+02 .106E+01

.940E+02 257E+02 .519E+00

.980E+02 - 427E+02 .124E+01

.905E+02 281E+02 .494E+00

.I18E+03 428E+02 .109E+01 .132E+03 .201E+03 -.692E+02 .303E+01 .140E+03 .I17E+03 .235E+02 .315E+00

AVERAGE ERROR = .296E+01

AVERAGE SQUARE ERROR :

AVERAGE KRIGING VAR. =

.369E+04

.221E+04

VARIANCE OF ERR. = .377E+04

JACK KNIFE MEAN = .176E+01

JACK KNIFE VARIANCE = Stop - Program terminated.

.688E+01

A:\>

130E+04 148E+04 122E+04 150E+04 149E+04 127E+04 146E+04 160E+04 .168E+04 .158E+04 .175E+04

233

APPENDIX 4

Listing of BASIC Program for Conversion of Gridded Output Prior to Contouring

i0 DIM A(60,60) I00 DEFINT I-N 105 INPUT "ENTER INPUT FILENAME", FILEI$ Ii0 OPEN FILEI$ FOR INPUT AS #i 120 INPUT "ENTER NUMBER OF ROWS IN GRID", NROW 125 INPUT "ENTER NUMBER OF COLS IN GRID", NCOL 126 INPUT "ENTER XMIN,XMAX,YMIN,YMAX", XMIN,XMAX,YMIN,YMAX

127 PRINT XMIN,XMAX,YMIN,YMAX 130 INPUT "ENTER OUTPUT FILENAME: NAME.GRD", FILES 180 OPEN FILES AS #2 LEN=4 200 FIELD #2, 4 AS VERIFY$ 220 LSET VERIFY$ = "DSPM": PUT #2 240 FIELD #2, 2 AS BYTEI$, 2 AS BYTE2$ 260 LSET BYTEI$=MKI$(NROW) 270 LSET BYTE2$=MKI$(NROW): PUT #2 280 FIELD #2, 4 AS SP$ 300 LSET SP$=MKS$(XMIN): PUT #2 320 LSET SP$=MKS$(XMAX): PUT #2 340 LSET SP$=MKS$(YMIN): PUT #2 360 LSET SP$=MKS$(YMAX): PUT #2 380 LSET SP$=MKS$(0): PUT #2 400 LSET SP$=MKS$(0): PUT #2 420 ZLO=9.9E+30: ZHI=-ZLO 421 FOR Ill = 1 TO NROW 422 FOR JJJ = 1 TO NCOL 423 INPUT #i, KKK, LLL, IY, IX, A(III,JJJ), XXX 424 NEXT JJJ: NEXT III 440 FOR IY = NROW TO 1 STEP -i 500 FOR IX = 1 TO NCOL 612 Z = A(IY, IX) 620 IF Z<ZLO THEN ZLO=Z 640 IF Z>ZHI THEN ZHI = Z 660 LSET SP$=MKS$(Z): PUT #2 680 NEXT 700 NEXT 720 LSET SP$=MKS$(ZLO): PUT #2,7 740 LSET SP$=MKS$(ZHI): PUT #2,8 760 CLOSE #2 780 END

Page 24: UVKRIG: A FORTRAN-77 program for universal kriging

234 J. R. CARR

APPENDIX 5

Listing of EQSOLV. an Alternate Equation Solver

In subroutine EUKRIG,

replace the call to

CALL EQSOLV(A,U,WT,KK,ISTAT,KZ) subroutine SOLN3 with this call statement.

C C C

i0

20

30

40

50

55

60

70

SUBROUTINE EQSOLV(A,U,C,N,M,K) OIMENSION A(41,41),U(50),C(50),B(30,11),BT(II,30),

SIG(41,41),XMU(II),CI(50),C2(II), DC(30 ,11 I ,DI (50 ) ,E ( l l , l l l ,G( l l ) ,XID( l l , l l ) , EIIlI,II),BII50),H(50I,X(50I,TEMP(II,II)

IF (M .GT. 0) THEN

STEP i: SOLVE FOR MU-BAR; IA: FORM DC

DO i0 I = 1,N CI(I) = U(1) DO I0 J = I,N SIG(I,J) = A(I,J) CONTINUE IF (M .EQ. i) THEN

DO 20 I = I,N DO 20 J = 1,3 K = N * J B(I,J) = A(I,K) BT(J,I) = B(I,J)

CONTINUE K=3

ELSEIF (M .EQ. 2) THEN DO 30 I = I,N DO 30 J = 1,6 K = N + J B(I,J) = A(I,K) BT(J,I) = B(I,J) CONTINUE K=6

ELSEIF (M .EQ. 3) THEN DO 40 I = I,N DO 40 J = 1,10 K = N + J B(I,J) = A(I,K) BT(J,I) = B(I,J) CONTINUE K = i0

ENDIF DO 50 I = I,K L = N + I C2(I) = U(L) CONTINUE L Z = N ÷ K CALL SOLN2(SIG, B,DC,N,K) CALL SOLN (SIG,CI,DI,N)

DO 55 II = I,K DO 55 JJ = I,K E(II,JJ) = 0.0 DO 55 KK = I,N E(II,JJ) = E(II,JJ) + BT(II,KK) * DC(KK,JJ)

CONTINUE DO 60 IJ = I,K

G(II) = 0.0 DO 60 JJ = ],N G(II) = G(II} + BT(II,JJ) * DI(JJ)

CONTINUE DO 70 II = I,K G1 = G(II) - C2(II) G(II) = G1 CONTINUE CALL SOLN3(E,G, XMU,K)

Page 25: UVKRIG: A FORTRAN-77 program for universal kriging

FORTRAN-77 program for universal kriging 235

i00 C

120

130

140

i0

20

26

29 30

40 50

i0

20

26

27 30

40

STEP 2: USING MU-BAR, SOLVE FOR THE WEIGHTS, LAMBDA

DO i00 II = 1,N BI(II) = 0.0 DO 100 JJ = 1,K BI(II) = BI(II) + DC(II,JJ) * XMU(JJ)

CONTINUE CALL SOLN(SIG,BI,H,N) DO 120 II = I,N C(II) -- DI(II) - BI(II) CONTINUE DO 130 II = I,K L = N + II C(L) = XMU(II) CONTINUE

ELSEIF (M .EQ. 0) THEN L = N + 1 CALL SOLN (A,U,X,L) DO 140 I = ],L C(1) : X(1) CONTINUE

ENDIF RETURN END SUBROUTINE SOLN(A,B, X,N) DIMENSION A(41,41), X(50), B(50), TEMP(41,42)

MP = N ¢ i DO i0 I = I,N DO i0 J = I,N TEMP(I,J) = A(I,J) DO 20 I = I,N TEMP(I,MP) = B([) CONTINUE DO 30 I = I,N IP = I + I DO 30 J = I,N IF (TEMP(I,I) .EQ. 0.0) GO TO 50 IF (I J) 26,30,26 F = - (TEMP(J,I) / TEMP(I,I)) DO 29 K = IP,MP TEMP(J,K) = TEMP(J,K) + F*TEMP(I,K) CONTINUE DO 40 I = I,N IM = N + 1 X(1) = TEMP(I,IM) / TEMP(I,I) RETURN END SUBROUTINE SOLN2(A, B,C,N,M) DIMENSION A(41,41), B(30,11), C(30,II), TEMP(41,52) MP = N + M DO i0 I = I,N DO I0 J = I,N TEMP(I,J) = A(I,J) DO 20 I = I,N DO 20 J = I,M K = N + J TEMP(I,K) :: B(I,J) CONTINUE DO 30 [ = I,N IP = I ~ ] DO 30 K = I,N IF (TEMP(I,I) .EQ. 0.0) GO TO 30 IF (I - K) 26,30,26 F = -- (TEMP(K,I) / TEMP(I,I)) DO 27 L = IP,MP TEMP(K,L) = TEMP(K,L) * F * TEMP(I,L) CONTINUE DO 40 I = I,N DO 40 J = I,M K = N ¢ J

IF (TEMP(I,I) .EQ. 0.0) GO TO 40 C(I,J) = TEMP(I,K) / TEMP(I,I) CONTINUE RETURN END

CP, G~O 15:2-5

Page 26: UVKRIG: A FORTRAN-77 program for universal kriging

236

1

i0

2O

3 4

2

6

40

5O I00

200

J .R . CAKR

SUBROUTINE SOLN3(A,B,C,N) DIMENSION A(II,II),B(II),C(II),TEMP(II,22)

DIMENSION LOC(II),CK(II) DO I I = I,N CK(I) = 0.0 CONTINUE M P = N + I DO i0 I = I,N DO I0 J = I,N TEMP(I,J) = A(I,J) DO 20 I = I,N TEMP(I,MP) = SNGL(B(1)) CONTINUE DO i00 I = I,N IP = I + 1 AMAX = 0.0 DO 2 K = I,N IF (AMAX - ABS(TEMP(K,I))) 3,2,2 IF (CK(K)) 4,4,2 LOC(1) = K AMAX = ABS(TEMP(K,I)) CONTINUE L : LOC(I) CK(L) = 1.0 DO 50 J = I,N IF (L - J) 6,50,6 F = - TEMP(J,I) / TEMP(L,I) DO 40 K = IP,MP TEMP(J,K) = TEMP(J,K) + F * TEMP(L,K)

CONTINUE CONTINUE DO 200 I ~ I,N L = LOC(1) C(I) = TEMP(L,MP) / TEM~(L,I) CONTINUE RETURN END