NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
iw3unp29.f
Go to the documentation of this file.
1C> @file
2C> @brief Reads and unpacks one report into the unpacked office note
3C> 29/124 format
4C> @author Dennis Keyser @date 2013-03-20
5
6C> This routine has not been tested reading input data from any dump
7C> type in ON29/124 format on WCOSS. It likely will not work when
8C> attempting to read ON29/124 format dumps on WCOSS. It has also
9C> not been tested reading any dump file other than ADPUPA (BUFR
10C> input only) on WCOSS. It does work reading BUFR ADPUPA dump files
11C> on WCOSS. It will hopefully working reading other BUFR (only)
12C> dump files on WCOSS. Also, this routine is only known to work correctly
13C> when compiled using 8 byte machine words (real and integer).
14C>
15C> Reads and unpacks one report into the unpacked office note
16C> 29/124 format. The input data may be packed into either bufr or
17C> true on29/124 format with a y2k compliant pseudo-on85 header label.
18C> (Note: as a temporary measure, this code will still operate on a
19C> true on29/124 format file with a non-y2k compliant on85 header
20C> label. The code will use the "windowing" technique to obtain a
21C> 4-digit year.) This routine will determine the format of the
22C> input data and take the appropriate action. It returns the
23C> unpacked report to the calling program in the array 'obs'.
24C> Various contingencies are covered by return value of the function
25C> and parameter 'ier' - function and ier have same value. Repeated
26C> calls of function will return a sequence of unpacked on29/124
27C> reports. The calling program may switch to a new 'nunit' at any
28C> time, that dataset will then be read in sequence. If user
29C> switches back to a previous 'nunit', that data set will be read
30C> from the beginning, not from where the user left off (this is a
31C> 'software tool', not an entire i/o system).
32C>
33C> Program history log:
34C> - Jack Woollen 1996-12-13 (gsc) Note this new
35C> version of iw3gad incorporates the earlier version which
36C> was written by j. stackpole and dealt only with true
37C> on29/124 data as input - this option is still available
38C> but is a small part of the new routine which was written
39C> from scratch to read in bufr data.
40C> - Dennis Keyser 1997-01-27 Changes to more closely duplicate format
41C> obtained when reading from true on29/124 data sets.
42C> - Dennis Keyser 1997-02-04 Drops with missing stnid get stnid set to
43C> "drp88a"; satwnds with zero pressure are tossed.
44C> - Dennis Keyser 1997-02-12 To get around the 3-bit limitation to
45C> the on29 pressure q.m. mnemonic "qmpr", an sdmedit/quips
46C> purge or reject flag on pressure is changed from 12 or 14
47C> to 6 in order to fit into 3-bits, see function e35o29;
48C> interprets sdmedit and quips purge/keep/change flags
49C> properly for all data types; can now process cat. 6 and
50C> cat. 2/3 type flight-level reccos (before skipped these);
51C> tests for missing lat, lon, obtime decoded from bufr and
52C> retains missing value on these in unpacked on29/124
53C> format (before no missing check, led to possible non-
54C> missing but incorrect values for these); the check for
55C> drops with missing stnid removed since decoder fixed for
56C> this.
57C> - Dennis Keyser 1997-05-01 Looks for duplicate levels when
58C> processing on29 cat. 2, 3, and 4 (in all data on level)
59C> and removes duplicate level; in processing on29 cat. 3
60C> levels, removes all levels where wind is missing; fixed
61C> bug in aircraft (airep/pirep/amdar) quality mark
62C> assignment (was not assigning keep flag to report if
63C> pressure had a keep q.m. but temperature q.m. was
64C> missing).
65C> - Dennis Keyser 1997-05-30 For aircft: (only acars right now) -
66C> seconds are decoded (if avail.) and used to obtain
67C> report time; only asdar/amdar - new cat. 8 code figs.
68C> o-put 917 (char. 1 & 2 of actual stnid), 918 (char. 3 &
69C> 4 of actual stnid), 919 (char. 5 & 6 of actual stnid);
70C> asdar/amdar and acars - new cat. 8 code fig. o-put 920
71C> (char. 7 & 8 of actual stnid); only acars - new cat. 8
72C> code fig. o-put 921 (report time to nearest 1000'th of
73C> an hour); only some acars - new mnemonic "ialt" now
74C> exists and can (if line not commented out) be used to
75C> obtain unpacked on29 cat. 6.
76C> - Dennis Keyser 1997-07-02 Removed filtering of aircraft data as
77C> follows: air france amdars no longer filtered, amdar/
78C> asdar below 7500 ft. no longer filtered, airep/pirep
79C> below 100 meters no longer filtered, all aircraft with
80C> missing wind but valid temperature are no longer
81C> filtered; reprocesses u.s. satwnd stn. ids to conform
82C> with previous on29 appearance except now 8-char (tag
83C> char. 1 & 6 not changed from bufr stn. id) - never any
84C> dupl. ids now for u.s. satwnds decoded from a single
85C> bufr file; streamlined/eliminated some do loops to
86C> speed up a bit.
87C> - Dennis Keyser 1997-09-18 Corrected errors in reformatting surface
88C> data into unpacked on124, specifically-header: inst. type
89C> (synoptic fmt flg, auto stn. type, converted hrly flg),
90C> indicators (precip., wind speed, wx/auto stn), cat51:
91C> p-tend, horiz. viz., present/past wx, cloud info, max/
92C> min temp, cat52: precip., snow dpth, wave info, ship
93C> course/speed, cat8: code figs. 81-85,98; corrected
94C> problem which coded upper-air mandatory level winds
95C> as cat. 3 instead of cat. 1 when mass data (only) was
96C> reported on same mandatory level in a separate reported
97C> level in the raw bulletin.
98C> - Dennis Keyser 1997-10-06 Updated logic to read and process nesdis
99C> hi-density satellite winds properly.
100C> - Dennis Keyser 1997-10-30 Added gross check on u-air pressure, all
101C> levels with reported pressure .le. zero now tossed; sfc
102C> cat. 52 sea-sfc temperature now read from hierarchy of
103C> sst in bufr {1st choice - hi-res sst ('sst2'), 2nd
104C> choice - lo-res sst ('sst1'), 3rd choice - sea temp
105C> ('stmp')}, before only read 'sst1'.
106C> - Dennis Keyser 1998-01-26 Changed pqm processing for adpupa types
107C> such that sdmedit flags are now honored (before, pqm
108C> was always hardwired to 2 for adpupa types); bumped
109C> limit for number of levels that can be processed from
110C> 100 to 150 and added diagnostic print when the limit
111C> is exceeded.
112C> - Dennis Keyser 1998-05-19 Y2k compliant version of iw3gad routine
113C> accomplished by redefining original 32-character on85
114C> header label to be a 40-character label that contains a
115C> full 4-digit year, can still read "true" on29/124 data
116C> sets provided their header label is in this modified
117C> form.
118C> - Dennis Keyser 1998-07-22 Minor modifications to account for
119C> corrections in y2k/f90 bufrlib (mainly related to
120C> bufrlib routine dumpbf).
121C> - Dennis Keyser 1998-08-04 Fixed a bug that resulted in code being
122C> clobbered in certain situations for recco reports; minor
123C> modifications to give same answers on cray as on sgi;
124C> allowed code to read true on29/124 files with non-y2k
125C> compliant on85 label (a temporary measure during
126C> transition of main programs to y2k); added call to "aea"
127C> which converts ebcdic characters to ascii for input
128C> true on29/124 data set processing of sgi (which does
129C> not support "-cebcdic" in assign statement).
130C> - Dennis Keyser 1999-02-25 Added ability to read reprocessed ssm/i
131C> bufr data set (spssmi); added ability to read mean
132C> sea-level pressure bogus (paobs) data set (sfcbog).
133C> - Dennis Keyser 1999-05-14 Made changes necessary to port this
134C> routine to the ibm sp.
135C> - Dennis Keyser 1999-06-18 Can now process water vapor satwnds
136C> from foreign producers; stn. id for foreign satwnds
137C> now reprocessed in same way as for nesdis/goes satwnds,
138C> character 1 of stn. id now defines even vs. odd
139C> satellite while character 6 of stn. id now defines
140C> ir cloud-drft vs. visible cloud drft vs. water vapor.
141C> - Dennis Keyser 2002-03-05 Removed entry "e02o29", now performs
142C> height to press. conversion directly in code for cat. 7;
143C> test for missing "rpid" corrected for adpupa data (now
144C> checks ufbint return code rather than value=bmiss);
145C> accounts for changes in input adpupa, adpsfc, aircft
146C> and aircar bufr dump files after 3/2002: cat. 7 and cat.
147C> 51 use mnemonic "hblcs" to get height of cloud base if
148C> mnemonic "hocb" not available (and it will not be for all
149C> cat. 7 and some cat. 51 reports); mnemonic "tiwm"
150C> replaces "suws" in header for surface data; mnemonic
151C> "borg" replaces "icli" in cat. 8 for aircraft data (will
152C> still work properly for input adpupa, adpsfc, aircft and
153C> aircar dump files prior to 3/2002).
154C> - Dennis Keyser 2013-03-20 Changes to run on wcoss, obtain value of
155C> bmiss set in calling program via call to bufrlib routine
156C> getbmiss rather than hardwiring it to 10e08 (or 10e10);
157C> use formatted print statements where previously
158C> unformatted print was used (wcoss splits unformatted
159C> print at 80 characters).
160C>
161C> @param[in] lunit fortran unit number for sequential data set containing
162C> packed bufr reports or packed and blocked office note 29/124 reports
163C> @param[out] obs array containing one report in unpacked office note
164C> 29/124 format. Format is mixed, user must equivalence
165C> integer and character arrays to this array (see
166C> docblock for w3fi64 in /nwprod/lib/sorc/w3nco
167C> or writeups on w3fi64, on29, on124 for help)
168C> the length of the array should be at least 1608.
169C> @param[out] ier return flag (equal to function value)
170C>
171C> Input files:
172C> - unit aa sequential bufr or office note 29/124 data set ("aa"
173C> is unit number specified by input argument "nunit")
174C>
175C> Output files:
176C> - unit 06 printout
177C>
178C> @note
179C> - if input data set is on29/124, it should be assigned in this way:
180C> - cray:
181C> - assign -a adpupa -fcos -cebcdic fort.xx
182C> - sgi:
183C> - assign -a adpupa -fcos fort.xx
184C> (note: -cebcdic is not possible on sgi, so call to w3nco
185C> routine "aea" takes care of the conversion as each
186C> on29 record is read in)
187C> - if input data set is bufr, it should be assigned in this way:
188C> - cray:
189C> - assign -a adpupa fort.xx
190C> - sgi:
191C> - assign -a adpupa -f cos fort.xx
192C>
193C> For input on29/124 data sets, a contingency has been built
194C> into this subroutine to perform the conversion from ebcdic to
195C> ascii in the event the assign does not perform the conversion
196C> the return flags in ier (and function iw3unp29 itself) are:
197C> - 0 Observation read and unpacked into location 'obs'.
198C> see writeup of w3fi64 for contents. (all character
199C> words are left-justified.) Next call to iw3unp29
200C> will return next observation in data set.
201C> - 1 A 40 byte header in the format described here
202C> (y2k compliant pseudo-office note 85) is returned
203C> in the first 10 words of 'obs' on a 4-byte machine
204C> (ibm) and in the first 5 words of 'obs' on an
205C> 8-byte machine (cray). Next call to
206C> iw3unp29 will return first obs. in this data set.
207C> (note: if input data set is a true on29/124 file
208C> with the y2k compliant pseudo-on85 header record,
209C> then the pseudo-on85 header record is actually
210C> read in and returned; if input data set is a true
211C> on29/124 file with a non-y2k compliant on85 header
212C> record, then a y2k compliant pseudo-on85 header
213C> record is constructed from it using the "windowing"
214C> technique to obtain a 4-digit year from a 2-digit
215C> year.)
216C> format for y2k compliant pseudo-on85 header record
217C> returned (40 bytes in character):
218C> - bytes 1- 8 -- data set name (as defined in on85 except up to
219C> eight ascii char., left justified with blank fill)
220C> - bytes 9-10 -- set type (as defined in on85)
221C> - bytes 11-20 -- center (analysis) date for data
222C> set (ten ascii characters in form "yyyymmddhh")
223C> - bytes 21-24 -- set initialize (dump) time, as dedined in on85)
224C> - bytes 25-34 -- always "washington" (as in on85)
225C> - bytes 35-36 -- source machine (as defined in on85)
226C> - bytes 37-40 -- blank fill characters
227C> - 2 end-of-file (never an empty or null file):
228C> - input on29/124 data set: the "endof file" record is
229C> encountered - no useful information in 'obs' array.
230C> next call to iw3unp29 will return physical end of
231C> file for data set in 'nunit' (see ier=3 below).
232C> - input bufr data set: the physical end of file is
233C> encountered.
234C> -3 end-of-file:
235C> Physical end of file encountered on data set -
236C> this can only happen for an empty (null) data set
237C> or for a true on29/124 data set. There are no
238C> more reports (or never were any if null) associated
239C> with data set in this unit number - no useful
240C> information in 'obs' array. Either all done (if
241C> no more unit numbers are to be read in), or reset
242C> 'nunit' to point to a new data set (in which case
243C> next call to iw3unp29 should return with ier=1).
244C> - 4 only valid for input on29/124 data set - i/o error
245C> reading the next record of reports - no useful
246C> information in 'obs' array. Calling program can
247C> choose to stop or again call iw3unp29 which will
248C> attempt to unpack the first observation in the next
249C> record of reports.
250C> - 999 applies only to non-empty data sets:
251C> - input on29/124 data set: first choice y2k compliant
252C> pseudo-on85 file header label not encountered where
253C> expected, and second choice non-y2k compliant on85
254C> file header label also not encountered.
255C> - input bufr data set either header label in
256C> format of pseudo-on85 could not be returned, or an
257C> abnormal error occurred in the attempt to decode an
258C> observation. For either input data set type, no
259C> useful information in 'obs' array. Calling program
260C> can choose to stop with non-zero condition code or
261C> reset 'nunit' to point to a new data set (in which
262C> case next call to iw3unp29 should return with
263C> ier=1).
264C> - input data set neither on29/124 nor bufr speaks for
265C> itself.
266C>
267C> @author Dennis Keyser @date 2013-03-20
268C>
269
270 FUNCTION iw3unp29(LUNIT,OBS,IER)
271
272 common/io29aa/jwfile(100),lastf
273 common/io29bb/kndx,kskacf(8),kskupa,ksksfc,ksksat,ksksmi
274 common/io29cc/subset,idat10
275 common/io29dd/hdr(12),rcats(50,150,11),ikat(11),mcat(11),ncat(11)
276 common/io29ee/robs(255,11)
277 common/io29ff/qms(255,9)
278 common/io29gg/sfo(34)
279 common/io29hh/sfq(5)
280 common/io29ii/pwmin
281 common/io29jj/iset,manlin(1001)
282 common/io29kk/kount(499,18)
283 common/io29ll/bmiss
284
285 dimension obs(*)
286 REAL(8) bmiss,getbmiss
287
288 SAVE
289
290 DATA itimes/0/
291
292 IF(itimes.EQ.0) THEN
293
294C THE FIRST TIME IN, INITIALIZE SOME DATA
295C (NOTE: FORTRAN 77/90 STANDARD DOES NOT ALLOW COMMON BLOCK VARIABLES
296C TO BE INITIALIZED VIA DATA STATEMENTS, AND, FOR SOME REASON,
297C THE BLOCK DATA DOES NOT INITIALIZE DATA IN THE W3NCO LIBRARY
298C AVOID BLOCK DATA IN W3NCO/W3EMC)
299C --------------------------------------------------------------------
300
301 itimes = 1
302 jwfile = 0
303 lastf = 0
304 kndx = 0
305 kskacf = 0
306 kskupa = 0
307 ksksfc = 0
308 ksksat = 0
309 ksksmi = 0
310 kount = 0
311 ikat(1) = 1
312 ikat(2) = 2
313 ikat(3) = 3
314 ikat(4) = 4
315 ikat(5) = 5
316 ikat(6) = 6
317 ikat(7) = 7
318 ikat(8) = 8
319 ikat(9) = 51
320 ikat(10) = 52
321 ikat(11) = 9
322 mcat(1) = 6
323 mcat(2) = 4
324 mcat(3) = 4
325 mcat(4) = 4
326 mcat(5) = 6
327 mcat(6) = 6
328 mcat(7) = 3
329 mcat(8) = 3
330 mcat(9) = 21
331 mcat(10) = 15
332 mcat(11) = 3
333 iset = 0
334 END IF
335
336C UNIT NUMBER OUT OF RANGE RETURNS A 999
337C --------------------------------------
338
339 IF(lunit.LT.1 .OR. lunit.GT.100) THEN
340 print'(" ##IW3UNP29 - UNIT NUMBER ",I0," OUT OF RANGE -- ",
341 $ "IER = 999")', lunit
342 GO TO 9999
343 END IF
344 IF(lastf.NE.lunit .AND. lastf.GT.0) THEN
345 CALL closbf(lastf)
346 jwfile(lastf) = 0
347 END IF
348 lastf = lunit
349
350C THE JWFILE INDICATOR: =0 IF UNOPENED; =1 IF ON29; =2 IF BUFR
351C ------------------------------------------------------------
352
353 IF(jwfile(lunit).EQ.0) THEN
354 print'(" ===> IW3UNP29 - WCOSS VERSION: 03-20-2013")'
355
356 bmiss = getbmiss()
357 print'(1X)'
358 print'(" BUFRLIB value for missing passed into IW3UNP29 is: ",
359 $ G0)', bmiss
360 print'(1X)'
361
362 IF(i03o29(lunit,obs,ier).EQ.1) THEN
363 print'(" IW3UNP29 - OPENED A TRUE OFFICE NOTE 29 FILE IN ",
364 $ "UNIT ",I0)', lunit
365 jwfile(lunit) = 1
366 ier = 1
367 iw3unp29 = 1
368 ELSEIF(i03o29(lunit,obs,ier).EQ.3) THEN
369 print 107, lunit
370 107 FORMAT(/,' ##IW3UNP29 - FILE IN UNIT',i3,' IS EMPTY OR NULL -- ',
371 $ 'IER = 3'/)
372 ier = 3
373 iw3unp29 = 3
374 ELSEIF(i02o29(lunit,obs,ier).EQ.1) THEN
375 print'(" IW3UNP29 - OPENED A BUFR FILE IN UNIT ",I0)', lunit
376
377 jwfile(lunit) = 2
378 kndx = 0
379 kskacf = 0
380 kskupa = 0
381 ksksfc = 0
382 ksksat = 0
383 ksksmi = 0
384 ier = 1
385 iw3unp29 = 1
386 ELSEIF(i03o29(lunit,obs,ier).EQ.999) THEN
387 print'(" IW3UNP29 - OPENED A TRUE OFFICE NOTE 29 FILE IN ",
388 $ "UNIT ",I0)', lunit
389 print 88
390 88 FORMAT(/' ##IW3UNP29/I03O29 - NEITHER EXPECTED Y2K COMPLIANT ',
391 $ 'PSEUDO-ON85 LABEL NOR SECOND CHOICE NON-Y2K COMPLIANT ON85 ',
392 $ 'LABEL FOUND IN'/21x,'FIRST RECORD OF FILE -- IER = 999'/)
393 GO TO 9999
394 ELSE
395 print 108, lunit
396 108 FORMAT(/,' ##IW3UNP29 - FILE IN UNIT',i3,' IS NEITHER BUFR NOR ',
397 $ 'TRUE OFFICE NOTE 29 -- IER = 999'/)
398 GO TO 9999
399 END IF
400 ELSEIF(jwfile(lunit).EQ.1) THEN
401 IF(i03o29(lunit,obs,ier).NE.0) jwfile(lunit) = 0
402 IF(ier.GT.0) CLOSE (lunit)
403 iw3unp29 = ier
404 ELSEIF(jwfile(lunit).EQ.2) THEN
405 IF(i02o29(lunit,obs,ier).NE.0) jwfile(lunit) = 0
406 IF(ier.GT.0) CALL closbf(lunit)
407 IF(ier.EQ.2.OR.ier.EQ.3) THEN
408 IF(kskacf(1).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT/",
409 $ "AIRCAR REPORTS TOSSED DUE TO ZERO CAT. 6 LVLS = ",I0)',
410 $ kskacf(1)
411 IF(kskacf(2).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT ",
412 $ "REPORTS TOSSED DUE TO BEING ""LFPW"" AMDAR = ",I0)',
413 $ kskacf(2)
414 IF(kskacf(8).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT ",
415 $ "REPORTS TOSSED DUE TO BEING ""PHWR"" AIREP = ",I0)',
416 $ kskacf(8)
417 IF(kskacf(3).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT ",
418 $ "REPORTS TOSSED DUE TO BEING CARSWELL AMDAR = ",I0)',
419 $ kskacf(3)
420 IF(kskacf(4).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT ",
421 $ "REPORTS TOSSED DUE TO BEING CARSWELL ACARS = ",I0)',
422 $ kskacf(4)
423 IF(kskacf(5).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT/",
424 $ "AIRCAR REPORTS TOSSED DUE TO HAVING MISSING WIND = ",I0)',
425 $ kskacf(5)
426 IF(kskacf(6).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT ",
427 $ "REPORTS TOSSED DUE TO BEING AMDAR < 2286 M = ",I0)',
428 $ kskacf(6)
429 IF(kskacf(7).GT.0) print'(" IW3UNP29 - NO. OF AIRCFT ",
430 $ "REPORTS TOSSED DUE TO BEING AIREP < 100 M = ",I0)',
431 $ kskacf(7)
432 IF(kskacf(1)+kskacf(2)+kskacf(3)+kskacf(4)+kskacf(5)+
433 $ kskacf(6)+kskacf(7)+kskacf(8).GT.0)
434 $ print'(" IW3UNP29 - TOTAL NO. OF AIRCFT/AIRCAR REPORTS ",
435 $ "TOSSED = ",I0)',
436 $ kskacf(1)+kskacf(2)+kskacf(3)+kskacf(4)+
437 $ kskacf(5)+kskacf(6)+kskacf(7)+kskacf(8)
438 IF(kskupa.GT.0) print'(" IW3UNP29 - TOTAL NO. OF ADPUPA ",
439 $ "REPORTS TOSSED = ",I0)', kskupa
440 IF(ksksfc.GT.0) print'(" IW3UNP29 - TOTAL NO. OF ADPSFC/",
441 $ "SFCSHP/SFCBOG REPORTS TOSSED = ",I0)', ksksfc
442 IF(ksksat.GT.0) print'(" IW3UNP29 - TOTAL NO. OF SATWND ",
443 $ "REPORTS TOSSED = ",I0)', ksksat
444 IF(ksksmi.GT.0) print'(" IW3UNP29 - TOTAL NO. OF SPSSMI ",
445 $ "REPORTS TOSSED = ",I0)', ksksmi
446 kndx = 0
447 kskacf = 0
448 kskupa = 0
449 ksksfc = 0
450 ksksat = 0
451 ksksmi = 0
452 END IF
453 iw3unp29 = ier
454 END IF
455
456 RETURN
457
458 9999 CONTINUE
459 ier = 999
460 iw3unp29 = 999
461 RETURN
462
463 END
464C***********************************************************************
465C***********************************************************************
466C***********************************************************************
467C> This function read obs files and returns error message.
468C> @param LUNIT full path of file
469C> @param HDR header of file
470C> @param IER missing or invalid data indicator
471C> @return Y2K COMPLIANT
472C>
473C> @author Dennis Keyser @date 2013-03-20
474C>
475C-----------------------------------------------------------------------
476 FUNCTION i01o29(LUNIT,HDR,IER)
477C ---> formerly FUNCTION IW3HDR
478
479 common/io29aa/jwfile(100),lastf
480
481 dimension hdr(*)
482
483 SAVE
484
485C UNIT NUMBER OUT OF RANGE RETURNS A 999
486C --------------------------------------
487
488 IF(lunit.LT.1 .OR. lunit.GT.100) THEN
489 print'(" ##IW3UNP29/I01O29 - UNIT NUMBER ",I0," OUT OF RANGE ",
490 $ "-- IER = 999")', lunit
491 GO TO 9999
492 END IF
493
494C THE JWFILE INDICATOR: =0 IF UNOPENED; =1 IF ON29; =2 IF BUFR
495C ------------------------------------------------------------
496
497 IF(jwfile(lunit).EQ.0) THEN
498 IF(i03o29(lunit,hdr,ier).EQ.1) THEN
499 i01o29 = i03o29(0,hdr,ier)
500 i01o29 = 1
501 RETURN
502 ELSEIF(i02o29(lunit,hdr,ier).EQ.1) THEN
503 CALL closbf(lunit)
504 i01o29 = 1
505 RETURN
506 ELSE
507
508C CAN'T READ FILE HEADER RETURNS A 999
509C ------------------------------------
510
511 print'(" ##IW3UNP29/I01O29 - CAN""T READ FILE HEADER -- ",
512 $ "IER = 999")'
513 GO TO 9999
514 END IF
515 ELSE
516
517C FILE ALREADY OPEN RETURNS A 999
518C -------------------------------
519
520 print'(" ##IW3UNP29/I01O29 - FILE ALREADY OPEN -- IER = 999")'
521 GO TO 9999
522 END IF
523
524 RETURN
525
526 9999 CONTINUE
527 ier = 999
528 i01o29 = 999
529 RETURN
530
531 END
532C***********************************************************************
533C***********************************************************************
534C***********************************************************************
535
536C> This function read obs files and returns error message.
537C> @param LUNIT full path of file
538C> @param OBS data output
539C> @param IER missing or invalid data indicator
540C> @return Y2K COMPLIANT
541C>
542C> @author Dennis Keyser @date 2013-03-20
543C>
544
545 FUNCTION i02o29(LUNIT,OBS,IER)
546C ---> formerly FUNCTION JW3O29
547
548 common/io29cc/subset,idat10
549
550 CHARACTER*40 on85
551 CHARACTER*10 cdate
552 CHARACTER*8 subset,cbufr
553 CHARACTER*6 c01o29
554 CHARACTER*4 cdump
555 dimension obs(1608),ron85(16),jdate(5),jdump(5)
556 equivalence(ron85(1),on85)
557
558 SAVE
559
560 DATA on85/' '/
561
562 jdate = -1
563 jdump = -1
564
565C IF FILE IS CLOSED TRY TO OPEN IT AND RETURN A Y2K COMPLIANT
566C PSEUDO-ON85 LABEL
567C -----------------------------------------------------------
568
569 CALL status(lunit,lun,il,im)
570
571 IF(il.EQ.0) THEN
572 iret = -1
573 i02o29 = 2
574 rewind lunit
575 READ(lunit,END=10,ERR=10,FMT='(A8)') cbufr
576 IF(cbufr(1:4).EQ.'BUFR') THEN
577 print'(" IW3UNP29/I02O29 - INPUT FILE ON UNIT ",I0, " IS",
578 $ " UNBLOCKED NCEP BUFR"/)', lunit
579 ELSE IF(cbufr(5:8).EQ.'BUFR') THEN
580 print'(" IW3UNP29/I02O29 - INPUT FILE ON UNIT ",I0, " IS",
581 $ " BLOCKED NCEP BUFR"/)', lunit
582 ELSE
583 rewind lunit
584 GO TO 10
585 END IF
586 call datelen(10)
587 CALL dumpbf(lunit,jdate,jdump)
588cppppp
589 print'(" CENTER DATE (JDATE) = ",I4,4I3.2/" DUMP DATE (JDUMP)",
590 $ " (year not used anywhere) = "I4,4I3.2)',jdate,jdump
591cppppp
592 IF(jdate(1).GT.999) THEN
593 WRITE(cdate,'(I4.4,3I2.2)') (jdate(i),i=1,4)
594 ELSE IF(jdate(1).GT.0) THEN
595
596C If 2-digit year returned in JDATE(1), must use "windowing" technique
597C 2 create a 4-digit year
598
599 print'(" ##IW3UNP29/I02O29 - 2-DIGIT YEAR IN JDATE(1) ",
600 $ "RETURNED FROM DUMPBF (JDATE IS: ",I4.4,3I2.2,") - USE ",
601 $ "WINDOWING TECHNIQUE TO OBTAIN 4-DIGIT YEAR")', jdate
602 IF(jdate(1).GT.20) THEN
603 WRITE(cdate,'("19",4I2.2)') (jdate(i),i=1,4)
604 ELSE
605 WRITE(cdate,'("20",4I2.2)') (jdate(i),i=1,4)
606 ENDIF
607 print'(" ##IW3UNP29/I02O29 - CORRECTED JDATE(1) WITH ",
608 $ "4-DIGIT YEAR, JDATE NOW IS: ",I4.4,3I2.2)', jdate
609 ELSE
610 GO TO 10
611 ENDIF
612
613 CALL openbf(lunit,'IN',lunit)
614
615C This next call, I believe, is needed only because SUBSET is not
616C returned in DUMPBF ...
617 call readmg(lunit,subset,idat10,iret)
618
619 WRITE(cdump,'(2I2.2)') jdump(4),100*jdump(5)/60
620 IF(jdump(1).LT.0) cdump = '9999'
621 on85=c01o29(subset)//' C2'//cdate//cdump//'WASHINGTONCR '
622 obs(1:16) = ron85
623 i02o29 = 1
624 10 CONTINUE
625 ier = i02o29
626 RETURN
627 END IF
628
629C IF THE FILE IS ALREADY OPENED FOR INPUT TRY TO READ THE NEXT SUBSET
630C -------------------------------------------------------------------
631
632 IF(il.LT.0) THEN
633 7822 CONTINUE
634 CALL readns(lunit,subset,idat10,iret)
635 IF(iret.EQ.0) i02o29 = r01o29(subset,lunit,obs)
636 IF(iret.NE.0) i02o29 = 2
637 IF(i02o29.EQ.-9999) GO TO 7822
638 ier = i02o29
639 RETURN
640 END IF
641
642C FILE MUST BE OPEN FOR INPUT!
643C ----------------------------
644
645 print'(" ##IW3UNP29/I02O29 - FILE ON UNIT ",I0," IS OPENED FOR ",
646 $ "OUTPUT -- IER = 999")', lunit
647 i02o29 = 999
648 ier = 999
649 RETURN
650
651 END
652
653C> This function reads a true (see *) on29/124 data set and unpacks one
654C> report into the unpacked office note 29/124 format. the input and
655C> output arguments here have the same meaning as for iw3unp29.
656C> repeated calls of function will return a sequence of unpacked
657C> on29/124 reports. * - unlike original "true" on29/124 data sets,
658C> the "expected" file header label is a y2k compliant 40-byte
659C> pseudo-on85 version - if this is not encountered this code, as a
660C> temporary measure during the y2k transition period, will look for
661C> the original non-y2k compliant 32-byte on85 header label and use
662C> the "windowing" technique to convert the 2-digit year to a 4-digit
663C> year in preparation for returning a 40-byte pseudo-on85 label in
664C> the first C call. (see iw3unp29 docblock for format of 40-byte
665C> pseudo-on85 header label.)
666C>
667C> Program History Log:
668C> -1991-07-23 Dennis Keyser w3fi64 (f77) internal read error
669C> no longer causes calling program to fail but will move
670C> to next record if can't recover to next report
671C> -1993-10-07 Dennis Keyser -- adapted for use on cray (added save
672C> statement, removed ibm-specific code, etc.)
673C> -1993-10-15 R. E. Jones added code so if file is ebcdic it converts
674C> it to ascii
675C> -1996-10-04 Jack Woollen changed name to i03gad and incorporated
676C> into new w3lib routine iw3gad
677C> -2013-03-20 Dennis Keyser changes to run on wcoss
678C>
679C> @param[in] nunit fortran unit number for sequential data set containing
680C> packed and blocked office note 29/124 reports
681C> @param[out] obs array containing one report in unpacked office note
682C> - 29/124 format is mixed, user must equivalence
683C> - integer and character arrays to this array (see
684C> - docblock for w3fi64 in /nwprod/lib/sorc/w3nco
685C> - or writeups on w3fi64, on29, on124 for help)
686C> - the length of the array should be at least 1608
687C> @param[out] ier return flag (equal to function value) in iw3unp29 docblock
688C> @return Y2K COMPLIANT
689C>
690C> @note aa unit number specified by input argument "nunit")
691C> called by subprogram iw3unp29.
692C>
693C> @author keyser @date 2013-03-20
694C>
695 FUNCTION i03o29(NUNIT, OBS, IER)
696C ---> formerly FUNCTION KW3O29
697
698 CHARACTER*1 cbuff(6432),con85l(32)
699 CHARACTER*2 cbf910
700 CHARACTER*4 cyr4d
701 CHARACTER*8 cbufr
702 INTEGER ibuff(5),obs(*)
703
704 equivalence(ibuff,cbuff)
705
706 SAVE
707
708 DATA ioldun/0/
709
710C TEST FOR NEW (OR PREVIOUSLY USED) NUNIT AND ADJUST 'NEXT'
711C (THIS ALLOWS USER TO SWITCH TO NEW NUNIT PRIOR TO READING TO
712C THE 'END OF FILE' ON AN OLD UNIT. ANY SWITCH TO A NEW UNIT WILL
713C START THE READ AT THE BEGINNING)
714C ----------------------------------------------------------------
715
716 if(nunit.eq.0) then
717 if(ioldun.gt.0) rewind ioldun
718 i03o29 = 0
719 ioldun = 0
720 return
721 end if
722
723 IF(nunit.NE.ioldun) THEN
724
725C THIS IS A NEW UNIT NUMBER, SET 'NEXT' TO 0 AND REWIND THIS UNIT
726C ---------------------------------------------------------------
727
728CDAKCDAK PRINT 87, NUNIT NOW REDUNDANT TO PRINT THIS
729 87 FORMAT(//' IW3UNP29/I03O29 - PREPARING TO READ ON29 DATA SET IN ',
730 $ 'UNIT ',i3/)
731 ioldun = nunit
732 next = 0
733 nfile = 0
734 rewind nunit
735 iswt = 0
736 END IF
737
738 10 CONTINUE
739
740 IF(next.NE.0) GO TO 70
741
742C COME HERE TO READ IN A NEW RECORD (EITHER REPORTS, Y2K COMPLIANT 40-
743C BYTE PSEUDO-ON85 LBL, NON-Y2K 32-BYTE COMPLIANT ON85 LBL, OR E-O-F)
744C --------------------------------------------------------------------
745
746 READ(nunit,END=9997,ERR=9998,FMT='(A8)') cbufr
747 IF(cbufr(1:4).EQ.'BUFR' .OR. cbufr(5:8).EQ.'BUFR') THEN
748
749C INPUT DATASET IS BUFR - EXIT IMMEDIATELY
750C ----------------------------------------
751
752 ioldun = 0
753 next = 0
754 ier = 999
755 GO TO 90
756 END IF
757
758 rewind nunit
759
760 READ(nunit,err=9998,END=9997,FMT='(6432A1)') cbuff
761
762C IF ISWT=1, CHARACTER DATA IN RECORD ARE EBCDIC - CONVERT TO ASCII
763C -----------------------------------------------------------------
764
765 IF(iswt.EQ.1) CALL aea(cbuff,cbuff,6432)
766
767 IF(nfile.EQ.0) THEN
768
769C TEST FOR EXPECTED HEADER LABEL
770C ------------------------------
771
772 nfile = 1
773
774 IF(cbuff(25)//cbuff(26)//cbuff(27)//cbuff(28).EQ.'WASH') THEN
775 ELSEIF(cbuff(21)//cbuff(22)//cbuff(23)//cbuff(24).EQ.'WASH')THEN
776 ELSE
777
778C QUICK CHECK SHOWS SOMETHING OTHER THAN EITHER Y2K COMPLIANT PSEUDO-
779C ON85 LBL OR NON-Y2K COMPLIANT ON85 LBL FOUND -- COULD MEAN CHARACTER
780C DATA ARE IN EBCDIC, SO SEE IF CONVERSION TO ASCII RECTIFIES THIS
781C ---------------------------------------------------------------------
782
783 print 78
784 78 FORMAT(/' ##IW3UNP29 - NEITHER EXPECTED Y2K COMPLIANT PSEUDO-',
785 $ 'ON85 LABEL NOR SECOND CHOICE NON-Y2K COMPLIANT ON85 LABEL ',
786 $ 'FOUND IN'/14x,'FIRST RECORD OF FILE -- TRY EBCDIC TO ASCII ',
787 $ 'CONVERSION'/)
788 CALL aea(cbuff,cbuff,6432)
789 iswt = 1
790 END IF
791
792 IF(cbuff(25)//cbuff(26)//cbuff(27)//cbuff(28).EQ.'WASH') THEN
793
794C THIS IS Y2K COMPLIANT 40-BYTE PSEUDO-ON85 LBL; RESET 'NEXT', SET
795C 'IER', FILL 'OBS(1)-(4)', AND QUIT
796C ---------------------------------------------------------------
797 next = 0
798 ier = 1
799 obs(1:5) = ibuff(1:5)
800 GO TO 90
801 ELSE IF(cbuff(21)//cbuff(22)//cbuff(23)//cbuff(24).EQ.'WASH')
802 $ THEN
803
804C THIS IS NON-Y2K COMPLIANT 32-BYTE ON85 LBL; RESET 'NEXT', SET
805C 'IER', USE "WINDOWING" TECHNIQUE TO CONTRUCT 4-DIGIT YEAR,
806C CONSTRUCT A 40-BYTE PSEUDO-ON85 LABE, FILL 'OBS(1)-(4)', AND QUIT
807C ------------------------------------------------------------------
808 print'(" ==> THIS IS A TRUE OFFICE NOTE 29 FILE!! <==")'
809 print 88
810 88 FORMAT(/' ##IW3UNP29/I03O29 - WARNING: ORIGINAL NON-Y2K ',
811 $ 'COMPLIANT ON85 LABEL FOUND IN FIRST RECORD OF FILE INSTEAD OF ',
812 $ 'EXPECTED'/30x,'Y2K COMPLIANT PSEUDO-ON85 LABEL -- THIS ',
813 $ 'ROUTINE IS FORCED TO USE "WINDOWING" TECHNIQUE TO CONTRUCT'/30x,
814 $'A Y2K COMPLIANT PSEUDO-ON85 LABEL TO RETURN TO CALLING PROGRAM'/)
815
816 next = 0
817 ier = 1
818
819 cbf910 = cbuff(9)//cbuff(10)
820 READ(cbf910,'(I2)') iyr2d
821 print'(" ##IW3UNP29/I03O29 - 2-DIGIT YEAR FOUND IN ON85 ",
822 $ "LBL (",A,") IS: ",I0/19X," USE WINDOWING TECHNIQUE TO ",
823 $ "OBTAIN 4-DIGIT YEAR")', cbuff(1:32),iyr2d
824 IF(iyr2d.GT.20) THEN
825 iyr4d = 1900 + iyr2d
826 ELSE
827 iyr4d = 2000 + iyr2d
828 ENDIF
829 print'(" ##IW3UNP29/I03O29 - 4-DIGIT YEAR OBTAINED VIA ",
830 $ "WINDOWING TECHNIQUE IS: ",I0/)', iyr4d
831 con85l = cbuff(1:32)
832 cbuff(7:40) = ' '
833 cbuff(9:10) = con85l(7:8)
834 WRITE(cyr4d,'(I4.4)') iyr4d
835 DO i=1,4
836 cbuff(10+i) = cyr4d(i:i)
837 ENDDO
838 cbuff(15:36) = con85l(11:32)
839 obs(1:5) = ibuff(1:5)
840 GO TO 90
841 ELSE
842
843C SOMETHING OTHER THAN EITHER Y2K COMPLIANT PSEUDO-ON85 LBL OR
844C NON-Y2K COMPLIANT ON85 LBL FOUND; RESET 'NEXT', SET 'IER' AND QUIT
845C ------------------------------------------------------------------
846CDAKCDAK PRINT 88 CAN'T PRINT THIS ANYMORE
847CDA88 FORMAT(/' ##IW3UNP29/I03O29 - EXPECTED ON85 LABEL NOT FOUND IN ',
848CDAK $ 'FIRST RECORD OF NEW LOGICAL FILE -- IER = 999'/)
849 ioldun = 0
850 next = 0
851 ier = 999
852 GO TO 90
853 END IF
854
855 END IF
856
857 IF(cbuff(1)//cbuff(2)//cbuff(3)//cbuff(4).EQ.'ENDO') THEN
858
859C LOGICAL "ENDOF FILE" READ; RESET NEXT, SET IER, AND QUIT
860C --------------------------------------------------------
861
862 next = 0
863 ier = 2
864 nfile = 0
865 GO TO 90
866 END IF
867 GO TO 70
868
869 9997 CONTINUE
870
871C PHYSICAL END OF FILE; RESET 'NEXT', SET 'IER' AND QUIT
872C ------------------------------------------------------
873
874 next = 0
875 ier = 3
876 GO TO 90
877
878 9998 CONTINUE
879
880C I/O ERROR; RESET 'NEXT', SET 'IER' AND QUIT
881C -------------------------------------------
882
883cppppp
884 print'(" ##IW3UNP29/I03O29 - ERROR READING DATA RECORD")'
885cppppp
886 next = 0
887 ier = 4
888 GO TO 90
889
890 70 CONTINUE
891
892C WORKING WITHIN ACTUAL DATA REC. READ, CALL W3FI64 TO READ IN NEXT RPT
893C ---------------------------------------------------------------------
894
895 CALL w3fi64(cbuff,obs,next)
896
897 IF(next.GE.0) THEN
898
899C REPORT SUCCESSFULLY RETURNED IN ARRAY 'OBS'
900C -------------------------------------------
901
902 ier = 0
903
904 ELSE
905
906C HIT END-OF-RECORD, OR INTERNAL READ ERROR ENCOUNTERED & CAN'T RECOVER
907C -- READ IN NEXT RECORD OF REPORTS
908C ---------------------------------------------------------------------
909
910 next = 0
911 GO TO 10
912 END IF
913
914 90 CONTINUE
915
916 i03o29 = ier
917
918 RETURN
919
920 END
921C***********************************************************************
922C> This function read subset and returns group name.
923C> @param SUBSET subset
924C> @return group name
925C>
926C> @author Dennis Keyser @date 2013-03-20
927C>
928C***********************************************************************
929 FUNCTION c01o29(SUBSET)
930C ---> formerly FUNCTION ADP
931
932 CHARACTER*(*) subset
933 CHARACTER*6 c01o29
934
935 SAVE
936
937 c01o29 = 'NONE'
938
939 IF(subset(1:5).EQ.'NC000') c01o29 = 'ADPSFC'
940 IF(subset(1:5).EQ.'NC001') THEN
941 IF(subset(6:8).NE.'006') THEN
942 c01o29 = 'SFCSHP'
943 ELSE
944 c01o29 = 'SFCBOG'
945 END IF
946 END IF
947 IF(subset(1:5).EQ.'NC002') c01o29 = 'ADPUPA'
948 IF(subset(1:5).EQ.'NC004') c01o29 = 'AIRCFT'
949 IF(subset(1:5).EQ.'NC005') c01o29 = 'SATWND'
950 IF(subset(1:5).EQ.'NC012') c01o29 = 'SPSSMI'
951
952 IF(subset .EQ. 'NC003101') c01o29 = 'SATEMP'
953 IF(subset .EQ. 'NC004004') c01o29 = 'AIRCAR'
954 IF(subset .EQ. 'NC004005') c01o29 = 'ADPUPA'
955
956 IF(subset .EQ. 'ADPSFC') c01o29 = 'ADPSFC'
957 IF(subset .EQ. 'SFCSHP') c01o29 = 'SFCSHP'
958 IF(subset .EQ. 'SFCBOG') c01o29 = 'SFCBOG'
959 IF(subset .EQ. 'ADPUPA') c01o29 = 'ADPUPA'
960 IF(subset .EQ. 'AIRCFT') c01o29 = 'AIRCFT'
961 IF(subset .EQ. 'SATWND') c01o29 = 'SATWND'
962 IF(subset .EQ. 'SATEMP') c01o29 = 'SATEMP'
963 IF(subset .EQ. 'AIRCAR') c01o29 = 'AIRCAR'
964 IF(subset .EQ. 'SPSSMI') c01o29 = 'SPSSMI'
965
966 IF(c01o29.EQ.'NONE') print'(" ##IW3UNP29/C01O29 - UNKNOWN SUBSET",
967 $ " (=",A,") -- CONTINUE~~")', subset
968
969 RETURN
970 END
971C***********************************************************************
972C> This function read subset and returns corresponding file data.
973C> @param SUBSET subset
974C> @param LUNIT full path of file
975C> @param OBS data output
976C> @return file data
977C>
978C> @author Dennis Keyser @date 2013-03-20
979C>
980C***********************************************************************
981 FUNCTION r01o29(SUBSET,LUNIT,OBS)
982C ---> formerly FUNCTION ADC
983
984 CHARACTER*(*) subset
985 CHARACTER*6 c01o29,adpsub
986 dimension obs(*)
987
988 SAVE
989
990C FIND AN ON29/124 DATA TYPE AND CALL A TRANSLATOR
991C ------------------------------------------------
992
993 r01o29 = 4
994 adpsub = c01o29(subset)
995 IF(adpsub .EQ. 'ADPSFC') r01o29 = r04o29(lunit,obs)
996 IF(adpsub .EQ. 'SFCSHP') r01o29 = r04o29(lunit,obs)
997 IF(adpsub .EQ. 'SFCBOG') r01o29 = r04o29(lunit,obs)
998 IF(adpsub .EQ. 'ADPUPA') r01o29 = r03o29(lunit,obs)
999 IF(adpsub .EQ. 'AIRCFT') r01o29 = r05o29(lunit,obs)
1000 IF(adpsub .EQ. 'AIRCAR') r01o29 = r05o29(lunit,obs)
1001 IF(adpsub .EQ. 'SATWND') r01o29 = r06o29(lunit,obs)
1002 IF(adpsub .EQ. 'SPSSMI') r01o29 = r07o29(lunit,obs)
1003 RETURN
1004 END
1005C***********************************************************************
1006C***********************************************************************
1007C***********************************************************************
1008 SUBROUTINE s01o29(SID,XOB,YOB,RHR,RCH,RSV,RSV2,ELV,ITP,RTP)
1009C ---> Formerly SUBROUTINE O29HDR
1010
1011 common/io29dd/hdr(12),rcats(50,150,11),ikat(11),mcat(11),ncat(11)
1012 common/io29ll/bmiss
1013
1014 CHARACTER*(*) rsv,rsv2
1015 CHARACTER*8 cob,sid,rct
1016 dimension ihdr(12),rhdr(12),icats(50,150,11)
1017 REAL(8) bmiss
1018 equivalence(ihdr(1),rhdr(1)),(cob,iob),(icats,rcats)
1019
1020 SAVE
1021
1022 DATA omiss/99999/
1023
1024C INITIALIZE THE UNPACK ARRAY TO MISSINGS
1025C ---------------------------------------
1026
1027 ncat = 0
1028 rcats = omiss
1029 cob = ' '
1030 icats(6,1:149,1) = iob
1031 icats(4,1:149,2) = iob
1032 icats(4,1:149,3) = iob
1033 icats(4,1:149,4) = iob
1034 icats(6,1:149,5) = iob
1035 icats(6,1:149,6) = iob
1036 icats(3,1:149,7) = iob
1037 icats(3,1:149,8) = iob
1038
1039C WRITE THE RECEIPT TIME IN CHARACTERS
1040C ------------------------------------
1041
1042 rct = '9999 '
1043 IF(rch*100.LT.2401.AND.rch*100.GT.-1)
1044 $ WRITE(rct,'(I4.4)') nint(rch*100.)
1045
1046C STORE THE ON29 HEADER INFORMATION INTO UNP FORMAT
1047C -------------------------------------------------
1048
1049 rhdr( 1) = omiss
1050 IF(yob.LT.bmiss) rhdr( 1) = nint(100.*yob)
1051cppppp
1052 IF(yob.GE.bmiss) print'(" ~~IW3UNP29/S01O29: ID ",A," has a ",
1053 $ "missing LATITUDE - on29 hdr, word 1 is set to ",G0)',
1054 $ sid,rhdr(1)
1055cppppp
1056 rhdr( 2) = omiss
1057 IF(xob.LT.bmiss) rhdr( 2) = nint(100.*mod(720.-xob,360.))
1058cppppp
1059 IF(xob.GE.bmiss) print'(" ~~IW3UNP29/S01O29: ID ",A," has a ",
1060 $ "missing LONGITUDE - on29 hdr, word 2 is set to ",G0)',
1061 $ sid,rhdr(2)
1062cppppp
1063 rhdr( 3) = omiss
1064 rhdr( 4) = omiss
1065 IF(rhr.LT.bmiss) rhdr( 4) = nint((100.*rhr)+0.0001)
1066cppppp
1067 IF(rhr.GE.bmiss) print'(" ~~IW3UNP29/S01O29: ID ",A," has a ",
1068 $ "missing OB TIME - on29 hdr, word 4 is set to ",G0)', sid,rhdr(4)
1069cppppp
1070 IF(rsv2.EQ.' ') THEN
1071 cob = ' '
1072 cob(1:4) = rct(3:4)//rsv(1:2)
1073 ihdr(5) = iob
1074 cob = ' '
1075 cob(1:3) = rct(1:2)//rsv(3:3)
1076 ihdr(6) = iob
1077 ELSE
1078 cob = ' '
1079 cob(1:4) = rsv2(3:4)//rsv(1:2)
1080 ihdr(5) = iob
1081 cob = ' '
1082 cob(1:3) = rsv2(1:2)//rsv(3:3)
1083 ihdr(6) = iob
1084 END IF
1085 rhdr( 7) = nint(elv)
1086 ihdr( 8) = itp
1087 ihdr( 9) = rtp
1088 rhdr(10) = omiss
1089 cob = ' '
1090 cob(1:4) = sid(1:4)
1091 ihdr(11) = iob
1092 cob = ' '
1093 cob(1:4) = sid(5:6)//' '
1094 ihdr(12) = iob
1095
1096C STORE THE HEADER INTO A HOLDING ARRAY
1097C -------------------------------------
1098
1099 hdr = rhdr
1100
1101 RETURN
1102 END
1103C***********************************************************************
1104C***********************************************************************
1105C***********************************************************************
1106 SUBROUTINE s02o29(ICAT,N,*)
1107C ---> Formerly SUBROUTINE O29CAT
1108
1109 common/io29dd/hdr(12),rcats(50,150,11),ikat(11),mcat(11),ncat(11)
1110 common/io29ee/pob(255),qob(255),tob(255),zob(255),dob(255),
1111 $ sob(255),vsg(255),clp(255),cla(255),ob8(255),
1112 $ cf8(255)
1113 common/io29ff/pqm(255),qqm(255),tqm(255),zqm(255),wqm(255),
1114 $ qcp(255),qca(255),q81(255),q82(255)
1115 common/io29gg/psl,stp,sdr,ssp,stm,dpd,tmx,tmi,hvz,prw,pw1,ccn,chn,
1116 $ ctl,ctm,cth,hcb,cpt,apt,pc6,snd,p24,dop,pow,how,swd,
1117 $ swp,swh,sst,spg,spd,shc,sas,wes
1118 common/io29hh/psq,spq,swq,stq,ddq
1119 common/io29ii/pwmin
1120 common/io29ll/bmiss
1121
1122 CHARACTER*8 cob,c11,c12
1123 CHARACTER*1 pqm,qqm,tqm,zqm,wqm,qcp,qca,q81,q82,psq,spq,swq,stq,
1124 $ ddq
1125 dimension rcat(50),jcat(50)
1126 REAL(8) bmiss
1127 equivalence(rcat(1),jcat(1)),(c11,hdr(11)),(c12,hdr(12)),
1128 $ (cob,iob)
1129 LOGICAL surf
1130
1131 SAVE
1132
1133cppppp-ID
1134 iprint = 0
1135c if(C11(1:4)//C12(1:2).eq.'59758 ') iprint = 1
1136c if(C11(1:4)//C12(1:2).eq.'59362 ') iprint = 1
1137c if(C11(1:4)//C12(1:2).eq.'57957 ') iprint = 1
1138c if(C11(1:4)//C12(1:2).eq.'74794 ') iprint = 1
1139c if(C11(1:4)//C12(1:2).eq.'74389 ') iprint = 1
1140c if(C11(1:4)//C12(1:2).eq.'96801A') iprint = 1
1141cppppp-ID
1142
1143 surf = .false.
1144 GOTO 1
1145
1146C ENTRY POINT SE01O29 FORCES DATA INTO THE SURFACE (FIRST) LEVEL
1147C --------------------------------------------------------------
1148
1149 entry se01o29(icat,n)
1150C ---> formerly ENTRY O29SFC
1151 surf = .true.
1152
1153C CHECK THE PARAMETERS COMING IN
1154C ------------------------------
1155
11561 kcat = 0
1157 DO i = 1,11
1158 IF(icat.EQ.ikat(i)) THEN
1159 kcat = i
1160 GO TO 991
1161 END IF
1162 ENDDO
1163
1164 991 CONTINUE
1165
1166C PARAMETER ICAT (ON29 CATEGORY) OUT OF BOUNDS RETURNS A 999
1167C ----------------------------------------------------------
1168
1169 IF(kcat.EQ.0) THEN
1170 print'(" ##IW3UNP29/S02O29 - ON29 CATEGORY ",I0," OUT OF ",
1171 $ "BOUNDS -- IER = 999")', icat
1172 RETURN 1
1173 END IF
1174
1175C PARAMETER N (LEVEL INDEX) OUT OF BOUNDS RETURNS A 999
1176C -----------------------------------------------------
1177
1178 IF(n.GT.255) THEN
1179 print'(" ##IW3UNP29/S02O29 - LEVEL INDEX ",I0," EXCEEDS 255 ",
1180 $ "-- IER = 999")', n
1181 RETURN 1
1182 END IF
1183
1184C MAKE A MISSING LEVEL AND RETURN WHEN N=0 (NOT ALLOWED FOR CAT 01)
1185C -----------------------------------------------------------------
1186
1187 IF(n.EQ.0) THEN
1188 IF(kcat.EQ.1) RETURN
1189 ncat(kcat) = min(149,ncat(kcat)+1)
1190cppppp
1191 if(iprint.eq.1)
1192 $ print'(" To prepare for sfc. data, write all missings on ",
1193 $ "lvl ",I0," for cat ",I0)', ncat(kcat),kcat
1194cppppp
1195 RETURN
1196 END IF
1197
1198C FIGURE OUT WHICH LEVEL TO UPDATE AND RESET THE LEVEL COUNTER
1199C ------------------------------------------------------------
1200
1201 IF(kcat.EQ.1) THEN
1202 l = i04o29(pob(n)*.1)
1203 IF(l.EQ.999999) GO TO 9999
1204
1205C BAD MANDATORY LEVEL RETURNS A 999
1206C ---------------------------------
1207
1208 IF(l.LE.0) THEN
1209 print'(" ##IW3UNP29/S02O29 - BAD MANDATORY LEVEL (P = ",
1210 $ G0,") -- IER = 999")', pob(n)
1211 RETURN 1
1212 END IF
1213 ncat(kcat) = max(ncat(kcat),l)
1214cppppp
1215 if(iprint.eq.1)
1216 $ print'(" Will write cat. 1 data on lvl ",I0," for cat ",I0,
1217 $ ", - total no. cat. 1 lvls processed so far = ",I0)',
1218 $ l,kcat,ncat(kcat)
1219cppppp
1220 ELSEIF(surf) THEN
1221 l = 1
1222 ncat(kcat) = max(ncat(kcat),1)
1223cppppp
1224 if(iprint.eq.1)
1225 $ print'(" Will write cat. ",I0," SURFACE data on lvl ",I0,
1226 $ ", - total no. cat. ",I0," lvls processed so far = ",I0)',
1227 $ kcat,l,kcat,ncat(kcat)
1228cppppp
1229 ELSE
1230 l = min(149,ncat(kcat)+1)
1231 IF(l.EQ.149) THEN
1232cppppp
1233 print'(" ~~IW3UNP29/S02O29: ID ",A," - This cat. ",I0,
1234 $ " level cannot be processed because the limit has already",
1235 $ " been reached")', c11(1:4)//c12(1:2),kcat
1236cppppp
1237 RETURN
1238 END IF
1239 ncat(kcat) = l
1240cppppp
1241 if(iprint.eq.1)
1242 $ print'(" Will write cat. ",I0," NON-SFC data on lvl ",I0,
1243 $ ", - total no. cat. ",I0," lvls processed so far = ",I0)',
1244 $ kcat,l,kcat,ncat(kcat)
1245cppppp
1246 END IF
1247
1248C EACH CATEGORY NEEDS A SPECIFIC DATA ARRANGEMENT
1249C -----------------------------------------------
1250
1251 cob = ' '
1252 IF(icat.EQ.1) THEN
1253 rcat(1) = min(nint(zob(n)),nint(rcats(1,l,kcat)))
1254 rcat(2) = min(nint(tob(n)),nint(rcats(2,l,kcat)))
1255 rcat(3) = min(nint(qob(n)),nint(rcats(3,l,kcat)))
1256 rcat(4) = min(nint(dob(n)),nint(rcats(4,l,kcat)))
1257 rcat(5) = min(nint(sob(n)),nint(rcats(5,l,kcat)))
1258 cob(1:4) = zqm(n)//tqm(n)//qqm(n)//wqm(n)
1259 jcat(6) = iob
1260 ELSEIF(icat.EQ.2) THEN
1261 rcat(1) = min(nint(pob(n)),99999)
1262 rcat(2) = min(nint(tob(n)),99999)
1263 rcat(3) = min(nint(qob(n)),99999)
1264 cob(1:3) = pqm(n)//tqm(n)//qqm(n)
1265 jcat(4) = iob
1266 ELSEIF(icat.EQ.3) THEN
1267 rcat(1) = min(nint(pob(n)),99999)
1268 rcat(2) = min(nint(dob(n)),99999)
1269 rcat(3) = min(nint(sob(n)),99999)
1270
1271C MARK THE TROPOPAUSE LEVEL IN CAT. 3
1272
1273 IF(nint(vsg(n)).EQ.16) pqm(n) = 'T'
1274
1275C MARK THE MAXIMUM WIND LEVEL IN CAT. 3
1276
1277 IF(nint(vsg(n)).EQ. 8) THEN
1278 pqm(n) = 'W'
1279 IF(pob(n).EQ.pwmin) pqm(n) = 'X'
1280 END IF
1281 cob(1:2) = pqm(n)//wqm(n)
1282 jcat(4) = iob
1283 ELSEIF(icat.EQ.4) THEN
1284 rcat(1) = min(nint(zob(n)),99999)
1285 rcat(2) = min(nint(dob(n)),99999)
1286 rcat(3) = min(nint(sob(n)),99999)
1287 cob(1:2) = zqm(n)//wqm(n)
1288 jcat(4) = iob
1289 ELSEIF(icat.EQ.5) THEN
1290 rcat(1) = min(nint(pob(n)),99999)
1291 rcat(2) = min(nint(tob(n)),99999)
1292 rcat(3) = min(nint(qob(n)),99999)
1293 rcat(4) = min(nint(dob(n)),99999)
1294 rcat(5) = min(nint(sob(n)),99999)
1295 cob(1:4) = pqm(n)//tqm(n)//qqm(n)//wqm(n)
1296 jcat(6) = iob
1297 ELSEIF(icat.EQ.6) THEN
1298 rcat(1) = min(nint(zob(n)),99999)
1299 rcat(2) = min(nint(tob(n)),99999)
1300 rcat(3) = min(nint(qob(n)),99999)
1301 rcat(4) = min(nint(dob(n)),99999)
1302 rcat(5) = min(nint(sob(n)),99999)
1303 cob(1:4) = zqm(n)//tqm(n)//qqm(n)//wqm(n)
1304 jcat(6) = iob
1305 ELSEIF(icat.EQ.7) THEN
1306 rcat(1) = min(nint(clp(n)),99999)
1307 rcat(2) = min(nint(cla(n)),99999)
1308 cob(1:2) = qcp(n)//qca(n)
1309 jcat(3) = iob
1310 ELSEIF(icat.EQ.8) THEN
1311 rcat(1) = min(nint(ob8(n)),99999)
1312 rcat(2) = min(nint(cf8(n)),99999)
1313 cob(1:2) = q81(n)//q82(n)
1314 jcat(3) = iob
1315 ELSEIF(icat.EQ.51) THEN
1316 rcat( 1) = min(nint(psl),99999)
1317 rcat( 2) = min(nint(stp),99999)
1318 rcat( 3) = min(nint(sdr),99999)
1319 rcat( 4) = min(nint(ssp),99999)
1320 rcat( 5) = min(nint(stm),99999)
1321 rcat( 6) = min(nint(dpd),99999)
1322 rcat( 7) = min(nint(tmx),99999)
1323 rcat( 8) = min(nint(tmi),99999)
1324 cob(1:4) = psq//spq//swq//stq
1325 jcat(9) = iob
1326 cob = ' '
1327 cob(1:1) = ddq
1328 jcat(10) = iob
1329 jcat(11) = min(nint(hvz),99999)
1330 jcat(12) = min(nint(prw),99999)
1331 jcat(13) = min(nint(pw1),99999)
1332 jcat(14) = min(nint(ccn),99999)
1333 jcat(15) = min(nint(chn),99999)
1334 jcat(16) = min(nint(ctl),99999)
1335 jcat(17) = min(nint(hcb),99999)
1336 jcat(18) = min(nint(ctm),99999)
1337 jcat(19) = min(nint(cth),99999)
1338 jcat(20) = min(nint(cpt),99999)
1339 rcat(21) = min(abs(nint(apt)),99999)
1340 IF(cpt.GE.bmiss.AND.apt.LT.0.)
1341 $ rcat(21) = min(abs(nint(apt))+500,99999)
1342 ELSEIF(icat.EQ.52) THEN
1343 jcat( 1) = min(nint(pc6),99999)
1344 jcat( 2) = min(nint(snd),99999)
1345 jcat( 3) = min(nint(p24),99999)
1346 jcat( 4) = min(nint(dop),99999)
1347 jcat( 5) = min(nint(pow),99999)
1348 jcat( 6) = min(nint(how),99999)
1349 jcat( 7) = min(nint(swd),99999)
1350 jcat( 8) = min(nint(swp),99999)
1351 jcat( 9) = min(nint(swh),99999)
1352 jcat(10) = min(nint(sst),99999)
1353 jcat(11) = min(nint(spg),99999)
1354 jcat(12) = min(nint(spd),99999)
1355 jcat(13) = min(nint(shc),99999)
1356 jcat(14) = min(nint(sas),99999)
1357 jcat(15) = min(nint(wes),99999)
1358 ELSE
1359
1360C UNSUPPORTED CATEGORY RETURNS A 999
1361C ----------------------------------
1362
1363 print'(" ##IW3UNP29/S02O29 - CATEGORY ",I0," NOT SUPPORTED ",
1364 $ "-- IER = 999")', icat
1365 RETURN 1
1366 END IF
1367
1368C TRANSFER THE LEVEL DATA INTO THE HOLDING ARRAY AND EXIT
1369C -------------------------------------------------------
1370
1371 DO i = 1,mcat(kcat)
1372 rcats(i,l,kcat) = rcat(i)
1373 ENDDO
1374
1375 RETURN
1376 9999 CONTINUE
1377 RETURN 1
1378 END
1379C***********************************************************************
1380C***********************************************************************
1381C***********************************************************************
1382 SUBROUTINE s03o29(UNP,SUBSET,*,*)
1383C ---> Formerly SUBROUTINE O29UNP
1384
1385 common/io29dd/hdr(12),rcats(50,150,11),ikat(11),mcat(11),ncat(11)
1386
1387 dimension rcat(50),jcat(50),unp(*)
1388 CHARACTER*8 subset
1389 equivalence(rcat(1),jcat(1))
1390
1391 SAVE
1392
1393C CALL TO SORT CATEGORIES 02, 03, 04, AND 08 LEVELS
1394C -------------------------------------------------
1395
1396 CALL s04o29
1397
1398C TRANSFER DATA FROM ALL CATEGORIES INTO UNP ARRAY & SET POINTERS
1399C ---------------------------------------------------------------
1400
1401 indx = 43
1402 jcat = 0
1403 nlevto = 0
1404 nlevc8 = 0
1405
1406 DO k = 1,11
1407 jcat(2*k+11) = ncat(k)
1408 IF(k.NE.7.AND.k.NE.8.AND.k.NE.11) THEN
1409 nlevto = nlevto + ncat(k)
1410 ELSE IF(k.EQ.8) THEN
1411 nlevc8 = nlevc8 + ncat(k)
1412 END IF
1413 IF(ncat(k).GT.0) jcat(2*k+12) = indx
1414 IF(ncat(k).EQ.0) jcat(2*k+12) = 0
1415 DO j = 1,ncat(k)
1416 DO i = 1,mcat(k)
1417
1418C UNPACKED ON29 REPORT CONTAINS MORE THAN 1608 WORDS - RETURNS A 999
1419C ------------------------------------------------------------------
1420
1421 IF(indx.GT.1608) THEN
1422 print'(" ##IW3UNP29/S03O29 - UNPKED ON29 RPT CONTAINS ",
1423 $ I0," WORDS, > LIMIT OF 1608 -- IER = 999")', indx
1424 RETURN 1
1425 END IF
1426 unp(indx) = rcats(i,j,k)
1427 indx = indx+1
1428 ENDDO
1429 ENDDO
1430 ENDDO
1431
1432C RETURN WITHOUT PROCESSING THIS REPORT IF NO DATA IN CAT. 1-6, 51, 52
1433C (UNLESS SSM/I REPORT, THEN DO NOT RETURN UNLESS ALSO NO CAT. 8 DATA)
1434C --------------------------------------------------------------------
1435
1436 IF(nlevto.EQ.0) THEN
1437 IF(subset(1:5).NE.'NC012') THEN
1438 RETURN 2
1439 ELSE
1440 IF(nlevc8.EQ.0) RETURN 2
1441 END IF
1442 END IF
1443
1444C TRANSFER THE HEADER AND POINTER ARRAYS INTO UNP
1445C -----------------------------------------------
1446
1447 unp(1:12) = hdr
1448 unp(13:42) = rcat(13:42)
1449
1450 RETURN
1451 END
1452C***********************************************************************
1453C***********************************************************************
1454C***********************************************************************
1455 SUBROUTINE s04o29
1456C ---> Formerly SUBROUTINE O29SRT
1457
1458 common/io29dd/hdr(12),rcats(50,150,11),ikat(11),mcat(11),ncat(11)
1459cppppp
1460 character*8 c11,c12,sid
1461cppppp
1462
1463 dimension rcat(50,150),iord(150),iwork(65536),scat(50,150),rctl(3)
1464cppppp
1465 equivalence(c11,hdr(11)),(c12,hdr(12))
1466cppppp
1467
1468 SAVE
1469
1470cppppp
1471 sid = c11(1:4)//c12(1:4)
1472cppppp
1473
1474C SORT CATEGORIES 2, 3, AND 4 - LEAVE THE FIRST LEVEL IN EACH INTACT
1475C ------------------------------------------------------------------
1476
1477 DO k=2,4
1478 IF(ncat(k).GT.1) THEN
1479 DO j=1,ncat(k)-1
1480 DO i=1,mcat(k)
1481 scat(i,j) = rcats(i,j+1,k)
1482 ENDDO
1483 ENDDO
1484 CALL orders(2,iwork,scat(1,1),iord,ncat(k)-1,50,8,2)
1485 rctl = 10e9
1486 DO j=1,ncat(k)-1
1487 IF(k.LT.4) jj = iord((ncat(k)-1)-j+1)
1488 IF(k.EQ.4) jj = iord(j)
1489 DO i=1,mcat(k)
1490 rcat(i,j) = scat(i,jj)
1491 ENDDO
1492 idup = 0
1493 IF(nint(rcat(1,j)).EQ.nint(rctl(1))) THEN
1494 IF(nint(rcat(2,j)).EQ.nint(rctl(2)).AND.
1495 $ nint(rcat(3,j)).EQ.nint(rctl(3))) THEN
1496cppppp
1497 if(k.ne.4) then
1498 print'(" ~~@@IW3UNP29/S04O29: ID ",A," has a ",
1499 $ "dupl. cat. ",I0," lvl (all data) at ",G0," mb -- lvl will be ",
1500 $ "excluded from processing")', sid,k,rcat(1,j)*.1
1501 else
1502 print'(" ~~@@IW3UNP29/S04O29: ID ",A," has a ",
1503 $ "dupl. cat. ",I0," lvl (all data) at ",G0," m -- lvl will be ",
1504 $ "excluded from processing")', sid,k,rcat(1,j)
1505 end if
1506cppppp
1507 idup = 1
1508 ELSE
1509cppppp
1510 if(k.ne.4) then
1511 print'(" ~~@@#IW3UNP29/S04O29: ID ",A," has a ",
1512 $ "dupl. cat. ",I0," press. lvl (data differ) at ",G0," mb -- lvl",
1513 $ " will NOT be excluded")', sid,k,rcat(1,j)*.1
1514 else
1515 print'(" ~~@@#IW3UNP29/S04O29: ID ",A," has a ",
1516 $ "dupl. cat. ",I0," height lvl (data differ) at ",G0," m -- lvl ",
1517 $ "will NOT be excluded")', sid,k,rcat(1,j)
1518 end if
1519cppppp
1520 END IF
1521 END IF
1522 rctl = rcat(1:3,j)
1523 IF(idup.EQ.1) rcat(1,j) = 10e8
1524 ENDDO
1525 jjj = 1
1526 DO j=2,ncat(k)
1527 IF(rcat(1,j-1).GE.10e8) GO TO 887
1528 jjj = jjj + 1
1529 DO i=1,mcat(k)
1530 rcats(i,jjj,k) = rcat(i,j-1)
1531 ENDDO
1532 887 CONTINUE
1533 ENDDO
1534cppppp
1535 if(jjj.ne.ncat(k))
1536 $ print'(" ~~@@IW3UNP29/S04O29: ID ",A," has had ",I0,
1537 $ " lvls removed due to their being duplicates")',
1538 $ sid,ncat(k)-jjj
1539cppppp
1540 ncat(k) = jjj
1541 end if
1542 IF(ncat(k).EQ.1) THEN
1543 IF(min(rcats(1,1,k),rcats(2,1,k),rcats(3,1,k)).GT.99998.8)
1544 $ ncat(k) = 0
1545 END IF
1546 ENDDO
1547
1548C SORT CATEGORY 08 BY CODE FIGURE
1549C -------------------------------
1550
1551 DO k=8,8
1552 IF(ncat(k).GT.1) THEN
1553 CALL orders(2,iwork,rcats(2,1,k),iord,ncat(k),50,8,2)
1554 DO j=1,ncat(k)
1555 DO i=1,mcat(k)
1556 rcat(i,j) = rcats(i,iord(j),k)
1557 ENDDO
1558 ENDDO
1559 DO j=1,ncat(k)
1560 DO i=1,mcat(k)
1561 rcats(i,j,k) = rcat(i,j)
1562 ENDDO
1563 ENDDO
1564 END IF
1565 ENDDO
1566
1567C NORMAL EXIT
1568C -----------
1569
1570 RETURN
1571 END
1572C***********************************************************************
1573C***********************************************************************
1574C***********************************************************************
1575 SUBROUTINE s05o29
1576C ---> Formerly SUBROUTINE O29INX
1577
1578 common/io29ee/obs(255,11)
1579 common/io29ff/qms(255,9)
1580 common/io29gg/sfo(34)
1581 common/io29hh/sfq(5)
1582 common/io29ll/bmiss
1583
1584 CHARACTER*1 qms,sfq
1585
1586 REAL(8) bmiss
1587
1588 SAVE
1589
1590C SET THE INPUT DATA ARRAYS TO MISSING OR BLANK
1591C ---------------------------------------------
1592
1593 obs = bmiss
1594 qms = ' '
1595 sfo = bmiss
1596 sfq = ' '
1597
1598 RETURN
1599 END
1600C***********************************************************************
1601C***********************************************************************
1602C***********************************************************************
1603 FUNCTION i04o29(P)
1604C ---> formerly FUNCTION MANO29
1605
1606 common/io29jj/iset,manlin(1001)
1607
1608 SAVE
1609
1610 IF(iset.EQ.0) THEN
1611 manlin = 0
1612
1613 manlin(1000) = 1
1614 manlin(850) = 2
1615 manlin(700) = 3
1616 manlin(500) = 4
1617 manlin(400) = 5
1618 manlin(300) = 6
1619 manlin(250) = 7
1620 manlin(200) = 8
1621 manlin(150) = 9
1622 manlin(100) = 10
1623 manlin(70) = 11
1624 manlin(50) = 12
1625 manlin(30) = 13
1626 manlin(20) = 14
1627 manlin(10) = 15
1628 manlin(7) = 16
1629 manlin(5) = 17
1630 manlin(3) = 18
1631 manlin(2) = 19
1632 manlin(1) = 20
1633
1634 iset = 1
1635 END IF
1636
1637 ip = nint(p*10.)
1638
1639 IF(ip.GT.10000 .OR. ip.LT.10 .OR. mod(ip,10).NE.0) THEN
1640 i04o29 = 0
1641 ELSE
1642 i04o29 = manlin(ip/10)
1643 END IF
1644
1645 RETURN
1646
1647 END
1648C***********************************************************************
1649C***********************************************************************
1650C***********************************************************************
1651 FUNCTION r02o29()
1652C ---> formerly FUNCTION ONFUN
1653
1654 common/io29ll/bmiss
1655
1656 CHARACTER*8 subset,rpid
1657 LOGICAL l02o29,l03o29
1658 INTEGER kkk(0:99),kkkk(49)
1659 REAL(8) bmiss
1660
1661 SAVE
1662
1663 DATA grav/9.8/,cm2k/1.94/,tzro/273.15/
1664 DATA kkk /5*90,16*91,30*92,49*93/
1665 DATA kkkk/94,2*95,6*96,10*97,30*98/
1666
1667 prs1(z) = 1013.25 * (((288.15 - (.0065 * z))/288.15)**5.256)
1668 prs2(z) = 226.3 * exp(1.576106e-4 * (11000. - z))
1669 prs3(pmnd,temp,z,zmnd)
1670 $ = pmnd * (((temp - (.0065 * (z - zmnd)))/temp)**5.256)
1671 es(t) = 6.1078 * exp((17.269 * (t-273.16))/((t-273.16)+237.3))
1672 qfrmtp(t,pppp) = (0.622 * es(t))/(pppp-(0.378 * es(t)))
1673 hgtf(p) = (1.-(p/1013.25)**(1./5.256))*(288.15/.0065)
1674
1675 r02o29 = 0
1676
1677 RETURN
1678
1679 entry e01o29(prs)
1680C ---> formerly ENTRY ONPRS
1681 IF(prs.LT.bmiss) e01o29 = nint(prs*.1)
1682 IF(prs.GE.bmiss) e01o29 = bmiss
1683 RETURN
1684 entry e37o29(pmnd,temp,hgt,zmnd,tqm)
1685C ---> formerly ENTRY ONPFHT
1686 IF(hgt.GE.bmiss) THEN
1687 e37o29 = bmiss
1688 ELSE
1689 IF(hgt.LE.11000) THEN
1690 p = prs1(hgt)
1691 ELSE
1692 p = prs2(hgt)
1693 END IF
1694 IF(max(pmnd,zmnd).GE.bmiss) THEN
1695 e37o29 = p
1696 RETURN
1697 END IF
1698 IF(temp.GE.9999.) temp = bmiss
1699 IF(tqm.GE.bmiss) tqm = 2
1700 IF(temp.GE.bmiss.OR.tqm.GE.4) CALL w3fa03(p,d1,temp,d2)
1701 q = qfrmtp(temp,p)
1702 tvirt = temp * (1.0 + (0.61 * q))
1703 e37o29 = prs3(pmnd,tvirt,hgt,zmnd)
1704 END IF
1705 RETURN
1706 entry e03o29(prs)
1707C ---> formerly ENTRY ONHFP
1708 IF(prs.LT.bmiss) e03o29 = hgtf(prs)
1709 IF(prs.GE.bmiss) e03o29 = bmiss
1710 RETURN
1711 entry e04o29(wdr,wsp)
1712C ---> formerly ENTRY ONWDR
1713 e04o29 = wdr
1714 RETURN
1715 entry e05o29(wdr,wsp)
1716C ---> formerly ENTRY ONWSP
1717 IF(wsp.LT.bmiss) THEN
1718 e05o29 = (wsp*cm2k)
1719 e05o29 = e05o29 + 0.0000001
1720 ELSE
1721 e05o29 = bmiss
1722 END IF
1723 RETURN
1724 entry e06o29(tmp)
1725C ---> formerly ENTRY ONTMP
1726 itmp = nint(tmp*100.)
1727 itzro = nint(tzro*100.)
1728 IF(tmp.LT.bmiss) e06o29 = nint((itmp - itzro)*0.1)
1729 IF(tmp.GE.bmiss) e06o29 = bmiss
1730 RETURN
1731 entry e07o29(dpd,tmp)
1732C ---> formerly ENTRY ONDPD
1733 IF(dpd.LT.bmiss .AND. tmp.LT.bmiss) e07o29 = (tmp-dpd)*10.
1734 IF(dpd.GE.bmiss .OR. tmp.GE.bmiss) e07o29 = bmiss
1735 RETURN
1736 entry e08o29(hgt)
1737C ---> formerly ENTRY ONHGT
1738 e08o29 = hgt
1739 IF(hgt.LT.bmiss) e08o29 = (hgt/grav)
1740 RETURN
1741 entry e09o29(hvz)
1742C ---> formerly ENTRY ONHVZ
1743 IF(hvz.GE.bmiss.OR.hvz.LT.0.) THEN
1744 e09o29 = bmiss
1745 ELSE IF(nint(hvz).LT.6000) THEN
1746 e09o29 = min(int(nint(hvz)/100),50)
1747 ELSE IF(nint(hvz).LT.30000) THEN
1748 e09o29 = int(nint(hvz)/1000) + 50
1749 ELSE IF(nint(hvz).LE.70000) THEN
1750 e09o29 = int(nint(hvz)/5000) + 74
1751 ELSE
1752 e09o29 = 89
1753 END IF
1754 RETURN
1755 entry e10o29(prw)
1756C ---> formerly ENTRY ONPRW
1757 e10o29 = bmiss
1758 IF(prw.LT.bmiss) e10o29 = nint(mod(prw,100.))
1759 RETURN
1760 entry e11o29(paw)
1761C ---> formerly ENTRY ONPAW
1762 e11o29 = bmiss
1763 IF(paw.LT.bmiss) e11o29 = nint(mod(paw,10.))
1764 RETURN
1765 entry e12o29(ccn)
1766C ---> formerly ENTRY ONCCN
1767 IF(nint(ccn).EQ.0) THEN
1768 e12o29 = 0
1769 ELSE IF(ccn.LT. 15) THEN
1770 e12o29 = 1
1771 ELSE IF(ccn.LT. 35) THEN
1772 e12o29 = 2
1773 ELSE IF(ccn.LT. 45) THEN
1774 e12o29 = 3
1775 ELSE IF(ccn.LT. 55) THEN
1776 e12o29 = 4
1777 ELSE IF(ccn.LT. 65) THEN
1778 e12o29 = 5
1779 ELSE IF(ccn.LT. 85) THEN
1780 e12o29 = 6
1781 ELSE IF(ccn.LT.100) THEN
1782 e12o29 = 7
1783 ELSE IF(nint(ccn).EQ.100) THEN
1784 e12o29 = 8
1785 ELSE
1786 e12o29 = bmiss
1787 END IF
1788 RETURN
1789 entry e13o29(cla)
1790C ---> formerly ENTRY ONCLA
1791 e13o29 = bmiss
1792 IF(cla.EQ.0) e13o29 = 0
1793 IF(cla.EQ.1) e13o29 = 5
1794 IF(cla.EQ.2) e13o29 = 25
1795 IF(cla.EQ.3) e13o29 = 40
1796 IF(cla.EQ.4) e13o29 = 50
1797 IF(cla.EQ.5) e13o29 = 60
1798 IF(cla.EQ.6) e13o29 = 75
1799 IF(cla.EQ.7) e13o29 = 95
1800 IF(cla.EQ.8) e13o29 = 100
1801 RETURN
1802 entry e14o29(ccl,ccm)
1803C ---> formerly ENTRY ONCHN
1804 e14o29 = ccl
1805 IF(nint(e14o29).EQ.0) e14o29 = ccm
1806 IF(nint(e14o29).LT.10) RETURN
1807 IF(nint(e14o29).EQ.10) THEN
1808 e14o29 = 9.
1809 ELSE IF(nint(e14o29).EQ.15) THEN
1810 e14o29 = 10.
1811 ELSE
1812 e14o29 = bmiss
1813 END IF
1814 RETURN
1815 entry e15o29(ctlmh)
1816C ---> formerly ENTRY ONCTL, ONCTM, ONCTH
1817 e15o29 = ctlmh
1818 RETURN
1819 entry e18o29(chl,chm,chh,ctl,ctm,cth)
1820C ---> formerly ENTRY ONHCB
1821 IF(nint(max(ctl,ctm,cth)).EQ.0) THEN
1822 e18o29 = 9
1823 RETURN
1824 END IF
1825 e18o29 = bmiss
1826 IF(chh.LT.bmiss) e18o29 = chh
1827 IF(chm.LT.bmiss) e18o29 = chm
1828 IF(chl.LT.bmiss) e18o29 = chl
1829 IF(e18o29.GE.bmiss.OR.e18o29.LT.0) RETURN
1830 IF(e18o29.LT. 150) THEN
1831 e18o29 = 0
1832 ELSE IF(e18o29.LT. 350) THEN
1833 e18o29 = 1
1834 ELSE IF(e18o29.LT. 650) THEN
1835 e18o29 = 2
1836 ELSE IF(e18o29.LT. 950) THEN
1837 e18o29 = 3
1838 ELSE IF(e18o29.LT.1950) THEN
1839 e18o29 = 4
1840 ELSE IF(e18o29.LT.3250) THEN
1841 e18o29 = 5
1842 ELSE IF(e18o29.LT.4950) THEN
1843 e18o29 = 6
1844 ELSE IF(e18o29.LT.6750) THEN
1845 e18o29 = 7
1846 ELSE IF(e18o29.LT.8250) THEN
1847 e18o29 = 8
1848 ELSE
1849 e18o29 = 9
1850 END IF
1851 RETURN
1852 entry e19o29(cpt)
1853C ---> formerly ENTRY ONCPT
1854 e19o29 = bmiss
1855 IF(nint(cpt).GT.-1.AND.nint(cpt).LT.9) e19o29 = cpt
1856 RETURN
1857 entry e20o29(prc)
1858C ---> formerly ENTRY ONPRC
1859 e20o29 = prc
1860 IF(prc.LT.0.) THEN
1861 e20o29 = 9998
1862 ELSE IF(prc.LT.bmiss) THEN
1863 e20o29 = nint(prc*3.937)
1864 END IF
1865 RETURN
1866 entry e21o29(snd)
1867C ---> formerly ENTRY ONSND
1868 e21o29 = snd
1869 IF(snd.LT.0.) THEN
1870 e21o29 = 998
1871 ELSE IF(snd.LT.bmiss) THEN
1872 e21o29 = nint(snd*39.37)
1873 END IF
1874 RETURN
1875 entry e22o29(pc6)
1876C ---> formerly ENTRY ONDOP
1877 e22o29 = bmiss
1878 IF(pc6.LT.bmiss) e22o29 = 1
1879 RETURN
1880 entry e23o29(per)
1881C ---> formerly ENTRY ONPOW, ONSWP
1882 e23o29 = nint(per)
1883 RETURN
1884 entry e24o29(hgt)
1885C ---> formerly ENTRY ONHOW, ONSWH
1886 e24o29 = hgt
1887 IF(hgt.LT.bmiss) e24o29 = nint(2.*hgt)
1888 RETURN
1889 entry e25o29(swd)
1890C ---> formerly ENTRY ONSWD
1891 e25o29 = swd
1892 IF(swd.EQ.0) THEN
1893 e25o29 = 0
1894 ELSE IF(swd.LT.5) THEN
1895 e25o29 = 36
1896 ELSE IF(swd.LT.bmiss) THEN
1897 e25o29 = nint((swd+.001)*.1)
1898 END IF
1899 RETURN
1900 entry e28o29(spg)
1901C ---> formerly ENTRY ONSPG
1902 e28o29 = spg
1903 RETURN
1904 entry e29o29(spd)
1905C ---> formerly ENTRY ONSPD
1906 e29o29 = spd
1907 RETURN
1908 entry e30o29(shc)
1909C ---> formerly ENTRY ONSHC
1910 e30o29 = bmiss
1911 IF(nint(shc).GT.-1.AND.nint(shc).LT.9) e30o29 = nint(shc)
1912 RETURN
1913 entry e31o29(sas)
1914C ---> formerly ENTRY ONSAS
1915 e31o29 = bmiss
1916 IF(nint(sas).GT.-1.AND.nint(sas).LT.10) e31o29 = nint(sas)
1917 RETURN
1918 entry e32o29(wes)
1919C ---> formerly ENTRY ONWES
1920 e32o29 = wes
1921 RETURN
1922 entry e33o29(subset,rpid)
1923C ---> formerly ENTRY ONRTP
1924 e33o29 = bmiss
1925 IF(subset(1:5).EQ.'NC000'.AND.l02o29(rpid) ) e33o29 = 511
1926 IF(subset(1:5).EQ.'NC000'.AND.l03o29(rpid) ) e33o29 = 512
1927 IF(subset.EQ.'NC001001'.AND.rpid.NE.'SHIP') e33o29 = 522
1928 IF(subset.EQ.'NC001001'.AND.rpid.EQ.'SHIP') e33o29 = 523
1929 IF(subset.EQ.'NC001002') e33o29 = 562
1930 IF(subset.EQ.'NC001003') e33o29 = 561
1931 IF(subset.EQ.'NC001004') e33o29 = 531
1932 IF(subset.EQ.'NC001006') e33o29 = 551
1933 IF(subset.EQ.'NC002001') THEN
1934
1935C LAND RADIOSONDE - FIXED
1936C -----------------------
1937
1938 e33o29 = 011
1939 IF(l03o29(rpid)) e33o29 = 012
1940 IF(rpid(1:4).EQ.'CLAS') e33o29 = 013
1941 END IF
1942 IF(subset.EQ.'NC002002') THEN
1943
1944C LAND RADIOSONDE - MOBILE
1945C ------------------------
1946
1947 e33o29 = 013
1948 END IF
1949 IF(subset.EQ.'NC002003') THEN
1950
1951C SHIP RADIOSONDE
1952C ---------------
1953
1954 e33o29 = 022
1955 IF(rpid(1:4).EQ.'SHIP') e33o29 = 023
1956 END IF
1957 IF(subset.EQ.'NC002004') THEN
1958
1959C DROPWINSONDE
1960C -------------
1961
1962 e33o29 = 031
1963 END IF
1964 IF(subset.EQ.'NC002005') THEN
1965
1966C PIBAL
1967C -----
1968
1969 e33o29 = 011
1970 IF(l03o29(rpid)) e33o29 = 012
1971 END IF
1972
1973 IF(subset.EQ.'NC004001') e33o29 = 041
1974 IF(subset.EQ.'NC004002') e33o29 = 041
1975 IF(subset.EQ.'NC004003') e33o29 = 041
1976 IF(subset.EQ.'NC004004') e33o29 = 041
1977 IF(subset.EQ.'NC004005') e33o29 = 031
1978 IF(subset(1:5).EQ.'NC005') e33o29 = 063
1979 RETURN
1980 entry e34o29(hgt,z100)
1981C ---> formerly ENTRY ONFIX
1982C - With Jeff Ator's fix on 1/30/97, don't need this anymore
1983cdak HGT0 = HGT
1984cdak IF(MOD(NINT(HGT),300).EQ.0.OR.MOD(NINT(HGT),500).EQ.0)
1985cdak $ HGT = HGT * 1.016
1986
1987C ALL WINDS-BY-HEIGHT HEIGHTS ARE TRUNCATED DOWN TO THE NEXT
1988C 10 METER LEVEL IF PART DD (ABOVE 100 MB LEVEL) (ON29 CONVENTION)
1989C -----------------------------------------------------------------
1990
1991 IF(hgt.GT.z100) THEN
1992 IF(mod(nint(hgt),10).NE.0) hgt = int(hgt/10.) * 10
1993 e34o29 = nint(hgt)
1994 ELSE
1995C - With Jeff Ator's fix on 1/30/97, don't need this anymore
1996cdak IF(HGT.NE.HGT0) THEN
1997cdak IF(MOD(NINT(HGT0),1500).EQ.0) HGT = HGT - 1.0
1998cdak ELSE
1999 IF(mod(nint(hgt/1.016),1500).EQ.0) hgt = nint(hgt - 1.0)
2000cdak END IF
2001 e34o29 = int(hgt)
2002 END IF
2003 RETURN
2004 entry e38o29(hvz)
2005 IF(hvz.GE.bmiss.OR.hvz.LT.0.) THEN
2006 e38o29 = bmiss
2007 ELSE IF(nint(hvz).LT.1000) THEN
2008 kk = min(int(nint(hvz)/10),99)
2009 e38o29 = kkk(kk)
2010 ELSE IF(nint(hvz).LT.50000) THEN
2011 kk = min(int(nint(hvz)/1000),49)
2012 e38o29 = kkkk(kk)
2013 ELSE
2014 e38o29 = 99
2015 END IF
2016 RETURN
2017 END
2018C***********************************************************************
2019C***********************************************************************
2020C***********************************************************************
2021 FUNCTION c02o29()
2022C ---> formerly FUNCTION ONCHR
2023 CHARACTER*8 c02o29,e35o29,e36o29
2024 CHARACTER*1 cprt(0:11),cmr29(0:15)
2025
2026 SAVE
2027
2028C (NOTE: Prior to mid-March 1999, a purge or reject flag on pressure
2029C was set to 6 (instead of 14 or 12, resp.) to get around the
2030C 3-bit limit to ON29 pressure q.m. mnemonic "QMPR". The 3-bit
2031C limit on "QMPR" was changed to 4-bits with a decoder change
2032C in February 1999. However, the codes that write the q.m.'s
2033C out (EDTBUFR and QUIPC) were not changed to write out 14 or
2034C 12 for purge or reject until mid-March 1999. In order to
2035C allow old runs to work properly, a q.m. of 6 will continue
2036C to be interpreted as a "P". This would have to change if
2037C q.m.=6 ever has a defined meaning.)
2038
2039C Code Table Value: 0 1 2 3 4 5 6 7
2040
2041 DATA cmr29 /'H','A',' ','Q','C','F','P','F',
2042
2043C Code Table Value: 8 9 10 11 12 13 14 15
2044
2045 . 'F','F','O','B','R','F','P','F'/
2046
2047 DATA cprt /' ',' ',' ',' ','A','B','C','D','I','J','K','L'/
2048
2049 c02o29 = ' '
2050 RETURN
2051 entry e35o29(qmk)
2052C ---> formerly ENTRY ONQMK
2053 IF(qmk.GE.0 .AND. qmk.LE.15) e35o29 = cmr29(nint(qmk))
2054 IF(qmk.LT.0 .OR. qmk.GT.15) e35o29 = ' '
2055 RETURN
2056 entry e36o29(nprt)
2057C ---> formerly ENTRY ONPRT
2058 e36o29 = ' '
2059 IF(nprt.LT.12) e36o29 = cprt(nprt)//' '
2060 RETURN
2061 END
2062C***********************************************************************
2063C***********************************************************************
2064C***********************************************************************
2065 FUNCTION l01o29()
2066C ---> formerly FUNCTION ONLOG
2067 CHARACTER*8 rpid
2068 LOGICAL l01o29,l02o29,l03o29
2069
2070 SAVE
2071
2072 l01o29 = .true.
2073
2074 RETURN
2075
2076 entry l02o29(rpid)
2077C ---> formerly ENTRY ONBKS
2078 l02o29 = .false.
2079 READ(rpid,'(I5)',err=1) ibks
2080 l02o29 = .true.
20811 RETURN
2082 entry l03o29(rpid)
2083C ---> formerly ENTRY ONCAL
2084 l03o29 = .true.
2085 READ(rpid,'(I5)',err=2) ibks
2086 l03o29 = .false.
20872 RETURN
2088 END
2089C***********************************************************************
2090C***********************************************************************
2091C***********************************************************************
2092 FUNCTION r03o29(LUNIT,OBS)
2093C ---> formerly FUNCTION ADPUPA
2094
2095 common/io29dd/hdr(12),rcats(50,150,11),ikat(11),mcat(11),ncat(11)
2096 common/io29ee/pob(255),qob(255),tob(255),zob(255),dob(255),
2097 $ sob(255),vsg(255),clp(255),cla(255),ob8(255),
2098 $ cf8(255)
2099 common/io29ff/pqm(255),qqm(255),tqm(255),zqm(255),wqm(255),
2100 $ qcp(255),qca(255),q81(255),q82(255)
2101 common/io29cc/subset,idat10
2102 common/io29bb/kndx,kskacf(8),kskupa,ksksfc,ksksat,ksksmi
2103 common/io29ii/pwmin
2104 common/io29ll/bmiss
2105
2106 CHARACTER*80 hdstr,lvstr,qmstr,rcstr
2107 CHARACTER*8 subset,sid,e35o29,e36o29,rsv,rsv2
2108 CHARACTER*1 pqm,qqm,tqm,zqm,wqm,qcp,qca,q81,q82,pqml
2109 REAL(8) rid_8,hdr_8(12),vsg_8(255)
2110 REAL(8) rct_8(5,255),arr_8(10,255)
2111 REAL(8) rat_8(255),rmore_8(4),rgp10_8(255),rpmsl_8,rpsal_8
2112 REAL(8) bmiss
2113 INTEGER ihblcs(0:9)
2114 dimension obs(*),rct(5,255),arr(10,255)
2115 dimension rat(255),rmore(4),rgp10(255)
2116 dimension p2(255),p8(255),p16(255)
2117
2118 equivalence(rid_8,sid)
2119 LOGICAL l02o29
2120
2121 SAVE
2122
2123 DATA hdstr/'NULL CLON CLAT HOUR MINU SELV '/
2124 DATA lvstr/'PRLC TMDP TMDB GP07 GP10 WDIR WSPD '/
2125 DATA qmstr/'QMPR QMAT QMDD QMGP QMWN '/
2126 DATA rcstr/'RCHR RCMI RCTS '/
2127
2128 DATA ihblcs/25,75,150,250,450,800,1250,1750,2250,2500/
2129
2130 prs1(z) = 1013.25 * (((288.15 - (.0065 * z))/288.15)**5.256)
2131 prs2(z) = 226.3 * exp(1.576106e-4 * (11000. - z))
2132
2133C CHECK IF THIS IS A PREPBUFR FILE
2134C --------------------------------
2135
2136 r03o29 = 99
2137c#V#V#dak - future
2138cdak IF(SUBSET.EQ.'ADPUPA') R03O29 = PRPUPA(LUNIT,OBS)
2139caaaaadak - future
2140 IF(r03o29.NE.99) RETURN
2141 r03o29 = 0
2142
2143 CALL s05o29
2144
2145C VERTICAL SIGNIFICANCE DESCRIPTOR TO ASSIGN ON29 CATEGORY
2146C --------------------------------------------------------
2147
2148C NOTE: MNEMONIC "VSIG" 008001 IS DEFINED AS VERTICAL SOUNDING
2149C SIGNIFICANCE -- CODE TABLE FOLLOWS:
2150C 64 Surface
2151C processed as ON29 category 2 and/or 3 and/or 4
2152C 32 Standard (mandatory) level
2153C processed as ON29 category 1
2154C 16 Tropopause level
2155C processed as ON29 category 5
2156C 8 Maximum wind level
2157C processed as ON29 category 3 or 4
2158C 4 Significant level, temperature
2159C processed as ON29 category 2
2160C 2 Significant level, wind
2161C processed as ON29 category 3 or 4
2162C 1 ???????????????????????
2163C processed as ON29 category 6
2164C
2165C anything else - the level is not processed
2166
2167 CALL ufbint(lunit,vsg_8,1,255,nlev,'VSIG');vsg=vsg_8
2168
2169C PUT THE HEADER INFORMATION INTO ON29 FORMAT
2170C -------------------------------------------
2171
2172 CALL ufbint(lunit,hdr_8,12, 1,iret,hdstr);hdr(2:)=hdr_8(2:)
2173 IF(hdr(5).GE.bmiss) hdr(5) = 0
2174 CALL ufbint(lunit,rid_8,1,1,iret,'RPID')
2175 IF(iret.NE.1) sid = 'MISSING '
2176cppppp-ID
2177 iprint = 0
2178c if(sid.eq.'59758 ') iprint = 1
2179c if(sid.eq.'61094 ') iprint = 1
2180c if(sid.eq.'62414 ') iprint = 1
2181c if(sid.eq.'59362 ') iprint = 1
2182c if(sid.eq.'57957 ') iprint = 1
2183c if(sid.eq.'74794 ') iprint = 1
2184c if(sid.eq.'74389 ') iprint = 1
2185c if(sid.eq.'96801A ') iprint = 1
2186 if(iprint.eq.1)
2187 $ print'(" @@@ START DIAGNOSTIC PRINTOUT FOR ID ",A)', sid
2188cppppp-ID
2189
2190 irecco = 0
2191 CALL ufbint(lunit,rpmsl_8,1, 1,iret,'PMSL');rpmsl=rpmsl_8
2192 IF(subset.EQ.'NC004005') THEN
2193 CALL ufbint(lunit,rgp10_8,1,255,nlev,'GP10');rgp10=rgp10_8
2194 CALL ufbint(lunit,rpsal_8,1,1,iret,'PSAL');rpsal=rpsal_8
2195 IF(nint(vsg(1)).EQ.32.AND.rpmsl.GE.bmiss.AND.
2196 $ max(rgp10(1),rpsal).LT.bmiss) THEN
2197cppppp
2198cdak print'(" ~~IW3UNP29/R03O29: ID ",A," is a Cat. 1 type ",
2199cdak $ "Flight-level RECCO")', sid
2200cppppp
2201 irecco = 1
2202 ELSE IF(min(vsg(1),rpmsl,rgp10(1)).GE.bmiss.AND.rpsal.LT.
2203 $ bmiss)
2204 $ THEN
2205cppppp
2206cdak print'(" ~~IW3UNP29/R03O29: ID ",A," is a Cat. 6 type ",
2207cdak $ "Flight-level RECCO (but reformatted into cat. 2/3)")', sid
2208cppppp
2209 irecco = 6
2210 ELSE IF(min(vsg(1),rgp10(1)).GE.bmiss.AND.max(rpmsl,rpsal)
2211 $ .LT.bmiss) THEN
2212cppppp
2213cdak print'(" ~~IW3UNP29/R03O29: ID ",A," is a Cat. 2/3 type ",
2214cdak $ "Flight-level RECCO with valid PMSL")', sid
2215cppppp
2216 irecco = 23
2217 ELSE
2218cppppp
2219 print'(" ~~IW3UNP29/R03O29: ID ",A," is currently an ",
2220 $ "unknown type of Flight-level RECCO - VSIG =",G0,
2221 $ "; PMSL =",G0,"; GP10 =",G0," -- SKIP IT for now")',
2222 $ sid,vsg(1),rpmsl,rgp10(1)
2223 r03o29 = -9999
2224 kskupa =kskupa + 1
2225 RETURN
2226cppppp
2227 END IF
2228 END IF
2229
2230 xob = hdr(2)
2231 yob = hdr(3)
2232 rhr = bmiss
2233 IF(hdr(4).LT.bmiss) rhr = nint(hdr(4))+nint(hdr(5))/60.
2234 rch = bmiss
2235 rsv = '999 '
2236 elv = hdr(6)
2237 IF(irecco.GT.0) THEN
2238 rpsal = rpsal + sign(0.0000001,rpsal)
2239 elv = rpsal
2240 END IF
2241
2242 CALL ufbint(lunit,rat_8, 1,255,nlev,'RATP');rat=rat_8
2243 itp = min(99,nint(rat(1)))
2244 rtp = e33o29(subset,sid)
2245 IF(elv.GE.bmiss) THEN
2246cppppp
2247 print'(" IW3UNP29/R03O29: ID ",A," has a missing elev, so ",
2248 $ "elevation set to ZERO")', sid
2249cppppp
2250 IF((rtp.GT.20.AND.rtp.LT.24).OR.subset.EQ.'NC002004') elv = 0
2251 END IF
2252cdak if(sid(5:5).eq.' ') print'(A)', sid
2253 IF(l02o29(sid).AND.sid(5:5).EQ.' ') sid = '0'//sid
2254 rsv2 = ' '
2255 CALL s01o29(sid,xob,yob,rhr,rch,rsv,rsv2,elv,itp,rtp)
2256
2257C PUT THE LEVEL DATA INTO ON29 UNITS
2258C ----------------------------------
2259
2260 CALL ufbint(lunit,arr_8,10,255,nlev,lvstr);arr=arr_8
2261
2262 pwmin = 999999.
2263 jlv = 2
2264 IF(irecco.EQ.6) jlv = 1
2265 IF(irecco.GT.0.AND.nlev.EQ.1) THEN
2266 vsg(jlv) = 4
2267 vsg(jlv+1) = 2
2268 qob(jlv) = e07o29(arr(2,1),arr(3,1))
2269 tob(jlv) = e06o29(arr(3,1))
2270 arr(2,1) = bmiss
2271 arr(3,1) = bmiss
2272 dob(jlv+1) = e04o29(arr(6,1),arr(7,1))
2273 sob(jlv+1) = e05o29(arr(6,1),arr(7,1))
2274 IF(nint(dob(jlv+1)).EQ.0.AND.nint(sob(jlv+1)).GT.0)
2275 $ dob(jlv+1) = 360.
2276 IF(nint(dob(jlv+1)).EQ.360.AND.nint(sob(jlv+1)).EQ.0)
2277 $ dob(jlv+1) = 0.
2278 arr(6,1) = bmiss
2279 arr(7,1) = bmiss
2280 IF(irecco.EQ.23) THEN
2281 vsg(1) = 64
2282 arr(1,1) = rpmsl
2283 END IF
2284 END IF
2285
2286 IF(irecco.EQ.6) GO TO 4523
2287
2288 DO l=1,nlev
2289 pob(l) = e01o29(arr(1,l))
2290 IF(nint(arr(1,l)).LE.0) THEN
2291 pob(l) = bmiss
2292cppppp
2293 print'(" ~~@@IW3UNP29/R03O29: ID ",A," has a ZERO or ",
2294 $ "negative reported pressure that is reset to missing")',
2295 $ sid
2296cppppp
2297 END IF
2298 qob(l) = e07o29(arr(2,l),arr(3,l))
2299 tob(l) = e06o29(arr(3,l))
2300 zob(l) = min(e08o29(arr(4,l)),e08o29(arr(5,l)))
2301cppppp
2302 if(iprint.eq.1) then
2303 if(irecco.gt.0) print'(" At lvl=",I0,"; orig. ZOB = ",G0)',
2304 $ l,zob(l)
2305 end if
2306cppppp
2307 IF(irecco.EQ.1) THEN
2308 IF(mod(nint(zob(l)),10).NE.0) zob(l) = int(zob(l)/10.) * 10
2309 zob(l) = nint(zob(l))
2310 ELSEIF(irecco.EQ.23) THEN
2311 zob(l) = 0
2312 END IF
2313 dob(l) = e04o29(arr(6,l),arr(7,l))
2314 sob(l) = e05o29(arr(6,l),arr(7,l))
2315 IF(nint(dob(l)).EQ.0.AND.nint(sob(l)).GT.0) dob(l) = 360.
2316 IF(nint(dob(l)).EQ.360.AND.nint(sob(l)).EQ.0) dob(l) = 0.
2317cppppp
2318 if(iprint.eq.1) then
2319 print'(" At lvl=",I0,"; VSG=",G0,"; POB = ",G0,"; QOB = ",G0,
2320 $ "; TOB = ",G0,"; ZOB = ",G0,"; DOB = ",G0,"; final SOB ",
2321 $ "(kts) = ",G0,"; origl SOB (mps) = ",G0)',
2322 $ l,vsg(l),pob(l),qob(l),tob(l),zob(l),dob(l),sob(l),arr(7,l)
2323 end if
2324cppppp
2325 IF(irecco.EQ.0.AND.max(pob(l),dob(l),sob(l)).LT.bmiss)
2326 $ pwmin=min(pwmin,pob(l))
2327 ENDDO
2328
2329 4523 CONTINUE
2330
2331 mlev = nlev
2332
2333 CALL ufbint(lunit,arr_8,10,255,nlev,qmstr);arr=arr_8
2334
2335 IF(irecco.GT.0.AND.mlev.EQ.1) THEN
2336 pob1 = bmiss
2337 IF(pob(1).LT.bmiss) pob1 = pob(1) * 0.1
2338 tob1 = bmiss
2339 IF(tob(jlv).LT.bmiss) tob1 = (tob(jlv) * 0.1) + 273.15
2340 rps1 = rpsal
2341 zob1 = zob(1)
2342 tqm1 = arr(3,1)
2343 pob(jlv)=nint(e37o29(pob1,tob1,rps1,zob1,tqm1)) * 10
2344 pob(jlv+1) = pob(jlv)
2345cppppp
2346 if(iprint.eq.1) then
2347 do l=jlv,jlv+1
2348 print'(" At lvl=",I0,"; VSG=",G0,"; POB = ",G0,"; QOB = ",
2349 $ G0,"; TOB = ",G0,"; ZOB = ",G0,"; DOB = ",G0,"; SOB = ",
2350 $ G0)', l,vsg(l),pob(l),qob(l),tob(l),zob(l),dob(l),sob(l)
2351 enddo
2352 end if
2353cppppp
2354 END IF
2355
2356 IF(irecco.GT.0.AND.nlev.EQ.1) THEN
2357 pqm(jlv) = 'E'
2358 pqm(jlv+1) = 'E'
2359 tqm(jlv) = e35o29(arr(2,1))
2360 arr(2,1) = bmiss
2361 qqm(jlv) = e35o29(arr(3,1))
2362 arr(3,1) = bmiss
2363 arr(4,1) = 3
2364 wqm(jlv+1) = e35o29(arr(5,1))
2365 arr(5,1) = bmiss
2366 END IF
2367
2368 IF(irecco.EQ.6) GO TO 4524
2369
2370 DO l=1,nlev
2371 pqm(l) = e35o29(arr(1,l))
2372 tqm(l) = e35o29(arr(2,l))
2373 qqm(l) = e35o29(arr(3,l))
2374 zqm(l) = e35o29(arr(4,l))
2375 wqm(l) = e35o29(arr(5,l))
2376 ENDDO
2377
2378 4524 CONTINUE
2379
2380 IF(irecco.GT.0.AND.nlev.EQ.1) nlev = jlv + 1
2381
2382C SURFACE DATA MUST GO FIRST
2383C --------------------------
2384
2385 CALL s02o29(2,0,*9999)
2386 CALL s02o29(3,0,*9999)
2387 CALL s02o29(4,0,*9999)
2388
2389 indx2 = 0
2390 indx8 = 0
2391 indx16 = 0
2392 p2 = bmiss
2393 p8 = bmiss
2394 p16 = bmiss
2395
2396 DO l=1,nlev
2397 IF(nint(vsg(l)).EQ.64) THEN
2398cppppp
2399 if(iprint.eq.1) then
2400 print'(" Lvl=",L," is a surface level")'
2401 end if
2402 if(iprint.eq.1.and.pob(l).LT.bmiss.AND.(tob(l).LT.bmiss.OR.irecco
2403 $ .EQ.23)) then
2404 print'(" --> valid cat. 2 sfc. lvl ")'
2405 end if
2406cppppp
2407 IF(pob(l).LT.bmiss.AND.(tob(l).LT.bmiss.OR.irecco.EQ.23))
2408 $ CALL se01o29(2,l)
2409cppppp
2410 if(iprint.eq.1.and.pob(l).LT.bmiss.AND.(dob(l).LT.bmiss.OR.irecco
2411 $ .EQ.23)) then
2412 print'(" --> valid cat. 3 sfc. lvl ")'
2413 end if
2414cppppp
2415 IF(pob(l).LT.bmiss.AND.(dob(l).LT.bmiss.OR.irecco.EQ.23))
2416 $ CALL se01o29(3,l)
2417 IF(zob(l).LT.bmiss.AND.dob(l).LT.bmiss) THEN
2418cppppp
2419 if(iprint.eq.1) print'(" --> valid cat. 4 sfc. lvl ")'
2420cppppp
2421
2422C CAT. 4 HEIGHT DOES NOT PASS ON A KEEP, PURGE, OR REJECT LIST Q.M.
2423C -----------------------------------------------------------------
2424
2425 zqm(l) = ' '
2426 CALL se01o29(4,l)
2427 END IF
2428 vsg(l) = 0
2429 ELSE IF(nint(vsg(l)).EQ.2) THEN
2430 p2(l) = pob(l)
2431 indx2 = l
2432 IF(indx8.GT.0) THEN
2433 DO ii = 1,indx8
2434 IF(pob(l).EQ.p8(ii).AND.pob(l).LT.bmiss) THEN
2435cppppp
2436 if(iprint.eq.1) then
2437 print'(" ## This cat. 3 level, on lvl ",I0,
2438 $ " will have already been processed as a cat. 3 ",
2439 $ "MAX wind lvl (on lvl ",I0,") - skip this Cat. ",
2440 $ "3 lvl")', l,ii
2441 end if
2442cppppp
2443 IF(max(sob(ii),dob(ii)).GE.bmiss) THEN
2444 sob(ii) = sob(l)
2445 dob(ii) = dob(l)
2446cppppp
2447 if(iprint.eq.1) then
2448 print'(" ...... also on lvl ",I0," - transfer",
2449 $ " wind data to dupl. MAX wind lvl because its ",
2450 $ "missing there")', l
2451 end if
2452cppppp
2453 END IF
2454 vsg(l) = 0
2455 GO TO 7732
2456 END IF
2457 ENDDO
2458 END IF
2459 ELSE IF(nint(vsg(l)).EQ.8) THEN
2460 p8(l) = pob(l)
2461 indx8 = l
2462 IF(indx2.GT.0) THEN
2463 DO ii = 1,indx2
2464 IF(pob(l).EQ.p2(ii).AND.pob(l).LT.bmiss) THEN
2465cppppp
2466 if(iprint.eq.1) then
2467 print'(" ## This MAX wind level, on lvl ",I0,
2468 $ " will have already been processed as a cat. 3 ",
2469 $ "lvl (on lvl ",I0,") - skip this MAX wind lvl ",
2470 $ "but set"/6X,"cat. 3 lvl PQM to ""W""")', l,ii
2471 end if
2472cppppp
2473 pqm(ii) = 'W'
2474 IF(pob(l).EQ.pwmin) pqm(ii) = 'X'
2475 IF(max(sob(ii),dob(ii)).GE.bmiss) THEN
2476 sob(ii) = sob(l)
2477 dob(ii) = dob(l)
2478cppppp
2479 if(iprint.eq.1) then
2480 print'(" ...... also on lvl ",I0," - transfer",
2481 $ " wind data to dupl. cat. 3 lvl because its ",
2482 $ "missing there")', l
2483 end if
2484cppppp
2485 END IF
2486 vsg(l) = 0
2487 GO TO 7732
2488 END IF
2489 ENDDO
2490 END IF
2491 IF(indx8-1.GT.0) THEN
2492 DO ii = 1,indx8-1
2493 IF(pob(l).EQ.p8(ii).AND.pob(l).LT.bmiss) THEN
2494cppppp
2495 if(iprint.eq.1) then
2496 print'(" ## This cat. 3 MAX wind lvl, on lvl ",I0,
2497 $ " will have already been processed as a cat. 3 ",
2498 $ "MAX wind lvl (on lvl ",I0,") - skip this Cat. ",
2499 $ "3 MAX wind lvl")', l,ii
2500 end if
2501cppppp
2502 IF(max(sob(ii),dob(ii)).GE.bmiss) THEN
2503 sob(ii) = sob(l)
2504 dob(ii) = dob(l)
2505cppppp
2506 if(iprint.eq.1) then
2507 print'(" ...... also on lvl ",I0," - transfer",
2508 $ " wind data to dupl. MAX wind lvl because its ",
2509 $ "missing there")', l
2510 end if
2511cppppp
2512 END IF
2513 vsg(l) = 0
2514 GO TO 7732
2515 END IF
2516 ENDDO
2517 END IF
2518 ELSE IF(nint(vsg(l)).EQ.16) THEN
2519 indx16 = indx16 + 1
2520 p16(indx16) = pob(l)
2521 END IF
2522 7732 CONTINUE
2523 ENDDO
2524
2525C TAKE CARE OF 925 MB NEXT
2526C ------------------------
2527
2528 DO l=1,nlev
2529 IF(nint(vsg(l)).EQ.32 .AND. nint(pob(l)).EQ.9250) THEN
2530 cf8(l) = 925
2531 ob8(l) = zob(l)
2532 q81(l) = ' '
2533 q82(l) = ' '
2534 IF(tob(l).LT.bmiss) CALL s02o29(2,l,*9999)
2535 IF(dob(l).LT.bmiss) CALL s02o29(3,l,*9999)
2536 IF(ob8(l).LT.bmiss) CALL s02o29(8,l,*9999)
2537 vsg(l) = 0
2538 END IF
2539 ENDDO
2540
2541C REST OF THE DATA
2542C ----------------
2543
2544 z100 = 16000
2545 DO l=1,nlev
2546 IF(nint(vsg(l)).EQ.32) THEN
2547 IF(min(dob(l),zob(l),tob(l)).GE.bmiss) THEN
2548cppppp
2549 if(iprint.eq.1) then
2550 print'(" ==> For lvl ",I0,"; VSG=32 & DOB,ZOB,TOB all ",
2551 $ "missing --> this level not processed")', l
2552 end if
2553 vsg(l) = 0
2554 ELSE IF(min(zob(l),tob(l)).LT.bmiss) THEN
2555cppppp
2556 if(iprint.eq.1) then
2557 print'(" ==> For lvl ",I0,"; VSG=32 & one or both of ",
2558 $ "ZOB,TOB non-missing --> valid cat. 1 lvl")', l
2559 end if
2560cppppp
2561 CALL s02o29(1,l,*9999)
2562 IF(nint(pob(l)).EQ.1000.AND.zob(l).LT.bmiss) z100 = zob(l)
2563 vsg(l) = 0
2564 END IF
2565 END IF
2566 ENDDO
2567 DO l=1,nlev
2568 IF(nint(vsg(l)).EQ.32) THEN
2569 IF(dob(l).LT.bmiss.AND.min(zob(l),tob(l)).GE.bmiss) THEN
2570 ll = i04o29(pob(l)*.1)
2571 IF(ll.EQ.999999) THEN
2572cppppp
2573 print'(" ~~IW3UNP29/R03O29: ID ",A," has VSG=32 for ",
2574 $ "lvl ",I0," but pressure not mand.!! --> this level ",
2575 $ "not processed")', sid,l
2576cppppp
2577 ELSE IF(min(rcats(1,ll,1),rcats(2,ll,1)).LT.99999.) THEN
2578 IF(rcats(4,ll,1).GE.99998.) THEN
2579cppppp
2580 if(iprint.eq.1) then
2581 print'(" ==> For lvl ",I0,"; VSG=32 & ZOB,TOB ",
2582 $ "both missing while DOB non-missing BUT one or ",
2583 $ "both of Z, T non-missing while wind missing ",
2584 $ "in"/7X,"earlier cat. 1 processing of this ",G0,
2585 $ "mb level --> valid cat. 1 lvl")', l,pob(l)*.1
2586 end if
2587cppppp
2588 CALL s02o29(1,l,*9999)
2589 ELSE
2590cppppp
2591 if(iprint.eq.1) then
2592 print'(" ==> For lvl ",I0,"; VSG=32 & ZOB,TOB ",
2593 $ "both missing while DOB non-missing BUT one or ",
2594 $ "both of Z, T non-missing while wind non-missing",
2595 $ " in"/6X,"earlier cat. 1 processing of this ",G0,
2596 $ "mb level --> valid cat. 3 lvl")', l,pob(l)*.1
2597 end if
2598cppppp
2599 CALL s02o29(3,l,*9999)
2600 END IF
2601 ELSE
2602cppppp
2603 if(iprint.eq.1) then
2604 print'(" ==> For lvl ",I0,"; VSG=32 & ZOB,TOB both ",
2605 $ "missing while DOB non-missing AND both Z, T ",
2606 $ "missing on"/7X,"this ",G0,"mb level in cat. 1 --> ",
2607 $ "valid cat. 3 lvl")', l,pob(l)*.1
2608 end if
2609cppppp
2610 CALL s02o29(3,l,*9999)
2611 END IF
2612 ELSE
2613cppppp
2614 print'(" ~~IW3UNP29/R03O29: ID ",A," has VSG=32 for lvl ",
2615 $ I0," & should never come here!! - by default output",
2616 $ " as cat. 1 lvl")', sid,l
2617cppppp
2618 CALL s02o29(1,l,*9999)
2619 END IF
2620 vsg(l) = 0
2621 END IF
2622 ENDDO
2623
2624 DO l=1,nlev
2625 IF(nint(vsg(l)).EQ. 4) THEN
2626cppppp
2627 if(iprint.eq.1) then
2628 print'(" ==> For lvl ",I0,"; VSG= 4 --> valid cat. 2 ",
2629 $ "lvl")', l
2630 end if
2631cppppp
2632 IF(indx16.GT.0) THEN
2633 DO ii = 1,indx16
2634 IF(pob(l).EQ.p16(ii).AND.pob(l).LT.bmiss) THEN
2635cppppp
2636 if(iprint.eq.1) then
2637 print'(" ## This cat. 2 level, on lvl ",I0," is",
2638 $ " also the tropopause level, as its pressure ",
2639 $ "matches that of trop. lvl no. ",I0," - ",
2640 $ "set this cat. 2"/5X,"lvl PQM to ""T""")', l,ii
2641 end if
2642cppppp
2643 pqm(l) = 'T'
2644 GO TO 7738
2645 END IF
2646 ENDDO
2647 END IF
2648 7738 CONTINUE
2649 CALL s02o29(2,l,*9999)
2650 vsg(l) = 0
2651 ELSEIF(nint(vsg(l)).EQ.16) THEN
2652cppppp
2653 if(iprint.eq.1) then
2654 print'(" ==> For lvl ",I0,"; VSG=16 --> valid cat. 3/5 ",
2655 $ "lvl")', l
2656 end if
2657cppppp
2658 pqml = pqm(l)
2659 IF(min(sob(l),dob(l)).LT.bmiss) CALL s02o29(3,l,*9999)
2660 pqm(l) = pqml
2661 CALL s02o29(5,l,*9999)
2662 vsg(l) = 0
2663 ELSEIF(nint(vsg(l)).EQ. 1) THEN
2664cppppp
2665 print'(" ~~IW3UNP29/R03O29: HERE IS A VSG =1, SET TO CAT.6, ",
2666 $ "AT ID ",A,"; SHOULD NEVER HAPPEN!!")', sid
2667cppppp
2668 CALL s02o29(6,l,*9999)
2669 vsg(l) = 0
2670 ELSEIF(nint(vsg(l)).EQ. 2 .AND. pob(l).LT.bmiss) THEN
2671 IF(max(sob(l),dob(l)).LT.bmiss) THEN
2672cppppp
2673 if(iprint.eq.1) then
2674 print.ne.'(" ==> For lvl ",I0,"; VSG= 2 & POB missing ",
2675 $ "--> valid cat. 3 lvl (expect that ZOB is missing)")', l
2676 end if
2677cppppp
2678 CALL s02o29(3,l,*9999)
2679 ELSE
2680cppppp
2681 if(iprint.eq.1) then
2682 print.ne.'(" ==> For lvl ",I0,"; VSG= 2 & POB missing ",
2683 $ "--> Cat. 3 level not processed - wind is missing")', l
2684 end if
2685cppppp
2686 END IF
2687 vsg(l) = 0
2688 ELSEIF(nint(vsg(l)).EQ. 2 .AND. zob(l).LT.bmiss) THEN
2689 IF(max(sob(l),dob(l)).LT.bmiss) THEN
2690
2691C CERTAIN U.S. WINDS-BY-HEIGHT ARE CORRECTED TO ON29 CONVENTION
2692C -------------------------------------------------------------
2693
2694 IF(sid(1:2).EQ.'70'.OR.sid(1:2).EQ.'71'.OR.sid(1:2).EQ.'72'
2695 $ .OR.sid(1:2).EQ.'74') zob(l) = e34o29(zob(l),z100)
2696cppppp
2697 if(iprint.eq.1) then
2698 print.ne.'(" ==> For lvl ",I0,"; VSG= 2 & ZOB missing ",
2699 $ "--> valid cat. 4 lvl (POB must always be missing)")', l
2700 if(sid(1:2).eq.'70'.or.sid(1:2).eq.'71'.or.sid(1:2).eq.'72'
2701 $ .or.sid(1:2).eq.'74') print'(" .... ZOB at this ",
2702 $ "U.S. site adjusted to ",G0)', zob(l)
2703 end if
2704cppppp
2705
2706C CAT. 4 HEIGHT DOES NOT PASS ON A KEEP, PURGE, OR REJECT LIST Q.M.
2707C -----------------------------------------------------------------
2708
2709 zqm(l) = ' '
2710
2711 CALL s02o29(4,l,*9999)
2712 ELSE
2713cppppp
2714 if(iprint.eq.1) then
2715 print.ne.'(" ==> For lvl ",I0,"; VSG= 2 & ZOB missing ",
2716 $ "--> Cat. 4 level not processed - wind is missing")', l
2717 end if
2718cppppp
2719 END IF
2720 vsg(l) = 0
2721 ELSEIF(nint(vsg(l)).EQ. 8 .AND. pob(l).LT.bmiss) THEN
2722cppppp
2723 if(iprint.eq.1) then
2724 print.ne.'(" ==> For lvl ",I0,"; VSG= 8 & POB missing ",
2725 $ "--> valid cat. 3 lvl (expect that ZOB is missing)")', l
2726 end if
2727cppppp
2728 CALL s02o29(3,l,*9999)
2729 vsg(l) = 0
2730 ELSEIF(nint(vsg(l)).EQ. 8 .AND. zob(l).LT.bmiss) THEN
2731 IF(max(sob(l),dob(l)).LT.bmiss) THEN
2732
2733C CERTAIN U.S. WINDS-BY-HEIGHT ARE CORRECTED TO ON29 CONVENTION
2734C -------------------------------------------------------------
2735
2736 IF(sid(1:2).EQ.'70'.OR.sid(1:2).EQ.'71'.OR.sid(1:2).EQ.'72'
2737 $ .OR.sid(1:2).EQ.'74') zob(l) = e34o29(zob(l),z100)
2738cppppp
2739 if(iprint.eq.1) then
2740 print.ne.'(" ==> For lvl ",I0,"; VSG= 8 & ZOB missing ",
2741 $ "--> valid cat. 4 lvl (POB must always be missing)")', l
2742 if(sid(1:2).eq.'70'.or.sid(1:2).eq.'71'.or.sid(1:2).eq.'72'
2743 $ .or.sid(1:2).eq.'74') print'(" .... ZOB at this ",
2744 $ "U.S. site adjusted to ",G0)', zob(l)
2745 end if
2746cppppp
2747
2748C CAT. 4 HEIGHT DOES NOT PASS ON A KEEP, PURGE, OR REJECT LIST Q.M.
2749C -----------------------------------------------------------------
2750
2751 zqm(l) = ' '
2752
2753 CALL s02o29(4,l,*9999)
2754 ELSE
2755cppppp
2756 if(iprint.eq.1) then
2757 print.ne.'(" ==> For lvl ",I0,"; VSG= 8 & ZOB missing ",
2758 $ "--> Cat. 4 level not processed - wind is missing")', l
2759 end if
2760cppppp
2761 END IF
2762 vsg(l) = 0
2763 END IF
2764 ENDDO
2765
2766C CHECK FOR LEVELS WHICH GOT LEFT OUT
2767C -----------------------------------
2768
2769 DO l=1,nlev
2770 IF(nint(vsg(l)).GT.0) THEN
2771 print 887, l,sid,nint(vsg(l))
2772 887 FORMAT(' ##IW3UNP29/R03O29 - ~~ON LVL',i4,' OF ID ',a8,', A ',
2773 $ 'VERTICAL SIGNIFICANCE OF',i3,' WAS NOT SUPPORTED - LEAVE ',
2774 $ 'THIS LEVEL OUT OF THE PROCESSING')
2775 print'(" ..... at lvl=",I0,"; POB = ",G0,"; QOB = ",G0,
2776 $ "; TOB = ",G0,"; ZOB = ",G0,"; DOB = ",G0,";"/19X,"SOB = ",
2777 $ G0)', pob(l),qob(l),tob(l),zob(l),dob(l),sob(l)
2778 END IF
2779 ENDDO
2780
2781C CLOUD DATA GOES INTO CATEGORY 07
2782C --------------------------------
2783
2784 CALL ufbint(lunit,arr_8,10,255,nlev,'HOCB CLAM QMCA HBLCS')
2785 arr=arr_8
2786 DO l=1,nlev
2787 IF(arr(1,l).LT.bmiss/2.) THEN
2788 ! Prior to 3/2002 HBLCS was not available, this will
2789 ! always be tested first because it is more precise
2790 ! in theory but will now be missing after 3/2002
2791 IF(elv+arr(1,l).GE.bmiss/2.) THEN
2792 clp(l) = bmiss
2793 ELSE IF(elv+arr(1,l).LE.11000) THEN
2794 clp(l) = (prs1(elv+arr(1,l))*10.) + 0.001
2795 ELSE
2796 clp(l) = (prs2(elv+arr(1,l))*10.) + 0.001
2797 END IF
2798 ELSE
2799 ! Effective 3/2002 only this will be available
2800 IF(nint(arr(4,l)).GE.10) THEN
2801 clp(l) = bmiss
2802 ELSE
2803 IF(elv+ihblcs(nint(arr(4,l))).GE.bmiss/2.) THEN
2804 clp(l) = bmiss
2805 ELSE IF(elv+ihblcs(nint(arr(4,l))).LE.11000) THEN
2806 clp(l) = (prs1(elv+ihblcs(nint(arr(4,l))))*10.) +0.001
2807 ELSE
2808 clp(l) = (prs2(elv+ihblcs(nint(arr(4,l))))*10.) +0.001
2809 END IF
2810 END IF
2811 END IF
2812 cla(l) = e13o29(arr(2,l))
2813 qcp(l) = ' '
2814 qca(l) = e35o29(arr(3,l))
2815 IF(clp(l).LT.bmiss .OR. cla(l).LT.bmiss) CALL s02o29(7,l,*9999)
2816 ENDDO
2817
2818C -----------------------------------------------------
2819C MISC DATA GOES INTO CATEGORY 08
2820C -----------------------------------------------------
2821C CODE FIGURE 104 - RELEASE TIME IN .01*HR
2822C CODE FIGURE 105 - RECEIPT TIME IN .01*HR
2823C CODE FIGURE 106 - RADIOSONDE INSTR. TYPE,
2824C SOLAR/IR CORRECTION INDICATOR,
2825C TRACKING TECH/STATUS OF SYSTEM USED
2826C CODE FIGURE 925 - HEIGHT OF 925 LEVEL
2827C -----------------------------------------------------
2828
2829 CALL ufbint(lunit,rct_8, 5,255,nrct,rcstr);rct=rct_8
2830
2831C NOTE: MNEMONIC "RCTS" 008202 IS A LOCAL DESCRIPTOR DEFINED AS
2832C RECEIPT TIME SIGNIFICANCE -- CODE TABLE FOLLOWS:
2833C 0 General decoder receipt time
2834C 1 NCEP receipt time
2835C 2 OSO receipt time
2836C 3 ARINC ground station receipt time
2837C 4 Radiosonde TEMP AA part receipt time
2838C 5 Radiosonde TEMP BB part receipt time
2839C 6 Radiosonde TEMP CC part receipt time
2840C 7 Radiosonde TEMP DD part receipt time
2841C 8 Radiosonde PILOT AA part receipt time
2842C 9 Radiosonde PILOT BB part receipt time
2843C 10 Radiosonde PILOT CC part receipt time
2844C 11 Radiosonde PILOT DD part receipt time
2845C 12-62 Reserved for future use
2846C 63 Missing
2847
2848 DO l=1,nrct
2849 cf8(l) = 105
2850 ob8(l) = nint((nint(rct(1,l))+nint(rct(2,l))/60.) * 100.)
2851 IF(irecco.GT.0.AND.nint(rct(3,l)).EQ.0) rct(3,l) = 9
2852 q81(l) = e36o29(nint(rct(3,l)))
2853 q82(l) = ' '
2854 CALL s02o29(8,l,*9999)
2855 ENDDO
2856
2857 CALL ufbint(lunit,rmore_8,4,1,nrmore,'SIRC TTSS UALNHR UALNMN')
2858 rmore=rmore_8
2859 IF(max(rmore(3),rmore(4)).LT.bmiss) THEN
2860 cf8(1) = 104
2861 ob8(1) = nint((rmore(3)+rmore(4)/60.) * 100.)
2862 q81(1) = ' '
2863 q82(1) = ' '
2864 CALL s02o29(8,1,*9999)
2865 END IF
2866 IF(nint(rat(1)).LT.100) THEN
2867 cf8(1) = 106
2868 isir = 9
2869 IF(nint(rmore(1)).LT.9) isir = nint(rmore(1))
2870 itec = 99
2871 IF(nint(rmore(2)).LT.99) itec = nint(rmore(2))
2872 ob8(1) = (isir * 10000) + (nint(rat(1)) * 100) + itec
2873 q81(1) = ' '
2874 q82(1) = ' '
2875 CALL s02o29(8,1,*9999)
2876 END IF
2877
2878C PUT THE UNPACKED ON29 REPORT INTO OBS
2879C -------------------------------------
2880
2881 CALL s03o29(obs,subset,*9999,*9998)
2882
2883 RETURN
2884 9999 CONTINUE
2885 r03o29 = 999
2886 RETURN
2887 9998 CONTINUE
2888 print'(" IW3UNP29/R03O29: RPT with ID= ",A," TOSSED - ZERO ",
2889 $ "CAT.1-6,51,52 LVLS")', sid
2890 r03o29 = -9999
2891 kskupa =kskupa + 1
2892 RETURN
2893 END
2894C***********************************************************************
2895C***********************************************************************
2896C***********************************************************************
2897 FUNCTION r04o29(LUNIT,OBS)
2898C ---> formerly FUNCTION SURFCE
2899
2900 common/io29ee/pob(255),qob(255),tob(255),zob(255),dob(255),
2901 $ sob(255),vsg(255),clp(255),cla(255),ob8(255),
2902 $ cf8(255)
2903 common/io29ff/pqm(255),qqm(255),tqm(255),zqm(255),wqm(255),
2904 $ qcp(255),qca(255),q81(255),q82(255)
2905 common/io29gg/psl,stp,sdr,ssp,stm,dpd,tmx,tmi,hvz,prw,pw1,ccn,chn,
2906 $ ctl,ctm,cth,hcb,cpt,apt,pc6,snd,p24,dop,pow,how,swd,
2907 $ swp,swh,sst,spg,spd,shc,sas,wes
2908 common/io29hh/psq,spq,swq,stq,ddq
2909 common/io29cc/subset,idat10
2910 common/io29bb/kndx,kskacf(8),kskupa,ksksfc,ksksat,ksksmi
2911 common/io29ll/bmiss
2912
2913 CHARACTER*80 hdstr,rcstr
2914 CHARACTER*8 subset,sid,e35o29,rsv,rsv2
2915 CHARACTER*1 pqm,qqm,tqm,zqm,wqm,qcp,qca,q81,q82,psq,spq,swq,stq,
2916 $ ddq
2917 REAL(8) rid_8,ufbint_8,bmiss
2918 REAL(8) hdr_8(20),rct_8(5,255),rrsv_8(3),clds_8(4,255),
2919 $ tmxmnm_8(4,255)
2920 INTEGER itiwm(0:15),ihblcs(0:9)
2921 dimension obs(*),hdr(20),rct(5,255),rrsv(3),clds(4,255),jth(0:9),
2922 $ jtl(0:9),ltl(0:9),tmxmnm(4,255)
2923 equivalence(rid_8,sid)
2924
2925 SAVE
2926
2927 DATA hdstr/'RPID CLON CLAT HOUR MINU SELV AUTO '/
2928 DATA rcstr/'RCHR RCMI RCTS '/
2929
2930 DATA jth/0,1,2,3,4,5,6,8,7,9/,jtl/0,1,5,8,7,2,3,4,6,9/
2931 DATA ltl/0,1,5,6,7,2,8,4,3,9/
2932 DATA itiwm/0,3*7,3,3*7,1,3*7,4,3*7/
2933 DATA ihblcs/25,75,150,250,450,800,1250,1750,2250,2500/
2934
2935C CHECK IF THIS IS A PREPBUFR FILE
2936C --------------------------------
2937
2938 r04o29 = 99
2939c#V#V#dak - future
2940cdak IF(SUBSET.EQ.'ADPSFC') R04O29 = PRPSFC(LUNIT,OBS)
2941cdak IF(SUBSET.EQ.'SFCSHP') R04O29 = PRPSFC(LUNIT,OBS)
2942cdak IF(SUBSET.EQ.'SFCBOG') R04O29 = PRPSFC(LUNIT,OBS)
2943caaaaadak - future
2944 IF(r04o29.NE.99) RETURN
2945 r04o29 = 0
2946
2947 CALL s05o29
2948
2949C PUT THE HEADER INFORMATION INTO ON29 FORMAT
2950C -------------------------------------------
2951
2952 CALL ufbint(lunit,hdr_8,20, 1,iret,hdstr);hdr(2:)=hdr_8(2:)
2953 CALL ufbint(lunit,rct_8, 5,255,nrct,rcstr);rct=rct_8
2954 IF(hdr(5).GE.bmiss) hdr(5) = 0
2955 rctim = nint(rct(1,1))+nint(rct(2,1))/60.
2956 rid_8 = hdr_8(1)
2957 xob = hdr(2)
2958 yob = hdr(3)
2959 rhr = bmiss
2960 IF(hdr(4).LT.bmiss) rhr = nint(hdr(4))+nint(hdr(5))/60.
2961 rch = rctim
2962 elv = hdr(6)
2963
2964C I1 DEFINES SYNOPTIC FORMAT FLAG (SUBSET NC000001, NC000009)
2965C I1 DEFINES AUTOMATED STATION TYPE (SUBSET NC000003-NC000008,NC000010)
2966C I2 DEFINES CONVERTED HOURLY FLAG (SUBSET NC000xxx)
2967C I2 DEFINES SHIP LOCATION FLAG (SUBSET NC001xxx) (WHERE xxx != 006)
2968
2969 i1 = 9
2970 i2 = 9
2971 IF(subset(1:5).EQ.'NC000') THEN
2972 IF(subset(6:8).EQ.'001'.OR.subset(6:8).EQ.'009') THEN
2973 i1 = 1
2974 IF(subset(6:8).EQ.'009') i2 = 1
2975 ELSE IF(subset(6:8).NE.'002') THEN
2976 IF(hdr(7).LT.15) THEN
2977 IF(hdr(7).GT.0.AND.hdr(7).LT.5) THEN
2978 i1 = 2
2979 ELSE IF(hdr(7).EQ.8) THEN
2980 i1 = 3
2981 ELSE
2982 i1 = 4
2983 END IF
2984 END IF
2985 END IF
2986 END IF
2987 itp = (10 * i1) + i2
2988 rtp = e33o29(subset,sid)
2989
2990C THE 25'TH (RESERVE) CHARACTER IS INDICATOR FOR PRECIP. (INCL./EXCL.)
2991C THE 26'TH (RESERVE) CHARACTER IS INDICATOR FOR W SPEED (SOURCE/UNITS)
2992C '0' - Wind speed estimated in m/s (uncertified instrument)
2993C '1' - Wind speed obtained from anemometer in m/s (certified
2994C instrument)
2995C '3' - Wind speed estimated in knots (uncertified instrument)
2996C '4' - Wind speed obtained from anemometer in knots (certified
2997C instrument)
2998C '7' - Missing
2999C THE 27'TH (RESERVE) CHARACTER IS INDICATOR FOR STN OPER./PAST WX DATA
3000
3001 CALL ufbint(lunit,ufbint_8,1,1,nrsv,'INPC');rrsv(1)=ufbint_8
3002 CALL ufbint(lunit,ufbint_8,1,1,nrsv,'TIWM');tiwm=ufbint_8
3003 IF(tiwm.LT.bmiss) THEN ! Effective 3/2002
3004 rrsv(2) = 7
3005 IF(nint(tiwm).LE.15) rrsv(2) = itiwm(nint(tiwm))
3006 ELSE ! Prior to 3/2002
3007 CALL ufbint(lunit,ufbint_8,1,1,nrsv,'SUWS');rrsv(2)=ufbint_8
3008 END IF
3009 CALL ufbint(lunit,ufbint_8,1,1,nrsv,'ITSO');rrsv(3)=ufbint_8
3010 rsv = '999 '
3011 DO i=1,3
3012 IF(rrsv(i).LT.bmiss) WRITE(rsv(i:i),'(I1)') nint(rrsv(i))
3013 ENDDO
3014
3015C READ THE CATEGORY 51 SURFACE DATA FROM BUFR
3016C -------------------------------------------
3017
3018 CALL ufbint(lunit,ufbint_8,1,1,iret,'PMSL');psl=ufbint_8
3019 CALL ufbint(lunit,ufbint_8,1,1,iret,'PRES');stp=ufbint_8
3020 CALL ufbint(lunit,ufbint_8,1,1,iret,'WDIR');sdr=ufbint_8
3021 CALL ufbint(lunit,ufbint_8,1,1,iret,'WSPD');ssp=ufbint_8
3022 wspd1 = ssp
3023 CALL ufbint(lunit,ufbint_8,1,1,iret,'TMDB');stm=ufbint_8
3024 CALL ufbint(lunit,ufbint_8,1,1,iret,'TMDP');dpd=ufbint_8
3025 IF(subset.NE.'NC000007') THEN
3026 CALL ufbint(lunit,ufbint_8,1,1,iret,'MXTM');tmx=ufbint_8
3027 CALL ufbint(lunit,ufbint_8,1,1,iret,'MITM');tmi=ufbint_8
3028 ELSE
3029 tmx = bmiss
3030 tmi = bmiss
3031 END IF
3032 CALL ufbint(lunit,ufbint_8,1,1,iret,'QMPR');qsl=ufbint_8
3033 CALL ufbint(lunit,ufbint_8,1,1,iret,'QMPR');qsp=ufbint_8
3034 CALL ufbint(lunit,ufbint_8,1,1,iret,'QMWN');qmw=ufbint_8
3035 CALL ufbint(lunit,ufbint_8,1,1,iret,'QMAT');qmt=ufbint_8
3036 CALL ufbint(lunit,ufbint_8,1,1,iret,'QMDD');qmd=ufbint_8
3037 CALL ufbint(lunit,ufbint_8,1,1,iret,'HOVI');hvz=ufbint_8
3038 CALL ufbint(lunit,ufbint_8,1,1,iret,'PRWE');prw=ufbint_8
3039 CALL ufbint(lunit,ufbint_8,1,1,iret,'PSW1');pw1=ufbint_8
3040 CALL ufbint(lunit,ufbint_8,1,1,iret,'PSW2');pw2=ufbint_8
3041 CALL ufbint(lunit,ufbint_8,1,1,iret,'TOCC');ccn=ufbint_8
3042 CALL ufbint(lunit,ufbint_8,1,1,iret,'CHPT');cpt=ufbint_8
3043 CALL ufbint(lunit,ufbint_8,1,1,iret,'3HPC');apt=ufbint_8
3044 IF(max(apt,cpt).GE.bmiss) THEN
3045 apt = bmiss
3046 CALL ufbint(lunit,ufbint_8,1,1,iret,'24PC');apt24=ufbint_8
3047 IF(apt24.LT.bmiss) THEN
3048 apt = apt24
3049 cpt = bmiss
3050 END IF
3051 END IF
3052
3053
3054C READ THE CATEGORY 52 SURFACE DATA FROM BUFR
3055C -------------------------------------------
3056
3057 CALL ufbint(lunit,ufbint_8,1,1,iret,'TP06');pc6=ufbint_8
3058 CALL ufbint(lunit,ufbint_8,1,1,iret,'TOSD');snd=ufbint_8
3059 CALL ufbint(lunit,ufbint_8,1,1,iret,'TP24');p24=ufbint_8
3060 CALL ufbint(lunit,ufbint_8,1,1,iret,'TOPC');pto=ufbint_8
3061 IF(pto.LT.bmiss) THEN
3062 IF(pc6.GE.bmiss.AND.nint(dop).EQ. 6) pc6 = pto
3063cppppp
3064 IF(pc6.GE.bmiss.AND.nint(dop).EQ. 6)
3065 $ print'(" ~~IW3UNP29/R04O29: PTO used for PC6 since latter ",
3066 $ "missing & 6-hr DOP")'
3067cppppp
3068 IF(p24.GE.bmiss.AND.nint(dop).EQ.24) p24 = pto
3069cppppp
3070 IF(p24.GE.bmiss.AND.nint(dop).EQ.24)
3071 $ print'(" ~~IW3UNP29/R04O29: PTO used for P24 since latter ",
3072 $ "missing & 24-hr DOP")'
3073cppppp
3074 END IF
3075 CALL ufbint(lunit,ufbint_8,1,1,iret,'POWW');pow=ufbint_8
3076 CALL ufbint(lunit,ufbint_8,1,1,iret,'HOWW');how=ufbint_8
3077 IF(subset(1:5).EQ.'NC001') THEN
3078 IF(subset(6:8).NE.'006') THEN
3079 IF(min(pow,how).GE.bmiss) THEN
3080 CALL ufbint(lunit,ufbint_8,1,1,iret,'POWV');pow=ufbint_8
3081 CALL ufbint(lunit,ufbint_8,1,1,iret,'HOWV');how=ufbint_8
3082 END IF
3083 ELSE
3084C PAOBS always have a missing elev, but we know they are at sea level
3085 elv = 0
3086 END IF
3087 END IF
3088 CALL ufbint(lunit,ufbint_8,1,1,iret,'DOSW');swd=ufbint_8
3089 CALL ufbint(lunit,ufbint_8,1,1,iret,'POSW');swp=ufbint_8
3090 CALL ufbint(lunit,ufbint_8,1,1,iret,'HOSW');swh=ufbint_8
3091 CALL ufbint(lunit,ufbint_8,1,1,iret,'SST1');sst=ufbint_8
3092 IF(sst.GE.bmiss) THEN
3093 CALL ufbint(lunit,ufbint_8,1,1,iret,'STMP');sst=ufbint_8
3094 ENDIF
3095 CALL ufbint(lunit,ufbint_8,1,1,iret,'????');spg=ufbint_8
3096 CALL ufbint(lunit,ufbint_8,1,1,iret,'????');spd=ufbint_8
3097 CALL ufbint(lunit,ufbint_8,1,1,iret,'TDMP');shc=ufbint_8
3098 CALL ufbint(lunit,ufbint_8,1,1,iret,'ASMP');sas=ufbint_8
3099 CALL ufbint(lunit,ufbint_8,1,1,iret,'????');wes=ufbint_8
3100 i52flg = 0
3101 IF(min(snd,p24,pow,how,swd,swp,swh,sst,spg,spd,shc,sas,wes)
3102 $ .GE.bmiss.AND.(pc6.EQ.0..OR.pc6.GE.bmiss)) i52flg= 1
3103
3104C SOME CLOUD DATA IS NEEDED FOR LOW, MIDDLE, AND HIGH CLOUDS IN CAT. 51
3105C ---------------------------------------------------------------------
3106
3107 CALL ufbint(lunit,clds_8,4,255,ncld,'VSSO CLAM CLTP HOCB')
3108 clds=clds_8
3109 cth = -9999.
3110 ctm = -9999.
3111 ctl = -9999.
3112 chh = bmiss
3113 chm = bmiss
3114 chl = bmiss
3115 IF(ncld.EQ.0) THEN
3116 ccm = bmiss
3117 ccl = bmiss
3118 ELSE
3119 ccm = 0.
3120 ccl = 0.
3121 DO l=1,ncld
3122 vss = clds(1,l)
3123 cam = clds(2,l)
3124 ctp = clds(3,l)
3125 cht = bmiss
3126 IF(clds(4,l).LT.bmiss) THEN
3127 ! Prior to 3/2002 HBLCS was not available, this will
3128 ! always be tested first because it is more precise
3129 ! and may still be available for some types after
3130 ! 3/2002
3131 cht = clds(4,l)
3132 ELSE
3133 ! Effective 3/2002 this will be available and can be
3134 ! used for types where HOCB is not available - less
3135 ! precise and only available on 1 level
3136 CALL ufbint(lunit,ufbint_8,1,1,iret,'HBLCS')
3137 hblcs=ufbint_8
3138 IF(nint(hblcs).LT.10) cht = ihblcs(nint(hblcs))
3139 END IF
3140 IF(cht.LT.bmiss) cht = cht * 3.2808
3141 IF(nint(vss).EQ.0) THEN
3142 IF(nint(ctp).GT.9.AND.nint(ctp).LT.20) THEN
3143 ith = mod(nint(ctp),10)
3144 kth = jth(ith)
3145 cth = max(kth,nint(cth))
3146 chh = min(cht,chh)
3147 ELSE IF(nint(ctp).LT.30) THEN
3148 itm = mod(nint(ctp),10)
3149 ctm = max(itm,nint(ctm))
3150 IF(itm.EQ.0) cam = 0.
3151 ccm = max(cam,ccm)
3152 chm = min(cht,chm)
3153 ELSE IF(nint(ctp).LT.40) THEN
3154 itl = mod(nint(ctp),10)
3155 ktl = jtl(itl)
3156 ctl = max(ktl,nint(ctl))
3157 IF(itl.EQ.0) cam = 0.
3158 ccl = max(cam,ccl)
3159 chl = min(cht,chl)
3160 ELSE IF(nint(ctp).EQ.59) THEN
3161 cth = 10.
3162 ctm = 10.
3163 IF(ccm.EQ.0.) ccm = 15.
3164 ctl = 10.
3165 IF(ccl.EQ.0.) ccl = 15.
3166 ELSE IF(nint(ctp).EQ.60) THEN
3167 cth = 10.
3168 ELSE IF(nint(ctp).EQ.61) THEN
3169 ctm = 10.
3170 IF(ccm.EQ.0.) ccm = 15.
3171 ELSE IF(nint(ctp).EQ.62) THEN
3172 ctl = 10.
3173 IF(ccl.EQ.0.) ccl = 15.
3174 END IF
3175 END IF
3176 ENDDO
3177 END IF
3178 IF(nint(cth).GT.-1.AND.nint(cth).LT.10) THEN
3179 cth = jth(nint(cth))
3180 ELSE IF(nint(cth).NE.10) THEN
3181 cth = bmiss
3182 END IF
3183 IF(nint(ctm).LT.0.OR.nint(ctm).GT.10) THEN
3184 ctm = bmiss
3185 ccm = bmiss
3186 END IF
3187 IF(nint(ctl).GT.-1.AND.nint(ctl).LT.10) THEN
3188 ctl = ltl(nint(ctl))
3189 ELSE IF(nint(ctl).NE.10) THEN
3190 ctl = bmiss
3191 ccl = bmiss
3192 END IF
3193
3194C CALL FUNCTIONS TO TRANSFORM TO ON29/124 UNITS
3195C ---------------------------------------------
3196
3197 psl = e01o29(psl)
3198 stp = e01o29(stp)
3199 sdr = e04o29(sdr,ssp)
3200 ssp = e05o29(sdr,ssp)
3201 IF(nint(sdr).EQ.0) sdr = 360.
3202 IF(sdr.GE.bmiss.AND.nint(ssp).EQ.0) sdr = 360.
3203 dpd = e07o29(dpd,stm)
3204 stm = e06o29(stm)
3205 tmx = e06o29(tmx)
3206 tmi = e06o29(tmi)
3207
3208 psq = e35o29(qsl)
3209 spq = e35o29(qsp)
3210 swq = e35o29(qmw)
3211 stq = e35o29(qmt)
3212 ddq = e35o29(qmd)
3213
3214C ADJUST QUIPS QUALITY MARKERS TO REFLECT UNPACKED ON29 CONVENTION
3215
3216 IF(subset(1:5).EQ.'NC001'.AND.psq.EQ.'C') stp = bmiss
3217 IF(psl.GE.bmiss) psq = ' '
3218 IF(stp.GE.bmiss) spq = ' '
3219 IF(max(sdr,ssp).GE.bmiss) swq = ' '
3220 IF(stm.GE.bmiss) stq = ' '
3221
3222 IF(subset(1:5).EQ.'NC000'.OR.subset.EQ.'NC001004') THEN
3223 hvz = e09o29(hvz)
3224 ELSE
3225 hvz = e38o29(hvz)
3226 END IF
3227 prw = e10o29(prw)
3228 pw1 = e11o29(pw1)
3229 pw2 = e11o29(pw2)
3230 IF(ddq.NE.'P'.AND.ddq.NE.'H'.AND.ddq.NE.'C') THEN
3231 ddq = ' '
3232 ipw2 = nint(pw2)
3233 IF(ipw2.GT.-1.AND.ipw2.LT.10) WRITE(ddq,'(I1)') ipw2
3234 END IF
3235 ccn = e12o29(ccn)
3236 chn = e14o29(ccl,ccm)
3237 ctl = e15o29(ctl)
3238 ctm = e15o29(ctm)
3239 cth = e15o29(cth)
3240 hcb = e18o29(chl,chm,chh,ctl,ctm,cth)
3241 cpt = e19o29(cpt)
3242 apt = e01o29(apt)
3243
3244 pc6 = e20o29(pc6)
3245 snd = e21o29(snd)
3246 p24 = e20o29(p24)
3247 dop = e22o29(pc6)
3248 pow = e23o29(pow)
3249 how = e24o29(how)
3250 swd = e25o29(swd)
3251 swp = e23o29(swp)
3252 swh = e24o29(swh)
3253 sst = e06o29(sst)
3254 spg = e28o29(spg)
3255 spd = e29o29(spd)
3256 shc = e30o29(shc)
3257 sas = e31o29(sas)
3258 wes = e32o29(wes)
3259
3260C MAKE THE UNPACKED ON29/124 REPORT INTO OBS
3261C ------------------------------------------
3262
3263 rsv2 = ' '
3264 CALL s01o29(sid,xob,yob,rhr,rch,rsv,rsv2,elv,itp,rtp)
3265 CALL s02o29(51,1,*9999)
3266 IF(i52flg.EQ.0) CALL s02o29(52,1,*9999)
3267
3268C ------------------------------------------------------------------
3269C MISC DATA GOES INTO CATEGORY 08
3270C ------------------------------------------------------------------
3271C CODE FIGURE 020 - ALTIMETER SETTING IN 0.1*MB
3272C CODE FIGURE 081 - CALENDAR DAY MAXIMUM TEMPERATURE
3273C CODE FIGURE 082 - CALENDAR DAY MINIMUM TEMPERATURE
3274C CODE FIGURE 083 - SIX HOUR MAXIMUM TEMPERATURE
3275C CODE FIGURE 084 - SIX HOUR MINIMUM TEMPERATURE
3276C CODE FIGURE 085 - PRECIPITATION OVER PAST HOUR IN 0.01*INCHES
3277C CODE FIGURE 098 - DURATION OF SUNSHINE FOR CALENDAR DAY IN MINUTES
3278C CODE FIGURE 924 - WIND SPEED IN 0.01*M/S
3279C ------------------------------------------------------------------
3280
3281 CALL ufbint(lunit,ufbint_8,1,1,iret,'ALSE');als=ufbint_8
3282 IF(als.LT.bmiss) THEN
3283 ob8(1) = e01o29(als)
3284 cf8(1) = 20
3285 q81(1) = ' '
3286 q82(1) = ' '
3287 CALL s02o29(8,1,*9999)
3288 END IF
3289 IF(subset.EQ.'NC000007') THEN
3290 CALL ufbint(lunit,tmxmnm_8,4,255,ntxm,
3291 $ '.DTHMXTM MXTM .DTHMITM MITM');tmxmnm=tmxmnm_8
3292 IF(ntxm.GT.0) THEN
3293 DO i = 1,ntxm
3294 DO j = 1,3,2
3295 IF(nint(tmxmnm(j,i)).EQ.24) THEN
3296 IF(tmxmnm(j+1,i).LT.bmiss) THEN
3297 tmx = e06o29(tmxmnm(j+1,i))
3298 IF(tmx.LT.0) THEN
3299 ob8(1) = 1000 + abs(nint(tmx))
3300 ELSE
3301 ob8(1) = nint(tmx)
3302 END IF
3303 cf8(1) = 81 + int(j/2)
3304 q81(1) = ' '
3305 q82(1) = ' '
3306 CALL s02o29(8,1,*9999)
3307 END IF
3308 ELSE IF(nint(tmxmnm(j,i)).EQ.6) THEN
3309 IF(tmxmnm(j+1,i).LT.bmiss) THEN
3310 tmx = e06o29(tmxmnm(j+1,i))
3311 IF(tmx.LT.0) THEN
3312 ob8(1) = 1000 + abs(nint(tmx))
3313 ELSE
3314 ob8(1) = nint(tmx)
3315 END IF
3316 cf8(1) = 83 + int(j/2)
3317 q81(1) = ' '
3318 q82(1) = ' '
3319 CALL s02o29(8,1,*9999)
3320 END IF
3321 END IF
3322 ENDDO
3323 ENDDO
3324 END IF
3325 END IF
3326 CALL ufbint(lunit,ufbint_8,1,1,iret,'TP01');pc1=ufbint_8
3327 IF(pc1.LT.10000) THEN
3328 ob8(1) = e20o29(pc1)
3329 cf8(1) = 85
3330 q81(1) = ' '
3331 q82(1) = ' '
3332 CALL s02o29(8,1,*9999)
3333 END IF
3334 CALL ufbint(lunit,ufbint_8,1,1,iret,'TOSS');dus=ufbint_8
3335 IF(nint(dus).LT.1000) THEN
3336 ob8(1) = nint(98000. + dus)
3337 cf8(1) = 98
3338 q81(1) = ' '
3339 q82(1) = ' '
3340 CALL s02o29(8,1,*9999)
3341 END IF
3342 IF(wspd1.LT.bmiss) THEN
3343 ob8(1) = nint(wspd1*10.)
3344 cf8(1) = 924
3345 q81(1) = ' '
3346 q82(1) = ' '
3347 CALL s02o29(8,1,*9999)
3348 END IF
3349
3350 CALL s03o29(obs,subset,*9999,*9998)
3351
3352 RETURN
3353
3354 9999 CONTINUE
3355 r04o29 = 999
3356 RETURN
3357
3358 9998 CONTINUE
3359 print'(" IW3UNP29/R04O29: RPT with ID= ",A," TOSSED - ZERO ",
3360 $ "CAT.1-6,51,52 LVLS")', sid
3361 r04o29 = -9999
3362 ksksfc =ksksfc + 1
3363 RETURN
3364
3365 END
3366C***********************************************************************
3367C***********************************************************************
3368C***********************************************************************
3369 FUNCTION r05o29(LUNIT,OBS)
3370C ---> formerly FUNCTION AIRCFT
3371
3372 common/io29ee/pob(255),qob(255),tob(255),zob(255),dob(255),
3373 $ sob(255),vsg(255),clp(255),cla(255),ob8(255),
3374 $ cf8(255)
3375 common/io29ff/pqm(255),qqm(255),tqm(255),zqm(255),wqm(255),
3376 $ qcp(255),qca(255),q81(255),q82(255)
3377 common/io29cc/subset,idat10
3378 common/io29bb/kndx,kskacf(8),kskupa,ksksfc,ksksat,ksksmi
3379 common/io29ll/bmiss
3380
3381 CHARACTER*80 hdstr,lvstr,qmstr,rcstr,crawr
3382 CHARACTER*8 subset,sid,sido,sidmod,e35o29,rsv,rsv2,ccl,craw(1,255)
3383 CHARACTER*1 pqm,qqm,tqm,zqm,wqm,qcp,qca,q81,q82,cturb(0:14)
3384 REAL(8) rid_8,rcl_8,ufbint_8,rns_8,bmiss
3385 REAL(8) hdr_8(20),rct_8(5,255),arr_8(10,255),raw_8(1,255)
3386 dimension obs(*),hdr(20),rct(5,255),arr(10,255),raw(1,255)
3387 equivalence(rid_8,sid),(rcl_8,ccl),(raw_8,craw)
3388
3389 SAVE
3390
3391 DATA hdstr/'RPID CLON CLAT HOUR MINU SECO '/
3392 DATA lvstr/'PRLC TMDP TMDB WDIR WSPD '/
3393 DATA qmstr/'QMPR QMAT QMDD QMGP QMWN '/
3394 DATA rcstr/'RCHR RCMI RCTS '/
3395
3396 DATA cturb/'0','1','2','3','0','1','2','3','0','1','2',4*'3'/
3397
3398C CHECK IF THIS IS A PREPBUFR FILE
3399C --------------------------------
3400
3401 r05o29 = 99
3402c#V#V#dak - future
3403cdak IF(SUBSET.EQ.'AIRCFT') R05O29 = PRPCFT(LUNIT,OBS)
3404cdak IF(SUBSET.EQ.'AIRCAR') R05O29 = PRPCFT(LUNIT,OBS)
3405caaaaadak - future
3406 IF(r05o29.NE.99) RETURN
3407 r05o29 = 0
3408
3409 CALL s05o29
3410
3411C PUT THE HEADER INFORMATION INTO ON29 FORMAT
3412C -------------------------------------------
3413
3414 CALL ufbint(lunit,hdr_8,20, 1,iret,hdstr);hdr(2:)=hdr_8(2:)
3415 IF(iret.EQ.0) sid = ' '
3416 CALL ufbint(lunit,rct_8, 5,255,nrct,rcstr);rct=rct_8
3417 IF(hdr(5).GE.bmiss) hdr(5) = 0
3418 IF(hdr(6).GE.bmiss) hdr(6) = 0
3419 rctim = nint(rct(1,1))+nint(rct(2,1))/60.
3420 rid_8 = hdr_8(1)
3421 xob = hdr(2)
3422 yob = hdr(3)
3423 rhr = bmiss
3424 IF(hdr(4).LT.bmiss) rhr = nint(hdr(4)) + ((nint(hdr(5)) * 60.) +
3425 $ nint(hdr(6)))/3600.
3426 rch = rctim
3427
3428C TRY TO FIND FIND THE FLIGHT LEVEL HEIGHT
3429C ----------------------------------------
3430
3431 CALL ufbint(lunit,hdr_8,20,1,iret,'PSAL FLVL IALT HMSL PRLC')
3432 hdr=hdr_8
3433 elev = bmiss
3434 IF(hdr(5).LT.bmiss) elev = e03o29(hdr(5)*.01)
3435 IF(hdr(4).LT.bmiss) elev = hdr(4)
3436C FOR MDCARS ACARS DATA ONLY:
3437C UNCOMMENTING NEXT LINE WILL SET P-ALT TO REPORTED "IALT" VALUE --
3438C IN THIS CASE, PREPDATA WILL LATER GET PRESS. VIA STD. ATMOS. FCN.
3439C COMMENTING NEXT LINE WILL USE REPORTED PRESSURE "PRLC" TO GET
3440C P-ALT VIA INVERSE STD. ATMOS. FCN. -- IN THIS CASE, PREPDATA WILL
3441C LATER RETURN THIS SAME PRESS. VIA STD. ATMOS. FCN.
3442cdak IF(HDR(3).LT.BMISS) ELEV = HDR(3)
3443 IF(hdr(2).LT.bmiss) elev = hdr(2) + sign(0.0000001,hdr(2))
3444 IF(hdr(1).LT.bmiss) elev = hdr(1) + sign(0.0000001,hdr(1))
3445 elv = elev
3446
3447C ACFT NAVIGATION SYSTEM STORED IN INSTR. TYPE LOCATION (AS WITH ON29)
3448C --------------------------------------------------------------------
3449
3450 itp = 99
3451 CALL ufbint(lunit,rns_8,1,1,iret,'ACNS');rns=rns_8
3452 IF(rns.LT.bmiss) THEN
3453 IF(nint(rns).EQ.0) THEN
3454 itp = 97
3455 ELSE IF(nint(rns).EQ.1) THEN
3456 itp = 98
3457 END IF
3458 END IF
3459
3460 rtp = e33o29(subset,sid)
3461
3462 CALL ufbint(lunit,rcl_8,1,1,iret,'BORG') ! Effective 3/2002
3463 IF(iret.EQ.0) THEN
3464 ccl = ' '
3465 CALL ufbint(lunit,rcl_8,1,1,iret,'ICLI') ! Prior to 3/2002
3466 IF(iret.EQ.0) ccl = ' '
3467 END IF
3468cvvvvv temporary?
3469 IF(ccl(1:4).EQ.'KAWN') THEN
3470
3471C This will toss all Carswell/Tinker Aircraft reports - until Jack
3472C fixes the dup-check to properly remove the duplicate Carswell
3473C reports, we are better off removing them all since they are
3474C often of less quality than the non-Carswell AIREP reports
3475C RIGHT NOW WE ARE HAPPY WITH DUP-CHECKER'S HANDLING OF THESE,
3476C SO COMMENT THIS OUT
3477
3478cdak R05O29 = -9999
3479cdak KSKACF(?) = KSKACF(?) + 1
3480cdak RETURN
3481 END IF
3482caaaaa temporary?
3483 IF(subset.EQ.'NC004003') THEN
3484
3485C ------------------------------------
3486C ASDAR/AMDAR AIRCRAFT TYPE COME HERE
3487C ------------------------------------
3488
3489cvvvvv temporary?
3490C Currently, we throw out any ASDAR/AMDAR reports with header "LFPW" -
3491C simply because they never appeared in NAS9000 ON29 AIRCFT data set
3492C (NOTE: These should all have ACID's that begin with "IT")
3493C (NOTE: These will not be removed from the new decoders, because
3494C they are apparently unique reports of reasonable
3495C quality. EMC just needs to test them in a parallel run
3496C to make sure prepacqc and the analysis handle them okay.)
3497
3498C NOTE: NO, NO DON'T THROW THEM OUT ANY MORE !!!!!!
3499C Keyser -- 6/13/97
3500
3501CDAKCDAK if(ccl(1:4).eq.'LFPW') then
3502cppppp
3503cdak print'(" IW3UNP29/R05O29: TOSS ""LFPW"" AMDAR with ID = ",A,
3504cdak $ "; CCL = ",A)', SID,CCL(1:4)
3505cppppp
3506CDAKCDAK R05O29 = -9999
3507CDAKCDAK kskacf(2) = kskacf(2) + 1
3508CDAKCDAK return
3509CDAKCDAK end if
3510caaaaa temporary?
3511
3512C MODIFY REPORT ID AS WAS DONE IN OLD ON29 AIRCRAFT PACKER
3513C --------------------------------------------------------
3514
3515 CALL s06o29(sid,sidmod)
3516 sido = sid
3517 sid = sidmod
3518
3519C THE 25'TH (RESERVE) CHARACTER INDICATES PHASE OF FLIGHT
3520C THE 26'TH (RESERVE) CHARACTER INDICATES TEMPERATURE PRECISION
3521C THE 27'TH (RESERVE) CHARACTER INDICATES CARSWELL (NEVER HAPPENS)
3522C (NOTE: NAS9000 ONLY ASSIGNED HEADER "KAWN" AS CARSWELL, ALTHOUGH
3523C "PHWR" AND "EGWR" ARE ALSO APPARENTLY ALSO CARSWELL)
3524
3525 rsv = '71 '
3526 CALL ufbint(lunit,ufbint_8,1,1,iret,'POAF');pof=ufbint_8
3527 IF(pof.LT.bmiss) WRITE(rsv(1:1),'(I1)') nint(pof)
3528 CALL ufbint(lunit,ufbint_8,1,1,iret,'PCAT');pct=ufbint_8
3529 IF(nint(pct).GT.1) rsv(2:2) = '0'
3530 IF(ccl(1:4).EQ.'KAWN') rsv(3:3) = 'C'
3531
3532 ELSE IF(subset.EQ.'NC004004') THEN
3533
3534C ------------------------------
3535C ACARS AIRCRAFT TYPE COME HERE
3536C ------------------------------
3537
3538 CALL ufbint(lunit,rid_8,1,1,iret,'ACRN')
3539 IF(iret.EQ.0) sid = 'ACARS '
3540 kndx = kndx + 1
3541 rsv = '999 '
3542
3543 ELSE IF(subset.EQ.'NC004001'.OR.subset.EQ.'NC004002') THEN
3544
3545C -----------------------------------------
3546C AIREP AND PIREP AIRCRAFT TYPES COME HERE
3547C -----------------------------------------
3548
3549C MAY POSSIBLY NEED TO MODIFY THE RPID HERE
3550C -----------------------------------------
3551
3552 IF(sid(6:6).EQ.'Z') sid(6:6) = 'X'
3553 IF(sid.EQ.'A '.OR.sid.EQ.' '.OR.sid(1:3).EQ.'ARP'
3554 $ .OR.sid(1:3).EQ.'ARS') sid = 'AIRCFT '
3555
3556cvvvvv temporary?
3557C Determined that Hickum AFB reports are much like Carswell - they have
3558C problems! They also are usually duplicates of either Carswell or
3559C non-Carswell reports. Apparently the front-end processing filters
3560C them out (according to B. Ballish). So, to make things match,
3561C we will do the same here.
3562C ACTUALLY, JEFF ATOR HAS REMOVED THESE FROM THE DECODER, SO WE
3563C SHOULD NEVER EVEN SEE THEM IN THE DATABASE, but it won't hurt
3564C anything to keep this in here.
3565C (NOTE: These all have headers of "PHWR")
3566
3567 if(ccl(1:4).eq.'PHWR') then
3568cppppp
3569cdak print'(" IW3UNP29/R05O29: TOSS ""PHWR"" AIREP with ID = ",A,
3570cdak $ "; CCL = ",A)', SID,CCL(1:4)
3571cppppp
3572 r05o29 = -9999
3573 kskacf(8) = kskacf(8) + 1
3574 return
3575 end if
3576caaaaa temporary?
3577
3578cvvvvv temporary?
3579C 1) Carswell/Tinker AMDARS are processed as AIREP subtypes.
3580C Nearly all of them are duplicated as true non-Carswell AMDARS in
3581C the AMDAR subtype. The earlier version of the aircraft dup-
3582C checker could not remove such duplicates; the new verison now
3583C in operations can remove these. SO, WE HAVE COMMENTED THIS OUT.
3584C
3585C The Carswell AMDARS can be identified by the string " Sxyz" in
3586C the raw report (beyond byte 40), where y is 0,1, or 2.
3587C (NOTE: Apparently Carswell here applies to more headers than
3588C just "KAWN", so report header is not even checked.)
3589
3590C 2) Carswell/Tinker ACARS are processed as AIREP subtypes.
3591C These MAY duplicate true non-Carswell ACARS in the ACARS
3592C subtype. The NAS9000 decoder always excluded this type (no
3593C dup-checking was done). All of these will be removed here.
3594C The Carswell ACARS can be identified by the string " Sxyz" in
3595C the raw report (beyond byte 40), where y is 3 or greater.
3596C (NOTE: Apparently Carswell here applies to more headers than
3597C just "KAWN", so report header is not even checked.)
3598
3599 call ufbint(lunit,raw_8,1,255,nlev,'RRSTG');raw=raw_8
3600 if(nlev.gt.5) then
3601 ni = -7
3602 do mm = 6,nlev
3603 ni = ni + 8
3604 crawr(ni:ni+7) = craw(1,mm)
3605 if(ni+8.gt.80) go to 556
3606 enddo
3607 556 continue
3608 do mm = 1,ni+7
3609 if(crawr(mm:mm+1).eq.' S') then
3610 if((crawr(mm+2:mm+2).ge.'0'.and.crawr(mm+2:mm+2).le.
3611 $ '9').or.crawr(mm+2:mm+2).eq.'/') then
3612 if((crawr(mm+3:mm+3).ge.'0'.and.crawr(mm+3:mm+3)
3613 $ .le.'9').or.crawr(mm+3:mm+3).eq.'/') then
3614 if((crawr(mm+4:mm+4).ge.'0'.and.
3615 $ crawr(mm+4:mm+4).le.'9').or.crawr(mm+4:mm+4)
3616 $ .eq.'/') then
3617cppppp
3618cdak print'(" IW3UNP29/R05O29: For ",A,", raw_8(",I0,") = ",A)',
3619cdak $ SID,ni+7,crawr(1:ni+7)
3620cppppp
3621 if(crawr(mm+3:mm+3).lt.'3') then
3622
3623C THIS IS A CARSWELL/TINKER AMDAR REPORT --> THROW OUT
3624C (NOT ANYMORE, DUP-CHECKER IS HANDLING THESE OKAY NOW)
3625C ----------------------------------------------------
3626
3627cppppp
3628cdak print'(" IW3UNP29/R05O29: Found a Carswell AMDAR for ",A,
3629cdak $ "; CCL = ",A)', SID,CCL(1:4)
3630cppppp
3631cdak R05O29 = -9999
3632cdak KSKACF(3) = KSKACF(3) + 1
3633cdak RETURN
3634 else
3635
3636C THIS IS A CARSWELL/TINKER ACARS REPORT --> THROW OUT
3637C ----------------------------------------------------
3638
3639cppppp
3640cdak print'(" IW3UNP29/R05O29: Found a Carswell ACARS for ",A,
3641cdak $ "; CCL = ",A)', SID,CCL(1:4)
3642cppppp
3643 r05o29 = -9999
3644 kskacf(4) = kskacf(4) + 1
3645 RETURN
3646
3647 end if
3648 end if
3649 end if
3650 end iF
3651 end if
3652 if(mm+5.gt.ni+7) go to 557
3653 enddo
3654 557 continue
3655 END IF
3656caaaaa temporary?
3657
3658C THE 25'TH (RESERVE) CHARACTER INDICATES 8'TH CHARACTER OF STATION ID
3659C THE 26'TH (RESERVE) CHARACTER INDICATES 7'TH CHARACTER OF STATION ID
3660C THE 27'TH (RESERVE) CHARACTER INDICATES CARSWELL
3661C (NOTE: NAS9000 ONLY ASSIGNED HEADER "KAWN" AS CARSWELL, ALTHOUGH
3662C "PHWR" AND "EGWR" ARE ALSO APPARENTLY ALSO CARSWELL)
3663
3664 rsv = sid(8:8)//sid(7:7)//' '
3665 IF(ccl(1:4).EQ.'KAWN') rsv(3:3) = 'C'
3666
3667 END IF
3668
3669C -----------------------------
3670C ALL AIRCRAFT TYPES COME HERE
3671C -----------------------------
3672
3673 CALL ufbint(lunit,ufbint_8,1,1,iret,'DGOT');dgt=ufbint_8
3674
3675C PUT THE LEVEL DATA INTO ON29 UNITS
3676C ----------------------------------
3677
3678 CALL ufbint(lunit,arr_8,10,255,nlev,lvstr);arr=arr_8
3679 DO l=1,nlev
3680
3681Cvvvvv temporary?
3682C Even though PREPDATA filters out any aircraft reports with a missing
3683C wind, or AIREP/PIREP and AMDAR reports below 100 and 2286 meters,
3684C respectively, it will be done here for now in order to help in
3685C the comparison between counts coming from the Cray dumps and the
3686C NAS9000 ON29 dumps (the NAS9000 ON29 maker filters these out).
3687
3688C NO, NO LET'S NOT FILTER HERE ANY MORE - LEAVE IT UP TO PREPDATA
3689C SINCE WE AREN'T COMPARING NAS9000 AND CRAY COUNTS ANY MORE
3690C Keyser -- 6/13/97
3691
3692CDAKCDAK if(arr(4,1).ge.bmiss.or.arr(5,1).ge.bmiss) then
3693CDAKCDAK R05O29 = -9999
3694CDAKCDAK kskacf(5) = kskacf(5) + 1
3695CDAKCDAK return
3696CDAKCDAK end if
3697CDAKCDAK if(subset.eq.'NC004003'.and.elev.lt.2286.) then
3698CDAKCDAK R05O29 = -9999
3699CDAKCDAK kskacf(6) = kskacf(6) + 1
3700CDAKCDAK return
3701CDAKCDAK else if(subset.ne.'NC004004'.and.elev.lt.100.) then
3702CDAKCDAK R05O29 = -9999
3703CDAKCDAK kskacf(7) = kskacf(7) + 1
3704CDAKCDAK return
3705CDAKCDAK end if
3706caaaaa temporary?
3707
3708 pob(l) = e01o29(arr(1,l))
3709 qob(l) = e07o29(arr(2,l),arr(3,l))
3710 tob(l) = e06o29(arr(3,l))
3711 zob(l) = elev
3712 dob(l) = e04o29(arr(4,l),arr(5,l))
3713 sob(l) = e05o29(arr(4,l),arr(5,l))
3714 ENDDO
3715 wspd1 = arr(5,1)
3716
3717 CALL ufbint(lunit,arr_8,10,255,nlev,qmstr);arr=arr_8
3718
3719 IF(subset.EQ.'NC004004') THEN
3720
3721C ---------------------------------------------------------
3722C ACARS AIRCRAFT TYPE COME HERE FOR QUALITY MARK ASSIGNMENT
3723C ---------------------------------------------------------
3724
3725 DO l=1,nlev
3726 pqm(l) = e35o29(arr(1,l))
3727 tqm(l) = e35o29(arr(2,l))
3728 qqm(l) = e35o29(arr(3,l))
3729 zqm(l) = e35o29(arr(4,l))
3730 wqm(l) = e35o29(arr(5,l))
3731 ENDDO
3732
3733C DEFAULT Q.MARK FOR WIND: "A"
3734C ----------------------------
3735
3736 IF(nlev.EQ.0.OR.arr(5,1).GE.bmiss) wqm(1) = 'A'
3737
3738 ELSE
3739
3740C --------------------------------------------------------------
3741C ALL OTHER AIRCRAFT TYPES COME HERE FOR QUALITY MARK ASSIGNMENT
3742C --------------------------------------------------------------
3743
3744 DO l=1,nlev
3745 arr(4,l) = 2
3746
3747C IF KEEP FLAG ON WIND, ENTIRE REPORT GETS KEEP FLAG ('H' IN ZQM)
3748C -- unless....
3749C IF PURGE FLAG ON WIND, ENTIRE REPORT GETS PURGE FLAG ('P' IN ZQM)
3750C IF PURGE FLAG ON TEMP, ENTIRE REPORT GETS PURGE FLAG ('P' IN ZQM)
3751C IF FAIL FLAG ON WIND, ENTIRE REPORT GETS FAIL FLAG ('F' IN ZQM)
3752C IF FAIL FLAG ON TEMP, ENTIRE REPORT GETS FAIL FLAG ('F' IN ZQM)
3753C -----------------------------------------------------------------
3754
3755 IF(arr(5,l).EQ.0.AND.(arr(2,l).LT.10.OR.arr(2,l).GT.15))THEN
3756 arr(4,l) = 0
3757 ELSE IF(arr(5,l).EQ.14.OR.arr(2,l).EQ.14) THEN
3758 arr(4,l) = 14
3759 ELSE IF(arr(5,l).EQ.13.OR.arr(2,l).EQ.13) THEN
3760 arr(4,l) = 13
3761 END IF
3762 pqm(l) = ' '
3763 tqm(l) = ' '
3764 qqm(l) = ' '
3765 zqm(l) = e35o29(arr(4,l))
3766
3767C DEGREE OF TURBULENCE IS STORED IN MOISTURE Q.M. SLOT
3768C ----------------------------------------------------
3769
3770 IF(nint(dgt).LT.15) qqm(l) = cturb(nint(dgt))
3771 ENDDO
3772
3773C DEFAULT Q.MARK FOR WIND: "C"
3774C ----------------------------
3775
3776 wqm(1) = 'C'
3777 END IF
3778
3779C PUT THE UNPACKED ON29 REPORT INTO OBS
3780C -------------------------------------
3781
3782 rsv2 = ' '
3783 CALL s01o29(sid,xob,yob,rhr,rch,rsv,rsv2,elv,itp,rtp)
3784 CALL s02o29(6,1,*9999)
3785
3786C ------------------------------------------------------------------
3787C MISC DATA GOES INTO CATEGORY 08
3788C ------------------------------------------------------------------
3789C CODE FIGURE 021 - REPORT SEQUENCE NUMBER
3790C CODE FIGURE 917 - CHARACTERS 1 AND 2 OF ACTUAL STATION IDENTIFICATION
3791C (CURRENTLY ONLY FOR ASDAR/AMDAR)
3792C CODE FIGURE 918 - CHARACTERS 3 AND 4 OF ACTUAL STATION IDENTIFICATION
3793C (CURRENTLY ONLY FOR ASDAR/AMDAR)
3794C CODE FIGURE 919 - CHARACTERS 5 AND 6 OF ACTUAL STATION IDENTIFICATION
3795C (CURRENTLY ONLY FOR ASDAR/AMDAR)
3796C CODE FIGURE 920 - CHARACTERS 7 AND 8 OF ACTUAL STATION IDENTIFICATION
3797C (CURRENTLY ONLY FOR ASDAR/AMDAR AND ACARS)
3798C CODE FIGURE 921 - OBSERVATION TIME TO NEAREST 1000'TH OF AN HOUR
3799C (CURRENTLY ONLY FOR ACARS)
3800C CODE FIGURE 922 - FIRST TWO CHARACTERS OF BULLETIN BEING MONITORED
3801C CODE FIGURE 923 - LAST TWO CHARACTERS OF BULLETIN BEING MONITORED
3802C CODE FIGURE 924 - WIND SPEED IN 0.01*M/S
3803C ------------------------------------------------------------------
3804
3805 IF(subset.EQ.'NC004004') THEN
3806 ob8(1) = kndx
3807 cf8(1) = 21
3808 q81(1) = ' '
3809 q82(1) = ' '
3810 CALL s02o29(8,1,*9999)
3811 ob8(1) = 99999.
3812 q81(1) = sid(7:7)
3813 q82(1) = sid(8:8)
3814 cf8(1) = 920
3815 CALL s02o29(8,1,*9999)
3816 IF(rhr.LT.bmiss) THEN
3817 ob8(1) = nint((rhr*1000.)+0.0000001)
3818 cf8(1) = 921
3819 q81(1) = ' '
3820 q82(1) = ' '
3821 CALL s02o29(8,1,*9999)
3822 END IF
3823 ELSE IF(subset.EQ.'NC004003') THEN
3824 DO kkk = 1,4
3825 ob8(kkk) = 99999.
3826 q81(kkk) = sido(2*kkk-1:2*kkk-1)
3827 q82(kkk) = sido(2*kkk:2*kkk)
3828 cf8(kkk) = 916 + kkk
3829 CALL s02o29(8,kkk,*9999)
3830 ENDDO
3831 END IF
3832 IF(ccl.NE.' ') THEN
3833 ob8(2) = 99999.
3834 q81(2) = ccl(1:1)
3835 q82(2) = ccl(2:2)
3836 cf8(2) = 922
3837 CALL s02o29(8,2,*9999)
3838 ob8(3) = 99999.
3839 q81(3) = ccl(3:3)
3840 q82(3) = ccl(4:4)
3841 cf8(3) = 923
3842 CALL s02o29(8,3,*9999)
3843 END IF
3844 IF(wspd1.LT.bmiss) THEN
3845 ob8(4) = nint(wspd1*10.)
3846 cf8(4) = 924
3847 q81(4) = ' '
3848 q82(4) = ' '
3849 CALL s02o29(8,4,*9999)
3850 END IF
3851
3852 CALL s03o29(obs,subset,*9999,*9998)
3853
3854 RETURN
3855
3856 9999 CONTINUE
3857 r05o29 = 999
3858 RETURN
3859
3860 9998 CONTINUE
3861 print'(" IW3UNP29/R05O29: RPT with ID= ",A," TOSSED - ZERO ",
3862 $ "CAT.1-6,51,52 LVLS")', sid
3863 r05o29 = -9999
3864 kskacf(1) = kskacf(1) + 1
3865 RETURN
3866
3867 END
3868C***********************************************************************
3869C***********************************************************************
3870C***********************************************************************
3871 FUNCTION r06o29(LUNIT,OBS)
3872C ---> formerly FUNCTION SATWND
3873
3874 common/io29ee/pob(255),qob(255),tob(255),zob(255),dob(255),
3875 $ sob(255),vsg(255),clp(255),cla(255),ob8(255),
3876 $ cf8(255)
3877 common/io29ff/pqm(255),qqm(255),tqm(255),zqm(255),wqm(255),
3878 $ qcp(255),qca(255),q81(255),q82(255)
3879 common/io29cc/subset,idat10
3880 common/io29bb/kndx,kskacf(8),kskupa,ksksfc,ksksat,ksksmi
3881 common/io29kk/kount(499,18)
3882 common/io29ll/bmiss
3883
3884 CHARACTER*80 hdstr,lvstr,qmstr,rcstr
3885 CHARACTER*8 subset,sid,e35o29,rsv,rsv2
3886 CHARACTER*3 cindx3
3887 CHARACTER*1 pqm,qqm,tqm,zqm,wqm,qcp,qca,q81,q82,csat(499),
3888 $ cprd(9),cindx7,c7(26),cprod(0:4),cprdf(3)
3889 INTEGER iprdf(3)
3890 REAL(8) rid_8,ufbint_8,bmiss
3891 REAL(8) hdr_8(20),rct_8(5,255),arr_8(10,255)
3892 dimension obs(*),hdr(20),rct(5,255),arr(10,255)
3893 equivalence(rid_8,sid)
3894
3895 SAVE
3896
3897 DATA hdstr/'RPID CLON CLAT HOUR MINU SAID '/
3898 DATA lvstr/'PRLC TMDP TMDB WDIR WSPD '/
3899 DATA qmstr/'QMPR QMAT QMDD QMGP SWQM '/
3900 DATA rcstr/'RCHR RCMI RCTS '/
3901
3902 DATA csat /'A','B','C','D',45*'?','Z','W','X','Y','Z','W','X',
3903 $ 'Y','Z','W',90*'?','R','O','P','Q','R','O','P','Q','R','O',
3904 $ 339*'?','V'/
3905 DATA cprod /'C','D','?','?','E'/
3906 DATA cprdf /'C','B','V'/
3907 DATA iprdf / 1 , 6 , 4 /
3908 DATA cprd /'C','V','I','W','P','T','L','Z','G'/
3909 DATA c7 /'A','B','C','D','E','F','G','H','I','J','K','L','M',
3910 $ 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'/
3911
3912C CHECK IF THIS IS A PREPBUFR FILE
3913C --------------------------------
3914
3915 r06o29 = 99
3916c#V#V#dak - future
3917cdak IF(SUBSET.EQ.'SATWND') R06O29 = PRPWND(LUNIT,OBS)
3918caaaaadak - future
3919 IF(r06o29.NE.99) RETURN
3920 r06o29 = 0
3921
3922 CALL s05o29
3923
3924C TRY TO FIND FIND THE HEIGHT ASSIGNMENT
3925C --------------------------------------
3926
3927 CALL ufbint(lunit,hdr_8,20,1,iret,'HGHT PRLC');hdr=hdr_8
3928 elev = bmiss
3929 IF(hdr(2).LT.bmiss) elev = e03o29(hdr(2)*.01)
3930 IF(hdr(1).LT.bmiss) elev = hdr(1)
3931
3932C PUT THE HEADER INFORMATION INTO ON29 FORMAT
3933C -------------------------------------------
3934
3935 CALL ufbint(lunit,hdr_8,20, 1,iret,hdstr);hdr(2:)=hdr_8(2:)
3936 CALL ufbint(lunit,rct_8, 5,255,nrct,rcstr);rct=rct_8
3937 IF(hdr(5).GE.bmiss) hdr(5) = 0
3938 rctim = nint(rct(1,1))+nint(rct(2,1))/60.
3939 rid_8 = hdr_8(1)
3940 xob = hdr(2)
3941 yob = hdr(3)
3942 rhr = bmiss
3943 IF(hdr(4).LT.bmiss) rhr = nint(hdr(4))+nint(hdr(5))/60.
3944 rch = rctim
3945 rsv = '990 '
3946
3947C THE 25'TH (RESERVE) CHARACTER IS THE CLOUD MASK/DEEP LAYER INDICATOR
3948C {=2 - CLOUD TOP (NORMAL CLOUD DRIFT), =1 - DEEP LAYER,
3949C =9 - INDICATOR MISSING, THUS REVERTS TO DEFAULT CLOUD TOP}
3950C (=9 FOR ALL BUT U.S. HIGH-DENSITY SATWND TYPES)
3951C --------------------------------------------------------------------
3952
3953C THE 27'TH (RESERVE) CHARACTER INDICATES THE PRODUCER OF THE SATWND
3954C ------------------------------------------------------------------
3955
3956C THE INSTRUMENT TYPE INDICATES THE PRODUCT TYPE
3957C ----------------------------------------------
3958
3959 itp = 99
3960
3961C REPROCESS THE STN. ID
3962C ---------------------
3963
3964C REPROCESSED CHAR 1 -----> GOES: BUFR CHAR 1
3965C -----> METEOSAT: SAT. NO. 52, 56 GET 'X'
3966C SAT. NO. 53, 57 GET 'Y'
3967C SAT. NO. 50, 54, 58 GET 'Z'
3968C SAT. NO. 51, 55, 59 GET 'W'
3969C -----> GMS(JA): SAT. NO. 152,156 GET 'P'
3970C SAT. NO. 153,157 GET 'Q'
3971C SAT. NO. 150,154,158 GET 'R'
3972C SAT. NO. 151,155,159 GET 'O'
3973C -----> INSAT: SAT. NO. 499 GET 'V'
3974C REPROCESSED CHAR 2 -----> GOES: RETURNED VALUE IN BUFR FOR 'SWPR'
3975C (PRODUCER)
3976C -----> OTHERS: SAT. PRODUCER -- ESA GET 'C'
3977C -- GMS GET 'D'
3978C -- INSAT GET 'E'
3979C REPROCESSED CHAR 6 -----> GOES: BUFR CHAR 6
3980C -----> OTHERS -- INFRA-RED CLOUD DRIFT GET 'C'
3981C -- VISIBLE CLOUD DRIFT GET 'B'
3982C -- WATER VAPOR GET 'V'
3983C REPROCESSED CHAR 3-5 ---> SEQUENTIAL SERIAL INDEX (001 - 999)
3984C (UNIQUE FOR EACH BUFR CHAR 1/6 COMB.)
3985C REPROCESSED CHAR 7 -----> GROUP NUMBER FOR SERIAL INDEX IN
3986C REPROCESSED CHAR 3-5 (0 - 9, A - Z)
3987C REPROCESSED CHAR 8 -----> ALWAYS BLANK (' ') FOR NOW
3988
3989 READ(subset(8:8),'(I1)') inum
3990 IF(sid(1:1).GE.'A'.AND.sid(1:1).LE.'D') THEN
3991 CALL ufbint(lunit,ufbint_8,1,1,iret,'SWPR');swpr=ufbint_8
3992 IF(nint(swpr).GT.0.AND.nint(swpr).LT.10)
3993 $ WRITE(rsv(3:3),'(I1)') nint(swpr)
3994 sid(2:2) = rsv(3:3)
3995 CALL ufbint(lunit,ufbint_8,1,1,iret,'SWTP');swtp=ufbint_8
3996 IF(swtp.LT.bmiss) itp = nint(swtp)
3997 CALL ufbint(lunit,ufbint_8,1,1,iret,'SWDL');swdl=ufbint_8
3998 IF(nint(swdl).GT.-1.AND.nint(swdl).LT.10)
3999 $ WRITE(rsv(1:1),'(I1)') nint(swdl)
4000 ELSE
4001 sid = '????????'
4002 IF(nint(hdr(6)).LT.500) THEN
4003 sid(1:1) = csat(nint(hdr(6)))
4004 sid(2:2) = cprod(nint(hdr(6))/100)
4005 rsv(3:3) = sid(2:2)
4006 END IF
4007 IF(inum.LT.4) THEN
4008 sid(6:6) = cprdf(inum)
4009 itp = iprdf(inum)
4010 END IF
4011 END IF
4012 cindx3 = '???'
4013 cindx7 = '?'
4014 IF(nint(hdr(6)).LT.500.AND.itp.LT.19) THEN
4015 kount(nint(hdr(6)),itp) = min(kount(nint(hdr(6)),itp)+1,35999)
4016 kount3 = mod(kount(nint(hdr(6)),itp),1000)
4017 kount7 = int(kount(nint(hdr(6)),itp)/1000)
4018 WRITE(cindx3,'(I3.3)') kount3
4019 IF(kount7.LT.10) THEN
4020 WRITE(cindx7,'(I1.1)') kount7
4021 ELSE
4022 cindx7 = c7(kount7-9)
4023 END IF
4024 END IF
4025 sid = sid(1:2)//cindx3//sid(6:6)//cindx7//' '
4026
4027 elv = elev
4028 rtp = e33o29(subset,sid)
4029
4030C PUT THE LEVEL DATA INTO ON29 UNITS
4031C ----------------------------------
4032
4033 CALL ufbint(lunit,arr_8,10,255,nlev,lvstr);arr=arr_8
4034 DO l=1,nlev
4035 pob(l) = e01o29(arr(1,l))
4036
4037C GROSS CHECK ON PRESSURE
4038C -----------------------
4039
4040 IF(nint(pob(l)).EQ.0) THEN
4041 print'(" ~~IW3UNP29/R06O29: RPT with ID= ",A," TOSSED - ",
4042 $ "PRES. IS ZERO MB")', sid
4043 r06o29 = -9999
4044 ksksat = ksksat + 1
4045 RETURN
4046 END IF
4047
4048 qob(l) = e07o29(arr(2,l),arr(3,l))
4049 tob(l) = e06o29(arr(3,l))
4050 zob(l) = elev
4051 dob(l) = e04o29(arr(4,l),arr(5,l))
4052 sob(l) = e05o29(arr(4,l),arr(5,l))
4053 ENDDO
4054 wspd1 = arr(5,1)
4055
4056C DETERMINE QUALITY MARKERS
4057C -------------------------
4058
4059 CALL ufbint(lunit,arr_8,10,255,nlev,qmstr);arr=arr_8
4060 CALL ufbint(lunit,ufbint_8,1,1,iret,'RFFL');rffl=ufbint_8
4061 IF(rffl.LT.bmiss.AND.(nint(arr(5,1)).EQ.2.OR.nint(arr(5,1)).GE.
4062 $ bmiss)) THEN
4063 IF(nint(rffl).GT.84) THEN
4064 arr(5,1) = 1
4065 ELSE IF(nint(rffl).GT.55) THEN
4066 arr(5,1) = 2
4067 ELSE IF(nint(rffl).GT.49) THEN
4068 arr(5,1) = 3
4069 ELSE
4070 arr(5,1) = 13
4071 END IF
4072 END IF
4073
4074 DO l=1,nlev
4075 wqm(l) = e35o29(arr(5,l))
4076
4077 IF(wqm(l).EQ.'R'.OR.wqm(l).EQ.'P'.OR.wqm(l).EQ.'F') THEN
4078
4079C A REJECT, PURGE, OR FAIL FLAG ON WIND IS TRANSFERRED TO ALL VARIABLES
4080C ---------------------------------------------------------------------
4081
4082 pqm(l) = wqm(l)
4083 tqm(l) = wqm(l)
4084 qqm(l) = wqm(l)
4085 zqm(l) = wqm(l)
4086
4087 ELSE
4088
4089 pqm(l) = e35o29(arr(1,l))
4090 tqm(l) = e35o29(arr(2,l))
4091 qqm(l) = e35o29(arr(3,l))
4092 zqm(l) = e35o29(arr(4,l))
4093
4094 END IF
4095
4096 ENDDO
4097
4098C PUT THE UNPACKED ON29 REPORT INTO OBS
4099C -------------------------------------
4100
4101 rsv2 = ' '
4102 CALL s01o29(sid,xob,yob,rhr,rch,rsv,rsv2,elv,itp,rtp)
4103 CALL s02o29(6,1,*9999)
4104
4105C ---------------------------------------------------------------------
4106C MISC DATA GOES INTO CATEGORY 08
4107C ---------------------------------------------------------------------
4108C CODE FIGURE 013 - PRESSURE
4109C CODE FIGURE 920 - CHARACTERS 7 AND 8 OF ACTUAL STATION IDENTIFICATION
4110C (CURRENTLY ONLY APPLIES TO U.S. SATWND TYPES)
4111C CODE FIGURE 924 - WIND SPEED IN 0.01*M/S
4112C ---------------------------------------------------------------------
4113C ---------------------------------------------------------------------
4114
4115 IF(pob(1).LT.bmiss) THEN
4116 ob8(1) = nint(pob(1)*0.1)
4117 cf8(1) = 13
4118 q81(1) = ' '
4119 q82(1) = ' '
4120 CALL s02o29(8,1,*9999)
4121 END IF
4122 IF(sid(1:1).GE.'A'.AND.sid(1:1).LE.'D') THEN
4123 ob8(1) = 99999.
4124 q81(1) = sid(7:7)
4125 q82(1) = sid(8:8)
4126 cf8(1) = 920
4127 CALL s02o29(8,1,*9999)
4128 END IF
4129 IF(wspd1.LT.bmiss) THEN
4130 ob8(2) = nint(wspd1*10.)
4131 cf8(2) = 924
4132 q81(2) = ' '
4133 q82(2) = ' '
4134 CALL s02o29(8,2,*9999)
4135 END IF
4136
4137 CALL s03o29(obs,subset,*9999,*9998)
4138
4139 RETURN
4140
4141 9999 CONTINUE
4142 r06o29 = 999
4143 RETURN
4144
4145 9998 CONTINUE
4146 print'(" IW3UNP29/R06O29: RPT with ID= ",A," TOSSED - ZERO ",
4147 $ "CAT.1-6,51,52 LVLS")', sid
4148 r06o29 = -9999
4149 ksksat =ksksat + 1
4150 RETURN
4151
4152 END
4153C***********************************************************************
4154C***********************************************************************
4155C***********************************************************************
4156 FUNCTION r07o29(LUNIT,OBS)
4157C ---> formerly FUNCTION SPSSMI
4158
4159 common/io29ee/pob(255),qob(255),tob(255),zob(255),dob(255),
4160 $ sob(255),vsg(255),clp(255),cla(255),ob8(255),
4161 $ cf8(255)
4162 common/io29ff/pqm(255),qqm(255),tqm(255),zqm(255),wqm(255),
4163 $ qcp(255),qca(255),q81(255),q82(255)
4164 common/io29cc/subset,idat10
4165 common/io29bb/kndx,kskacf(8),kskupa,ksksfc,ksksat,ksksmi
4166 common/io29ll/bmiss
4167
4168 CHARACTER*80 hdstr
4169 CHARACTER*8 subset,sid,rsv,rsv2
4170 CHARACTER*4 cstdv
4171 CHARACTER*1 pqm,qqm,tqm,zqm,wqm,qcp,qca,q81,q82,crf
4172 REAL(8) rid_8,ufbint_8,hdr_8(20),tmbr_8(7),addp_8(5),prod_8(2,2)
4173 REAL(8) bmiss
4174 dimension obs(*),hdr(20),addp(5),prod(2,2),tmbr(7)
4175
4176 equivalence(rid_8,sid)
4177
4178 SAVE
4179
4180 DATA hdstr/'RPID CLON CLAT HOUR MINU SECO NMCT SAID '/
4181
4182C CHECK IF THIS IS A PREPBUFR FILE
4183C --------------------------------
4184
4185 r07o29 = 99
4186c#V#V#dak - future
4187cdak IF(SUBSET.EQ.'SPSSMI') R07O29 = PRPSMI(LUNIT,OBS)
4188caaaaadak - future
4189 IF(r07o29.NE.99) RETURN
4190 r07o29 = 0
4191
4192 CALL s05o29
4193
4194C PUT THE HEADER INFORMATION INTO ON29 FORMAT
4195C -------------------------------------------
4196
4197 CALL ufbint(lunit,hdr_8,20, 1,iret,hdstr);hdr(2:)=hdr_8(2:)
4198 IF(hdr(5).GE.bmiss) hdr(5) = 0
4199 IF(hdr(6).GE.bmiss) hdr(6) = 0
4200 rid_8 = hdr_8(1)
4201 xob = hdr(2)
4202 yob = hdr(3)
4203 rhr = bmiss
4204 IF(hdr(4).LT.bmiss) rhr = nint(hdr(4)) + ((nint(hdr(5)) * 60.) +
4205 $ nint(hdr(6)))/3600.
4206 rch = 99999.
4207 elv = 99999.
4208 itp = 99
4209 rtp = hdr(7)
4210
4211C CHECK ON VALUE FOR SATELLITE ID TO DETERMINE IF THIS IS A SUPEROB
4212C (SATELLITE ID IS MISSING FOR SUPEROBS)
4213C -----------------------------------------------------------------
4214
4215 isupob = 1
4216 IF(hdr(8).LT.bmiss) isupob = 0
4217
4218C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4219
4220 stdv = bmiss
4221
4222C PUT THE SSM/I DATA INTO ON29 UNITS (WILL RETURN TO HEADER DATA LATER)
4223C ALL PROCESSING GOES INTO CATEGORY 08
4224C ---------------------------------------------------------------------
4225
4226 IF(rtp.EQ.68) THEN
4227C ---------------------------------------------------------------------
4228C ** 7-CHANNEL BRIGHTNESS TEMPERATURES -- REPORT TYPE 68 **
4229C ---------------------------------------------------------------------
4230C CODE FIGURE 189 - 19 GHZ V BRIGHTNESS TEMPERATURE (DEG. K X 100)
4231C CODE FIGURE 190 - 19 GHZ H BRIGHTNESS TEMPERATURE (DEG. K X 100)
4232C CODE FIGURE 191 - 22 GHZ V BRIGHTNESS TEMPERATURE (DEG. K X 100)
4233C CODE FIGURE 192 - 37 GHZ V BRIGHTNESS TEMPERATURE (DEG. K X 100)
4234C CODE FIGURE 193 - 37 GHZ H BRIGHTNESS TEMPERATURE (DEG. K X 100)
4235C CODE FIGURE 194 - 85 GHZ V BRIGHTNESS TEMPERATURE (DEG. K X 100)
4236C CODE FIGURE 195 - 85 GHZ H BRIGHTNESS TEMPERATURE (DEG. K X 100)
4237C ---------------------------------------------------------------------
4238 nlcat8 = 7
4239 CALL ufbint(lunit,tmbr_8,1,7,nlev,'TMBR');tmbr=tmbr_8
4240 DO nchn = 1,7
4241 ob8(nchn) = min(nint(tmbr(nchn)*100.),99999)
4242 cf8(nchn) = 188 + nchn
4243 ENDDO
4244 ELSE IF(rtp.EQ.575) THEN
4245C ---------------------------------------------------------------------
4246C ** ADDITIONAL PRODUCTS -- REPORT TYPE 575 **
4247C ---------------------------------------------------------------------
4248C CODE FIGURE 210 - SURFACE TAG (RANGE: 0,1,3-6)
4249C CODE FIGURE 211 - ICE CONCENTRATION (PERCENT)
4250C CODE FIGURE 212 - ICE AGE (RANGE: 0,1)
4251C CODE FIGURE 213 - ICE EDGE (RANGE: 0,1)
4252C CODE FIGURE 214 - CALCULATED SURFACE TYPE (RANGE: 1-20)
4253C ---------------------------------------------------------------------
4254 nlcat8 = 5
4255 CALL ufbint(lunit,addp_8,5,1,iret,'SFTG ICON ICAG ICED SFTP')
4256 addp=addp_8
4257 DO nadd = 1,5
4258 IF(addp(nadd).LT.bmiss) THEN
4259 ob8(nadd) = nint(addp(nadd))
4260 cf8(nadd) = 209 + nadd
4261 END IF
4262 ENDDO
4263 ELSE IF(rtp.EQ.571) THEN
4264C ---------------------------------------------------------------------
4265C ** OCEAN SURFACE WIND SPEED PRODUCT -- REPORT TYPE 571 **
4266C ---------------------------------------------------------------------
4267C CODE FIGURE 196 - OCEANIC WIND SPEED (M/S * 10)
4268C (RAIN FLAG IN Q.M. BYTE 2)
4269C ---------------------------------------------------------------------
4270 cf8(1) = 196
4271 elv = 0
4272 nlcat8 = 1
4273 IF(isupob.EQ.1) THEN
4274 CALL ufbrep(lunit,prod_8,2,2,iret,'FOST WSOS');prod=prod_8
4275 DO jj = 1,2
4276 IF(prod(1,jj).EQ.4) THEN
4277 ob8(1) = nint(prod(2,jj)*10.)
4278 ELSE IF(prod(1,jj).EQ.10) THEN
4279 stdv = nint(prod(2,jj)*100.)
4280 END IF
4281 ENDDO
4282 ELSE
4283 CALL ufbint(lunit,ufbint_8,1,1,iret,'WSOS');prodn=ufbint_8
4284 ob8(1) = nint(prodn*10.)
4285 CALL ufbint(lunit,ufbint_8,1,1,iret,'RFLG');rflg=ufbint_8
4286 IF(rflg.LT.bmiss) THEN
4287 WRITE(crf,'(I1.1)') nint(rflg)
4288 q82(1) = crf
4289 END IF
4290 END IF
4291 ELSE IF(rtp.EQ.65) THEN
4292C ---------------------------------------------------------------------
4293C ** OCEAN TOTAL PRECIPITABLE WATER PRODUCT -- REPORT TYPE 65 **
4294C ---------------------------------------------------------------------
4295C CODE FIGURE 197 - TOTAL PRECIPITABLE WATER (MM * 10)
4296C (RAIN FLAG IN Q.M. BYTE 2)
4297C ---------------------------------------------------------------------
4298 cf8(1) = 197
4299 elv = 0
4300 nlcat8 = 1
4301 IF(isupob.EQ.1) THEN
4302 CALL ufbrep(lunit,prod_8,2,2,iret,'FOST PH2O');prod=prod_8
4303 DO jj = 1,2
4304 IF(prod(1,jj).EQ.4) THEN
4305 ob8(1) = nint(prod(2,jj)*10.)
4306 ELSE IF(prod(1,jj).EQ.10) THEN
4307 stdv = nint(prod(2,jj)*100.)
4308 END IF
4309 ENDDO
4310 ELSE
4311 CALL ufbint(lunit,ufbint_8,1,1,iret,'PH2O');prodn=ufbint_8
4312 ob8(1) = nint(prodn*10.)
4313 CALL ufbint(lunit,ufbint_8,1,1,iret,'RFLG');rflg=ufbint_8
4314 IF(rflg.LT.bmiss) THEN
4315 WRITE(crf,'(I1)') nint(rflg)
4316 q82(1) = crf
4317 END IF
4318 END IF
4319 ELSE IF(rtp.EQ.66) THEN
4320C ---------------------------------------------------------------------
4321C ** LAND/OCEAN RAINFALL RATE -- REPORT TYPE 66 **
4322C ---------------------------------------------------------------------
4323C CODE FIGURE 198 - RAINFALL RATE (MM/HR)
4324C ---------------------------------------------------------------------
4325 cf8(1) = 198
4326 nlcat8 = 1
4327 IF(isupob.EQ.1) THEN
4328 CALL ufbrep(lunit,prod_8,2,2,iret,'FOST REQV');prod=prod_8
4329 DO jj = 1,2
4330 IF(prod(1,jj).EQ.4) THEN
4331 ob8(1) = nint(prod(2,jj)*3600.)
4332 ELSE IF(prod(1,jj).EQ.10) THEN
4333 stdv = nint(prod(2,jj)*36000.)
4334 END IF
4335 ENDDO
4336 ELSE
4337 CALL ufbint(lunit,ufbint_8,1,1,iret,'REQV');prodn=ufbint_8
4338 ob8(1) = nint(prodn*3600.)
4339 END IF
4340 ELSE IF(rtp.EQ.576) THEN
4341C ---------------------------------------------------------------------
4342C ** SURFACE TEMPERATURE -- REPORT TYPE 576 **
4343C ---------------------------------------------------------------------
4344C CODE FIGURE 199 - SURFACE TEMPERATURE (DEGREES KELVIN)
4345C ---------------------------------------------------------------------
4346 cf8(1) = 199
4347 nlcat8 = 1
4348 IF(isupob.EQ.1) THEN
4349 CALL ufbrep(lunit,prod_8,2,2,iret,'FOST TMSK');prod=prod_8
4350 DO jj = 1,2
4351 IF(prod(1,jj).EQ.4) THEN
4352 ob8(1) = nint(prod(2,jj))
4353 ELSE IF(prod(1,jj).EQ.10) THEN
4354 stdv = nint(prod(2,jj)*10.)
4355 END IF
4356 ENDDO
4357 ELSE
4358 CALL ufbint(lunit,ufbint_8,1,1,iret,'TMSK');prodn=ufbint_8
4359 ob8(1) = nint(prodn)
4360 END IF
4361 ELSE IF(rtp.EQ.69) THEN
4362C ---------------------------------------------------------------------
4363C ** OCEAN CLOUD WATER -- REPORT TYPE 69 **
4364C ---------------------------------------------------------------------
4365C CODE FIGURE 200 - CLOUD WATER (MM * 100)
4366C ---------------------------------------------------------------------
4367 cf8(1) = 200
4368 elv = 0
4369 nlcat8 = 1
4370 IF(isupob.EQ.1) THEN
4371 CALL ufbrep(lunit,prod_8,2,2,iret,'FOST CH2O');prod=prod_8
4372 DO jj = 1,2
4373 IF(prod(1,jj).EQ.4) THEN
4374 ob8(1) = nint(prod(2,jj)*100.)
4375 ELSE IF(prod(1,jj).EQ.10) THEN
4376 stdv = nint(prod(2,jj)*1000.)
4377 END IF
4378 ENDDO
4379 ELSE
4380 CALL ufbint(lunit,ufbint_8,1,1,iret,'CH2O');prodn=ufbint_8
4381 ob8(1) = nint(prodn*100.)
4382 END IF
4383 ELSE IF(rtp.EQ.573) THEN
4384C ---------------------------------------------------------------------
4385C ** SOIL MOISTURE -- REPORT TYPE 573 **
4386C ---------------------------------------------------------------------
4387C CODE FIGURE 201 - SOIL MOISTURE (MM)
4388C ---------------------------------------------------------------------
4389 cf8(1) = 201
4390 nlcat8 = 1
4391 IF(isupob.EQ.1) THEN
4392 CALL ufbrep(lunit,prod_8,2,2,iret,'FOST SMOI');prod=prod_8
4393 DO jj = 1,2
4394 IF(prod(1,jj).EQ.4) THEN
4395 ob8(1) = nint(prod(2,jj)*1000.)
4396 ELSE IF(prod(1,jj).EQ.10) THEN
4397 stdv = nint(prod(2,jj)*10000.)
4398 END IF
4399 ENDDO
4400 ELSE
4401 CALL ufbint(lunit,ufbint_8,1,1,iret,'SMOI');prodn=ufbint_8
4402 ob8(1) = nint(prodn*1000.)
4403 END IF
4404 ELSE IF(rtp.EQ.574) THEN
4405C ---------------------------------------------------------------------
4406C ** SNOW DEPTH -- REPORT TYPE 574 **
4407C ---------------------------------------------------------------------
4408C CODE FIGURE 202 - SNOW DEPTH (MM)
4409C ---------------------------------------------------------------------
4410 cf8(1) = 202
4411 nlcat8 = 1
4412 IF(isupob.EQ.1) THEN
4413 CALL ufbrep(lunit,prod_8,2,2,iret,'FOST SNDP');prod=prod_8
4414 DO jj = 1,2
4415 IF(prod(1,jj).EQ.4) THEN
4416 ob8(1) = nint(prod(2,jj)*1000.)
4417 ELSE IF(prod(1,jj).EQ.10) THEN
4418 stdv = nint(prod(2,jj)*10000.)
4419 END IF
4420 ENDDO
4421 ELSE
4422 CALL ufbint(lunit,ufbint_8,1,1,iret,'SNDP');prodn=ufbint_8
4423 ob8(1) = nint(prodn*1000.)
4424 END IF
4425 END IF
4426
4427C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4428
4429C FINISH PUTTING THE HEADER INFORMATION INTO ON29 FORMAT
4430C ------------------------------------------------------
4431
4432 rsv = '999 '
4433 rsv2 = ' '
4434
4435 IF(stdv.LT.bmiss) THEN
4436 WRITE(cstdv,'(I4.4)') nint(stdv)
4437 ELSE
4438 cstdv = '9999'
4439 END IF
4440 rsv2(3:4) = cstdv(1:2)
4441 rsv(1:2) = cstdv(3:4)
4442
4443 CALL ufbint(lunit,ufbint_8,1,1,iret,'ACAV');acav=ufbint_8
4444 IF(acav.LT.bmiss) THEN
4445 WRITE(cstdv(1:2),'(I2.2)') nint(acav)
4446 ELSE
4447 cstdv = '9999'
4448 END IF
4449 rsv2(1:2) = cstdv(1:2)
4450
4451 CALL s01o29(sid,xob,yob,rhr,rch,rsv,rsv2,elv,itp,rtp)
4452
4453 DO ii = 1,nlcat8
4454 IF(cf8(ii).LT.bmiss) CALL s02o29(8,ii,*9999)
4455 ENDDO
4456
4457C PUT THE UNPACKED ON29 REPORT INTO OBS
4458C -------------------------------------
4459
4460 CALL s03o29(obs,subset,*9999,*9998)
4461
4462 RETURN
4463 9999 CONTINUE
4464 r07o29 = 999
4465 RETURN
4466 9998 CONTINUE
4467 print'(" IW3UNP29/R07O29: RPT with ID= ",A," TOSSED - ZERO ",
4468 $ "CAT.1-6,8,51,52 LVLS")', sid
4469 r07o29 = -9999
4470 ksksmi = ksksmi + 1
4471 RETURN
4472 END
4473
4474C> This subrountine modifies amdar reports so that last character ends
4475C> with 'Z'.
4476C> @param[in] IDEN Acft id
4477C> @param[out] ID Modified aircraft id.
4478C>
4479C> @author RAY CRAYTON @date 1992-02-16
4480
4481 SUBROUTINE s06o29(IDEN,ID)
4482C ---> formerly SUBROUTINE IDP
4483
4484 CHARACTER*8 IDEN,ID
4485 CHARACTER*6 ZEROES
4486 CHARACTER*1 JCHAR
4487
4488 SAVE
4489
4490 DATA zeroes/'000000'/
4491
4492 id = ' '
4493
4494 l = index(iden(1:8),' ')
4495 IF(l.EQ.0) THEN
4496 n = 8
4497 ELSE
4498 n = l - 1
4499 IF(n.LT.1) THEN
4500 id = 'AMDARZ'
4501 END IF
4502 END IF
4503
4504 IF(n.EQ.8) THEN
4505 IF(iden(8:8).EQ.'Z') THEN
4506
4507C THE ID INDICATES IT IS AN 8-CHARACTER ASDAR REPORT. COMPRESS IT BY
4508C DELETING THE 6TH AND 7TH CHARACTER
4509C ------------------------------------------------------------------
4510
4511 id = iden(1:5)//'Z'
4512 GO TO 500
4513 END IF
4514 END IF
4515
4516 l = i05o29(iden(1:1),7,jchar)
4517
4518 IF(l.EQ.0.OR.l.GT.6.OR.n.GT.6) THEN
4519
4520C UP THROUGH 6 CHARACTERS ARE LETTERS. CHANGE 6TH CHARACTER TO 'Z'
4521C ---------------------------------------------------------------
4522
4523 IF(n.GE.5) THEN
4524 id = iden
4525 id(6:6) = 'Z'
4526 ELSE
4527
4528C ZERO FILL AND ADD 'Z' TO MAKE 6 CHARAACTERS
4529C -------------------------------------------
4530
4531 id = iden(1:n)//zeroes(n+1:5)//'Z'
4532 END IF
4533
4534 ELSE IF(n.EQ.6) THEN
4535
4536C THE IDEN HAS 6 NUMERIC OR ALPHANUMERIC CHARACTERS
4537C -------------------------------------------------
4538
4539 IF(iden(6:6).EQ.'Z') THEN
4540 id = iden(1:6)
4541 ELSE IF(l.GT.3) THEN
4542 id = iden(1:3)//iden(5:6)//'Z'
4543 ELSE IF(l.EQ.1) THEN
4544 id = iden(2:6)//'Z'
4545 ELSE
4546 id = iden(1:l-1)//iden(l+1:6)//'Z'
4547 END IF
4548
4549 ELSE IF(n.EQ.5) THEN
4550
4551C THE IDEN HAS 5 NUMERIC OR ALPHANUMERIC CHARACTERS
4552C -------------------------------------------------
4553
4554 id = iden(1:5)//'Z'
4555 ELSE
4556
4557C THE IDEN HAS 1-4 NUMERIC OR ALPHANUMERIC CHARACTERS
4558C ---------------------------------------------------
4559
4560 IF(l.EQ.1) THEN
4561 id = zeroes(1:5-n)//iden(1:n)//'Z'
4562 ELSE
4563 IF(n.LT.l) THEN
4564 iden(1:6) = 'AMDARZ'
4565 ELSE
4566 id = iden(1:l-1)// zeroes(1:5-n)//iden(l:n)//'Z'
4567 END IF
4568 END IF
4569 END IF
4570
4571 500 CONTINUE
4572 RETURN
4573 END
4574
4575C> This function finds the location of the next numeric character
4576C> in a string of characters.
4577C>
4578C> @param[in] STRING Character array.
4579C> @param[in] NUM Number of characters to search in string.
4580C> @param[out] CHAR Character found.
4581C> @return I05O29 Integer*4 location of alphanumeric character, = 0 if not found.
4582C> @author Ray Crayton @date 1989-07-07
4583C>
4584 FUNCTION i05o29(STRING,NUM,CHAR)
4585C ---> formerly FUNCTION IFIG
4586 CHARACTER*1 string(1),char
4587
4588 SAVE
4589
4590 DO i = 1,num
4591 IF(string(i).GE.'0'.AND.string(i).LE.'9') THEN
4592 i05o29 = i
4593 char = string(i)
4594 GO TO 200
4595 END IF
4596 ENDDO
4597 i05o29 = 0
4598 char = '?'
4599 200 CONTINUE
4600 RETURN
4601 END
subroutine aea(ia, ie, nc)
Program history log:
Definition aea.f:41
function i03o29(nunit, obs, ier)
This function reads a true (see *) on29/124 data set and unpacks one report into the unpacked office ...
Definition iw3unp29.f:696
function i05o29(string, num, char)
This function finds the location of the next numeric character in a string of characters.
Definition iw3unp29.f:4585
function i01o29(lunit, hdr, ier)
This function read obs files and returns error message.
Definition iw3unp29.f:477
function iw3unp29(lunit, obs, ier)
This routine has not been tested reading input data from any dump type in ON29/124 format on WCOSS.
Definition iw3unp29.f:271
function i02o29(lunit, obs, ier)
This function read obs files and returns error message.
Definition iw3unp29.f:546
character *6 function c01o29(subset)
This function read subset and returns group name.
Definition iw3unp29.f:930
subroutine s06o29(iden, id)
This subrountine modifies amdar reports so that last character ends with 'Z'.
Definition iw3unp29.f:4482
function r01o29(subset, lunit, obs)
This function read subset and returns corresponding file data.
Definition iw3unp29.f:982
subroutine orders(in, isort, idata, index, n, m, i1, i2)
Orders is a fast and stable sort routine suitable for efficient, multiple-pass sorting on variable le...
Definition orders.f:86
subroutine w3fa03(press, height, temp, theta)
Computes the standard height, temperature, and potential temperature given the pressure in millibars ...
Definition w3fa03.f:28
subroutine w3fi64(cocbuf, locrpt, next)
Unpacks an array of upper-air reports that are packed in the format described by NMC office note 29,...
Definition w3fi64.f:393