NADCON5-ng  0.0.1
NADCON5 Next Generation
makeplotfiles02.f
Go to the documentation of this file.
1 c> \ingroup doers
2 c> Part of the NADCON5 process, generates `gmtbat03`
3 c>
4 c> Built upon the skeleton of "makeplotem.f" for GEOCON v2.0
5 c> But built specifically for NADCON v5.0. So different
6 c> in file names and expanded plot creation that it was
7 c> given the new name "makeplotfiles02.f" to align with
8 c> another NADCON5 program "makeplotfiles01.f"
9 c>
10 c> Creates a batch file called
11 c>
12 c> gmtbat03.(olddtm).(newdtm).(region).(igridsec)
13 c>
14 c> That batch file will create JPGs of:
15 c> 1. Color Plots of the dlat/dlon/deht grids at T=0.4
16 c> 2. Color Plots of the "method noise" grids (the "d3" grids, see DRU-11, p. 150) with thinned coverage overlaid
17 c> 3. B/W plots of thinned vectors that went into the T=0.4 transformation grid
18 c> 4. B/W plots of dropped vectors that did not go into the T=0.4 transformation grid
19 c> 5. B/W plots of thinned coverage of points that went into the T=0.4 transformation grid
20 c> 6. B/W plots of dropped coverage of points that did not go into the T=0.4 transformation grid
21 c>
22 c> ### Program arguments
23 c> Arguments are newline terminated and read from standard input
24 c>
25 c> They are enumerated here
26 c> \param oldtm Source Datum
27 c> \param newdtm Target Datum,region
28 c> \param region Conversion Region
29 c> \param agridsec Grid Spacing in arcsec
30 c>
31 c> Example:
32 c>
33 c> olddatum = 'ussd'
34 c> newdatum = 'nad27'
35 c> region = 'conus'
36 c> agridsec = '900'
37 c>
38 c> ### Program Inputs:
39 c>
40 c> ## Changelog
41 c>
42 c> ### 2016 08 26
43 c> Added new code to do reference vectors consistently
44 c> See DRU-12, p. 56-57
45 c> Also fixed a typo in reference vector length for vmtcdeht plots
46 c> Also changing the call to getmapbounds to give it `olddatum` and `newdatum`
47 c> to aide in filtering out things like the Saint regions in Alaska
48 c> for unsupported transformations.
49 c>
50 c> ### 2016 07 29:
51 c> Scrapped code about personalized reference vectors. Just put all
52 c> reference vectors outside/below plot
53 c> Also moved gridstats and vecstats out into the `/Subs` directory
54 c> to be used by other programs (like makeplotfiles03.f)
55 c>
56 c> ### 2016 07 28:
57 c> Changed code to build the color palette of the `d3` grids
58 c> around the median, and not ave or std.
59 c> See DRU-12, p. 48
60 c>
61 c> ### 2016 07 21:
62 c> Added code to allow for optional placement of reference vectors, coming from
63 c> `map.parameters` as read in subroutine getmapbounds
64 c>
65 c> ### 2016 01 21:
66 c> Updated to get the CPT values fixed in `d3` grids, so that
67 c> (cpthi - cptlo) is exactly divisible by `cptin` at (2 x csm)
68 c>
69 c> ### 2015 10 27:
70 c> Updated to work with the new naming scheme (see DRU-11, p. 150)
71 c>
72 c> ### 2015 10 05:
73 c> Updated to work with the new naming scheme (see DRU-11, p. 139)
75  implicit real*8(a-h,o-z)
76  parameter(maxplots=60)
77 
78  character*35 fname0
79  character*34 dirnam
80  character*10 olddtm,newdtm,od,nd
81  character*2 state,stdum
82  character*3 ele,elelat,elelon,eleeht,elehor,ele0
83 
84  character*5 agridsec
85  integer*4 igridsec
86  character*200 suffix1,suffix2,suffix3,suffix2d3
87  character*200 suffix2t04
88  character*200 wfname,gmtfile
89  character*200 gfncvtcdlat,gfncvtcdlon,gfncvtcdeht
90  character*200 gfncvdcdlat,gfncvdcdlon,gfncvdcdeht
91 
92  character*200 bfnvmtcdlat,bfnvmtcdlon,bfnvmtcdeht
93  character*200 bfnvstcdlat,bfnvstcdlon
94 
95 c - 10/27/2015: "sad" = "Scaled AbsoluteValue Differential", aka "d3" grids
96 c - See DRU-11, p. 150
97  character*200 sadbfnvmtcdlat,sadbfnvmtcdlon,sadbfnvmtcdeht
98  character*200 sadbfnvstcdlat,sadbfnvstcdlon
99 
100  character*200 gfnvmtcdlat,gfnvmtcdlon,gfnvmtcdeht,gfnvmtcdhor
101  character*200 gfnvstcdlat,gfnvstcdlon, gfnvstcdhor
102 
103  character*200 gfnvmdcdlat,gfnvmdcdlon,gfnvmdcdeht,gfnvmdcdhor
104  character*200 gfnvsdcdlat,gfnvsdcdlon, gfnvsdcdhor
105 
106 c - GMT stuff
107  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
108  real*4 jm(maxplots)
109  real*4 b1(maxplots),b2(maxplots)
110  character*10 fn(maxplots)
111 c - 2016 07 21:
112  logical lrv(maxplots)
113  real*8 rv0x(maxplots),rv0y(maxplots),rl0y(maxplots)
114 
115 c - Stuff that is in the work file records:
116  character*6 pid
117  character*2 state
118  character*1 rejlat,rejlon,rejeht
119  real*8 xlath,xlonh,xehth
120  real*8 dlatsec,dlonsec,dehtm,dhorsec,azhor
121  real*8 dlatm,dlonm,dhorm
122  character*10 olddtm,newdtm,region
123 c - Units to put on scale on GMT color plots
124  character*17 scunlat,scunlon,scuneht,scunhor
125  character*1 mapflag
126 
127 c - Plot/Scale stuff
128  real*8 lorvopc
129  real*8 lorvoghorm,lorvoghors
130  real*8 lorvogehtm
131 
132 
133 
134 c ------------------------------------------------------------------
135 c - BEGIN PROGRAM
136 c ------------------------------------------------------------------
137  write(6,1001)
138  1001 format('BEGIN program makeplotfiles02.f')
139 
140 c--------------------------------------------
141 c - Some necessary constants
142 c
143 c - "lorvopc" = Length of Reference Vector on Paper in **CM**
144 c - *** CRITICAL: The units of centimeters align with
145 c - the use, in .gmtdefaults4, of:
146 c - MEASURE_UNIT = cm
147 c - If you change that value, then the units of lorvopc
148 c - will be whatever you change it too, which may prove
149 c - displeasing.
150 c -
151 c - "csm" is the Color Sigma Multiplier...the
152 c - number of Standard Deviations away from
153 c - the average for the color palette to
154 c - span on color plots.
155 c--------------------------------------------
156  lorvopc = 1.d0
157  csm = 3.d0
158  pi = 2.d0*dasin(1.d0)
159  d2r = pi/180.d0
160  re = 6371000.d0
161  multiplierlorvog = 2
162 
163 c ------------------------------------------------------------------
164 c - User-supplied input
165 c ------------------------------------------------------------------
166  read(5,'(a)')olddtm
167  read(5,'(a)')newdtm
168  read(5,'(a)')region
169  read(5,'(a)')agridsec
170  read(5,'(a)')mapflag
171 
172 c ------------------------------------------------------------------
173 c - Generate the suffixes used in all our files
174 c ------------------------------------------------------------------
175  read(agridsec,*)igridsec
176  suffix1=trim(olddtm)//'.'//trim(newdtm)//'.'//trim(region)
177 
178  suffix2=trim(suffix1)//'.'//trim(agridsec)
179  suffix2t04=trim(suffix2)//'.04'
180  suffix2d3=trim(suffix2)//'.d3'
181 
182  suffix3=trim(suffix2)//'.'//trim(mapflag)
183 
184 c ------------------------------------------------------------------
185 c - LAZY CODING: Spin through work file, collecting stats
186 c - which we will use to scale the map and vectors, etc.
187 c ------------------------------------------------------------------
188 c ------------------------------------------------------------------
189 c - Open the work file
190 c ------------------------------------------------------------------
191  wfname='work.'//trim(suffix1)
192  open(1,file='Work/'//wfname,status='old',form='formatted')
193  write(6,1004)trim(wfname)
194  1004 format(6x,'makeplotfiles02.f: Opening work file ',a)
195 
196  ndhor = 0
197  ndeht = 0
198  avedhorm = 0.d0
199  avedhors = 0.d0
200  avedehtm = 0.d0
201  891 read(1,104,end=892)pid,state,rejlat,rejlon,rejeht,
202  *xlath,xlonh,xehth,
203  *dlatsec,dlonsec,dehtm,dhorsec,azhor,dlatm,dlonm,dhorm,
204  *olddtm,newdtm
205  if(rejlat.eq.' ' .and. rejlon.eq.' ')then
206  avedhorm = avedhorm + dhorm
207  avedhors = avedhors + dhorsec
208  ndhor = ndhor + 1
209  endif
210  if(rejeht.eq.' ')then
211 c - Because they can be +/-, we and this is JUST for scaling the map,
212 c - we want the average MAGNITUDE...use ABS.
213  avedehtm = avedehtm + dabs(dehtm)
214  ndeht = ndeht + 1
215  endif
216  goto 891
217  892 continue
218  if(ndhor .gt.0)then
219  avedhorm = avedhorm / dble(ndhor )
220  avedhors = avedhors / dble(ndhor )
221  else
222  avedhorm = 0.d0
223  avedhors = 0.d0
224  endif
225  if(ndeht .gt.0)then
226  avedehtm = avedehtm / dble(ndeht )
227  else
228  avedehtm = 0.d0
229  endif
230  write(6,893)ndhor ,avedhorm,avedhors,ndeht ,avedehtm
231  893 format(6x,'makeplotfiles02.f: Vector Stats: ',/,
232  *10x,'Number of Good Horizontal Vectors : ',i10,/,
233  *10x,'Average length (meters) : ',f10.3,/,
234  *10x,'Average length (arcseconds) : ',f10.6,/,
235  *10x,'Number of Good Ell. Ht. Vectors : ',i10,/,
236  *10x,'Average length (meters) : ',f10.3)
237  104 format(a6,1x,a2,a1,a1,a1,1x,f14.10,1x,f14.10,1x,f8.3,1x,
238  *f9.5,1x,f9.5,1x,f9.3,1x,f9.5,1x,f9.5,1x,f9.3,1x,f9.3,1x,f9.3,
239  *1x,a10,1x,a10)
240 c ------------------------------------------------------------------
241 c - END OF LAZY CODING
242 c ------------------------------------------------------------------
243 
244 
245 
246 c --------------------------------------------------------------
247 c - GMT Batch file: Determine Number of areas to plot (=nplots)
248 c - and Boundaries of plots and other stuff.
249 c - Report the information out.
250 c --------------------------------------------------------------
251 c - 2016 08 29:
252  call getmapbounds(mapflag,maxplots,region,nplots,
253  *olddtm,newdtm,
254  *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y,rl0y)
255 
256 c - 2016 08 26, DRU-12, p.56-57
257 c call getmapbounds(mapflag,maxplots,region,nplots,
258 c *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y,rl0y)
259 c - See DRU-11, p. 126 for choices on grid boundaries for NADCON v5.0
260 c - 2016 07 21:
261 c call getmapbounds(mapflag,maxplots,region,nplots,
262 c *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y)
263 c call getmapbounds(mapflag,maxplots,region,nplots,
264 c *bw,be,bs,bn,jm,b1,b2,fn)
265  write(6,1006)trim(region)
266  1006 format(6x,'makeplotfiles02.f: Calling getmapbounds for region ',a)
267 
268 
269 c ---------------------------------------------------------------
270 c - Compute and report various things about our coverage
271 c - and vector plots.
272 c ---------------------------------------------------------------
273 c - Reference vector set to length of the average
274 c - absolute value of horizontal or ell ht shift.
275 c - Note "gm2pc" = "ground meters to paper centimeters"
276 c - "gs2pc" = "ground arcseconds to paper centimeters"
277 c - "lorvog*s" = "length of reference vector on ground (element) in arcseconds"
278 c - "lorvog*m" = "length of reference vector on ground (element) in meters"
279 
280  if(ndhor.ne.0)then
281 c iqhorm = floor(log10(avedhorm))
282 c qqhorm = 10.d0**(iqhorm-1)
283 c lorvoghorm = MultiplierLorvog*qqhorm*nint(avedhorm/qqhorm)
284  lorvoghorm = onzd2(multiplierlorvog*avedhorm)
285  gm2pchor = lorvopc / lorvoghorm
286 
287 c iqhors = floor(log10(avedhors))
288 c qqhors = 10.d0**(iqhors-1)
289 c lorvoghors = MultiplierLorvog*qqhors*nint(avedhors/qqhors)
290  lorvoghors = onzd2(multiplierlorvog*avedhors)
291  gs2pchor = lorvopc / lorvoghors
292  endif
293 
294  if(ndeht.ne.0)then
295 c iqehtm = floor(log10(avedehtm))
296 c qqehtm = 10.d0**(iqehtm-1)
297 c lorvogehtm = MultiplierLorvog*qqehtm*nint(avedehtm/qqehtm)
298  lorvogehtm = onzd2(multiplierlorvog*avedehtm)
299  gm2pceht = lorvopc / lorvogehtm
300  endif
301 
302 c - Report:
303  write(6,894)nplots
304  894 format(6x,'makeplotfiles02.f: Info about plots:',/,
305  *8x,'Number of sub-region plot sets to cover this region: ',i2)
306 
307  do 895 i=1,nplots
308  dns = bn(i) - bs(i)
309  dew = be(i) - bw(i)
310  write(6,896)i,bs(i),bn(i),bw(i),be(i),dns,dew
311  if(ndhor .ne.0)then
312  write(6,897)lorvoghorm,lorvoghors,gm2pchor,gs2pchor
313  else
314  write(6,898)
315  endif
316 
317  if(ndeht .ne.0)then
318  write(6,899)lorvogehtm,gm2pceht
319  else
320  write(6,900)
321  endif
322 
323  895 continue
324 
325  896 format(
326  *8x,'Plot # ',i2,/,
327  *10x,'S/N/W/E/N-S/E-W = ',6f7.1)
328  897 format(
329  *10x,'Lat/Lon/Hor plots: ',/,
330  *12x,'Reference Vector ( m) = ',f10.2,/,
331  *12x,'Reference Vector ( s) = ',f10.6,/,
332  *12x,'Ground M to Paper cm = ',f20.10,/,
333  *12x,'Ground S to Paper cm = ',f20.10)
334  898 format(
335  *10x,'Lat/Lon/Hor plots: ',/,
336  *12x,'No horizontal data available for plotting')
337  899 format(
338  *10x,'Ell. Height plots: ',/,
339  *12x,'Reference Vector ( m) = ',f10.2,/,
340  *12x,'Ground M to Paper cm = ',f20.10)
341  900 format(
342  *10x,'Ell. Height plots: ',/,
343  *12x,'No ellipsoid height data available for plotting')
344 
345 c ------------------------------------------------------------------
346 c - pvlon and pvlat are the percentage of the total lon/lat
347 c - span of the plot, from which the reference vector
348 c - begins, starting with the Lower Left corner
349 c ------------------------------------------------------------------
350  pvlon = 10.d0
351  pvlat = 10.d0
352 
353  pvlat = (pvlat / 100.d0)
354  pvlon = (pvlon / 100.d0)
355 
356 
357 c ------------------------------------------------------------------
358 c - The output batch file full of all the GMT commands
359 c - needed to create the plots of interest
360 c ------------------------------------------------------------------
361  gmtfile = 'gmtbat03.'//trim(suffix3)
362  open(99,file=gmtfile,status='new',form='formatted')
363  write(6,1011)trim(gmtfile)
364  1011 format(6x,'makeplotfiles02.f: Creating GMT batch file ',a)
365  write(99,1030)trim(gmtfile)
366  1030 format('echo BEGIN batch file ',a)
367 
368 
369 
370 c ------------------------------------------------------------------
371 c - Because our color palette will depend upon the statistics of
372 c - our grids, we need to access those grids, and store a few
373 c - statistics.
374 c ------------------------------------------------------------------
375  bfnvmtcdlat = 'vmtcdlat.'//trim(suffix2t04)//'.b'
376  bfnvmtcdlon = 'vmtcdlon.'//trim(suffix2t04)//'.b'
377  bfnvmtcdeht = 'vmtcdeht.'//trim(suffix2t04)//'.b'
378  bfnvstcdlat = 'vstcdlat.'//trim(suffix2t04)//'.b'
379  bfnvstcdlon = 'vstcdlon.'//trim(suffix2t04)//'.b'
380 
381  sadbfnvmtcdlat = 'vmtcdlat.'//trim(suffix2d3)//'.b'
382  sadbfnvmtcdlon = 'vmtcdlon.'//trim(suffix2d3)//'.b'
383  sadbfnvmtcdeht = 'vmtcdeht.'//trim(suffix2d3)//'.b'
384  sadbfnvstcdlat = 'vstcdlat.'//trim(suffix2d3)//'.b'
385  sadbfnvstcdlon = 'vstcdlon.'//trim(suffix2d3)//'.b'
386 
387  gfnvmtcdlat = 'vmtcdlat.'//trim(suffix2)
388  gfnvmtcdlon = 'vmtcdlon.'//trim(suffix2)
389  gfnvmtcdeht = 'vmtcdeht.'//trim(suffix2)
390  gfnvmtcdhor = 'vmtcdhor.'//trim(suffix2)
391  gfnvstcdlat = 'vstcdlat.'//trim(suffix2)
392  gfnvstcdlon = 'vstcdlon.'//trim(suffix2)
393  gfnvstcdhor = 'vstcdhor.'//trim(suffix2)
394 
395  gfncvtcdlat = 'cvtcdlat.'//trim(suffix2)
396  gfncvtcdlon = 'cvtcdlon.'//trim(suffix2)
397  gfncvtcdeht = 'cvtcdeht.'//trim(suffix2)
398 
399  gfnvmdcdlat = 'vmdcdlat.'//trim(suffix2)
400  gfnvmdcdlon = 'vmdcdlon.'//trim(suffix2)
401  gfnvmdcdeht = 'vmdcdeht.'//trim(suffix2)
402  gfnvmdcdhor = 'vmdcdhor.'//trim(suffix2)
403  gfnvsdcdlat = 'vsdcdlat.'//trim(suffix2)
404  gfnvsdcdlon = 'vsdcdlon.'//trim(suffix2)
405  gfnvsdcdhor = 'vsdcdhor.'//trim(suffix2)
406 
407  gfncvdcdlat = 'cvdcdlat.'//trim(suffix2)
408  gfncvdcdlon = 'cvdcdlon.'//trim(suffix2)
409  gfncvdcdeht = 'cvdcdeht.'//trim(suffix2)
410 
411  call vecstats(gfnvmtcdhor,nthinhor)
412  call vecstats(gfnvmtcdeht,nthineht)
413 
414 c-------------------------------------
415 c - Stats of the TRANSFORMATION grids
416 c-------------------------------------
417 
418  if(nthinhor.ne.0)then
419  write(6,1012)trim(bfnvmtcdlat)
420  call gridstats(bfnvmtcdlat,ave,std,xmd)
421  avelatm = ave
422  stdlatm = std
423  write(6,1012)trim(bfnvmtcdlon)
424  call gridstats(bfnvmtcdlon,ave,std,xmd)
425  avelonm = ave
426  stdlonm = std
427 
428  write(6,1012)trim(bfnvstcdlat)
429  call gridstats(bfnvstcdlat,ave,std,xmd)
430  avelats = ave
431  stdlats = std
432  write(6,1012)trim(bfnvstcdlon)
433  call gridstats(bfnvstcdlon,ave,std,xmd)
434  avelons = ave
435  stdlons = std
436 
437 c - Get color palette, Lat, meters:
438  call cpt(avelatm,stdlatm,csm,cptlolatm,cpthilatm,cptinlatm)
439 
440 c - Get color palette, Lon, meters:
441  call cpt(avelonm,stdlonm,csm,cptlolonm,cpthilonm,cptinlonm)
442 
443 c - Get color palette, Lat, arcseconds:
444  call cpt(avelats,stdlats,csm,cptlolats,cpthilats,cptinlats)
445 
446 c - Get color palette, Lon, arcseconds:
447  call cpt(avelons,stdlons,csm,cptlolons,cpthilons,cptinlons)
448 
449  endif
450 
451  if(nthineht.ne.0)then
452  write(6,1012)trim(bfnvmtcdeht)
453  call gridstats(bfnvmtcdeht,ave,std,xmd)
454  aveehtm = ave
455  stdehtm = std
456 
457 c - Get color palette, Eht, meters:
458  call cpt(aveehtm,stdehtm,csm,cptloehtm,cpthiehtm,cptinehtm)
459 
460  endif
461 
462 
463 
464 c-------------------------------------
465 c - Stats of the METHOD NOISE ("d3") grids
466 c-------------------------------------
467  if(nthinhor.ne.0)then
468  write(6,1012)trim(sadbfnvmtcdlat)
469  call gridstats(sadbfnvmtcdlat,ave,std,xmd)
470  avelatmsad = ave
471  stdlatmsad = std
472  xmdlatmsad = xmd
473  write(6,1012)trim(sadbfnvmtcdlon)
474  call gridstats(sadbfnvmtcdlon,ave,std,xmd)
475  avelonmsad = ave
476  stdlonmsad = std
477  xmdlonmsad = xmd
478 
479  write(6,1012)trim(sadbfnvstcdlat)
480  call gridstats(sadbfnvstcdlat,ave,std,xmd)
481  avelatssad = ave
482  stdlatssad = std
483  xmdlatssad = xmd
484  write(6,1012)trim(sadbfnvstcdlon)
485  call gridstats(sadbfnvstcdlon,ave,std,xmd)
486  avelonssad = ave
487  stdlonssad = std
488  xmdlonssad = xmd
489 
490 c - Get color palette, Lat, meters:
491 c call cpt(avelatmsad,stdlatmsad,csm,
492 c * cptlolatmsad,cpthilatmsad,cptinlatmsad)
493 c cptlolatmsad = 0.d0
494 c - 2016 01 21:
495 c cpthilatmsad = 2 * csm * cptinlatmsad
496 c - 2016 07 28:
497  call cpt2(xmdlatmsad,2.d0,
498  * cptlolatmsad,cpthilatmsad,cptinlatmsad)
499 
500 
501 c - Get color palette, Lon, meters:
502 c call cpt(avelonmsad,stdlonmsad,csm,
503 c * cptlolonmsad,cpthilonmsad,cptinlonmsad)
504 c cptlolonmsad = 0.d0
505 c - 2016 01 21:
506 c cpthilonmsad = 2 * csm * cptinlonmsad
507 c - 2016 07 28:
508  call cpt2(xmdlonmsad,2.d0,
509  * cptlolonmsad,cpthilonmsad,cptinlonmsad)
510 
511 
512 c - Get color palette, Lat, arcseconds:
513 c call cpt(avelatssad,stdlatssad,csm,
514 c * cptlolatssad,cpthilatssad,cptinlatssad)
515 c cptlolatssad = 0.d0
516 c - 2016 01 21:
517 c cpthilatssad = 2 * csm * cptinlatssad
518 c - 2016 07 28:
519  call cpt2(xmdlatssad,2.d0,
520  * cptlolatssad,cpthilatssad,cptinlatssad)
521 
522 
523 c - Get color palette, Lon, arcseconds:
524 c call cpt(avelonssad,stdlonssad,csm,
525 c * cptlolonssad,cpthilonssad,cptinlonssad)
526 c cptlolonssad = 0.d0
527 c - 2016 01 21:
528 c cpthilonssad = 2 * csm * cptinlonssad
529 c - 2016 07 28:
530  call cpt2(xmdlonssad,2.d0,
531  * cptlolonssad,cpthilonssad,cptinlonssad)
532 
533  endif
534 
535  if(nthineht.ne.0)then
536  write(6,1012)trim(sadbfnvmtcdeht)
537  call gridstats(sadbfnvmtcdeht,ave,std,xmd)
538  aveehtmsad = ave
539  stdehtmsad = std
540  xmdehtmsad = xmd
541 
542 c - Get color palette, Eht, meters:
543 c call cpt(aveehtmsad,stdehtmsad,csm,
544 c * cptloehtmsad,cpthiehtmsad,cptinehtmsad)
545 c cptloehtmsad = 0.d0
546 c - 2016 01 21:
547 c cpthiehtmsad = 2 * csm * cptinehtmsad
548  call cpt2(xmdehtmsad,2.d0,
549  * cptloehtmsad,cpthiehtmsad,cptinehtmsad)
550 
551  endif
552 
553 
554 
555 
556 
557 
558 
559 
560 
561  1012 format(6x,'makeplotfiles02.f: Grabbing stats of grid: ',a)
562 
563 c ------------------------------------------------------------------
564 c ------------------------------------------------------------------
565 c ------------------------------------------------------------------
566 c - MAIN LOOP: Loop over number of sub-areas (nplots) I've chosen
567 c - for this region (see "getmapbounds.f" subroutine).
568 c ------------------------------------------------------------------
569 c ------------------------------------------------------------------
570 c ------------------------------------------------------------------
571  do 2001 ij=1,nplots
572  write(99,990)trim(region),trim(fn(ij)),
573  * trim(region),trim(fn(ij))
574 
575 c --------------------
576 c - B/W COVERAGE PLOTS
577 c --------------------
578 c - Make B/W Coverage Plots of Thinned data
579 c - Latitude
580  if(nthinhor.ne.0)
581  * call bwplotcv('lat',gfncvtcdlat,bw,be,bs,bn,jm,
582  * b1,b2,maxplots,olddtm,newdtm,region,'LAT',ij,
583  * igridsec,fn)
584 c - Longitude
585  if(nthinhor.ne.0)
586  * call bwplotcv('lon',gfncvtcdlon,bw,be,bs,bn,jm,
587  * b1,b2,maxplots,olddtm,newdtm,region,'LON',ij,
588  * igridsec,fn)
589 c - Ellipsoid Height
590  if(nthineht.ne.0)
591  * call bwplotcv('eht',gfncvtcdeht,bw,be,bs,bn,jm,
592  * b1,b2,maxplots,olddtm,newdtm,region,'EHT',ij,
593  * igridsec,fn)
594 
595 c - Make B/W Coverage Plots of Dropped data
596 c - Latitude
597  if(nthinhor.ne.0)
598  * call bwplotcv('lat',gfncvdcdlat,bw,be,bs,bn,jm,
599  * b1,b2,maxplots,olddtm,newdtm,region,'LAT',ij,
600  * igridsec,fn)
601 c - Longitude
602  if(nthinhor.ne.0)
603  * call bwplotcv('lon',gfncvdcdlon,bw,be,bs,bn,jm,
604  * b1,b2,maxplots,olddtm,newdtm,region,'LON',ij,
605  * igridsec,fn)
606 c - Ellipsoid Height
607  if(nthineht.ne.0)
608  * call bwplotcv('eht',gfncvdcdeht,bw,be,bs,bn,jm,
609  * b1,b2,maxplots,olddtm,newdtm,region,'EHT',ij,
610  * igridsec,fn)
611 
612 c ------------------
613 c - B/W VECTOR PLOTS
614 c ------------------
615 c - Where is the start of the reference vector:
616 c - 2016 07 29: Decided to scrap personalized locations
617 c - and just put all reference vectors outside/below
618 c - the plots
619 
620 c - 2016 08 26
621  xvlon = rv0x(ij)
622  xvlat = rv0y(ij)
623 
624  xllon = xvlon
625  xllat = rl0y(ij)
626 
627 c - 2016 07 21:
628 c if(lrv(ij))then
629 c xvlon = rv0x(ij)
630 c xvlat = rv0y(ij)
631 c else
632 cccc xvlon = bw(ij) + (pvlon*(be(ij)-bw(ij)))
633 c xvlat = bs(ij) + (pvlat*(bn(ij)-bs(ij)))
634 cccc xvlat = bs(ij) - (pvlat*(bn(ij)-bs(ij)))
635 c endif
636 c - Where is the start of the label for the ref vector:
637 cccc xllon = xvlon
638 c - To prevent the label from going off the page on
639 c - plots that have very little N/S span, put in a
640 c - failsafe
641 c - 2016 07 21:
642 c if(lrv(ij))then
643 c xllat = xvlat - 0.1d0
644 c else
645 cccc if(bn(ij)-bs(ij).lt.2.0)then
646 c xllat = bs(ij) + ((pvlat*0.75d0)*(bn(ij)-bs(ij)))
647 cccc xllat = bs(ij) - ((pvlat*1.25d0)*(bn(ij)-bs(ij)))
648 cccc else
649 c xllat = bs(ij) + (pvlat*(bn(ij)-bs(ij))) - 0.1d0
650 cccc xllat = bs(ij) - (pvlat*(bn(ij)-bs(ij))) - 0.1d0
651 cccc endif
652 c endif
653 
654 c - Make B/W Vector Plots of Thinned data
655 
656 c - Latitude
657  if(nthinhor.ne.0)then
658  call bwplotvc('lat',gfnvmtcdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
659  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
660  * lorvoghorm,lorvopc,igridsec,fn)
661  call bwplotvc('lat',gfnvstcdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
662  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
663  * lorvoghors,lorvopc,igridsec,fn)
664  endif
665 c - Longitude
666  if(nthinhor.ne.0)then
667  call bwplotvc('lon',gfnvmtcdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
668  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
669  * lorvoghorm,lorvopc,igridsec,fn)
670  call bwplotvc('lon',gfnvstcdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
671  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
672  * lorvoghors,lorvopc,igridsec,fn)
673  endif
674 c - Ellipsoid height
675  if(nthineht.ne.0)then
676  call bwplotvc('eht',gfnvmtcdeht,bw,be,bs,bn,jm,b1,b2,maxplots,
677  * olddtm,newdtm,region,'EHT',ij,xvlon,xvlat,xllon,xllat,
678  * lorvogehtm,lorvopc,igridsec,fn)
679  endif
680 c - Horizontal
681  if(nthinhor.ne.0)then
682  call bwplotvc('hor',gfnvmtcdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
683  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
684  * lorvoghorm,lorvopc,igridsec,fn)
685  call bwplotvc('hor',gfnvstcdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
686  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
687  * lorvoghors,lorvopc,igridsec,fn)
688  endif
689 
690 c - Make B/W Vector Plots of Dropped data
691 
692 c - Latitude
693  if(nthinhor.ne.0)then
694  call bwplotvc('lat',gfnvmdcdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
695  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
696  * lorvoghorm,lorvopc,igridsec,fn)
697  call bwplotvc('lat',gfnvsdcdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
698  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
699  * lorvoghors,lorvopc,igridsec,fn)
700  endif
701 c - Longitude
702  if(nthinhor.ne.0)then
703  call bwplotvc('lon',gfnvmdcdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
704  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
705  * lorvoghorm,lorvopc,igridsec,fn)
706  call bwplotvc('lon',gfnvsdcdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
707  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
708  * lorvoghors,lorvopc,igridsec,fn)
709  endif
710 c - Ellipsoid Height
711  if(nthineht.ne.0)then
712  call bwplotvc('eht',gfnvmdcdeht,bw,be,bs,bn,jm,b1,b2,maxplots,
713  * olddtm,newdtm,region,'EHT',ij,xvlon,xvlat,xllon,xllat,
714  * lorvogehtm,lorvopc,igridsec,fn)
715  endif
716 c - Horizontal
717  if(nthinhor.ne.0)then
718  call bwplotvc('hor',gfnvmdcdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
719  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
720  * lorvoghorm,lorvopc,igridsec,fn)
721  call bwplotvc('hor',gfnvsdcdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
722  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
723  * lorvoghors,lorvopc,igridsec,fn)
724  endif
725 
726 c --------------------
727 c - Color gridded data (Transformation grid)
728 c --------------------
729 c - Make color plots of gridded (T=0.4), thinned data, with no
730 c - points.
731 
732 c - Latitude
733  if(nthinhor.ne.0)then
734  call coplot('lat',bfnvmtcdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
735  * olddtm,newdtm,region,'LAT',ij,cptlolatm,cpthilatm,cptinlatm,
736  * suffix2t04,igridsec,fn)
737  call coplot('lat',bfnvstcdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
738  * olddtm,newdtm,region,'LAT',ij,cptlolats,cpthilats,cptinlats,
739  * suffix2t04,igridsec,fn)
740  endif
741 c - Longitude
742  if(nthinhor.ne.0)then
743  call coplot('lon',bfnvmtcdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
744  * olddtm,newdtm,region,'LON',ij,cptlolonm,cpthilonm,cptinlonm,
745  * suffix2t04,igridsec,fn)
746  call coplot('lon',bfnvstcdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
747  * olddtm,newdtm,region,'LON',ij,cptlolons,cpthilons,cptinlons,
748  * suffix2t04,igridsec,fn)
749  endif
750 c - Ellipsoid Height
751  if(nthineht.ne.0)then
752  call coplot('eht',bfnvmtcdeht,bw,be,bs,bn,jm,b1,b2,maxplots,
753  * olddtm,newdtm,region,'EHT',ij,cptloehtm,cpthiehtm,cptinehtm,
754  * suffix2t04,igridsec,fn)
755  endif
756 
757 c --------------------
758 c - Color gridded data ("method noise", AKA "d3" grid)
759 c --------------------
760 c - Make color plots of "method noise" *with* data overlain. See
761 c - DRU-11, p.150
762 
763 c - Latitude
764  if(nthinhor.ne.0)then
765  call coplotwcv('lat',sadbfnvmtcdlat,bw,be,bs,bn,jm,b1,b2,
766  * maxplots,olddtm,newdtm,region,'LAT',ij,cptlolatmsad,
767  * cpthilatmsad,cptinlatmsad,suffix2d3,igridsec,fn,
768  * gfncvtcdlat)
769 
770  call coplotwcv('lat',sadbfnvstcdlat,bw,be,bs,bn,jm,b1,b2,
771  * maxplots,olddtm,newdtm,region,'LAT',ij,cptlolatssad,
772  * cpthilatssad,cptinlatssad,suffix2d3,igridsec,fn,
773  * gfncvtcdlat)
774  endif
775 c - Longitude
776  if(nthinhor.ne.0)then
777  call coplotwcv('lon',sadbfnvmtcdlon,bw,be,bs,bn,jm,b1,b2,
778  * maxplots,olddtm,newdtm,region,'LON',ij,cptlolonmsad,
779  * cpthilonmsad,cptinlonmsad,suffix2d3,igridsec,fn,
780  * gfncvtcdlon)
781 
782  call coplotwcv('lon',sadbfnvstcdlon,bw,be,bs,bn,jm,b1,b2,
783  * maxplots,olddtm,newdtm,region,'LON',ij,cptlolonssad,
784  * cpthilonssad,cptinlonssad,suffix2d3,igridsec,fn,
785  * gfncvtcdlon)
786  endif
787 c - Ellipsoid Height
788  if(nthineht.ne.0)then
789  call coplotwcv('eht',sadbfnvmtcdeht,bw,be,bs,bn,jm,b1,b2,
790  * maxplots,olddtm,newdtm,region,'EHT',ij,cptloehtmsad,
791  * cpthiehtmsad,cptinehtmsad,suffix2d3,igridsec,fn,
792  * gfncvtcdeht)
793  endif
794 
795 
796  2001 continue
797 
798  990 format(
799  *'# ------------------------------',/,
800  *'# Plots for region: ',a,', sub-region: ',a,/,
801  *'# ------------------------------',/,
802  *'echo Creating plots for region: ',a,', sub-region: ',a)
803 
804  write(99,1031)trim(gmtfile)
805  1031 format('echo END batch file ',a)
806  close(99)
807 
808  write(6,9999)
809  9999 format('END program makeplotfiles02.f')
810 
811 
812  end
813 c
814 c ------------------------------------------------------
815 c
816  include 'Subs/bwplotvc.f'
817  include 'Subs/bwplotcv.f'
818  include 'Subs/coplot.f'
819  include 'Subs/coplotwcv.f'
820  include 'Subs/plotcoast.f'
821  include 'Subs/getmapbounds.f'
822  include 'Subs/getmag.f'
823  include 'Subs/cpt.f'
824  include 'Subs/select2_mod.for'
825  include 'Subs/cpt2.f'
826  include 'Subs/gridstats.f'
827  include 'Subs/vecstats.f'
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...
Definition: coplotwcv.f:68
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.
Definition: bwplotvc.f:33
subroutine cpt2(med, csm, xlo, xhi, xin)
This subroutine generates the color pallette variables for a GMT color plot.
Definition: cpt2.f:21
program makeplotfiles02
Part of the NADCON5 process, generates gmtbat03
real *8 function onzd2(x)
Function to round a digit to one significant figure (one non zero digit), double precision.
Definition: onzd2.f:32
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.
Definition: coplot.f:70
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.
Definition: getmapbounds.f:73
subroutine gridstats(fname, ave, std, med)
Subroutine to print grid statistics to stdout.
Definition: gridstats.f:10
subroutine cpt(ave, std, csm, xlo, xhi, xin)
This subroutine generates the color pallette variables for a GMT color plot.
Definition: cpt.f:28
subroutine vecstats(fname, n)
Subroutine to tell us how many thinned vectors were used to make a grid.
Definition: vecstats.f:8
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.
Definition: bwplotcv.f:26