NADCON5-ng  0.0.1
NADCON5 Next Generation
makeplotfiles01.f
Go to the documentation of this file.
1 c> \ingroup doers
2 c> Part of the NADCON5 process, generates gmtbat01
3 c>
4 c> Program to take a "work" file and create
5 c> a variety of GMT-ready data files of the following
6 c> 1. Coverage in latitude
7 c> 2. Coverage in longitude
8 c> 3. Coverage in ellipsoid height
9 c> 4. Vectors in latitude
10 c> 5. Vectors in longitude
11 c> 6. Vectors in ellipdoid height
12 c> 7. Vectors in horizontal (properly azimuthed)
13 c>
14 c> It furthermore will create batch file to run the
15 c> GMT scripts:
16 c>
17 c> gmtbat01.(olddtm).(newdtm).(region).(mapflag)
18 c>
19 c> ### Program arguments
20 c> Arguments are newline terminated and read from standard input
21 c>
22 c> They are enumerated here
23 c> \param oldtm Source Datum
24 c> \param newdtm Target Datum,region
25 c> \param region Conversion Region
26 c> \param mapflag Map Detail Level
27 c>
28 c> Example:
29 c>
30 c> olddatum = 'ussd'
31 c> newdatum = 'nad27'
32 c> region = 'conus'
33 c> mapflag = 0
34 c>
35 c> ### Program Inputs:
36 c>
37 c> ## Changelog
38 c>
39 c> ### 2016 08 26
40 c> Added new code to do reference vectors consistently
41 c> See DRU-12, p. 56-57
42 c> Also changing the call to "getmapbounds" to give it "olddatum" and "newdatum"
43 c> to aide in filtering out things like the Saint regions in Alaska
44 c> for unsupported transformations.
45 c>
46 c> ### 2016 07 29:
47 c> Scrapped the code for personalized reference vector location. Just put
48 c> all ref vectors outside/below plot.
49 c>
50 c> ### 2016 07 21:
51 c> Added code to allow for optional placement of reference vectors, coming from
52 c> "map.parameters" as read in subroutine "getmapbounds"
53 c>
55  implicit double precision(a-h,o-z)
56  parameter(maxplots=60)
57 
58 c - Stuff that is in the work file records:
59  character*6 pid
60  character*2 state
61  character*1 rejlat,rejlon,rejeht
62  real*8 xlath,xlonh,xehth
63  real*8 dlatsec,dlonsec,dehtm,dhorsec,azhor
64  real*8 dlatm,dlonm,dhorm
65  character*10 olddtm,newdtm,region
66 
67 c - Input work file:
68  character*200 wfname
69 
70 c - Plot/Scale stuff
71  real*8 lorvopc
72  real*8 lorvoghorm,lorvoghors
73  real*8 lorvogehtm
74 
75 c - Output GMT-ready files:
76 c - Coverage, All, Coordinate Differences
77  character*200 gfncvacdlat
78  character*200 gfncvacdlon
79  character*200 gfncvacdeht
80 
81 c - Vectors, All, Coordinate Differences, Meters
82  character*200 gfnvmacdlat
83  character*200 gfnvmacdlon
84  character*200 gfnvmacdeht
85  character*200 gfnvmacdhor
86 
87 c - Vectors, All, Coordinate Differences, ArcSeconds
88  character*200 gfnvsacdlat
89  character*200 gfnvsacdlon
90  character*200 gfnvsacdhor
91 
92 c - GMT stuff
93  real*8 bw(maxplots),be(maxplots),bs(maxplots),bn(maxplots)
94  real*4 jm(maxplots)
95  real*4 b1(maxplots),b2(maxplots)
96  character*10 fn(maxplots)
97 c - 2016 07 21:
98  logical lrv(maxplots)
99  real*8 rv0x(maxplots),rv0y(maxplots),rl0y(maxplots)
100 
101 c - Output GMT-batch file:
102  character*200 gmtfile
103 
104  character*1 mapflag
105  character*200 suffix1,suffix4
106 
107 c ------------------------------------------------------------------
108 c - BEGIN PROGRAM
109 c ------------------------------------------------------------------
110  write(6,1001)
111  1001 format('BEGIN makeplotfiles01.f')
112 
113 c--------------------------------------------
114 c - Some necessary constants
115 c
116 c - "lorvopc" = Length of Reference Vector on Paper in **CM**
117 c - *** CRITICAL: The units of centimeters align with
118 c - the use, in .gmtdefaults4, of:
119 c - MEASURE_UNIT = cm
120 c - If you change that value, then the units of lorvopc
121 c - will be whatever you change it too, which may prove
122 c - displeasing.
123 c -
124 c--------------------------------------------
125  lorvopc = 1.d0
126  pi = 2.d0*dasin(1.d0)
127  d2r = pi/180.d0
128  re = 6371000.d0
129 
130  multiplierlorvog = 2
131 
132 c--------------------------------------------
133 c - User-supplied input
134 c--------------------------------------------
135  read(5,'(a)')olddtm
136  read(5,'(a)')newdtm
137  read(5,'(a)')region
138  read(5,'(a)')mapflag
139 
140 c ------------------------------------------------------------------
141 c - Generate the suffixes used in all our files
142 c ------------------------------------------------------------------
143  suffix1=trim(olddtm)//'.'//trim(newdtm)//'.'//trim(region)
144  suffix4=trim(suffix1)//'.'//trim(mapflag)
145 
146 c ------------------------------------------------------------------
147 c - Create and open the work file
148 c ------------------------------------------------------------------
149  wfname='work.'//trim(suffix1)
150  open(1,file='Work/'//wfname,status='old',form='formatted')
151  write(6,1004)trim(wfname)
152  1004 format(6x,'makeplotfiles01.f: Opening work file ',a)
153 
154 c ------------------------------------------------------------------
155 c - Open the GMT batch file for plotting
156 c ------------------------------------------------------------------
157  gmtfile = 'gmtbat01.'//trim(suffix4)
158  open(99,file=gmtfile,status='new',form='formatted')
159  write(6,1011)trim(gmtfile)
160  1011 format(6x,'makeplotfiles01.f: Creating GMT batch file ',a)
161  write(99,1030)trim(gmtfile)
162  1030 format('echo BEGIN batch file ',a)
163 
164 
165 c ------------------------------------------------------------------
166 c - Open the output GMT-ready files
167 c ------------------------------------------------------------------
168  gfncvacdlat = 'cvacdlat.'//trim(suffix1)
169  open(11,file=gfncvacdlat,status='new',form='formatted')
170  write(6,1010)trim(gfncvacdlat)
171 
172  gfncvacdlon = 'cvacdlon.'//trim(suffix1)
173  open(12,file=gfncvacdlon,status='new',form='formatted')
174  write(6,1010)trim(gfncvacdlon)
175 
176  gfncvacdeht = 'cvacdeht.'//trim(suffix1)
177  open(13,file=gfncvacdeht,status='new',form='formatted')
178  write(6,1010)trim(gfncvacdeht)
179 
180 c - Vectors, Meters, All, Coordinate Differences
181  gfnvmacdlat = 'vmacdlat.'//trim(suffix1)
182  open(21,file=gfnvmacdlat,status='new',form='formatted')
183  write(6,1010)trim(gfnvmacdlat)
184 
185  gfnvmacdlon = 'vmacdlon.'//trim(suffix1)
186  open(22,file=gfnvmacdlon,status='new',form='formatted')
187  write(6,1010)trim(gfnvmacdlon)
188 
189  gfnvmacdeht = 'vmacdeht.'//trim(suffix1)
190  open(23,file=gfnvmacdeht,status='new',form='formatted')
191  write(6,1010)trim(gfnvmacdeht)
192 
193  gfnvmacdhor = 'vmacdhor.'//trim(suffix1)
194  open(24,file=gfnvmacdhor,status='new',form='formatted')
195  write(6,1010)trim(gfnvmacdhor)
196 
197 c - Vectors, ArcSeconds, All, Coordinate Differences
198  gfnvsacdlat = 'vsacdlat.'//trim(suffix1)
199  open(31,file=gfnvsacdlat,status='new',form='formatted')
200  write(6,1010)trim(gfnvsacdlat)
201 
202  gfnvsacdlon = 'vsacdlon.'//trim(suffix1)
203  open(32,file=gfnvsacdlon,status='new',form='formatted')
204  write(6,1010)trim(gfnvsacdlon)
205 
206  gfnvsacdhor = 'vsacdhor.'//trim(suffix1)
207  open(34,file=gfnvsacdhor,status='new',form='formatted')
208  write(6,1010)trim(gfnvsacdhor)
209 
210  1010 format(6x,'makeplotfiles01.f: Creating file ',a)
211 
212 c - LAZY CODING: Spin through work file, collecting stats
213 c - which we will use to scale the map and vectors, etc.
214 c - Then rewind the work file.
215 c - If I wasn't lazy, this would be a RAM-read, etc etc
216  ndhor = 0
217  ndeht = 0
218  avedhorm = 0.d0
219  avedhors = 0.d0
220  avedehtm = 0.d0
221 
222  891 read(1,104,end=892)pid,state,rejlat,rejlon,rejeht,
223  *xlath,xlonh,xehth,
224  *dlatsec,dlonsec,dehtm,dhorsec,azhor,dlatm,dlonm,dhorm,
225  *olddtm,newdtm
226  if(rejlat.eq.' ' .and. rejlon.eq.' ')then
227  avedhorm = avedhorm + dhorm
228  avedhors = avedhors + dhorsec
229  ndhor = ndhor + 1
230  endif
231  if(rejeht.eq.' ')then
232 c - Because they can be +/-, we and this is JUST for scaling the map,
233 c - we want the average MAGNITUDE...use ABS. This means that
234 c - I don't need to accept my own latter advice of returning
235 c - here and using RMS.
236  avedehtm = avedehtm + dabs(dehtm)
237  ndeht = ndeht + 1
238  endif
239  goto 891
240  892 continue
241  if(ndhor.gt.0)then
242  avedhorm = avedhorm / dble(ndhor)
243  avedhors = avedhors / dble(ndhor)
244  else
245  avedhorm = 0.d0
246  avedhors = 0.d0
247  endif
248  if(ndeht.gt.0)then
249  avedehtm = avedehtm / dble(ndeht)
250  else
251  avedehtm = 0.d0
252  endif
253  write(6,893)ndhor,avedhorm,avedhors,ndeht,avedehtm
254  893 format(6x,'makeplotfiles01.f: Vector Stats: ',/,
255  *10x,'Number of Good Horizontal Vectors : ',i10,/,
256  *10x,'Average length (meters) : ',f10.3,/,
257  *10x,'Average length (arcseconds) : ',f10.6,/,
258  *10x,'Number of Good Ell. Ht. Vectors : ',i10,/,
259  *10x,'Average length (meters) : ',f10.3)
260 
261 c - END OF LAZY CODING
262 
263 
264 c --------------------------------------------------------------
265 c - GMT Batch file: Determine Number of areas to plot (=nplots)
266 c - and Boundaries of plots and other stuff
267 c --------------------------------------------------------------
268 c - 2016 08 29:
269  call getmapbounds(mapflag,maxplots,region,nplots,
270  *olddtm,newdtm,
271  *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y,rl0y)
272 
273 c - 2016 08 26, DRU-12, p.56-57
274 c call getmapbounds(mapflag,maxplots,region,nplots,
275 c *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y,rl0y)
276 c - See DRU-11, p. 126 for choices on grid boundaries for NADCON v5.0
277 c - 2016 07 21:
278 c call getmapbounds(mapflag,maxplots,region,nplots,
279 c *bw,be,bs,bn,jm,b1,b2,fn,lrv,rv0x,rv0y)
280 c call getmapbounds(mapflag,maxplots,region,nplots,
281 c *bw,be,bs,bn,jm,b1,b2,fn)
282  write(6,1006)trim(region)
283  1006 format(6x,'makeplotfiles01.f: Calling getmapbounds for region ',a)
284 
285 c ---------------------------------------------------------------
286 c - Compute and report various things about our coverage
287 c - and vector plots.
288 c ---------------------------------------------------------------
289 c - Reference vector set to length of the average
290 c - absolute value of horizontal or ell ht shift.
291 
292 c - I keep flip-flopping about whether it's more visually
293 c - pleasing to use the average or twice the average.
294 
295 c - As of 2015 10 22, I go with "twice the average"
296 c - Thus: MultiplierLorvog = 2
297 
298 c - Note "gm2pc" = "ground meters to paper centimeters"
299 c - "gs2pc" = "ground arcseconds to paper centimeters"
300 c - "lorvog*s" = "length of reference vector on ground (element) in arcseconds"
301 c - "lorvog*m" = "length of reference vector on ground (element) in meters"
302 
303  if(ndhor.ne.0)then
304 c iqhorm = floor(log10(avedhorm))
305 c qqhorm = 10.d0**(iqhorm-1)
306 c lorvoghorm = MultiplierLorvog*qqhorm*nint(avedhorm/qqhorm)
307  lorvoghorm = onzd2(multiplierlorvog*avedhorm)
308  gm2pchor = lorvopc / lorvoghorm
309 
310 c iqhors = floor(log10(avedhors))
311 c qqhors = 10.d0**(iqhors-1)
312 c lorvoghors = MultiplierLorvog*qqhors*nint(avedhors/qqhors)
313  lorvoghors = onzd2(multiplierlorvog*avedhors)
314  gs2pchor = lorvopc / lorvoghors
315  endif
316 
317  if(ndeht.ne.0)then
318 c iqehtm = floor(log10(avedehtm))
319 c qqehtm = 10.d0**(iqehtm-1)
320 c lorvogehtm = MultiplierLorvog*qqehtm*nint(avedehtm/qqehtm)
321  lorvogehtm = onzd2(multiplierlorvog*avedehtm)
322  gm2pceht = lorvopc / lorvogehtm
323  endif
324 
325  write(6,894)nplots
326  894 format(6x,'makeplotfiles01.f: Info about plots:',/,
327  *8x,'Number of sub-region plot sets ',
328  *'being made for this region: ',i2)
329 
330  do 895 i=1,nplots
331  dns = bn(i) - bs(i)
332  dew = be(i) - bw(i)
333  write(6,896)i,region,fn(i),
334  * bs(i),bn(i),bw(i),be(i),dns,dew
335  if(ndhor.ne.0)then
336  write(6,897)lorvoghorm,lorvoghors,gm2pchor,gs2pchor
337  else
338  write(6,898)
339  endif
340 
341  if(ndeht.ne.0)then
342  write(6,899)lorvogehtm,gm2pceht
343  else
344  write(6,900)
345  endif
346 
347  895 continue
348 
349  896 format(50('-'),/,
350  *8x,'Plot # ',i2,
351  *'(',a,1x,a,')',/,
352  *10x,'S/N/W/E/N-S/E-W = ',6f7.1)
353  897 format(
354  *10x,'Lat/Lon/Hor plots: ',/,
355  *12x,'Reference Vector ( m) = ',f10.2,/,
356  *12x,'Reference Vector ( s) = ',f10.6,/,
357  *12x,'Ground M to Paper cm = ',f20.10,/,
358  *12x,'Ground S to Paper cm = ',f20.10)
359  898 format(
360  *10x,'Lat/Lon/Hor plots: ',/,
361  *12x,'No horizontal data available for plotting')
362  899 format(
363  *10x,'Ell. Height plots: ',/,
364  *12x,'Reference Vector ( m) = ',f10.2,/,
365  *12x,'Ground M to Paper cm = ',f20.10)
366  900 format(
367  *10x,'Ell. Height plots: ',/,
368  *12x,'No ellipsoid height data available for plotting')
369 
370 c - pvlon and pvlat are the percentage of the total lon/lat
371 c - span of the plot, from which the reference vector
372 c - begins, starting with the Lower Left corner
373  pvlon = 10.d0
374  pvlat = 10.d0
375 
376  pvlat = (pvlat / 100.d0)
377  pvlon = (pvlon / 100.d0)
378 
379 c --------------------------------------------------------------
380 c --------------------------------------------------------------
381 c --------------------------------------------------------------
382 c - MAIN LOOP: TOP
383 c --------------------------------------------------------------
384 c --------------------------------------------------------------
385 c --------------------------------------------------------------
386 c - Read in each record and produce GMT-ready data for
387 c - all appropriate non-rejected records.
388 
389  rewind(1)
390 
391  n=0
392  ncvlat = 0
393  ncvlon = 0
394  ncveht = 0
395  nvclat = 0
396  nvclon = 0
397  nvceht = 0
398  nvchor = 0
399 
400  1 read(1,104,end=2)pid,state,rejlat,rejlon,rejeht,xlath,xlonh,xehth,
401  *dlatsec,dlonsec,dehtm,dhorsec,azhor,dlatm,dlonm,dhorm,
402  *olddtm,newdtm
403 
404  104 format(a6,1x,a2,a1,a1,a1,1x,f14.10,1x,f14.10,1x,f8.3,1x,
405  *f9.5,1x,f9.5,1x,f9.3,1x,f9.5,1x,f9.5,1x,f9.3,1x,f9.3,1x,f9.3,
406  *1x,a10,1x,a10)
407 
408 
409 c - Experiment
410  105 format(f16.10,1x,f15.10,1x,f6.2,1x,f12.2,1x,f5.1)
411  1105 format(f16.10,1x,f15.10,1x,f6.2,1x,a6)
412 
413 c1106 format(f16.10,1x,f15.10,1x,f6.2,1x,f12.2,1x,f5.1,1x,f9.5,1x,a6)
414  1106 format(f16.10,1x,f15.10,1x,f6.2,1x,f12.2,1x,f9.5,1x,f9.3,1x,a6)
415 
416 c---------------------------------------------------------------------
417 c - If it's a good latitude point, write to:
418 c 11) Latitude Coverage File
419 c 21) Latitude Vector (meters) File
420 c 31) Latitude Vector (seconds) File
421  if(rejlat.eq.' ')then
422  if(dlatm.le.0)then
423  az = 180.d0
424  else
425  az = 0.d0
426  endif
427  vclatm = dabs(dlatm *gm2pchor)
428  vclats = dabs(dlatsec*gs2pchor)
429  write(11,1105)xlonh,xlath,sngl(1.0),pid
430  write(21,1106)xlonh,xlath,az,vclatm,dlatsec,dlatm,pid
431  write(31,1106)xlonh,xlath,az,vclats,dlatsec,dlatm,pid
432  ncvlat = ncvlat + 1
433  nvclat = nvclat + 1
434  endif
435 c---------------------------------------------------------------------
436 c - If it's a good longitude point, write to:
437 c 12) Longitude Coverage File
438 c 22) Longitude Vector (meters) File
439 c 32) Longitude Vector (seconds) File
440  if(rejlon.eq.' ')then
441  if(dlonm.le.0)then
442  az = 270.d0
443  else
444  az = 90.d0
445  endif
446  vclonm = dabs(dlonm *gm2pchor)
447  vclons = dabs(dlonsec*gs2pchor)
448  write(12,1105)xlonh,xlath,sngl(1.0),pid
449  write(22,1106)xlonh,xlath,az,vclonm,dlonsec,dlonm,pid
450  write(32,1106)xlonh,xlath,az,vclons,dlonsec,dlonm,pid
451 
452  ncvlon = ncvlon + 1
453  nvclon = nvclon + 1
454  endif
455 c---------------------------------------------------------------------
456 c - If it's a good ell ht point, write to:
457 c 13) Ell Ht Coverage File
458 c 23) Ell Ht Vector (meters) File
459  if(rejeht.eq.' ')then
460  if(dehtm.le.0)then
461  az = 180.d0
462  else
463  az = 0.d0
464  endif
465  vcehtm = dabs(dehtm*gm2pceht)
466  write(13,1105)xlonh,xlath,sngl(1.0),pid
467  write(23,1106)xlonh,xlath,az,vcehtm,0.d0,dehtm,pid
468 
469  ncveht = ncveht + 1
470  nvceht = nvceht + 1
471  endif
472 c---------------------------------------------------------------------
473 c - If it's a good latitude *and* good longitude point, write to:
474 c 24) Horizontal Vector (meters) File
475 c 34) Horizontal Vector (seconds) File
476  if(rejlat.eq.' ' .and. rejlon.eq.' ')then
477 c - No need for "dabs", since its already applied
478  vchorm = dhorm *gm2pchor
479  vchors = dhorsec*gs2pchor
480  write(24,1106)xlonh,xlath,azhor,vchorm,dhorsec,dhorm,pid
481  write(34,1106)xlonh,xlath,azhor,vchors,dhorsec,dhorm,pid
482 
483  nvchor = nvchor + 1
484  endif
485 
486 c - Count total number of points read in the work file
487  n=n+1
488 
489 
490  goto 1
491 
492 c --------------------------------------------------------------
493 c --------------------------------------------------------------
494 c --------------------------------------------------------------
495 c - MAIN LOOP: BOTTOM
496 c --------------------------------------------------------------
497 c --------------------------------------------------------------
498 c --------------------------------------------------------------
499 
500  2 continue
501 
502  write(6,778)n,ncvlat,ncvlon,ncveht,nvclat,nvclon,nvceht,nvchor
503 
504  778 format(6x,'makeplotfiles01.f: Statistics: ',/,
505  *10x,'Number of total records read : ',i10,/,
506  *10x,'Number of lat coverage records prepared: ',i10,/,
507  *10x,'Number of lon coverage records prepared: ',i10,/,
508  *10x,'Number of eht coverage records prepared: ',i10,/,
509  *10x,'Number of lat vector records prepared: ',i10,/,
510  *10x,'Number of lon vector records prepared: ',i10,/,
511  *10x,'Number of eht vector records prepared: ',i10,/,
512  *10x,'Number of hor vector records prepared: ',i10)
513 
514 c --------------------------------------------------------------
515 c --------------------------------------------------------------
516 c --------------------------------------------------------------
517 c - CREATE GMT BATCH FILE
518 c - There are multiple steps here:
519 c - 1) Determine how many maps to make (for example, for
520 c CONUS its a little easier to look at things when
521 c broken down into a 3x3 tile over CONUS, rather than
522 c one large plot)
523 c - 2) Determine the boundaries of each map to be created
524 c - 3) Determine which shoreline (GMT-provided, or Dru's
525 c personally created detailed shorelines of certain
526 c areas)
527 c - 4) The title of each plot
528 c - 5) The size of each plot
529 c - 6) The file name to use for each plot
530 c -
531 c - As each decision is made, make the right calls to the batch
532 c - file.
533 c --------------------------------------------------------------
534 c --------------------------------------------------------------
535 c --------------------------------------------------------------
536  write(6,800)
537  800 format(6x,'makeplotfiles01.f: Preparing GMT batch file')
538 
539 c --------------------------------------------------------------
540 c - GMT Batch file: Make header
541 c --------------------------------------------------------------
542  write(6,801)
543  801 format(6x,'makeplotfiles01.f: GMT: Write header')
544 
545  write(99,901)
546  901 format('gmtset GRID_PEN_PRIMARY 0.25p,-')
547  write(99,902)
548 c 902 format('gmtset BASEMAP_TYPE fancy')
549  902 format('gmtset BASEMAP_TYPE fancy',/,
550  *'gmtset HEADER_FONT Helvetica',/,
551  *'gmtset HEADER_FONT_SIZE 12p',/,
552  *'gmtset HEADER_OFFSET 0.5c')
553 
554 
555  write(6,802)
556  802 format(6x,'makeplotfiles01.f: GMT: Num Plots Analysis')
557  write(6,1005)trim(region)
558  1005 format(6x,'makeplotfiles01.f: REGION = ',a)
559 
560 
561 c --------------------------------------------------------------
562 c --------------------------------------------------------------
563 c --------------------------------------------------------------
564 c - GMT Batch creation loop TOP
565 c --------------------------------------------------------------
566 c --------------------------------------------------------------
567 c --------------------------------------------------------------
568 c - For each "ij" value, we will put GMT calls into batch
569 c - file "gmtbat01***" (unit 99) which will plot the following:
570 c - 1) Coverage in LAT
571 c - 2) Coverage in LON
572 c - 3) Coverage in EHT
573 c - 4) Vectors in LAT, meters
574 c - 5) Vectors in LON, meters
575 c - 6) Vectors in EHT, meters
576 c - 7) Vectors in HOR, meters
577 c - 8) Vectors in LAT, arcseconds
578 c - 9) Vectors in LON, arcseconds
579 c - 10) Vectors in HOR, arcseconds
580 c --------------------------------------------------------------
581 c
582 c - Note on "igridsec": Later in the NADCON5 processing,
583 c - "igridsec" will mean the number of arcseconds at which
584 c - thinnging and gridding occur. At this point, though,
585 c - it has not meaning. We set it to "-1" to tell the
586 c - plotting programs to ignore it.
587 
588 
589  igridsec = -1
590 
591  do 2001 ij=1,nplots
592  write(99,990)trim(region),trim(fn(ij)),
593  * trim(region),trim(fn(ij))
594 
595 c--------------------------------------
596 c - B/W COVERAGE PLOTS
597 c--------------------------------------
598 c - Make B/W Coverage Plots
599 c - Latitude
600  call bwplotcv('lat',gfncvacdlat,bw,be,bs,bn,jm,
601  * b1,b2,maxplots,olddtm,newdtm,region,'LAT',ij,
602  * igridsec,fn)
603 c - Longitude
604  call bwplotcv('lon',gfncvacdlon,bw,be,bs,bn,jm,
605  * b1,b2,maxplots,olddtm,newdtm,region,'LON',ij,
606  * igridsec,fn)
607 c - Ellipsoid Height
608  call bwplotcv('eht',gfncvacdeht,bw,be,bs,bn,jm,
609  * b1,b2,maxplots,olddtm,newdtm,region,'EHT',ij,
610  * igridsec,fn)
611 
612 c--------------------------------------
613 c - VECTORS
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 - Vectors in LAT
655  call bwplotvc('lat',gfnvmacdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
656  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
657  * lorvoghorm,lorvopc,igridsec,fn)
658  call bwplotvc('lat',gfnvsacdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
659  * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,
660  * lorvoghors,lorvopc,igridsec,fn)
661 c call bwplotvc('lat',gfnvmacdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
662 c * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,ncmhor,
663 c * q1hor,igridsec,fn)
664 c call bwplotvc('lat',gfnvsacdlat,bw,be,bs,bn,jm,b1,b2,maxplots,
665 c * olddtm,newdtm,region,'LAT',ij,xvlon,xvlat,xllon,xllat,ncmhor,
666 c * q1hor,igridsec,fn)
667 
668 
669 c - Vectors in LON
670  call bwplotvc('lon',gfnvmacdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
671  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
672  * lorvoghorm,lorvopc,igridsec,fn)
673  call bwplotvc('lon',gfnvsacdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
674  * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,
675  * lorvoghors,lorvopc,igridsec,fn)
676 c call bwplotvc('lon',gfnvmacdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
677 c * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,ncmhor,
678 c * q1hor,igridsec,fn)
679 c call bwplotvc('lon',gfnvsacdlon,bw,be,bs,bn,jm,b1,b2,maxplots,
680 c * olddtm,newdtm,region,'LON',ij,xvlon,xvlat,xllon,xllat,ncmhor,
681 c * q1hor,igridsec,fn)
682 
683 c - Vectors in EHT
684  call bwplotvc('eht',gfnvmacdeht,bw,be,bs,bn,jm,b1,b2,maxplots,
685  * olddtm,newdtm,region,'EHT',ij,xvlon,xvlat,xllon,xllat,
686  * lorvogehtm,lorvopc,igridsec,fn)
687 c call bwplotvc('eht',gfnvmacdeht,bw,be,bs,bn,jm,b1,b2,maxplots,
688 c * olddtm,newdtm,region,'EHT',ij,xvlon,xvlat,xllon,xllat,ncmhor,
689 c * q1hor,igridsec,fn)
690 
691 c - Vectors in HOR
692  call bwplotvc('hor',gfnvmacdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
693  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
694  * lorvoghorm,lorvopc,igridsec,fn)
695  call bwplotvc('hor',gfnvsacdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
696  * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,
697  * lorvoghors,lorvopc,igridsec,fn)
698 c call bwplotvc('hor',gfnvmacdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
699 c * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,ncmhor,
700 c * q1hor,igridsec,fn)
701 c call bwplotvc('hor',gfnvsacdhor,bw,be,bs,bn,jm,b1,b2,maxplots,
702 c * olddtm,newdtm,region,'HOR',ij,xvlon,xvlat,xllon,xllat,ncmhor,
703 c * q1hor,igridsec,fn)
704 
705  2001 continue
706 
707 c --------------------------------------------------------------
708 c --------------------------------------------------------------
709 c --------------------------------------------------------------
710 c - GMT Batch creation loop BOTTOM
711 c --------------------------------------------------------------
712 c --------------------------------------------------------------
713 c --------------------------------------------------------------
714 
715  write(99,1031)trim(gmtfile)
716  1031 format('echo END batch file ',a)
717  close(99)
718 
719  write(6,9999)
720  9999 format('END makeplotfiles01.f')
721 
722 
723 
724  990 format(
725  *'# ------------------------------',/,
726  *'# Plots for region: ',a,', sub-region: ',a,/,
727  *'# ------------------------------',/,
728  *'echo Creating plots for region: ',a,', sub-region: ',a)
729 
730  end
731 c
732 c
733 c
734  include 'Subs/getmapbounds.f'
735  include 'Subs/plotcoast.f'
736  include 'Subs/bwplotcv.f'
737  include 'Subs/bwplotvc.f'
738  include 'Subs/onzd2.f'
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
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 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 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
program makeplotfiles01
Part of the NADCON5 process, generates gmtbat01.