NADCON5-ng  0.0.2
NADCON5 Next Generation Documentation
makeplotfiles03.f
Go to the documentation of this file.
1 c> \ingroup doers
2 c> \if MANPAGE
3 c> \page makeplotfiles03
4 c> \endif
5 c>
6 c> Part of the NADCON5 process, generates `gmtbat06`
7 c>
8 c> Creates a batch file called
9 c>
10 c> gmtbat06.(olddtm).(newdtm).(region).(igridsec).(mapflag)
11 c>
12 c> That batch file will create JPGs of:
13 c> 1. Color Plots of the rddlat/rddlon/rddeht grids
14 c> 2. B/W plots of coverage of RMS'd differential vectors that went into the grid
15 c> 3. B/W plots of RMS'd differential vectors that went into the grid
16 c>
17 c> ### Program arguments
18 c> Arguments are newline terminated and read from standard input
19 c>
20 c> They are enumerated here
21 c> \param oldtm Source Datum
22 c> \param newdtm Target Datum,region
23 c> \param region Conversion Region
24 c> \param agridsec Grid Spacing in arcsec
25 c> \param mapflag Map Generation Level
26 c>
27 c> Example:
28 c>
29 c> olddatum = 'ussd'
30 c> newdatum = 'nad27'
31 c> region = 'conus'
32 c> agridsec = '900'
33 c> mapflag = '0'
34 c>
35 c> ### Program Inputs:
36 c>
37 c> ## Changelog
38 c>
39 c> ### 2016 10 19:
40 c> FIX for the HARN/FBN transformation. As it stood, the "gridstats" was
41 c> returning "0.0" as the median of the post-masked "ete" grid (which
42 c> is true, but unfortunate.) I've changed the call to "gridstats"
43 c> to send it the "PREMASKED" version of the "ete" grid, so the median
44 c> won't be zero.
45 c>
46 c> ### 2016 08 26
47 c> Added new code to do reference vectors consistently
48 c> See DRU-12, p. 56-57
49 c>
50 c> Fixed an error where "lorvogehtm" was declared real*8 but past 72 column,
51 c> so defaulting to integer*4 and coming out as "0.000" on plots
52 c>
53 c> Also changing the call to "getmapbounds" to give it "olddatum" and "newdatum"
54 c> to aide in filtering out things like the Saint regions in Alaska
55 c> for unsupported transformations.
56 c>
57 c> ### 2016 08 02:
58 c> Changed the color palette for "09" grids from 2xMedian to 3xMedian
59 c>
60 c> ### 2016 07 29:
61 c> Dropped code about personalized reference vectors and just
62 c> let them be below/outside map
63 c>
64 c> ### 2016 08 01:
65 c> Moved "gridstats" to subroutines
66 c> Also, completely removed the in-program computations of
67 c> the color palette, and instead relied on "cpt" and "cpt2"
68 c> as per "makeplotfiles02"
69 c>
70 c> ### 2016 07 21:
71 c> Added code to allow for optional placement of reference vectors, coming from
72 c> `map.parameters` as read in subroutine getmapbounds
73 c>
74 c> ### 2016 01 21:
75 c> Updated to fix the CPT for the "09" (data noise)
76 c> grids so that (cpthi - cptin) is exactly divisible by cptin
77 c>
78 c> ### 2015 11 09:
79 c> Updated to adopt new naming scheme (yes, again)
80 c> (See DRU-11, p. 150), as well as creating plots of the
81 c> total error grid.
82 c>
83 c> ### 2015 10 07:
84 c> Latest Version which had new naming scheme and
85 c> dual-computations of arcseconds and meters for lat/lon
86 c> See DRU-11, pl. 139.
87 c>
89  implicit real*8(a-h,o-z)
90  parameter(maxplots=60)
91 
92  character*35 fname0
93  character*34 dirnam
94  character*10 olddtm,newdtm,od,nd
95  character*2 state,stdum
96  character*3 ele,elelat,elelon,eleeht,ele0
97 
98  character*5 agridsec
99  integer*4 igridsec
100  character*200 suffix1,suffix2,suffix3
101  character*200 suffix2t09,suffix2d3
102  character*200 wfname,gmtfile
103 
104 c - ".b" of RMS'd double difference data
105  character*200 bfnvsrddlat,bfnvsrddlon,bfnvmrddeht
106  character*200 bfnvmrddlat,bfnvmrddlon
107 
108 c - "grd" of RMS'd double difference data
109  character*200 rfnvsrddlat,rfnvsrddlon,rfnvmrddeht
110  character*200 rfnvmrddlat,rfnvmrddlon
111 
112 c - "coverage" of RMS'd data (needs to be created in "myrms.f")
113  character*200 gfncvrddlat,gfncvrddlon,gfncvrddeht
114 
115 c - RMS'd double difference vectors
116  character*200 gfnvsrddlat,gfnvsrddlon,gfnvmrddeht
117  character*200 gfnvmrddlat,gfnvmrddlon
118 
119 c - "Method Noise" grids:
120  character*200 sadbfnvmtcdlat1000,sadbfnvmtcdlon1000
121  character*200 sadbfnvmtcdeht1000
122  character*200 sadbfnvstcdlat1000,sadbfnvstcdlon1000
123 
124 c -" Total Error" grids:
125  character*200 bfnvsetelat,bfnvsetelon
126  character*200 bfnvmetelat,bfnvmetelon
127  character*200 bfnvmeteeht
128 
129 c - 2016 10 19:
130 c - For the HARN/FBN situation *only*
131 c - "Total Error" grids, pre-mask:
132  character*200 bfnvsetelat0,bfnvsetelon0
133  character*200 bfnvmetelat0,bfnvmetelon0
134  character*200 bfnvmeteeht0
135 
136 
137 c - 2015 10 09:
138  character*200 gfnvsrddhor,gfnvmrddhor
139 
140 c - Stats file
141  character*200 sfn
142 
143 c - GMT stuff
144  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
145  real*4 jm(maxplots)
146  real*4 b1(maxplots),b2(maxplots)
147  character*10 fn(maxplots)
148 c - 2016 07 21:
149  logical lrv(maxplots)
150  real*8 rv0x(maxplots),rv0y(maxplots),rl0y(maxplots)
151 
152 
153 c - Stuff that is in the work file records:
154  character*6 pid
155  character*2 state
156  character*1 rejlat,rejlon,rejeht
157  real*8 xlath,xlonh,xehth
158  real*8 dlatsec,dlonsec,dehtm
159  real*8 dlatm,dlonm
160  character*10 olddtm,newdtm,region
161 c - Units to put on scale on GMT color plots
162  character*17 scunlat,scunlon,scuneht
163  character*1 mapflag
164 
165  real*8 lorvopc,lorvoglats,lorvoglatm,lorvoglons,lorvoglonm
166  real*8 lorvogehtm
167 c - 2015 10 09
168  real*8 lorvoghors,lorvoghorm
169 
170 c ------------------------------------------------------------------
171 c - BEGIN PROGRAM
172 c ------------------------------------------------------------------
173  write(6,1001)
174  1001 format('BEGIN program makeplotfiles03.f')
175 
176 c ------------------------------------------------------------------
177 c - User-supplied input
178 c ------------------------------------------------------------------
179  read(5,'(a)')olddtm
180  read(5,'(a)')newdtm
181  read(5,'(a)')region
182  read(5,'(a)')agridsec
183  read(5,'(a)')mapflag
184 
185 c ------------------------------------------------------------------
186 c - Some necessary constants
187 c ------------------------------------------------------------------
188  lorvopc = 1.d0
189  csm = 3.d0
190  pi = 2.d0*dasin(1.d0)
191  d2r = pi/180.d0
192  multiplierlorvog = 2
193 
194 c ------------------------------------------------------------------
195 c - Generate the suffixes used in all our files
196 c ------------------------------------------------------------------
197  read(agridsec,*)igridsec
198  suffix1=trim(olddtm)//'.'//trim(newdtm)//'.'//trim(region)
199  suffix2=trim(suffix1)//'.'//trim(agridsec)
200  suffix3=trim(suffix2)//'.'//trim(mapflag)
201 
202  suffix2d3=trim(suffix2)//'.d3'
203  suffix2t09=trim(suffix2)//'.09'
204 
205 c ------------------------------------------------------------------
206 c - Got clever here...I stored # of double differences and the RMS of those
207 c - vectors into "dvstats...." back in the running of "checkgrid.f".
208 c - Now let's re-acquire this data and use it to scale double differenced vectors
209 c - in this program. Granted, this won't be EXACTLY the same
210 c - as what is in the data (the RMS'd DD vectors are RMS'd in cells/bins,
211 c - but what is in "dvstats" is just an area-wide RMS value) but it's
212 c - good enough to scale things in the ballpark.
213 
214  sfn = 'dvstats.'//trim(suffix2)
215  open(1,file=sfn,status='old',form='formatted')
216  write(6,1004)
217  1004 format(6x,'makeplotfiles03.f: Acquiring vectors ',
218  *'stats from the dvstats file')
219 
220  read(1,*)nlat,rlats
221  read(1,*)nlon,rlons
222  read(1,*)neht,rehtm
223  read(1,*)nlat0,rlatm
224  read(1,*)nlon0,rlonm
225 c - 2015 10 09
226  read(1,*)nhor ,rhors
227  read(1,*)nhor0,rhorm
228 
229  if(nlat0.ne.nlat)stop 10001
230  if(nlon0.ne.nlon)stop 10002
231  if(nhor0.ne.nhor)stop 10003
232  if(nhor.ne.nlat)stop 10004
233  if(nhor.ne.nlon)stop 10005
234 
235  write(6,893)nlat,rlats,rlatm,
236  *nlon,rlons,rlonm,
237  *nhor,rhors,rhorm,
238  *neht,rehtm
239 
240  893 format(6x,'makeplotfiles03.f: Vector Stats: ',/,
241  *10x,'Number of Double Differenced Vectors in LAT: ',i10,/,
242  *10x,'RMS length (arcseconds) : ',f10.3,/,
243  *10x,'RMS length (meters) : ',f10.3,/,
244  *10x,'Number of Double Differenced Vectors in LON: ',i10,/,
245  *10x,'RMS length (arcseconds) : ',f10.3,/,
246  *10x,'RMS length (meters) : ',f10.3,/,
247  *10x,'Number of Double Differenced Vectors in HOR: ',i10,/,
248  *10x,'RMS length (arcseconds) : ',f10.3,/,
249  *10x,'RMS length (meters) : ',f10.3,/,
250  *10x,'Number of Double Differenced Vectors in EHT: ',i10,/,
251  *10x,'RMS length (arcseconds) : ',f10.3)
252 c ------------------------------------------------------------------
253 
254 
255 c --------------------------------------------------------------
256 c - GMT Batch file: Open the file
257 c --------------------------------------------------------------
258  gmtfile = 'gmtbat06.'//trim(suffix3)
259  open(99,file=gmtfile,status='new',form='formatted')
260  write(6,1011)trim(gmtfile)
261  1011 format(6x,'makeplotfiles03.f: Creating GMT batch file ',a)
262  write(99,1030)trim(gmtfile)
263  1030 format('echo BEGIN batch file ',a)
264 
265 
266 c - The "method noise" grids
267  sadbfnvmtcdlat1000 = 'vmtcdlat.'//trim(suffix2d3)//'.b'
268  sadbfnvstcdlat1000 = 'vstcdlat.'//trim(suffix2d3)//'.b'
269  sadbfnvmtcdlon1000 = 'vmtcdlon.'//trim(suffix2d3)//'.b'
270  sadbfnvstcdlon1000 = 'vstcdlon.'//trim(suffix2d3)//'.b'
271  sadbfnvmtcdeht1000 = 'vmtcdeht.'//trim(suffix2d3)//'.b'
272 
273 c - The "data noise" grids
274  bfnvsrddlat = 'vsrddlat.'//trim(suffix2t09)//'.b'
275  bfnvsrddlon = 'vsrddlon.'//trim(suffix2t09)//'.b'
276  bfnvmrddeht = 'vmrddeht.'//trim(suffix2t09)//'.b'
277  bfnvmrddlat = 'vmrddlat.'//trim(suffix2t09)//'.b'
278  bfnvmrddlon = 'vmrddlon.'//trim(suffix2t09)//'.b'
279 
280 c - The "total noise" grids
281  bfnvsetelat ='vsetelat.'//trim(suffix2)//'.b'
282  bfnvsetelon ='vsetelon.'//trim(suffix2)//'.b'
283  bfnvmetelat ='vmetelat.'//trim(suffix2)//'.b'
284  bfnvmetelon ='vmetelon.'//trim(suffix2)//'.b'
285  bfnvmeteeht ='vmeteeht.'//trim(suffix2)//'.b'
286 
287 c --------------------------------------------------------------
288 c - GMT Batch file: Get color palatte for the "total error"
289 c - grids. Keep this separate from the color palette for
290 c - the "data noise" grids.
291 c --------------------------------------------------------------
292 
293 c - 2016 08 01: All below changed to rely on "cpt2" for "ete" grids
294 
295  if(nlat.ne.0)then
296 
297 c - 2016 10 19
298 c - Lazy coding here: You can ONLY have "olddtm" = "nad83_harn" if
299 c - you also have "nad83_fbn" as "newdtm" and "conus"
300 c - as "region", so I won't bother checking all 3:
301  if(trim(olddtm).ne.'nad83_harn')then
302  write(6,1012)trim(bfnvmetelat)
303  call gridstats(bfnvmetelat,ave,std,xmd)
304  else
305  bfnvmetelat0 = trim(bfnvmetelat)//'.premask'
306  write(6,1012)trim(bfnvmetelat0)
307  call gridstats(bfnvmetelat0,ave,std,xmd)
308  endif
309 
310  avelatme = ave
311  stdlatme = std
312  xmdlatme = xmd
313  call cpt2(xmdlatme,2.d0,
314  * cptlolatme,cpthilatme,cptinlatme)
315 c cptinlatmE=onzd2(std)
316 c scaledave =onzd2(ave)
317 c cptlolatmE = 0.d0
318 c cpthilatmE = scaledave + csm*cptinlatmE
319 
320 
321 c - 2016 10 19
322 c - Lazy coding here: You can ONLY have "olddtm" = "nad83_harn" if
323 c - you also have "nad83_fbn" as "newdtm" and "conus"
324 c - as "region", so I won't bother checking all 3:
325  if(trim(olddtm).ne.'nad83_harn')then
326  write(6,1012)trim(bfnvsetelat)
327  call gridstats(bfnvsetelat,ave,std,xmd)
328  else
329  bfnvsetelat0 = trim(bfnvsetelat)//'.premask'
330  write(6,1012)trim(bfnvsetelat0)
331  call gridstats(bfnvsetelat0,ave,std,xmd)
332  endif
333 
334  avelatse = ave
335  stdlatse = std
336  xmdlatse = xmd
337  call cpt2(xmdlatse,2.d0,
338  * cptlolatse,cpthilatse,cptinlatse)
339 c cptinlatsE=onzd2(std)
340 c scaledave =onzd2(ave)
341 c cptlolatsE = 0.d0
342 c cpthilatsE = scaledave + csm*cptinlatsE
343  endif
344 
345  if(nlon.ne.0)then
346 
347 c - 2016 10 19
348 c - Lazy coding here: You can ONLY have "olddtm" = "nad83_harn" if
349 c - you also have "nad83_fbn" as "newdtm" and "conus"
350 c - as "region", so I won't bother checking all 3:
351  if(trim(olddtm).ne.'nad83_harn')then
352  write(6,1012)trim(bfnvmetelon)
353  call gridstats(bfnvmetelon,ave,std,xmd)
354  else
355  bfnvmetelon0 = trim(bfnvmetelon)//'.premask'
356  write(6,1012)trim(bfnvmetelon0)
357  call gridstats(bfnvmetelon0,ave,std,xmd)
358  endif
359 
360  avelonme = ave
361  stdlonme = std
362  xmdlonme = xmd
363  call cpt2(xmdlonme,2.d0,
364  * cptlolonme,cpthilonme,cptinlonme)
365 c cptinlonmE=onzd2(std)
366 c scaledave =onzd2(ave)
367 c cptlolonmE = 0.d0
368 c cpthilonmE = scaledave + csm*cptinlonmE
369 
370 c - 2016 10 19
371 c - Lazy coding here: You can ONLY have "olddtm" = "nad83_harn" if
372 c - you also have "nad83_fbn" as "newdtm" and "conus"
373 c - as "region", so I won't bother checking all 3:
374  if(trim(olddtm).ne.'nad83_harn')then
375  write(6,1012)trim(bfnvsetelon)
376  call gridstats(bfnvsetelon,ave,std,xmd)
377  else
378  bfnvsetelon0 = trim(bfnvsetelon)//'.premask'
379  write(6,1012)trim(bfnvsetelon0)
380  call gridstats(bfnvsetelon0,ave,std,xmd)
381  endif
382 
383  avelonse = ave
384  stdlonse = std
385  xmdlonse = xmd
386  call cpt2(xmdlonse,2.d0,
387  * cptlolonse,cpthilonse,cptinlonse)
388 c cptinlonsE=onzd2(std)
389 c scaledave =onzd2(ave)
390 c cptlolonsE = 0.d0
391 c cpthilonsE = scaledave + csm*cptinlonsE
392  endif
393 
394  if(neht.ne.0)then
395 
396 c - 2016 10 19
397 c - Lazy coding here: You can ONLY have "olddtm" = "nad83_harn" if
398 c - you also have "nad83_fbn" as "newdtm" and "conus"
399 c - as "region", so I won't bother checking all 3:
400  if(trim(olddtm).ne.'nad83_harn')then
401  write(6,1012)trim(bfnvmeteeht)
402  call gridstats(bfnvmeteeht,ave,std,xmd)
403  else
404  bfnvmeteeht0 = trim(bfnvmeteeht)//'.premask'
405  write(6,1012)trim(bfnvmeteeht0)
406  call gridstats(bfnvmeteeht0,ave,std,xmd)
407  endif
408 
409  aveehtme = ave
410  stdehtme = std
411  xmdehtme = xmd
412  call cpt2(xmdehtme,2.d0,
413  * cptloehtme,cpthiehtme,cptinehtme)
414 c cptinehtmE=onzd2(std)
415 c scaledave =onzd2(ave)
416 c cptloehtmE = 0.d0
417 c cpthiehtmE = scaledave + csm*cptinehtmE
418  endif
419 
420 
421 c --------------------------------------------------------------
422 c - GMT Batch file: Determine Number of areas to plot (=nplots)
423 c - and Boundaries of plots and other stuff.
424 c - Report the information out.
425 c --------------------------------------------------------------
426 c - 2016 08 29:
427  call getmapbounds(mapflag,maxplots,region,nplots,
428  *olddtm,newdtm,
429  *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y,rl0y)
430 
431 
432 c - 2016 08 26, DRU-12, p.56-57
433 c call getmapbounds(mapflag,maxplots,region,nplots,
434 c *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y,rl0y)
435 c - See DRU-11, p. 126 for choices on grid boundaries for NADCON v5.0
436 c - 2016 07 21
437 c call getmapbounds(mapflag,maxplots,region,nplots,
438 c *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y)
439 c call getmapbounds(mapflag,maxplots,region,nplots,
440 c *bw,be,bs,bn,jm,b1,b2,fn)
441  write(6,1006)trim(region)
442  1006 format(6x,'makeplotfiles03.f: Calling getmapbounds for region ',a)
443 
444 c ---------------------------------------------------------------
445 c - Compute and report various things about our coverage
446 c - and vector plots.
447 c ---------------------------------------------------------------
448 c - How many centimeters long will our reference arrows be?
449 c - Base this on the actual data
450 
451  if(nlat.ne.0)then
452 c iqlats = floor(log10(rlats))
453 c qqlats = 10.d0**(iqlats-1)
454 c lorvoglats = MultiplierLorvog*qqlats*nint(rlats/qqlats)
455  lorvoglats = onzd2(multiplierlorvog*rlats)
456  gs2pclat = lorvopc / lorvoglats
457 
458 c iqlatm = floor(log10(rlatm))
459 c qqlatm = 10.d0**(iqlatm-1)
460 c lorvoglatm = MultiplierLorvog*qqlatm*nint(rlatm/qqlatm)
461  lorvoglatm = onzd2(multiplierlorvog*rlatm)
462  gm2pclat = lorvopc / lorvoglatm
463  endif
464 
465  if(nlon.ne.0)then
466 c iqlons = floor(log10(rlons))
467 c qqlons = 10.d0**(iqlons-1)
468 c lorvoglons = MultiplierLorvog*qqlons*nint(rlons/qqlons)
469  lorvoglons = onzd2(multiplierlorvog*rlons)
470  gs2pclon = lorvopc / lorvoglons
471 
472 c iqlonm = floor(log10(rlonm))
473 c qqlonm = 10.d0**(iqlonm-1)
474 c lorvoglonm = MultiplierLorvog*qqlonm*nint(rlonm/qqlonm)
475  lorvoglonm = onzd2(multiplierlorvog*rlonm)
476  gm2pclon = lorvopc / lorvoglonm
477  endif
478 
479  if(neht.ne.0)then
480 c iqehtm = floor(log10(rehtm))
481 c qqehtm = 10.d0**(iqehtm-1)
482 c lorvogehtm = MultiplierLorvog*qqehtm*nint(rehtm/qqehtm)
483  lorvogehtm = onzd2(multiplierlorvog*rehtm)
484  gm2pceht = lorvopc / lorvogehtm
485  endif
486 
487  if(nlon.ne.0 .and. nlat.ne.0)then
488 c iqhors = floor(log10(rhors))
489 c qqhors = 10.d0**(iqhors-1)
490 c lorvoghors = MultiplierLorvog*qqhors*nint(rhors/qqhors)
491  lorvoghors = onzd2(multiplierlorvog*rhors)
492  gs2pchor = lorvopc / lorvoghors
493 
494 c iqhorm = floor(log10(rhorm))
495 c qqhorm = 10.d0**(iqhorm-1)
496 c lorvoghorm = MultiplierLorvog*qqhorm*nint(rhorm/qqhorm)
497  lorvoghorm = onzd2(multiplierlorvog*rhorm)
498  gm2pchor = lorvopc / lorvoghorm
499  endif
500 
501 
502 c - Report:
503  write(6,894)nplots
504  894 format(6x,'makeplotfiles03.f: Info about plots:',/,
505  *8x,'Number of sub-area plot sets to cover this region: ',i2)
506 
507  do 895 i=1,nplots
508  dns = bn(i) - bs(i)
509  dew = be(i) - bw(i)
510  write(6,896)i,bs(i),bn(i),bw(i),be(i),dns,dew
511 
512  if(nlat.ne.0)then
513  write(6,897)'lat',lorvoglatm,lorvoglats,gm2pclat,gs2pclat
514  else
515  write(6,898)'lat'
516  endif
517 
518  if(nlon.ne.0)then
519  write(6,897)'lon',lorvoglonm,lorvoglons,gm2pclon,gs2pclon
520  else
521  write(6,898)'lon'
522  endif
523 
524  if(neht.ne.0)then
525  write(6,899)'eht',lorvogehtm,gm2pceht
526  else
527  write(6,898)'eht'
528  endif
529 
530  if(nlat.ne.0 .and. nlon.ne.0)then
531  write(6,897)'hor',lorvoghorm,lorvoghors,gm2pchor,gs2pchor
532  else
533  write(6,898)'hor'
534  endif
535 
536  895 continue
537 
538  896 format(
539  *8x,'Plot # ',i2,/,
540  *10x,'S/N/W/E/N-S/E-W = ',6f7.1)
541  897 format(
542  *10x,a3,' plots',13x,':',/,
543  *12x,'Reference Vector ( m) = ',f10.2,/,
544  *12x,'Reference Vector ( s) = ',f10.6,/,
545  *12x,'Ground M to Paper cm = ',f20.10,/,
546  *12x,'Ground S to Paper cm = ',f20.10)
547  899 format(
548  *10x,a3,' plots',13x,':',/,
549  *12x,'Reference Vector ( m) = ',f10.2,/,
550  *12x,'Ground M to Paper cm = ',f20.10)
551  898 format(
552  *10x,a3,' plots: No data available for plotting')
553 
554 c ------------------------------------------------------------------
555 c - pvlon and pvlat are the percentage of the total lon/lat
556 c - span of the plot, from which the reference vector
557 c - begins, starting with the Lower Left corner
558 c ------------------------------------------------------------------
559  pvlon = 10.d0
560  pvlat = 10.d0
561 
562  pvlat = (pvlat / 100.d0)
563  pvlon = (pvlon / 100.d0)
564 
565 
566 c --------------------------------------------------------------
567 c - GMT Batch file: Get color palatte for the "data noise", aka "09"
568 c - grids.
569 c --------------------------------------------------------------
570 c ------------------------------------------------------------------
571 c - Because our color palette will depend upon the statistics of
572 c - our grids, we need to access those grids, and store a few
573 c - statistics.
574 c ------------------------------------------------------------------
575  rfnvsrddlat = 'vsrddlat.'//trim(suffix2t09)//'.grd'
576  rfnvsrddlon = 'vsrddlon.'//trim(suffix2t09)//'.grd'
577  rfnvmrddeht = 'vmrddeht.'//trim(suffix2t09)//'.grd'
578  rfnvmrddlat = 'vmrddlat.'//trim(suffix2t09)//'.grd'
579  rfnvmrddlon = 'vmrddlon.'//trim(suffix2t09)//'.grd'
580 
581  gfnvsrddlat = 'vsrddlat.'//trim(suffix2)
582  gfnvsrddlon = 'vsrddlon.'//trim(suffix2)
583  gfnvmrddeht = 'vmrddeht.'//trim(suffix2)
584  gfnvmrddlat = 'vmrddlat.'//trim(suffix2)
585  gfnvmrddlon = 'vmrddlon.'//trim(suffix2)
586  gfnvsrddhor = 'vsrddhor.'//trim(suffix2)
587  gfnvmrddhor = 'vmrddhor.'//trim(suffix2)
588 
589  gfncvrddlat = 'cvrddlat.'//trim(suffix2)
590  gfncvrddlon = 'cvrddlon.'//trim(suffix2)
591  gfncvrddeht = 'cvrddeht.'//trim(suffix2)
592 
593 c - NOTE ON COLOR PALLETTES, BELOW:
594 c - Because all of the differential vectors are RMS'd values at
595 c - this point, they will have a minimum value of zero. As such,
596 c - set the "cptlo" values to zero.
597 
598 c - 2016 08 01: Changed to use "cpt2" for "09" (RMS) grids
599 c - 2016 08 02: Changed the multiplier in the 09 grids from 2 to 3
600 
601  if(nlat.ne.0)then
602  write(6,1012)trim(bfnvsrddlat)
603  call gridstats(bfnvsrddlat,ave,std,xmd)
604  avelats = ave
605  stdlats = std
606  xmdlats = xmd
607  call cpt2(xmdlats,3.d0,
608  * cptlolats,cpthilats,cptinlats)
609 
610  write(6,1012)trim(bfnvmrddlat)
611  call gridstats(bfnvmrddlat,ave,std,xmd)
612  avelatm = ave
613  stdlatm = std
614  xmdlatm = xmd
615  call cpt2(xmdlatm,3.d0,
616  * cptlolatm,cpthilatm,cptinlatm)
617 
618  endif
619 
620  if(nlon.ne.0)then
621  write(6,1012)trim(bfnvsrddlon)
622  call gridstats(bfnvsrddlon,ave,std,xmd)
623  avelons = ave
624  stdlons = std
625  xmdlons = xmd
626  call cpt2(xmdlons,3.d0,
627  * cptlolons,cpthilons,cptinlons)
628 
629  write(6,1012)trim(bfnvmrddlon)
630  call gridstats(bfnvmrddlon,ave,std,xmd)
631  avelonm = ave
632  stdlonm = std
633  xmdlonm = xmd
634  call cpt2(xmdlonm,3.d0,
635  * cptlolonm,cpthilonm,cptinlonm)
636 
637  endif
638 
639  if(neht.ne.0)then
640  write(6,1012)trim(bfnvmrddeht)
641  call gridstats(bfnvmrddeht,ave,std,xmd)
642  aveehtm = ave
643  stdehtm = std
644  xmdehtm = xmd
645  call cpt2(xmdehtm,3.d0,
646  * cptloehtm,cpthiehtm,cptinehtm)
647 
648  endif
649 
650 
651  1012 format(6x,'makeplotfiles03.f: Grabbing stats of grid: ',a)
652 
653 c ------------------------------------------------------------------
654 c ------------------------------------------------------------------
655 c ------------------------------------------------------------------
656 c - MAIN LOOP: Loop over number of sub-areas (nplots) I've chosen
657 c - for this region (see "getmapbounds.f" subroutine).
658 c ------------------------------------------------------------------
659 c ------------------------------------------------------------------
660 c ------------------------------------------------------------------
661  do 2001 ij=1,nplots
662  write(99,990)trim(region),trim(fn(ij)),
663  * trim(region),trim(fn(ij))
664 
665 c --------------------
666 c - B/W COVERAGE PLOTS
667 c --------------------
668 c - Make B/W Coverage Plots of RMS'd data
669 c - Latitude
670  if(nlat.ne.0)
671  * call bwplotcv('lat',gfncvrddlat,bw,be,bs,bn,jm,
672  * b1,b2,maxplots,olddtm,newdtm,region,'LAT',ij,
673  * igridsec,fn)
674 c - Longitude
675  if(nlon.ne.0)
676  * call bwplotcv('lon',gfncvrddlon,bw,be,bs,bn,jm,
677  * b1,b2,maxplots,olddtm,newdtm,region,'LON',ij,
678  * igridsec,fn)
679 c - Ellipsoid Height
680  if(neht.ne.0)
681  * call bwplotcv('eht',gfncvrddeht,bw,be,bs,bn,jm,
682  * b1,b2,maxplots,olddtm,newdtm,region,'EHT',ij,
683  * igridsec,fn)
684 
685 c ------------------
686 c - B/W VECTOR PLOTS
687 c ------------------
688 c - Where is the start of the reference vector:
689 c - 2016 07 29: Decided to scrap personalized locations
690 c - and just put all reference vectors outside/below
691 c - the plots
692 
693 c - 2016 08 26
694  xvlon = rv0x(ij)
695  xvlat = rv0y(ij)
696 
697  xllon = xvlon
698  xllat = rl0y(ij)
699 
700 c - 2016 07 21:
701 c if(lrv(ij))then
702 c xvlon = rv0x(ij)
703 c xvlat = rv0y(ij)
704 c else
705 cccc xvlon = bw(ij) + (pvlon*(be(ij)-bw(ij)))
706 c xvlat = bs(ij) + (pvlat*(bn(ij)-bs(ij)))
707 cccc xvlat = bs(ij) - (pvlat*(bn(ij)-bs(ij)))
708 c endif
709 c - Where is the start of the label for the ref vector:
710 cccc xllon = xvlon
711 c - To prevent the label from going off the page on
712 c - plots that have very little N/S span, put in a
713 c - failsafe
714 c if(lrv(ij))then
715 c xllat = xvlat - 0.1d0
716 c else
717 cccc if(bn(ij)-bs(ij).lt.2.0)then
718 c xllat = bs(ij) + ((pvlat*0.75d0)*(bn(ij)-bs(ij)))
719 cccc xllat = bs(ij) - ((pvlat*1.25d0)*(bn(ij)-bs(ij)))
720 cccc else
721 c xllat = bs(ij) + (pvlat*(bn(ij)-bs(ij))) - 0.1d0
722 cccc xllat = bs(ij) - (pvlat*(bn(ij)-bs(ij))) - 0.1d0
723 cccc endif
724 c endif
725 
726 c - Make B/W Vector Plots of RMS'd data
727 
728 c - Latitude
729  if(nlat.ne.0)then
730  call bwplotvc('lat',gfnvsrddlat,bw,be,bs,bn,jm,b1,b2,maxplots,
731  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
732  * lorvoglats,lorvopc,igridsec,fn)
733  call bwplotvc('lat',gfnvmrddlat,bw,be,bs,bn,jm,b1,b2,maxplots,
734  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
735  * lorvoglatm,lorvopc,igridsec,fn)
736  endif
737 c - Longitude
738  if(nlon.ne.0)then
739  call bwplotvc('lon',gfnvsrddlon,bw,be,bs,bn,jm,b1,b2,maxplots,
740  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
741  * lorvoglons,lorvopc,igridsec,fn)
742  call bwplotvc('lon',gfnvmrddlon,bw,be,bs,bn,jm,b1,b2,maxplots,
743  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
744  * lorvoglonm,lorvopc,igridsec,fn)
745  endif
746 c - Ellipsoid height
747  if(neht.ne.0)then
748  call bwplotvc('eht',gfnvmrddeht,bw,be,bs,bn,jm,b1,b2,maxplots,
749  * olddtm,newdtm,region,'EHT',ij,xvlon,xvlat,xllon,xllat,
750  * lorvogehtm,lorvopc,igridsec,fn)
751  endif
752 c - Horizontal
753  if(nlon.ne.0 .and. nlat.ne.0)then
754  call bwplotvc('hor',gfnvsrddhor,bw,be,bs,bn,jm,b1,b2,maxplots,
755  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
756  * lorvoghors,lorvopc,igridsec,fn)
757  call bwplotvc('hor',gfnvmrddhor,bw,be,bs,bn,jm,b1,b2,maxplots,
758  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
759  * lorvoghorm,lorvopc,igridsec,fn)
760  endif
761 
762 c ------------------------------------------------
763 c - Color gridded data of RMS grids ("data noise")
764 c ------------------------------------------------
765 c - Make color plots of gridded, RMS'd data, with no
766 c - points.
767 
768  write(99,3101)
769  3101 format('echo Color Plots of RMS data...')
770 c - Latitude
771  if(nlat.ne.0)then
772  call coplot('lat',bfnvsrddlat,bw,be,bs,bn,jm,b1,b2,maxplots,
773  * olddtm,newdtm,region,'LAT',ij,cptlolats,cpthilats,cptinlats,
774  * suffix2t09,igridsec,fn)
775  call coplot('lat',bfnvmrddlat,bw,be,bs,bn,jm,b1,b2,maxplots,
776  * olddtm,newdtm,region,'LAT',ij,cptlolatm,cpthilatm,cptinlatm,
777  * suffix2t09,igridsec,fn)
778  endif
779 c - Longitude
780  if(nlon.ne.0)then
781  call coplot('lon',bfnvsrddlon,bw,be,bs,bn,jm,b1,b2,maxplots,
782  * olddtm,newdtm,region,'LON',ij,cptlolons,cpthilons,cptinlons,
783  * suffix2t09,igridsec,fn)
784  call coplot('lon',bfnvmrddlon,bw,be,bs,bn,jm,b1,b2,maxplots,
785  * olddtm,newdtm,region,'LON',ij,cptlolonm,cpthilonm,cptinlonm,
786  * suffix2t09,igridsec,fn)
787  endif
788 c - Ellipsoid Height
789  if(neht.ne.0)then
790  call coplot('eht',bfnvmrddeht,bw,be,bs,bn,jm,b1,b2,maxplots,
791  * olddtm,newdtm,region,'EHT',ij,cptloehtm,cpthiehtm,cptinehtm,
792  * suffix2t09,igridsec,fn)
793  endif
794 
795 c ------------------------------------------------
796 c - Color gridded data of "Total Error" grids
797 c ------------------------------------------------
798 
799  write(99,3102)
800  3102 format('echo Color Plots of Total Error grids...')
801 c - Latitude
802  if(nlat.ne.0)then
803  call coplot('lat',bfnvsetelat,bw,be,bs,bn,jm,b1,b2,maxplots,
804  * olddtm,newdtm,region,'LAT',ij,cptlolatse,cpthilatse,
805  * cptinlatse,
806  * suffix2,igridsec,fn)
807  call coplot('lat',bfnvmetelat,bw,be,bs,bn,jm,b1,b2,maxplots,
808  * olddtm,newdtm,region,'LAT',ij,cptlolatme,cpthilatme,
809  * cptinlatme,
810  * suffix2,igridsec,fn)
811  endif
812 c - Longitude
813  if(nlon.ne.0)then
814  call coplot('lon',bfnvsetelon,bw,be,bs,bn,jm,b1,b2,maxplots,
815  * olddtm,newdtm,region,'LON',ij,cptlolonse,cpthilonse,
816  * cptinlonse,
817  * suffix2,igridsec,fn)
818  call coplot('lon',bfnvmetelon,bw,be,bs,bn,jm,b1,b2,maxplots,
819  * olddtm,newdtm,region,'LON',ij,cptlolonme,cpthilonme,
820  * cptinlonme,
821  * suffix2,igridsec,fn)
822  endif
823 c - Ellipsoid Height
824  if(neht.ne.0)then
825  call coplot('eht',bfnvmeteeht,bw,be,bs,bn,jm,b1,b2,maxplots,
826  * olddtm,newdtm,region,'EHT',ij,cptloehtme,cpthiehtme,
827  * cptinehtme,
828  * suffix2,igridsec,fn)
829  endif
830 
831  2001 continue
832  990 format(
833  *'# ------------------------------',/,
834  *'# Plots for region: ',a,', sub-region: ',a,/,
835  *'# ------------------------------',/,
836  *'echo Creating plots for region: ',a,', sub-region: ',a)
837 
838  write(99,1031)trim(gmtfile)
839  1031 format('echo END batch file ',a)
840  close(99)
841 
842  write(6,9999)
843  9999 format('END program makeplotfiles03.f')
844 
845  end
846 c
847 c ----------------------------------------------------
848 c
849  include 'Subs/getmapbounds.f'
850  include 'Subs/getmag.f'
851  include 'Subs/coplot.f'
852  include 'Subs/bwplotvc.f'
853  include 'Subs/bwplotcv.f'
854  include 'Subs/plotcoast.f'
855  include 'Subs/onzd2.f'
856  include 'Subs/gridstats.f'
857  include 'Subs/cpt2.f'
858  include 'Subs/select2_mod.for'
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:37
subroutine cpt2(med, csm, xlo, xhi, xin)
This subroutine generates the color pallette variables for a GMT color plot.
Definition: cpt2.f:25
program makeplotfiles03
Part of the NADCON5 process, generates gmtbat06
real *8 function onzd2(x)
Function to round a digit to one significant figure (one non zero digit), double precision.
Definition: onzd2.f:36
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:74
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:77
subroutine gridstats(fname, ave, std, med)
Subroutine to print grid statistics to stdout.
Definition: gridstats.f:14
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:30