NADCON5-ng  0.0.1
NADCON5 Next Generation
NADCON5 Core Library

Programs and Functions which are responsible for computing the grid transformations used to build NADCON5. More...

Programs, Functions, and Subroutines

program addem
 Part of the NADCON5 NADCON5 Core Library , adds one grid to another. More...
 
program b2xyz
 Part of the NADCON5 NADCON5 Core Library , converts *.b grid to xyz More...
 
program convlv
 Part of the NADCON5 NADCON5 Core Library , Convolves two grids. More...
 
program decimate
 Part of the NADCON5 NADCON5 Core Library , Extract a reduced (1 of n) dataset. More...
 
program gabs
 Part of the NADCON5 NADCON5 Core Library , Convert values in a *.b grid to absolute value. More...
 
program gscale
 Part of the NADCON5 NADCON5 Core Library , Scales a grid by a factor. More...
 
program gsqr
 Part of the NADCON5 NADCON5 Core Library , Squares values in a *.b grid. More...
 
program gsqrt
 Part of the NADCON5 NADCON5 Core Library , Square Root of values in a *.b grid. More...
 
program regrd2
 Part of the NADCON5 NADCON5 Core Library , regrid data. More...
 
program subtrc
 Part of the NADCON5 NADCON5 Core Library , Subtract one grid from another. More...
 
program xyz2b
 Part of the NADCON5 NADCON5 Core Library , Converts GMT *.grd to a *.b NADCON style grid file. More...
 
subroutine bicubic (z, glamn, glomn, dla, dlo, nla, nlo, maxla, maxlo, xla, xlo, val)
 Subroutine to perform a 2-D cubic ("bicubic") interpolation. More...
 
subroutine bilin (data, glamn, glomn, dla, dlo, nla, nlo, maxla, maxlo, xla, xlo, val)
 Subroutine to perform bilinear interpolation. More...
 
subroutine biquad (z, glamn, glomn, dla, dlo, nla, nlo, maxla, maxlo, xla, xlo, val)
 Subroutine to perform a 2-D quadratic ("biquadratic") interpolation. More...
 
subroutine bwplotcv (ele, fname, bw, be, bs, bn, jm, b1, b2, maxplots, olddtm, newdtm, region, elecap, ij, igridsec, fn)
 Subroutine to make GMT calls to do a B/W coverage plot. More...
 
subroutine bwplotvc (ele, fname, bw, be, bs, bn, jm, b1, b2, maxplots, olddtm, newdtm, region, elecap, ij, xvlon, xvlat, xllon, xllat, lorvog, lorvopc, igridsec, fn)
 Subroutine to make GMT calls to do a B/W vector plot. More...
 
subroutine coplot (ele, fname, bw, be, bs, bn, jm, b1, b2, maxplots, olddtm, newdtm, region, elecap, ij, cptlo, cpthi, cptin6, suffixused, igridsec, fn)
 Subroutine to make GMT calls to do Color Raster Rendering of Gridded Data. More...
 
subroutine coplotwcv (ele, fname, bw, be, bs, bn, jm, b1, b2, maxplots, olddtm, newdtm, region, elecap, ij, cptlo, cpthi, cptin6, suffixused, igridsec, fn, cvfname)
 Subroutine to make GMT calls to do a color raster rendering of gridded data, with coverage overlaid. More...
 
subroutine cpt (ave, std, csm, xlo, xhi, xin)
 This subroutine generates the color pallette variables for a GMT color plot. More...
 
subroutine cpt2 (med, csm, xlo, xhi, xin)
 This subroutine generates the color pallette variables for a GMT color plot. More...
 
real function cubterp (x, f0, f1, f2, f3)
 This function fits a cubic function through four points. More...
 
subroutine getgridbounds (region, xn, xs, xw, xe)
 Subroutine to collect up the GRID boundaries for use in creating NADCON 5. More...
 
subroutine getmag (x, ix)
 Subroutine to return the magnitude of a double precision value. More...
 
subroutine getmapbounds (mapflag, maxplots, region, nplots, olddtm, newdtm, bw, be, bs, bn, jm, b1, b2, fn, lrv, rv0x, rv0y, rl0y)
 Subroutine to collect up the MAP boundaries for use in creating NADCON 5. More...
 
subroutine gridstats (fname, ave, std, med)
 Subroutine to print grid statistics to stdout. More...
 
subroutine indexxd (n, nd, arr, indx)
 Subroutine to perform ?? indexing on floating point data (double precision) More...
 
subroutine indexxi (n, nd, arr, indx)
 Subroutine to perform ?? indexing on integer data. More...
 
integer *2 function iselect2 (k, n, arr, nmax)
 Function to select an element of a partially filled, but packed multi dimensional array, integer*2 More...
 
real *4 function onzd (x)
 Function to round a digit to one significant figure (one non zero digit), single precision. More...
 
real *8 function onzd2 (x)
 Function to round a digit to one significant figure (one non zero digit), double precision. More...
 
subroutine plotcoast (region, ifnum)
 Subroutine to write GMT-based commands to create a shoreline Write GMT-based commands to create a shoreline based on region. More...
 
real function qterp (x, f0, f1, f2)
 This function fits a quadratic function through 3 points. More...
 
real *8 function select2 (k, n, arr, nmax)
 Function to select an element of a partially filled, but packed multi dimensional array, double precision. More...
 
real *4 function select2 (k, n, arr, nmax)
 Function to select an element of a partially filled, but packed multi dimensional array, single precision. More...
 
subroutine vecstats (fname, n)
 Subroutine to tell us how many thinned vectors were used to make a grid. More...
 

Detailed Description

Programs and Functions which are responsible for computing the grid transformations used to build NADCON5.

The programs here can be considered "Library" Programs, or functions, which do the raw work of computing various transformations and conversions from *.b NADCON binary grid to a GMT style *.grd

Function Documentation

program addem ( )

Part of the NADCON5 NADCON5 Core Library , adds one grid to another.

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileAFirst Input File Name
infileBSecond Input File Name
outfileOutput File Name of A+B

Program Inputs:

  • lin1 Input File A
  • lin2 Input File B
  • lout Output File to Write A+B

Definition at line 20 of file addem.f.

program b2xyz ( )

Part of the NADCON5 NADCON5 Core Library , converts *.b grid to xyz

Program to convert standard "*.b" grid formatted data to a binary xyz (lon, lat, value) list, which can then be used by GMT for various things (like running the GMT routine "xyz2grd", to get a "*.grd" file, which is useful for plotting, etc)

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput File Name

Program Inputs:

  • Input File defined by infile

Program Outputs:

  • temp.xyz

Definition at line 27 of file b2xyz.f.

subroutine bicubic ( real*4, dimension(maxla,maxlo)  z,
  glamn,
  glomn,
  dla,
  dlo,
  nla,
  nlo,
  maxla,
  maxlo,
  xla,
  xlo,
  val 
)

Subroutine to perform a 2-D cubic ("bicubic") interpolation.

Performs interpolation at location "xla,xlo" off of grid "z", whose header information is the standard ".b" header information with additional inputs

Parameters
[in]zInput Grid
[in]glamnminimum latitude (real*8 decimal degrees)
[in]glomnminimum longitude (real*8 decimal degrees)
[in]dlalatitude spacing (real*8 decimal degrees)
[in]dlolongitude spacing (real*8 decimal degrees)
[in]nlanumber of lat rows (integer*4)
[in]nlonumber of lon cols (integer*4)
[in]maxlaactual dimensioned size of "z" in rows
[in]maxloactual dimensioned size of "z" in cols
[in]xlalat of pt for interpolation (real*8 dec. deg)
[in]xlolon of pt for interpolation (real*8 dec. deg)
[out]valinterpolated value (real*8)

Method:

Fit a 4x4 window over the random point. Unless the point is less than one grid spacing from the edge of the grid, it will fall in the inner 2x2 cell, and the 4x4 cell will be centered upon that.

Thus, if our point of interest is the asterisk, the window will look like this:

       .  .  .  .
       .  .  .  .
       .  .* .  . 
       .  .  .  .

Definition at line 37 of file bicubic.f.

Referenced by checkgrid().

37 
38 c - Data is assumed real*4
39  implicit real*8 (a-h,o-z)
40  real*4 z(maxla,maxlo)
41 
42 c - Internal use
43  real*4 x,y,fx0,fx1,fx2,fx3,cubterp
44 
45 c - Find which row should be LEAST when fitting
46 c - a 4x4 window around xla.
47  difla = (xla - glamn)
48  ratla = difla / dla
49  jla = int(ratla)
50 c - Fix any edge overlaps
51  if(jla.lt.1)jla = 1
52  if(jla.gt.nla-3)jla = nla-3
53 
54 c - Find which column should be LEAST when fitting
55 c - a 4x4 window around xlo.
56  diflo = (xlo - glomn)
57  ratlo = diflo / dlo
58  jlo = int(ratlo)
59 c - Fix any edge overlaps
60  if(jlo.lt.1)jlo = 1
61  if(jlo.gt.nlo-3)jlo = nlo-3
62 
63 c - In the range of 0(westernmost) to
64 c - 3(easternmost) col, where is our
65 c - random lon value? That is, x must
66 c - be real and fall between 0 and 3.
67 c - (Note, unless it is near an edge,
68 c - it will always be between 1 and 2)
69 
70  x=(xlo-dlo*(jlo-1)-glomn)/dlo
71 
72  if(x.lt.0.0)then
73  write(6,100)x
74  stop
75  endif
76  100 format(
77  *'FATAL in bicubic: x<0 : ',f20.10)
78 
79  if(x.gt.3.0)then
80  write(6,101)x
81  stop
82  endif
83  101 format(
84  *'FATAL in bicubic: x>3 : ',f20.10)
85 
86 c - In the range of 0(southernmost) to
87 c - 3(northernmost) row, where is our
88 c - random lat value? That is, x must
89 c - be real and fall between 0 and 3.
90 c - (Note, unless it is near an edge,
91 c - it will always be between 1 and 2)
92 
93  y=(xla-dla*(jla-1)-glamn)/dla
94 
95  if(y.lt.0.0)then
96  write(6,102)y
97  stop
98  endif
99  102 format(
100  *'FATAL in bicubic: y<0 : ',f20.10)
101 
102  if(y.gt.3.0)then
103  write(6,103)y
104  stop
105  endif
106  103 format(
107  *'FATAL in bicubic: y>3 : ',f20.10)
108 
109 c - Now do the interpolation. First, build a 1-D cubic function
110 c - east-west in the southermost row and interpolate to longitude
111 c - "xlo" (at "x" for 0<x<3). Then do it in the 2nd row,
112 c - then again in the 3rd, and finally the 4th and most northern row.
113 c - The last step is to fit a 1-D cubic function north-south at the
114 c - four previous interpolations, but this time to interpolate to
115 c - latitude "xla" (at "y" for 0<y<3). Obviously we
116 c - could reverse the order, doing 4 north-south cubics
117 c - followed by one east-east and we'd get the same answer.
118 
119 
120  fx0=cubterp(x,z(jla ,jlo ),z(jla ,jlo+1),
121  * z(jla ,jlo+2),z(jla ,jlo+3))
122 
123  fx1=cubterp(x,z(jla+1,jlo ),z(jla+1,jlo+1),
124  * z(jla+1,jlo+2),z(jla+1,jlo+3))
125 
126  fx2=cubterp(x,z(jla+2,jlo ),z(jla+2,jlo+1),
127  * z(jla+2,jlo+2),z(jla+2,jlo+3))
128 
129  fx3=cubterp(x,z(jla+3,jlo ),z(jla+3,jlo+1),
130  * z(jla+3,jlo+2),z(jla+3,jlo+3))
131 
132  val=dble(cubterp(y,fx0,fx1,fx2,fx3))
133 
134 
135 c write(6,1001)glamn,xla,jla,y
136 c write(6,1002)glomn,xlo,jlo,x
137 c write(6,1003)z(jla+3,jlo ),z(jla+3,jlo+1),
138 c * z(jla+3,jlo+2),z(jla+3,jlo+3)
139 c write(6,1003)z(jla+2,jlo ),z(jla+2,jlo+1),
140 c * z(jla+2,jlo+2),z(jla+2,jlo+3)
141 c write(6,1003)z(jla+1,jlo ),z(jla+1,jlo+1),
142 c * z(jla+1,jlo+2),z(jla+1,jlo+3)
143 c write(6,1003)z(jla ,jlo ),z(jla ,jlo+1),
144 c * z(jla ,jlo+2),z(jla ,jlo+3)
145 c write(6,1004)fx0,fx1,fx2,fx3,val
146 c pause
147 
148  1001 format(f14.10,1x,f14.10,1x,i8,1x,f8.5)
149  1002 format(f14.10,1x,f14.10,1x,i8,1x,f8.5)
150  1003 format(4(f15.8,1x))
151  1004 format(
152  *'fx0 = ',f15.8,/,
153  *'fx1 = ',f15.8,/,
154  *'fx2 = ',f15.8,/,
155  *'fx3 = ',f15.8,/,
156  *'val = ',f15.8)
157 
158 
159 
160  return
real function cubterp(x, f0, f1, f2, f3)
This function fits a cubic function through four points.
Definition: cubterp.f:48

+ Here is the caller graph for this function:

subroutine bilin ( real*4, dimension(maxla,maxlo)  data,
  glamn,
  glomn,
  dla,
  dlo,
  nla,
  nlo,
  maxla,
  maxlo,
  xla,
  xlo,
  val 
)

Subroutine to perform bilinear interpolation.

Performs a bilinear interpolation at location xla,xlo off of grid data, whose header information is the standard .b header information

Parameters
[in]dataInput Data assumed to be real*4
[in]glamnminimum latitude (real*8 decimal degrees) *.b
[in]glomnminimum longitude (real*8 decimal degrees) *.b
[in]dlalatitude spacing (real*8 decimal degrees) *.b
[in]dlolongitude spacing (real*8 decimal degrees) *.b
[in]nlanumber of lat rows (integer*4) *.b
[in]nlonumber of lon cols (integer*4) *.b
[in]maxlaactual dimensioned size of "data" in rows *.b
[in]maxloactual dimensioned size of "data" in cols *.b
[in]xlalat of pt for interpolation (real*8 dec. def)
[in]xlolon of pt for interpolation (real*8 dec. def)
[out]valinterpolated value (real*8)

Definition at line 23 of file bilin.f.

Referenced by checkgrid().

23 c - Subroutine to perform a bilinear interpolation
24 c - at location "xla,xlo" off of grid "data", whose
25 c - header information is the standard ".b" header
26 c - information of
27 c - glamn = minimum latitude (real*8 decimal degrees)
28 c - glomn = minimum longitude (real*8 decimal degrees)
29 c - dla = latitude spacing (real*8 decimal degrees)
30 c - dlo = longitude spacing (real*8 decimal degrees)
31 c - nla = number of lat rows (integer*4)
32 c - nlo = number of lon cols (integer*4)
33 c - maxla = actual dimensioned size of "data" in rows
34 c - maxlo = actual dimensioned size of "data" in cols
35 
36 c - data is assumed real*4
37  implicit real*8 (a-h,o-z)
38  real*4 data(maxla,maxlo)
39  logical onedlat,onedlon
40 
41 c - HACK
42 c do 8787 i=1,nla
43 c do 8788 j=1,nlo
44 c write(6,8789)i,j,data(i,j)
45 c8788 continue
46 c8787 continue
47 c8789 format(i5,1x,i5,1x,f20.10)
48 
49 c - Find the row of xla
50  difla = (xla - glamn)
51  ratla = difla / dla
52  ila = int(ratla)+1
53  gla0 = glamn + (ila-1)*dla
54 
55 c - Find the col of xlo
56  diflo = (xlo - glomn)
57  ratlo = diflo / dlo
58  ilo = int(ratlo)+1
59  glo0 = glomn + (ilo-1)*dlo
60 
61 
62 c - Do the interpolation.
63  t=(xlo-glo0)/dlo
64  u=(xla-gla0)/dla
65 
66  val = (1.d0-t)*(1.d0-u)*data(ila ,ilo )
67  * + ( t)*(1.d0-u)*data(ila ,ilo+1)
68  * + ( t)*( u)*data(ila+1,ilo+1)
69  * + (1.d0-t)*( u)*data(ila+1,ilo )
70 
71 c - HACK
72  return
73  write(6,198)xla,xlo
74  write(6,200)ila,ilo,gla0,glo0
75  write(6,199)xla-gla0,xlo-glo0
76  write(6,201)ila,ilo,gla0,glo0,
77  *data(ila,ilo)
78  write(6,201)ila,ilo+1,gla0,glo0+dlo,
79  *data(ila,ilo+1)
80  write(6,201)ila+1,ilo,gla0+dla,glo0,
81  *data(ila+1,ilo)
82  write(6,201)ila+1,ilo+1,gla0+dla,glo0+dlo,
83  *data(ila+1,ilo+1)
84  write(6,202)'SW',(1.d0-t)*(1.d0-u)
85  write(6,202)'SE',( t)*(1.d0-u)
86  write(6,202)'NW',( t)*( u)
87  write(6,202)'NE',(1.d0-t)*( u)
88  202 format(
89  *'Weight to ',a,' corner = ',f20.15)
90 
91  198 format(
92  *6x,'bilin.f: lat/lon = ',f10.6,1x,f10.6)
93  199 format(
94  *6x,'bilin.f: diff from SW corner of cell = ',f10.6,1x,f10.6)
95  200 format(
96  *6x,'bilin.f: SW corner: ',i6,1x,i6,1x,f10.6,1x,f10.6)
97  201 format(
98  *6x,2(i6,1x),2(f10.6,1x),f20.15)
99 
100 
101 c write(6,801)xla,xlo,ila,ilo,gla0,glo0,t,u,val
102  801 format(f15.8,1x,f15.8,1x,i6,1x,i6,1x,
103  *f15.8,1x,f15.8,1x,f8.6,1x,f8.6,1x,f20.10)
104 
105 c write(6,802)data(ila ,ilo ),
106 c *data(ila ,ilo+1),data(ila+1,ilo+1),
107 c *data(ila+1,ilo )
108  802 format(4(f15.8,1x))
109 
110  return

+ Here is the caller graph for this function:

subroutine biquad ( real*4, dimension(maxla,maxlo)  z,
  glamn,
  glomn,
  dla,
  dlo,
  nla,
  nlo,
  maxla,
  maxlo,
  xla,
  xlo,
  val 
)

Subroutine to perform a 2-D quadratic ("biquadratic") interpolation.

Performs a biquadratic interpolation at location xla,xlo off of grid z, whose header information is the standard ".b" header information

Parameters
[in]zInput Grid
[in]glamnminimum latitude (real*8 decimal degrees)
[in]glomnminimum longitude (real*8 decimal degrees)
[in]dlalatitude spacing (real*8 decimal degrees)
[in]dlolongitude spacing (real*8 decimal degrees)
[in]nlanumber of lat rows (integer*4)
[in]nlonumber of lon cols (integer*4)
[in]maxlaactual dimensioned size of "z" in rows
[in]maxloactual dimensioned size of "z" in cols
[in]xlalat of pt for interpolation (real*8 dec. deg)
[in]xlolon of pt for interpolation (real*8 dec. deg)
[out]valinterpolated value (real*8)

Method:

Fit a 3x3 window over the random point. The closest 2x2 points will surround the point. But based on which quadrant of that 2x2 cell in which the point falls, the 3x3 window could extend NW, NE, SW or SE from the 2x2 cell.

Definition at line 29 of file biquad.f.

Referenced by checkgrid().

29 
30 c - Subroutine to perform a 2-D quadratic ("biquadratic")
31 c - interpolation at location "xla,xlo" off of grid "z", whose
32 c - header information is the standard ".b" header
33 c - information of
34 c - glamn = minimum latitude (real*8 decimal degrees)
35 c - glomn = minimum longitude (real*8 decimal degrees)
36 c - dla = latitude spacing (real*8 decimal degrees)
37 c - dlo = longitude spacing (real*8 decimal degrees)
38 c - nla = number of lat rows (integer*4)
39 c - nlo = number of lon cols (integer*4)
40 c - maxla = actual dimensioned size of "z" in rows
41 c - maxlo = actual dimensioned size of "z" in cols
42 c - Further input:
43 c - xla = lat of pt for interpolation (real*8 dec. deg)
44 c - xlo = lon of pt for interpolation (real*8 dec. deg)
45 c - Output:
46 c - val = interpolated value (real*8)
47 c -
48 c - Method:
49 c - Fit a 3x3 window over the random point. The closest
50 c - 2x2 points will surround the point. But based on which
51 c - quadrant of that 2x2 cell in which the point falls, the
52 c - 3x3 window could extend NW, NE, SW or SE from the 2x2 cell.
53 
54 c - Data is assumed real*4
55  implicit real*8 (a-h,o-z)
56  real*4 z(maxla,maxlo)
57 
58 c - Internal use
59  real*4 x,y,fx0,fx1,fx2,qterp
60 
61 c - Find which row should be LEAST when fitting
62 c - a 3x3 window around xla.
63  difla = (xla - glamn)
64  ratla = difla / (dla/2.d0)
65  ila = int(ratla)+1
66  if(mod(ila,2).ne.0)then
67  jla = (ila+1)/2 - 1
68  else
69  jla = (ila )/2
70  endif
71 c - Fix any edge overlaps
72  if(jla.lt.1)jla = 1
73  if(jla.gt.nla-2)jla = nla-2
74 
75 c - Find which column should be LEAST when fitting
76 c - a 3x3 window around xlo.
77  diflo = (xlo - glomn)
78  ratlo = diflo / (dlo/2.d0)
79  ilo = int(ratlo)+1
80  if(mod(ilo,2).ne.0)then
81  jlo = (ilo+1)/2 - 1
82  else
83  jlo = (ilo )/2
84  endif
85 c - Fix any edge overlaps
86  if(jlo.lt.1)jlo = 1
87  if(jlo.gt.nlo-2)jlo = nlo-2
88 
89 c - In the range of 0(westernmost) to
90 c - 2(easternmost) col, where is our
91 c - random lon value? That is, x must
92 c - be real and fall between 0 and 2.
93 
94  x=(xlo-dlo*(jlo-1)-glomn)/dlo
95 
96  if(x.lt.0.0)then
97  val = 1.d30
98  write(6,100)x,val
99 c stop
100  return
101  endif
102  100 format(
103  *'FATAL in biquad: x<0 : ',f20.10,/,
104  *' --> Returning with val = ',f40.1)
105 
106  if(x.gt.2.0)then
107  val = 1.d30
108  write(6,101)x,val
109 c stop
110  return
111  endif
112  101 format(
113  *'FATAL in biquad: x>2 : ',f20.10,/,
114  *' --> Returning with val = ',f40.1)
115 
116 c - In the range of 0(southernmost) to
117 c - 2(northernmost) row, where is our
118 c - random lat value? That is, x must
119 c - be real and fall between 0 and 2.
120 
121  y=(xla-dla*(jla-1)-glamn)/dla
122 
123  if(y.lt.0.0)then
124  val = 1.d30
125  write(6,102)y,val
126 c stop
127  return
128  endif
129  102 format(
130  *'FATAL in biquad: y<0 : ',f20.10,/,
131  *' --> Returning with val = ',f40.1)
132 
133  if(y.gt.2.0)then
134  val = 1.d30
135  write(6,103)y,val
136 c stop
137  return
138  endif
139  103 format(
140  *'FATAL in biquad: y>2 : ',f20.10,/,
141  *' --> Returning with val = ',f40.1)
142 
143 c - Now do the interpolation. First, build a paraboloa
144 c - east-west the southermost row and interpolate to longitude
145 c - "xlo" (at "x" for 0<x<2). Then do it in the middle
146 c - row, then finally the northern row. The last step
147 c - is to fit a parabola north-south at the three previous
148 c - interpolations, but this time to interpolate to
149 c - latitude "xla" (at "y" for 0<y<2). Obviously we
150 c - could reverse the order, doing 3 north-south parabolas
151 c - followed by one east-east and we'd get the same answer.
152 
153  fx0=qterp(x,z(jla ,jlo),z(jla ,jlo+1),z(jla ,jlo+2))
154  fx1=qterp(x,z(jla+1,jlo),z(jla+1,jlo+1),z(jla+1,jlo+2))
155  fx2=qterp(x,z(jla+2,jlo),z(jla+2,jlo+1),z(jla+2,jlo+2))
156  val=dble(qterp(y,fx0,fx1,fx2))
157 
158 c goto 888
159 
160 c write(6,*) ' '
161 c write(6,*) ' ---------------------------------'
162 c write(6,*) ' Inside biquad.f'
163 c write(6,*) ' '
164 
165 c write(6,*) ' Southern Row of 3x3 window: '
166 c write(6,*) ' jla ,jlo ,z(jla ,jlo ) = ',
167 c *jla ,jlo ,z(jla ,jlo )
168 c write(6,*) ' jla ,jlo+1,z(jla ,jlo+1) = ',
169 c *jla ,jlo+1,z(jla ,jlo+1)
170 c write(6,*) ' jla ,jlo+2,z(jla ,jlo+2) = ',
171 c *jla ,jlo+2,z(jla ,jlo+2)
172 c write(6,*) ' fx0 = ',fx0
173 
174 c write(6,*) ' Middle Row of 3x3 window: '
175 c write(6,*) ' jla+1,jlo ,z(jla+1,jlo ) = ',
176 c *jla+1,jlo ,z(jla+1,jlo )
177 c write(6,*) ' jla+1,jlo+1,z(jla+1,jlo+1) = ',
178 c *jla+1,jlo+1,z(jla+1,jlo+1)
179 c write(6,*) ' jla+1,jlo+2,z(jla+1,jlo+2) = ',
180 c *jla+1,jlo+2,z(jla+1,jlo+2)
181 c write(6,*) ' fx1 = ',fx1
182 
183 c write(6,*) ' Northern Row of 3x3 window: '
184 c write(6,*) ' jla+2,jlo ,z(jla+2,jlo ) = ',
185 c *jla+2,jlo ,z(jla+2,jlo )
186 c write(6,*) ' jla+2,jlo+1,z(jla+2,jlo+1) = ',
187 c *jla+2,jlo+1,z(jla+2,jlo+1)
188 c write(6,*) ' jla+2,jlo+2,z(jla+2,jlo+2) = ',
189 c *jla+2,jlo+2,z(jla+2,jlo+2)
190 c write(6,*) ' fx2 = ',fx2
191 
192 c write(6,*) ' Final interpolated value = ',val
193 
194 c 888 continue
195 
196 
197  return
real function qterp(x, f0, f1, f2)
This function fits a quadratic function through 3 points.
Definition: qterp.f:47

+ Here is the caller graph for this function:

subroutine bwplotcv ( character*3  ele,
character*200  fname,
real*8, dimension(maxplots)  bw,
real*8, dimension(maxplots)  be,
real*8, dimension(maxplots)  bs,
real*8, dimension(maxplots)  bn,
real*4, dimension(maxplots)  jm,
real*4, dimension(maxplots)  b1,
real*4, dimension(maxplots)  b2,
integer*4  maxplots,
character*10  olddtm,
character*10  newdtm,
character*10  region,
character*3  elecap,
  ij,
  igridsec,
character*10, dimension(maxplots)  fn 
)

Subroutine to make GMT calls to do a B/W coverage plot.

Changelog

2016 08 29:

Updated the -R and -B initial calls to 6 decimal places

2016 08 25:

.gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0 Center the plot with "-Xc" at first "psxy" call Remove all "-JM**i+" references, and just use the actual width (jm) that came out of the "getmapbounds" routine and was sent here.

2016 07 21:

Modified use of JM command based on new forced sizes.

2015 02 15:

Updated to allow this subroutine to work earlier (in makeplotfiles01()), before igridsec was defined. See DRU-11, p. 139

Definition at line 26 of file bwplotcv.f.

References plotcoast().

Referenced by makeplotfiles01(), makeplotfiles02(), and makeplotfiles03().

26 
27 c - 2016 08 29:
28 c Updated the -R and -B initial calls to 6 decimal places
29 
30 c - 2016 08 25:
31 c .gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0
32 c Center the plot with "-Xc" at first "psxy" call
33 c Remove all "-JM**i+" references, and just use the actual
34 c width (jm) that came out of the "getmapbounds" routine and
35 c was sent here.
36 
37 c - 2016 07 21:
38 c - Modified use of JM command based on new forced sizes.
39 
40 c - Subroutine to make GMT calls to do a B/W coverage plot
41 
42 c - Updated 10/2/2015 to allow this subroutine to work
43 c - earlier (in makeplotfiles01.f), before "igridsec" was defined.
44 c - See DRU-11, p. 139
45 
46  integer*4 maxplots
47  character*3 ele,elecap
48  character*200 fname
49  character*10 olddtm,newdtm,region
50  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
51  real*4 jm(maxplots)
52  real*4 b1(maxplots),b2(maxplots)
53  character*10 fn(maxplots)
54  character*5 extra
55  character*20 gridnote
56 
57 c ----------------------------------------------------
58 c - All coverage type files begin with "cv".
59 c - The 3rd element tells me all, thinned, dropped or RMS
60 c - The 4th/5th elements tell me if these are coordinate
61 c - differneces or double differences. Elements 6,7,8
62 c - tell me what data we're plotting.
63 c ----------------------------------------------------
64 
65 
66 c ----------------------------------------------------
67 c - FAILSAFES: BEGIN
68 c ----------------------------------------------------
69  if(fname(3:3).eq.'t')then
70  extra='-thin'
71  elseif(fname(3:3).eq.'d')then
72  extra='-drop'
73  elseif(fname(3:3).eq.'a')then
74  extra='-all '
75  elseif(fname(3:3).eq.'r')then
76  extra='-RMSd'
77  else
78  write(6,1)trim(fname)
79  stop
80  endif
81  1 format('FATAL in bwplotcv. Bad character in spot 3: ',a)
82 
83  if(fname(1:2).ne.'cv')then
84  write(6,2)trim(fname)
85  stop
86  endif
87  2 format('FATAL in bwplotcv. Bad character in spots 1-2: ',a)
88 
89  if(.not.(fname(4:5).eq.'cd' .or. fname(4:5).eq.'dd'))then
90  write(6,3)trim(fname)
91  stop
92  endif
93  3 format('FATAL in bwplotcv. Bad character in spots 4-5: ',a)
94 
95  if(fname(6:8).ne.ele)then
96  write(6,4)trim(fname),ele
97  stop
98  endif
99  4 format('FATAL in bwplotcv. Bad match of fname / ele: ',a,1x,a)
100 
101 c - Just in case we forgot to set "igridsec" to be -1
102 c - when we came here from makeplotfiles01:
103  if(fname(1:3).eq.'cvacd')then
104  igridsec = -1
105  endif
106 
107  if(igridsec.le.0)then
108  gridnote = ''
109  else
110  write(gridnote,10)igridsec
111  endif
112  10 format('(',i0,' sec)')
113 
114 
115 
116 c ----------------------------------------------------
117 c - FAILSAFES: END
118 c ----------------------------------------------------
119 
120 
121 
122 c ----------------------------------------------
123 c - GMT COMMANDS: BEGIN
124 c ----------------------------------------------
125 
126 c - Header of commands/echoes:
127  write(99,991)ele,extra,trim(region),trim(fn(ij)),
128  *ele,extra,trim(region),trim(fn(ij))
129 
130 c - Write out the actual dots, and the title, with PSXY command
131  write(99,904)trim(fname),bw(ij),be(ij),bs(ij),bn(ij),
132  *jm(ij),b1(ij),b2(ij),trim(newdtm),trim(olddtm),elecap,
133  *extra,trim(gridnote),trim(region),trim(fn(ij))
134 
135 c - ALWAYS plot the coast last, as it closes the PS file
136  call plotcoast(region,99)
137 
138 c - Convert PS to JPG
139  write(99,905)
140 
141 c - Rename the JPG to my naming scheme
142  write(99,910)trim(fname),trim(fn(ij))
143 c ----------------------------------------------
144 c - GMT COMMANDS: END
145 c ----------------------------------------------
146 
147 
148 
149  991 format(
150  *'# -----------------------------------------------------',/,
151  *'# coverage in ',a,a,1x,a,1x,a,/,
152  *'# -----------------------------------------------------',/,
153  *'echo ...coverage in ',a,a,1x,a,1x,a)
154 
155 
156 c - Plot the actual coverage points
157 c - 2016 08 29
158  904 format('psxy ',a,' -Xc -R',f0.6,'/',f0.6,'/',sp,f0.6,'/',f0.6,
159  * ss,' -JM',f3.1,'i -B',f0.6,'/',f0.6,':."',
160  * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
161  * 1x,a,'-',a,
162  * '": -Sc0.02i ',
163  * '-Gblack -K > plot.ps')
164 
165 
166 
167 c - 2016 08 25:
168 c 904 format('psxy ',a,' -Xc -R',f0.2,'/',f0.2,'/',sp,f0.2,'/',f0.2,
169 c * ss,' -JM',f3.1,'i -B',f0.2,'/',f0.2,':."',
170 c * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
171 c * 1x,a,'-',a,
172 c * '": -Sc0.02i ',
173 c * '-Gblack -K > plot.ps')
174 c - 2016 07 21
175 c 904 format('psxy ',a,' -R',f0.2,'/',f0.2,'/',sp,f0.2,'/',f0.2,
176 c * ss,' -JM',f3.1,'i -B',f0.2,'/',f0.2,':."',
177 c * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
178 c * 1x,a,'-',a,
179 c * '": -Sc0.02i ',
180 c * '-Gblack -K > plot.ps')
181 c 904 format('psxy ',a,' -R',f0.2,'/',f0.2,'/',sp,f0.2,'/',f0.2,
182 c * ss,' -JM',f3.1,'i+ -B',f0.2,'/',f0.2,':."',
183 c * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
184 c * 1x,a,'-',a,
185 c * '": -Sc0.02i ',
186 c * '-Gblack -K > plot.ps')
187 
188 c - 905 = Convert PS to JPG
189  905 format('ps2raster plot.ps -Tj -P -A ')
190 
191 
192 c - Renaming
193  910 format('mv -f plot.jpg ',a,'.',a,'.jpg',/,
194  *'rm -f plot.ps')
195 c 910 format('mv -f plot.jpg cv',a1,a3,'.',a,'.',a,'.',a,
196 c *'.',i0,'.',a,'.jpg',/,'rm -f plot.ps')
197  1910 format('mv -f plot.jpg cv',a3,'.',a,'.',a,'.',a,
198  *'.',a,'.jpg',/,'rm -f plot.ps')
199 
200  return
subroutine plotcoast(region, ifnum)
Subroutine to write GMT-based commands to create a shoreline Write GMT-based commands to create a sho...
Definition: plotcoast.f:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine bwplotvc ( character*3  ele,
character*200  fname,
real*8, dimension(maxplots)  bw,
real*8, dimension(maxplots)  be,
real*8, dimension(maxplots)  bs,
real*8, dimension(maxplots)  bn,
real*4, dimension(maxplots)  jm,
real*4, dimension(maxplots)  b1,
real*4, dimension(maxplots)  b2,
integer*4  maxplots,
character*10  olddtm,
character*10  newdtm,
character*10  region,
character*3  elecap,
  ij,
  xvlon,
  xvlat,
  xllon,
  xllat,
real*8  lorvog,
real*8  lorvopc,
  igridsec,
character*10, dimension(maxplots)  fn 
)

Subroutine to make GMT calls to do a B/W vector plot.

Changelog

2016 08 29:

Expanded the refence vector calls to be 6 decimal places, as well as the initial -R call for S/N/W/E and also the -B part of that call

2016 08 25:

.gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0 Center the plot with "-Xc" at first "psxy" call Remove all "-JM**i+" references, and just use the actual width (jm) that came out of the "getmapbounds" routine and was sent here.

2016 07 29:

Updated the reference vector call to have the "-N" option, so it'll plot outside the map

2016 07 21:

Modified use of JM command based on new forced sizes.

2015 02 15:

Updated to allow this subroutine to work earlier (in makeplotfiles01()), before igridsec was defined. See DRU-11, p. 139

Definition at line 33 of file bwplotvc.f.

References plotcoast().

Referenced by checkgrid(), makeplotfiles01(), makeplotfiles02(), and makeplotfiles03().

33 
34 c - 2016 08 29:
35 c Expanded the refence vector calls to be 6 decimal places, as well
36 c as the initial -R call for S/N/W/E
37 c and also the -B part of that call
38 
39 c - 2016 08 25:
40 c .gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0
41 c Center the plot with "-Xc" at first "psxy" call
42 c Remove all "-JM**i+" references, and just use the actual
43 c width (jm) that came out of the "getmapbounds" routine and
44 c was sent here.
45 
46 
47 c - 2016 07 29: Updated the reference vector call to
48 c - have the "-N" option, so it'll plot outside the map
49 
50 c - 2016 07 21: Updated JM usage for new forced sizes
51 
52 c subroutine bwplotvc(ele,fname,bw,be,bs,bn,jm,b1,b2,maxplots,
53 c *olddtm,newdtm,region,elecap,ij,xvlon,xvlat,xllon,xllat,ncm,
54 c *q1,igridsec,fn)
55 c - Subroutine to make GMT calls to do a B/W vector plot
56 
57 c - Updated 10/2/2015 to allow this subroutine to work
58 c - earlier (in makeplotfiles01.f), before "igridsec" was defined.
59 c - See DRU-11, p. 139
60 
61  implicit real*8(a-h,o-z)
62  integer*4 maxplots
63  character*3 ele,elecap
64  character*200 fname
65  character*10 olddtm,newdtm,region
66  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
67  real*4 jm(maxplots)
68  real*4 b1(maxplots),b2(maxplots)
69  character*10 fn(maxplots)
70  character*5 extra
71  character*20 units
72  character*20 gridnote
73  character*20 gridnote2
74 
75  real*8 lorvopc,lorvog
76 
77 c ----------------------------------------------------
78 c - All vector type files begin with either "vm"
79 c - (meters) or "vs" (arcseconds).
80 c - The 3rd element tells me all, thinned, dropped or RMS
81 c - The 4th/5th elements tell me if these are coordinate
82 c - differnces or double differences. Elements 6,7,8
83 c - tell me what data we're plotting.
84 c ----------------------------------------------------
85 
86 
87 c ----------------------------------------------------
88 c - FAILSAFES: BEGIN
89 c ----------------------------------------------------
90  if(fname(3:3).eq.'t')then
91  extra='-thin'
92  elseif(fname(3:3).eq.'d')then
93  extra='-drop'
94  elseif(fname(3:3).eq.'a')then
95  extra='-all '
96  elseif(fname(3:3).eq.'r')then
97  extra='-RMSd'
98  else
99  write(6,1)trim(fname)
100  stop
101  endif
102  1 format('FATAL in bwplotvc. Bad character in spot 3: ',a)
103 
104  if(.not.(fname(1:2).eq.'vm'.or.fname(1:2).eq.'vs'))then
105  write(6,2)trim(fname)
106  stop
107  endif
108  2 format('FATAL in bwplotvc. Bad character in spots 1-2: ',a)
109 
110  if(.not.(fname(4:5).eq.'cd' .or. fname(4:5).eq.'dd' .or.
111  * fname(4:5).eq.'gi'))then
112  write(6,3)trim(fname)
113  stop
114  endif
115  3 format('FATAL in bwplotvc. Bad character in spots 4-5: ',a)
116 
117  if(fname(6:8).ne.ele)then
118  write(6,4)trim(fname),ele
119  stop
120  endif
121  4 format('FATAL in bwplotvc. Bad match of fname / ele: ',a,1x,a)
122 
123 c - Just in case we forgot to set "igridsec" to be -1
124 c - when we came here from makeplotfiles01:
125  if(fname(1:3).eq.'vmacd' .or. fname(1:3).eq.'vsacd')then
126  igridsec = -1
127  endif
128 
129  if (fname(2:2).eq.'m')then
130  units='meters'
131  elseif(fname(2:2).eq.'s')then
132  units='arcseconds'
133  else
134  write(6,5)trim(fname)
135  stop
136  endif
137  5 format('FATAL in bwplotvc. Bad units in name: ',a)
138 
139  if(igridsec.le.0)then
140  gridnote = ''
141  gridnote2 = ''
142  else
143  write(gridnote,10)igridsec
144  write(gridnote2,11)igridsec
145  endif
146  10 format('(',i0,' sec)')
147  11 format(i0,'.')
148 
149 c ----------------------------------------------------
150 c - FAILSAFES: END
151 c ----------------------------------------------------
152 
153 
154 c ----------------------------------------------
155 c - GMT COMMANDS: BEGIN
156 c ----------------------------------------------
157 
158 c - Header of commands/echoes:
159  write(99,991)ele,extra,trim(units),trim(region),trim(fn(ij)),
160  *ele,extra,trim(units),trim(region),trim(fn(ij))
161 
162 c - Plot the actual vectors, and the title, with PSXY command
163  write(99,903)trim(fname),bw(ij),be(ij),bs(ij),bn(ij),
164  *jm(ij),b1(ij),b2(ij),trim(newdtm),trim(olddtm),elecap,
165  *extra,trim(gridnote),trim(region),trim(fn(ij)),fname(2:5)
166 
167 
168 
169 c - Plot the reference vector
170  write(99,908)xvlon,xvlat,90.d0,lorvopc
171 c write(99,908)xvlon,xvlat,90.d0,q1
172 
173 c - Label the reference vector
174 c - HACK
175 c write(6,807)trim(fname),trim(units)
176 c 807 format('File: ',a,/,'Units: ',a)
177  if (trim(units).eq.'arcseconds')then
178  write(99,1909)xllon,xllat,lorvog,trim(units)
179  elseif(trim(units).eq.'meters')then
180  write(99, 909)xllon,xllat,lorvog,trim(units)
181  endif
182 
183 c - ALWAYS plot the coast last, as it closes the PS file
184  call plotcoast(region,99)
185 
186 c - Convert PS to JPG
187  write(99,905)
188 
189 c - Rename the JPG to my naming scheme
190 c write(99,906)trim(fname),trim(gridnote2),trim(fn(ij))
191  write(99,906)trim(fname),trim(fn(ij))
192 
193 c ----------------------------------------------
194 c - GMT COMMANDS: END
195 c ----------------------------------------------
196 
197  991 format(
198  *'# -----------------------------------------------------',/,
199  *'# vectors in ',a,a,1x,a,1x,a,1x,a,/,
200  *'# -----------------------------------------------------',/,
201  *'echo ...vectors in ',a,a,1x,a,1x,a,1x,a)
202 
203 c - Plot the actual vectors
204 c - 2016 08 29
205  903 format('psxy ',a,' -Xc -R',f0.6,'/',f0.6,'/',sp,f0.6,'/',f0.6,
206  * ss,' -JM',f3.1,'i -B',f0.6,'/',f0.6,':."',
207  * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
208  * 1x,a,'-',a,1x,a,
209  *'": -SV0.0001i/0.02i/0.02i ',
210  * '-Gblack -K > plot.ps')
211 c - 2016 08 25:
212 c 903 format('psxy ',a,' -Xc -R',f0.2,'/',f0.2,'/',sp,f0.2,'/',f0.2,
213 c * ss,' -JM',f3.1,'i -B',f0.2,'/',f0.2,':."',
214 c * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
215 c * 1x,a,'-',a,1x,a,
216 c *'": -SV0.0001i/0.02i/0.02i ',
217 c * '-Gblack -K > plot.ps')
218 
219 c 903 format('psxy ',a,' -R',f0.2,'/',f0.2,'/',sp,f0.2,'/',f0.2,
220 c * ss,' -JM',f3.1,'i -B',f0.2,'/',f0.2,':."',
221 c * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
222 c * 1x,a,'-',a,1x,a,
223 c *'": -SV0.0001i/0.02i/0.02i ',
224 c * '-Gblack -K > plot.ps')
225 c 903 format('psxy ',a,' -R',f0.2,'/',f0.2,'/',sp,f0.2,'/',f0.2,
226 c * ss,' -JM',f3.1,'i+ -B',f0.2,'/',f0.2,':."',
227 c * 'NADCON v5.0 ',a,' minus ',a,' ',a3,a5,a,
228 c * 1x,a,'-',a,1x,a,
229 c *'": -SV0.0001i/0.02i/0.02i ',
230 c * '-Gblack -K > plot.ps')
231 
232 c - 908 = Plot a REFERENCE vector
233 c - 2016 08 29: More decimal places
234  908 format('psxy -SV0.0001i/0.02i/0.02i -N -R -O -K -JM',
235  * ' -Gred >> plot.ps << !',/,
236  * f10.6,1x,f10.6,1x,f5.1,1x,f9.1,/,
237  * '!')
238 c - 2016 07 29: Make reference vector appear outside of map
239 c 908 format('psxy -SV0.0001i/0.02i/0.02i -N -R -O -K -JM',
240 c * ' -Gred >> plot.ps << !',/,
241 c * f6.2,1x,f6.2,1x,f5.1,1x,f9.1,/,
242 c * '!')
243 c 908 format('psxy -SV0.0001i/0.02i/0.02i -R -O -K -JM',
244 c * ' -Gred >> plot.ps << !',/,
245 c * f6.2,1x,f6.2,1x,f5.1,1x,f9.1,/,
246 c * '!')
247 
248 c - 909 = Label the REFERENCE vector
249 c - 2016 08 29: More decimal places
250  909 format('pstext -N -O -K -R -JM -Gred >> plot.ps << !',/,
251  * f10.6,1x,f10.6,1x,'12 0 1 TL ',f10.3,1x,a,/,
252  * '!')
253 c - 2016 07 29: Use -N to plot it outside
254 c 909 format('pstext -N -O -K -R -JM -Gred >> plot.ps << !',/,
255 c * f6.2,1x,f6.2,1x,'12 0 1 TL ',f10.3,1x,a,/,
256 c * '!')
257 c - 2016 08 29: More decimal places
258  1909 format('pstext -N -O -K -R -JM -Gred >> plot.ps << !',/,
259  * f10.6,1x,f10.6,1x,'12 0 1 TL ',f10.6,1x,a,/,
260  * '!')
261 c1909 format('pstext -N -O -K -R -JM -Gred >> plot.ps << !',/,
262 c * f6.2,1x,f6.2,1x,'12 0 1 TL ',f10.6,1x,a,/,
263 c * '!')
264 c 909 format('pstext -O -K -R -JM -Gred >> plot.ps << !',/,
265 c * f6.2,1x,f6.2,1x,'12 0 1 TL ',f10.3,1x,a,/,
266 c * '!')
267 c1909 format('pstext -O -K -R -JM -Gred >> plot.ps << !',/,
268 c * f6.2,1x,f6.2,1x,'12 0 1 TL ',f10.6,1x,a,/,
269 c * '!')
270 
271 c 909 format('pstext -O -K -R -JM -Gred >> plot.ps << !',/,
272 c * f6.2,1x,f6.2,1x,'12 0 1 TL ',i6,' cm',/,
273 c * '!')
274 
275 c - 905 = Convert PS to JPG
276  905 format('ps2raster plot.ps -Tj -P -A ')
277 
278 c - Rename to our naming scheme
279 c 906 format('mv -f plot.jpg ',a,
280 c *'.',a,a,'.jpg',/,'rm -f plot.ps')
281  906 format('mv -f plot.jpg ',a,
282  *'.',a,'.jpg',/,'rm -f plot.ps')
283 
284  return
subroutine plotcoast(region, ifnum)
Subroutine to write GMT-based commands to create a shoreline Write GMT-based commands to create a sho...
Definition: plotcoast.f:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

program convlv ( )

Part of the NADCON5 NADCON5 Core Library , Convolves two grids.

Convolves one grid against another

\[ c(i,j) = a(i,j) * b(i,j) \]

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileAFirst Input File Name
infileBSecond Input File Name
outfileOutput File Name of A*B

Program Inputs:

  • lin1 Input File A
  • lin2 Input File B
  • lout Output File to Write A+B

Definition at line 25 of file convlv.f.

subroutine coplot ( character*3  ele,
character*200  fname,
real*8, dimension(maxplots)  bw,
real*8, dimension(maxplots)  be,
real*8, dimension(maxplots)  bs,
real*8, dimension(maxplots)  bn,
real*4, dimension(maxplots)  jm,
real*4, dimension(maxplots)  b1,
real*4, dimension(maxplots)  b2,
integer*4  maxplots,
character*10  olddtm,
character*10  newdtm,
character*10  region,
character*3  elecap,
  ij,
  cptlo,
  cpthi,
  cptin6,
character*200  suffixused,
  igridsec,
character*10, dimension(maxplots)  fn 
)

Subroutine to make GMT calls to do Color Raster Rendering of Gridded Data.

Changelog

2016 09 08:

Had to up the D_FORMAT default to %.3G because tight scalebar ranges with the newly allowed "more free" average values were showing repeating values when only 2 digits could be shown.

2016 09 07:

Had to add lines pre/post "makecpt" to change the D_FORMAT. This is because I had been forcing the "scave" in cpt.f to be ONZD. But that yielded bad values sometimes, so I switched it. With that switch, the scave could have lots of digits. Well, that means the newly adopted "D_FORMAT" of %.2G was insufficient for the CPT table. Who knew that D_FORMAT affected that! Anyway, so change "D_FORMAT" pre/post all makecpt calls.

2016 08 30:

See item #39 in Google ToDo list Changed "grdcontour" to have a blank "-R" call so it'll mimic whatever decimal places are in the "grdimage" call that came before it.

2016 08 29:

Updated the initial -R and -B calls to 6 decimal places

2016 08 25:

-.gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0

  • Center the plot with "-Xc" at grdimage
  • Center the scalebar by setting its Xcoordinate, which runs in "plot frame" coordinates (0/0 at lower left) , to be equal to "jm/2"
  • Force the scale bar to be exactly 4 inches wide, always
  • Change the format for "makecpt" from 0.6 to 0.10

2016 07 29:

Update to put more data into comment/echo

Also,

  • forced the -Ctemp.cpt option in "grdcontour" to make the contours line up with the color palette
  • For d3 plots, to drop all contours
  • For d3 plots to only use "coverage" part only if "ij" is not "1"
  • Same for "09" and "ete" grids

2016 07 21:

  • Set the "JM" code in "grdcontour" to just be "-JM" and let it therefore run with whatever JM size is used in "grdimage"
  • Set the "A" code in "grdcontour" to be "-A-" which should turn off the labels on all contours
  • Fixed size of scale bar

2016 03 01:

  1. Changed to a continuous color plot
    • Get rid of "-Z" in "makecpt"
  2. Changed to an 8 color, from 6 color, plot (without changing the RANGE yet...see DRU-12, p. 19)
    • Change varible that comes in from "cptin" to "cptin6"
    • Compute cptin = cptin6 * 0.75d0 immediately

Update 2016 02 29:

  1. Removed all shading from color plots
    • Get rid of "grdgradient" call
    • Remove from "grdimage" the "-Itempi.grd" part
    • Remove the "rm -f tempi.grd" line

Definition at line 70 of file coplot.f.

References plotcoast().

Referenced by makeplotfiles02(), and makeplotfiles03().

70 
71 c - 2016 09 08
72 c Had to up the D_FORMAT default to %.3G because tight scalebar ranges
73 c with the newly allowed "more free" average values were showing
74 c repeating values when only 2 digits could be shown.
75 
76 c - 2016 09 07
77 c Had to add lines pre/post "makecpt" to change the D_FORMAT. This is because
78 c I *had* been forcing the "scave" in cpt.f to be ONZD. But that yielded
79 c bad values sometimes, so I switched it. With that switch, the scave could
80 c have lots of digits. Well, that means the newly adopted "D_FORMAT" of %.2G
81 c was insufficient for the CPT table. Who knew that D_FORMAT affected that!
82 c Anyway, so change "D_FORMAT" pre/post all makecpt calls.
83 
84 c - 2016 08 30: See item #39 in Google ToDo list
85 c Changed "grdcontour" to have a blank "-R" call so it'll mimic whatever
86 c decimal places are in the "grdimage" call that came before it.
87 
88 c - 2016 08 29:
89 c Updated the initial -R and -B calls to 6 decimal places
90 
91 c - 2016 08 25:
92 c .gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0
93 c Center the plot with "-Xc" at grdimage
94 c Center the scalebar by setting its Xcoordinate, which runs in "plot frame"
95 c coordinates (0/0 at lower left) , to be equal to "jm/2"
96 c Force the scale bar to be exactly 4 inches wide, always
97 c Change the format for "makecpt" from 0.6 to 0.10
98 
99 c - 2016 07 29:
100 c Update to put more data into comment/echo
101 c Also forced the -Ctemp.cpt option in "grdcontour" to make the contours line up with the color palette
102 
103 c For d3 plots, to drop all contours
104 c For d3 plots to only use "coverage" part *only* if "ij" is not "1"
105 c Same for "09" and "ete" grids
106 
107 
108 c subroutine coplot(ele,fname,bw,be,bs,bn,jm,b1,b2,maxplots,
109 c *olddtm,newdtm,region,elecap,ij,cptlo,cpthi,cptin,suffixused,
110 c *igridsec,fn)
111 
112 c - Update 2016 07 21:
113 c - Set the "JM" code in "grdcontour" to just be "-JM" and let it therefore
114 c run with whatever JM size is used in "grdimage"
115 c - Set the "A" code in "grdcontour" to be "-A-" which should turn off
116 c the labels on all contours
117 c - Fixed size of scale bar
118 
119 c - Update 2016 03 01:
120 c - 1) Changed to a continuous color plot
121 c * Get rid of "-Z" in "makecpt"
122 c 2) Changed to an 8 color, from 6 color, plot (without changing the RANGE yet...see DRU-12, p. 19)
123 c * Change varible that comes in from "cptin" to "cptin6"
124 c * Compute cptin = cptin6 * 0.75d0 immediately
125 
126 c - Update 2016 02 29:
127 c - 1) Removed all shading from color plots
128 c * Get rid of "grdgradient" call
129 c * Remove from "grdimage" the "-Itempi.grd" part
130 c * Remove the "rm -f tempi.grd" line
131 
132 
133 c subroutine coplot(ele,fname,bw,be,bs,bn,jm,b1,b2,maxplots,
134 c *olddtm,newdtm,region,elecap,ij,cptlo,cpthi,cptin,suffix2,
135 c *igridsec,fn)
136 
137 c subroutine coplot(ele,fname,bw,be,bs,bn,jm,b1,b2,maxplots,
138 c *olddtm,newdtm,region,elecap,ij,ave,std,suffix2,igridsec,fn)
139 
140  implicit real*8(a-h,o-z)
141 
142 c - Subroutine to make GMT calls to do a color raster rendering
143 c - of gridded data
144 
145  integer*4 maxplots
146  character*3 ele,elecap
147  character*200 fname
148  character*10 olddtm,newdtm,region
149  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
150  real*4 jm(maxplots)
151  real*4 b1(maxplots),b2(maxplots)
152  character*10 fn(maxplots)
153  real*8 ave,std
154  character*200 suffixused
155  character*20 units
156  character*20 gridnote
157  character*20 gridnote2
158 
159 c ----------------------------------------------------
160 c - FAILSAFES: BEGIN
161 c ----------------------------------------------------
162  if(.not.(fname(1:3).eq.'vmt'.or.fname(1:3).eq.'vst' .or.
163  * fname(1:3).eq.'vmr'.or.fname(1:3).eq.'vsr' .or.
164  * fname(1:3).eq.'vme'.or.fname(1:3).eq.'vse'))then
165  write(6,2)trim(fname)
166  stop
167  endif
168  2 format('FATAL in coplot. Bad character in spots 1-3: ',a)
169 
170  if(.not.(fname(4:5).eq.'cd' .or. fname(4:5).eq.'dd' .or.
171  * fname(4:5).eq.'te' ))then
172  write(6,3)trim(fname)
173  stop
174  endif
175  3 format('FATAL in coplot. Bad character in spots 4-5: ',a)
176 
177  if(fname(6:8).ne.ele)then
178  write(6,4)trim(fname),ele
179  stop
180  endif
181  4 format('FATAL in coplot. Bad match of fname / ele: ',a,1x,a)
182 
183  if(fname(2:2).eq.'m')then
184  units='meters'
185  elseif(fname(2:2).eq.'s')then
186  units='arcseconds'
187  else
188  write(6,5)trim(fname)
189  stop
190  endif
191  5 format('FATAL in coplot. Bad units in name: ',a)
192 
193  if(igridsec.le.0)then
194  write(6,6)igridsec
195  else
196  write(gridnote,10)igridsec
197  write(gridnote2,11)igridsec
198  endif
199  6 format('FATAL in coplot. Bad igridsec: ',i0)
200  10 format('(',i0,' sec)')
201  11 format(i0,'.')
202 
203 c ----------------------------------------------------
204 c - FAILSAFES: END
205 c ----------------------------------------------------
206 
207 c ------------------------------------------------------------------
208 c - Contour interval and labeling
209 c ------------------------------------------------------------------
210 c - 2016 07 29: Just use cptin6 as it came in
211  cptin = cptin6
212 c - Begin 2016 03 01
213 c cptin = cptin6 * 0.75d0
214 c - End 2016 03 01
215 
216  conin = cptin
217  conlb = conin / 2.d0
218 
219 c ----------------------------------------------
220 c - GMT COMMANDS: BEGIN
221 c ----------------------------------------------
222 
223 
224 c - Header of commands/echoes:
225 c - 2016 07 29:
226  write(99,991)ele,trim(units),trim(region),trim(fn(ij)),
227  *trim(suffixused),
228  *ele,trim(units),trim(region),trim(fn(ij)),
229  *trim(suffixused)
230 c write(99,991)ele,trim(units),trim(region),trim(fn(ij)),
231 c *ele,trim(units),trim(region),trim(fn(ij))
232 
233 c - GMT call to create the color palette:
234 c - Store the palette as file "temp.cpt", to be
235 c - deleted later.
236  write(99,901)cptlo,cpthi,cptin
237 
238 c - Begin 2016 03 01:
239 c 901 format(
240 c *'makecpt -Crainbow -T',f0.6,'/',f0.6,'/',f0.6,
241 c *' -Z > temp.cpt')
242 c 901 format(
243 c *'makecpt -Crainbow -T',f0.6,'/',f0.6,'/',f0.6,
244 c *' > temp.cpt')
245 c - 2016 08 25
246 c 901 format(
247 c *'makecpt -Crainbow -T',f0.10,'/',f0.10,'/',f0.10,
248 c *' > temp.cpt')
249 c - 2016 09 07
250 c 901 format(
251 c *'gmtset D_FORMAT %.12G',/,
252 c *'makecpt -Crainbow -T',f0.10,'/',f0.10,'/',f0.10,
253 c *' > temp.cpt',/,
254 c *'gmtset D_FORMAT %.2G')
255 c - 2016 09 08
256  901 format(
257  *'gmtset D_FORMAT %.12G',/,
258  *'makecpt -Crainbow -T',f0.10,'/',f0.10,'/',f0.10,
259  *' > temp.cpt',/,
260  *'gmtset D_FORMAT %.3G')
261 
262 c - GMT call to create the gradient file from
263 c - the "grd" formatted version of our input grid.
264 c - Store the gradients as file "tempi.grd" to be
265 c - deleted later.
266 
267 c - Updated 2016 02 29:
268 c write(99,902)fname(1:8),trim(suffixused)
269  902 format(
270  *'grdgradient ',a,'.',a,
271  *'.grd -N4.8 -A90 -M -Gtempi.grd')
272 c - Until here 2016 02 29
273 
274 c - GMT call to create the color render of the
275 c - gridded data. Store as file "plot.ps"
276 c - to be deleted later.
277 
278  write(99,903)fname(1:8),trim(suffixused),
279  *bw(ij),be(ij),bs(ij),bn(ij),
280  *jm(ij),b1(ij),b2(ij),
281  *trim(newdtm),trim(olddtm),elecap,igridsec,
282  *trim(region),trim(fn(ij)),fname(2:5)
283 
284 
285 c - Commented this out for 2016 03 01:
286 c 903 format(
287 c *'grdimage ',a,'.',a,'.grd',
288 c *' -Ei -Itempi.grd',
289 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
290 c *' -JM',f3.1,'i -B',f0.2,'/',f0.2,
291 c *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
292 c *'(',i0,' sec)',
293 c *1x,a,'-',a,1x,a,
294 c *':" -Ctemp.cpt -K > plot.ps')
295 c 903 format(
296 c *'grdimage ',a,'.',a,'.grd',
297 c *' -Ei ',
298 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
299 c *' -JM',f3.1,'i -B',f0.2,'/',f0.2,
300 c *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
301 c *'(',i0,' sec)',
302 c *1x,a,'-',a,1x,a,
303 c *':" -Ctemp.cpt -K > plot.ps')
304 c - Below for 2016 08 25:
305 c 903 format(
306 c *'grdimage ',a,'.',a,'.grd',
307 c *' -Ei -Xc',
308 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
309 c *' -JM',f3.1,'i -B',f0.2,'/',f0.2,
310 c *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
311 c *'(',i0,' sec)',
312 c *1x,a,'-',a,1x,a,
313 c *':" -Ctemp.cpt -K > plot.ps')
314 c - 2016 08 29:
315  903 format(
316  *'grdimage ',a,'.',a,'.grd',
317  *' -Ei -Xc',
318  *' -R',f0.6,'/',f0.6,'/',f0.6,'/',f0.6,
319  *' -JM',f3.1,'i -B',f0.6,'/',f0.6,
320  *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
321  *'(',i0,' sec)',
322  *1x,a,'-',a,1x,a,
323  *':" -Ctemp.cpt -K > plot.ps')
324 
325 c - GMT call to put a color scale on the map. Add it
326 c - to file "plot.ps".
327 
328 c - 2016 07 21
329 c write(99,904)trim(units)
330 c qqa = jm(ij) - 1.d0
331 c qqb = qqa / 2.d0
332 c write(99,904)qqb,qqa,trim(units)
333 c - 2016 08 25
334  qqa = jm(ij)/2
335  write(99,904)qqa,trim(units)
336 
337  904 format(
338  *'psscale -D',f3.1,'i/-0.4i/4.0i/0.2ih',
339  *' -Ctemp.cpt -I0.4 -B/:',a,
340  *': -O -K >> plot.ps')
341 
342 c 904 format(
343 c *'psscale -D4i/-0.4i/8i/0.2ih -Ctemp.cpt -I0.4 -B/:',a,
344 c *': -O -K >> plot.ps')
345 
346 
347 
348 c - GMT call to put contours on the map.
349 c - 2016 07 29
350 c - 2016 07 21
351 
352 c 2016 07 29: skip contours if this is a d3, 09 or "ete" plot
353  ll = len(trim(suffixused))
354  if(suffixused(ll-1:ll).eq.'d3')goto 807
355  if(suffixused(ll-1:ll).eq.'09')goto 807
356  if(fname(3:5).eq.'ete')goto 807
357 
358 
359 
360  write(99,908)fname(1:8),trim(suffixused)
361 
362 c write(99,908)fname(1:8),trim(suffixused),
363 c *bw(ij),be(ij),bs(ij),bn(ij)
364 c write(99,908)fname(1:8),trim(suffixused),conin,
365 c *bw(ij),be(ij),bs(ij),bn(ij)
366 c write(99,908)fname(1:8),trim(suffixused),conin,
367 c *bw(ij),be(ij),bs(ij),bn(ij),
368 c *jm(ij),conlb
369 
370 c - 2016 08 30:
371  908 format(
372  *'grdcontour ',a,'.',a,'.grd',
373  *' -Ctemp.cpt',
374  *' -R',
375  *' -JM -Wthin',
376  *' -A- -O -K >> plot.ps')
377 c - 2016 07 29
378 c 908 format(
379 c *'grdcontour ',a,'.',a,'.grd',
380 c *' -Ctemp.cpt',
381 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
382 c *' -JM -Wthin',
383 c *' -A- -O -K >> plot.ps')
384 c - 2016 07 21
385 c 908 format(
386 c *'grdcontour ',a,'.',a,'.grd',
387 c *' -C',f0.5,
388 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
389 c *' -JM -Wthin',
390 c *' -A- -O -K >> plot.ps')
391 c 908 format(
392 c *'grdcontour ',a,'.',a,'.grd',
393 c *' -C',f0.5,
394 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
395 c *' -JM',f3.1,'i -Wthin',
396 c *' -A',f0.5,' -O -K >> plot.ps')
397 
398 c - 2016 07 28 - Skip to here (skipping contours) for d3, 09 or "ete" plots
399  807 continue
400 
401 c - GMT call to create the shoreline. Add it to
402 c - file "plot.ps".
403 c - ALWAYS plot the coast last, as it closes the PS file
404  call plotcoast(region,99)
405 
406 c - GMT call to convert the plot.ps file to plot.jpg.
407  write(99,905)
408  905 format(
409  *'ps2raster plot.ps -Tj -P -A')
410 
411 c - Change name of JPG to its final name:
412  write(99,906)fname(2:8),trim(suffixused),trim(fn(ij))
413  906 format('mv plot.jpg c',a,'.',a,'.',a,'.jpg')
414 
415 c - Remove all the temporary files
416  write(99,907)
417 
418 c - Update 2016 02 29:
419 c 907 format(
420 c *'rm -f temp.cpt',/,
421 c *'rm -f tempi.grd',/,
422 c *'rm -f plot.ps')
423  907 format(
424  *'rm -f temp.cpt',/,
425  *'rm -f plot.ps')
426 c - Until here 2016 02 29
427 
428 
429 c - 2016 07 29:
430  991 format(
431  *'# -----------------------------------------------------',/,
432  *'# color plots in ',a,1x,a,1x,a,1x,a,1x,' Grid:',a /,
433  *'# -----------------------------------------------------',/,
434  *'echo ...color plots in ',a,1x,a,1x,a,1x,a,1x,' Grid:',a)
435 c 991 format(
436 c *'# -----------------------------------------------------',/,
437 c *'# color plots in ',a,1x,a,1x,a,1x,a,/,
438 c *'# -----------------------------------------------------',/,
439 c *'echo ...color plots in ',a,1x,a,1x,a,1x,a)
440 
441  return
subroutine plotcoast(region, ifnum)
Subroutine to write GMT-based commands to create a shoreline Write GMT-based commands to create a sho...
Definition: plotcoast.f:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine coplotwcv ( character*3  ele,
character*200  fname,
real*8, dimension(maxplots)  bw,
real*8, dimension(maxplots)  be,
real*8, dimension(maxplots)  bs,
real*8, dimension(maxplots)  bn,
real*4, dimension(maxplots)  jm,
real*4, dimension(maxplots)  b1,
real*4, dimension(maxplots)  b2,
integer*4  maxplots,
character*10  olddtm,
character*10  newdtm,
character*10  region,
character*3  elecap,
  ij,
  cptlo,
  cpthi,
  cptin6,
character*200  suffixused,
  igridsec,
character*10, dimension(maxplots)  fn,
character*200  cvfname 
)

Subroutine to make GMT calls to do a color raster rendering of gridded data, with coverage overlaid.

Changelog

2016 09 08:

Had to up the D_FORMAT default to %.3G because tight scalebar ranges with the newly allowed "more free" average values were showing repeating values when only 2 digits could be shown.

2016 09 07:

Had to add lines pre/post "makecpt" to change the D_FORMAT. This is because I had been forcing the "scave" in cpt.f to be ONZD. But that yielded bad values sometimes, so I switched it. With that switch, the scave could have lots of digits. Well, that means the newly adopted "D_FORMAT" of %.2G was insufficient for the CPT table. Who knew that D_FORMAT affected that! Anyway, so change "D_FORMAT" pre/post all makecpt calls.

2016 08 30:

See item #39 in Google ToDo list Changed "grdcontour" to have a blank "-R" call so it'll mimic whatever decimal places are in the "grdimage" call that came before it.

2016 08 29:

Updated the initial -R and -B calls to 6 decimal places

2016 08 25:

  • .gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0
  • Center the plot with "-Xc" at grdimage
  • Center the scalebar by setting its Xcoordinate, which runs in "plot frame" coordinates (0/0 at lower left) , to be equal to "jm/2"
  • Force the scale bar to be exactly 4 inches wide, always
  • Change the format for "makecpt" from 0.6 to 0.10

2016 07 29:

  • Update to put more data into comment/echo
  • Forced grdcontour with -Ctemp.cpt to align contours with color palette

2016 07 28:

  • For d3 plots, to drop all contours
  • For d3 plots to only use "coverage" part only if "ij" is not "1"
  • Same for "09" and "ete" grids

2016 07 21:

  • Set the "JM" code in "grdcontour" to just be "-JM" and let it therefore run with whatever JM size is used in "grdimage"
  • Set the "A" code in "grdcontour" to be "-A-" which should turn off the labels on all contours
  • Fixed the size of the scale bar

2016 03 01:

  1. Changed to a continuous color plot
    • Get rid of "-Z" in "makecpt"
  2. Changed to an 8 color, from 6 color, plot (without changing the RANGE yet...see DRU-12, p. 19)
    • Change varible that comes in from "cptin" to "cptin6"
    • Compute cptin = cptin6 * 0.75d0 immediately

2016 02 29:

  1. Removed all shading from color plots
    • Get rid of "grdgradient" call
    • Remove from "grdimage" the "-Itempi.grd" part
    • Remove the "rm -f tempi.grd" line

Definition at line 68 of file coplotwcv.f.

References plotcoast().

Referenced by makeplotfiles02().

68 
69 c - 2016 09 08
70 c Had to up the D_FORMAT default to %.3G because tight scalebar ranges
71 c with the newly allowed "more free" average values were showing
72 c repeating values when only 2 digits could be shown.
73 
74 c - 2016 09 07
75 c Had to add lines pre/post "makecpt" to change the D_FORMAT. This is because
76 c I *had* been forcing the "scave" in cpt.f to be ONZD. But that yielded
77 c bad values sometimes, so I switched it. With that switch, the scave could
78 c have lots of digits. Well, that means the newly adopted "D_FORMAT" of %.2G
79 c was insufficient for the CPT table. Who knew that D_FORMAT affected that!
80 c Anyway, so change "D_FORMAT" pre/post all makecpt calls.
81 
82 c - 2016 08 30: See item #39 in Google ToDo list
83 c Changed "grdcontour" to have a blank "-R" call so it'll mimic whatever
84 c decimal places are in the "grdimage" call that came before it.
85 
86 c - 2016 08 29:
87 c Updated the initial -R and -B calls to 6 decimal places
88 
89 c - 2016 08 25:
90 c .gmtdefaults4 has been changed so X_ORIGIN is equal to 0.0
91 c Center the plot with "-Xc" at grdimage
92 c Center the scalebar by setting its Xcoordinate, which runs in "plot frame"
93 c coordinates (0/0 at lower left) , to be equal to "jm/2"
94 c Force the scale bar to be exactly 4 inches wide, always
95 c Change the format for "makecpt" from 0.6 to 0.10
96 
97 
98 c - 2016 07 29:
99 c Update to put more data into comment/echo
100 c - Forced grdcontour with -Ctemp.cpt to align contours with color palette
101 
102 c - Update 2016 07 28 to:
103 c For d3 plots, to drop all contours
104 c For d3 plots to only use "coverage" part *only* if "ij" is not "1"
105 c Same for "09" and "ete" grids
106 
107 c subroutine coplotwcv(ele,fname,bw,be,bs,bn,jm,b1,b2,maxplots,
108 c *olddtm,newdtm,region,elecap,ij,cptlo,cpthi,cptin,suffixused,
109 c *igridsec,fn,cvfname)
110 
111 c - Update 2016 07 21:
112 c - Set the "JM" code in "grdcontour" to just be "-JM" and let it therefore
113 c run with whatever JM size is used in "grdimage"
114 c - Set the "A" code in "grdcontour" to be "-A-" which should turn off
115 c the labels on all contours
116 c - Fixed the size of the scale bar
117 
118 
119 c - Update 2016 03 01:
120 c - 1) Changed to a continuous color plot
121 c * Get rid of "-Z" in "makecpt"
122 c 2) Changed to an 8 color, from 6 color, plot (without changing the RANGE yet...see DRU-12, p. 19)
123 c * Change varible that comes in from "cptin" to "cptin6"
124 c * Compute cptin = cptin6 * 0.75d0 immediately
125 
126 
127 c - Update 2016 02 29:
128 c - 1) Removed all shading from color plots
129 c * Get rid of "grdgradient" call
130 c * Remove from "grdimage" the "-Itempi.grd" part
131 c * Remove the "rm -f tempi.grd" line
132 c
133 
134  implicit real*8(a-h,o-z)
135 
136 c - Subroutine to make GMT calls to do a color raster rendering
137 c - of gridded data, with coverage overlaid.
138 
139  integer*4 maxplots
140  character*3 ele,elecap
141  character*200 fname,cvfname
142  character*10 olddtm,newdtm,region
143  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
144  real*4 jm(maxplots)
145  real*4 b1(maxplots),b2(maxplots)
146  character*10 fn(maxplots)
147  real*8 ave,std
148  character*200 suffixused
149  character*20 units
150  character*20 gridnote
151  character*20 gridnote2
152 
153 c ----------------------------------------------------
154 c - FAILSAFES: BEGIN
155 c ----------------------------------------------------
156  if(.not.(fname(1:3).eq.'vmt'.or.fname(1:3).eq.'vst' .or.
157  * fname(1:3).eq.'vmr'.or.fname(1:3).eq.'vsr'))then
158  write(6,2)trim(fname)
159  stop
160  endif
161  2 format('FATAL in coplotwcv. Bad character in spots 1-3: ',a)
162 
163  if(.not.(fname(4:5).eq.'cd' .or. fname(4:5).eq.'dd'))then
164  write(6,3)trim(fname)
165  stop
166  endif
167  3 format('FATAL in coplotwcv. Bad character in spots 4-5: ',a)
168 
169  if(fname(6:8).ne.ele)then
170  write(6,4)trim(fname),ele
171  stop
172  endif
173  4 format('FATAL in coplotwcv. Bad match of fname / ele: ',a,1x,a)
174 
175  if(fname(2:2).eq.'m')then
176  units='meters'
177  elseif(fname(2:2).eq.'s')then
178  units='arcseconds'
179  else
180  write(6,5)trim(fname)
181  stop
182  endif
183  5 format('FATAL in coplotwcv. Bad units in name: ',a)
184 
185  if(igridsec.le.0)then
186  write(6,6)igridsec
187  else
188  write(gridnote,10)igridsec
189  write(gridnote2,11)igridsec
190  endif
191  6 format('FATAL in coplotwcv. Bad igridsec: ',i0)
192  10 format('(',i0,' sec)')
193  11 format(i0,'.')
194 
195 c ----------------------------------------------------
196 c - FAILSAFES: END
197 c ----------------------------------------------------
198 
199 c ------------------------------------------------------------------
200 c - Contour interval and labeling
201 c ------------------------------------------------------------------
202 c - 2016 07 28: Scrapped the whole thing about scaling cptin.
203 c - Just bring in the interval for an 8 color spread, period.
204  cptin = cptin6
205 
206 c - 2016 03 01:
207 c cptin = cptin6 * 0.75d0
208 c - End 2016 03 01
209 
210  conin = cptin
211  conlb = conin / 2.d0
212 
213 c ----------------------------------------------
214 c - GMT COMMANDS: BEGIN
215 c ----------------------------------------------
216 
217 
218 c - Header of commands/echoes:
219 c - 2016 07 29:
220  write(99,991)ele,trim(units),trim(region),trim(fn(ij)),
221  *trim(suffixused),
222  *ele,trim(units),trim(region),trim(fn(ij)),
223  *trim(suffixused)
224 c write(99,991)ele,trim(units),trim(region),trim(fn(ij)),
225 c *ele,trim(units),trim(region),trim(fn(ij))
226 
227 
228 c - GMT call to create the color palette:
229 c - Store the palette as file "temp.cpt", to be
230 c - deleted later.
231  write(99,901)cptlo,cpthi,cptin
232 
233 c - Begin 2016 03 01:
234 c 901 format(
235 c *'makecpt -Crainbow -T',f0.6,'/',f0.6,'/',f0.6,
236 c *' -Z > temp.cpt')
237 c 901 format(
238 c *'makecpt -Crainbow -T',f0.6,'/',f0.6,'/',f0.6,
239 c *' > temp.cpt')
240 c - 2016 08 25
241 c 901 format(
242 c *'makecpt -Crainbow -T',f0.10,'/',f0.10,'/',f0.10,
243 c *' > temp.cpt')
244 c - 2016 09 07
245 c 901 format(
246 c *'gmtset D_FORMAT %.12G',/,
247 c *'makecpt -Crainbow -T',f0.10,'/',f0.10,'/',f0.10,
248 c *' > temp.cpt',/,
249 c *'gmtset D_FORMAT %.2G')
250 c - 2016 09 07
251  901 format(
252  *'gmtset D_FORMAT %.12G',/,
253  *'makecpt -Crainbow -T',f0.10,'/',f0.10,'/',f0.10,
254  *' > temp.cpt',/,
255  *'gmtset D_FORMAT %.3G')
256 
257 
258 c - GMT call to create the gradient file from
259 c - the "grd" formatted version of our input grid.
260 c - Store the gradients as file "tempi.grd" to be
261 c - deleted later.
262 
263 c - Updated 2016 02 29:
264 c write(99,902)fname(1:8),trim(suffixused)
265  902 format(
266  *'grdgradient ',a,'.',a,
267  *'.grd -N4.8 -A90 -M -Gtempi.grd')
268 c - Until here 2016 02 29
269 
270 c - GMT call to create the color render of the
271 c - gridded data. Store as file "plot.ps"
272 c - to be deleted later.
273 
274  write(99,903)fname(1:8),trim(suffixused),
275  *bw(ij),be(ij),bs(ij),bn(ij),
276  *jm(ij),b1(ij),b2(ij),
277  *trim(newdtm),trim(olddtm),elecap,igridsec,
278  *trim(region),trim(fn(ij)),'method noise'
279 
280 
281 c - Commented out for 2016 02 29:
282 c 903 format(
283 c *'grdimage ',a,'.',a,'.grd',
284 c *' -Ei -Itempi.grd',
285 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
286 c *' -JM',f3.1,'i -B',f0.2,'/',f0.2,
287 c *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
288 c *'(',i0,' sec)',
289 c *1x,a,'-',a,1x,a,
290 c *':" -Ctemp.cpt -K > plot.ps')
291 c - Commented out for 2016 03 01:
292 c 903 format(
293 c *'grdimage ',a,'.',a,'.grd',
294 c *' -Ei ',
295 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
296 c *' -JM',f3.1,'i -B',f0.2,'/',f0.2,
297 c *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
298 c *'(',i0,' sec)',
299 c *1x,a,'-',a,1x,a,
300 c *':" -Ctemp.cpt -K > plot.ps')
301 c - Below for 2016 08 25:
302 c 903 format(
303 c *'grdimage ',a,'.',a,'.grd',
304 c *' -Ei -Xc',
305 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
306 c *' -JM',f3.1,'i -B',f0.2,'/',f0.2,
307 c *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
308 c *'(',i0,' sec)',
309 c *1x,a,'-',a,1x,a,
310 c *':" -Ctemp.cpt -K > plot.ps')
311 c - 2016 08 29:
312  903 format(
313  *'grdimage ',a,'.',a,'.grd',
314  *' -Ei -Xc',
315  *' -R',f0.6,'/',f0.6,'/',f0.6,'/',f0.6,
316  *' -JM',f3.1,'i -B',f0.6,'/',f0.6,
317  *':."NADCON v5.0 ',a,' minus ',a,' ',a3,
318  *'(',i0,' sec)',
319  *1x,a,'-',a,1x,a,
320  *':" -Ctemp.cpt -K > plot.ps')
321 
322 c - GMT call to put a color scale on the map. Add it
323 c - to file "plot.ps".
324 
325 c - 2016 07 21:
326 c qqa = jm(ij) - 1.d0
327 c qqb = qqa / 2.d0
328 c write(99,904)qqb,qqa,trim(units)
329 c - 2016 08 25
330  qqa = jm(ij)/2
331  write(99,904)qqa,trim(units)
332 
333  904 format(
334  *'psscale -D',f3.1,'i/-0.4i/4.0i/0.2ih',
335  *' -Ctemp.cpt -I0.4 -B/:',a,
336  *': -O -K >> plot.ps')
337 
338 c write(99,904)trim(units)
339 c 904 format(
340 c *'psscale -D4i/-0.4i/8i/0.2ih -Ctemp.cpt -I0.4 -B/:',a,
341 c *': -O -K >> plot.ps')
342 
343 c - GMT call to put contours on the map.
344 
345 c - 2016 07 28...skip contours if this is a d3, 09 or "ete" plot
346  ll = len(trim(suffixused))
347  if(suffixused(ll-1:ll).eq.'d3')goto 807
348  if(suffixused(ll-1:ll).eq.'09')goto 807
349  if(fname(3:5).eq.'ete')goto 807
350 
351 c - 2016 08 30:
352  write(99,908)fname(1:8),trim(suffixused)
353 c - 2016 07 29:
354 c write(99,908)fname(1:8),trim(suffixused),
355 c *bw(ij),be(ij),bs(ij),bn(ij)
356 c - 2016 07 21:
357 c write(99,908)fname(1:8),trim(suffixused),conin,
358 c *bw(ij),be(ij),bs(ij),bn(ij)
359 c write(99,908)fname(1:8),trim(suffixused),conin,
360 c *bw(ij),be(ij),bs(ij),bn(ij),
361 c *jm(ij),conlb
362 
363 c - 2016 08 30
364  908 format(
365  *'grdcontour ',a,'.',a,'.grd',
366  *' -Ctemp.cpt',
367  *' -R',
368  *' -JM -Wthin',
369  *' -A- -O -K >> plot.ps')
370 c - 2016 07 29:
371 c 908 format(
372 c *'grdcontour ',a,'.',a,'.grd',
373 c *' -Ctemp.cpt',
374 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
375 c *' -JM -Wthin',
376 c *' -A- -O -K >> plot.ps')
377 c - 2016 07 21:
378 c 908 format(
379 c *'grdcontour ',a,'.',a,'.grd',
380 c *' -C',f0.5,
381 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
382 c *' -JM -Wthin',
383 c *' -A- -O -K >> plot.ps')
384 c 908 format(
385 c *'grdcontour ',a,'.',a,'.grd',
386 c *' -C',f0.5,
387 c *' -R',f0.2,'/',f0.2,'/',f0.2,'/',f0.2,
388 c *' -JM',f3.1,'i -Wthin',
389 c *' -A',f0.5,' -O -K >> plot.ps')
390 
391 c - 2016 07 28 - Skip to here (skipping contours) for d3, 09 or "ete" plots
392  807 continue
393 
394 c - 2016 07 28 - Skip the coverage if this is a "d3" plot, 09 plot or "ete" plot *and*
395 c - we are at the overall map level of 1 ("entire")
396  if(suffixused(ll-1:ll).eq.'d3' .and. ij.eq.1)goto 808
397  if(suffixused(ll-1:ll).eq.'09' .and. ij.eq.1)goto 808
398  if(fname(3:5).eq.'ete' .and. ij.eq.1)goto 808
399 
400 c - GMT call to overlay the coverage
401  write(99,909)trim(cvfname)
402 
403  909 format(
404  *'psxy ',a,' -R -J -Sc0.02i -Gblack -O -K >> plot.ps')
405 
406  808 continue
407 
408 c - GMT call to create the shoreline. Add it to
409 c - file "plot.ps".
410 c - ALWAYS plot the coast last, as it closes the PS file
411  call plotcoast(region,99)
412 
413 c - GMT call to convert the plot.ps file to plot.jpg.
414  write(99,905)
415  905 format(
416  *'ps2raster plot.ps -Tj -P -A')
417 
418 c - Change name of JPG to its final name:
419  write(99,906)fname(2:8),trim(suffixused),trim(fn(ij))
420  906 format('mv plot.jpg c',a,'.',a,'.',a,'.jpg')
421 
422 c - Remove all the temporary files
423  write(99,907)
424 
425 c - Updated 2016 02 29:
426 c 907 format(
427 c *'rm -f temp.cpt',/,
428 c *'rm -f tempi.grd',/,
429 c *'rm -f plot.ps')
430  907 format(
431  *'rm -f temp.cpt',/,
432  *'rm -f plot.ps')
433 c - Until here 2016 02 29
434 
435 
436  991 format(
437  *'# -----------------------------------------------------',/,
438  *'# color plots with coverage in ',a,1x,a,1x,a,1x,a,
439  * 1x,' Grid:',a/,
440  *'# -----------------------------------------------------',/,
441  *'echo ...color plots with coverage in ',a,1x,a,1x,a,1x,a,
442  * 1x,' Grid:',a)
443 c 991 format(
444 c *'# -----------------------------------------------------',/,
445 c *'# color plots with coverage in ',a,1x,a,1x,a,1x,a,/,
446 c *'# -----------------------------------------------------',/,
447 c *'echo ...color plots with coverage in ',a,1x,a,1x,a,1x,a)
448 
449  return
subroutine plotcoast(region, ifnum)
Subroutine to write GMT-based commands to create a shoreline Write GMT-based commands to create a sho...
Definition: plotcoast.f:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine cpt ( real*8  ave,
real*8  std,
real*8  csm,
real*8  xlo,
real*8  xhi,
real*8  xin 
)

This subroutine generates the color pallette variables for a GMT color plot.

Parameters
[in]aveAverage of the gridded data
[in]stdStandard deviation of the gridded data
[in]csmColor Sigma Multiplier (how many sigmas on each side of the average do you want the colors to range?)
[out]xloLow value
[out]xhiHigh value
[out]xinInterval

Changelog

2016 09 06:

Modified because the forcing of "scave" to be one non zero digit was throwing off the scalebar so far in Guam that the data in Guam wasn't even plotting. Change to make the interval still be one non zero digit, but then a simpler formula for the scaled average was put in.

2016 07 29:

Modified from original version to reflect "new math" invented this week that helps shrink the color bar and/or widen the color bar (see issues 14 and 15 in DRU-12, p. 48)

Definition at line 28 of file cpt.f.

Referenced by makeplotfiles02().

28 
29 c - 2016 09 06
30 c Modified because the forcing of "scave" to be one non zero
31 c digit was throwing off the scalebar so far in Guam that
32 c the data in Guam wasn't even plotting. Change to make
33 c the interval still be one non zero digit, but then a
34 c simpler formula for the scaled average was put in.
35 
36 c - 2016 07 29
37 c Modified from original version to reflect "new math" invented
38 c this week that helps shrink the color bar and/or widen the
39 c color bar (see issues 14 and 15 in DRU-12, p. 48)
40 
41  implicit none
42  real*8 ave,std,csm,xlo,xhi,xin
43  real*8 qv,qq,scave
44  integer*4 iv,iq
45  real*8 spread8,onzd2
46 c - This subroutine generates the color pallette variables
47 c - for a GMT color plot
48 c
49 c - Input:
50 c ave = Average of the gridded data
51 c std = Standard deviation of the gridded data
52 c csm = Color Sigma Multiplier (how many sigmas on each
53 c side of the average do you want the colors to range?)
54 c - Output:
55 c xlo = Low value
56 c xhi = High value
57 c xin = Interval
58 
59  spread8 = 2 * csm * std / 8.d0
60  xin = onzd2(spread8)
61 
62 c iv = floor(dlog10(std))
63 c qv = 10.d0**iv
64 c qq = std / qv
65 c iq = nint(qq)
66 
67 c - 2016 09 06
68 c write(6,*) ' cpt: ave (pre onzd2) = ',ave
69 c scave = onzd2(ave)
70 c write(6,*) ' cpt: ave (post onzd2) = ',ave
71  scave = xin * nint(ave / xin)
72 
73 c xin = iq * qv
74 c scave = qv * nint(ave/qv)
75 
76 c xlo = scave - csm*xin
77 c xhi = scave + csm*xin
78 
79  xlo = scave - 4*xin
80  xhi = scave + 4*xin
81 
82  write(6,*) ' ---------------------'
83  write(6,*) 'cpt: ave = ',ave
84  write(6,*) 'cpt: std = ',std
85  write(6,*) 'cpt: csm = ',csm
86  write(6,*) 'cpt: spread8 = ',spread8
87  write(6,*) 'cpt: targ low = ',ave-csm*std
88  write(6,*) 'cpt: targ high= ',ave+csm*std
89  write(6,*) ' '
90  write(6,*) 'cpt: xin = ',xin
91  write(6,*) 'cpt: scave = ',scave
92  write(6,*) 'cpt: xlo = ',xlo
93  write(6,*) 'cpt: xhi = ',xhi
94 
95  return
real *8 function onzd2(x)
Function to round a digit to one significant figure (one non zero digit), double precision.
Definition: onzd2.f:32

+ Here is the caller graph for this function:

subroutine cpt2 ( real*8  med,
real*8  csm,
real*8  xlo,
real*8  xhi,
real*8  xin 
)

This subroutine generates the color pallette variables for a GMT color plot.

This particular routine is best for data that are all positive, but cluster near a small value while having a lot of outliers to the high-side. The color plot uses the MEDIAN (and a multiplier) to set the upper limit, while forcing the lower limit to be ZERO.

Parameters
[in]medMedian of the gridded data
[in]csmColor Sigma Multiplier (The maximum color range will be based on csm*med. The minimum color range will be zero)
[out]xloLow value
[out]xhiHigh value
[out]xinInterval

Definition at line 21 of file cpt2.f.

Referenced by makeplotfiles02(), and makeplotfiles03().

21  implicit none
22  real*8 med,csm,xlo,xhi,xin
23  real*8 qv,qq,spread,std
24  integer*4 iv,iq
25 c - This subroutine generates the color pallette variables
26 c - for a GMT color plot. This particular routine is best
27 c - for data that are all positive, but cluster near a small
28 c - value while having a lot of outliers to the high-side.
29 c - The color plot uses the MEDIAN (and a multiplier)
30 c - to set the upper limit, while forcing the lower limit
31 c - to be ZERO.
32 c
33 c - Input:
34 c med = Median of the gridded data
35 c csm = Color Sigma Multiplier (The maximum color range will
36 c be based on csm*med. The minimum color range will
37 c be zero)
38 c - Output:
39 c xlo = Low value
40 c xhi = High value
41 c xin = Interval
42 
43  spread = csm*med
44  std = spread/8.d0
45 
46  iv = floor(dlog10(std))
47  qv = 10.d0**iv
48  qq = std / qv
49  iq = nint(qq)
50 
51  xin = iq * qv
52 
53  xlo = 0.d0
54  xhi = 8 * xin
55  return

+ Here is the caller graph for this function:

real function cubterp (   x,
  f0,
  f1,
  f2,
  f3 
)

This function fits a cubic function through four points.

This function fits a cubic function through four equally spaced points along the x-axis at indices 0, 1, 2 and 3. The spacing along the x-axis is "dx"

Thus:

\begin{eqnarray*} f0 = f_0 &= y(x_0) \\ f1 = f_1 &= y(x_1) \\ f2 = f_2 &= y(x_2) \\ f3 = f_3 &= y(x_3) \end{eqnarray*}

Where:

\begin{eqnarray*} x_1 &= x_0 + dx \\ x_2 &= x_1 + dx \\ x_3 &= x_2 + dx \end{eqnarray*}

The input value is some value of "x" that falls between 0 and 3. The output value (cubterp) is the cubic function at x.

Parameters
[in]xCompute Interpolation at this positon, a value between 0 and 3 it is scaled relative to x_0 x_3 and dx. For example, a value of 1.5 is x_0 + 1.5*dx which falls between x1 and x2
[in]f0y value at x_0
[in]f1y value at x_1 = x_0 + dx
[in]f2y value at x_2 = x_0 + dx
[in]f3y value at x_3 = x_0 + dx`

This function uses Newton-Gregory forward polynomial

\begin{eqnarray*} \nabla f_0 &=& f_1 -f_0 \\ \nabla f_1 &=& f_2 -f_1 \\ \nabla^2 f_0 &=& \nabla f_1 - \nabla f_0 \\ cubterp(x, f_0, f_1, f_2, f_3) &=& f_0 + x \nabla f_0 + 0.5 x \left( x-1.0 \right) \nabla^2 f_0 \end{eqnarray*}

Definition at line 48 of file cubterp.f.

48 
49 c - x = real*4
50 c - f0,f1,f2,f3 = real*4
51 
52 c - This function fits a cubic function through
53 c - four points, *equally* spaced along the x-axis
54 c - at indices 0, 1, 2 and 3. The spacing along the
55 c - x-axis is "dx"
56 c - Thus:
57 c -
58 c - f0 = y(x(0))
59 c - f1 = y(x(1))
60 c - f2 = y(x(2))
61 c - f3 = y(x(3))
62 c - Where
63 c - x(1) = x(0) + dx
64 c - x(2) = x(1) + dx
65 c - x(3) = x(2) + dx
66 
67 c - The input value is some value of "x" that falls
68 c - between 0 and 3. The output value (cubterp) is
69 c - the cubic function at x.
70 c -
71 c - This function uses Newton-Gregory forward polynomial
72 
73 c df0 =f1 -f0
74 c df1 =f2 -f1
75 c d2f0=df1-df0
76 
77 c qterp=f0 + x*df0 + 0.5*x*(x-1.0)*d2f0
78 
79  df0 = f1 - f0
80  df1 = f2 - f1
81  df2 = f3 - f2
82 
83  d2f0 = df1 - df0
84  d2f1 = df2 - df1
85 
86  d3f0 = d2f1 - d2f0
87 
88  cubterp=f0 + x*df0 + 0.5*x*(x-1.0)*d2f0
89  * +(1.0/6.0)*d3f0*x*(x-1.0)*(x-2.0)
90 
91  return
real function cubterp(x, f0, f1, f2, f3)
This function fits a cubic function through four points.
Definition: cubterp.f:48
program decimate ( )

Part of the NADCON5 NADCON5 Core Library , Extract a reduced (1 of n) dataset.

Decimate - Extract 1 of every n points

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput File Name
outfileOutput File Name
nyLatitude Decimation Ratio 1:ny
nxLongitude Decimation Ratio 1:nx

Program Inputs:

  • lin Input File A

Program Outputs:

  • lout Output File to Write Decimated File

Definition at line 25 of file decimate.f.

References inouti(), and inoutr().

+ Here is the call graph for this function:

program gabs ( )

Part of the NADCON5 NADCON5 Core Library , Convert values in a *.b grid to absolute value.

Belongs to the suite of ".b" file manipulators

This program will convert every value in a ".b" grid to its absolute value.

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput File Name
outfileOutput File Name

Program Inputs:

  • lin Input File (*.b grid)

Program Outputs:

  • lout Output File (*.b grid)

Definition at line 26 of file gabs.f.

subroutine getgridbounds ( character*10  region,
real*8  xn,
real*8  xs,
real*8  xw,
real*8  xe 
)

Subroutine to collect up the GRID boundaries for use in creating NADCON 5.

This CAN BE different than the MAP boundaries as such:

GRID boundaries will be just four values (n/s/w/e) for any region

MAP boundaries will allow multiple maps to be made and may or may not align with the GRID boundaries. Used to allow for more "close up" maps and such, without the need to screw up the MAP boundaries.

Parameters
[in]regionRegion Name
[out]xnnorth boundary for this region
[out]xssouth boundary for this region
[out]xwwest boundary for this region
[out]xeeast boundary for this region

Subroutine Input Files:

  • `Data/grid.parameters

Definition at line 26 of file getgridbounds.f.

Referenced by checkgrid(), makework(), mymedian5(), and myrms().

26 c
27 c - Subroutine to collect up the GRID boundaries
28 c - for use in creating NADCON 5
29 c
30 c - This CAN BE different than the MAP boundaries
31 c - as such:
32 c
33 c - GRID boundaries will be just four values (n/s/w/e) for any region
34 c
35 c - MAP boundaries will allow multiple maps to be made and may or may
36 c - not align with the GRID boundaries. Used to allow for more
37 c - "close up" maps and such, without the need to screw up the
38 c - MAP boundaries.
39 
40 c - Input:
41 c region
42 c - Output:
43 c xn,xs,xw,xe = N/S/W/E boundaries of the grid to be
44 c created for this region
45 
46  character*10 region
47  real*8 xn,xs,xw,xe
48  character*80 card
49 
50  ifile = 3
51 
52  open(ifile,
53  *file='Data/grid.parameters',
54  *status='old',form='formatted')
55 
56 c - Read 2 header lines
57  read(ifile,'(a)')card
58  read(ifile,'(a)')card
59 
60 c - Now loop and find our region
61  1 read(ifile,'(a)',end=2)card
62  if(trim(card(1:10)).eq.trim(region))then
63  read(card(14:23),*)xn
64  read(card(27:36),*)xs
65  read(card(40:49),*)xw
66  read(card(53:62),*)xe
67  close(ifile)
68  return
69  endif
70  goto 1
71 
72 c - If we get here, the region sent to this subroutine wasn't found
73 c - in our file /Data/grid.parameters. Crash and burn.
74  2 write(6,100)trim(region)
75  stop 10001
76  100 format(6x,'FATAL Subroutine getgridbounds: Unknown region: ',a)
77 

+ Here is the caller graph for this function:

subroutine getmag (   x,
  ix 
)

Subroutine to return the magnitude of a double precision value.

Parameters
[out]xresult, magnitude of ix
[in]ixinput douple precision

Definition at line 9 of file getmag.f.

9 c - Subroutine to return the magnitude of a double precision
10 c - value.
11  implicit real*8 (a-h,o-z)
12  y = dlog10(x)
13  ix = floor(y)
14  write(6,*) ' getmag: x,y,ix = ',x,y,ix
15  return
subroutine getmapbounds ( character*1  mapflag,
  maxplots,
character*10  region,
  nplots,
character*10  olddtm,
character*10  newdtm,
real*8, dimension(maxplots)  bw,
real*8, dimension(maxplots)  be,
real*8, dimension(maxplots)  bs,
real*8, dimension(maxplots)  bn,
real*4, dimension(maxplots)  jm,
real*4, dimension(maxplots)  b1,
real*4, dimension(maxplots)  b2,
character*10, dimension(maxplots)  fn,
logical, dimension(maxplots)  lrv,
real*8, dimension(maxplots)  rv0x,
real*8, dimension(maxplots)  rv0y,
real*8, dimension(maxplots)  rl0y 
)

Subroutine to collect up the MAP boundaries for use in creating NADCON 5.

This CAN BE different than the GRID boundaries as such:

GRID boundaries will be just four values (n/s/w/e) for any region

MAP boundaries will allow multiple maps to be made and may or may not align with the GRID boundaries. Used to allow for more "close up" maps and such, without the need to screw up the MAP boundaries.

Parameters
[in]mapflagMap Generation Flag
[in]maxplots
[in]regionregion to get map bounds
[out]nplotsnumber of plots generated
[in]olddtmsource datum
[in]newdtmtarget datum
[out]bwwestern bound of plot (Array of length maxplots)
[out]beeastern bound of plot (Array of length maxplots)
[out]bssouthern bound of plot (Array of length maxplots)
[out]bnnorthern bound of plot (Array of length maxplots)
[out]jm(Array of length maxplots)
[out]b1(Array of length maxplots)
[out]b2(Array of length maxplots)
[out]fn(Array of length maxplots)
[out]lrv(Array of length maxplots)
[out]rv0x(Array of length maxplots)
[out]rv0y(Array of length maxplots)
[out]rl0y(Array of length maxplots)

Version for NADCON 5 Built upon the original version used in GEOCON v2.0 Do not use with GEOCON v2.0

Broken down into sub-subroutines to make it easier to swap out when I make different choices.

Changelog

2016 08 29:

Taking in olddtm and newdtm now, and adding code to use that to filter out "Saint" regions in Alaska when plotting transformations not supported in those regions.

2016 08 26:

Used actual mercator projection math to compute the exact reference vector and label locations 1/2 inch and 3/4 inch respectively below the S/W corner of the plot.

2016 07 21:

Two new columns added to "map.parameters", which have the location of the reference vector. Return a logical "lrv" as true if there is an optional special location for the reverence vector. Return as false if not. If true, return lon/lat coords of ref vector origin in rv0x/rv0y. If false, return zeros in those fields.

Also, compute "jm" on the fly, ignoring what is in the table. All plots will now be forced PORTRAIT and forced no wider than 6" and no taller than 8", while maintaining proper X/Y ratios in a Mercator projection. That means, make the biggest plot possible, with the right ratio, that is neither wider than 6" nor taller than 8" and then, whatever the width of that largest plot is – return that width in the "jm" field.

Definition at line 73 of file getmapbounds.f.

Referenced by checkgrid(), makeplotfiles01(), makeplotfiles02(), and makeplotfiles03().

73 
74 c - 2016 08 29: Taking in olddtm and newdtm now, and adding
75 c - code to use that to filter out "Saint" regions in Alaska
76 c - when plotting transformations not supported in those regions.
77 
78 c - 2016 08 26: Used actual mercator projection math to compute
79 c - the exact reference vector and label locations 1/2 inch and
80 c - 3/4 inch respectively below the S/W corner of the plot.
81 
82 c - Updated 2016 07 21: Two new columns added to "map.parameters", which
83 c - have the location of the reference vector. Return a logical "lrv"
84 c - as true if there is an optional special location for the reverence vector.
85 c - Return as false if not. If true, return lon/lat coords of ref vector
86 c - origin in rv0x/rv0y. If false, return zeros in those fields.
87 c -
88 c - Also, compute "jm" on the fly, ignoring what is in the table. All plots
89 c - will now be forced PORTRAIT and forced no wider than 6" and no taller
90 c - than 8", while maintaining proper X/Y ratios in a Mercator projection.
91 c - That means, make the biggest plot possible, with the right ratio, that
92 c - is neither wider than 6" nor taller than 8" and then, whatever the width
93 c - of that largest plot is -- return that width in the "jm" field.
94 
95 c
96 c - Subroutine to collect up the MAP boundaries
97 c - for use in creating NADCON 5
98 c
99 c - This CAN BE different than the GRID boundaries
100 c - as such:
101 c
102 c - GRID boundaries will be just four values (n/s/w/e) for any region
103 c
104 c - MAP boundaries will allow multiple maps to be made and may or may
105 c - not align with the GRID boundaries. Used to allow for more
106 c - "close up" maps and such, without the need to screw up the
107 c - MAP boundaries.
108 
109 c - Input:
110 c region, maxplots, mapflag
111 c olddtm, newdtm
112 c - Output:
113 c number of plots, their bounds, their GMT scales and
114 c label deltas
115 
116 c - Version for NADCON 5
117 c - Built upon the original version used in GEOCON v2.0
118 c - Do not use with GEOCON v2.0
119 
120 c - Broken down into sub-subroutines to make it easier
121 c - to swap out when I make different choices.
122 
123  character*10 region,olddtm,newdtm
124  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
125  real*4 jm(maxplots)
126  real*4 b1(maxplots),b2(maxplots)
127  character*10 fn(maxplots)
128  character*1 mapflag
129 
130 
131 c - 2016 07 21:
132  logical lrv(maxplots)
133  real*8 rv0x(maxplots),rv0y(maxplots),rl0y(maxplots)
134  character*3 c3x,c3y
135  character*2 c2x,c2y
136  real*8 pi,d2r
137 
138  character*200 card
139 
140 
141  pi = 2.d0*dasin(1.d0)
142  d2r = pi/180.d0
143 
144  ifile = 3
145 
146  open(ifile,
147  *file='Data/map.parameters',
148  *status='old',form='formatted')
149 
150 c - Get numerical version of mapflag
151  read(mapflag,*)iflag
152 
153 c - Get the header out of the way
154  read(ifile,'(a)')card
155  read(ifile,'(a)')card
156 
157 c - Loop over all map parameters, finding the ones relevant to
158 c - our region and mapflag.
159  i = 0
160  1 read(ifile,'(a)',end=2)card
161  if(card( 1:10).ne.region)goto 1
162  read(card(14:14),*)iflag0
163  if(iflag0.gt.iflag)goto 1
164 
165 c - 2016 08 29:
166 c - Specific to the case where we are looking at region=alaska,
167 c - and NOT region=<some saint island>, then for the specific
168 c - case of transforming from NAD 27 forward, let's skip
169 c - the <saint islands>
170  if(region.eq.'alaska' .and.
171  * iflag.eq.2 .and.
172  * iflag0.eq.2 .and.
173  * (card(16:25).eq.'stpaul' .or.
174  * card(16:25).eq.'stgeorge' .or.
175  * card(16:25).eq.'stlawrence' .or.
176  * card(16:25).eq.'stmatthew') .and.
177  * olddtm.eq.'nad27' )goto 1
178 
179  i = i + 1
180  fn(i) = trim(card( 16: 25))
181  read(card( 27: 30),*)iwd
182  read(card( 32: 33),*)iwm
183  read(card( 35: 38),*)ied
184  read(card( 40: 41),*)iem
185  read(card( 43: 45),*)isd
186  read(card( 47: 48),*)ism
187  read(card( 50: 52),*)ind
188  read(card( 54: 55),*)inm
189  read(card( 57: 60),*)xjm
190  read(card( 62: 64),*)ib1d
191  read(card( 66: 67),*)ib1m
192  read(card( 69: 71),*)ib2d
193  read(card( 73: 74),*)ib2m
194 c - 2016 07 21:
195  read(card( 76: 78),'(a3)')c3x
196  read(card( 80: 81),'(a2)')c2x
197  read(card( 83: 85),'(a3)')c3y
198  read(card( 87: 88),'(a2)')c2y
199 
200  bw(i) = dble(iwd) + dble(iwm)/60.d0
201  be(i) = dble(ied) + dble(iem)/60.d0
202  if(ind.lt.0)inm = -inm
203  if(isd.lt.0)ism = -ism
204  bn(i) = dble(ind) + dble(inm)/60.d0
205  bs(i) = dble(isd) + dble(ism)/60.d0
206  jm(i) = xjm
207  b1(i) = dble(ib1d) + dble(ib1m)/60.d0
208  b2(i) = dble(ib2d) + dble(ib2m)/60.d0
209 
210 c - 2016 07 21 (Optional reference vector locations):
211  if(c3x.eq.'---')then
212  lrv(i) = .false.
213  rv0x(i) = 0
214  rv0y(i) = 0
215  else
216  lrv(i) = .true.
217  read(c3x,*)rv0xd
218  read(c2x,*)rv0xm
219  read(c3y,*)rv0yd
220  read(c2y,*)rv0ym
221  rv0x(i) = dble(rv0xd) + dble(rv0xm)/60.d0
222  rv0y(i) = dble(rv0yd) + dble(rv0ym)/60.d0
223  endif
224 
225 c - 2016 07 21 (Forcing the map to keep its proper Mercator-projected X/Y ratio,
226 c - while filling the maximum space that does not exceed 6" wide nor 8" high)
227  dx = (be(i) - bw(i)) * d2r
228 
229  q1 = dtan(bn(i)*d2r)
230  q2 = 1.d0 / dcos(bn(i)*d2r) ! Secant
231  yn = log(q1 + q2)
232 
233  q1 = dtan(bs(i)*d2r)
234  q2 = 1.d0 / dcos(bs(i)*d2r) ! Secant
235  ys = log(q1 + q2)
236 
237  dy = yn - ys
238 
239  ratio = dx/dy
240 
241 c - Max height and width
242 c xmxht = 8
243  xmxht = 6
244  xmxwd = 6
245 
246  if(xmxht*ratio .gt. xmxwd)then
247  jm(i) = xmxwd
248 c - And height = xmxwd / ratio...
249  else
250  jm(i) = xmxht*ratio
251 c - And height = xmxht
252  endif
253 
254 c - 2016 08 26
255 c See DRU-12, p. 56-57
256 c - dy/dphi is linear for latitudes south of 65. All of our plots
257 c - have at most a 65 degree south border. So I can use that for
258 c - a pretty good approximation to compute the latitude of the
259 c - reference vector, in degrees, to send back as "rv0y".
260 
261 c First, get the ratio of dx/dy in the lower left part of the
262 c - plot. Use 1% of the E/W span and apply that both ways.
263  ddum = 0.01d0*(be(i) - bw(i))
264  ydum = bs(i) + ddum
265  xdum = bw(i) + ddum
266 
267  xw = bw(i) * d2r
268  xe = xdum * d2r
269 
270  dx = (xe - xw)
271 
272  q1 = dtan(ydum*d2r)
273  q2 = 1.d0 / dcos(ydum*d2r) ! Secant
274  yn = log(q1 + q2)
275 
276  q1 = dtan(bs(i)*d2r)
277  q2 = 1.d0 / dcos(bs(i)*d2r) ! Secant
278  ys = log(q1 + q2)
279 
280 c - dy is in radians
281  dy = yn - ys
282 
283 c - Now I have a new "dx" and "dy" representing the lower left 1% of the plot,
284 c - in radians/radians. Compute the new ratio for this part.
285  ratio = dx/dy
286 
287 c - Since radians to inches does NOT change in the E/W direction, and since
288 c - I know exactly how wide the plot is, I can compute a radians/inch conversion
289 c - in E/W, for 1% of the width of the plot.
290  r2iew = (0.01d0 * jm(i)) / dx
291 
292 c - The ratio of dx/dy, is going to be identical to the ratio of r2iew/r2ins:
293  r2ins = r2iew / ratio
294 
295 c - Convert r2ins into degrees-to-inches
296  d2ins = r2ins * d2r
297 
298 c - Now, the south edge is known in degrees. I want the reference vector
299 c - to be 1/2 inch below that. I want the reference vector label to
300 c - be an additional 1/4 inches down.
301  rv0y(i) = bs(i) - (0.50d0)/d2ins
302  rl0y(i) = bs(i) - (0.65d0)/d2ins
303 
304 c - And set the reference vector's left edge to equal the left edge of the plot
305  rv0x(i) = bw(i)
306 
307 c - Flags for debugging
308  write(6,8) trim(fn(i))
309  8 format('***************************',/,
310  * 'Reference Vector Computations for',
311  * 'Sub-Region: ',a)
312 
313  write(6,*) ' yn,ys,dy = ',yn,ys,dy
314  write(6,*) ' xe,xw,dx = ',xe,xw,dx
315  write(6,*) ' E/W width (jm) = ',jm(i)
316  write(6,*) ' SW ratio = ',ratio
317  write(6,*) ' SW bounds,Lat = ',ydum,bs(i)
318  write(6,*) ' SW bounds,Lon = ',xdum,bw(i)
319  write(6,*) ' r2i E/W = ',r2iew
320  write(6,*) ' r2i N/S = ',r2ins
321  write(6,*) ' d2i N/S = ',d2ins
322  write(6,*) ' Southwest corner = ',bs(i),bw(i)
323  write(6,*) ' Ref Vector = ',rv0y(i),rv0x(i)
324  write(6,*) ' Ref Label = ',rl0y(i),rv0x(i)
325 
326  goto 1
327 
328  2 nplots = i
329 
330  close(ifile)
331 
332  if(nplots.eq.0)then
333  write(6,100)trim(region)
334  stop 10001
335  endif
336  100 format(6x,'FATAL Subroutine getmapbounds: Unknown region: ',a)
337  return

+ Here is the caller graph for this function:

subroutine gridstats ( character*200  fname,
  ave,
  std,
real*8  med 
)

Subroutine to print grid statistics to stdout.

Parameters
[in]fnamename of grid stat file
[out]aveaverage
[out]stdstandard deviatio
[out]median

Definition at line 10 of file gridstats.f.

Referenced by makeplotfiles02(), and makeplotfiles03().

10  implicit real*8(a-h,o-z)
11  parameter(nmax = 1561*3541)
12  real*8 med
13  real*4 data(5000),s1,select2,arr(nmax)
14  integer*4 nla,nlo,ikind
15  character*200 fname
16  open(11,file=fname,status='old',form='unformatted')
17 
18  ave = 0.d0
19  rms = 0.d0
20 
21  read(11)glamn,glomn,dla,dlo,nla,nlo,ikind
22  if(ikind.eq.0)stop 20304
23 
24  ikt = 0
25  do 1 i=1,nla
26  if(ikind.eq.1)read(11)(data(j),j=1,nlo)
27  do 3 j=1,nlo
28  ikt = ikt + 1
29  arr(ikt) = data(j)
30  3 continue
31  do 2 j=1,nlo
32  ave = ave + dble(data(j))
33  rms = rms + dble(data(j))**2
34  2 continue
35  1 continue
36  fact = dble(nla*nlo) / dble(nla*nlo - 1)
37 
38  ave = ave / dble(nla*nlo)
39  rms = sqrt(rms / dble(nla*nlo))
40  std = dsqrt(fact*(rms**2 - ave**2))
41 
42  npts = ikt
43  nmed = 1+ ikt/2
44 
45  write(6,*) ' IN gridstats, npts = ',npts
46  write(6,*) ' IN gridstats, nmed = ',nmed
47 
48 c nmed = ikt/3
49  s1 = select2(nmed,npts,arr,nmax)
50 
51  write(6,*) ' IN gridstats, s1 = ',s1
52  med = s1
53  write(6,*) ' IN gridstats, med = ',med
54 
55  write(6,100)trim(fname),ave,std,med
56  100 format('gridstats for ',a,' = ',3f20.10)
57 
58  close(11)
59 
60  return
real *8 function select2(k, n, arr, nmax)
Function to select an element of a partially filled, but packed multi dimensional array...
Definition: select2_dbl.for:18

+ Here is the caller graph for this function:

program gscale ( )

Part of the NADCON5 NADCON5 Core Library , Scales a grid by a factor.

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput File Name
factorScaling Factor
outfileOutput File Name

Program Inputs:

  • lin1 Input File

Program Outputs:

  • lout Output File

Definition at line 23 of file gscale.f.

program gsqr ( )

Part of the NADCON5 NADCON5 Core Library , Squares values in a *.b grid.

Belongs to the suite of ".b" file manipulators

This program will convert every value in a ".b" grid to its squared value.

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput File Name
outfileOutput File Name

Program Inputs:

  • lin Input File (*.b grid)

Program Outputs:

  • lout Output File (*.b grid)

Definition at line 26 of file gsqr.f.

program gsqrt ( )

Part of the NADCON5 NADCON5 Core Library , Square Root of values in a *.b grid.

Belongs to the suite of ".b" file manipulators

This program will convert every value in a ".b" grid to its square-root value.

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput File Name
outfileOutput File Name

Program Inputs:

  • lin Input File (*.b grid)

Program Outputs:

  • lout Output File (*.b grid)

Definition at line 26 of file gsqrt.f.

subroutine indexxd ( integer  n,
integer  nd,
real*8, dimension(nd)  arr,
integer, dimension(nd)  indx 
)

Subroutine to perform ?? indexing on floating point data (double precision)

Parameters
[in]nnumber of iterations (rows?)
[in]ndarray and index dimensions
[in]arrinput data array
[out]indxindex out

Changelog

1/8/2004:

Modified to allow indx and arr to be DIMENSIONED differently than the number of good values they contain

11/7/2003

Modified to REAL*8 by D. Smith,

Definition at line 20 of file indexxd.for.

Referenced by getmedian().

20 c - Modified to REAL*8 by D. Smith, 11/7/2003
21 c - Further modified 1/8/2004 to allow indx and arr to
22 c - be DIMENSIONED differently than the number of good
23 c - values they contain
24 
25  integer nd
26  INTEGER n,indx(nd),m,nstack
27  REAL*8 arr(nd)
28  parameter(m=7,nstack=50)
29  INTEGER i,indxt,ir,itemp,j,jstack,k,l,istack(nstack)
30  REAL*8 a
31  do 11 j=1,n
32  indx(j)=j
33 11 continue
34  jstack=0
35  l=1
36  ir=n
37 1 if(ir-l.lt.m)then
38  do 13 j=l+1,ir
39  indxt=indx(j)
40  a=arr(indxt)
41  do 12 i=j-1,1,-1
42  if(arr(indx(i)).le.a)goto 2
43  indx(i+1)=indx(i)
44 12 continue
45  i=0
46 2 indx(i+1)=indxt
47 13 continue
48  if(jstack.eq.0)return
49  ir=istack(jstack)
50  l=istack(jstack-1)
51  jstack=jstack-2
52  else
53  k=(l+ir)/2
54  itemp=indx(k)
55  indx(k)=indx(l+1)
56  indx(l+1)=itemp
57  if(arr(indx(l+1)).gt.arr(indx(ir)))then
58  itemp=indx(l+1)
59  indx(l+1)=indx(ir)
60  indx(ir)=itemp
61  endif
62  if(arr(indx(l)).gt.arr(indx(ir)))then
63  itemp=indx(l)
64  indx(l)=indx(ir)
65  indx(ir)=itemp
66  endif
67  if(arr(indx(l+1)).gt.arr(indx(l)))then
68  itemp=indx(l+1)
69  indx(l+1)=indx(l)
70  indx(l)=itemp
71  endif
72  i=l+1
73  j=ir
74  indxt=indx(l)
75  a=arr(indxt)
76 3 continue
77  i=i+1
78  if(arr(indx(i)).lt.a)goto 3
79 4 continue
80  j=j-1
81  if(arr(indx(j)).gt.a)goto 4
82  if(j.lt.i)goto 5
83  itemp=indx(i)
84  indx(i)=indx(j)
85  indx(j)=itemp
86  goto 3
87 5 indx(l)=indx(j)
88  indx(j)=indxt
89  jstack=jstack+2
90  if(jstack.gt.nstack)pause 'NSTACK too small in indexx'
91  if(ir-i+1.ge.j-l)then
92  istack(jstack)=ir
93  istack(jstack-1)=i
94  ir=j-1
95  else
96  istack(jstack)=j-1
97  istack(jstack-1)=l
98  l=i
99  endif
100  endif
101  goto 1

+ Here is the caller graph for this function:

subroutine indexxi ( integer  n,
integer  nd,
integer*4, dimension(nd)  arr,
integer, dimension(nd)  indx 
)

Subroutine to perform ?? indexing on integer data.

Parameters
[in]nnumber of iterations (rows?)
[in]ndarray and index dimensions
[in]arrinput data array
[out]indxindex out

Changelog

2/5/2013:

Modified by D. Smith. Arr has been changed to integer*4. And like other versions of "indexx" which I've modified, I allow indx and arr to be DIMENSIONED differently than the number of good values they contain

Parameters
ndModified by D. Smith, 2/5/2013 . Arr has been changed to integer*4. And like other versions of "indexx" which I've modified, I allow indx and arr to be DIMENSIONED differently than the number of good values they contain

Definition at line 20 of file indexxi.for.

Referenced by mymedian5(), and myrms().

20 
21 c> Modified by D. Smith, 2/5/2013 . Arr has been
22 c> changed to integer*4. And like other versions
23 c> of "indexx" which I've modified,
24 c> I allow indx and arr to
25 c> be DIMENSIONED differently than the number of good
26 c> values they contain
27 
28  integer nd
29  INTEGER n,indx(nd),m,nstack
30 cDAS REAL*4 arr(nd)
31  integer*4 arr(nd)
32  parameter(m=7,nstack=50)
33  INTEGER i,indxt,ir,itemp,j,jstack,k,l,istack(nstack)
34 cDAS REAL*4 a
35  integer*4 a
36 
37  do 11 j=1,n
38  indx(j)=j
39 11 continue
40  jstack=0
41  l=1
42  ir=n
43 1 if(ir-l.lt.m)then
44  do 13 j=l+1,ir
45  indxt=indx(j)
46  a=arr(indxt)
47  do 12 i=j-1,1,-1
48  if(arr(indx(i)).le.a)goto 2
49  indx(i+1)=indx(i)
50 12 continue
51  i=0
52 2 indx(i+1)=indxt
53 13 continue
54  if(jstack.eq.0)return
55  ir=istack(jstack)
56  l=istack(jstack-1)
57  jstack=jstack-2
58  else
59  k=(l+ir)/2
60  itemp=indx(k)
61  indx(k)=indx(l+1)
62  indx(l+1)=itemp
63  if(arr(indx(l+1)).gt.arr(indx(ir)))then
64  itemp=indx(l+1)
65  indx(l+1)=indx(ir)
66  indx(ir)=itemp
67  endif
68  if(arr(indx(l)).gt.arr(indx(ir)))then
69  itemp=indx(l)
70  indx(l)=indx(ir)
71  indx(ir)=itemp
72  endif
73  if(arr(indx(l+1)).gt.arr(indx(l)))then
74  itemp=indx(l+1)
75  indx(l+1)=indx(l)
76  indx(l)=itemp
77  endif
78  i=l+1
79  j=ir
80  indxt=indx(l)
81  a=arr(indxt)
82 3 continue
83  i=i+1
84  if(arr(indx(i)).lt.a)goto 3
85 4 continue
86  j=j-1
87  if(arr(indx(j)).gt.a)goto 4
88  if(j.lt.i)goto 5
89  itemp=indx(i)
90  indx(i)=indx(j)
91  indx(j)=itemp
92  goto 3
93 5 indx(l)=indx(j)
94  indx(j)=indxt
95  jstack=jstack+2
96  if(jstack.gt.nstack)pause 'NSTACK too small in indexx'
97  if(ir-i+1.ge.j-l)then
98  istack(jstack)=ir
99  istack(jstack-1)=i
100  ir=j-1
101  else
102  istack(jstack)=j-1
103  istack(jstack-1)=l
104  l=i
105  endif
106  endif
107  goto 1

+ Here is the caller graph for this function:

integer*2 function iselect2 ( integer  k,
integer  n,
integer*2, dimension(nmax)  arr,
integer  nmax 
)

Function to select an element of a partially filled, but packed multi dimensional array, integer*2

Finds the "kth" element of an array, "arr", which is dimensioned to be "nmax" values long, but which only has data in the first "n" cells.

Changelog

1/14/2016:

Like "select2" but modified by D. Smith to allow an "nmax" array given, but which only has values in elements 1-n, and to have "arr" be Integer*2

Definition at line 18 of file iselect2.for.

18 
19 c - Like "select2" but modified by D. Smith on 1/14/2016
20 c - to allow an "nmax" array given, but which only
21 c - has values in elements 1-n, and to have "arr"
22 c - be Integer*2
23 
24  INTEGER k,n,nmax
25 c REAL*8 select,arr(nmax)
26  integer*2 iselect2,arr(nmax)
27  INTEGER i,ir,j,l,mid
28 c REAL*8 a,temp
29  integer*2 a,temp
30  l=1
31  ir=n
32 1 if(ir-l.le.1)then
33  if(ir-l.eq.1)then
34  if(arr(ir).lt.arr(l))then
35  temp=arr(l)
36  arr(l)=arr(ir)
37  arr(ir)=temp
38  endif
39  endif
40  iselect2=arr(k)
41  return
42  else
43  mid=(l+ir)/2
44  temp=arr(mid)
45  arr(mid)=arr(l+1)
46  arr(l+1)=temp
47  if(arr(l+1).gt.arr(ir))then
48  temp=arr(l+1)
49  arr(l+1)=arr(ir)
50  arr(ir)=temp
51  endif
52  if(arr(l).gt.arr(ir))then
53  temp=arr(l)
54  arr(l)=arr(ir)
55  arr(ir)=temp
56  endif
57  if(arr(l+1).gt.arr(l))then
58  temp=arr(l+1)
59  arr(l+1)=arr(l)
60  arr(l)=temp
61  endif
62  i=l+1
63  j=ir
64  a=arr(l)
65 3 continue
66  i=i+1
67  if(arr(i).lt.a)goto 3
68 4 continue
69  j=j-1
70  if(arr(j).gt.a)goto 4
71  if(j.lt.i)goto 5
72  temp=arr(i)
73  arr(i)=arr(j)
74  arr(j)=temp
75  goto 3
76 5 arr(l)=arr(j)
77  arr(j)=a
78  if(j.ge.k)ir=j-1
79  if(j.le.k)l=i
80  endif
81  goto 1
integer *2 function iselect2(k, n, arr, nmax)
Function to select an element of a partially filled, but packed multi dimensional array...
Definition: iselect2.for:18
real*4 function onzd ( real*4  x)

Function to round a digit to one significant figure (one non zero digit), single precision.

Function "onzd" stands for "One Non Zero Digit"

It takes a Real*4 number as input, and rounds that number to the closest number containing only 1 non-zero digit. The list of such numbers is infifinite, but contain these, in order:

0.7 , 0.8 , 0.9 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9, 10 , 20 , 30 , etc etc
Parameters
[in]xinput value
Returns
real*4 rounded value of x to one non zero digit

Examples of input/output are:

   0.000019      =>    0.000020
   0.007432      =>    0.007000
   1.7           =>    2.000000
   9.143         =>    9.000000
  17.4           =>   20.000000
 947.3           =>  900.000000
 987.432         => 1000.000000
1014.8           => 1000.000000
1502.7           => 2000.000000

Definition at line 29 of file onzd.f.

29  implicit none
30  real*4 onzd,x,y
31  real*8 q,qten
32  integer*4 imag,iq,isign
33 
34 c - Function "onzd" stands for "One Non Zero Digit"
35 
36 c - It takes a Real*4 number as input, and rounds that
37 c - number to the closest number containing only 1 non-zero digit.
38 c - The list of such numbers is infifinite, but contain
39 c - these, in order:
40 c - 0.7 , 0.8 , 0.9 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9, 10 , 20 , 30 , etc etc
41 c -
42 c - Examples of input/output are:
43 c - 0.000019 => 0.000020
44 c - 0.007432 => 0.007000
45 c - 1.7 => 2.000000
46 c - 9.143 => 9.000000
47 c - 17.4 => 20.000000
48 c - 947.3 => 900.000000
49 c - 987.432 => 1000.000000
50 c - 1014.8 => 1000.000000
51 c - 1502.7 => 2000.000000
52 
53  isign = +1
54  y = x
55  if(x.lt.0)then
56  isign = -1
57  y = -x
58  endif
59 
60 c - 1) Determine magnitude of x, in terms of integer exponent of ten
61  imag = floor(log10(y))
62 
63 c - 1a) Get the multiplier
64  qten = (10.d0**imag)
65 
66 c - 2) Get into a range between 0.0 and 10.0
67  q = dble(y) / qten
68 
69 c - 3) Round to the closest integer (0 through 10)
70  iq = nint(q)
71 
72 c - 4) Scale back to the original size
73  onzd = isign * dble(iq) * qten
74 
75 c write(6,100)x,imag,qten,q,iq,onzd
76 c 100 format(f30.15,1x,i10,1x,f30.15,1x,f30.15,1x,i10,1x,f30.15)
77 
78  return
real *4 function onzd(x)
Function to round a digit to one significant figure (one non zero digit), single precision.
Definition: onzd.f:29
real*8 function onzd2 ( real*8  x)

Function to round a digit to one significant figure (one non zero digit), double precision.

Function "onzd" stands for "One Non Zero Digit"

Version 2 operates just like version 1 (onzd()), only the input and output will be real*8 values, not real*4.

It takes a Real*8 number as input, and rounds that number to the closest number containing only 1 non-zero digit. The list of such numbers is infifinite, but contain these, in order:

0.7 , 0.8 , 0.9 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9, 10 , 20 , 30 , etc etc
Parameters
[in]xinput value
Returns
real*8 rounded value of x to one non zero digit

Examples of input/output are:

   0.000019      =>    0.000020
   0.007432      =>    0.007000
   1.7           =>    2.000000
   9.143         =>    9.000000
  17.4           =>   20.000000
 947.3           =>  900.000000
 987.432         => 1000.000000
1014.8           => 1000.000000
1502.7           => 2000.000000

Definition at line 32 of file onzd2.f.

Referenced by checkgrid(), makeplotfiles01(), makeplotfiles02(), makeplotfiles03(), and myrms().

32  implicit none
33  real*8 onzd2,x,y
34  real*8 q,qten
35  integer*4 imag,iq,isign
36 
37 c - Function "onzd2" stands for "One Non Zero Digit, version 2"
38 
39 c - Version 2 operates just like version 1 (onzd.f), only the input
40 c - and output will be real*8 values, not real*4.
41 
42 c - It takes a Real*8 number as input, and rounds that
43 c - number to the closest number containing only 1 non-zero digit.
44 c - The list of such numbers is infifinite, but contain
45 c - these, in order:
46 c - 0.7 , 0.8 , 0.9 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9, 10 , 20 , 30 , etc etc
47 c -
48 c - Examples of input/output are:
49 c - 0.000019 => 0.000020
50 c - 0.007432 => 0.007000
51 c - 1.7 => 2.000000
52 c - 9.143 => 9.000000
53 c - 17.4 => 20.000000
54 c - 947.3 => 900.000000
55 c - 987.432 => 1000.000000
56 c - 1014.8 => 1000.000000
57 c - 1502.7 => 2000.000000
58 
59  y = x
60  isign = +1
61  if(x.lt.0)then
62  isign = -1
63  y = -x
64  endif
65 
66 c - 1) Determine magnitude of x, in terms of integer exponent of ten
67  imag = floor(dlog10(y))
68 
69 c - 1a) Get the multiplier
70  qten = (10.d0**imag)
71 
72 c - 2) Get into a range between 0.0 and 10.0
73  q = dble(y) / qten
74 
75 c - 3) Round to the closest integer (0 through 10)
76  iq = nint(q)
77 
78 c - 4) Scale back to the original size
79  onzd2 = isign * dble(iq) * qten
80 
81 c write(6,100)x,imag,qten,q,iq,onzd2
82 c 100 format(f30.15,1x,i10,1x,f30.15,1x,f30.15,1x,i10,1x,f30.15)
83 
84  return
real *8 function onzd2(x)
Function to round a digit to one significant figure (one non zero digit), double precision.
Definition: onzd2.f:32

+ Here is the caller graph for this function:

subroutine plotcoast ( character*10  region,
  ifnum 
)

Subroutine to write GMT-based commands to create a shoreline Write GMT-based commands to create a shoreline based on region.

Use GMT-default coastline for:

  • conus
  • alaska

Use Dru's custome coastline for:

  • hawaii
  • prvi
  • as
  • guamcnmi
  • stlawrence
  • stmatthew
  • stgeorge
  • stpaul
Parameters
[in]regionThe Region to create coastline for
[in]ifnumthe file descriptor of the output file to write GMT commands to

Changelog

2016 01 07:

Forced the Alaska region to plot the islands of St. George, St. Matthew and St. Paul (St. Lawrence is already plotted), as well as 35 missing Aleutian Islands

2015 09 23:

Added four new regions:

  • St. Lawrence Island, Alaska
  • St. Matthew Island, Alaska
  • St. George Island, Alaska
  • St. Paul Island, Alaska

Definition at line 40 of file plotcoast.f.

Referenced by bwplotcv(), bwplotvc(), coplot(), and coplotwcv().

40 
41 c - 2016 01 07
42 c Forced the Alaska region to plot the
43 c islands of St. George, St. Matthew and St. Paul
44 c (St. Lawrence is already plotted), as well
45 c as 35 missing Aleutian Islands
46 
47 c - 2015 09 23: Added four new regions:
48 c St. Lawrence Island, Alaska
49 c St. Matthew Island, Alaska
50 c St. George Island, Alaska
51 c St. Paul Island, Alaska
52 
53  character*10 region
54 
55 c - Write GMT-based commands to create a shoreline
56 c - based on region.
57 c - Use GMT-default coastline for:
58 c conus
59 c alaska
60 c - Use Dru's custome coastline for:
61 c hawaii
62 c prvi
63 c as
64 c guamcnmi
65 c stlawrence
66 c stmatthew
67 c stgeorge
68 c stpaul
69 
70 
71  if (trim(region).eq.'conus')then
72  write(ifnum,100)
73  elseif(trim(region).eq.'alaska')then
74  write(ifnum,109)
75  elseif(trim(region).eq.'hawaii')then
76  write(ifnum,101)
77  elseif(trim(region).eq.'prvi')then
78  write(ifnum,102)
79  elseif(trim(region).eq.'guamcnmi')then
80  write(ifnum,103)
81  elseif(trim(region).eq.'as')then
82  write(ifnum,104)
83  elseif(trim(region).eq.'stlawrence')then
84  write(ifnum,105)
85  elseif(trim(region).eq.'stmatthew')then
86  write(ifnum,106)
87  elseif(trim(region).eq.'stgeorge')then
88  write(ifnum,107)
89  elseif(trim(region).eq.'stpaul')then
90  write(ifnum,108)
91 
92  else
93  write(6,200)region
94  stop 10001
95  endif
96  return
97 
98  200 format('FATAL in plotcoast.f: Unknown region: ',a10)
99 
100 c - CONUS
101  100 format(
102  *'pscoast -Df -R -JM -W0.25p -N1 -N2 -A1200 -O >> plot.ps')
103 
104 c - HAWAII
105  101 format(
106  *'psxy Boundaries/HI_Hawaii.gmt -R -JM -B -O -K',
107  *' >> plot.ps',/,
108  *'psxy Boundaries/HI_Kahoolawe.gmt -R -JM -B -O -K ',
109  *' >> plot.ps',/,
110  *'psxy Boundaries/HI_Kauai.gmt -R -JM -B -O -K ',
111  *' >> plot.ps',/,
112  *'psxy Boundaries/HI_Lanai.gmt -R -JM -B -O -K ',
113  *' >> plot.ps',/,
114  *'psxy Boundaries/HI_Maui.gmt -R -JM -B -O -K ',
115  *' >> plot.ps',/,
116  *'psxy Boundaries/HI_Molokai.gmt -R -JM -B -O -K ',
117  *' >> plot.ps',/,
118  *'psxy Boundaries/HI_Nihau.gmt -R -JM -B -O -K ',
119  *' >> plot.ps',/,
120  *'psxy Boundaries/HI_Oahu.gmt -R -JM -B -O ',
121  *' >> plot.ps')
122 
123 c - PRVI
124  102 format(
125  *'psxy Boundaries/VQ_StCroix.gmt -R -JM -B -O -K',
126  *' >> plot.ps',/,
127  *'psxy Boundaries/VQ_StJohn.gmt -R -JM -B -O -K ',
128  *' >> plot.ps',/,
129  *'psxy Boundaries/VQ_StThomas.gmt -R -JM -B -O -K ',
130  *' >> plot.ps',/,
131  *'psxy Boundaries/PR_Culebra.gmt -R -JM -B -O -K ',
132  *' >> plot.ps',/,
133  *'psxy Boundaries/PR_Desecheo.gmt -R -JM -B -O -K ',
134  *' >> plot.ps',/,
135  *'psxy Boundaries/PR_Mona.gmt -R -JM -B -O -K ',
136  *' >> plot.ps',/,
137  *'psxy Boundaries/PR_Viequez.gmt -R -JM -B -O -K ',
138  *' >> plot.ps',/,
139  *'psxy Boundaries/PR_PuertoRico.gmt -R -JM -B -O ',
140  *' >> plot.ps')
141 
142 c - GUAM/CNMI
143  103 format(
144  *'psxy Boundaries/GQ_Guam.gmt -R -JM -B -O -K',
145  *' >> plot.ps',/,
146  *'psxy Boundaries/CQ_Rota.gmt -R -JM -B -O -K ',
147  *' >> plot.ps',/,
148  *'psxy Boundaries/CQ_Saipan.gmt -R -JM -B -O -K ',
149  *' >> plot.ps',/,
150  *'psxy Boundaries/CQ_Tinian.gmt -R -JM -B -O -K ',
151  *' >> plot.ps',/,
152  *'psxy Boundaries/CQ_Anatahan.gmt -R -JM -B -O -K ',
153  *' >> plot.ps',/,
154  *'psxy Boundaries/CQ_Sarigan.gmt -R -JM -B -O -K ',
155  *' >> plot.ps',/,
156  *'psxy Boundaries/CQ_Guguan.gmt -R -JM -B -O -K ',
157  *' >> plot.ps',/,
158  *'psxy Boundaries/CQ_Alamagan.gmt -R -JM -B -O -K ',
159  *' >> plot.ps',/,
160  *'psxy Boundaries/CQ_Pagan.gmt -R -JM -B -O -K ',
161  *' >> plot.ps',/,
162  *'psxy Boundaries/CQ_Agrihan.gmt -R -JM -B -O -K ',
163  *' >> plot.ps',/,
164  *'psxy Boundaries/CQ_Asuncion.gmt -R -JM -B -O -K ',
165  *' >> plot.ps',/,
166  *'psxy Boundaries/CQ_MaugWest.gmt -R -JM -B -O -K ',
167  *' >> plot.ps',/,
168  *'psxy Boundaries/CQ_MaugEast.gmt -R -JM -B -O -K ',
169  *' >> plot.ps',/,
170  *'psxy Boundaries/CQ_MaugNorth.gmt -R -JM -B -O -K ',
171  *' >> plot.ps',/,
172  *'psxy Boundaries/CQ_Pajaros.gmt -R -JM -B -O',
173  *' >> plot.ps')
174 
175 c - AS
176  104 format(
177  *'psxy Boundaries/AS_Aunuu.gmt -R -JM -B -O -K',
178  *' >> plot.ps',/,
179  *'psxy Boundaries/AS_Nuutele.gmt -R -JM -B -O -K ',
180  *' >> plot.ps',/,
181  *'psxy Boundaries/AS_Ofu.gmt -R -JM -B -O -K ',
182  *' >> plot.ps',/,
183  *'psxy Boundaries/AS_Olosega.gmt -R -JM -B -O -K ',
184  *' >> plot.ps',/,
185  *'psxy Boundaries/AS_Rose.gmt -R -JM -B -O -K ',
186  *' >> plot.ps',/,
187  *'psxy Boundaries/AS_Swains.gmt -R -JM -B -O -K ',
188  *' >> plot.ps',/,
189  *'psxy Boundaries/AS_Tau.gmt -R -JM -B -O -K ',
190  *' >> plot.ps',/,
191  *'psxy Boundaries/AS_Tutila.gmt -R -JM -B -O ',
192  *' >> plot.ps')
193 
194 c - St. Lawrence Island, Alaska
195  105 format(
196  *'psxy Boundaries/AK_StLawrence.gmt -R -JM -B -O -K',
197  *' >> plot.ps',/,
198  *'psxy Boundaries/AK_NorthPunuk.gmt -R -JM -B -O -K ',
199  *' >> plot.ps',/,
200  *'psxy Boundaries/AK_MiddlePunuk.gmt -R -JM -B -O -K ',
201  *' >> plot.ps',/,
202  *'psxy Boundaries/AK_SouthPunuk.gmt -R -JM -B -O ',
203  *' >> plot.ps')
204 
205 c - St. Matthew Island, Alaska
206  106 format(
207  *'psxy Boundaries/AK_StMatthew.gmt -R -JM -B -O -K',
208  *' >> plot.ps',/,
209  *'psxy Boundaries/AK_Hall.gmt -R -JM -B -O -K ',
210  *' >> plot.ps',/,
211  *'psxy Boundaries/AK_Pinnacle.gmt -R -JM -B -O ',
212  *' >> plot.ps')
213 
214 c - St. George Island, Alaska
215  107 format(
216  *'psxy Boundaries/AK_StGeorge.gmt -R -JM -B -O',
217  *' >> plot.ps')
218 
219 c - St. Paul Island, Alaska
220  108 format(
221  *'psxy Boundaries/AK_StPaul.gmt -R -JM -B -O -K',
222  *' >> plot.ps',/,
223  *'psxy Boundaries/AK_Otter.gmt -R -JM -B -O -K ',
224  *' >> plot.ps',/,
225  *'psxy Boundaries/AK_Walrus.gmt -R -JM -B -O ',
226  *' >> plot.ps')
227 
228 c - ALASKA
229  109 format(
230  *'pscoast -Df -R -JM -W0.25p -N1 -N2 -A1200 -O -K ',
231  *' >> plot.ps',/,
232  *'psxy Boundaries/AK_NorthPunuk.gmt -R -JM -B -O -K ',
233  *' >> plot.ps',/,
234  *'psxy Boundaries/AK_MiddlePunuk.gmt -R -JM -B -O -K ',
235  *' >> plot.ps',/,
236  *'psxy Boundaries/AK_SouthPunuk.gmt -R -JM -B -O -K ',
237  *' >> plot.ps',/,
238  *'psxy Boundaries/AK_StMatthew.gmt -R -JM -B -O -K',
239  *' >> plot.ps',/,
240  *'psxy Boundaries/AK_Hall.gmt -R -JM -B -O -K ',
241  *' >> plot.ps',/,
242  *'psxy Boundaries/AK_Pinnacle.gmt -R -JM -B -O -K ',
243  *' >> plot.ps',/,
244  *'psxy Boundaries/AK_StGeorge.gmt -R -JM -B -O -K',
245  *' >> plot.ps',/,
246  *'psxy Boundaries/AK_StPaul.gmt -R -JM -B -O -K',
247  *' >> plot.ps',/,
248  *'psxy Boundaries/AK_Otter.gmt -R -JM -B -O -K ',
249  *' >> plot.ps',/,
250  *'psxy Boundaries/AK_Walrus.gmt -R -JM -B -O -K ',
251  *' >> plot.ps',/,
252  *'psxy Boundaries/AK_Adak.gmt -R -JM -B -O -K ',
253  *' >> plot.ps',/,
254  *'psxy Boundaries/AK_Agattu.gmt -R -JM -B -O -K ',
255  *' >> plot.ps',/,
256  *'psxy Boundaries/AK_Amchitka.gmt -R -JM -B -O -K ',
257  *' >> plot.ps',/,
258  *'psxy Boundaries/AK_Amlia.gmt -R -JM -B -O -K ',
259  *' >> plot.ps',/,
260  *'psxy Boundaries/AK_Amukta.gmt -R -JM -B -O -K ',
261  *' >> plot.ps',/,
262  *'psxy Boundaries/AK_Andreanof.gmt -R -JM -B -O -K ',
263  *' >> plot.ps',/,
264  *'psxy Boundaries/AK_Atka.gmt -R -JM -B -O -K ',
265  *' >> plot.ps',/,
266  *'psxy Boundaries/AK_Attu.gmt -R -JM -B -O -K ',
267  *' >> plot.ps',/,
268  *'psxy Boundaries/AK_Buldir.gmt -R -JM -B -O -K ',
269  *' >> plot.ps',/,
270  *'psxy Boundaries/AK_Carlisle.gmt -R -JM -B -O -K ',
271  *' >> plot.ps',/,
272  *'psxy Boundaries/AK_Chagulak.gmt -R -JM -B -O -K ',
273  *' >> plot.ps',/,
274  *'psxy Boundaries/AK_Chugul.gmt -R -JM -B -O -K ',
275  *' >> plot.ps',/,
276  *'psxy Boundaries/AK_Fenimore.gmt -R -JM -B -O -K ',
277  *' >> plot.ps',/,
278  *'psxy Boundaries/AK_FourMountains.gmt -R -JM -B -O -K ',
279  *' >> plot.ps',/,
280  *'psxy Boundaries/AK_GreatSitkin.gmt -R -JM -B -O -K ',
281  *' >> plot.ps',/,
282  *'psxy Boundaries/AK_Herbert.gmt -R -JM -B -O -K ',
283  *' >> plot.ps',/,
284  *'psxy Boundaries/AK_Igitkin.gmt -R -JM -B -O -K ',
285  *' >> plot.ps',/,
286  *'psxy Boundaries/AK_Ikiginak.gmt -R -JM -B -O -K ',
287  *' >> plot.ps',/,
288  *'psxy Boundaries/AK_Kagalaska.gmt -R -JM -B -O -K ',
289  *' >> plot.ps',/,
290  *'psxy Boundaries/AK_Kagami.gmt -R -JM -B -O -K ',
291  *' >> plot.ps',/,
292  *'psxy Boundaries/AK_Kanaga.gmt -R -JM -B -O -K ',
293  *' >> plot.ps',/,
294  *'psxy Boundaries/AK_Kasatochi.gmt -R -JM -B -O -K ',
295  *' >> plot.ps',/,
296  *'psxy Boundaries/AK_Kiska.gmt -R -JM -B -O -K ',
297  *' >> plot.ps',/,
298  *'psxy Boundaries/AK_Koniuji.gmt -R -JM -B -O -K ',
299  *' >> plot.ps',/,
300  *'psxy Boundaries/AK_Oglodak.gmt -R -JM -B -O -K ',
301  *' >> plot.ps',/,
302  *'psxy Boundaries/AK_Seguam.gmt -R -JM -B -O -K ',
303  *' >> plot.ps',/,
304  *'psxy Boundaries/AK_Semichi.gmt -R -JM -B -O -K ',
305  *' >> plot.ps',/,
306  *'psxy Boundaries/AK_Semisopochnoi.gmt -R -JM -B -O -K ',
307  *' >> plot.ps',/,
308  *'psxy Boundaries/AK_Shemya.gmt -R -JM -B -O -K ',
309  *' >> plot.ps',/,
310  *'psxy Boundaries/AK_Tagalak.gmt -R -JM -B -O -K ',
311  *' >> plot.ps',/,
312  *'psxy Boundaries/AK_Tanaga.gmt -R -JM -B -O -K ',
313  *' >> plot.ps',/,
314  *'psxy Boundaries/AK_Ulak.gmt -R -JM -B -O -K ',
315  *' >> plot.ps',/,
316  *'psxy Boundaries/AK_Uliaga.gmt -R -JM -B -O -K ',
317  *' >> plot.ps',/,
318  *'psxy Boundaries/AK_Umak.gmt -R -JM -B -O -K ',
319  *' >> plot.ps',/,
320  *'psxy Boundaries/AK_Yunaska.gmt -R -JM -B -O ',
321  *' >> plot.ps')
322 

+ Here is the caller graph for this function:

real function qterp (   x,
  f0,
  f1,
  f2 
)

This function fits a quadratic function through 3 points.

This function fits a parabola (quadratic) function through three equally spaced points along the x-axis at indices 0, 1, and 2. The spacing along the x-axis is "dx"

Thus:

\begin{eqnarray*} f0 = f_0 &= y(x_0) \\ f1 = f_1 &= y(x_1) \\ f2 = f_2 &= y(x_2) \end{eqnarray*}

Where:

\begin{eqnarray*} x_1 &= x_0 + dx \\ x_2 &= x_1 + dx \\ x_3 &= x_2 + dx \end{eqnarray*}

The input value is some value of "x" that falls between 0 and 2. The output value (qterp) is the quadratic function at x.

Parameters
[in]xCompute Interpolation at this positon, a value between 0 and 3 it is scaled relative to x_0 x_2 and dx. For example, the value of 1.5 is x_0 + 1.5*dx which falls between x1 and x2
[in]f0y value at x_0
[in]f1y value at x_1 = x_0 + dx
[in]f2y value at x_2 = x_0 + dx
Returns
real quadratically interpolated value of f(x*) where x* = x_0 + x*dxx

This function uses Newton-Gregory forward polynomial

\begin{eqnarray*} \nabla f_0 &=& f_1 -f_0 \\ \nabla f_1 &=& f_2 -f_1 \\ \nabla^2 f_0 &=& \nabla f_1 - \nabla f_0 \\ qterp(x, f_0, f_1, f_2) &=& f_0 + x \nabla f_0 + 0.5 x \left( x-1.0 \right) \nabla^2 f_0 \end{eqnarray*}

Definition at line 47 of file qterp.f.

47 
48 c - x = real*4
49 c - f0,f1,f2 = real*4
50 
51 c - This function fits a parabola (quadratic) through
52 c - three points, *equally* spaced along the x-axis
53 c - at indices 0, 1 and 2. The spacing along the
54 c - x-axis is "dx"
55 c - Thus:
56 c -
57 c - f0 = y(x(0))
58 c - f1 = y(x(1))
59 c - f2 = y(x(2))
60 c - Where
61 c - x(1) = x(0) + dx
62 c - x(2) = x(1) + dx
63 
64 c - The input value is some value of "x" that falls
65 c - between 0 and 2. The output value (qterp2) is
66 c - the parabolic function at x.
67 c -
68 c - This function uses Newton-Gregory forward polynomial
69 
70  df0 =f1 -f0
71  df1 =f2 -f1
72  d2f0=df1-df0
73 
74  qterp=f0 + x*df0 + 0.5*x*(x-1.0)*d2f0
75 
76  return
real function qterp(x, f0, f1, f2)
This function fits a quadratic function through 3 points.
Definition: qterp.f:47
program regrd2 ( )

Part of the NADCON5 NADCON5 Core Library , regrid data.

Regrid gridded data using biquadratic interpolation

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput Master Grid File Name
outfileOutput Regrid File Name
nrowNumber of rows in new Grid (Lat)
ncolNumber of cols in new Grid (Lon)

Program Inputs:

  • lin Input File

Program Outputs:

  • lout Output File

Definition at line 25 of file regrd2.f.

References bquad1(), bquad2(), r1(), and r2().

+ Here is the call graph for this function:

real*8 function select2 ( integer  k,
integer  n,
real*8, dimension(nmax)  arr,
integer  nmax 
)

Function to select an element of a partially filled, but packed multi dimensional array, double precision.

Finds the "kth" element of an array, "arr", which is dimensioned to be "nmax" values long, but which only has data in the first "n" cells.

Changelog

7/17/2008:

Like "select2" but modified by D. Smith to allow an "nmax" array given, but which only has values in elements 1-n, and to have "arr" be Integer*2

Definition at line 18 of file select2_dbl.for.

18 
19 c - Like "select" but modified by D. Smith on 7/17/2008
20 c - to allow an "nmax" array given, but which only
21 c - has values in elements 1-n
22 
23  INTEGER k,n,nmax
24  REAL*8 select2,arr(nmax)
25  INTEGER i,ir,j,l,mid
26  REAL*8 a,temp
27  l=1
28  ir=n
29 1 if(ir-l.le.1)then
30  if(ir-l.eq.1)then
31  if(arr(ir).lt.arr(l))then
32  temp=arr(l)
33  arr(l)=arr(ir)
34  arr(ir)=temp
35  endif
36  endif
37  select2=arr(k)
38  return
39  else
40  mid=(l+ir)/2
41  temp=arr(mid)
42  arr(mid)=arr(l+1)
43  arr(l+1)=temp
44  if(arr(l+1).gt.arr(ir))then
45  temp=arr(l+1)
46  arr(l+1)=arr(ir)
47  arr(ir)=temp
48  endif
49  if(arr(l).gt.arr(ir))then
50  temp=arr(l)
51  arr(l)=arr(ir)
52  arr(ir)=temp
53  endif
54  if(arr(l+1).gt.arr(l))then
55  temp=arr(l+1)
56  arr(l+1)=arr(l)
57  arr(l)=temp
58  endif
59  i=l+1
60  j=ir
61  a=arr(l)
62 3 continue
63  i=i+1
64  if(arr(i).lt.a)goto 3
65 4 continue
66  j=j-1
67  if(arr(j).gt.a)goto 4
68  if(j.lt.i)goto 5
69  temp=arr(i)
70  arr(i)=arr(j)
71  arr(j)=temp
72  goto 3
73 5 arr(l)=arr(j)
74  arr(j)=a
75  if(j.ge.k)ir=j-1
76  if(j.le.k)l=i
77  endif
78  goto 1
real *8 function select2(k, n, arr, nmax)
Function to select an element of a partially filled, but packed multi dimensional array...
Definition: select2_dbl.for:18
real*4 function select2 ( integer  k,
integer  n,
real*4, dimension(nmax)  arr,
integer  nmax 
)

Function to select an element of a partially filled, but packed multi dimensional array, single precision.

Finds the "kth" element of an array, "arr", which is dimensioned to be "nmax" values long, but which only has data in the first "n" cells.

Changelog

7/17/2008:

Like "select2" but modified by D. Smith to allow an "nmax" array given, but which only has values in elements 1-n, and to have "arr" be Integer*2

Definition at line 18 of file select2_mod.for.

18 c - Like "select" but modified by D. Smith on 7/17/2008
19 c - to allow an "nmax" array given, but which only
20 c - has values in elements 1-n. Maintain the Real*4 nature of arr.
21 
22 c - Finds the "kth" element of an array, "arr", which
23 c - is dimensioned to be "nmax" values long, but which
24 c - only has data in the first "n" cells.
25 
26  INTEGER k,n,nmax
27  REAL*4 select2,arr(nmax)
28  INTEGER i,ir,j,l,mid
29  REAL*4 a,temp
30  l=1
31  ir=n
32 1 if(ir-l.le.1)then
33  if(ir-l.eq.1)then
34  if(arr(ir).lt.arr(l))then
35  temp=arr(l)
36  arr(l)=arr(ir)
37  arr(ir)=temp
38  endif
39  endif
40  select2=arr(k)
41  return
42  else
43  mid=(l+ir)/2
44  temp=arr(mid)
45  arr(mid)=arr(l+1)
46  arr(l+1)=temp
47  if(arr(l+1).gt.arr(ir))then
48  temp=arr(l+1)
49  arr(l+1)=arr(ir)
50  arr(ir)=temp
51  endif
52  if(arr(l).gt.arr(ir))then
53  temp=arr(l)
54  arr(l)=arr(ir)
55  arr(ir)=temp
56  endif
57  if(arr(l+1).gt.arr(l))then
58  temp=arr(l+1)
59  arr(l+1)=arr(l)
60  arr(l)=temp
61  endif
62  i=l+1
63  j=ir
64  a=arr(l)
65 3 continue
66  i=i+1
67  if(arr(i).lt.a)goto 3
68 4 continue
69  j=j-1
70  if(arr(j).gt.a)goto 4
71  if(j.lt.i)goto 5
72  temp=arr(i)
73  arr(i)=arr(j)
74  arr(j)=temp
75  goto 3
76 5 arr(l)=arr(j)
77  arr(j)=a
78  if(j.ge.k)ir=j-1
79  if(j.le.k)l=i
80  endif
81  goto 1
real *8 function select2(k, n, arr, nmax)
Function to select an element of a partially filled, but packed multi dimensional array...
Definition: select2_dbl.for:18
program subtrc ( )

Part of the NADCON5 NADCON5 Core Library , Subtract one grid from another.

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileAFirst Input File Name
infileBSecond Input File Name
outfileOutput File Name of A*B

Program Inputs:

  • lin1 Input File A
  • lin2 Input File B
  • lout Output File to Write A-B

Definition at line 21 of file subtrc.f.

subroutine vecstats ( character*200  fname,
integer*4  n 
)

Subroutine to tell us how many thinned vectors were used to make a grid.

Parameters
[in]fnamevector filename to read
[out]nnumber of thinned vectors

Definition at line 8 of file vecstats.f.

Referenced by makeplotfiles02().

8 c - Subroutine to tell us how many thinned vectors were
9 c - used to make a grid
10  character*200 fname
11  integer*4 n
12  character*80 card
13  open(90,file=fname,status='old',form='formatted')
14  n = 0
15  1 read(90,'(a)',end=2)card
16  n = n + 1
17  goto 1
18  2 return

+ Here is the caller graph for this function:

program xyz2b ( )

Part of the NADCON5 NADCON5 Core Library , Converts GMT *.grd to a *.b NADCON style grid file.

Turn gmt/netcdf grd dump into my grid file (real number version) assumes grd dump is longitude/latitude/real (binary s.p.)

Program arguments

Arguments are newline terminated and read from standard input

When run from the command line, the program prints a prompt for each argument

They are enumerated here

Parameters
infileInput File Name
outfileOutput File Name

Program Inputs:

  • lin Input File (*.grd)

Program Outputs:

  • lout Output File (*.b)

Definition at line 25 of file xyz2b.f.

References put1(), put2(), w1(), and w2().

+ Here is the call graph for this function: