NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3unpk77.f
Go to the documentation of this file.
1C> @file
2C> @brief Decodes single report from bufr messages
3C> @author Dennis Keyser @date 2002-03-05
4
5C> This subroutine decodes a single report from bufr messages
6C> in a jbufr-type data file. Currently wind profiler, nexrad (vad)
7C> wind and goes sounding/radiance data types are valid. Report is
8C> returned in quasi-office note 29 unpacked format (see remarks 4.).
9C>
10C> ### Program History Log:
11C> Date | Programmer | Comment
12C> -----|------------|--------
13C> 1996-12-16 | Dennis Keyser | Original author (based on w3lib routine w3fi77)
14C> 1997-06-02 | Dennis Keyser | Added nexrad (vad) wind data type
15C> 1997-06-16 | Dennis Keyser | Added goes sounding/radiance data type
16C> 1997-09-18 | Dennis Keyser | Added instrument data used in processing,
17C> solar zenith angle, and satellite zenith angle
18C> to list of parameters returned from goes
19C> sounding/radiance data type
20C> 1998-07-09 | Dennis Keyser | Modified wind profiler cat. 11 (height, horiz.
21C> significance, vert. significance) to account
22C> for updates to bufrtable mnemonics in /dcom;
23C> changed char. 6 of goes stnid to be unique for
24C> two different even or odd satellite id's
25C> (every other even or odd sat. id now gets same
26C> char. 6 tag)
27C> 1998-08-19 | Dennis Keyser | Subroutine now y2k and fortran 90 compliant
28C> 1999-03-16 | Dennis Keyser | Incorporated bob kistler's changes needed
29C> to port the code to the ibm sp
30C> 1999-05-17 | Dennis Keyser | Made changes necessary to port this routine to
31C> the ibm sp
32C> 1999-09-26 | Dennis Keyser | Changes to make code more portable
33C> 2002-03-05 | Dennis Keyser | Accounts for changes in input proflr (wind
34C> profiler) bufr dump file after 3/2002: cat. 10
35C> surface data now all missing (mnemonics "pmsl",
36C> "wdir1","wspd1", "tmdb", "rehu", "reqv" no
37C> longer available); cat. 11 mnemonics "acavh",
38C> "acavv", "spp0", and "nphl" no longer
39C> available; header mnemonic "npsm" is no longer
40C> available, header mnemonic "tpse" replaces
41C> "tpmi" (avg. time in minutes still output);
42C> number of upper-air levels incr. from 43 to up
43C> to 64 (size of output "rdata" array incr. from
44C> 600 to 1200 to account for this) (will still
45C> work properly for input proflr dump files prior
46C> to 3/2002)
47C>
48C> @param[in] IDATE 4-word array holding "central" date to process (yyyy, mm, dd, hh)
49C> @param[in] IHE Number of whole hours relative to "idate" for date of
50C> earliest bufr message that is to be decoded; earliest date is "idate" +
51C> "ihe" hours (if "ihe" is positive, latest message date is after "idate";
52C> if "ihe" is negative latest message date is prior to "idate") example:
53C> if ihe=1, then earliest date is 1-hr after idate; if ihe=-3, then earliest
54C> date is 3-hr prior to idate
55C> @param[in] IHL Number of whole hours relative to "idate" for date of
56C> latest bufr message that is to be decoded; latest date is "idate" + ("ihl"
57C> hours plus 59 min) if "ihl" is positive (latest message date is after
58C> "idate"), and "idate" + ("ihl"+1 hours minus 1 min) if "ihl" is negative
59C> (latest message date is prior to "idate") example: if ihl=3, then latest
60C> date is 3-hr 59-min after idate; if ihl=-2, then latest date is 1-hr 1-min
61C> prior to idate
62C> @param[in] LUNIT Fortran unit number for input data file
63C> @param[out] RDATA Single report returned an a quasi-office note 29 unpacked
64C> format (see remarks 4.) (minimum size is 1200 words)
65C> @param[inout] IRET [in] Controls degree of unit 6 printout (.ge. 0 -limited
66C> printout; = -1 some additional diagnostic printout; = .lt. -1 -extensive
67C> printout) (see remarks 3.)
68C> [out] Return code as follows:
69C> - IRET = 0 ---> Report successfully returned
70C> - IRET > 0 ---> No report returned due to:
71C> - = 1 ---> All reports read in, end
72C> - = 2 ---> Lat and/or lon data missing
73C> - = 3 ---> Reserved
74C> - = 4 ---> Some/all date information missing
75C> - = 5 ---> No data levels processed (all levels are missing)
76C> - = 6 ---> Number of levels in report header is not 1
77C> - = 7 ---> Number of levels in another single level sequence is not 1
78C>
79C> @remark
80C> - 1 A condition code (stop) of 15 will occur if the input
81C> dates for start and/or stop time are specified incorrectly.
82C> - 2 A condition code (stop) of 22 will occur if the
83C> characters on this machine are neither ascii nor ebcdic.
84C> - 3 The input argument "iret" should be set prior to each
85C> call to this subroutine.
86C>
87C> ***************************************************************
88C> 4)
89C> BELOW IS THE FORMAT OF AN UNPACKED REPORT IN OUTPUT ARRAY RDATA
90C> (EACH WORD REPRESENTS A FULL-WORD ACCORDING TO THE MACHINE)
91C> N O T E : THIS IS THE SAME FORMAT AS FOR W3LIB ROUTINE W3FI77
92C> EXCEPT WHERE NOTED
93C> ***************************************************************
94C>
95C> #### FORMAT FOR WIND PROFILER REPORTS
96C> WORD | CONTENT | UNIT | FORMAT
97C> ---- | --------------------- | ------------------- | ---------
98C> 1 | LATITUDE | 0.01 DEGREES | REAL
99C> 2 | LONGITUDE | 0.01 DEGREES WEST | REAL
100C> 3 | TIME SIGNIFICANCE | (BUFR CODE TABLE "0 08 021") | INTEGER
101C> 4 | OBSERVATION TIME | 0.01 HOURS (UTC) | REAL
102C> 5 | YEAR/MONTH | 4-CHAR. 'YYMM' LEFT-JUSTIFIED | CHARACTER
103C> 6 | DAY/HOUR | 4-CHARACTERS 'DDHH' | CHARACTER
104C> 7 | STATION ELEVATION | METERS | REAL
105C> 8 | SUBMODE/EDITION NO. | (SM X 10) + ED. NO. (ED. NO.=2, CONSTANT; SEE &,~) | INTEGER
106C> 9 | REPORT TYPE | 71 (CONSTANT) | INTEGER
107C> 10 | AVERAGING TIME | MINUTES (NEGATIVE MEANS PRIOR TO OBS. TIME) | INTEGER
108C> 11 | STN. ID. (FIRST 4 CHAR.) | 4-CHARACTERS LEFT-JUSTIFIED| CHARACTER
109C> 12 | STN. ID. (LAST 2 CHAR.) | 2-CHARACTERS LEFT-JUSTIFIED| CHARACTER
110C> 13-34 | ZEROED OUT - NOT USED | | INTEGER
111C> 35 | CATEGORY 10, NO. LEVELS | COUNT | INTEGER
112C> 36 | CATEGORY 10, DATA INDEX | COUNT | INTEGER
113C> 37 | CATEGORY 11, NO. LEVELS | COUNT | INTEGER
114C> 38 | CATEGORY 11, DATA INDEX | COUNT | INTEGER
115C> 39-42 | ZEROED OUT - NOT USED | | INTEGER
116C> 43-END | UNPACKED DATA GROUPS | (FOLLOWS) | REAL
117C>
118C> #### CATEGORY 10 - WIND PROFILER SFC DATA (EACH LEVEL, SEE WORD 35 ABOVE)
119C> WORD | PARAMETER | UNITS | FORMAT
120C> ---- | --------- | ----------------- | -------------
121C>(SEE @)1 | SEA-LEVEL PRESSURE | 0.1 MILLIBARS | REAL
122C>(SEE *)2 | STATION PRESSURE | 0.1 MILLIBARS | REAL
123C>(SEE @)3 | HORIZ. WIND DIR. | DEGREES | REAL
124C>(SEE @)4 | HORIZ. WIND SPEED | 0.1 M/S | REAL
125C>(SEE @)5 | AIR TEMPERATURE | 0.1 DEGREES K | REAL
126C>(SEE @)6 | RELATIVE HUMIDITY | PERCENT | REAL
127C>(SEE @)7 | RAINFALL RATE | 0.0000001 M/S | REAL
128C>
129C> #### CATEGORY 11 - WIND PROFILER UPPER-AIR DATA (FIRST LEVEL IS SURFACE) (EACH LEVEL, SEE WORD 37 ABOVE)
130C> WORD | PARAMETER | UNITS | FORMAT
131C> ---- | --------- | ----------------- | -------------
132C> 1 | HEIGHT ABOVE SEA-LVL | METERS | REAL
133C> 2 | HORIZ. WIND DIR. | DEGREES | REAL
134C> 3 | HORIZ. WIND SPEED | 0.1 M/S | REAL
135C> 4 | QUALITY CODE | (SEE %) | INTEGER
136C> 5 | VERT. WIND COMP. (W) | 0.01 M/S | REAL
137C>(SEE @)6 | HORIZ. CONSENSUS NO. | (SEE $) | INTEGER
138C>(SEE @)7 | VERT. CONSENSUS NO. | (SEE $) | INTEGER
139C>(SEE @)8 | SPECTRAL PEAK POWER | DB | REAL
140C> 9 | HORIZ. WIND SPEED | 0.1 M/S | REAL
141C> | STANDARD DEVIATION | 0.1 M/S | REAL
142C> 10 | VERT. WIND COMPONENT | 0.1 M/S | REAL
143C> | STANDARD DEVIATION | 0.1 M/S | REAL
144C>(SEE @)11 | MODE | (SEE #) | INTEGER
145C>
146C> ##### SEE:
147C> - *- ALWAYS MISSING
148C> - &- THIS IS A CHANGE FROM FORMAT IN W3LIB ROUTINE W3FI77
149C> - %- 0 - MEDIAN AND SHEAR CHECKS BOTH PASSED
150C> - 2 - MEDIAN AND SHEAR CHECK RESULTS INCONCLUSIVE
151C> - 4 - MEDIAN CHECK PASSED; SHEAR CHECK FAILED
152C> - 8 - MEDIAN CHECK FAILED; SHEAR CHECK PASSED
153C> - 12 - MEDIAN AND SHEAR CHECKS BOTH FAILED
154C> - $- NO. OF INDIVIDUAL 6-MINUTE AVERAGE MEASUREMENTS THAT WERE
155C> INCLUDED IN FINAL ESTIMATE OF AVERAGED WIND (RANGE: 0, 2-10)
156C> (BASED ON A ONE-HOUR AVERAGE)
157C> - #- 1 - DATA FROM LOW MODE
158C> 2 - DATA FROM HIGH MODE
159C> 3 - MISSING
160C> - @- THIS PARAMETER IS NO LONGER AVAILABLE AFTER 3/2002 AND IS SET
161C> TO MISSING (99999 FOR INTEGER OR 99999. FOR REAL)
162C> - ~- SUBMODE IS NO LONGER AVAILABLE AFTER 3/2002 AND IS SET TO 3
163C> (ITS MISSING VALUE)
164C>
165C>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
166C> FORMAT FOR GOES SOUNDING/RADIANCE REPORTS
167C>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
168C> HEADER
169C> WORD CONTENT UNIT FORMAT
170C> ---- ---------------------- ------------------- ---------
171C> 1 LATITUDE 0.01 DEGREES REAL
172C> 2 LONGITUDE 0.01 DEGREES WEST REAL
173C> 3 FIELD OF VIEW NUMBER NUMERIC INTEGER
174C> 4 OBSERVATION TIME 0.01 HOURS (UTC) REAL
175c>vvvvvdak port
176C> 5 YEAR/MONTH 4-CHAR. 'YYMM' CHARACTER
177c>aaaaadak port
178C> LEFT-JUSTIFIED
179C> 6 DAY/HOUR 4-CHARACTERS 'DDHH' CHARACTER
180C> 7 STATION ELEVATION METERS REAL
181C> 8 PROCESS. TECHNIQUE (=21-CLEAR; INTEGER
182C> 8 PROCESS. TECHNIQUE =23-CLOUD-CORRECTED)
183C> 9 REPORT TYPE 61 (CONSTANT) INTEGER
184C> 10 QUALITY FLAG (BUFR CODE TABLE "0 33 002") INTEGER
185C> 11 STN. ID. (FIRST 4 CHAR.) 4-CHARACTERS CHARACTER
186C> LEFT-JUSTIFIED
187C> 12 STN. ID. (LAST 2 CHAR.) 2-CHARACTERS CHARACTER
188C> LEFT-JUSTIFIED (SEE %)
189C>
190C> 13-26 ZEROED OUT - NOT USED
191C> 27 CATEGORY 08, NO. LEVELS COUNT INTEGER
192C> 28 CATEGORY 08, DATA INDEX COUNT INTEGER
193C> 29-38 ZEROED OUT - NOT USED
194C> 39 CATEGORY 12, NO. LEVELS COUNT INTEGER
195C> 40 CATEGORY 12, DATA INDEX COUNT INTEGER
196C> 41 CATEGORY 13, NO. LEVELS COUNT INTEGER
197C> 42 CATEGORY 13, DATA INDEX COUNT INTEGER
198C>
199C> 43-END UNPACKED DATA GROUPS (FOLLOWS) REAL
200C>
201C> CATEGORY 12 - SATELLITE SOUNDING LEVEL DATA (FIRST LEVEL IS SURFACE;
202C> EACH LEVEL, SEE 39 ABOVE)
203C> WORD PARAMETER UNITS FORMAT
204C> ---- --------- ----------------- -------------
205C> 1 PRESSURE 0.1 MILLIBARS REAL
206C> 2 GEOPOTENTIAL METERS REAL
207C> 3 TEMPERATURE 0.1 DEGREES C REAL
208C> 4 DEWPOINT TEMPERATURE 0.1 DEGREES C REAL
209C> 5 NOT USED SET TO MISSING REAL
210C> 6 NOT USED SET TO MISSING REAL
211C> 7 QUALITY MARKERS 4-CHARACTERS CHARACTER
212C> LEFT-JUSTIFIED (SEE &)
213C>
214C> CATEGORY 13 - SATELLITE RADIANCE "LEVEL" DATA (EACH "LEVEL", SEE
215C> 41 ABOVE)
216C> WORD PARAMETER UNITS FORMAT
217C> ---- --------- ----------------- -------------
218C> 1 CHANNEL NUMBER NUMERIC INTEGER
219C> 2 BRIGHTNESS TEMP. 0.01 DEG. KELVIN REAL
220C> 3 QUALITY MARKERS 4-CHARACTERS CHARACTER
221C> LEFT-JUSTIFIED (SEE &&)
222C>
223C> CATEGORY 08 - ADDITIONAL (MISCELLANEOUS) DATA (EACH LEVEL, SEE @
224C> BELOW)
225C> WORD PARAMETER UNITS FORMAT
226C> ---- --------- ----------------- -------------
227C> 1 VARIABLE SEE @ BELOW REAL
228C> 2 CODE FIGURE SEE @ BELOW REAL
229C> 3 MARKERS 2-CHARACTERS CHARACTER
230C> LEFT-JUSTIFIED (SEE #)
231C>
232C> %- SIXTH CHARACTER OF STATION ID IS A TAGGED AS FOLLOWS:
233C> "I" - GOES-EVEN-1 (252, 256, ...) SAT. , CLEAR COLUMN RETR.
234C> "J" - GOES-EVEN-1 (252, 256, ...) SAT. , CLD-CORRECTED RETR.
235
236C> "L" - GOES-ODD-1 (253, 257, ...) SAT. , CLEAR COLUMN RETR.
237C> "M" - GOES-ODD-1 (253, 257, ...) SAT. , CLD-CORRECTED RETR.
238
239C> "O" - GOES-EVEN-2 (254, 258, ...) SAT. , CLEAR COLUMN RETR.
240C> "P" - GOES-EVEN-2 (254, 258, ...) SAT. , CLD-CORRECTED RETR.
241
242C> "Q" - GOES-ODD-2 (251, 255, ...) SAT. , CLEAR COLUMN RETR.
243C> "R" - GOES-ODD-2 (251, 255, ...) SAT. , CLD-CORRECTED RETR.
244
245C> "?" - EITHER SATELLITE AND/OR RETRIEVAL TYPE UNKNOWN
246
247C> &- FIRST CHARACTER IS Q.M. FOR GEOPOTENTIAL
248C> SECOND CHARACTER IS Q.M. FOR TEMPERATURE
249C> THIRD CHARACTER IS Q.M. FOR DEWPOINT TEMPERATURE
250C> FOURTH CHARACTER IS NOT USED
251C> " " - INDICATES DATA NOT SUSPECT
252C> "Q" - INDICATES DATA ARE SUSPECT
253C> "F" - INDICATES DATA ARE BAD
254C> &&- FIRST CHARACTER IS Q.M. FOR BRIGHTNESS TEMPERATURE
255C> SECOND-FOURTH CHARACTERS ARE NOT USED
256C> " " - INDICATES DATA NOT SUSPECT
257C> "Q" - INDICATES DATA ARE SUSPECT
258C> "F" - INDICATES DATA ARE BAD
259C> @- NUMBER OF "LEVELS" FROM WORD 27. MAXIMUM IS 12, AND ARE ORDERED
260C> AS FOLLOWS (IF A DATUM ARE MISSING THAT LEVEL NOT STORED)
261C> 1 - LIFTED INDEX ---------- .01 DEG. KELVIN -- C. FIG. 250.
262C> 2 - TOTAL PRECIP. WATER -- .01 MILLIMETERS -- C. FIG. 251.
263C> 3 - 1. TO .9 SIGMA P.WATER- .01 MILLIMETERS -- C. FIG. 252.
264C> 4 - .9 TO .7 SIGMA P.WATER- .01 MILLIMETERS -- C. FIG. 253.
265C> 5 - .7 TO .3 SIGMA P.WATER- .01 MILLIMETERS -- C. FIG. 254.
266C> 6 - SKIN TEMPERATURE ----- .01 DEG. KELVIN -- C. FIG. 255.
267C> 7 - CLOUD TOP TEMPERATURE- .01 DEG. KELVIN -- C. FIG. 256.
268C> 8 - CLOUD TOP PRESSURE --- .1 MILLIBARS ----- C. FIG. 257.
269C> 9 - CLOUD AMOUNT (BUFR TBL. C.T. 0-20-011) -- C. FIG. 258.
270C> 10 - INSTR. DATA USED IN PROC.
271C> (BUFR TBL. C.T. 0-02-021) -- C. FIG. 259.
272C> 11 - SOLAR ZENITH ANGLE --- .01 DEGREE ------- C. FIG. 260.
273C> 12 - SAT. ZENITH ANGLE ---- .01 DEGREE ------- C. FIG. 261.
274C> #- FIRST CHARACTER IS Q.M. FOR THE DATUM
275C> " " - INDICATES DATA NOT SUSPECT
276C> "Q" - INDICATES DATA ARE SUSPECT
277C> "F" - INDICATES DATA ARE BAD
278C> SECOND CHARACTER IS NOT USED
279C>
280C>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
281C> FORMAT FOR NEXRAD (VAD) WIND REPORTS
282C>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
283C> HEADER
284C> WORD CONTENT UNIT FORMAT
285C> ---- ---------------------- ------------------- ---------
286C> 1 LATITUDE 0.01 DEGREES REAL
287C> 2 LONGITUDE 0.01 DEGREES WEST REAL
288C> 3 ** RESERVED ** SET TO 99999 INTEGER
289C> 4 OBSERVATION TIME 0.01 HOURS (UTC) REAL
290c>vvvvvdak port
291C> 5 YEAR/MONTH 4-CHAR. 'YYMM' CHARACTER
292c>aaaaadak port
293C> LEFT-JUSTIFIED
294C> 6 DAY/HOUR 4-CHARACTERS 'DDHH' CHARACTER
295C> 7 STATION ELEVATION METERS REAL
296C> 8 ** RESERVED ** SET TO 99999 INTEGER
297C>
298C> 9 REPORT TYPE 72 (CONSTANT) INTEGER
299C> 10 ** RESERVED ** SET TO 99999 INTEGER
300C> 11 STN. ID. (FIRST 4 CHAR.) 4-CHARACTERS CHARACTER
301C> LEFT-JUSTIFIED
302C> 12 STN. ID. (LAST 2 CHAR.) 2-CHARACTERS CHARACTER
303C> LEFT-JUSTIFIED
304C>
305C> 13-18 ZEROED OUT - NOT USED INTEGER
306C> 19 CATEGORY 04, NO. LEVELS COUNT INTEGER
307C> 20 CATEGORY 04, DATA INDEX COUNT INTEGER
308C> 21-42 ZEROED OUT - NOT USED INTEGER
309C>
310C> 43-END UNPACKED DATA GROUPS (FOLLOWS) REAL
311C>
312C> CATEGORY 04 - UPPER-AIR WINDS-BY-HEIGHT DATA(FIRST LEVEL IS SURFACE)
313C> (EACH LEVEL, SEE WORD 19 ABOVE)
314C> WORD PARAMETER UNITS FORMAT
315C> ---- --------- ----------------- -------------
316C> 1 HEIGHT ABOVE SEA-LVL METERS REAL
317C> 2 HORIZ. WIND DIR. DEGREES REAL
318C> 3 HORIZ. WIND SPEED 0.1 M/S (SEE *) REAL
319C> 4 QUALITY MARKERS 4-CHARACTERS CHARACTER
320C> LEFT-JUSTIFIED (SEE %)
321C>
322C> *- UNITS HERE DIFFER FROM THOSE IN TRUE UNPACKED OFFICE NOTE 29
323C> (WHERE UNITS ARE KNOTS)
324C> %- THE FIRST THREE CHARACTERS ARE ALWAYS BLANK, THE FOURTH
325C> CHARACTER IS A "CONFIDENCE LEVEL" WHICH IS RELATED TO THE ROOT-
326C> MEAN-SQUARE VECTOR ERROR FOR THE HORIZONTAL WIND. IT IS
327C> DEFINED AS FOLLOWS:
328C> 'A' = RMS OF 1.9 KNOTS
329C> 'B' = RMS OF 3.9 KNOTS
330C> 'C' = RMS OF 5.8 KNOTS
331C> 'D' = RMS OF 7.8 KNOTS
332C> 'E' = RMS OF 9.7 KNOTS
333C> 'F' = RMS OF 11.7 KNOTS
334C> 'G' = RMS > 13.6 KNOTS
335C>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
336C>
337C> FOR ALL REPORT TYPES, MISSING VALUES ARE:
338C> 99999. FOR REAL
339C> 99999 FOR INTEGER
340C> 9'S FOR CHARACTERS IN WORD 5, 6 OF HEADER
341C> BLANK FOR CHARACTERS IN WORD 11, 12 OF HEADER
342C> AND FOR CHARACTERS IN ANY CATEGORY LEVEL
343C>
344C> @author Dennis Keyser @date 2002-03-05
345 SUBROUTINE w3unpk77(IDATE,IHE,IHL,LUNIT,RDATA,IRET)
346 CHARACTER*4 CBUFR
347 INTEGER IDATE(4),LSDATE(4),jdate(8),IDATA(1200)
348 dimension rinc(5)
349 REAL RDATA(*),RDATX(1200)
350 COMMON /pk77bb/kdate(8),ldate(8),iprint
351 COMMON /pk77cc/index
352 COMMON /pk77dd/lshe,lshl,icdate(5),iddate(5)
353 COMMON /pk77ff/ifov(3),kntsat(250:260)
354
355 SAVE
356
357 equivalence(rdatx,idata)
358 DATA itm/0/,lunitl/-99/,kount/0/
359 iprint = 0
360 IF(iret.LT.0) iprint = iabs(iret)
361 iret = 0
362 IF(itm.EQ.0) THEN
363C-----------------------------------------------------------------------
364
365C FIRST AND ONLY TIME INTO THIS SUBROUTINE DO A FEW THINGS....
366
367 itm = 1
368 ifov = 0
369 kntsat = 0
370C DETERMINE MACHINE WORD LENGTH IN BYTES (=8 FOR CRAY) AND TYPE OF
371C CHARACTER SET {ASCII(ICHTP=0) OR EBCDIC(ICHTP=1)}
372 CALL w3fi04(iendn,ichtp,lw)
373 print 2213, lw, ichtp, iendn
374 2213 FORMAT(/' ---> W3UNPK77: CALL TO W3FI04 RETURNS: LW = ',i3,
375 $ ', ICHTP = ',i3,', IENDN = ',i3/)
376 IF(ichtp.GT.1) THEN
377C CHARACTERS ON THIS MACHINE ARE NEITHER ASCII OR EBCDIC!! -- STOP 22
378 print 217
379 217 FORMAT(' *** W3UNPK77 ERROR: CHARACTERS ON THIS MACHINE ',
380 $ 'ARE NEITHER ASCII NOR EBCDIC - STOP 22'/)
381 CALL errexit(22)
382 END IF
383C-----------------------------------------------------------------------
384 END IF
385 IF(lunit.NE.lunitl) THEN
386C-----------------------------------------------------------------------
387
388C IF THE INPUT DATA UNIT NUMBER ARGUMENT IS DIFFERENT THAT THE LAST TIME
389C THIS SUBR. WAS CALLED, PRINT NEW HEADER, SET JRET = 1
390
391 lunitl = lunit
392 jret = 1
393 print 101, lunit
394 101 FORMAT(//' ---> W3UNPK77: VERSION 03/05/2002: JBUFR DATA SET ',
395 $ 'READ FROM UNIT ',i4/)
396C-----------------------------------------------------------------------
397 ELSE
398
399C FOR SUBSEQUENT TIMES INTO THIS SUBR. W/ SAME LUNIT AS LAST TIME,
400C TEST INPUT DATE & HR RANGE ARGUMENTS AGAINST THEIR VALUES THE LAST
401C TIME SUBR. CALLED -- IF THEY ARE DIFFERENT, SET JRET = 1 (ELSE
402C JRET = 0), WILL TEST JRET SOON
403
404 jret = 1
405 DO i = 4,1,-1
406 IF(idate(i).NE.lsdate(i)) GO TO 88
407 ENDDO
408 IF(ihe.NE.lshe.OR.ihl.NE.lshl) GO TO 88
409 jret = 0
410 88 CONTINUE
411C-----------------------------------------------------------------------
412 END IF
413 IF(jret.EQ.1) THEN
414 print 6680
415 6680 FORMAT(/' JRET = 1 - REWIND DATA FILE & SET-UP TO DO DATE CHECK'/)
416C-----------------------------------------------------------------------
417
418C COME HERE IF FIRST CALL TO SUBROUTINE OR IF INPUT DATA UNIT NUMBER OR
419C IF INPUT DATE/TIME OR RANGE IN TIME HAS BEEN CHANGED FROM LAST CALL
420
421C CLOSE BUFR DATA SET (IN CASE OPEN FROM PREVIOUS RUN)
422C REWIND INPUT BUFR DATA SET, GET CENTER TIME AND DUMP TIME,
423C OPEN BUFR DATA SET
424
425C SET-UP TO DETERMINE IF BUFR MESSAGE IS WITHIN REQUESTED DATES
426
427C (ALSO SET INDEX=0, FORCES BUFR MSG TO BE READ BEFORE RPTS ARE DECODED)
428
429C-----------------------------------------------------------------------
430
431 CALL closbf(lunit)
432
433 rewind lunit
434
435 READ(lunit,END=9999,ERR=9999) cbufr
436 IF(cbufr.NE.'BUFR') GO TO 9999
437
438 call datelen(10)
439
440 CALL dumpbf(lunit,icdate,iddate)
441cppppp
442 print *,'CENTER DATE (ICDATE) = ',icdate
443 print *,'DUMP DATE (IDDATE) = ',iddate
444cppppp
445
446 if(icdate(1).le.0) then
447C COME HERE IF CENTER DATE COULD NOT BE READ FROM FIRST DUMMY MESSAGE
448C - RETURN WITH IRET = 1
449 print *, ' *** W3UNPK77 ERROR: CENTER DATE COULD NOT BE ',
450 $ 'OBTAINED FROM INPUT FILE ON UNIT ',lunit
451 go to 9998
452 end if
453 if(iddate(1).le.0) then
454C COME HERE IF DUMP DATE COULD NOT BE READ FROM SECOND DUMMY MESSAGE
455C - RETURN WITH IRET = 1
456 print *, ' *** W3UNPK77 ERROR: DUMP DATE COULD NOT BE ',
457 $ 'OBTAINED FROM INPUT FILE ON UNIT ',lunit
458 go to 9998
459 end if
460 IF(icdate(1).LT.100) THEN
461
462C If 2-digit year returned in ICDATE(1), must use "windowing" technique
463C to create a 4-digit year
464
465C IMPORTANT: IF DATELEN(10) IS CALLED, THE DATE HERE SHOULD ALWAYS
466C CONTAIN A 4-DIGIT YEAR, EVEN IF INPUT FILE IS NOT
467C Y2K COMPLIANT (BUFRLIB DOES THE WINDOWING HERE)
468
469 print *, '##W3UNPK77 - THE FOLLOWING SHOULD NEVER ',
470 $ 'HAPPEN!!!!!'
471 print *, '##W3UNPK77 - 2-DIGIT YEAR IN ICDATE(1) ',
472 $ 'RETURNED FROM DUMPBF (ICDATE IS: ',icdate,') - USE ',
473 $ 'WINDOWING TECHNIQUE TO OBTAIN 4-DIGIT YEAR'
474 IF(icdate(1).GT.20) THEN
475 icdate(1) = 1900 + icdate(1)
476 ELSE
477 icdate(1) = 2000 + icdate(1)
478 ENDIF
479 print *, '##WW3UNPK77 - CORRECTED ICDATE(1) WITH 4-DIGIT ',
480 $ 'YEAR, ICDATE NOW IS: ',icdate
481 ENDIF
482
483 IF(iddate(1).LT.100) THEN
484
485C If 2-digit year returned in IDDATE(1), must use "windowing" technique
486C to create a 4-digit year
487
488C IMPORTANT: IF DATELEN(10) IS CALLED, THE DATE HERE SHOULD ALWAYS
489C CONTAIN A 4-DIGIT YEAR, EVEN IF INPUT FILE IS NOT
490C Y2K COMPLIANT (BUFRLIB DOES THE WINDOWING HERE)
491
492 print *, '##W3UNPK77 - THE FOLLOWING SHOULD NEVER ',
493 $ 'HAPPEN!!!!!'
494 print *, '##W3UNPK77 - 2-DIGIT YEAR IN IDDATE(1) ',
495 $ 'RETURNED FROM DUMPBF (IDDATE IS: ',iddate,') - USE ',
496 $ 'WINDOWING TECHNIQUE TO OBTAIN 4-DIGIT YEAR'
497 IF(iddate(1).GT.20) THEN
498 iddate(1) = 1900 + iddate(1)
499 ELSE
500 iddate(1) = 2000 + iddate(1)
501 ENDIF
502 print *, '##W3UNPK77 - CORRECTED IDDATE(1) WITH 4-DIGIT ',
503 $ 'YEAR, IDDATE NOW IS: ',iddate
504 END IF
505
506C OPEN BUFR FILE - READ IN DICTIONARY MESSAGES (TABLE A, B, D ENTRIES)
507
508 CALL openbf(lunit,'IN',lunit)
509 print 100, lunit
510 100 FORMAT(/5x,'===> BUFR DATA SET IN UNIT',i3,' SUCCESSFULLY ',
511 $ 'OPENED FOR INPUT; DCTNY MESSAGES CONTAIN BUFR TABLES A,B,D'/)
512 index = 0
513 kount = 0
514 jdate(1:3) = idate(1:3)
515 jdate(4) = 0
516 jdate(5) = idate(4)
517 jdate(6:8) = 0
518 print 6681, idate
519 6681 FORMAT(/' %%% REQUESTED "CENTRAL" DATE IS :',i5,3i3,' 0'/)
520C DETERMINE EARLIEST DATE FOR ACCEPTING BUFR MESSAGES FOR DECODING
521 call w3movdat((/0.,real(ihe),0.,0.,0./),jdate,kdate)
522 print 6682, (kdate(i),i=1,3),kdate(5),kdate(6)
523 6682 FORMAT(/' --> EARLIEST DATE FOR ACCEPTING BUFR MSGS IS:',i5,4i3/)
524C DETERMINE LATEST DATE FOR ACCEPTING BUFR MESSAGES FOR DECODING
525 if(ihl.ge.0) then
526 xminl = (ihl * 60) + 59
527 else
528 xminl = ((ihl + 1) * 60) - 1
529 end if
530 call w3movdat((/0.,0.,xminl,0.,0./),jdate,ldate)
531 print 6683, (ldate(i),i=1,3),ldate(5),ldate(6)
532 6683 FORMAT(/' --> LATEST DATE FOR ACCEPTING BUFR MSGS IS:',i5,4i3/)
533 call w3difdat(ldate,kdate,3,rinc)
534 IF(rinc(3).LT.0) THEN
535 print 104
536 104 FORMAT(' *** W3UNPK77 ERROR: DATES SPECIFIED INCORRECTLY -',
537 $ ' STOP 15'/)
538 CALL errexit(15)
539 END IF
540C-----------------------------------------------------------------------
541 END IF
542C SUBR. UNPK7701 RETURNS A SINGLE DECODED REPORT FROM BUFR MESSAGE
543 CALL unpk7701(lunit,itp,iret)
544C IRET=1 MEANS ALL DATA HAVE BEEN DECODED FOR SPECIFIED TIME PERIOD
545C (REWIND DATA FILE AND RETURN W/ IRET=1)
546C IRET.GE.2 MEANS REPORT NOT RETURNED DUE TO ERROR IN DECODING (RETURN)
547C (ACTUALLY IRET.GE.2 CURRENTLY CANNOT HAPPEN OUT OF UNPK7701)
548 IF(iret.GE.1) THEN
549 IF(iret.EQ.1) THEN
550 rewind lunit
551 IF(itp.EQ.2) THEN
552 print 8101, ifov
553 8101 FORMAT(/' ---> W3UNPK77: SUMMARY OF GOES REPORT COUNTS GROUPED',
554 $ ' BY F-O-V NO. (PRIOR TO ANY FILTERING BY CALLING PROGRAM)'/15x,
555 $ '# WITH F-O-V NO. 00 TO 02:',i6,' - GET "BAD" Q.MARK'/15x,
556 $ '# WITH F-O-V NO. 03 TO 09:',i6,' - GET "SUSPECT" Q.MARK'/15x,
557 $ '# WITH F-O-V NO. 10 TO 25:',i6,' - GET "NEUTRAL" Q.MARK'/20x,
558 $ '(NOTE: RADIANCES ALWAYS HAVE NEUTRAL Q.MARK)'/)
559 print 8102
560 8102 FORMAT(/' ---> W3UNPK77: SUMMARY OF GOES REPORT COUNTS GROUPED',
561 $ ' BY SATELLITE ID (PRIOR TO ANY FILTERING BY CALLING PROGRAM)'/)
562 DO idsat = 250,259
563 IF(kntsat(idsat).GT.0) print 8103, idsat,kntsat(idsat)
564 ENDDO
565 8103 FORMAT(15x,'NUMBER FROM SAT. ID',i4,4x,':',i6)
566 IF(kntsat(260).GT.0) print 8104
567 8104 FORMAT(15x,'NUMBER FROM UNKNOWN SAT. ID:',i6)
568 print 8105
569 8105 FORMAT(/)
570 END IF
571 END IF
572 GO TO 99
573 END IF
574 kount = kount + 1
575C INITIALIZE THE OUTPUT ON29 ARRAY
576 CALL unpk7702(rdata,itp)
577 IF(itp.EQ.1) THEN
578C-----------------------------------------------------------------------
579C THE FOLLOWING PERTAINS TO WIND PROFILER REPORTS
580C-----------------------------------------------------------------------
581C STORE THE HEADER INFORMATION INTO ON29 FORMAT
582 CALL unpk7703(lunit,rdata,iret)
583C IRET.GE.2 MEANS RPT NOT RETURNED DUE TO MSG DATA IN HDR (RETURN)
584 IF(iret.GE.2) GO TO 99
585C STORE THE SURFACE DATA INTO ON29 FORMAT (CATEGORY 10)
586 CALL unpk7704(lunit,rdata)
587C STORE THE UPPER-AIR DATA INTO ON29 FORMAT (CATEGORY 11)
588 CALL unpk7705(lunit,rdata)
589 rdatx(1:1200) = rdata(1:1200)
590 IF(idata(35)+idata(37).EQ.0) iret = 5
591 ELSE IF(itp.EQ.2) THEN
592C-----------------------------------------------------------------------
593C THE FOLLOWING PERTAINS TO GOES SOUNDING/RADIANCE REPORTS
594C-----------------------------------------------------------------------
595C STORE THE HEADER INFORMATION INTO ON29 FORMAT
596 CALL unpk7708(lunit,rdata,kount,iret)
597C IRET.GE.2 MEANS RPT NOT RETURNED DUE TO MSG DATA IN HDR (RETURN)
598 IF(iret.GE.2) GO TO 99
599C STORE THE UPPER-AIR DATA/RADIANCE INTO ON29 FORMAT (CATEGORY 12, 13)
600 CALL unpk7709(lunit,rdata,iret)
601 ELSE IF(itp.EQ.3) THEN
602C-----------------------------------------------------------------------
603C THE FOLLOWING PERTAINS TO NEXRAD (VAD) WIND REPORTS
604C-----------------------------------------------------------------------
605C STORE THE HEADER INFORMATION INTO ON29 FORMAT
606 CALL unpk7706(lunit,rdata,iret)
607C IRET.GE.2 MEANS RPT NOT RETURNED DUE TO MSG DATA IN HDR (RETURN)
608 IF(iret.GE.2) GO TO 99
609C STORE THE UPPER-AIR DATA INTO ON29 FORMAT (CATEGORY 4)
610 CALL unpk7707(lunit,rdata,iret)
611C-----------------------------------------------------------------------
612 END IF
613 99 CONTINUE
614C PRIOR TO RETURNING SAVE INPUT DATE & HR RANGE ARGUMENTS FROM THIS CALL
615 lsdate = idate
616 lshe = ihe
617 lshl = ihl
618 RETURN
619C-----------------------------------------------------------------------
620 9999 CONTINUE
621C COME HERE IF NULL OR NON-BUFR FILE IS INPUT - RETURN WITH IRET = 1
622 print *, ' *** W3UNPK77 ERROR: INPUT FILE IN UNIT ',lunit,' IS ',
623 $ 'EITHER A NULL OR NON-BUFR FILE'
624 9998 continue
625 rewind lunit
626 iret = 1
627 lsdate = idate
628 lshe = ihe
629 lshl = ihl
630 END
631C> @brief Reads a single report out of bufr dataset
632C> @author Dennis Keyser @date 1996-12-16
633
634C> Calls bufrlib routines to read in a bufr message and then read a single
635C> report (subset) out of the message.
636C>
637C> ### Program History Log:
638C> Date | Programmer | Comment
639C> -----|------------|--------
640C> 1996-12-16 | Dennis Keyser NP22 | Initial.
641C>
642C> @param[in] LUNIT Fortran unit number for input data file.
643C> @param[out] ITP The type of report that has been decoded {=1 - wind profiler,
644C> =2 - goes sndg, =3 - nexrad(vad) wind}
645C> @param[out] IRET Return code as described in w3unpk77 docblock
646C>
647C> @author Dennis Keyser @date 1996-12-16
648 SUBROUTINE unpk7701(LUNIT,ITP,IRET)
649 CHARACTER*8 SUBSET
650 integer mdate(4),ndate(8)
651 dimension rinc(5)
652 COMMON /pk77bb/kdate(8),ldate(8),iprint
653 COMMON /pk77cc/index
654 COMMON /pk77dd/lshe,lshl,icdate(5),iddate(5)
655
656 SAVE
657
658 DATA irec/0/
659
660 10 CONTINUE
661C=======================================================================
662 IF(index.EQ.0) THEN
663
664C READ IN NEXT BUFR MESSAGE
665
666 CALL readmg(lunit,subset,ibdate,jret)
667 IF(jret.NE.0) THEN
668C-----------------------------------------------------------------------
669 print 101
670 101 FORMAT(' ---> W3UNPK77: ALL BUFR MESSAGES READ IN AND DECODED'/)
671 iret = 1
672 RETURN
673C-----------------------------------------------------------------------
674 END IF
675 if(ibdate.lt.100000000) then
676c If input BUFR file does not return messages with a 4-digit year,
677c something is wrong (even non-compliant BUFR messages should
678c construct a 4-digit year as long as datelen(10) has been called
679 print *, '##W3UNP777/UNPK7701 - A 10-digit Sect. 1 BUFR ',
680 $ 'message date was not returned in unit ',lunit,' - ',
681 $ 'problem with BUFR file - ier = 1'
682 iret = 1
683 return
684 end if
685 CALL ufbcnt(lunit,irec,isub)
686 mdate(1) = ibdate/1000000
687 mdate(2) = mod((ibdate/10000),100)
688 mdate(3) = mod((ibdate/100),100)
689 mdate(4) = mod(ibdate,100)
690C ALL JBUFR MESSAGES CURRENTLY HAVE "00" FOR MINUTES IN SECTION 1
691 ndate(1:3) = mdate(1:3)
692 ndate(4) = 0
693 ndate(5) = mdate(4)
694 ndate(6:8) = 0
695 IF(iprint.GE.1) THEN
696 print *,'HAVE SUCCESSFULLY READ IN A BUFR MESSAGE'
697 print 103
698 103 FORMAT(' BUFR FOUND BEGINNING AT BYTE 1 OF MESSAGE')
699 print 105, irec,mdate,subset
700 105 FORMAT(8x,'HAVE READ IN A BUFR MESSAGE NO.',i3,', DATE: ',
701 $ i6,3i4,' 0; TABLE A ENTRY = ',a8,' AND EDIT. NO. = 2'/)
702 END IF
703 IF(subset.EQ.'NC002007') THEN
704 IF(iprint.GE.1) print *, 'THIS MESSAGE CONTAINS WIND ',
705 $ 'PROFILER REPORTS'
706 itp = 1
707 ELSE IF(subset.EQ.'NC002008') THEN
708 IF(iprint.GE.1) print *, 'THIS MESSAGE CONTAINS NEXRAD ',
709 $ '(VAD) WIND REPORTS'
710 itp = 3
711 ELSE IF(subset.EQ.'NC003001') THEN
712 IF(iprint.GE.1) print *, 'THIS MESSAGE CONTAINS GOES ',
713 $ 'SOUNDING/RADIANCE REPORTS'
714 itp = 2
715 ELSE
716 print 107, irec
717 107 FORMAT(' *** W3UNPK77 WARNING: BUFR MESSAGE NO.',i3,' CONTAINS ',
718 $ 'REPORTS THAT CANNOT BE DECODED BY W3UNPK77, TRY READING NEXT ',
719 $ 'MSG'/)
720 index = 0
721 GO TO 10
722 END IF
723 call w3difdat(kdate,ndate,3,rinc)
724 kmin = rinc(3)
725 call w3difdat(ldate,ndate,3,rinc)
726 lmin = rinc(3)
727C CHECK DATE OF MESSAGE AGAINST SPECIFIED TIME RANGES
728 if((kmin.gt.0.or.lmin.lt.0).AND.irec.GT.2) then
729 print 106, irec,mdate
730 106 FORMAT(' BUFR MESSAGE NO.',i3,' WITH DATE:',i5,3i3,' 0 NOT W/I',
731 $ ' REQ. TIME RANGE, TRY READING NEXT MSG'/)
732 index = 0
733 GO TO 10
734 END IF
735 END IF
736C=======================================================================
737C READ NEXT SUBSET (REPORT) IN MESSAGE
738
739 IF(iprint.GT.1) print *,'CALL READSB'
740 CALL readsb(lunit,jret)
741 IF(iprint.GT.1) print *,'BACK FROM READSB'
742 IF(jret.NE.0) THEN
743 IF(index.GT.0) THEN
744
745C ALL SUBSETS IN THIS MESSAGE PROCESSED, READ IN NEXT MESSAGE (IF ALL
746C MESSAGES READ IN NO MORE DATA TO PROCESS)
747
748 IF(iprint.GT.1) print *, 'ALL REPORTS IN THIS MESSAGE ',
749 $ 'DECODED, GO ON TO NEXT MESSAGE'
750 ELSE
751
752C THERE WERE NO SUBSETS FOUND IN THIS BUFR MESSAGE, GOOD CHANCE IT IS
753C ONE OF TWO DUMMY MESSAGES AT TOP OF FILE INDICATING CENTER TIME AND
754C DATA DUMP TIME ONLY; READ IN NEXT MESSAGE
755
756 IF(irec.EQ.1) THEN
757 print 4567, icdate
758 4567 FORMAT(/'===> BUFR MESSAGE NO. 1 IS A DUMMY MESSAGE CONTAINING ',
759 $ 'ONLY CENTER DATE (',i5,4i3,') - NO DATA - GO ON TO NEXT ',
760 $ 'MESSAGE'/)
761 ELSE IF(irec.EQ.2) THEN
762 print 4568, iddate
763 4568 FORMAT(/'===> BUFR MESSAGE NO. 2 IS A DUMMY MESSAGE CONTAINING ',
764 $ 'ONLY DUMP DATE (',i5,4i3,') - NO DATA - GO ON TO NEXT ',
765 $ 'MESSAGE'/)
766 ELSE
767 print 4569, irec,mdate
768 4569 FORMAT(/'===> BUFR MESSAGE NO.',i3,' (DATE:',i5,3i3,' 0) ',
769 $ 'CONTAINS ZERO REPORTS FOR SOME UNEXPLAINED REASON - GO ON TO ',
770 $ 'NEXT MESSAGE'/)
771 END IF
772 END IF
773 index = 0
774 GO TO 10
775 END IF
776C-----------------------------------------------------------------------
777 IF(iprint.GT.1) print *, 'READY TO PROCESS NEW DECODED REPORT'
778C***********************************************************************
779C A SINGLE REPORT HAS BEEN SUCCESSFULLY DECODED
780C***********************************************************************
781 index = index + 1
782 IF(iprint.GE.1) print *, 'WORKING WITH SUBSET NUMBER ',index
783 RETURN
784 END
785C> @brief Initializes the output array for a report.
786C> @author Dennis Keyser @date 1996-12-16
787
788C> Initializes the output array which holds a single report in the quasi-office
789C> note 29 unpacked format to all missing.
790C>
791C> ### Program History Log:
792C> Date | Programmer | Comment
793C> -----|------------|--------
794C> 1996-12-16 | Dennis Keyser NP22 | Initial.
795C> @param[in] ITP the type of report that has been decoded {=1 - wind profiler, =2 - goes sndg, =3 - nexrad(vad) wind}
796C> @param[out] RDATA single report returned an a quasi-office note 29 unpacked format; all data are missing
797C>
798C> @author Dennis Keyser @date 1996-12-16
799 SUBROUTINE unpk7702(RDATA,ITP)
800 REAL RDATA(*),RDATX(1200)
801 INTEGER IDATA(1200),IRTYP(3)
802 CHARACTER*8 COB
803C
804 SAVE
805C
806 equivalence(rdatx,idata),(cob,iob)
807 DATA xmsg/99999./,imsg/99999/,irtyp/71,61,72/
808 rdatx(1) = xmsg
809 rdatx(2) = xmsg
810 idata(3) = imsg
811 rdatx(4) = xmsg
812 cob = '999999 '
813 idata(5) = iob
814 cob = '9999 '
815 idata(6) = iob
816 rdatx(7) = xmsg
817 idata(8) = imsg
818 idata(9) = irtyp(itp)
819 idata(10) = imsg
820 cob = ' '
821 idata(11) = iob
822 idata(12) = iob
823C
824C ALL TYPES -- LOAD ZEROS INTO THE DEFINING WORD PAIRS
825C
826 idata(13:42) = 0
827C
828C ALL TYPES -- LOAD MISSINGS INTO THE DATA PORTION
829C
830 rdatx(43:1200) = xmsg
831 IF(itp.EQ.1) THEN
832C
833C PROFILER -- LOAD INTEGER MISSING WHERE APPROPRIATE
834C (Current limit of 104 Cat. 11 levels)
835C
836 idata(53:1200:11) = imsg
837 idata(55:1200:11) = imsg
838 idata(56:1200:11) = imsg
839 idata(60:1200:11) = imsg
840 ELSE IF(itp.EQ.2) THEN
841C
842C GOES -- LOAD DEFAULT OF BLANK CHARACTERS INTO CAT. 12
843C LEVEL QUALITY MARKERS
844C (Current limit of 50 Cat. 12 levels)
845C (could be expanded if need be)
846C
847 idata(49:392:7) = iob
848C
849C GOES -- LOAD DEFAULT OF BLANK CHARACTER INTO FIRST CAT. 08
850C LEVEL QUALITY MARKER
851C (Current limit of 9 Cat. 08 levels)
852C (could be expanded if need be)
853C
854 idata(395:419:3) = iob
855C GOES -- LOAD INTEGER MISSING INTO CAT. 13 LEVEL CHANNEL NUMBER
856C -- LOAD DEFAULT OF BLANK CHARACTER INTO CAT. 13 LEVEL
857C QUALITY MARKER
858C (Current limit of 60 Cat. 13 levels)
859C (could be expanded if need be)
860C
861 idata(420:599:3) = imsg
862 idata(422:599:3) = iob
863 ELSE IF(itp.EQ.3) THEN
864C
865C VADWND -- LOAD DEFAULT OF BLANK CHARACTER INTO HGHT CAT. 04
866C LEVEL QUALITY MARKER
867C (Current limit of 70 Cat. 04 levels)
868C (could be expanded if need be)
869C
870 idata(46:1200:4) = iob
871 END IF
872 rdata(1:1200) = rdatx(1:1200)
873 RETURN
874 END
875C> @brief Fills in header in o-put array - pflr rpt.
876C> @author Dennis Keyser @date 2002-03-05
877
878C> For report (subset) read out of bufr message (passed in
879C> internally via bufrlib storage), calls bufrlib routine to decode
880C> header data for wind profiler report. header is then filled into
881C> the output array which holds a single wind profiler report in the
882C> quasi-office note 29 unpacked format.
883C>
884C> ### Program History Log:
885C> Date | Programmer | Comment
886C> -----|------------|--------
887C> 1996-12-16 | Dennis Keyser NP22 | Initial.
888C> 2002-03-05 | Dennis Keyser | Accounts for changes in input proflr (wind profiler) bufr dump file after 3/2002: mnemonic "npsm" is no longer available, mnemonic "tpse" replaces "tpmi" (avg. time in minutes still output) (will still work properly for input proflr dump files prior to 3/2002)
889C>
890C> @param[in] LUNIT Fortran unit number for input data file
891C> @param[inout] RDATA Single wind profiler report in a quasi-office note 29 unpacked format with [out] header information filled in [in] all data initialized as missing
892C> @param[out] IRET Return code as described in w3unpk77 docblock
893C>
894C> @author Dennis Keyser @date 2002-03-05
895 SUBROUTINE unpk7703(LUNIT,RDATA,IRET)
896 CHARACTER*6 STNID
897 CHARACTER*8 COB
898 CHARACTER*35 HDR1,HDR2
899 INTEGER IDATA(1200)
900 REAL(8) HDR_8(16)
901 REAL HDR(16),RDATA(*),RDATX(1200)
902 COMMON /pk77bb/kdate(8),ldate(8),iprint
903
904 SAVE
905
906 equivalence(rdatx,idata),(cob,iob)
907 DATA xmsg/99999./,imsg/99999/
908 DATA hdr1/'CLAT CLON TSIG SELV NPSM TPSE WMOB '/
909 DATA hdr2/'WMOS YEAR MNTH DAYS HOUR MINU TPMI '/
910 rdatx(1:1200) = rdata(1:1200)
911 hdr_8 = 10.0e10
912 CALL ufbint(lunit,hdr_8,16,1,nlev,hdr1//hdr2);hdr=hdr_8
913 IF(nlev.NE.1) THEN
914C.......................................................................
915C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS NOT WHAT IS EXPECTED --
916C SET IRET = 6 AND RETURN
917 print 217, nlev
918 217 FORMAT(/' ##W3UNPK77: THE NUMBER OF DECODED "LEVELS" (=',i5,') ',
919 $ 'IS NOT WHAT IS EXPECTED (1) - IRET = 6'/)
920 iret = 6
921 RETURN
922C.......................................................................
923 END IF
924
925C LATITUDE (STORED AS REAL)
926
927 m = 1
928 IF(iprint.GT.1) print 199, hdr(1),m
929 199 FORMAT(5x,'HDR HERE IS: ',f17.4,'; INDEX IS: ',i3)
930 IF(hdr(1).LT.xmsg) THEN
931 rdatx(1) = nint(hdr(1) * 100.)
932 nnnnn = 1
933 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
934 198 FORMAT(5x,'DATA(',i5,') STORED AS: ',f10.2)
935 ELSE
936 iret = 2
937 print 102
938 102 FORMAT(' *** W3UNPK77 ERROR: LAT MISSING FOR WIND PROFILER ',
939 $ 'REPORT'/)
940 RETURN
941 END IF
942
943C LONGITUDE (STORED AS REAL)
944
945 m = 2
946 IF(iprint.GT.1) print 199, hdr(2),m
947 IF(hdr(2).LT.xmsg) THEN
948 rdatx(2) = nint(mod((36000.-(hdr(2)*100.)),36000.))
949 nnnnn = 2
950 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
951 ELSE
952 iret = 2
953 print 104
954 104 FORMAT(' *** W3UNPK77 ERROR: LON MISSING FOR WIND PROFILER ',
955 $ 'REPORT'/)
956 RETURN
957 END IF
958
959C TIME SIGNIFICANCE (STORED AS INTEGER)
960
961 m = 3
962 IF(iprint.GT.1) print 199, hdr(3),m
963 IF(hdr(3).LT.xmsg) idata(3) = nint(hdr(3))
964 nnnnn = 3
965 IF(iprint.GT.1) print 197, nnnnn,idata(nnnnn)
966 197 FORMAT(5x,'IDATA(',i5,') STORED AS: ',i10)
967
968C STATION ELEVATION (FROM REPORTED STN. HGHT; STORED IN OUTPUT)
969C (STORED AS REAL)
970
971 m = 4
972 IF(iprint.GT.1) print 199, hdr(4),m
973 IF(hdr(4).LT.xmsg) rdatx(7) = nint(hdr(4))
974 nnnnn = 7
975 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
976
977C SUBMODE INFORMATION
978C EDITION NUMBER (ALWAYS = 2)
979C (PACKED AS SUBMODE TIMES 10 PLUS EDITION NUMBER - INTEGER)
980C {NOTE: After 3/2002, the submode information is no longer
981C available and is stored as missing (3).}
982
983 m = 5
984 iedtn = 2
985 idata(8) = (3 * 10) + iedtn
986 IF(iprint.GT.1) print 199, hdr(5),m
987 IF(hdr(5).LT.xmsg) idata(8) = (nint(hdr(5)) * 10) + iedtn
988 nnnnn = 8
989 IF(iprint.GT.1) print 197, nnnnn,idata(nnnnn)
990
991C AVERAGING TIME (STORED AS INTEGER)
992C (NOTE: Prior to 3/2002, this is decoded in minutes, after
993C 3/2002 this is decoded in seconds - in either case
994C it is stored in minutes)
995
996 m = 6
997 IF(iprint.GT.1) print 199, hdr(6),m
998 IF(iprint.GT.1) print 199, hdr(14),m
999 IF(hdr(6).LT.xmsg) THEN
1000 idata(10) = nint(hdr(6)/60.)
1001 ELSE IF(hdr(14).LT.xmsg) THEN
1002 idata(10) = nint(hdr(14))
1003 END IF
1004 nnnnn = 10
1005 IF(iprint.GT.1) print 197, nnnnn,idata(nnnnn)
1006C-----------------------------------------------------------------------
1007
1008C STATION IDENTIFICATION (STORED AS CHARACTER)
1009C (OBTAINED FROM ENCODED WMO BLOCK/STN NUMBERS)
1010
1011 stnid = ' '
1012
1013C WMO BLOCK NUMBER (STORED AS CHARACTER)
1014
1015 m = 7
1016 IF(iprint.GT.1) print 199, hdr(7),m
1017 IF(hdr(7).LT.xmsg) WRITE(stnid(1:2),'(I2.2)') nint(hdr(7))
1018
1019C WMO STATION NUMBER (STORED AS CHARACTER)
1020
1021 m = 8
1022 IF(iprint.GT.1) print 199, hdr(8),m
1023 IF(hdr(8).LT.xmsg) WRITE(stnid(3:5),'(I3.3)') nint(hdr(8))
1024 cob(1:4) = stnid(1:4)
1025 idata(11) = iob
1026 nnnnn = 11
1027 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1028 196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a4,'"')
1029 cob(1:4) = stnid(5:6)//' '
1030 idata(12) = iob
1031 nnnnn = 12
1032 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1033
1034cvvvvvdak port
1035C LOAD THE YEAR/MONTH (STORED AS CHARACTER IN FORM YYMM)
1036caaaaadak port
1037
1038 m = 9
1039 IF(iprint.GT.1) print 199, hdr(9),m
1040 iyear = imsg
1041 IF(hdr(9).LT.xmsg) iyear = nint(hdr(9))
1042 m = 10
1043 IF(iprint.GT.1) print 199, hdr(10),m
1044 IF(hdr(10).LT.xmsg.AND.iyear.LT.imsg) THEN
1045cvvvvvdak port
1046 iyear = mod(iyear,100)
1047caaaaadak port
1048 iyear = nint(hdr(10)) + (iyear * 100)
1049cvvvvvdak port
1050cdak WRITE(COB,'(I6.6,2X)') IYEAR
1051 WRITE(cob,'(I4.4,4X)') iyear
1052caaaaadak port
1053 idata(5) = iob
1054 nnnnn = 5
1055 IF(iprint.GT.1) print 9196, nnnnn,cob(1:6)
1056 9196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a6,'"')
1057 ELSE
1058 GO TO 30
1059 END IF
1060
1061C LOAD THE DAY/HOUR (STORED AS CHARACTER IN FORM DDHH)
1062C AND THE OBSERVATION TIME (STORED AS REAL)
1063
1064 m = 11
1065 IF(iprint.GT.1) print 199, hdr(11),m
1066 iday = imsg
1067 IF(hdr(11).LT.xmsg) iday = nint(hdr(11))
1068 m = 12
1069 IF(iprint.GT.1) print 199, hdr(12),m
1070 IF(hdr(12).LT.xmsg.AND.iday.LT.imsg) THEN
1071 ihrt = nint(hdr(12))
1072 m = 13
1073 IF(iprint.GT.1) print 199, hdr(13),m
1074 IF(hdr(13).GE.xmsg) GO TO 30
1075 rmnt = hdr(13)
1076 rdatx(4) = nint((ihrt * 100.) + (rmnt * 100.)/60.)
1077 nnnnn = 4
1078 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1079 ihrt = ihrt + (iday * 100)
1080 WRITE(cob(1:4),'(I4.4)') ihrt
1081 idata(6) = iob
1082 nnnnn = 6
1083 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1084 ELSE
1085 GO TO 30
1086 END IF
1087 rdata(1:1200) = rdatx(1:1200)
1088 RETURN
1089 30 CONTINUE
1090 iret = 4
1091 RETURN
1092 END
1093C> @brief Fills cat.10 into o-put array - pflr rpt
1094C> @author Dennis Keyser @date 2002-03-05
1095
1096C> For report (subset) read out of bufr message (passed in
1097C> internally via bufrlib storage), calls bufrlib routine to decode
1098C> surface data for wind profiler report. Surface data are then
1099C> filled into the output array as category 10. The ouput array
1100C> holds a single wind profiler report in the quasi-office note 29
1101C> unpacked format.
1102C>
1103C> ### Program History Log:
1104C> Date | Programmer | Comment
1105C> -----|------------|--------
1106C> 1996-12-16 | Dennis Keyser NP22 | Initial.
1107C> 2002-03-05 | Dennis Keyser | Accounts for changes in input proflr (wind profiler) bufr dump file after 3/2002: surface data now all missing (mnemonics "pmsl", "wdir1","wspd1", "tmdb", "rehu", "reqv" no longer available) (will still work properly for input proflr dump files prior to 3/2002)
1108C>
1109C> @param[in] LUNIT Fortran unit number for input data file
1110C> @param[inout] RDATA Single wind profiler report in a quasi-office note 29 unpacked format with [out] header information filled in [in] all data initialized as missing
1111C>
1112C> @remark Called by subroutine w3unpkb7. after 3/2002, there is no surface data available.
1113C>
1114C$$$
1115 SUBROUTINE unpk7704(LUNIT,RDATA)
1116 CHARACTER*40 SRFC
1117 INTEGER IDATA(1200)
1118 REAL(8) SFC_8(8)
1119 REAL SFC(8),RDATA(*),RDATX(1200)
1120 COMMON /pk77bb/kdate(8),ldate(8),iprint
1121
1122 SAVE
1123
1124 equivalence(rdatx,idata)
1125 DATA xmsg/99999./
1126 DATA srfc/'PMSL WDIR1 WSPD1 TMDB REHU REQV '/
1127 rdatx(1:1200) = rdata(1:1200)
1128 sfc_8 = 10.0e10
1129 CALL ufbint(lunit,sfc_8,8,1,nlev,srfc);sfc=sfc_8
1130 IF(nlev.NE.1) THEN
1131C.......................................................................
1132C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS NOT WHAT IS EXPECTED --
1133 print 217, nlev
1134 217 FORMAT(/' ##W3UNPK77: THE NUMBER OF DECODED "LEVELS" (=',i5,') ',
1135 $ 'IS NOT WHAT IS EXPECTED (1) - NO SFC DATA PROCESSED'/)
1136 GO TO 99
1137C.......................................................................
1138 END IF
1139
1140C MSL PRESSURE (STORED AS REAL)
1141
1142 m = 1
1143 IF(iprint.GT.1) print 199, sfc(1),m
1144 199 FORMAT(5x,'SFC HERE IS: ',f17.4,'; INDEX IS: ',i3)
1145 IF((sfc(1)*0.1).LT.xmsg) rdatx(43) = nint(sfc(1) * 0.1)
1146 nnnnn = 43
1147 IF(iprint.GT.1) print 198, nnnnn,rdatx(43)
1148 198 FORMAT(5x,'RDATA(',i5,') STORED AS: ',f10.2)
1149
1150C SURFACE HORIZONTAL WIND DIRECTION (STORED AS REAL)
1151
1152 m = 2
1153 IF(iprint.GT.1) print 199, sfc(2),m
1154 IF(sfc(2).LT.xmsg) rdatx(43+2) = nint(sfc(2))
1155 nnnnn = 43 + 2
1156 IF(iprint.GT.1) print 198, nnnnn,rdatx(43+2)
1157
1158C SURFACE HORIZONTAL WIND SPEED (STORED AS REAL)
1159
1160 m = 3
1161 IF(iprint.GT.1) print 199, sfc(3),m
1162 IF(sfc(3).LT.xmsg) rdatx(43+3) = nint(sfc(3) * 10.)
1163 nnnnn = 43 + 3
1164 IF(iprint.GT.1) print 198, nnnnn,rdatx(43+3)
1165
1166C SURFACE TEMPERATURE (STORED AS REAL)
1167
1168 m = 4
1169 IF(iprint.GT.1) print 199, sfc(4),m
1170 IF(sfc(4).LT.xmsg) rdatx(43+4) = nint(sfc(4) * 10.)
1171 nnnnn = 43 + 4
1172 IF(iprint.GT.1) print 198, nnnnn,rdatx(43+4)
1173
1174C RELATIVE HUMIDITY (STORED AS REAL)
1175
1176 m = 5
1177 IF(iprint.GT.1) print 199, sfc(5),m
1178 IF(sfc(5).LT.xmsg) rdatx(43+5) = nint(sfc(5))
1179 nnnnn = 43 + 5
1180 IF(iprint.GT.1) print 198, nnnnn,rdatx(43+5)
1181
1182C RAINFALL RATE (STORED AS REAL)
1183
1184 m = 6
1185 IF(iprint.GT.1) print 199, sfc(6),m
1186 IF(sfc(6).LT.xmsg) rdatx(43+6) = nint(sfc(6) * 1.e7)
1187 nnnnn = 43 + 6
1188 IF(iprint.GT.1) print 198, nnnnn,rdatx(43+6)
1189
1190C SET CATEGORY COUNTERS FOR SURFACE DATA
1191
1192 idata(35) = 1
1193 idata(36) = 43
1194 99 CONTINUE
1195 IF(iprint.GT.1) print *, 'IDATA(35)=',idata(35),'; IDATA(36)=',
1196 $ idata(36)
1197 rdata(1:1200) = rdatx(1:1200)
1198 RETURN
1199 END
1200C> @brief Fills cat.11 into o-put array - pflr rpt
1201C> @author Dennis Keyser @date 2002-03-05
1202
1203C> For report (subset) read out of bufr message (passed in
1204C> internally via bufrlib storage), calls bufrlib routine to decode
1205C> upper-air data for wind profiler report. upper-air data are then
1206C> filled into the output array as category 11. the ouput array
1207C> holds a single wind profiler report in the quasi-office note 29
1208C> unpacked format.
1209C>
1210C> ### Program History Log:
1211C> Date | Programmer | Comment
1212C> -----|------------|--------
1213C> 1996-12-16 | Dennis Keyser NP22 | Initial.
1214C> 1998-07-09 | Dennis Keyser | Modified wind profiler cat. 11 (height, horiz. significance, vert. significance) processing to account for updates to bufrtable mnemonics in /dcom
1215C> 2002-03-05 | Dennis Keyser | Accounts for changes in input proflr (wind profiler) bufr dump file after 3/2002: mnemonics "acavh", "acavv", "spp0", and "nphl" no longer available; (will still work properly for input proflr dump files prior to 3/2002)
1216C>
1217C> @param[in] LUNIT Fortran unit number for input data file
1218C> @param[inout] RDATA Single wind profiler report in a quasi-office note 29 unpacked format with [out] header information filled in [in] all data initialized as missing
1219C>
1220C$$$
1221 SUBROUTINE unpk7705(LUNIT,RDATA)
1222 CHARACTER*31 UAIR1,UAIR2
1223 CHARACTER*16 UAIR3
1224 INTEGER IDATA(1200)
1225 REAL(8) UAIR_8(16,255)
1226 REAL UAIR(16,255),RDATA(*),RDATX(1200)
1227 COMMON /pk77bb/kdate(8),ldate(8),iprint
1228
1229 SAVE
1230
1231 equivalence(rdatx,idata)
1232 DATA xmsg/99999./
1233 DATA uair1/'HEIT WDIR WSPD NPQC WCMP ACAVH '/
1234 DATA uair2/'ACAVV SPP0 SDHS SDVS NPHL '/
1235 DATA uair3/'HAST ACAV1 ACAV2'/
1236 rdatx(1:1200) = rdata(1:1200)
1237 nsfc = 0
1238 ilvl = 0
1239 ilc = 0
1240C FIRST UPPER-AIR LEVEL IS THE SURFACE INFORMATION
1241 IF(iprint.GT.1) print 1078, ilc,ilvl
1242 1078 FORMAT(' ATTEMPTING 1ST (SFC) LVL WITH ILC =',i5,'; NO. LEVELS ',
1243 $ 'PROCESSED TO NOW =',i5)
1244 rdatx(50+ilc) = rdatx(7)
1245 IF(iprint.GT.1) print 198, 50+ilc,rdatx(50+ilc)
1246 198 FORMAT(5x,'RDATA(',i5,') STORED AS: ',f10.2)
1247 IF(rdatx(50+ilc).LT.xmsg) nsfc = 1
1248 IF(idata(35).GE.1) THEN
1249 rdatx(50+ilc+1) = rdatx(idata(36)+2)
1250 rdatx(50+ilc+2) = rdatx(idata(36)+3)
1251 END IF
1252 IF(iprint.GT.1) print 198, 50+ilc+1,rdatx(50+ilc+1)
1253 IF(rdatx(50+ilc+1).LT.xmsg) nsfc = 1
1254 IF(iprint.GT.1) print 198, 50+ilc+2,rdatx(50+ilc+2)
1255 IF(rdatx(50+ilc+2).LT.xmsg) nsfc = 1
1256 ilvl = ilvl + 1
1257 ilc = ilc + 11
1258 IF(iprint.GT.1) print *,'HAVE COMPLETED LEVEL ',ilvl,' WITH ',
1259 $ 'NSFC=',nsfc,'; GOING INTO NEXT LEVEL WITH ILC=',ilc
1260 uair_8 = 10.0e10
1261 CALL ufbint(lunit,uair_8,16,255,nlev,uair1//uair2//uair3)
1262 uair=uair_8
1263 IF(nlev.EQ.0) THEN
1264C.......................................................................
1265C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS ZERO --
1266 IF(nsfc.EQ.0) THEN
1267C ... NO UPPER AIR DATA PROCESSED
1268 print 217
1269 217 FORMAT(/' ##W3UNPK77: NO UPPER-AIR DATA PROCESSED FOR THIS',
1270 $ ' REPORT -- NLEV = 0 AND NSFC = 0'/)
1271 GO TO 99
1272 ELSE
1273C ... ONLY FIRST (SURFACE) UPPER AIR LEVEL DATA PROCESSED
1274 print 218
1275 218 FORMAT(/' ##W3UNPK77: NO UPPER-AIR DATA ABOVE FIRST (SURFACE) ',
1276 $ 'LEVEL PROCESSED FOR THIS REPORT -- NLEV = 0 AND NSFC > 0'/)
1277 GO TO 98
1278 END IF
1279C.......................................................................
1280 END IF
1281 IF(iprint.GT.1) print 1068, nlev
1282 1068 FORMAT(' THIS REPORT CONTAINS ',i3,' LEVELS OF DATA (NOT ',
1283 $ 'INCLUDING BOTTOM -SURFACE- LEVEL)')
1284 DO i = 1,nlev
1285 IF(iprint.GT.1) print 1079, ilc,ilvl
1286 1079 FORMAT(' ATTEMPTING NEW LEVEL WITH ILC =',i5,'; NO. LEVELS ',
1287 $ 'PROCESSED TO NOW =',i5)
1288
1289C HEIGHT ABOVE SEA-LEVEL (STORED AS REAL)
1290C (NOTE: At one time, possibly even now, the height above sea
1291C level was erroneously stored under mnemonic "HAST"
1292C when it should have been stored under mnemonic "HEIT".
1293C ("HAST" is defined as the height above the station.)
1294C Will test first for valid data in "HEIT" - if missing,
1295C then will use data in "HAST" - this will allow this
1296C routine to transition w/o change when the fix is made.)
1297
1298 IF(uair(1,i).LT.xmsg) THEN
1299 m = 1
1300 IF(iprint.GT.1) print 199, uair(1,i),m
1301 199 FORMAT(5x,'UAIR HERE IS: ',f17.4,'; INDEX IS: ',i3)
1302 rdatx(50+ilc) = nint(uair(1,i))
1303 ELSE
1304 m = 12
1305 IF(iprint.GT.1) print 199, uair(12,i),m
1306 IF(uair(12,i).LT.xmsg) rdatx(50+ilc) = nint(uair(12,i))
1307 END IF
1308 IF(iprint.GT.1) print 198, 50+ilc,rdatx(50+ilc)
1309 ilvl = ilvl + 1
1310
1311C HORIZONTAL WIND DIRECTION (STORED AS REAL)
1312
1313 m = 2
1314 IF(iprint.GT.1) print 199, uair(2,i),m
1315 IF(uair(2,i).LT.xmsg) rdatx(50+ilc+1) = nint(uair(2,i))
1316 IF(iprint.GT.1) print 198, 50+ilc+1,rdatx(50+ilc+1)
1317
1318C HORIZONTAL WIND SPEED (STORED AS REAL)
1319
1320 m = 3
1321 IF(iprint.GT.1) print 199, uair(3,i),m
1322 IF(uair(3,i).LT.xmsg) rdatx(50+ilc+2) =nint(uair(3,i) * 10.)
1323 IF(iprint.GT.1) print 198, 50+ilc+2,rdatx(50+ilc+2)
1324
1325C QUALITY CODE (STORED AS INTEGER)
1326
1327 m = 4
1328 IF(iprint.GT.1) print 199, uair(4,i),m
1329 IF(uair(4,i).LT.xmsg) idata(50+ilc+3) = nint(uair(4,i))
1330 IF(iprint.GT.1) print 197, 50+ilc+3,idata(50+ilc+3)
1331 197 FORMAT(5x,'IDATA(',i5,') STORED AS: ',i10)
1332
1333C VERTICAL WIND COMPONENT (W) (STORED AS REAL)
1334
1335 m = 5
1336 IF(iprint.GT.1) print 199, uair(5,i),m
1337 IF(uair(5,i).LT.xmsg) rdatx(50+ilc+4) = nint(uair(5,i) * 100.)
1338 IF(iprint.GT.1) print 198, 50+ilc+4,rdatx(50+ilc+4)
1339
1340C HORIZONTAL CONSENSUS NUMBER (STORED AS INTEGER)
1341C (NOTE: Prior to 2/18/1999, the horizonal consensus number was
1342C stored under mnemonic "ACAV1".
1343C From 2/18/1999 through 3/2002, the horizontal consensus
1344C number was stored under mnemonic "ACAVH".
1345C After 3/2002, the horizontal consensus number is no
1346C longer stored.
1347C Will test first for valid data in "ACAVH" - if missing,
1348C then will test for data in "ACAV1" - this will allow
1349C this routine to work properly with historical data.)
1350
1351 IF(iprint.GT.1) print 199, uair(6,i),m
1352 IF(iprint.GT.1) print 199, uair(13,i),m
1353 IF(uair(6,i).LT.xmsg) THEN
1354 m = 6
1355 idata(50+ilc+5) = nint(uair(6,i))
1356 ELSE
1357 m = 13
1358 IF(uair(13,i).LT.xmsg) idata(50+ilc+5) = nint(uair(13,i))
1359 END IF
1360 IF(iprint.GT.1) print 197, 50+ilc+5,idata(50+ilc+5)
1361
1362C VERTICAL CONSENSUS NUMBER (STORED AS INTEGER)
1363C (NOTE: Prior to 2/18/1999, the vertical consensus number was
1364C stored under mnemonic "ACAV2".
1365C From 2/18/1999 through 3/2002, the vertical consensus
1366C number was stored under mnemonic "ACAVV".
1367C After 3/2002, the vertical consensus number is no
1368C longer stored.
1369C Will test first for valid data in "ACAVV" - if missing,
1370C then will test for data in "ACAV2" - this will allow
1371C this routine to work properly with historical data.)
1372
1373 IF(iprint.GT.1) print 199, uair(7,i),m
1374 IF(iprint.GT.1) print 199, uair(14,i),m
1375 IF(uair(7,i).LT.xmsg) THEN
1376 m = 7
1377 idata(50+ilc+6) = nint(uair(7,i))
1378 ELSE
1379 m = 14
1380 IF(uair(14,i).LT.xmsg) idata(50+ilc+6) = nint(uair(14,i))
1381 END IF
1382 IF(iprint.GT.1) print 197, 50+ilc+6,idata(50+ilc+6)
1383
1384C SPECTRAL PEAK POWER (STORED AS REAL)
1385C (NOTE: After 3/2002, the spectral peak power is no longer
1386C stored.)
1387
1388 m = 8
1389 IF(iprint.GT.1) print 199, uair(8,i),m
1390 IF(uair(8,i).LT.xmsg) rdatx(50+ilc+7) = nint(uair(8,i))
1391 IF(iprint.GT.1) print 198, 50+ilc+7,rdatx(50+ilc+7)
1392
1393C HORIZONTAL WIND SPEED STANDARD DEVIATION (STORED AS REAL)
1394
1395 m = 9
1396 IF(iprint.GT.1) print 199, uair(9,i),m
1397 IF(uair(9,i).LT.xmsg) rdatx(50+ilc+8)=nint(uair(9,i) * 10.)
1398 IF(iprint.GT.1) print 198, 50+ilc+8,rdatx(50+ilc+8)
1399
1400C VERTICAL WIND COMPONENT STANDARD DEVIATION (STORED AS REAL)
1401
1402 m = 10
1403 IF(iprint.GT.1) print 199, uair(10,i),m
1404 IF(uair(10,i).LT.xmsg) rdatx(50+ilc+9) =nint(uair(10,i) * 10.)
1405 IF(iprint.GT.1) print 198, 50+ilc+9,rdatx(50+ilc+9)
1406
1407C MODE INFORMATION (STORED AS INTEGER)
1408C (NOTE: After 3/2002, the mode information is no longer stored.)
1409
1410 m = 11
1411 IF(iprint.GT.1) print 199, uair(11,i),m
1412 IF(uair(11,i).LT.xmsg) idata(50+ilc+10) = nint(uair(11,i))
1413 IF(iprint.GT.1) print 197, 50+ilc+10,idata(50+ilc+10)
1414C.......................................................................
1415 ilc = ilc + 11
1416 IF(iprint.GT.1) print *,'HAVE COMPLETED LEVEL ',ilvl,
1417 $ '; GOING INTO NEXT LEVEL WITH ILC=',ilc
1418 ENDDO
1419
1420C SET CATEGORY COUNTERS FOR UPPER-AIR DATA
1421
1422 98 CONTINUE
1423 idata(37) = ilvl
1424 idata(38) = 50
1425 99 CONTINUE
1426 IF(iprint.GT.1) print *, 'NSFC=',nsfc,'; IDATA(37)=',idata(37),
1427 $ '; IDATA(38)=',idata(38)
1428 rdata(1:1200) = rdatx(1:1200)
1429 RETURN
1430 END
1431C> @brief Fills in header in o-put array - vadw rpt.
1432C> @author Dennis Keyser @date 1997-06-02
1433
1434C> For report (subset) read out of bufr message (passed in
1435C> internally via bufrlib storage), calls bufrlib routine to decode
1436C> header data for nexrad (vad) wind report. Header is then filled
1437C> into the output array which holds a single vad wind report in the
1438C> quasi-office note 29 unpacked format.
1439C>
1440C> ### Program History Log:
1441C> Date | Programmer | Comment
1442C> -----|------------|--------
1443C> 1997-06-02 | Dennis Keyser NP22 | Initial.
1444C>
1445C> @param[in] LUNIT Fortran unit number for input data file
1446C> @param[inout] RDATA Single wind profiler report in a quasi-office note 29 unpacked format with [out] header information filled in [in] all data initialized as missing
1447C> @param[out] IRET Return code as described in w3unpk77 docblock
1448C>
1449C> @author Dennis Keyser @date 1997-06-02
1450 SUBROUTINE unpk7706(LUNIT,RDATA,IRET)
1451 CHARACTER*8 STNID,COB
1452 CHARACTER*45 HDR1
1453 INTEGER IDATA(1200)
1454 REAL(8) HDR_8(9)
1455 REAL HDR(9),RDATA(*),RDATX(1200)
1456 COMMON /pk77bb/kdate(8),ldate(8),iprint
1457
1458 SAVE
1459
1460 equivalence(rdatx,idata),(stnid,hdr_8(4)),(cob,iob)
1461 DATA xmsg/99999./,imsg/99999/
1462 DATA hdr1/'CLAT CLON SELV RPID YEAR MNTH DAYS HOUR MINU '/
1463 rdatx(1:1200) = rdata(1:1200)
1464 hdr_8 = 10.0e10
1465 CALL ufbint(lunit,hdr_8,9,1,nlev,hdr1);hdr=hdr_8
1466 IF(nlev.NE.1) THEN
1467C.......................................................................
1468C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS NOT WHAT IS EXPECTED --
1469C SET IRET = 6 AND RETURN
1470 print 217, nlev
1471 217 FORMAT(/' ##W3UNPK77: THE NUMBER OF DECODED "LEVELS" (=',i5,') ',
1472 $ 'IS NOT WHAT IS EXPECTED (1) - IRET = 6'/)
1473 iret = 6
1474 RETURN
1475C.......................................................................
1476 END IF
1477
1478C LATITUDE (STORED AS REAL)
1479
1480 m = 1
1481 IF(iprint.GT.1) print 199, hdr(1),m
1482 199 FORMAT(5x,'HDR HERE IS: ',f17.4,'; INDEX IS: ',i3)
1483 IF(hdr(1).LT.xmsg) THEN
1484 rdatx(1) = nint(hdr(1) * 100.)
1485 nnnnn = 1
1486 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1487 198 FORMAT(5x,'RDATA(',i5,') STORED AS: ',f10.2)
1488 ELSE
1489 iret = 2
1490 print 102
1491 102 FORMAT(' *** W3UNPK77 ERROR: LAT MISSING FOR VAD WIND REPORT'/)
1492 RETURN
1493 END IF
1494
1495C LONGITUDE (STORED AS REAL)
1496
1497 m = 2
1498 IF(iprint.GT.1) print 199, hdr(2),m
1499 IF(hdr(2).LT.xmsg) THEN
1500 rdatx(2) = nint(mod((36000.-(hdr(2)*100.)),36000.))
1501 nnnnn = 2
1502 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1503 ELSE
1504 iret = 2
1505 print 104
1506 104 FORMAT(' *** W3UNPK77 ERROR: LON MISSING FOR VAD WIND REPORT'/)
1507 RETURN
1508 END IF
1509
1510C STATION ELEVATION (FROM REPORTED STN. HGHT; STORED IN OUTPUT)
1511C (STORED AS REAL)
1512
1513 m = 3
1514 IF(iprint.GT.1) print 199, hdr(3),m
1515 IF(hdr(3).LT.xmsg) rdatx(7) = nint(hdr(3))
1516 nnnnn = 7
1517 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1518
1519C STATION IDENTIFICATION (STORED AS CHARACTER)
1520C ('99'//LAST 3-CHARACTERS OF PRODUCT SOURCE ID//' ')
1521
1522 m = 4
1523 IF(iprint.GT.1) print 299, stnid,m
1524 299 FORMAT(5x,'HDR HERE IS: ',9x,a8,'; INDEX IS: ',i3)
1525 cob(1:4) = '99'//stnid(2:3)
1526 idata(11) = iob
1527 nnnnn = 11
1528 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1529 196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a4,'"')
1530 cob(1:4) = stnid(4:4)//' '
1531 idata(12) = iob
1532 nnnnn = 12
1533 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1534
1535cvvvvvdak port
1536C LOAD THE YEAR/MONTH (STORED AS CHARACTER IN FORM YYMM)
1537caaaaadak port
1538
1539 m = 5
1540 IF(iprint.GT.1) print 199, hdr(5),m
1541 iyear = imsg
1542 IF(hdr(5).LT.xmsg) iyear = nint(hdr(5))
1543 m = 6
1544 IF(iprint.GT.1) print 199, hdr(6),m
1545 IF(hdr(6).LT.xmsg.AND.iyear.LT.imsg) THEN
1546cvvvvvdak port
1547 iyear = mod(iyear,100)
1548caaaaadak port
1549 iyear = nint(hdr(6)) + (iyear * 100)
1550cvvvvvdak port
1551cdak WRITE(COB,'(I6.6,2X)') IYEAR
1552 WRITE(cob,'(I4.4,4X)') iyear
1553caaaaadak port
1554 idata(5) = iob
1555 nnnnn = 5
1556 IF(iprint.GT.1) print 9196, nnnnn,cob(1:6)
1557 9196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a6,'"')
1558 ELSE
1559 GO TO 30
1560 END IF
1561
1562C LOAD THE DAY/HOUR (STORED AS CHARACTER IN FORM DDHH)
1563C AND THE OBSERVATION TIME (STORED AS REAL)
1564
1565 m = 7
1566 IF(iprint.GT.1) print 199, hdr(7),m
1567 iday = imsg
1568 IF(hdr(7).LT.xmsg) iday = nint(hdr(7))
1569 m = 8
1570 IF(iprint.GT.1) print 199, hdr(8),m
1571 IF(hdr(8).LT.xmsg.AND.iday.LT.imsg) THEN
1572 ihrt = nint(hdr(8))
1573 m = 9
1574 IF(iprint.GT.1) print 199, hdr(9),m
1575 IF(hdr(9).GE.xmsg) GO TO 30
1576 rmnt = hdr(9)
1577 rdatx(4) = nint((ihrt * 100.) + (rmnt * 100.)/60.)
1578 nnnnn = 4
1579 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1580 ihrt = ihrt + (iday * 100)
1581 WRITE(cob(1:4),'(I4.4)') ihrt
1582 idata(6) = iob
1583 nnnnn = 6
1584 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1585 ELSE
1586 GO TO 30
1587 END IF
1588 rdata(1:1200) = rdatx(1:1200)
1589 RETURN
1590 30 CONTINUE
1591 iret = 4
1592 RETURN
1593 END
1594C> @brief Fills cat. 4 into o-put array - vadw rpt
1595C> @author Dennis Keyser @date 1997-06-02
1596
1597C> For report (subset) read out of bufr message (passed in
1598C> internally via bufrlib storage), calls bufrlib routine to decode
1599C> upper-air data for nexrad (vad) wind report. Upper-air data are
1600C> then filled into the output array as category 4. The ouput array
1601C> holds a single vad wind report in the quasi-office note 29
1602C> unpacked format.
1603C>
1604C> ### Program History Log:
1605C> Date | Programmer | Comment
1606C> -----|------------|--------
1607C> 1997-06-02 | Dennis Keyser NP22 | Initial.
1608C>
1609C> @param[in] LUNIT Fortran unit number for input data file
1610C> @param[inout] RDATA Single wind profiler report in a quasi-office note 29 unpacked format with [out] header information filled in [in] all data initialized as missing
1611C> @param[out] IRET Return code as described in w3unpk77 docblock
1612C>
1613C> @author Dennis Keyser @date 1997-06-02
1614 SUBROUTINE unpk7707(LUNIT,RDATA,IRET)
1615 CHARACTER*1 CRMS(0:12)
1616 CHARACTER*8 COB
1617 CHARACTER*25 UAIR1
1618 INTEGER IDATA(1200)
1619 REAL(8) UAIR_8(5,255)
1620 REAL UAIR(5,255),RDATA(*),RDATX(1200)
1621 COMMON /pk77bb/kdate(8),ldate(8),iprint
1622
1623 SAVE
1624
1625 equivalence(rdatx,idata),(cob,iob)
1626 DATA xmsg/99999./
1627 DATA uair1/'HEIT WDIR WSPD RMSW QMWN '/
1628 DATA crms/' ','A',' ','B',' ','C',' ','D',' ','E',' ','F',' '/
1629 rdatx(1:1200) = rdata(1:1200)
1630 nsfc = 0
1631 ilvl = 0
1632 ilc = 0
1633C FIRST CATEGORY 4 LEVEL UPPER-AIR LEVEL CONTAINS ONLY HEIGHT (ELEV)
1634 IF(iprint.GT.1) print 1078, ilc,ilvl
1635 1078 FORMAT(' ATTEMPTING 1ST (SFC) LVL WITH ILC =',i5,'; NO. LEVELS ',
1636 $ 'PROCESSED TO NOW =',i5)
1637 rdatx(43+ilc) = rdatx(7)
1638 IF(iprint.GT.1) print 198, 43+ilc,rdatx(43+ilc)
1639 198 FORMAT(5x,'RDATA(',i5,') STORED AS: ',f10.2)
1640 IF(rdatx(43+ilc).LT.xmsg) nsfc = 1
1641C NOTE: The following was added because of a problem on the sgi-ha
1642C platform related to equivalencing character and non-character
1643C -- for now the addition of these two lines will set the quality
1644C mark for sfc. cat . 4 level to the correct value of " "
1645C rather than to "9999" - Mary McCann notified SGI of this
1646C problem on 08-21-1998
1647 cob = ' '
1648 idata(43+ilc+3) = iob
1649 ilvl = ilvl + 1
1650 ilc = ilc + 4
1651 IF(iprint.GT.1) print *,'HAVE COMPLETED LEVEL ',ilvl,' WITH ',
1652 $ 'NSFC=',nsfc,'; GOING INTO NEXT LEVEL WITH ILC=',ilc
1653 uair_8 = 10.0e10
1654 CALL ufbint(lunit,uair_8,5,255,nlev,uair1);uair=uair_8
1655 IF(nlev.EQ.0) THEN
1656C.......................................................................
1657C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS ZERO --
1658 IF(nsfc.EQ.0) THEN
1659C ... NO UPPER AIR DATA PROCESSED
1660 print 217
1661 217 FORMAT(/' ##W3UNPK77: NO UPPER-AIR DATA PROCESSED FOR THIS',
1662 $ ' REPORT -- NLEV = 0 AND NSFC = 0'/)
1663 GO TO 99
1664 ELSE
1665C ... ONLY FIRST (SURFACE) UPPER AIR LEVEL DATA PROCESSED
1666 print 218
1667 218 FORMAT(/' ##W3UNPK77: NO UPPER-AIR DATA ABOVE FIRST (SURFACE) ',
1668 $ 'LEVEL PROCESSED FOR THIS REPORT -- NLEV = 0 AND NSFC > 0'/)
1669 GO TO 98
1670 END IF
1671C.......................................................................
1672 END IF
1673 IF(iprint.GT.1) print 1068, nlev
1674 1068 FORMAT(' THIS REPORT CONTAINS ',i3,' LEVELS OF DATA (NOT ',
1675 $ 'INCLUDING BOTTOM -SURFACE- LEVEL)')
1676 DO i = 1,nlev
1677 IF(iprint.GT.1) print 1079, ilc,ilvl
1678 1079 FORMAT(' ATTEMPTING NEW LEVEL WITH ILC =',i5,'; NO. LEVELS ',
1679 $ 'PROCESSED TO NOW =',i5)
1680
1681C HEIGHT ABOVE SEA-LEVEL (STORED AS REAL)
1682
1683 m = 1
1684 IF(iprint.GT.1) print 199, uair(1,i),m
1685 199 FORMAT(5x,'UAIR HERE IS: ',f17.4,'; INDEX IS: ',i3)
1686 IF(uair(1,i).LT.xmsg) THEN
1687 rdatx(43+ilc) = nint(uair(1,i))
1688
1689C ... WE HAVE A VALID CATEGORY 4 LEVEL -- THERE IS A VALID HEIGHT
1690
1691 ilvl = ilvl + 1
1692 ELSE
1693
1694C ... WE DO NOT HAVE A VALID CATEGORY 4 LEVEL -- THERE IS NO VALID
1695C HEIGHT GO ON TO NEXT INPUT LEVEL
1696
1697 IF(iprint.GT.1) print *, 'HEIGHT MISSING ON INPUT ',
1698 $ ' LEVEL ',i,', ALL OTHER DATA SET TO MSG ON THIS LEVEL'
1699 GO TO 10
1700 END IF
1701 IF(iprint.GT.1) print 198, 43+ilc,rdatx(43+ilc)
1702
1703C HORIZONTAL WIND DIRECTION (STORED AS REAL)
1704
1705 m = 2
1706 IF(iprint.GT.1) print 199, uair(2,i),m
1707 IF(uair(2,i).LT.xmsg) rdatx(43+ilc+1) = nint(uair(2,i))
1708 IF(iprint.GT.1) print 198, 43+ilc+1,rdatx(43+ilc+1)
1709
1710C HORIZONTAL WIND SPEED (STORED AS REAL) (OUTPUT STORED
1711C AS METERS/SECOND TIMES TEN, NOT IN KNOTS AS ON29 WOULD
1712C INDICATE FOR CAT. 4 WIND SPEED)
1713
1714 m = 3
1715 IF(iprint.GT.1) print 199, uair(3,i),m
1716 IF(uair(3,i).LT.xmsg) rdatx(43+ilc+2) =nint(uair(3,i) * 10.)
1717 IF(iprint.GT.1) print 198, 43+ilc+2,rdatx(43+ilc+2)
1718
1719C CONFIDENCE LEVEL (BASED ON RMS VECTOR WIND ERROR)
1720C (NOTE: CONVERTED TO ORIGINAL LETTER INDICATOR AND PACKED
1721C IN BYTE 4 OF CATEGORY 4 QUALITY MARKER LOCATION -- SEE
1722C W3UNPK77 DOCBLOCK REMARKS 5. FOR UNPACKED VAD WIND REPORT
1723C LAYOUT FOR VALUES
1724
1725 m = 4
1726 IF(iprint.GT.1) print 199, uair(4,i),m
1727 IF(uair(4,i).LT.xmsg) THEN
1728
1729C ... CONVERT FROM M/S TO KNOTS
1730
1731CDAKCDAK KRMS = INT(1.93333 * UAIR(4,I))
1732 krms = int(1.9425 * uair(4,i))
1733 cob = ' '
1734 IF(krms.LT.13) THEN
1735 cob(4:4) = crms(krms)
1736 ELSE
1737 cob(4:4) = 'G'
1738 END IF
1739 idata(43+ilc+3) = iob
1740 END IF
1741 IF(iprint.GT.1) print 196, 43+ilc+3,cob(1:4)
1742 196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a4,'"')
1743
1744C ON29 WIND QUALITY MARKER (CURRENTLY NOT STORED)
1745
1746 m = 5
1747 IF(iprint.GT.1) print 199, uair(5,i),m
1748C.......................................................................
1749 ilc = ilc + 4
1750 IF(iprint.GT.1) print *,'HAVE COMPLETED LEVEL ',ilvl,
1751 $ '; GOING INTO NEXT LEVEL WITH ILC=',ilc
1752
1753 10 CONTINUE
1754 ENDDO
1755
1756C SET CATEGORY COUNTERS FOR UPPER-AIR DATA
1757
1758 98 CONTINUE
1759 idata(19) = ilvl
1760 99 CONTINUE
1761 IF(idata(19).EQ.0) THEN
1762 idata(20) = 0
1763 iret = 5
1764 ELSE
1765 idata(20) = 43
1766 END IF
1767 IF(iprint.GT.1) print *, 'NSFC=',nsfc,'; IDATA(37)=',idata(37),
1768 $ '; IDATA(38)=',idata(38)
1769 rdata(1:1200) = rdatx(1:1200)
1770 RETURN
1771 END
1772C> @brief Fills in header in o-put array - goes snd
1773C> @author Dennis Keyser @date 1998-07-09
1774
1775C> For report (subset) read out of bufr message (passed in
1776C> internally via bufrlib storage), calls bufrlib routine to decode
1777C> header data for goes sounding report. Header is then filled into
1778C> the output array which holds a single goes sounding report in the
1779C> quasi-office note 29 unpacked format.
1780C>
1781C> ### Program History Log:
1782C> Date | Programmer | Comment
1783C> -----|------------|--------
1784C> 1997-06-05 | Dennis Keyser NP22 | Initial.
1785C> 1998-07-09 | Dennis Keyser | Changed char. 6 of goes stnid to be unique for two different even or odd satellite id's (every other even or odd sat. id now gets same char. 6 tag)
1786C>
1787C> @param[in] LUNIT Fortran unit number for input data file
1788C> @param[inout] RDATA Single wind profiler report in a quasi-office note 29 unpacked format with [out] header information filled in [in] all data initialized as missing
1789C> @param[in] KOUNT Number of reports processed including this one
1790C> @param[out] IRET Return code as described in w3unpk77 docblock
1791C>
1792C> @author Dennis Keyser @date 1998-07-09
1793 SUBROUTINE unpk7708(LUNIT,RDATA,KOUNT,IRET)
1794 CHARACTER*1 C6TAG(3,0:3)
1795 CHARACTER*8 STNID,COB
1796 CHARACTER*35 HDR1,HDR2
1797 INTEGER IDATA(1200)
1798 REAL(8) HDR_8(12)
1799 REAL HDR(12),RDATA(*),RDATX(1200)
1800 COMMON /pk77bb/kdate(8),ldate(8),iprint
1801 COMMON /pk77ff/ifov(3),kntsat(250:260)
1802
1803 SAVE
1804
1805 equivalence(rdatx,idata),(cob,iob)
1806 DATA xmsg/99999./,imsg/99999/
1807 DATA hdr1/'CLAT CLON ACAV GSDP QMRK SAID YEAR '/
1808 DATA hdr2/'MNTH DAYS HOUR MINU SECO '/
1809
1810
1811C CURRENT LIST OF SATELLITE IDENTIFIERS (BUFR C.F. 0-01-007)
1812C -----------------------------------------------------------
1813
1814C GOES 6 -- 250 GOES 9 -- 253 GOES 12 -- 256
1815C GOES 7 -- 251 GOES 10 -- 254 GOES 13 -- 257
1816C GOES 8 -- 252 GOES 11 -- 255 GOES 14 -- 258
1817
1818C IDSAT = -- EVEN1 -- --- ODD1 -- -- EVEN2 -- --- ODD2 --
1819C Sat. No. - 252,256,... 253,257,... 250,254,... 251,255,...
1820C IRTYP = CLR COR UNKN CLR COR UNKN CLR COR UNKN CLR COR UNKN
1821C --- --- ---- --- --- ---- --- --- ---- --- --- ----
1822
1823 DATA c6tag/'I','J','?', 'L','M','?', 'O','P','?', 'Q','R','?' /
1824
1825 rdatx(1:1200) = rdata(1:1200)
1826 hdr_8 = 10.0e10
1827 CALL ufbint(lunit,hdr_8,12,1,nlev,hdr1//hdr2);hdr=hdr_8
1828 IF(nlev.NE.1) THEN
1829C.......................................................................
1830C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS NOT WHAT IS EXPECTED --
1831C SET IRET = 6 AND RETURN
1832 print 217, nlev
1833 217 FORMAT(/' ##W3UNPK77: THE NUMBER OF DECODED "LEVELS" (=',i5,') ',
1834 $ 'IS NOT WHAT IS EXPECTED (1) - IRET = 6'/)
1835 iret = 6
1836 RETURN
1837C.......................................................................
1838 END IF
1839
1840C LATITUDE (STORED AS REAL)
1841
1842 m = 1
1843 IF(iprint.GT.1) print 199, hdr(1),m
1844 199 FORMAT(5x,'HDR HERE IS: ',f17.4,'; INDEX IS: ',i3)
1845 IF(hdr(1).LT.xmsg) THEN
1846 rdatx(1) = nint(hdr(1) * 100.)
1847 nnnnn = 1
1848 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1849 198 FORMAT(5x,'RDATA(',i5,') STORED AS: ',f10.2)
1850 ELSE
1851 iret = 2
1852 print 102
1853 102 FORMAT(' *** W3UNPK77 ERROR: LAT MISSING FOR GOES SOUNDING'/)
1854 RETURN
1855 END IF
1856
1857C LONGITUDE (STORED AS REAL)
1858
1859 m = 2
1860 IF(iprint.GT.1) print 199, hdr(2),m
1861 IF(hdr(2).LT.xmsg) THEN
1862 rdatx(2) = nint(mod((36000.-(hdr(2)*100.)),36000.))
1863 nnnnn = 2
1864 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1865 ELSE
1866 iret = 2
1867 print 104
1868 104 FORMAT(' *** W3UNPK77 ERROR: LON MISSING FOR GOES SOUNDING'/)
1869 RETURN
1870 END IF
1871
1872C NUMBER OF FIELDS OF VIEW - SAMPLE SIZE (STORED AS INTEGER)
1873
1874 m = 3
1875 IF(iprint.GT.1) print 199, hdr(3),m
1876 IF(hdr(3).LT.xmsg) idata(3) = nint(hdr(3))
1877 nnnnn = 3
1878 IF(iprint.GT.1) print 197, nnnnn,idata(nnnnn)
1879 197 FORMAT(5x,'IDATA(',i5,') STORED AS: ',i10)
1880
1881C STATION ELEVATION (FROM HEIGHT OF FIRST -SURFACE- LEVEL)
1882C (STORED AS REAL) -- STORED IN SUBROUTINE UNPK7709
1883
1884
1885C RETRIEVAL TYPE (GEOSTATIONARY SATELLITE DATA-PROCESSING
1886C TECHNIQUE USED) (STORED AS INTEGER)
1887
1888 m = 4
1889 IF(iprint.GT.1) print 199, hdr(4),m
1890 IF(hdr(4).LT.xmsg) idata(8) = nint(hdr(4))
1891 irtyp = 3
1892 IF(idata(8).EQ.21) THEN
1893 irtyp = 1
1894 ELSE IF(idata(8).EQ.23) THEN
1895 irtyp = 2
1896 END IF
1897 nnnnn = 8
1898 IF(iprint.GT.1) print 197, nnnnn,idata(nnnnn)
1899
1900C PRODUCT QUALITY BIT FLAGS - QUALITY INFO. (STORED AS INTEGER)
1901
1902 m = 5
1903 IF(iprint.GT.1) print 199, hdr(5),m
1904 IF(hdr(5).LT.xmsg) idata(10) = nint(hdr(5))
1905 nnnnn = 10
1906 IF(iprint.GT.1) print 197, nnnnn,idata(nnnnn)
1907
1908C STATION IDENTIFICATION (STORED AS CHARACTER)
1909C (FIRST 5-CHARACTERS OBTAINED FROM 5-DIGIT COUNT NUMBER,
1910C 6'TH CHARACTER OBTAINED FROM SAT. ID/RETRIEVAL TYPE TAG)
1911
1912 WRITE(stnid(1:5),'(I5.5)') min(kount,99999)
1913
1914C DECODE THE SATELLITE ID
1915
1916 m = 6
1917 idsat = 2
1918 IF(iprint.GT.1) print 199, hdr(6),m
1919 IF(hdr(6).LT.xmsg) THEN
1920 idsat = mod(nint(hdr(6)),4)
1921 IF(nint(hdr(6)).GT.249.AND.nint(hdr(6)).LT.260) THEN
1922 kntsat(nint(hdr(6))) = kntsat(nint(hdr(6))) + 1
1923 ELSE
1924 kntsat(260) = kntsat(260) + 1
1925 END IF
1926 END IF
1927 IF(iprint.GT.1) print 2197, idsat,irtyp
1928 2197 FORMAT(5x,'IDSAT IS: ',i10,', IRTYP IS: ',i10)
1929 stnid(6:6) = c6tag(irtyp,idsat)
1930 cob(1:4) = stnid(1:4)
1931 idata(11) = iob
1932 nnnnn = 11
1933 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1934 196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a4,'"')
1935 cob(1:4) = stnid(5:6)//' '
1936 idata(12) = iob
1937 nnnnn = 12
1938 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1939
1940cvvvvvdak port
1941C LOAD THE YEAR/MONTH (STORED AS CHARACTER IN FORM YYMM)
1942caaaaadak port
1943
1944 m = 7
1945 IF(iprint.GT.1) print 199, hdr(7),m
1946 iyear = imsg
1947 IF(hdr(7).LT.xmsg) iyear = nint(hdr(7))
1948 m = 8
1949 IF(iprint.GT.1) print 199, hdr(8),m
1950 IF(hdr(8).LT.xmsg.AND.iyear.LT.imsg) THEN
1951cvvvvvdak port
1952 iyear = mod(iyear,100)
1953caaaaadak port
1954 iyear = nint(hdr(8)) + (iyear * 100)
1955cvvvvvdak port
1956cdak WRITE(COB,'(I6.6,2X)') IYEAR
1957 WRITE(cob,'(I4.4,4X)') iyear
1958caaaaadak port
1959 idata(5) = iob
1960 nnnnn = 5
1961 IF(iprint.GT.1) print 9196, nnnnn,cob(1:6)
1962 9196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a6,'"')
1963 ELSE
1964 GO TO 30
1965 END IF
1966
1967C LOAD THE DAY/HOUR (STORED AS CHARACTER IN FORM DDHH)
1968C AND THE OBSERVATION TIME (STORED AS REAL)
1969
1970 m = 9
1971 IF(iprint.GT.1) print 199, hdr(9),m
1972 m = 10
1973 IF(iprint.GT.1) print 199, hdr(10),m
1974 IF(hdr(10).LT.xmsg.AND.hdr(9).LT.imsg) THEN
1975 m = 11
1976 IF(iprint.GT.1) print 199, hdr(11),m
1977 IF(hdr(11).GE.xmsg) GO TO 30
1978 m = 12
1979 IF(iprint.GT.1) print 199, hdr(12),m
1980 IF(hdr(12).GE.xmsg) GO TO 30
1981 rdatx(4) = nint(((hdr(10) + ((hdr(11) * 60.) + hdr(12))/3600.)
1982 $ * 100.) + 0.0000000001)
1983 nnnnn = 4
1984 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
1985 idayhr = nint(hdr(10)) + (nint(hdr(9)) * 100)
1986 WRITE(cob(1:4),'(I4.4)') idayhr
1987 idata(6) = iob
1988 nnnnn = 6
1989 IF(iprint.GT.1) print 196, nnnnn,cob(1:4)
1990 ELSE
1991 GO TO 30
1992 END IF
1993 rdata(1:1200) = rdatx(1:1200)
1994 RETURN
1995 30 CONTINUE
1996 iret = 4
1997 RETURN
1998 END
1999C> @brief Fills cat. 12,8 to o-put array -goes sndg
2000C> @author Dennis Keyser @date 1997-06-05
2001
2002C> For report (subset) read out of bufr message (passed in
2003C> internally via bufrlib storage), calls bufrlib routine to decode
2004C> upper-air (sounding) and additional data for goes sounding. Upper-
2005C> air data are then filled into the output array as category 12
2006C> (satellite sounding) and additional data are filled as category 8.
2007C> The ouput array holds a single goes sounding in the quasi-office
2008C> note 29 unpacked format.
2009C>
2010C> ### Program History Log:
2011C> Date | Programmer | Comment
2012C> -----|------------|--------
2013C> 1997-06-05 | Dennis Keyser NP22 | Initial.
2014C>
2015C> @param[in] LUNIT Fortran unit number for input data file
2016C> @param[inout] RDATA Single wind profiler report in a quasi-office note 29 unpacked format with [out] header information filled in [in] all data initialized as missing
2017C> @param[out] IRET Return code as described in w3unpk77 docblock
2018C>
2019C> @author Dennis Keyser @date 1997-06-05
2020 SUBROUTINE unpk7709(LUNIT,RDATA,IRET)
2021 CHARACTER*1 CQMFLG
2022 CHARACTER*8 COB
2023 CHARACTER*37 CAT8A,CAT8B
2024 CHARACTER*48 UAIR1,RAD1
2025 INTEGER IDATA(1200),ICDFG(12)
2026 REAL(8) UAIR_8(4,255),CAT8_8(12),RTCSF_8,RAD_8(2,255)
2027 REAL UAIR(4,255),CAT8(12),RDATA(*),RDATX(1200),SC8(12),RAD(2,255)
2028 COMMON /pk77bb/kdate(8),ldate(8),iprint
2029 COMMON /pk77ff/ifov(3),kntsat(250:260)
2030
2031 SAVE
2032
2033 equivalence(rdatx,idata),(cob,iob)
2034 DATA xmsg/99999./,ymsg/99999.8/
2035 DATA uair1/'PRLC HGHT TMDB TMDP '/
2036 DATA rad1 /'CHNM TMBR '/
2037 DATA cat8a/'GLFTI PH2O PH2O19 PH2O97 PH2O73 TMSK '/
2038 DATA cat8b/'GCDTT CDTP CLAM SIDU SOEL ELEV '/
2039 DATA icdfg/ 50 , 51 , 52 , 53 , 54 , 55 , 56 ,57 ,58,59, 60 , 61 /
2040 DATA sc8/100.,100.,100.,100.,100.,100.,100.,10.,1.,1.,100.,100./
2041 rdatx(1:1200) = rdata(1:1200)
2042
2043C ALL NON-RADIANCE DATA WILL BE Q.C.'D ACCORDING TO NUMBER OF FIELDS-OF-
2044C VIEW FOR RETRIEVAL: 0-2 --> BAD, 3-9 --> SUSPECT, 10-25 OR MISSING
2045C --> NEUTRAL
2046
2047 cqmflg = ' '
2048 IF(idata(3).LT.3) THEN
2049 cqmflg = 'F'
2050 ifov(1) = ifov(1) + 1
2051 ELSE IF(idata(3).LT.10.OR.idata(10).EQ.1) THEN
2052 cqmflg = 'Q'
2053 IF(idata(3).LT.10) ifov(2) = ifov(2) + 1
2054 END IF
2055 IF(idata(3).GT.9) ifov(3) = ifov(3) + 1
2056
2057C***********************************************************************
2058C FILL CATEGORY 12 PART OF OUTPUT
2059C***********************************************************************
2060
2061 ilvl = 0
2062 ilc = 0
2063 uair_8 = 10.0e10
2064 CALL ufbint(lunit,uair_8,4,255,nlev,uair1);uair=uair_8
2065 IF(nlev.EQ.0) THEN
2066C.......................................................................
2067C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS ZERO --
2068 print 217
2069 217 FORMAT(/' ##W3UNPK77: NO UPPER-AIR (SOUNDING) DATA PROCESSED ',
2070 $ 'FOR THIS REPORT -- NLEV = 0'/)
2071 GO TO 98
2072 ELSE IF(nlev.GT.50) THEN
2073C.......................................................................
2074C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS GREATER THAN LIMIT OF 50 --
2075 print 218
2076 218 FORMAT(/' ##W3UNPK77: NO UPPER-AIR (SOUNDING) DATA PROCESSED ',
2077 $ 'FOR THIS REPORT -- NLEV > 50'/)
2078 GO TO 98
2079C.......................................................................
2080 END IF
2081 IF(iprint.GT.1) print 1068, nlev
2082 1068 FORMAT(' THIS REPORT CONTAINS',i4,' INPUT LEVELS OF SOUNDING ',
2083 $ 'DATA')
2084 DO i = 1,nlev
2085 IF(iprint.GT.1) print 1079, i,ilc,ilvl
2086 1079 FORMAT(' ATTEMPTING NEW CAT. 12 INPUT LEVEL NUMBER',i4,' WITH ',
2087 $ 'ILC =',i5,'; NO. LEVELS PROCESSED TO NOW =',i5)
2088
2089C LEVEL PRESSURE (STORED AS REAL)
2090
2091 m = 1
2092 IF(iprint.GT.1) print 199, uair(1,i),m
2093 199 FORMAT(5x,'UAIR HERE IS: ',f17.4,'; INDEX IS: ',i3)
2094 IF(i.EQ.1) THEN
2095 psfc = uair(1,i) * 0.1
2096 ELSE IF(uair(1,i)*0.1.GE.ymsg) THEN
2097C WE DO NOT HAVE A VALID CATEGORY 12 LEVEL -- THERE IS NO VALID PRESSURE
2098C -- GO ON TO NEXT INPUT LEVEL (IF SFC LEVEL MSG, CONTINUE PROCESSING)
2099 IF(iprint.GT.1) print *, 'PRESSURE MISSING ON INPUT',
2100 $ ' LEVEL ',i,', SKIP THE PROCESSING OF THIS LEVEL'
2101 GO TO 10
2102 ELSE IF(uair(1,i)*0.1.GE.psfc) THEN
2103C WE DO NOT HAVE A VALID CATEGORY 12 LEVEL -- THE INPUT LEVEL PRESSURE
2104C IS BELOW THE SURFACE PRESSURE -- GO ON TO THE NEXT INPUT LEVEL
2105 IF(iprint.GT.1) print *,'PRESSURE ON INPUT LEVEL ',i,
2106 $ ' IS BELOW GROUND, SKIP THE PROCESSING OF THIS LEVEL'
2107 GO TO 10
2108 END IF
2109
2110C WE HAVE A VALID CATEGORY 12 LEVEL -- THERE IS A VALID PRESSURE
2111
2112 IF(uair(1,i)*0.1.LT.xmsg) rdatx(43+ilc) = nint(uair(1,i)*0.1)
2113 ilvl = ilvl + 1
2114 IF(iprint.GT.1) print 198, 43+ilc,rdatx(43+ilc)
2115 198 FORMAT(5x,'RDATA(',i5,') STORED AS: ',f10.2)
2116
2117C GEOPOTENTIAL HEIGHT (STORED AS REAL)
2118
2119 m = 2
2120 IF(iprint.GT.1) print 199, uair(2,i),m
2121 IF(uair(2,i).LT.xmsg) rdatx(43+ilc+1) = nint(uair(2,i))
2122 IF(iprint.GT.1) print 198, 43+ilc+1,rdatx(43+ilc+1)
2123 IF(i.EQ.1) THEN
2124 IF(iprint.GT.1) print *, 'THIS IS SURFACE LEVEL, SO ',
2125 $ 'STORE HEIGHT ALSO AS ELEVATION IN HEADER'
2126 IF(uair(2,1).LT.xmsg) rdatx(7) = nint(uair(2,1))
2127 nnnnn = 7
2128 IF(iprint.GT.1) print 198, nnnnn,rdatx(nnnnn)
2129 END IF
2130
2131C TEMPERATURE (STORED AS REAL)
2132
2133 m = 3
2134 IF(iprint.GT.1) print 199, uair(3,i),m
2135 itmp = nint(uair(3,i)*100.)
2136 IF(uair(3,i).LT.xmsg)
2137 $ rdatx(43+ilc+2) = nint((itmp - 27315) * 0.1)
2138 IF(iprint.GT.1) print 198, 43+ilc+2,rdatx(43+ilc+2)
2139
2140C DEWPOINT TEMPERATURE (STORED AS REAL)
2141
2142 m = 4
2143 IF(iprint.GT.1) print 199, uair(4,i),m
2144 itmp = nint(uair(4,i)*100.)
2145 IF(uair(4,i).LT.xmsg)
2146 $ rdatx(43+ilc+3) = nint((itmp - 27315) * 0.1)
2147 IF(iprint.GT.1) print 198, 43+ilc+3,rdatx(43+ilc+3)
2148
2149C QUALITY MARKERS (STORED AS CHARACTER)
2150
2151 cob = cqmflg//cqmflg//cqmflg//' '
2152 idata(43+ilc+6) = iob
2153 IF(iprint.GT.1) print 196, 43+ilc+6,cob(1:4)
2154 196 FORMAT(5x,'IDATA(',i5,') STORED IN CHARACTER AS: "',a4,'"')
2155C.......................................................................
2156 ilc = ilc + 7
2157 IF(i+1.LE.nlev.AND.iprint.GT.1) print *,'HAVE COMPLETED ',
2158 $ 'LEVEL ',ilvl,'; GOING INTO NEXT LEVEL WITH ILC=',ilc
2159
2160 10 CONTINUE
2161 ENDDO
2162
2163C SET CATEGORY COUNTERS FOR CATEGORY 12 (SOUNDING) DATA
2164
2165 idata(39) = ilvl
2166 98 CONTINUE
2167 IF(iprint.GT.1) print *, idata(39),' CAT. 12 LEVELS PROCESSED'
2168 IF(idata(39).GT.0) idata(40) = 43
2169
2170C***********************************************************************
2171C FILL CATEGORY 8 PART OF OUTPUT
2172C WILL ATTEMPT TO FILL 12 "LEVELS"
2173C LVL 1- LIFTED INDEX (DEG. K X 100 - RELATIVE) -------- CODE FIG. 250.
2174C LVL 2- TOTAL COLUMN PRECIPITABLE WATER (MM X 100) ---- CODE FIG. 251.
2175C LVL 3- 1. TO .9 SIGMA LAYER PRECIP. WATER (MM X 100) - CODE FIG. 252.
2176C LVL 4- .9 TO .7 SIGMA LAYER PRECIP. WATER (MM X 100) - CODE FIG. 253.
2177C LVL 5- .7 TO .3 SIGMA LAYER PRECIP. WATER (MM X 100) - CODE FIG. 254.
2178C LVL 6- SKIN TEMPERATURE (DEG. K X 100) --------------- CODE FIG. 255.
2179C LVL 7- CLOUD TOP TEMPERATURE (DEG. K X 100) ---------- CODE FIG. 256.
2180C LVL 8- CLOUD TOP PRESSURE (MB X 10) ------------------ CODE FIG. 257.
2181C LVL 9- CLOUD AMOUNT (C. FIG. BUFR TABLE 0-20-011) ---- CODE FIG. 258.
2182C LVL 10- INSTR. DATA USED IN PROC.
2183C (C. FIG. BUFR TABLE 0-02-021) --- CODE FIG. 259.
2184C LVL 11- SOLAR ZENITH ANGLE (SOLAR ELEV) (DEG. X 100) -- CODE FIG. 260.
2185C LVL 12- SATELLITE ZENITH ANGLE (ELEV) (DEG. X 100) --- CODE FIG. 261.
2186C
2187C IF DATA ONE ANY LEVEL ARE MISSING, THAT LEVEL IS NOT PROCESSED
2188C***********************************************************************
2189
2190 ilvl = 0
2191 ilc = 0
2192 cat8_8 = 10.0e10
2193 CALL ufbint(lunit,cat8_8,12,1,nlev8,cat8a//cat8b);cat8=cat8_8
2194 IF(nlev8.NE.1) THEN
2195 IF(nlev8.EQ.0) THEN
2196C.......................................................................
2197C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS ZERO --
2198 print 318
2199 318 FORMAT(/' ##W3UNPK77: NO ADDITIONAL (CAT. 8) DATA PROCESSED FOR ',
2200 $ 'THIS REPORT -- NLEV8 = 0'/)
2201 GO TO 99
2202C.......................................................................
2203 ELSE
2204C.......................................................................
2205C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS NOT WHAT IS EXPECTED --
2206C SET IRET = 7 AND RETURN
2207 print 219, nlev8
2208 219 FORMAT(/' ##W3UNPK77: THE NUMBER OF DECODED "LEVELS" (=',i5,') ',
2209 $ 'IS NOT WHAT IS EXPECTED (1) - IRET = 7'/)
2210 iret = 7
2211 RETURN
2212C.......................................................................
2213 END IF
2214 END IF
2215
2216C THE TEMPERATURE CHANNEL SELECTION FLAG WILL BE USED LATER TO
2217C DETERMINE Q. MARK FOR SKIN TEMPERATURE (IF 0 - OK, OTHERWISE - BAD)
2218
2219 rtcsf_8 = 10.0e10
2220 CALL ufbint(lunit,rtcsf_8,1,1,nlev0,'TCSF');rtcsf=rtcsf_8
2221 itcsf = 1
2222 m = 1
2223 IF(iprint.GT.1) print 299, rtcsf,m
2224 299 FORMAT(5x,'RTCSF HERE IS: ',f17.4,'; INDEX IS: ',i3)
2225 IF(rtcsf.LT.xmsg) itcsf = nint(rtcsf)
2226 IF(iprint.GT.1) print 1798, itcsf
2227 1798 FORMAT(5x,'ITCSF IS: ',i10)
2228
2229C LOOP THROUGH THE 12 POSSIBLE ADDITIONAL DATA
2230
2231 DO m = 1,12
2232 IF(iprint.GT.1) print 6079, m,ilc,ilvl
2233 6079 FORMAT(' ATTEMPTING MISCEL. INPUT',i5,' WITH ILC =',i5,'; NO. ',
2234 $ 'OUTPUT CAT. 8 LVLS PROCESSED TO NOW =',i5)
2235 IF(iprint.GT.1) print 399, cat8(m),m
2236 399 FORMAT(5x,'CAT8 HERE IS: ',f17.4,'; INDEX IS: ',i3)
2237 IF(cat8(m).LT.xmsg) THEN
2238
2239C WE HAVE A VALID CATEGORY 8 "LEVEL"
2240
2241 ilvl = ilvl + 1
2242
2243C STORE THE DATUM IN WORD 1 OF THE CAT. 8 LEVEL
2244
2245 rdatx(393+ilc) = nint(cat8(m) * sc8(m))
2246 IF(iprint.GT.1) print 198, 393+ilc,rdatx(393+ilc)
2247
2248C STORE THE CAT. 8 CODE FIGURE IN WORD 2 OF THE CAT. 8 LEVEL
2249
2250 rdatx(393+ilc+1) = real(200+icdfg(m))
2251 IF(iprint.GT.1) print 198, 393+ilc+1,rdatx(393+ilc+1)
2252
2253C STORE THE QUALITY MARKER IN BYTE 1 OF WORD 3 OF THE CAT. 8 LEVEL
2254
2255 cob = cqmflg//' '
2256
2257C IF THIS DATUM IS SKIN TEMPERATURE AND THE TEMPERATURE CHANNEL
2258C SELECTION FLAG IS BAD (.NE. 0), SET QUALITY MARKER TO "F"
2259
2260 IF(m.EQ.6.AND.itcsf.NE.0) cob(1:1) = 'F'
2261 idata(393+ilc+2) = iob
2262 IF(iprint.GT.1) print 196, 393+ilc+2,cob(1:4)
2263 ilc = ilc + 3
2264 IF(m.LT.12.AND.iprint.GT.1) print *,'HAVE COMPLETED OUTPUT',
2265 $ ' LVL',ilvl,'; GOING INTO NEXT INPUT DATUM WITH ILC=',ilc
2266 ELSE
2267 IF(iprint.GT.1) print *, 'DATUM MISSING ON INPUT ',m,
2268 $ ', GO ON TO NEXT INPUT DATUM (NO. LVLS PROCESSED SO ',
2269 $ 'FAR=',ilvl,'; ILC=',ilc,')'
2270 END IF
2271 ENDDO
2272
2273C SET CATEGORY COUNTERS FOR CATEGORY 8 (ADDITIONAL) DATA
2274
2275 idata(27) = ilvl
2276 99 CONTINUE
2277 IF(iprint.GT.1) print *, idata(27),' CAT. 08 LEVELS PROCESSED'
2278 IF(idata(27).GT.0) idata(28) = 393
2279
2280C***********************************************************************
2281C FILL CATEGORY 13 PART OF OUTPUT (RADIANCES)
2282C***********************************************************************
2283
2284 ilvl = 0
2285 ilc = 0
2286 rad_8 = 10.0e10
2287 CALL ufbint(lunit,rad_8,2,255,nlev13,rad1);rad=rad_8
2288 IF(nlev13.EQ.0) THEN
2289C.......................................................................
2290C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS ZERO --
2291 print 417
2292 417 FORMAT(/' ##W3UNPK77: NO RADIANCE DATA PROCESSED FOR THIS ',
2293 $ 'REPORT -- NLEV13 = 0'/)
2294 GO TO 100
2295 ELSE IF(nlev13.GT.60) THEN
2296C.......................................................................
2297C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS GREATER THAN LIMIT OF 60 --
2298 print 418
2299 418 FORMAT(/' ##W3UNPK77: NO RADIANCE DATA PROCESSED FOR THIS ',
2300 $ 'REPORT -- NLEV13 > 60'/)
2301 GO TO 100
2302C.......................................................................
2303 END IF
2304 IF(iprint.GT.1) print 2068, nlev13
2305 2068 FORMAT(' THIS REPORT CONTAINS',i4,' INPUT LEVELS (CHANNELS) OF ',
2306 $ 'RADIANCE DATA')
2307 DO i = 1,nlev13
2308 IF(iprint.GT.1) print 2079, i,ilc,ilvl
2309 2079 FORMAT(' ATTEMPTING NEW CAT. 13 INPUT "LEVEL" NUMBER',i4,' WITH ',
2310 $ 'ILC =',i5,'; NO. LEVELS (CHANNELS) PROCESSED TO NOW =',i5)
2311
2312C CHANNEL NUMBER (STORED AS INTEGER)
2313
2314 m = 1
2315 IF(iprint.GT.1) print 499, rad(1,i),m
2316 499 FORMAT(5x,'RAD HERE IS: ',f17.4,'; INDEX IS: ',i3)
2317 IF(rad(1,i).GE.ymsg) THEN
2318C WE DO NOT HAVE A VALID CATEGORY 13 LEVEL -- THERE IS NO VALID CHANNEL
2319C NUMBER -- GO ON TO NEXT INPUT LEVEL
2320 IF(iprint.GT.1) print *, 'CHANNEL NUMBER MISSING ON INPUT',
2321 $ ' LEVEL ',i,', SKIP THE PROCESSING OF THIS LEVEL'
2322 GO TO 210
2323 END IF
2324
2325C WE HAVE A VALID CATEGORY 13 LEVEL -- THERE IS A VALID CHANNEL NUMBER
2326
2327 idata(429+ilc) = nint(rad(1,i))
2328 ilvl = ilvl + 1
2329 IF(iprint.GT.1) print 197, 429+ilc,idata(429+ilc)
2330 197 FORMAT(5x,'IDATA(',i5,') STORED AS: ',i10)
2331
2332C BRIGHTNESS TEMPERATURE (STORED AS REAL)
2333
2334 m = 2
2335 IF(iprint.GT.1) print 499, rad(2,i),m
2336 IF(rad(2,i).LT.xmsg) rdatx(429+ilc+1) = nint(rad(2,i) * 100.)
2337 IF(iprint.GT.1) print 198, 429+ilc+1,rdatx(429+ilc+1)
2338
2339C QUALITY MARKERS (STORED AS CHARACTER)
2340
2341 cob = ' '
2342 idata(429+ilc+2) = iob
2343 IF(iprint.GT.1) print 196, 429+ilc+2,cob(1:4)
2344C.......................................................................
2345 ilc = ilc + 3
2346 IF(i+1.LE.nlev13.AND.iprint.GT.1) print *,'HAVE COMPLETED ',
2347 $ 'LEVEL ',ilvl,'; GOING INTO NEXT LEVEL WITH ILC=',ilc
2348
2349 210 CONTINUE
2350 ENDDO
2351
2352C SET CATEGORY COUNTERS FOR CATEGORY 13 (RADIANCE) DATA
2353
2354 idata(41) = ilvl
2355 100 CONTINUE
2356 IF(iprint.GT.1) print *, idata(41),' CAT. 13 LEVELS PROCESSED'
2357 IF(idata(41).GT.0) idata(42) = 429
2358
2359 IF(idata(27)+idata(39)+idata(41).EQ.0) iret = 5
2360
2361 IF(iprint.GT.1) print *,'IDATA(39)=',idata(39),'; IDATA(40)=',
2362 $ idata(40),'; IDATA(27)=',idata(27),'; IDATA(28)=',idata(28),
2363 $ '; IDATA(41)=',idata(41),'; IDATA(42)=',idata(42)
2364
2365 rdata(1:1200) = rdatx(1:1200)
2366 RETURN
2367 END
subroutine errexit(iret)
Exit with a return code.
Definition errexit.f:20
subroutine w3difdat(jdat, idat, it, rinc)
Returns the elapsed time interval from an NCEP absolute date and time given in the second argument un...
Definition w3difdat.f:29
subroutine w3fi04(iendn, itypec, lw)
Subroutine computes word size, the type of character set, ASCII or EBCDIC, and if the computer is big...
Definition w3fi04.f:30
subroutine w3movdat(rinc, idat, jdat)
This subprogram returns the date and time that is a given NCEP relative time interval from an NCEP ab...
Definition w3movdat.f:24
subroutine unpk7708(lunit, rdata, kount, iret)
Fills in header in o-put array - goes snd.
Definition w3unpk77.f:1794
subroutine unpk7702(rdata, itp)
Initializes the output array for a report.
Definition w3unpk77.f:800
subroutine unpk7705(lunit, rdata)
Fills cat.11 into o-put array - pflr rpt.
Definition w3unpk77.f:1222
subroutine unpk7709(lunit, rdata, iret)
Fills cat.
Definition w3unpk77.f:2021
subroutine w3unpk77(idate, ihe, ihl, lunit, rdata, iret)
This subroutine decodes a single report from bufr messages in a jbufr-type data file.
Definition w3unpk77.f:346
subroutine unpk7701(lunit, itp, iret)
Reads a single report out of bufr dataset.
Definition w3unpk77.f:649
subroutine unpk7707(lunit, rdata, iret)
Fills cat.
Definition w3unpk77.f:1615
subroutine unpk7706(lunit, rdata, iret)
Fills in header in o-put array - vadw rpt.
Definition w3unpk77.f:1451
subroutine unpk7704(lunit, rdata)
Fills cat.10 into o-put array - pflr rpt.
Definition w3unpk77.f:1116
subroutine unpk7703(lunit, rdata, iret)
Fills in header in o-put array - pflr rpt.
Definition w3unpk77.f:896