NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fp04.f
Go to the documentation of this file.
1C> @file
2C> @brief Print array of data points at lat/lon points.
3C> @author J. Horodeck @date 1980-01-15
4
5C> Given an array of meteorological data and corresponding
6C> latitude/longitude position for each data point, these data
7C> values are printed at their approximate latitude/longitude
8C> positions on a polar stereographic projection.
9C>
10C> PROGRAM HISTORY LOG:
11C> - J. Horodeck 1980-01-15
12C> - Ralph Jones 1985-07-31 Change to cdc fortran 200
13C> - Ralph Jones 1990-08-15 Change to cray cft77 fortran
14C>
15C> @param[in] IFLD Real or integer fullword array of data points.
16C> @param[in] ALAT Real array of latitude positions (>0 for nh,
17C> <0 for sh) for the data to be plotted.
18C> @param[in] ALON Real array of longitudes (west of greenwich)
19C> @param[in] TITLE Integer size 10 alphanumeric array of
20C> characters for title to be written on printout.
21C> @param[in] IDIM Integer number of data values to plot (size of
22C> arrays ifld, alat and alon).
23C> @param[in] CMIL Real left side of grid - minimum coarse mesh
24C> i coordinate (minimum value of 1.0).
25C> @param[in] CMIR Real right side of grid - maximum coarse mesh
26C> i coordinate (maximum value of 65.0).
27C> @param[in] CMJB Real bottom of grid - minimum coarse mesh
28C> j coordinate (minimum value of 1.0).
29C> @param[in] CMJT Real top of grid - maximum coarse mesh j
30C> coordinate (maximum value of 65.0).
31C> @param[in] INUM Integer three digit number for the following:
32C> - Hundreds digit = type of data
33C> - 1 = Fixed point
34C> - 2 = Floating point
35C> - 3 = Alphanumeric
36C> - Tens digit = hemispheric reference
37C> - 0 = Northern hemisphere
38C> - 1 = Southern hemisphere
39C> - Units digit = number of characters to plot
40C> - Minimum = 1 character
41C> - Maximum = 4 characters
42C> @param[in] XFAC Real map scale factor (desired map scale = xfac
43C> * 1:30,000,000 (standard nmc 65x65 grid scale))
44C> @param[out] IERR Integer return code.
45C>
46C> @note Because this code could produce considerable output
47C> the subset of the nmc 65x65 grid which can be printed is a
48C> function of the map scale factor, e.g. for xfac=5 the maximum
49C> range of i and j is 27.0, for xfac=2 the range is 64.0.
50C>
51C> @author J. Horodeck @date 1980-01-15
52 SUBROUTINE w3fp04(IFLD,ALAT,ALON,TITLE,IDIM,CMIL,CMIR,
53 & CMJB,CMJT,INUM,XFAC,IERR)
54C
55 REAL ALAT(IDIM), ALON(IDIM)
56C
57 INTEGER IFLD(IDIM), TITLE(10)
58 INTEGER LINE(24), IL(17), IR(17), IJU(20), IJL(20)
59C
60 LOGICAL A
61C
62C
63 CHARACTER*1 KH(120,77), MEAN(4), KB, KM, KP, LC,
64 & kk(5,77,20), DATA(4), l1, l2, l3,
65 & ipole(4), kn, ks
66 CHARACTER*4 L24, L116
67 CHARACTER*8 IFMTT
68 CHARACTER*24 FMT1
69 CHARACTER*28 FMT2
70 CHARACTER*24 FMT4
71C
72 equivalence(mean(1),imean), (DATA(1),lfld)
73 equivalence(rfield,ifield)
74 equivalence(ifmtt,ifmt)
75C
76 DATA jjaa /116/
77 DATA jjbb / 77/
78 DATA fmt1 /"(6X, ('+',I , X),//) "/
79 DATA fmt2 /"(' +',I3,1X, A1,' +',I3) "/
80 DATA fmt4 /"(//, 6X, ('+',I , X))"/
81 DATA kb /' '/, km/'-'/, kp/'+'/, lc/'X'/
82 DATA l1/'1'/, l2/'2'/, l3/'3'/, l24/' 24'/, l116/' 116'/
83 DATA ipole/'P','O','L','E'/, kn/'N'/, ks/'S'/
84C
85 1001 FORMAT('1',16x,'PANEL #',i2,' OF ',i2,4x,10a8,/,/)
86 1003 FORMAT(6x,116a1)
87 2001 FORMAT(///,20x,'UPPER LEFT CORNER--LAT =',f6.2,' LON =',f7.2,'W'
88 & , 3x,'UPPER RIGHT CORNER--LAT =',f6.2,' LON =',f7.2,'W')
89 2002 FORMAT(20x,'LOWER LEFT CORNER--LAT =',f6.2,' LON =',f7.2,'W'
90 & , 3x,'LOWER RIGHT CORNER--LAT =',f6.2,' LON =',f7.2,'W')
91 2003 FORMAT(/,/, 16x, 'PANEL #', i2, ' OF ', i2, 4x, 10a8)
92 9001 FORMAT(/,5x,'CMIL = ',f8.1,' CMIR = ',f8.1,' HIGH AND LOW'
93 & ,' VALUES REVERSED......RETURN......')
94 9002 FORMAT(/,5x,'CMJB = ',f8.1,' CMJT = ',f8.1,' HIGH AND LOW'
95 & ,' VALUES REVERSED......RETURN......')
96 9003 FORMAT(/,5x,f8.1,' IS ILLEGAL VALUE FOR LOW I. IT IS NOW 1.0')
97 9004 FORMAT(/,5x,f8.1,' IS ILLEGAL VALUE FOR HIGH I. IT IS NOW 65.0')
98 9005 FORMAT(/,5x,f8.1,' IS ILLEGAL VALUE FOR LOW J. IT IS NOW 1.0')
99 9006 FORMAT(/,5x,f8.1,' IS ILLEGAL VALUE FOR HIGH J. IT IS NOW 65.0')
100 9007 FORMAT(/,5x,'REQUESTED NUMBER OF CHARACTERS TO PLOT(',i2,' )IS'
101 & ,' NOT ALLOWED. FOUR(4) IS MAXIMUM. THATS ALL YOU GET')
102 9008 FORMAT(/,5x,'REQUESTED SUBSET OF 65X65 GRID CANNOT CURRENTLY '
103 & ,'BE PLOTTED WITH MAP SCALE FACTOR',f5.1,/5x,'IF PLOT '
104 & ,'IS NECESSARY, CONTACT JOHN M. HORODECK,ESQ. NMC/DD'
105 & ,'/SEB FOR ASSISTANCE')
106 9009 FORMAT(/,5x,i4,' IS INVALID HEMISPHERIC REFERENCE'
107 & , '......RETURN......')
108 9010 FORMAT(/,5x,'HUNDREDS DIGIT OF INUM(INUM =',i4,') IS'
109 & , ' INVALID......RETURN......')
110C
111C TEST I,J VALUES FOR RANGE AND ORDER
112C
113 IF (cmir.GT.cmil) GO TO 1
114 ierr = 1
115 print 9001, cmil, cmir
116 RETURN
117 1 CONTINUE
118 IF (cmjt.GT.cmjb) GO TO 2
119 ierr = 1
120 print 9002, cmjb, cmjt
121 RETURN
122 2 CONTINUE
123 IF (cmil.GE.1.0) GO TO 3
124 print 9003, cmil
125 cmil = 1.0
126 3 CONTINUE
127 IF (cmir.LE.65.0) GO TO 4
128 print 9004, cmir
129 cmir = 65.0
130 4 CONTINUE
131 IF (cmjb.GE.1.0) GO TO 5
132 print 9005, cmjb
133 cmjb = 1.0
134 5 CONTINUE
135 IF (cmjt.LE.65.0) GO TO 6
136 print 9006, cmjt
137 cmjt = 65.0
138 6 CONTINUE
139C
140C CALCULATE VARIOUS LIMITS
141C
142 lnum = mod(inum,10)
143 nref = (mod(inum,100))/10
144C
145C TEST FOR INCORRECT ARGUMENTS PASSED
146C
147 IF (lnum.LE.4) GO TO 7
148 print 9007, lnum
149 lnum = 4
150 7 CONTINUE
151 IF (nref.LE.1) GO TO 8
152 ierr = 1
153 print 9009, nref
154 RETURN
155 8 CONTINUE
156 IF ((inum/100).LE.3) GO TO 81
157 ierr = 1
158 print 9010, inum
159 RETURN
160 81 CONTINUE
161C
162 lnump1 = lnum + 1
163 i1 = (cmil-1.0)*xfac + 1.0
164 i2 = (cmir-1.0)*xfac + 1.0
165 j1 = (cmjb-1.0)*xfac + 1.0
166 j2 = (cmjt-1.0)*xfac + 1.0
167C
168C WILL THIS PLOT BE TOO LARGE?
169C
170 IF (((i2-i1).LT.139).AND.((j2-j1).LT.139)) GO TO 9
171 ierr = 1
172 print 9008, xfac
173 RETURN
174 9 CONTINUE
175C
176 offi = i1 - 1
177 offj = j1 - 1
178 jja = (i2-i1)*5 + 1
179 jjb = (j2-j1)*4 + 1
180 jjam1 = jja - 1
181 jjbbm1 = jjbb - 1
182 jjaam1 = jjaa - 1
183 jjaapn = jjaa + lnum
184 ibegin = lnump1 + 1
185 ipage = (jjam1/jjaa) + 1
186 jpage = (jjb/jjbb) + 1
187 xmesh = 381.0/xfac
188 xip = 32.0*xfac + 1.0
189 xjp = 32.0*xfac + 1.0
190 iixip = (xip-offi)*5 - 4
191 jjxjp = (xjp-offj)*4 - 3
192C
193C PLOT DATA ONE PANEL AT A TIME IN SECTIONS
194C
195 DO 150 nx=1,ipage
196 a = .false.
197C
198C SET LIMITS OF I TO BE PRINTED
199C
200 il(nx) = i1 + (23*(nx-1))
201 IF (nx.NE.ipage) ir(nx) = i1 + (23*nx)
202 IF (nx.EQ.ipage) ir(nx) = i2
203 imax = ir(nx) - offi
204 imin = il(nx) - offi
205 m = 0
206C
207C FILL ARRAY WITH VALUES OF I TO BE PRINTED AT TOP OF PAGE
208C
209 DO 10 i = imin,imax
210 m = m + 1
211 line(m) = i
212 10 CONTINUE
213C
214C CALCULATE WIDTH OF PANEL IN INTEGERS AND
215C CHARACTERS FROM WHICH DETERMINE FORMAT
216C FIELD COUNT AND CONVERT BINARY TO ASCII
217C
218C PRINT TOP LINE OF I
219C
220 la = (imax-imin) + 1
221 mmm = (la*5) - 4
222 IF (la.EQ.24) GO TO 13
223 CALL w3ai15(la,ifmt,1,4,kp)
224 fmt1(5:8) = ifmtt(1:4)
225 fmt4(9:12) = ifmtt(1:4)
226 CALL w3ai15(mmm,ifmt,1,4,kp)
227 fmt2(13:16) = ifmtt(1:4)
228 GO TO 16
229 13 CONTINUE
230 fmt1(5:8) = l24
231 fmt2(13:16) = l116
232 fmt4(9:12) = l24
233 16 CONTINUE
234 IF (la.LT.100) GO TO 19
235 fmt1(15:15) = l3
236 fmt1(17:17) = l1
237 fmt4(19:19) = l3
238 fmt4(21:21) = l1
239 GO TO 22
240 19 CONTINUE
241 fmt1(15:15) = l2
242 fmt1(17:17) = l2
243 fmt4(19:19) = l2
244 fmt4(21:21) = l2
245 22 CONTINUE
246 print 1001, nx, ipage, title
247 WRITE(6,fmt1) (line(n), n=1,la)
248C
249C PREPARE TO PRINT SECTIONS OF EACH PANEL
250C
251 DO 140 jnx=1,jpage
252C
253C SET LIMITS OF J TO BE PRINTED
254C
255 iju(jnx) = j2 - (19*(jnx-1))
256 IF (jnx.NE.jpage) ijl(jnx) = j2 - (19*jnx)
257 IF (jnx.EQ.jpage) ijl(jnx) = j1
258 jmax = iju(jnx) - offj
259 jmin = ijl(jnx) - offj
260 ju = jjb - (4*jmax-3)
261 jl = jjb - (4*jmin-3)
262 nnn = (jmax-jmin)*4 + 1
263C
264C FILL CHARACTER ARRAY WITH BLANKS AND PUT X MARKERS IN CORNERS
265C IF FIRST PANEL BLANK ENTIRE AREA,
266C OTHERWISE TRANSFER FIRST INUM I BYTES TO LARGE ARRAY
267C AND BLANK REMAINING ARRAY
268C
269 DO 37 j=1,jjbb
270 IF (nx.NE.1) GO TO 31
271 DO 28 i=1,jjaapn
272 kh(i,j) = kb
273 28 CONTINUE
274 GO TO 37
275 31 CONTINUE
276 DO 32 i=1,lnump1
277 kh(i,j) = kk(i,j,jnx)
278 32 CONTINUE
279 DO 34 i=ibegin,jjaapn
280 kh(i,j) = kb
281 34 CONTINUE
282 37 CONTINUE
283 IF (jnx.NE.1) GO TO 40
284 kh(1,jjbb) = lc
285 kh(mmm,jjbb) = lc
286 200 CONTINUE
287 40 CONTINUE
288 IF (jnx.NE.jpage) GO TO 50
289 kh(1,1) = lc
290 kh(mmm,1) = lc
291 50 CONTINUE
292C
293C LOOP TO PUT DATA IN CHARACTER ARRAY
294C
295 DO 110 i=1,idim
296C
297C TEST FOR BAD GEOGRAPHY
298C
299 IF ((abs(alat(i)).GT.90.).OR.(alon(i).LT.0.0).OR.(alon
300 a (i).GT.360.0)) GO TO 90
301C
302C CHANGE LAT,LON TO I,J
303C
304 IF (nref.EQ.0) GO TO 51
305 CALL w3fb04(alat(i),alon(i),-xmesh,260.0,deli,delj)
306 GO TO 52
307 51 CONTINUE
308 CALL w3fb04(alat(i),alon(i),xmesh,80.0,deli,delj)
309 52 CONTINUE
310 xi = xip + deli
311 xj = xjp + delj
312C
313C POSITION I,J COORDINATES IN CHARACTER ARRAY AND TEST
314C IF VALUES RETURNED ARE WITHIN LIMITS OF MAP AND WITHIN SECTIONS
315C
316 ii = 1.0 + (xi-offi-0.9001)*5.0
317 jj = 1.0 + (xj-offj-0.8751)*4.0
318 iw = (jjaam1*(nx-1)) + 1
319 ix = (jjaam1*nx) + 1
320 iy = jjb - (jjbbm1*(jnx-1))
321 IF (jnx.NE.jpage) iz = jjb - (jjbbm1*jnx)
322 IF (jnx.EQ.jpage) iz = 1
323 IF ((ii.LT.1).OR.(ii.GT.jja)) GO TO 100
324 IF ((jj.LT.1).OR.(jj.GT.jjb)) GO TO 100
325 IF ((ii.LT.iw).OR.(ii.GT.ix)) GO TO 100
326 IF ((jj.GT.iy).OR.(jj.LT.iz)) GO TO 100
327C
328C WRITE N+POLE IF IN THIS SECTION
329C
330 IF (.NOT.((iixip.GE.iw.AND.iixip.LE.ix).AND.
331 a (jjxjp.LE.iy.AND.jjxjp.GE.iz))) GO TO 56
332 iixxp = iixip - (jjaam1*(nx-1))
333 jjxxp = jjxjp - (iz-1)
334 IF (nref.EQ.0) kh(iixxp-1,jjxxp) = kn
335 IF (nref.EQ.1) kh(iixxp-1,jjxxp) = ks
336 kh(iixxp,jjxxp) = kp
337 DO 53 l=1,4
338 kh(iixxp+l,jjxxp) = ipole(l)
339 53 CONTINUE
340 56 CONTINUE
341C
342C CONVERT CHARACTER ARRAY COORDINATES FROM
343C TOTAL MAP VALUES TO SECTION VALUES
344C
345 ii = ii - (jjaam1*(nx-1))
346 IF (jnx.NE.jpage) jj = jj - (iz-1)
347C
348C IF SPACE IS OCCUPIED SKIP THIS STATION
349C
350 jnum = lnum + 1
351 DO 70 ik=1,jnum
352 in = ik - 1
353 IF (kh(ii+in,jj).EQ.kb) GO TO 60
354 GO TO 110
355 60 CONTINUE
356 70 CONTINUE
357C
358C PLACE VALUE TO BE PLOTTED IN CHARACTER ARRAY
359C
360 ifield = ifld(i)
361C
362C TEST FOR TYPE OF DATA
363C
364 IF ((inum/100).EQ.3) GO TO 82
365 IF ((inum/100).EQ.1) GO TO 73
366 jfld = rfield
367 GO TO 76
368 73 CONTINUE
369 jfld = ifield
370 76 CONTINUE
371C
372C IF ORIGINALLY FIXED POINT OR HAS BEEN CONVERTED
373C FROM FLOATING POINT TO FIXED POINT
374C
375 IF ((jfld/10000).GE.1) jfld = mod(jfld,10000)
376 iiabs = iabs(jfld)
377 CALL w3ai15(iiabs,imean,1,lnum,kp)
378 IF (jfld.LT.0) kh(ii,jj) = km
379 IF (jfld.GE.0) kh(ii,jj) = kp
380 DO 79 ia=1,lnum
381 kh(ii+ia,jj) = mean(ia)
382 79 CONTINUE
383 GO TO 110
384 82 CONTINUE
385C
386C FOR ALPHANUMERIC DATA
387C
388 lfld = ifld(i)
389 kh(ii,jj) = kp
390 DO 85 iq=1,lnum
391 kh(ii+iq,jj) = DATA(iq)
392 85 CONTINUE
393 90 CONTINUE
394 100 CONTINUE
395 110 CONTINUE
396 jjn = 0
397C
398C PRINT JTH ROW AND VALUES OF J
399C
400 DO 130 j=ju,jl,4
401 jn = nnn - (4*jjn)
402 IF (a) GO TO 115
403 jx = (jjb-j)/4 + 1
404 WRITE(6,fmt2) jx, (kh(i,jn), i=1,mmm), jx
405 115 CONTINUE
406 jjn = jjn + 1
407 IF (jn.NE.1) GO TO 118
408C
409C SAVE LAST INUM BYTES OF I
410C
411 DO 117 l=1,jjbb
412 DO 116 i=116,jjaapn
413 ia = i - 115
414 kk(ia,l,jnx) = kh(i,l)
415 116 CONTINUE
416 117 CONTINUE
417 a = .true.
418 GO TO 140
419 118 CONTINUE
420 DO 120 im=1,3
421 jn = jn - 1
422 print 1003, (kh(i,jn), i=1,mmm)
423 120 CONTINUE
424 a = .false.
425 130 CONTINUE
426 140 CONTINUE
427 WRITE(6,fmt4) (line(n), n=1,la)
428C
429C CALCULATE AND PRINT LAT/LON AT CORNERS
430C
431 al = il(nx)
432 ar = ir(nx)
433 xi1 = ((al-1.0)/xfac + 1.0) - 33.0
434 xi2 = ((ar-1.0)/xfac + 1.0) - 33.0
435 xj1 = cmjb - 33.0
436 xj2 = cmjt - 33.0
437 IF (nref.EQ.0) GO TO 142
438 CALL w3fb05(xi1,xj1,-xmesh,260.0,alat1,alon1)
439 CALL w3fb05(xi1,xj2,-xmesh,260.0,alat2,alon2)
440 CALL w3fb05(xi2,xj2,-xmesh,260.0,alat3,alon3)
441 CALL w3fb05(xi2,xj1,-xmesh,260.0,alat4,alon4)
442 GO TO 144
443 142 CONTINUE
444 CALL w3fb05(xi1,xj1,xmesh,80.0,alat1,alon1)
445 CALL w3fb05(xi1,xj2,xmesh,80.0,alat2,alon2)
446 CALL w3fb05(xi2,xj2,xmesh,80.0,alat3,alon3)
447 CALL w3fb05(xi2,xj1,xmesh,80.0,alat4,alon4)
448 144 CONTINUE
449 print 2001, alat2, alon2, alat3, alon3
450 print 2002, alat1, alon1, alat4, alon4
451 print 2003, nx, ipage, title
452 150 CONTINUE
453 ierr = 0
454 RETURN
455 END
subroutine w3ai15(nbufa, nbufb, n1, n2, minus)
Converts a set of binary numbers to an equivalent set of ascii number fields in core.
Definition w3ai15.f:48
subroutine w3fb04(alat, along, xmeshl, orient, xi, xj)
Converts the coordinates of a location on earth from the natural coordinate system of latitude/longit...
Definition w3fb04.f:40
subroutine w3fb05(xi, xj, xmeshl, orient, alat, along)
Converts the coordinates of a location from the grid(i,j) coordinate system overlaid on the polar ste...
Definition w3fb05.f:40
subroutine w3fp04(ifld, alat, alon, title, idim, cmil, cmir, cmjb, cmjt, inum, xfac, ierr)
Given an array of meteorological data and corresponding latitude/longitude position for each data poi...
Definition w3fp04.f:54