NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3miscan.f
Go to the documentation of this file.
1C> @file
2C> @brief Reads 1 ssm/i scan line from bufr d-set
3C> @author Dennis Keyser @date 1996-07-30
4
5C> Reads one ssm/i scan line (64 retrievals) from the NCEP
6C> bufr ssm/i dump file. Each scan is time checked against the
7C> user-requested time window and satellite id combinations. When a
8C> valid scan is read the program returns to the calling program.
9C> the user must pass in the type of the input ssm/i dump file,
10C> either derived products (regardless of source) or brightness
11C> temperatures (7-channels). If the latter is chosen, the user
12C> has the further option of processing, in addition to the
13C> brightness temperatures, in-line calculation of wind speed
14C> product via the goodberlet algorithm, and/or in-line calculation
15C> of both wind speed and total column precipitable water (tpw)
16C> products using the neural net 3 algorithm. If the wind speed
17C> or tpw is calculated here (either algorithm), this subroutine
18C> will check for brightness temperatures outside of a preset range
19C> and will return a missing wind speed/tpw if any b. temp is
20C> unreasonable. Also, for calculated wind speeds and tpw, this
21C> program will check to see if the b. temps are over land or ice,
22C> and if they are it will also return missing values since these
23C> data are valid only over ocean.
24C>
25C> ### Program History Log:
26C> Date | Programmer | Comment
27C> -----|------------|--------
28C> 1996-07-30 | Dennis Keyser | Original author - subroutine is a modified version of w3lib w3fi86 which read one scan line from the 30-orbit shared processing data sets
29C> 1997-05-22 | Dennis Keyser | Crisis fix to account for clon now returned from bufr as -180 to 0 (west) or 0 to 180 (east), used to return as 0 to 360 east which was not the bufr standard
30C> 1998-01-28 | Dennis Keyser | Replaced neural net 2 algorithm which calculated only wind speed product with neural net 3 algorithm which calculates both wind speed and total precipitable water products (among others) but, unlike nn2, does not return a rain flag value (it does set all retrievals to missing that fail rain flag and ice contamination tests)
31C> 1998-03-30 | Dennis Keyser | Modified to handle neural net 3 ssm/i products input in a products bufr data dump file; now prints out number of scans processed by satellite number in final summary
32C> 1998-10-23 | Dennis Keyser | Subroutine now y2k and fortran 90 compliant
33C> 1999-02-18 | Dennis Keyser | Modified to compile and run properly on ibm-sp
34C> 2000-06-08 | Dennis Keyser | Corrected mnemonic for rain rate to "reqv" (was "prer" for some unknown reason)
35C> 2001-01-03 | Dennis Keyser | Changed units of returned rain rate from whole mm/hr to 10**6 mm/sec, changed units of returned surface temp from whole kelvin to 10**2 kelvin (to incr. precision to that orig. in input bufr file)
36C> 2004-09-12 | Dennis Keyser | Now decodes sea-surface temperature if valid into same location as surface temperature, quantity is surface temperature if surface tag is not 5, otherwise quantity is sea-surface temperature (ncep products data dump file now contains sst); checks to see if old or new version of mnemonic table bufrtab.012 is being used here (old version had "ph2o" instead of "tpwt", "sndp" instead of "tosd", "wsos" instead of "wspd" and "ch2o" instead of the sequence "metfet vilwc metfet"), and decodes using whichever mnemonics are found {note: a further requirement for "vilwc" is that the first "metfet" (meteorological feature) in the sequence must be 12 (=cloud), else cloud water set to missing, regardless of "vilwc" value}
37C> 2011-08-04 | Dennis Keyser | Add ibdate (input bufr message date) to output argument list (now used by calling program prepobs_prepssmi)
38C>
39C> @param[in] INDTA Unit number of ncep bufr ssm/i dump data set
40C> @param[in] INLSF Unit number of direct access nesdis land/sea file
41C> (valid only if lbrit and either nnalg or gbalg true).
42C> @param[in] INGBI Unit number of grib index file for grib file
43C> Containing global 1-degree sea-surface temp field.
44C> (valid only if lbrit and either nnalg or gbalg true).
45C> @param[in] INGBD Unit number of grib file containing global 1-degree
46C> Sea-surface temp field (valid only if lbrit and either.
47C> Nnalg or gbalg true).
48C> @param[in] LSAT 10-word logical array (240:249) indicating which
49C> Satellite ids should be processed (see remarks)
50C> @param[in] LPROD Logical indicating if the input bufr file contains
51C> Products (regardless of source) - in this case one or.
52C> More available products can be processed and returned.
53C> @param[in] LBRIT Logical indicating if the input bufr file contains
54C> Brightness temperatures - in this case b. temps are.
55C> Processed and returned along with, if requested, in-.
56C> Line generated products from one or both algorithms.
57C> (see next two switches).
58C> - The following two switches apply only if lbrit is true -----
59C> @param[in] NNALG Indicating if the subroutine should
60C> calculate and return ssm/i wind speed and tpw
61C> via the neural net 3 algorithm (note: b o t h
62C> wind speed and tpw are returned here)
63C> @param[in] GBALG Indicating if the subroutine should
64C> calculate and return ssm/i wind speed via the
65C> goodberlet algorithm
66C> @param[in] KDATE Requested earliest year(yyyy), month, day, hour,
67C> Min for accepting scans.
68C> @param[in] LDATE Requested latest year(yyyy), month, day, hour,
69C> Min for accepting scans.
70C> @param[in] IGNRTM Switch to indicate whether scans should be time-
71C> Checked (= 0) or not time checked (=1) {if =1, all.
72C> Scans read in are processed regardless of their time..
73C> The input arguments "kdate" and "ldate" (earliest and.
74C> Latest date for processing data) are ignored in the.
75C> Time checking for scans. (note: the earliest and.
76C> Latest dates should still be specified to the.
77C> "expected" time range, but they will not be used for.
78C> Time checking in this case)}.
79C> @param[out] IBUFTN Output buffer holding data for a scan (1737 words -
80C> See remarks for format. some words may be missing
81C> Depending upon lprod, lbrit, nnalg and gbalg
82C> @param[out] IBDATE Input bufr message section 1 date (yyyymmddhh)
83C> @param[out] IER Error return code (see remarks)
84C>
85C> @remark
86C> Return code ier can have the following values:
87C> - IER = 0 Successful return of scan
88C> - IER = 1 All scans have been read, all done
89C> - IER = 2 Abnormal return - input bufr file in unit
90C> 'indta' is either empty (null) or is not bufr
91C> - IER = 3 Abnormal return - requested earliest and
92C> latest dates are backwards
93C> - IER = 4 Abnormal return - error opening random
94C> access file holding land/sea tags
95C> - IER = 5 Abnormal return - the number of decoded
96C> "levels" is not what is expected
97C> - IER = 6 Abnormal return - sea-surface temperature
98C> not found in grib index file - error returned
99C> from grib decoder getgb is 96
100C> - IER = 7 Abnormal return - sea-surface temperature
101C> grib message has a date that is either:
102C> 1) more than 7-days prior to the earliest
103C> requested date or 2) more than 7-days after
104C> the latest requested date
105C> - IER = 8 Abnormal return - byte-addressable read error
106C> for grib file containing sea-surface
107C> temperature field - error returned from grib
108C> decoder getgb is 97-99
109C> - IER = 9 Abnormal return - error returned from grib
110C> decoder - getgb - for sea-surface
111C> temperature field - > 0 but not 96-99
112C>
113C> Input argument lsat is set-up as follows:
114C> - LSAT(X) = TRUE -- Process scans from satellite id x (where x is code figure from bufr code table 0-01-007)
115C> - LSAT(X) = FALSE - Do not process scans from satellite id x
116C> - X = 240 is f-7 dmsp satellite (this satellite is no longer available)
117C> - X = 241 is f-8 dmsp satellite (this satellite is no longer available)
118C> - X = 242 is f-9 dmsp satellite (this satellite is no longer available)
119C> - X = 243 is f-10 dmsp satellite (this satellite is no longer available)
120C> - X = 244 is f-11 dmsp satellite (this is available as of 8/96 but is not considered to be an operational dmsp ssm/i satellite)
121C> - X = 245 is f-12 dmsp satellite (this satellite is no longer available)
122C> - X = 246 is f-13 dmsp satellite (this is available and is considered to be an operational odd dmsp ssm/i satellite as of 8/1996)
123C> - X = 247 is f-14 dmsp satellite (this is available as of 5/97 but is not considered to be an operational dmsp ssm/i satellite)
124C> - X = 248 is f-15 dmsp satellite (this is available as of 2/2000 and is considered to be an operational odd dmsp ssm/i satellite as of 2/2000)
125C> - X = 249 is reserved for a future dmsp satellite
126C>
127C> @note Here "even" means value in ibuftn(1) is an odd number while "odd" means value in ibuftn(1) is an even number
128C> Contents of array 'ibuftn' holding one complete scan (64 individual retrievlas (1737 words)
129C>
130C> #### Always returned:
131C> WORD | CONTENTS
132C> ---- | --------
133C> 1 | Satellite id (244 is f-11; 246 is f-13; 247 is f-14; 248 is f-15)
134C> 2 | 4-digit year for scan
135C> 3 | 2-digit month of year for scan
136C> 4 | 2-digit day of month for scan
137C> 5 | 2-digit hour of day for scan
138C> 6 | 2-digit minute of hour for scan
139C> 7 | 2-digit second of minute for scan
140C> 8 | Scan number in orbit
141C> 9 | Orbit number for scan
142C> 10 | Retrieval #1 latitude (*100 degrees: + n, - s)
143C> 11 | Retrieval #1 longitude (*100 degrees east)
144C> 12 | Retrieval #1 position number
145C> 13 | Retrieval #1 surface tag (code figure)
146C>
147C> #### For LPROD = TRUE {Input products file: note all products below except sea-surface temperature are available in the fnoc "operational" products data dump; most ncep products data dumps contain only wind speed, total precipitable water, cloud water and sea-surface temperature (all over ocean only)}:
148C> WORD | CONTENTS
149C> ---- | --------
150C> 14 | Retrieval #1 cloud water (*100 kilogram/meter**2)
151C> 15 | Retrieval #1 rain rate (*1000000 millimeters/second)
152C> 16 | Retrieval #1 wind speed (*10 meters/second)
153C> 17 | Retrieval #1 soil moisture (millimeters)
154C> 18 | Retrieval #1 sea-ice concentration (per cent)
155C> 19 | Retrieval #1 sea-ice age (code figure)
156C> 20 | Retrieval #1 ice edge (code figure)
157C> 21 | Retrieval #1 total precip. water (*10 millimeters)
158C> 22 | Retrieval #1 surface temp (*100 k) if not over ocean -OR-
159C> 22 | Retrieval #1 sea-surface temp (*100 k) if over ocean
160C> 23 | Retrieval #1 snow depth (millimeters)
161C> 24 | Retrieval #1 rain flag (code figure)
162C> 25 | Retrieval #1 calculated surface type (code figure)
163C>
164C> #### For LBRIT = TRUE (Input brightness temperature file):
165C> WORD | CONTENTS
166C> ---- | --------
167C> 26 | Retrieval #1 19 ghz v brightness temp (*100 deg. k)
168C> 27 | Retrieval #1 19 ghz h brightness temp (*100 deg. k)
169C> 28 | Retrieval #1 22 ghz v brightness temp (*100 deg. k)
170C> 29 | Retrieval #1 37 ghz v brightness temp (*100 deg. k)
171C> 30 | Retrieval #1 37 ghz h brightness temp (*100 deg. k)
172C> 31 | Retrieval #1 85 ghz v brightness temp (*100 deg. k)
173C> 32 | Retrieval #1 85 ghz h brightness temp (*100 deg. k)
174C>
175C> #### For LBRIT = TRUE and NNALG = TRUE (Input brightness temperature file):
176C> WORD | CONTENTS
177C> ---- | --------
178C> 33 | Retrieval #1 Neural net 3 algorithm wind speed (generated in-line) (*10 meters/second)
179C> 34 | Retrieval #1 Neural net 3 algorithm total precip. water (generated in-line) (*10 millimeters)
180C>
181C> #### For LBRIT = TRUE and GBALG = TRUE (Input brightness temperature file):
182C> WORD | CONTENTS
183C> ---- | --------
184C> 35 | Retrieval #1 goodberlet algorithm wind speed (generated in-line) (*10 meters/second)
185C> 36 | Retrieval #1 goodberlet algorithm rain flag (code figure)
186C> 37-1737 | Repeat 10-36 for 63 more retrievals
187C>
188C> @note All missing data or data not selected by calling program are set to 99999
189C>
190C> @author Dennis Keyser @date 1996-07-30
191
192 SUBROUTINE w3miscan(INDTA,INLSF,INGBI,INGBD,LSAT,LPROD,LBRIT,
193 $ NNALG,GBALG,KDATE,LDATE,IGNRTM,IBUFTN,IBDATE,IER)
194
195 LOGICAL LPROD,LBRIT,NNALG,GBALG,LSAT(240:249)
196
197 CHARACTER*1 CDUMMY
198 CHARACTER*2 ATXT(2)
199 CHARACTER*8 SUBSET
200 CHARACTER*20 RHDER,PROD2,BRITE
201 CHARACTER*46 SHDER,PROD1
202
203 REAL SHDR(9),RHDR(4,64),PROD(13,64),BRIT(2,448),RINC(5),
204 $ metfet(64)
205
206 REAL(8) SHDR_8(9),RHDR_8(4,64),PROD_8(13,64),BRIT_8(2,448),
207 $ ufbint_8(64)
208
209 INTEGER IBUFTN(1737),KDATA(7),KDATE(5),LDATE(5),LBTER(7),
210 $ kspsat(239:249),kntsat(239:249),iflag(64),kdat(8),ldat(8),
211 $ mdat(8),icdate(5),iddate(5)
212
213 common/misccc/sstdat(360,180)
214 common/miscee/lflag,licec
215
216 SAVE
217
218 DATA shder /'SAID YEAR MNTH DAYS HOUR MINU SECO SCNN ORBN '/
219 DATA rhder /'CLAT CLON POSN SFTG '/
220 DATA prod1 /'VILWC REQV WSPD SMOI ICON ICAG ICED TPWT TMSK '/
221 DATA prod2 /'TOSD RFLG SFTP SST1 '/
222 DATA brite /'CHNM TMBR '/
223 DATA atxt /'NN','GB'/
224 DATA imsg /99999/,kntscn/0/,knttim/0/,laerr/0/,
225 $ loerr/0/,lbter/7*0/,itimes/0/,nlr/0/,nir/0/,dmax/-99999./,
226 $ dmin/99999./,kspsat/11*0/,kntsat/11*0/,ilflg/0/,bmiss/10.0e10/
227
228 IF(itimes.EQ.0) THEN
229
230C***********************************************************************
231C FIRST CALL INTO SUBROUTINE DO A FEW THINGS .....
232 itimes = 1
233 lflag = 0
234 licec = 0
235 print 65, indta
236 65 FORMAT(//' ---> W3MISCAN: Y2K/F90 VERSION 08/04/2011: ',
237 $ 'PROCESSING SSM/I DATA FROM BUFR DATA SET READ FROM UNIT ',
238 $ i4/)
239 IF(lprod) print 66
240 66 FORMAT(//' ===> WILL READ FROM BUFR PRODUCTS DATA DUMP ',
241 $ 'FILE (EITHER FNOC OR NCEP) AND PROCESS ONE OR MORE SSM/I ',
242 $ 'PRODUCTS'//)
243 IF(lbrit) THEN
244 print 167
245 167 FORMAT(//' ===> WILL READ FROM BUFR BRIGHTNESS ',
246 $ 'TEMPERATURE DATA DUMP FILE AND PROCESS BRIGHTNESS ',
247 $ 'TEMPERATURES'//)
248 IF(nnalg) print 169
249 169 FORMAT(' ===> IN ADDITION, WILL PERFORM IN-LINE ',
250 $ 'CALCULATION OF NEURAL NETWORK 3 WIND SPEED AND TOTAL ',
251 $ 'PRECIPITABLE WATER AND PROCESS THESE'/)
252 IF(gbalg) print 170
253 170 FORMAT(' ===> IN ADDITION, WILL PERFORM IN-LINE ',
254 $ 'CALCULATION OF GOODBERLET WIND SPEED AND PROCESS THESE'/)
255 END IF
256 IF(ignrtm.EQ.1) print 704
257 704 FORMAT(' W3MISCAN: INPUT ARGUMENT "IGNRTM" IS SET TO 1 -- NO ',
258 $ 'TIME CHECKS WILL BE PERFORMED ON SCANS - ALL SCANS READ IN ',
259 $ 'ARE PROCESSED'/)
260
261 print 104, kdate,ldate
262 104 FORMAT(' W3MISCAN: REQUESTED EARLIEST DATE:',i7,4i5/
263 $ ' REQUESTED LATEST DATE:',i7,4i5)
264
265 kdat = 0
266 kdat(1:3) = kdate(1:3)
267 kdat(5:6) = kdate(4:5)
268 ldat = 0
269 ldat(1:3) = ldate(1:3)
270 ldat(5:6) = ldate(4:5)
271
272C DO REQUESTED EARLIEST AND LATEST DATES MAKE SENSE?
273
274 CALL w3difdat(ldat,kdat,3,rinc)
275 IF(rinc(3).LT.0) THEN
276C.......................................................................
277 print 103
278 103 FORMAT(' ##W3MISCAN: REQUESTED EARLIEST AND LATEST DATES ',
279 $ 'ARE BACKWARDS!! - IER = 3'/)
280 ier = 3
281 RETURN
282C.......................................................................
283 END IF
284
285C DETERMINE MACHINE WORD LENGTH IN BYTES AND TYPE OF CHARACTER SET
286C {ASCII(ICHTP=0) OR EBCDIC(ICHTP=1)}
287
288 CALL w3fi04(iendn,ichtp,lw)
289 print 2213, lw, ichtp, iendn
290 2213 FORMAT(/' ---> W3MISCAN: CALL TO W3FI04 RETURNS: LW = ',i3,
291 $ ', ICHTP = ',i3,', IENDN = ',i3/)
292
293 CALL datelen(10)
294
295 CALL dumpbf(indta,icdate,iddate)
296cppppp
297 print *,'CENTER DATE (ICDATE) = ',icdate
298 print *,'DUMP DATE (IDDATE) = ',iddate
299cppppp
300
301C COME HERE IF CENTER DATE COULD NOT BE READ FROM FIRST DUMMY MESSAGE
302C - RETURN WITH IRET = 2
303
304 IF(icdate(1).LE.0) GO TO 998
305
306C COME HERE IF DUMP DATE COULD NOT BE READ FROM SECOND DUMMY MESSAGE
307C - RETURN WITH IRET = 2
308
309 IF(iddate(1).LE.0) GO TO 998
310 IF(icdate(1).LT.100) THEN
311
312C IF 2-DIGIT YEAR RETURNED IN ICDATE(1), MUST USE "WINDOWING" TECHNIQUE
313C TO CREATE A 4-DIGIT YEAR
314
315C IMPORTANT: IF DATELEN(10) IS CALLED, THE DATE HERE SHOULD ALWAYS
316C CONTAIN A 4-DIGIT YEAR, EVEN IF INPUT FILE IS NOT
317C Y2K COMPLIANT (BUFRLIB DOES THE WINDOWING HERE)
318
319 print *, '##W3MISCAN - THE FOLLOWING SHOULD NEVER ',
320 $ 'HAPPEN!!!!!'
321 print *, '##W3MISCAN - 2-DIGIT YEAR IN ICDATE(1) RETURNED ',
322 $ 'FROM DUMPBF (ICDATE IS: ',icdate,') - USE WINDOWING ',
323 $ 'TECHNIQUE TO OBTAIN 4-DIGIT YEAR'
324 IF(icdate(1).GT.20) THEN
325 icdate(1) = 1900 + icdate(1)
326 ELSE
327 icdate(1) = 2000 + icdate(1)
328 ENDIF
329 print *, '##W3MISCAN - CORRECTED ICDATE(1) WITH 4-DIGIT ',
330 $ 'YEAR, ICDATE NOW IS: ',icdate
331 ENDIF
332
333 IF(iddate(1).LT.100) THEN
334
335C IF 2-DIGIT YEAR RETURNED IN IDDATE(1), MUST USE "WINDOWING" TECHNIQUE
336C TO CREATE A 4-DIGIT YEAR
337
338C IMPORTANT: IF DATELEN(10) IS CALLED, THE DATE HERE SHOULD ALWAYS
339C CONTAIN A 4-DIGIT YEAR, EVEN IF INPUT FILE IS NOT
340C Y2K COMPLIANT (BUFRLIB DOES THE WINDOWING HERE)
341
342 print *, '##W3MISCAN - THE FOLLOWING SHOULD NEVER ',
343 $ 'HAPPEN!!!!!'
344 print *, '##W3MISCAN - 2-DIGIT YEAR IN IDDATE(1) RETURNED ',
345 $ 'FROM DUMPBF (IDDATE IS: ',iddate,') - USE WINDOWING ',
346 $ 'TECHNIQUE TO OBTAIN 4-DIGIT YEAR'
347 IF(iddate(1).GT.20) THEN
348 iddate(1) = 1900 + iddate(1)
349 ELSE
350 iddate(1) = 2000 + iddate(1)
351 ENDIF
352 print *, '##W3MISCAN - CORRECTED IDDATE(1) WITH 4-DIGIT ',
353 $ 'YEAR, IDDATE NOW IS: ',iddate
354 END IF
355
356C OPEN BUFR FILE - READ IN DICTIONARY MESSAGES (TABLE A, B, D ENTRIES)
357
358 CALL openbf(indta,'IN',indta)
359
360 print *, ' '
361 print *, 'OPEN NCEP BUFR SSM/I DUMP FILE'
362 print *, ' '
363
364C Check to see if the old (pre 9/2004) version of the mnemonic
365C table is being used here (had "PH2O" instead of "TPWT",
366C "SNDP" instead of "TOSD", "WSOS" instead of "WSPD")
367C ------------------------------------------------------------
368
369 CALL status(indta,lun,idummy1,idummy2)
370 CALL nemtab(lun,'PH2O',idummy1,cdummy,iret_ph2o)
371 CALL nemtab(lun,'SNDP',idummy1,cdummy,iret_sndp)
372 CALL nemtab(lun,'WSOS',idummy1,cdummy,iret_wsos)
373 CALL nemtab(lun,'CH2O',idummy1,cdummy,iret_ch2o)
374
375 IF(lbrit.AND.(nnalg.OR.gbalg)) THEN
376
377C-----------------------------------------------------------------------
378C IF IN-LINE CALC. OF WIND SPEED FROM GOODBERLET ALG. OR
379C IN-LINE CALCULATION OF WIND SPEED AND TPW FROM NEURAL NET 3 ALG.
380C FIRST CALL TO THIS SUBROUTINE WILL READ IN SEA-SURFACE TEMPERATURE
381C FIELD AS A CHECK FOR ICE LIMITS
382C WILL ALSO OPEN DIRECT ACCESS NESDIS LAND SEA FILE
383C-----------------------------------------------------------------------
384
385 CALL misc06(ingbi,ingbd,kdate,ldate,*993,*994,*995,*996)
386 print 67, inlsf
387 67 FORMAT(//4x,'** W3MISCAN: OPEN R. ACCESS NESDIS LAND/SEA ',
388 $ 'FILE IN UNIT ',i2/)
389 OPEN(unit=inlsf,err=997,access='DIRECT',iostat=ierr,recl=10980)
390 END IF
391
392C READ THE FIRST BUFR MESSAGE IN THE BUFR FILE
393
394 CALL readmg(indta,subset,ibdate,iret)
395
396 print *, 'READ FIRST BUFR MESSAGE: SUBSET = ',subset,
397 $ '; IBDATE = ',ibdate,'; IRET = ',iret
398
399 IF(iret.NE.0) GO TO 998
400
401C***********************************************************************
402
403 END IF
404
405 30 CONTINUE
406
407C TIME TO DECODE NEXT SUBSET (SCAN) OUT OF BUFR MESSAGE
408
409 ibuftn = imsg
410 CALL readsb(indta,iret)
411 IF(iret.NE.0) THEN
412
413C ALL SUBSETS OUT OF THIS MESSAGE READ, TIME TO MOVE ON TO NEXT MESSAGE
414
415 CALL readmg(indta,subset,ibdate,iret)
416
417 print *, 'READ NEXT BUFR MESSAGE: SUBSET = ',subset,
418 $ '; IBDATE = ',ibdate,'; IRET = ',iret
419
420 IF(iret.NE.0) THEN
421c.......................................................................
422
423C NON-ZERO IRET IN READMG MEANS ALL BUFR MESSAGES IN FILE HAVE BEEN READ
424C - ALL FINISHED, NO OTHER SCANS W/I DESIRED TIME RANGE -- SET IER TO 1
425C AND RETURN TO CALLING PROGRAM
426
427 print 124, kntscn
428 124 FORMAT(/' W3MISCAN: +++++ ALL VALID SCANS UNPACKED AND ',
429 $ 'RETURNED FROM THIS NCEP BUFR SSM/I DUMP FILE'//34x,
430 $ '** W3MISCAN: SUMMARY **'//35x,'TOTAL NUMBER OF SCANS ',
431 $ 'PROCESSED AND RETURNED',11x,i7)
432 DO jj = 239,249
433 IF(kntsat(jj).GT.0) THEN
434 print 294, jj,kntsat(jj)
435 294 FORMAT(35x,'......NO. OF SCANS PROCESSED AND ',
436 $ 'RETURNED FROM SAT',i4,':',i7)
437 END IF
438 END DO
439 DO jj = 239,249
440 IF(kspsat(jj).GT.0) THEN
441 ii = jj
442 IF(jj.EQ.239) ii = 1
443 print 224, ii,kspsat(jj)
444 224 FORMAT(35x,'NO. OF SCANS SKIPPED DUE TO BEING FROM ',
445 $ 'NON-REQ SAT',i4,':',i7)
446 END IF
447 END DO
448 print 194, knttim
449 194 FORMAT(35x,'NUMBER OF SCANS SKIPPED DUE TO BEING OUTSIDE ',
450 $ 'TIME INT.:',i7)
451 print 324, laerr,loerr
452 324 FORMAT(
453 $/35x,'NUMBER OF RETRIEVALS WITH LATITUDE OUT OF RANGE: ',i7/
454 $ 35x,'NUMBER OF RETRIEVALS WITH LONGITUDE OUT OF RANGE: ',i7)
455 IF(lbrit) THEN
456 IF(nnalg.OR.gbalg) print 780, lbter,nlr,nir
457 780 FORMAT(
458 $ 35x,'NUMBER OF RETRIEVALS W/ ERROR IN 19 GHZ V BRIGHT. TEMP:',i7/
459 $ 35x,'NUMBER OF RETRIEVALS W/ ERROR IN 19 GHZ H BRIGHT. TEMP:',i7/
460 $ 35x,'NUMBER OF RETRIEVALS W/ ERROR IN 22 GHZ V BRIGHT. TEMP:',i7/
461 $ 35x,'NUMBER OF RETRIEVALS W/ ERROR IN 37 GHZ V BRIGHT. TEMP:',i7/
462 $ 35x,'NUMBER OF RETRIEVALS W/ ERROR IN 37 GHZ H BRIGHT. TEMP:',i7/
463 $ 35x,'NUMBER OF RETRIEVALS W/ ERROR IN 85 GHZ V BRIGHT. TEMP:',i7/
464 $ 35x,'NUMBER OF RETRIEVALS W/ ERROR IN 85 GHZ H BRIGHT. TEMP:',i7/
465 $ 35x,'NUMBER OF RETRIEVALS REJECTED DUE TO BEING OVER LAND: ',i7/
466 $ 35x,'NUMBER OF RETRIEVALS REJECTED DUE TO BEING OVER ICE: ',i7)
467 IF(nnalg) print 781, lflag,licec
468 781 FORMAT(
469 $ 35x,'NUMBER OF NN3 RETR. REJECTED DUE TO FAILING RAIN FLAG: ',i7/
470 $ 35x,'NUMBER OF NN3 RETR. REJECTED DUE TO ICE CONTAMINATION: ',i7)
471 IF(nnalg.OR.gbalg) print 782, dmax,dmin
472 782 FORMAT(/' ** FOR SEA-SFC TEMP AT ALL RETRIEVAL LOCATIONS: FIELD',
473 $ ' MAX =',f8.3,' DEG K, FIELD MIN =',f8.3,' DEG K'/)
474 END IF
475 ier = 1
476 RETURN
477C.......................................................................
478 END IF
479
480 GO TO 30
481 END IF
482
483C***********************************************************************
484C COME HERE FOR BOTH PRODUCTS AND BRIGHTNESS TEMPERATURES
485C***********************************************************************
486 shdr = bmiss
487 CALL ufbint(indta,shdr_8,09,1,nlev,shder) ; shdr = shdr_8
488 ilflg = 1
489 IF(nlev.NE.1) GO TO 999
490
491C STORE THE SCAN'S SATELLITE ID IN WORD 1
492C STORE SCAN'S YEAR (YYYY), MONTH, DAY, HOUR, MIN, SEC INTO WORDS 2-7
493C STORE THE SCAN NUMBER IN WORD 8
494C STORE THE SCAN'S ORBIT NUMBER IN WORD 9
495
496 ibuftn(1:9) = min(imsg,nint(shdr(1:9)))
497
498C CHECK TO SEE IF SCAN IS FROM REQUESTED SATELLITE ID
499
500 IF(ibuftn(1).LT.240.OR.ibuftn(1).GT.249) THEN
501 print 523, (ibuftn(ii),ii=1,9)
502 kspsat(239) = kspsat(239) + 1
503 GO TO 30
504 END IF
505 IF(.NOT.lsat(ibuftn(1))) THEN
506CDAK PRINT 523, (IBUFTN(II),II=1,9)
507 523 FORMAT(' ##W3MISCAN: SCAN NOT FROM REQ. SAT. ID -SAT. ID',i4,
508 $ ', SCAN TIME:',6i4,', SCAN',i6,', ORBIT',i8,'-GO TO NEXT SCAN')
509 kspsat(ibuftn(1)) = kspsat(ibuftn(1)) + 1
510 GO TO 30
511 END IF
512
513 IF(ignrtm.EQ.0) THEN
514
515C TIME CHECK THIS SCAN IF USER REQUESTS SUCH
516
517 mdat = 0
518 mdat(1:3) = ibuftn(2:4)
519 mdat(5:7) = ibuftn(5:7)
520 CALL w3difdat(kdat,mdat,4,rinc)
521 ksec = rinc(4)
522 CALL w3difdat(ldat,mdat,4,rinc)
523 lsec = rinc(4)
524 IF(ksec.GT.0.OR.lsec.LT.0) THEN
525
526C TIME CHECK FOR SCAN FAILED: GO ON TO NEXT SCAN
527
528CDAK PRINT 123, (IBUFTN(II),II=2,9)
529 123 FORMAT(' ##W3MISCAN: SCAN NOT IN REQUESTED TIME WINDOW-',
530 $ 'SCAN TIME:',6i5,' SCAN',i6,', ORBIT',i8,' - GO TO NEXT SCAN')
531 knttim = knttim + 1
532 GO TO 30
533 END IF
534 END IF
535 rhdr = bmiss
536 CALL ufbint(indta,rhdr_8,04,64,nlev,rhder) ; rhdr = rhdr_8
537 ilflg = 2
538 IF(nlev.NE.64) GO TO 999
539 iflag = 0
540 DO irt = 1,64
541
542C THIS ROUTINE EXPECTS LONGITUDE TO BE 0-360 E; BUFR NOW RETURNS -180-0
543C FOR WEST AND 0-180 FOR EAST
544
545 IF(rhdr(2,irt).LT.0.0) rhdr(2,irt) = rhdr(2,irt) + 360.
546C-----------------------------------------------------------------------
547C LOOP THROUGH THE 64 RETRIEVALS IN A SCAN
548C-----------------------------------------------------------------------
549C STORE THE LATITUDE (*100 DEGREES; + : NORTH, - : SOUTH)
550 IF(nint(rhdr(1,irt)*100.).GE.-9000.AND.nint(rhdr(1,irt)*100.)
551 $ .LE.9000) THEN
552 ibuftn((27*irt)-17) = nint(rhdr(1,irt)*100.)
553 ELSE
554
555C.......................................................................
556
557C BAD LATITUDE
558
559 laerr = laerr + 1
560 print 777, irt,ibuftn(8),ibuftn(9),nint(rhdr(1,irt)*100.)
561 777 FORMAT(' ##W3MISCAN: BAD LAT: RETR.',i3,', SCAN',i6,
562 $ ', ORBIT',i8,'; INPUT LAT=',i7,' - ALL DATA IN THIS ',
563 $ 'RETRIEVAL SET TO MISSING')
564 iflag(irt) = 1
565C.......................................................................
566
567 END IF
568
569C STORE THE LONGITUDE (*100 DEGREES EAST)
570
571 IF(nint(rhdr(2,irt)*100.).GE.0.AND.nint(rhdr(2,irt)*100.).LE.
572 $ 36000) THEN
573 IF(iflag(irt).EQ.0)
574 $ ibuftn((27*irt)-16) = nint(rhdr(2,irt)*100.)
575 ELSE
576
577C.......................................................................
578
579C BAD LONGITUDE
580
581 loerr = loerr + 1
582 print 778, irt,ibuftn(8),ibuftn(9),nint(rhdr(2,irt)*100.)
583 778 FORMAT(' ##W3MISCAN: BAD LON: RETR.',i3,', SCAN',i6,
584 $ ', ORBIT',i8,'; INPUT LON=',i7,' - ALL DATA IN THIS ',
585 $ 'RETRIEVAL SET TO MISSING')
586 iflag(irt) = 1
587C.......................................................................
588
589 END IF
590 IF(iflag(irt).NE.0) GO TO 110
591
592C STORE THE POSITION NUMBER
593
594 ibuftn((27*irt)-15) = min(imsg,nint(rhdr(3,irt)))
595
596C STORE THE SURFACE TAG (0-6)
597
598 ibuftn((27*irt)-14) = min(imsg,nint(rhdr(4,irt)))
599 110 CONTINUE
600C-----------------------------------------------------------------------
601 END DO
602
603 IF(lprod) THEN
604C***********************************************************************
605C COME HERE TO PROCESS PRODUCTS FROM INPUT SSM/I PRODUCTS FILE
606C***********************************************************************
607
608 prod = bmiss
609 CALL ufbint(indta,prod_8,13,64,nlev,prod1//prod2)
610 ufbint_8 = bmiss
611 IF(iret_ph2o.GT.0) THEN ! Prior to 9/2004
612 CALL ufbint(indta,ufbint_8,1,64,nlev,'PH2O')
613 prod_8(8,:) = ufbint_8(:)
614 END IF
615 ufbint_8 = bmiss
616 IF(iret_sndp.GT.0) THEN ! Prior to 9/2004
617 CALL ufbint(indta,ufbint_8,1,64,nlev,'SNDP')
618 prod_8(10,:) = ufbint_8(:)
619 END IF
620 ufbint_8 = bmiss
621 IF(iret_wsos.GT.0) THEN ! Prior to 9/2004
622 CALL ufbint(indta,ufbint_8,1,64,nlev,'WSOS')
623 prod_8(3,:) = ufbint_8(:)
624 END IF
625 ufbint_8 = bmiss
626 IF(iret_ch2o.GT.0) THEN ! Prior to 9/2004
627 CALL ufbint(indta,ufbint_8,1,64,nlev,'CH2O')
628 prod_8(1,:) = ufbint_8(:)
629 ELSE
630 CALL ufbint(indta,ufbint_8,1,64,nlev,'METFET')
631 metfet = ufbint_8
632 DO irt = 1,64
633 IF(nint(metfet(irt)).NE.12) prod_8(1,irt) = bmiss
634 END DO
635 END IF
636
637 prod=prod_8
638 ilflg = 3
639 IF(nlev.EQ.0) THEN
640 print 797, ibuftn(8),ibuftn(9)
641 797 FORMAT(' ##W3MISCAN: PRODUCTS REQ. BUT SCAN',i6,', ORBIT',
642 $ i8,' DOES NOT CONTAIN PRODUCT DATA - CONTINUE PROCESSING ',
643 $ 'SCAN (B.TEMPS REQ.?)')
644 GO TO 900
645 ELSE IF(nlev.NE.64) THEN
646 GO TO 999
647 END IF
648 DO irt = 1,64
649C-----------------------------------------------------------------------
650C LOOP THROUGH THE 64 RETRIEVALS IN A SCAN
651C-----------------------------------------------------------------------
652 IF(iflag(irt).NE.0) GO TO 111
653
654C STORE THE CLOUD WATER (*100 KG/M**2) IF AVAILABLE
655
656 IF(nint(prod(01,irt)).LT.imsg)
657 $ ibuftn((27*irt)-13) = nint(prod(01,irt)*100.)
658
659C STORE THE RAIN RATE (*1000000 KG/((M**2)*SEC)) IF AVAILABLE
660C (THIS IS ALSO RAIN RATE (*1000000 MM/SEC))
661
662 IF(nint(prod(02,irt)).LT.imsg)
663 $ ibuftn((27*irt)-12) = nint(prod(02,irt)*1000000.)
664
665C STORE THE WIND SPEED (*10 M/SEC) IF AVAILABLE
666
667 ibuftn((27*irt)-11) = min(imsg,nint(prod(03,irt)*10.))
668
669C STORE THE SOIL MOISTURE (MM) IF AVAILABLE
670
671 IF(nint(prod(04,irt)).LT.imsg)
672 $ ibuftn((27*irt)-10) = nint(prod(04,irt)*1000.)
673
674C STORE THE SEA ICE CONCENTRATION (PERCENT) IF AVAILABLE
675
676 ibuftn((27*irt)-09) = min(imsg,nint(prod(05,irt)))
677
678C STORE THE SEA ICE AGE (0,1) IF AVAILABLE
679
680 ibuftn((27*irt)-08) = min(imsg,nint(prod(06,irt)))
681
682C STORE THE ICE EDGE (0,1) IF AVAILABLE
683
684 ibuftn((27*irt)-07) = min(imsg,nint(prod(07,irt)))
685
686C STORE THE WATER VAPOR (*10 KG/M**2) IF AVAILABLE
687C (THIS IS ALSO TOTAL PRECIPITABLE WATER SCALED AS *10 MM)
688
689 ibuftn((27*irt)-06) = min(imsg,nint(prod(08,irt)*10.))
690
691 IF(ibuftn((27*irt)-14).NE.5) THEN
692
693C STORE THE SURFACE TEMPERATURE (*100 DEGREES KELVIN) IF AVAILABLE
694C (NOTE: SURFACE TAG MUST NOT BE 5)
695
696 ibuftn((27*irt)-05) = min(imsg,nint(prod(09,irt)*100.))
697
698 ELSE
699
700C STORE THE SEA-SURFACE TEMPERATURE (*100 DEGREES KELVIN) IF AVAILABLE
701C (NOTE: SURFACE TAG MUST BE 5)
702
703 ibuftn((27*irt)-05) = min(imsg,nint(prod(13,irt)*100.))
704
705 END IF
706
707C STORE THE SNOW DEPTH (MM) IF AVAILABLE
708
709 IF(nint(prod(10,irt)).LT.imsg)
710 $ ibuftn((27*irt)-04) = nint(prod(10,irt)*1000.)
711
712C STORE THE RAIN FLAG (0-3) IF AVAILABLE
713
714 ibuftn((27*irt)-03) = min(imsg,nint(prod(11,irt)))
715
716C STORE THE CALCULATED SURFACE TYPE (1-20) IF AVAILABLE
717
718 ibuftn((27*irt)-02) = min(imsg,nint(prod(12,irt)))
719 111 CONTINUE
720C-----------------------------------------------------------------------
721 END DO
722 END IF
723 900 CONTINUE
724
725 IF(lbrit) THEN
726C***********************************************************************
727C COME HERE TO PROCESS BRIGHTNESS TEMPERATURES FROM INPUT SSM/I
728C BRIGHTNESS TEMPERATURE FILE
729C AND POSSIBLY FOR IN-LINE CALC. OF WIND SPEED VIA GOODBERLET ALG.
730C AND POSSIBLY FOR IN-LINE CALC. OF WIND SPEED AND TPW VIA N. NET 3 ALG.
731C***********************************************************************
732
733 brit = bmiss
734 CALL ufbrep(indta,brit_8,2,448,nlev,brite) ; brit = brit_8
735 ilflg = 4
736 IF(nlev.EQ.0) THEN
737 print 798, ibuftn(8),ibuftn(9)
738 798 FORMAT(' ##W3MISCAN: B. TEMPS REQ. BUT SCAN',i6,', ORBIT',
739 $ i8,' DOES NOT CONTAIN B. TEMP DATA - DONE PROCESSING THIS',
740 $ ' SCAN')
741 GO TO 901
742 ELSE IF(nlev.NE.448) THEN
743 GO TO 999
744 END IF
745 DO irt = 1,64
746C-----------------------------------------------------------------------
747C LOOP THROUGH THE 64 RETRIEVALS IN A SCAN
748C-----------------------------------------------------------------------
749 IF(iflag(irt).NE.0) GO TO 112
750
751C STORE THE 7 BRIGHTNESS TEMPS (*100 DEGREES KELVIN)
752C -- CHANNELS ARE IN THIS ORDER FOR A PARTICULAR RETRIEVAL:
753C 19 GHZ V, 19 GHZ H, 22 GHZ V, 37 GHZ V, 37 GHZ H, 85 GHZ V, 85 GHZ H
754
755 igood = 0
756 mindx = (irt * 7) - 6
757 DO lch = mindx,mindx+6
758 ichnn = nint(brit(1,lch))
759 IF(ichnn.GT.7) GO TO 79
760 IF(nint(brit(2,lch)).LT.imsg) THEN
761 ibuftn((27*irt)-02+ichnn) = nint(brit(2,lch)*100.)
762 igood = 1
763 END IF
764 79 CONTINUE
765 END DO
766
767 IF(nnalg.OR.gbalg) THEN
768 kdata = imsg
769 IF(igood.EQ.1) THEN
770C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
771C COME HERE FOR IN-LINE CALC. OF WIND SPEED VIA GOODBERLET ALG. AND/OR
772C FOR IN-LINE CALC. OF WIND SPEED AND TPW VIA NEURAL NET 3 ALG.
773C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
774
775C GET LAND/SEA TAG AND CHECK FOR LAT/LON OVER LAND OR ICE
776
777 balon=real(mod(ibuftn((27*irt)-16)+18000,36000)-18000)/100.
778 ialon = mod(36000-ibuftn((27*irt)-16),36000)
779 ix = 361. - real(ialon)/100.
780 jy = 91 - nint(real(ibuftn((27*irt)-17))/100. + 0.50)
781 dmin = min(dmin,sstdat(ix,jy))
782 dmax = max(dmax,sstdat(ix,jy))
783 CALL misc04(inlsf,real(ibuftn((27*irt)-17))/100.,balon,lstag)
784
785C ..... REJECT IF OVER LAND (USE LAND/SEA TAG HERE)
786
787 IF(lstag.NE.0) THEN
788 nlr = nlr + 1
789 GO TO 112
790 END IF
791
792C ..... REJECT IF OVER ICE (USE SEA-SURFACE TEMPERATURE HERE)
793
794 IF(sstdat(ix,jy).LE.272.96) THEN
795 nir = nir + 1
796 GO TO 112
797 END IF
798
799 kdata = ibuftn((27*irt)-01:(27*irt)+05)
800 DO it = 1,7
801 IF((it.NE.2.AND.kdata(it).LT.10000).OR.
802 $ (it.EQ.2.AND.kdata(it).LT. 8000)) THEN
803 lbter(it) = lbter(it) + 1
804 print 779,it,ibuftn(8),ibuftn(9),kdata
805 779 FORMAT(' ##W3MISCAN: BT, CHN',i2,' BAD: SCAN',i6,', ORBIT',i8,
806 $ '; BT:',7i6,'-CANNOT CALC. PRODS VIA ALG.')
807 GO TO 112
808 END IF
809 END DO
810
811C CALL SUBR. MISC01 TO INITIATE IN-LINE PRODUCT CALCULATION
812
813 CALL misc01(nnalg,gbalg,kdata,swnn,tpwnn,swgb,nrfgb)
814
815 IF(nnalg) THEN
816CDAK IF(MOD(KNTSCN,100).EQ.0) PRINT 6021, ATXT(1),SWNN,
817CDAK $ TPWNN,REAL(KDATA(1))/100.,(REAL(KDATA(KKK))/100.,
818CDAK $ KKK=3,5),(REAL(KDATA(4)-KDATA(5)))/100.
819 6021 FORMAT(' W3MISCAN: ',a2,' SPD',f6.1,' TPW',f6.1,' TB19V',f6.1,
820 $ ' TB22V',f6.1,' TB37V',f6.1,' TB37H',f6.1,' TD37',f5.1)
821
822C STORE THE CALCULATED NEURAL NET 3 WIND SPEED (*10 M/SEC)
823
824 ibuftn((27*irt)+6) = min(imsg,nint(swnn*10.))
825
826C STORE THE CALCULATED NEURAL NET 3 TPW (*10 MILLIMETERS)
827
828 ibuftn((27*irt)+7) = min(imsg,nint(tpwnn*10.))
829 END IF
830
831 IF(gbalg) THEN
832CDAK IF(MOD(KNTSCN,100).EQ.0) PRINT 602, ATXT(2),NRFGB,
833CDAK $ SWGB,REAL(KDATA(1))/100.,(REAL(KDATA(KKK))/100.,
834CDAK $ KKK=3,5),(REAL(KDATA(4)-KDATA(5)))/100.
835 602 FORMAT(' W3MISCAN: ',a2,' RF, SPD',i2,f6.1,' TB19V',f6.1,
836 $ ' TB22V',f6.1,' TB37V',f6.1,' TB37H',f6.1,' TD37',f5.1)
837
838C STORE THE CALCULATED GOODBERLET WIND SPEED (*10 M/SEC)
839
840 ibuftn((27*irt)+8) = min(imsg,nint(swgb*10.))
841
842C STORE THE GOODBERLET RAIN FLAG (0-3)
843
844 ibuftn((27*irt)+9) = min(imsg,nrfgb)
845 END IF
846
847C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
848 ELSE
849
850C......................................................................
851
852C PROBLEM - CAN'T CALCULATE PRODUCTS VIA ANY ALG., ALL B.TEMPS MISSING
853
854 print 879, ibuftn(8),ibuftn(9),kdata
855 879 FORMAT(' ##W3MISCAN: ALL B.TMPS MSSNG: SCAN',i6,', ',
856 $ 'ORBIT',i8,'; BT:',7i6,'-CANNOT CALC PRODS VIA ALG.')
857C......................................................................
858
859 END IF
860 END IF
861
862 112 CONTINUE
863C-----------------------------------------------------------------------
864 END DO
865 END IF
866C***********************************************************************
867 901 CONTINUE
868
869C RETURN TO CALLING PROGRAM - IER = 0 SCAN SUCCESSFULLY READ
870
871 kntscn = kntscn + 1
872 kntsat(ibuftn(1)) = kntsat(ibuftn(1)) + 1
873 ier = 0
874 RETURN
875
876C.......................................................................
877 993 CONTINUE
878
879C PROBLEM: SEA-SURFACE TEMPERATURE NOT FOUND IN GRIB INDEX FILE - ERROR
880C RETURNED FROM GRIB DECODER GETGB IS 96 - SET IER = 6 & RETURN
881
882 print 2008, ingbi
883 2008 FORMAT(/' ##W3MISCAN: SEA-SURFACE TEMPERATURE NOT FOUND IN GRIB ',
884 $ 'INDEX FILE IN UNIT ',i2,' - IER = 6'/)
885 ier = 6
886 RETURN
887
888C.......................................................................
889 994 CONTINUE
890
891C PROBLEM: SEA-SURFACE TEMPERATURE GRIB MESSAGE HAS A DATE THAT IS
892C EITHER: 1) MORE THAN 7-DAYS PRIOR TO THE EARLIEST REQ. DATE
893C (INPUT ARG. "KDATE") OR 2) MORE THAN 7-DAYS AFTER THE LATEST
894C REQ. DATE (INPUT ARG. "LDATE") - SET IER = 7 AND RETURN
895
896 print 2009
897 2009 FORMAT(' SST GRIB MSG HAS DATE WHICH IS EITHER 7-DAYS',
898 $ ' PRIOR TO EARLIEST REQ. DATE'/14x,'OR 7-DAYS LATER THAN LATEST',
899 $ ' REQ. DATE - IER = 7'/)
900 ier = 7
901 RETURN
902
903C.......................................................................
904 995 CONTINUE
905
906C PROBLEM: BYTE-ADDRESSABLE READ ERROR FOR GRIB FILE CONTAINING SEA-
907C SURFACE TEMPERATURE FIELD - ERROR RETURNED FROM GRIB DECODER
908C GETGB IS 97-99 - SET IER = 8 AND RETURN
909
910 print 2010
911 2010 FORMAT(' BYTE-ADDRESSABLE READ ERROR FOR GRIB FILE ',
912 $ 'CONTAINING SEA-SURFACE TEMPERATURE FIELD - IER = 8'/)
913 ier = 8
914 RETURN
915
916C.......................................................................
917 996 CONTINUE
918
919C PROBLEM: ERROR RETURNED FROM GRIB DECODER - GETGB - FOR SEA-SURFACE
920C TEMPERATURE FIELD - > 0 BUT NOT 96-99 - SET IER = 9 & RETURN
921
922 print 2011
923 2011 FORMAT(' - IER = 9'/)
924 ier = 9
925 RETURN
926
927C.......................................................................
928 997 CONTINUE
929
930C PROBLEM: ERROR OPENING R. ACCESS FILE HOLDING LAND/SEA TAGS - SET IER
931C = 4 AND RETURN
932
933 print 2012, ierr,inlsf
934 2012 FORMAT(/' ##W3MISCAN: ERROR OPENING R. ACCESS LAND/SEA FILE IN ',
935 $ 'UNIT ',i2,' -- IOSTAT =',i5,' -- NO SCANS PROCESSED - IER = 4'/)
936 ier = 4
937 RETURN
938
939C.......................................................................
940 998 CONTINUE
941
942C PROBLEM: THE INPUT DATA SET IS EITHER EMPTY (NULL), NOT BUFR, OR
943C CONTAINS NO DATA MESSAGES - SET IER = 2 AND RETURN
944
945 print 14, indta
946 14 FORMAT(/' ##W3MISCAN: SSM-I DATA SET IN UNIT',i3,' IS EITHER ',
947 $'EMPTY (NULL), NOT BUFR, OR CONTAINS NO DATA MESSAGES - IER = 2'/)
948 ier = 2
949 RETURN
950
951C.......................................................................
952 999 CONTINUE
953
954C PROBLEM: THE NUMBER OF DECODED "LEVELS" IS NOT WHAT IS EXPECTED - SET
955C IER = 5 AND RETURN
956
957 print 217, nlev,ilflg
958 217 FORMAT(/' ##W3MISCAN: THE NUMBER OF DECODED "LEVELS" (=',i5,') ',
959 $ 'IS NOT WHAT IS EXPECTED (ILFLG=',i1,') - IER = 5'/)
960 ier = 5
961 RETURN
962
963C.......................................................................
964 END
965C> @brief Prepares for in-line caluclation of prods.
966C> @author Dennis Keyser @date 1995-01-04
967
968C> Based on input 7-channel ssm/i brightness temperatures,
969C> determines the rain flag category for wind speed product for the
970C> goodberlet algorithm. Then calls the appropriate function to
971C> calculate either the wind speed product for the goodberlet
972C> algorithm (if requested) or the wind speed and tpw products for
973C> the neural net 3 algorithm (if requested).
974C>
975C> ### Program History Log:
976C> Date | Programmer | Comment
977C> -----|------------|--------
978C> ????-??-?? | W. Gemmill | (w/nmc21) -- original author
979C> 1995-01-04 | Dennis Keyser | -- incorporated into w3miscan and
980C> streamlined code
981C> 1996-05-07 | Dennis Keyser | (np22) -- in-line neural network 1 algoritm
982C> replaced by neural network 2 algorithm
983C> 1996-07-30 | Dennis Keyser | (np22) -- can now process wind speed from
984C> both algorithms if desired
985C> 1998-01-28 | Dennis Keyser | (np22) -- replaced neural net 2 algorithm
986C> which calculated only wind speed product with neural net 3
987C> algorithm which calculates both wind speed and total
988C> precipitable water products (among others) but, unlike nn2,
989C> does not return a rain flag value (it does set all retrievals
990C> to missing that fail rain flag and ice contamination tests)
991C>
992C> @param[in] NNALG Process wind speed and tpw via neural net 3 algorithm if true
993C> @param[in] GBALG Process wind speed via goodberlet algorithm if true
994C> @param[in] KDATA 7-word array containing 7 channels of brightness temperature (kelvin x 100)
995C> @param[out] SWNN alculated wind speed based on neural net 3 algorithm (meters/second)
996C> @param[out] TPWNN Calculated total column precipitable water based on neural net 3 algorithm (millimeters)
997C> @param[out] SWGB Calculated wind speed based on goodberlet algorith (meters/second)
998C> @param[out] NRFGB Rain flag category for calculated wind speed from goodberlet algorithm
999C>
1000C> @remark If an algorithm is not chosen, the output products are set
1001C> to values of 99999. for that algorithm and, for the goodberlet
1002C> algorithm only, the rain flag is set to 99999. Called by
1003C> subroutine w3miscan().
1004C>
1005C> @author Dennis Keyser @date 1995-01-04
1006 SUBROUTINE misc01(NNALG,GBALG,KDATA,SWNN,TPWNN,SWGB,NRFGB)
1007 LOGICAL NNALG,GBALG
1008 REAL BTA(4),BTAA(7)
1009 INTEGER KDATA(7)
1010
1011 common/miscee/lflag,licec
1012
1013 SAVE
1014
1015 swnn = 99999.
1016 tpwnn = 99999.
1017 swgb = 99999.
1018 nrfgb = 99999
1019
1020 tb19v = real(kdata(1))/100.
1021 tb19h = real(kdata(2))/100.
1022 tb22v = real(kdata(3))/100.
1023 tb37v = real(kdata(4))/100.
1024 tb37h = real(kdata(5))/100.
1025 tb85v = real(kdata(6))/100.
1026 tb85h = real(kdata(7))/100.
1027 td37 = tb37v - tb37h
1028
1029 IF(nnalg) THEN
1030C COMPUTE WIND SPEED FROM NEURAL NET 2 ALGORITHM (1995)
1031C (no longer a possibility - subr. expects dim. of 5 on BTAA)
1032cdak NRFNN = 1
1033cdak IF(TB19H.LE.185.0.AND.TB37H.LE.210.0.AND.TB19V.LT.TB37V)
1034cdak $ NRFNN = 0
1035cdak BTAA(1) = TB19V
1036cdak BTAA(2) = TB22V
1037cdak BTAA(3) = TB37V
1038cdak BTAA(4) = TB37H
1039cdak BTAA(5) = TB85V
1040cdak SWNN = RISC02xx(BTAA)
1041
1042C COMPUTE WIND SPEED AND TPW FROM NEURAL NET 3 ALGORITHM (1997)
1043 btaa(1) = tb19v
1044 btaa(2) = tb19h
1045 btaa(3) = tb22v
1046 btaa(4) = tb37v
1047 btaa(5) = tb37h
1048 btaa(6) = tb85v
1049 btaa(7) = tb85h
1050 swnn = risc02(btaa,tpwnn,lqwnn,sstnn,jerr)
1051 IF(jerr.EQ.1) lflag = lflag + 1
1052 IF(jerr.EQ.2) licec = licec + 1
1053 END IF
1054
1055 IF(gbalg) THEN
1056C COMPUTE WIND SPEED FROM GOODBERLET ALGORITHM
1057 nrfgb = 0
1058 IF(td37.LE.50.0.OR.tb19h.GE.165.0) THEN
1059 IF(td37.LE.50.0.OR.tb19h.GE.165.0) nrfgb = 1
1060 IF(td37.LE.37.0) nrfgb = 2
1061 IF(td37.LE.30.0) nrfgb = 3
1062 END IF
1063 bta(1) = tb19v
1064 bta(2) = tb22v
1065 bta(3) = tb37v
1066 bta(4) = tb37h
1067 swgb = risc03(bta)
1068 END IF
1069
1070 RETURN
1071 END
1072C> @brief Calc. ssm/i prods from neural net 3 alg.
1073C> @author V. Krasnopolsky @date 1997-02-02
1074
1075C> This retrieval algorithm is a neural network implementation
1076C> of the ssm/i transfer function. It retrieves the wind speed (w)
1077C> at the height 20 meters, columnar water vapor (v), columnar liquid
1078C> water (l) and sst. The nn was trained using back-propagation
1079C> algorithm. Transfer function is described and compared with
1080C> cal/val and other algorithms in omb technical note no. 137. See
1081C> remarks for detailed info on this algorithm. This is an improved
1082C> version of the earlier neural network 2 algorithm.
1083C>
1084C> ### Program History Log:
1085C> Date | Programmer | Comment
1086C> -----|------------|--------
1087C> 1997-02-02 | V. Krasnopolsky | Initial.
1088C>
1089C> @param[in] XT 7-word array containing brightness temperature in the order:
1090C> t19v (word 1), t19h (word 2), t22v (word 3), t37v (word 4), t37h (word 5),
1091C> t85v (word 6), t85h (word 7) (all in kelvin)
1092C> @param[in] V Columnar water vapor (total precip. water) (mm)
1093C> @param[in] L Columnar liquid water (mm)
1094C> @param[in] SST Sea surface temperature (deg. c)
1095C> @param[in] JERR Error return code:
1096C> - = 0 -- Good retrievals
1097C> - = 1 -- Retrievals could not be made due to one or
1098C> more brightness temperatures out of range
1099C> (i.e, failed the rain flag test)
1100C> - = 2 -- Retrievals could not be made due to ice
1101C> contamination
1102C> {for either 1 or 2 above, all retrievals set to
1103C> 99999. (missing)}
1104C>
1105C> @remark Function, called by subroutine misc01.
1106C> Description of training and test data set:
1107C> ------------------------------------------
1108C> The training set consists of 3460 matchups which were received
1109C> from two sources:
1110C> - 1. 3187 F11/SSMI/buoy matchups were filtered out from a
1111C> preliminary version of the new NRL database which was
1112C> kindly provided by G. Poe (NRL). Maximum available wind
1113C> speed is 24 m/s.
1114C> - 2. 273 F11/SSMI/OWS matchups were filtered out from two
1115C> datasets collected by high latitude OWS LIMA and MIKE.
1116C> These data sets were kindly provided by D. Kilham
1117C> (University of Bristol). Maximum available wind speed
1118C> is 26.4 m/s.
1119C>
1120C> Satellite data are collocated with both buoy and OWS data in
1121C> space within 15 km and in time within 15 min.
1122C>
1123C> The test data set has the same structure, the same number of
1124C> matchups and maximum buoy wind speed.
1125C>
1126C> Description of retrieval flags:
1127C> -------------------------------
1128C> Retrieval flags by Stogryn et al. are used. The algorithm
1129C> produces retrievals under CLEAR + CLOUDY conditions, that is
1130C> if:
1131C> - T37V - T37H > 50. => CLEAR condition -or-
1132C> - T37V - T37H =< 50.|
1133C> - T19H =< 185. and |
1134C> - T37H =< 210. and | => CLOUDY conditions
1135C> - T19V < T37V |
1136C>
1137C> @author V. Krasnopolsky @date 1997-02-02
1138 FUNCTION risc02(XT,V,L,SST,JERR)
1139 parameter(iout =4)
1140 LOGICAL lq1,lq2,lq3,lq4
1141 REAL xt(7),y(iout),v,l,sst
1142 equivalence(y(1),spn)
1143
1144 jerr = 0
1145
1146C -------- Retrieval flag (Stogryn) -------------------------
1147
1148C T19H =< 185
1149
1150 lq1 = (xt(2).LE.185.)
1151
1152C T37H =< 210
1153
1154 lq2 = (xt(5).LE.210.)
1155
1156C T19V < T37V
1157
1158 lq3 = (xt(1).LT.xt(4))
1159
1160C T37V - T37H =< 50.
1161
1162 lq4 = ((xt(4) - xt(5)).LE.50.)
1163 lq1 = (lq1.AND.lq2.AND.lq3)
1164 IF(.NOT.lq1.AND.lq4) THEN
1165 spn = 99999.
1166 v = 99999.
1167 l = 99999.
1168 sst = 99999.
1169 jerr = 1
1170 GO TO 111
1171 END IF
1172
1173C --------------- Call NN ----------------------
1174
1175C NN WIND SPEED
1176
1177 CALL misc10(xt,y)
1178 v = y(2)
1179 l = y(3)
1180 sst = y(4)
1181
1182C --------- Remove negative values ----------------------------
1183
1184 IF(spn.LT.0.0) spn = 0.0
1185 IF(sst.LT.0.0) sst = 0.0
1186 IF(v .LT.0.0) v = 0.0
1187
1188C ------ Remove ice contamination ------------------------------------
1189
1190 ice = 0
1191 si85 = -174.4 + (0.715 * xt(1)) + (2.439 * xt(3)) - (0.00504 *
1192 $ xt(3) * xt(3)) - xt(6)
1193 tt = 44. + (0.85 * xt(1))
1194 IF(si85.GE.10.) THEN
1195 IF(xt(3).LE.tt) ice = 1
1196 IF((xt(3).GT.264.).AND.((xt(3)-xt(1)).LT.2.)) ice = 1
1197 END IF
1198 IF(ice.EQ.1) THEN
1199 spn = 99999.
1200 v = 99999.
1201 l = 99999.
1202 sst = 99999.
1203 jerr = 2
1204 END IF
1205
1206 111 CONTINUE
1207
1208 risc02 = spn
1209
1210 RETURN
1211 END
1212C> @brief Calc. ssm/i prods from neural net 3 alg.
1213C> @author V. Krasnopolsky @date 1996-07-15
1214
1215C> This nn calculates w (in m/s), v (in mm), l (in mm), and
1216C> sst (in deg c). This nn was trained on blended f11 data set
1217C> (ssmi/buoy matchups plus ssmi/ows matchups 15 km x 15 min) under
1218C> clear + cloudy conditions.
1219C>
1220C> ### Program History Log:
1221C> Date | Programmer | Comment
1222C> -----|------------|--------
1223C> 1996-07-15 | V. Krasnopolsky | Initial.
1224C>
1225C> @param[in] X 5-word array containing brightness temperature in the
1226C> order: t19v (word 1), t19h (word 2), t22v (word 3),
1227C> t37v (word 4), t37h (word 5) (all in kelvin)
1228C> @param[out] Y 4-word array containing calculated products in the
1229C> order: wind speed (m/s) (word 1), columnar water
1230C> vapor (total precip. water) (mm) (word 2), columnar
1231C> liquid water (mm) (word 3), sea surface temperature
1232C> (deg. c) (word 4)
1233C>
1234C> @remark Called by subroutine risc02().
1235C>
1236C> @author V. Krasnopolsky @date 1996-07-15
1237 SUBROUTINE misc10(X,Y)
1238 INTEGER HID,OUT
1239
1240C IN IS THE NUMBER OF NN INPUTS, HID IS THE NUMBER OF HIDDEN NODES,
1241C OUT IS THE NUMBER OF OUTPUTS
1242
1243 parameter(in =5, hid =12, out =4)
1244 dimension x(in),y(out),w1(in,hid),w2(hid,out),b1(hid),b2(out),
1245 $ o1(in),x2(hid),o2(hid),x3(out),o3(out),a(out),b(out)
1246
1247C W1 HOLDS INPUT WEIGHTS
1248
1249 DATA ((w1(i,j),j = 1,hid),i = 1,in)/
1250 $-0.0435901, 0.0614709,-0.0453639,-0.0161106,-0.0271382, 0.0229015,
1251 $-0.0650678, 0.0704302, 0.0383939, 0.0773921, 0.0661954,-0.0643473,
1252 $-0.0108528,-0.0283174,-0.0308437,-0.0199316,-0.0131226, 0.0107767,
1253 $ 0.0234265,-0.0291637, 0.0140943, .00567931,-.00931768,
1254 $-.00860661, 0.0159747,-0.0749903,-0.0503523, 0.0524172, 0.0195771,
1255 $ 0.0302056, 0.0331725, 0.0326714,-0.0291429, 0.0180438, 0.0281923,
1256 $-0.0269554, 0.102836, 0.0591511, 0.134313, -0.0109854,-0.0786303,
1257 $ 0.0117111, 0.0231543,-0.0205603,-0.0382944,-0.0342049,
1258 $ 0.00052407,0.110301, -0.0404777, 0.0428816, 0.0878070, 0.0168326,
1259 $ 0.0196183, 0.0293995, 0.00954805,-.00716287,0.0269475,
1260 $-0.0418217,-0.0165812, 0.0291809/
1261
1262C W2 HOLDS HIDDEN WEIGHTS
1263
1264 DATA ((w2(i,j),j = 1,out),i = 1,hid)/
1265 $-0.827004, -0.169961,-0.230296, -0.311201, -0.243296, 0.00454425,
1266 $ 0.950679, 1.09296, 0.0842604, 0.0140775, 1.80508, -0.198263,
1267 $-0.0678487, 0.428192, 0.827626, 0.253772, 0.112026, 0.00563793,
1268 $-1.28161, -0.169509, 0.0019085,-0.137136, -0.334738, 0.224899,
1269 $-0.189678, 0.626459,-0.204658, -0.885417, -0.148720, 0.122903,
1270 $ 0.650024, 0.715758, 0.735026, -0.123308, -0.387411,-0.140137,
1271 $ 0.229058, 0.244314,-1.08613, -0.294565, -0.192568, 0.608760,
1272 $-0.753586, 0.897605, 0.0322991,-0.178470, 0.0807701,
1273 $-0.781417/
1274
1275C B1 HOLDS HIDDEN BIASES
1276
1277 DATA (b1(i), i=1,hid)/
1278 $ -9.92116,-10.3103,-17.2536, -5.26287, 17.7729,-20.4812,
1279 $ -4.80869,-11.5222, 0.592880,-4.89773,-17.3294, -7.74136/
1280
1281C B2 HOLDS OUTPUT BIAS
1282
1283 DATA (b2(i), i=1,out)/-0.882873,-0.0120802,-3.19400,1.00314/
1284
1285C A(OUT), B(OUT) HOLD TRANSFORMATION COEFFICIENTS
1286
1287 DATA (a(i), i=1,out)/18.1286,31.8210,0.198863,37.1250/
1288 DATA (b(i), i=1,out)/13.7100,32.0980,0.198863,-5.82500/
1289
1290C INITIALIZE
1291
1292 o1 = x
1293
1294C START NEURAL NETWORK
1295
1296C - INITIALIZE X2
1297
1298 DO i = 1,hid
1299 x2(i) = 0.
1300 DO j = 1,in
1301 x2(i) = x2(i) + (o1(j) * w1(j,i))
1302 END DO
1303 x2(i) = x2(i) + b1(i)
1304 o2(i) = tanh(x2(i))
1305 END DO
1306
1307C - INITIALIZE X3
1308
1309 DO k = 1,out
1310 x3(k) = 0.
1311 DO j = 1,hid
1312 x3(k) = x3(k) + (w2(j,k) * o2(j))
1313 END DO
1314
1315 x3(k) = x3(k) + b2(k)
1316
1317C --- CALCULATE O3
1318
1319 o3(k) = tanh(x3(k))
1320 y(k) = (a(k) * o3(k)) + b(k)
1321 END DO
1322
1323 RETURN
1324 END
1325C> @brief Calc. wspd from neural net 2 algorithm
1326C> @author V. Krasnopolsky @date 1996-05-07
1327
1328C> Calculates a single neural network output for wind speed.
1329C> the network was trained on the whole data set without any
1330C> separation into subsets. It gives rms = 1.64 m/s for training set
1331C> and 1.65 m/s for testing set. This is an improved version of the
1332C> earlier neural network 1 algorithm.
1333C>
1334C> ### Program History Log:
1335C> Date | Programmer | Comment
1336C> -----|------------|--------
1337C> 1994-03-20 | V. Krasnopolsky | Initial.
1338C> 1995-05-07 | V. Krasnopolsky | Replaced with neural net 2 algorithm.
1339C>
1340C> @param[in] X 5-Word array containing brightness temperature in the
1341C> order: t19v (word 1), t22v (word 2), t37v (word 3),
1342C> t37h (word 4), t85v (word 5) (all in kelvin)
1343C> @return XX Wind speed (meters/second)
1344C>
1345C> @remark Function, no longer called by this program. It is here
1346C> simply to save neural net 2 algorithm for possible later use
1347C> (has been replaced by neural net 3 algorithm, see subr. risc02
1348C> and misc10).
1349C>
1350C> @author V. Krasnopolsky @date 1996-05-07
1351 FUNCTION risc02xx(X)
1352 INTEGER hid
1353C IN IS THE NUMBER OF B. TEMP. CHNLS, HID IS THE NUMBER OF HIDDEN NODES
1354 parameter(in =5, hid =2)
1355 dimension x(in),w1(in,hid),w2(hid),b1(hid),o1(in),x2(hid),o2(hid)
1356
1357 SAVE
1358
1359C W1 HOLDS INPUT WEIGHTS
1360 DATA ((w1(i,j),j=1,hid),i=1,in)/
1361 $ 4.402388e-02, 2.648334e-02, 6.361322e-04,-1.766535e-02,
1362 $ 7.876555e-03,-7.387260e-02,-2.656543e-03, 2.957161e-02,
1363 $-1.181134e-02, 4.520317e-03/
1364C W2 HOLDS HIDDEN WEIGHTS
1365 DATA (w2(i),i=1,hid)/8.705661e-01,1.430968/
1366C B1 HOLDS HIDDEN BIASES
1367 DATA (b1(i),i=1,hid)/-6.436114,8.799655/
1368C B2 HOLDS OUTPUT BIAS
1369C AY AND BY HOLD OUTPUT TRANSFORMATION COEFFICIENTS
1370 DATA b2/-0.736255/,ay/16.7833/,by/11.08/
1371 o1 = x
1372C INITIALIZE
1373 x3 = 0.
1374 DO i = 1, hid
1375 o2(i) = 0.
1376 x2(i) = 0.
1377 DO j = 1,in
1378 x2(i) = x2(i) + (o1(j) * w1(j,i))
1379 END DO
1380 x2(i) = x2(i) + b1(i)
1381 o2(i) = tanh(x2(i))
1382 x3 = x3 + (o2(i)* w2(i))
1383 END DO
1384 x3 = x3 + b2
1385 o3 = tanh(x3)
1386 risc02xx = (ay * o3) + by
1387 risc02xx = max(risc02xx,0.0)
1388C BIAS CORRECTION
1389 bias = 0.5 + 0.004*((risc02xx-10.)**3)*(1.-exp(-0.5*risc02xx))
1390 risc02xx = risc02xx + bias
1391 RETURN
1392 END
1393C> @brief Calc. w.spd from b temp.- goodberlet alg.
1394C> @author W. Gemmill @date 1994-08-15
1395
1396C> Calculates a single goodberlet output for wind speed.
1397C> This is a linear regression algorithm from 1989.
1398C>
1399C> ### Program History Log:
1400C> Date | Programmer | Comment
1401C> -----|------------|--------
1402C> 1994-08-15 | W. Gemmill | Initial.
1403C>
1404C> @param[in] X 4-word array containing brightness temperature in the
1405C> order: t19v (word 1), t22v (word 2), t37v (word 3),
1406C> t37h (word 4) (all in kelvin)
1407C> @return XX Wind speed (meters/second)
1408C>
1409C> @remark Function, called by subroutine misc01.
1410C>
1411C> @author W. Gemmill @date 1994-08-15
1412 FUNCTION risc03(X)
1413 dimension x(4)
1414
1415 SAVE
1416
1417 risc03 = 147.90 + (1.0969 * x(1)) - (0.4555 * x(2)) -
1418 $ (1.76 * x(3)) + (0.7860 * x(4))
1419 RETURN
1420 END
1421C> @brief Returns land/sea tag for given lat/lon
1422C> @author Dennis Keyser @date 1995-01-04
1423
1424C> Finds and returns the low resolution land/sea tag nearest
1425C> to the requested latitude and longitude.
1426C>
1427C> ### Program History Log:
1428C> Date | Programmer | Comment
1429C> -----|------------|--------
1430C> 1978-01-20 | J. K. Kalinowski (S11213) | Original author
1431C> 1978-10-03 | J. K. Kalinowski (S1214) | Changes unknown
1432C> 1985-03-01 | N. Digirolamo (SSAI) | Conversion to vs fortran
1433C> 1995-01-04 | Dennis Keyser | Incorporated into w3miscan and streamlined code
1434C>
1435C> @param[in] INLSF Unit number of direct access nesdis land/sea file
1436C> @param[in] BLAT Latitude (whole degrees: range is 0. to +90. north,
1437C> 0. to -90. south)
1438C> @param[in] BLNG Longitude (whole degrees: range is 0. to +179.99 east,
1439C> 0. to -180. west)
1440C> @param[out] LSTAG Land/sea tag {=0 - sea; =1 - land; =2 - coastal
1441C> interface (higher resolution tags are available);
1442C> =3 - coastal interface (no higher resolution tags
1443C> exist)}
1444C>
1445C> @remark Called by subroutine w3miscan.
1446C>
1447C> @author Dennis Keyser @date 1995-01-04
1448 SUBROUTINE misc04(INLSF,BLAT,BLNG,LSTAG)
1449 CHARACTER*1 LPUT
1450 REAL RGS(3)
1451C LPUT CONTAINS A REGION OF LAND/SEA TAGS (RETURNED FROM CALL TO MISC05)
1452 common/miscdd/lput(21960)
1453
1454 SAVE
1455
1456C RGS IS ARRAY HOLDING SOUTHERN BOUNDARIES OF EACH LAND/SEA TAG REGION
1457 DATA rgs/-85.,-30.,25./,numrgl/0/,iflag/0/
1458C INITIALIZE LAND/SEA TAG AS 1 (OVER LAND)
1459 lstag = 1
1460C FIND NEAREST POINT OF A HALF-DEGREE (LAT,LONG) GRID
1461C ..ALAT IS LATITUDE TO THE NEAREST HALF-DEGREE
1462 alat = int((blat+sign(.25,blat))/.5) * .5
1463C ..ALNG IS LONGITUDE TO THE NEAREST HALF-DEGREE
1464 alng = int((blng+sign(.25,blng))/.5) * .5
1465 IF(nint(alng*10.).EQ.1800) alng = -180.
1466C IDENTIFY DATABASE REGION IN WHICH TO FIND CORRECT TAG
1467 numrgn = 1
1468 IF(iabs(nint(alat*10)).GT.850) THEN
1469 RETURN
1470 ELSE IF(nint(alat*10).GT.275) THEN
1471 numrgn = 3
1472 ELSE IF(nint(alat*10.).GE.-275) THEN
1473 numrgn = 2
1474 END IF
1475 IF(numrgn.NE.numrgl.OR.iflag.EQ.1) THEN
1476 numrgl = numrgn
1477 CALL misc05(inlsf,numrgn,*99)
1478 END IF
1479C FIND THE BYTE & BIT PAIR W/I DATA BASE REGION CONTAINING DESIRED TAG
1480 trm1 = ((alat - rgs(numrgn)) * 1440.) + 360.
1481 lstpt = trm1 + (2. * alng)
1482C ..NBYTE IS THE BYTE IN LPUT CONTAINING THE TAG
1483 nbyte = (180 * 8) + (lstpt/4 * 8)
1484 nshft = (2 * (mod(lstpt,4) + 1)) - 2
1485C PULL OUT THE TAG
1486 CALL gbyte(lput,lstag,nbyte+nshft,2)
1487 iflag = 0
1488 RETURN
1489C-----------------------------------------------------------------------
1490 99 CONTINUE
1491C COME HERE IF LAND/SEA TAG COULD NOT BE RETURNED FROM SUBR. W3MISCAN
1492C (IN THIS CASE IT WILL REMAIN SET TO 1 INDICATING OVER LAND)
1493 iflag = 1
1494 RETURN
1495C-----------------------------------------------------------------------
1496 END
1497C> @brief Reads 2 records from land/sea tag database
1498C> @author Dennis Keyser @date 195-01-04
1499
1500C> Reads two records from a low resolution land/sea database and stores into common.
1501C>
1502C> ### Program History Log:
1503C> Date | Programmer | Comment
1504C> -----|------------|--------
1505C> 1978-01-20 | J. K. Kalinowski (S11213) | Original author
1506C> 1995-01-04 | Dennis Keyser | Incorporated into w3miscan and
1507C> streamlined code; modified to be machine independent thru
1508C> use of standard fortran direct access read
1509C>
1510C> @param[in] INLSF Unit number of direct access nesdis land/sea file
1511C> @param[in] NUMRGN The region (1,2 or 3) of the database to be accessed
1512C> (dependent on latitude band)
1513C>
1514C> @remark Called by subroutne misc04.
1515C>
1516C> @author Dennis Keyser @date 195-01-04
1517 SUBROUTINE misc05(INLSF,NUMRGN,*)
1518 CHARACTER*1 LPUT
1519
1520C LPUT CONTAINS A REGION OF LAND/SEA TAGS (COMPRISED OF 2 RECORDS FROM
1521C LAND/SEA FILE) -- 180 BYTES OF DOCUMENTATION FOLLOWED BY 21780 BYTES
1522C OF LAND/SEA TAGS
1523
1524 common/miscdd/lput(21960)
1525
1526 SAVE
1527
1528 nrec = (2 * numrgn) - 1
1529 READ(inlsf,rec=nrec,err=10) (lput(ii),ii=1,10980)
1530 nrec = nrec + 1
1531 READ(inlsf,rec=nrec,err=10) (lput(ii),ii=10981,21960)
1532 RETURN
1533C-----------------------------------------------------------------------
1534 10 CONTINUE
1535C ERROR READING IN A RECORD FROM LAND-SEA FILE -- RETURN (TAG WILL BE
1536C SET TO 1 MEANING OVER LAND IN THIS CASE)
1537 print 1000, nrec,inlsf
1538 1000 FORMAT(' ##W3MISCAN/MISC05: ERROR READING IN LAND-SEA DATA ',
1539 $ 'RECORD',i7,' IN UNIT ',i2,' -- SET TAG TO LAND'/)
1540 RETURN 1
1541C-----------------------------------------------------------------------
1542 END
1543C> @brief Reads in nh and sh 1-deg. sea-sfc temps.
1544C> @author Dennis Keyser @date 200-02-18
1545
1546C> Reads in global sea-surface temperature field on a one-degree grid from grib file.
1547C>
1548C> ### Program History Log:
1549C> Date | Programmer | Comment
1550C> -----|------------|--------
1551C> ????-??-?? | W. Gemmill (NP21) | Original author
1552C> 1995-01-04 | Dennis Keyser | Incorporated into w3miscan and
1553C> streamlined code; converted sst input file from vsam/on84 to
1554C> grib to allow code compile and run on the cray machines.
1555C> 2000-02-18 | Dennis Keyser | Modified to call w3lib routine "getgb",
1556C> this allows code to compile and run properly on ibm-sp
1557C>
1558C> @param[in] INGBI Unit number of grib index file for grib file
1559C> containing global 1-degree sea-surface temp field
1560C> @param[in] INGBD Unit number of grib file containing global 1-degree
1561C> sea-surface temp field
1562C> @param[in] IDAT1 Requested earliest year(yyyy), month, day, hour, min
1563C> @param[in] IDAT2 Requested latest year(yyyy), month, day, hour, min
1564C>
1565C> @remark Called by subroutine w3miscan.
1566C>
1567C> @author Dennis Keyser @date 200-02-18
1568 SUBROUTINE misc06(INGBI,INGBD,IDAT1,IDAT2,*,*,*,*)
1569 parameter(maxpts=360*180)
1570 LOGICAL*1 LBMS(360,180)
1571 INTEGER KPDS(200),KGDS(200),LPDS(200),LGDS(200),IDAT1(5),
1572 $ idat2(5),jdat1(8),jdat2(8),kdat(8),ldat(8),mdate(8)
1573 REAL RINC(5)
1574 CHARACTER*11 ENVVAR
1575 CHARACTER*80 FILEB,FILEI
1576 common/misccc/sstdat(360,180)
1577
1578 SAVE
1579
1580 envvar='XLFUNIT_ '
1581 WRITE(envvar(9:10),fmt='(I2)') ingbd
1582 CALL getenv(envvar,fileb)
1583 envvar='XLFUNIT_ '
1584 WRITE(envvar(9:10),fmt='(I2)') ingbi
1585 CALL getenv(envvar,filei)
1586 CALL baopenr(ingbd,fileb,iret1)
1587ccccc PRINT *,'SAGT: ',INGBD,FILEB,IRET1
1588 CALL baopenr(ingbi,filei,iret2)
1589ccccc PRINT *,'SAGT: ',INGBI,FILEI,IRET2
1590
1591 kpds = -1
1592 kgds = -1
1593 n = -1
1594 kpds(5) = 11
1595 kpds(6) = 1
1596 kpds(7) = 0
1597 kpds(8) = -1
1598 kpds(9) = -1
1599 kpds(10) = -1
1600 print 68, ingbd
1601 68 FORMAT(//4x,'** W3MISCAN/MISC06: READ IN "CURRENT" SEA-SURFACE ',
1602 $ 'TEMPERATURE DATA FROM GRIB MESSAGE IN UNIT',i3)
1603 CALL getgb(ingbd,ingbi,maxpts,0,kpds,kgds,kf,k,lpds,lgds,lbms,
1604 $ sstdat,iret)
1605C.......................................................................
1606C ABNORMAL RETURN IF PROBLEM WITH SST IN GRIB FILE
1607 IF(iret.NE.0) THEN
1608 WRITE(6,*)' ERROR READING SST USING GETGB. IRET = ',iret
1609 IF (iret.EQ.96) RETURN 1
1610 IF (iret.EQ.97) RETURN 3
1611 IF (iret.EQ.98) RETURN 3
1612 IF (iret.EQ.99) RETURN 3
1613 RETURN 4
1614 ENDIF
1615C.......................................................................
1616C READ SUCCESSFUL
1617 jdat1 = 0
1618 jdat2 = 0
1619 jdat1(1:3) = idat1(1:3)
1620 jdat1(5:6) = idat1(4:5)
1621 jdat2(1:3) = idat2(1:3)
1622 jdat2(5:6) = idat2(4:5)
1623 mdate = 0
1624 mdate(1) = ((lpds(21) - 1) * 100) + lpds(8)
1625 mdate(2:3) = lpds(9:10)
1626 mdate(5:6) = lpds(11:12)
1627 CALL w3movdat((/-7.,0.,0.,0.,0./),jdat1,kdat)
1628 CALL w3movdat((/ 7.,0.,0.,0.,0./),jdat2,ldat)
1629cppppp
1630 print *, '** W3MISCAN/MISCO6: SST GRIB FILE MUST HAVE DATE ',
1631 $ 'BETWEEN ',(kdat(iii),iii=1,3),(kdat(iii),iii=5,6),' AND ',
1632 $ (ldat(iii),iii=1,3),(ldat(iii),iii=5,6)
1633 print *, ' RETURNED FROM GRIB FILE IS YEAR ',
1634 $ 'OF CENTURY = ',lpds(8),' AND CENTURY = ',lpds(21)
1635 print *, ' CALULATED 4-DIGIT YEAR IS = ',
1636 $ mdate(1)
1637cppppp
1638 CALL w3difdat(kdat,mdate,3,rinc)
1639 kmin = rinc(3)
1640 CALL w3difdat(ldat,mdate,3,rinc)
1641 lmin = rinc(3)
1642 IF(kmin.GT.0.OR.lmin.LT.0) THEN
1643C.......................................................................
1644C COME HERE IF SST GRIB MSG HAS A DATE THAT IS EITHER: 1) MORE THAN 7-
1645C DAYS PRIOR TO THE EARLIEST REQ. DATE (INPUT ARG. "IDAT1" TO W3MISCAN)
1646C OR 2) MORE THAN 7-DAYS AFTER THE LATEST REQ. DATE (INPUT ARG.
1647C "IDAT2" TO W3MISCAN)
1648 print 27, (mdate(iii),iii=1,3),(mdate(iii),iii=5,6)
1649 27 FORMAT(/' ##W3MISCAN/MISC06: SST GRIB MSG HAS DATE:',i5,4i3,
1650 $ ' - AS A RESULT......')
1651 RETURN 2
1652C.......................................................................
1653 END IF
1654 print 60, (mdate(iii),iii=1,3),(mdate(iii),iii=5,6)
1655 60 FORMAT(/4x,'** W3MISCAN/MISC06: SEA-SFC TEMP SUCCESSFULLY READ ',
1656 $ 'IN FROM GRIB FILE, DATE IS: ',i5,4i3/)
1657 RETURN
1658
1659 CALL baclose(ingbi,iret)
1660 CALL baclose(ingbd,iret)
1661
1662 END
subroutine gbyte(ipackd, iunpkd, noff, nbits)
This is the fortran version of gbyte.
Definition gbyte.f:27
subroutine getgb(lugb, lugi, jf, j, jpds, jgds, kf, k, kpds, kgds, lb, f, iret)
Find and unpack a grib message.
Definition getgb.f:166
subroutine w3difdat(jdat, idat, it, rinc)
Returns the elapsed time interval from an NCEP absolute date and time given in the second argument un...
Definition w3difdat.f:29
subroutine w3fi04(iendn, itypec, lw)
Subroutine computes word size, the type of character set, ASCII or EBCDIC, and if the computer is big...
Definition w3fi04.f:30
subroutine misc06(ingbi, ingbd, idat1, idat2,,,,)
Reads in nh and sh 1-deg.
Definition w3miscan.f:1569
subroutine misc05(inlsf, numrgn,)
Reads 2 records from land/sea tag database.
Definition w3miscan.f:1518
subroutine misc01(nnalg, gbalg, kdata, swnn, tpwnn, swgb, nrfgb)
Prepares for in-line caluclation of prods.
Definition w3miscan.f:1007
function risc02xx(x)
Calc.
Definition w3miscan.f:1352
function risc02(xt, v, l, sst, jerr)
Calc.
Definition w3miscan.f:1139
function risc03(x)
Calc.
Definition w3miscan.f:1413
subroutine misc10(x, y)
Calc.
Definition w3miscan.f:1238
subroutine w3miscan(indta, inlsf, ingbi, ingbd, lsat, lprod, lbrit, nnalg, gbalg, kdate, ldate, ignrtm, ibuftn, ibdate, ier)
Reads one ssm/i scan line (64 retrievals) from the NCEP bufr ssm/i dump file.
Definition w3miscan.f:194
subroutine misc04(inlsf, blat, blng, lstag)
Returns land/sea tag for given lat/lon.
Definition w3miscan.f:1449
subroutine w3movdat(rinc, idat, jdat)
This subprogram returns the date and time that is a given NCEP relative time interval from an NCEP ab...
Definition w3movdat.f:24