NADCON5-ng  0.0.1
NADCON5 Next Generation
bwplotvc.f
Go to the documentation of this file.
1 c> \ingroup core
2 c> Subroutine to make GMT calls to do a B/W vector plot
3 c>
4 c> ## Changelog
5 c>
6 c> ### 2016 08 29:
7 c> Expanded the refence vector calls to be 6 decimal places, as well
8 c> as the initial -R call for S/N/W/E
9 c> and also the -B part of that call
10 c>
11 c> ### 2016 08 25:
12 c> `.gmtdefaults4` has been changed so X_ORIGIN is equal to 0.0
13 c> Center the plot with "-Xc" at first "psxy" call
14 c> Remove all "-JM**i+" references, and just use the actual
15 c> width (jm) that came out of the "getmapbounds" routine and
16 c> was sent here.
17 c>
18 c> ### 2016 07 29:
19 c> Updated the reference vector call to
20 c> have the "-N" option, so it'll plot outside the map
21 c>
22 c> ### 2016 07 21:
23 c> Modified use of JM command based on new forced sizes.
24 c>
25 c> ### 2015 02 15:
26 c> Updated to allow this subroutine to work
27 c> earlier (in makeplotfiles01()), before `igridsec` was defined.
28 c> See DRU-11, p. 139
29 c>
30  subroutine bwplotvc(ele,fname,bw,be,bs,bn,jm,b1,b2,maxplots,
31  *olddtm,newdtm,region,elecap,ij,xvlon,xvlat,xllon,xllat,lorvog,
32  *lorvopc,igridsec,fn)
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
285  end
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 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