Unpacks an array of upper-air reports that are packed in the format described by NMC office note 29, or unpacks an array of surface reports that are packed in the format described by NMC office note 124.
Input character data are converted to integer, real or character type as specified in the category tables below. Missing integer data are replaced with 99999, missing real data are replaced with 99999.0 and missing character data are replaced with blanks. This library is similar to w3ai02() except w3ai02() was written in assembler and could not handle internal read errors (program calling w3ai02() would fail in this case w/o explanation).
Program history log:
- L. Marx 1990-01 Converted code from assembler to vs fortran; Expanded error return codes in 'NEXT'
- Dennis Keyser 1991-07-22 Use same arguments as w3ai02() ; Streamlined code; Docblocked and commented; Diag- nostic print for errors; Attempts to skip to NEXT report in same record rather than exiting record.
- Dennis Keyser 1991-08-12 Slight changes to make sub- program more portable; Test for absence of end- of-record indicator, will gracefully exit record.
- Dennis Keyser 1992-06-29 Convert to cray cft77 fortran
- Dennis Keyser 1992-08-06 Corrected error which could lead to the length for a concatenation operator being less than 1 when an input parameter spans across two 10-character words.
- Parameters
-
[in] | COCBUF | Character*10 array containing a block of packed reports in nmc office note 29/124 format. |
[in] | NEXT | Marker indicating relative location (in bytes) of end of last report in COCBUF. Exception: NEXT must be set to zero prior to unpacking the first report of a new block of reports. subsequently, the value of NEXT returned by the previous call to w3fi64 should be used as input. (see output argument list below.) if NEXT is negative, w3fi64 will return immediately without action. |
[out] | LOCRPT | Array containing one unpacked report with pointers and counters to direct the user. Locrpt() must begin on a fullword boundary. Format is mixed, user must equivalence real and character arrays to this array (see below and remarks for content). |
word | content | unit | format |
1 | latitude | 0.01 degrees | real |
2 | longitude | 0.01 degrees west | real |
3 | unused | | |
4 | observation time | 0.01 hours (utc) | real |
5 | reserved (3rd byte is | 4-characters | char*8 |
| on29 "25'th char.; 4th | left-justified | |
| byte is on29 "26'th | | |
| char." (see on29) | | |
6 | reserved (3rd byte is | 3-characters | char*8 |
| on29 "27'th char. (see | left-justified | |
| on29) | | |
7 | station elevation | meters | real |
8 | instrument type | on29 table r.2 | integer |
9 | report type | on29 table r.1 or | integer |
| on124 table s.3 | | |
10 | ununsed | | |
11 | stn. id. (first 4 char.) | 4-characters | char*8 |
| left-justified | | |
12 | stn. id. (last 2 char.) | 2-characters | char*8 |
| left-justified | | |
13 | category 1, no. levels | count | integer |
14 | category 1, data index | count | integer |
15 | category 2, no. levels | count | integer |
16 | category 2, data index | count | integer |
17 | category 3, no. levels | count | integer |
18 | category 3, data index | count | integer |
19 | category 4, no. levels | count | integer |
20 | category 4, data index | count | integer |
21 | category 5, no. levels | count | integer |
22 | category 5, data index | count | integer |
23 | category 6, no. levels | count | integer |
24 | category 6, data index | count | integer |
25 | category 7, no. levels | count | integer |
26 | category 7, data index | count | integer |
27 | category 8, no. levels | count | integer |
28 | category 8, data index | count | integer |
29 | category 51, no. levels | count | integer |
30 | category 51, data index | count | integer |
31 | category 52, no. levels | count | integer |
32 | category 52, data index | count | integer |
33 | category 9, no. levels | count | integer |
34 | category 9, data index | count | integer |
35-42 | zeroed out - not used | | integer |
43-end | unpacked data groups | (see remarks) | mixed |
NEXT: Marker indicating relative location (in bytes) of end of current report in COCBUF. NEXT will be set to -1 if w3fi64() encounters string 'end record' in place of the NEXT report. This is the end of the block. No unpacking takes place. NEXT is set to-2 when internal (logic) errors have been detected. NEXT is set to -3 when data count check fails. In both of the latter cases some data (e.g., header information) may be unpacked into LOCRPT.
- Note
- After first reading and processing the office note 85 (first) date record, the user's fortran program begins a read loop as follows. For each iteration a blocked input report is read into array COCBUF. Now test the first ten characters in COCBUF for the string 'endof file' (sic). This string signals the end of input. Otherwise, set the marker 'NEXT' to zero and begin the unpacking loop.
Each iteration of the unpacking loop consists of a call to w3fi64() with the current value of 'NEXT'. If 'NEXT' is -1 upon returning from w3fi64(), it has reached the end of the input record, and the user's program should read the next record as above. If 'NEXT' is -2 or -3 upon returning, there is a grievous error in the current packed input record, and the user's program should print it for examination by automation division personnel. If 'NEXT' is positive, the output structure locrpt contains an unpacked report, and the user's program should process it at this point, subsequently repeating the unpacking loop.
EXAMPLE:
CHARACTER*10 COCBUF(644)
CHARACTER*8 COCRPT(1608)
CHARACTER*3 CQUMAN(20)
INTEGER LOCRPT(1608)
REAL ROCRPT(1608),GEOMAN(20),TMPMAN(20),DPDMAN(20),
$ wdrman(20),wspman(20)
equivalence(cocrpt,locrpt,rocrpt)
c READ and process the office note 85 date record
..........
c --- begin READ loop
10 CONTINUE
READ (unit=inp, iostat=ios, num=nbuf) cocbuf
IF(ios .LT. 0) GO TO (END OF INPUT)
IF(ios .GT. 0) GO TO (input error)
IF(nbuf .GT. 6432) GO TO (buffer overflow)
IF(cocbuf(1).EQ.'ENDOF FILE') GO TO (END OF INPUT)
next = 0
c ------ begin unpacking loop
20 CONTINUE
CALL w3fi64(cocbuf, locrpt, next)
IF(next .EQ. -1) GO TO 10
IF(next .LT. -1) GO TO (office note 29/124 error)
rlat = 0.01 * rocrpt(1) (latitude)
..... etc .....
c --- begin category 1 fetch -- mandatory level DATA
IF(locrpt(13) .GT. 0) THEN
nlvls = min(20,locrpt(13))
indx = locrpt(14)
DO 66 i = 1,nlvls
geoman(i) = rocrpt(indx)
tmpman(i) = 0.1 * rocrpt(indx+1)
dpdman(i) = 0.1 * rocrpt(indx+2)
wdrman(i) = rocrpt(indx+3)
wspman(i) = rocrpt(indx+4)
cquman(i) = cocrpt(indx+5)
indx = indx + 6
66 CONTINUE
END IF
..... etc .....
GO TO 20
...............
subroutine w3fi64(cocbuf, locrpt, next)
Unpacks an array of upper-air reports that are packed in the format described by NMC office note 29,...
Data from the on29/124 record is unpacked into fixed locations in words 1-12 and into indexed locations in word 43 and following. Study on29 appendix c/on124 appendix s.2 carefully. Each category (or group of fields) in the packed report has a corresponding layout in locations in array LOCRPT that may be found by using the corresponding index amount from words 14, 16, ..., 34, in array LOCRPT. For instance, if a report contains one or more packed category 3 data groups (wind data at variable pressure levels) that data will be unpacked into binary and and character fields in one or more unpacked category 3 data groups as described below. The number of levels will be stored in word 17 and the index in fullwords of the first level of unpacked data in the output array will be stored in word 18. The second level, if any, will be stored beginning four words further on, and so forth until the count in word 17 is exhausted. The field layout in each category is given below...
- CATEGORY 1 - MANDATORY LEVEL DATA
WORD | PARAMETER | UNITS | FORMAT |
1 | GEOPOTENTIAL | METERS | REAL |
2 | TEMPERATURE | 0.1 DEGREES C | REAL |
3 | DEWPOINT DEPRESSION | 0.1 DEGREES C | REAL |
4 | WIND DIRECTION | DEGREES | REAL |
5 | WIND SPEED | KNOTS | REAL |
6 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| GEOPOTENTIAL | ON29 TABLE Q.A | |
| TEMPERATURE | ON29 TABLE Q.A | |
| DEWPOINT DEPR. | ON29 TABLE Q.C | |
| WIND | ON29 TABLE Q.A | |
- CATEGORY 2 - TEMPERATURE AT VARIABLE PRESSURE
WORD | PARAMETER | UNITS | FORMAT |
1 | PRESSURE | 0.1 MILLIBARS | REAL |
2 | TEMPERATURE | 0.1 DEGREES C | REAL |
3 | DEWPOINT DEPRESSION | 0.1 DEGREES C | REAL |
4 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| PRESSURE | ON29 TABLE Q.B | |
| TEMPERATURE | ON29 TABLE Q.A | |
| DEWPOINT DEPR. | ON29 TABLE Q.C | |
| NOT USED | BLANK | |
- CATEGORY 3 - WINDS AT VARIABLE PRESSURE
WORD | PARAMETER | UNITS | FORMAT |
1 | PRESSURE | 0.1 MILLIBARS | REAL |
2 | WIND DIRECTION | DEGREES | REAL |
3 | WIND SPEED | KNOTS | REAL |
4 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| PRESSURE | ON29 TABLE Q.B | |
| WIND | ON29 TABLE Q.A | |
| NOT USED | BLANK | |
| NOT USED | BLANK | |
- CATEGORY 4 - WINDS AT VARIABLE HEIGHTS
WORD | PARAMETER | UNITS | FORMAT |
1 | GEOPOTENTIAL | METERS | REAL |
2 | WIND DIRECTION | DEGREES | REAL |
3 | WIND SPEED | KNOTS | REAL |
4 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| GEOPOTENTIAL | ON29 TABLE Q.B | |
| WIND | ON29 TABLE Q.A | |
| NOT USED | BLANK | |
| NOT USED | BLANK | |
- CATEGORY 5 - TROPOPAUSE DATA
WORD | PARAMETER | UNITS | FORMAT |
1 | GEOPOTENTIAL | METERS | REAL |
2 | TEMPERATURE | 0.1 DEGREES C | REAL |
3 | DEWPOINT DEPRESSION | 0.1 DEGREES C | REAL |
4 | WIND DIRECTION | DEGREES | REAL |
5 | WIND SPEED | KNOTS | REAL |
6 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| PRESSURE | ON29 TABLE Q.B | |
| TEMPERATURE | ON29 TABLE Q.A | |
| DEWPOINT DEPR. | ON29 TABLE Q.C | |
| WIND | ON29 TABLE Q.A | |
- CATEGORY 6 - CONSTANT-LEVEL DATA (AIRCRAFT, SAT. CLOUD-DRIFT)
WORD | PARAMETER | UNITS | FORMAT |
1 | PRESSURE ALTITUDE | METERS | REAL |
2 | TEMPERATURE | 0.1 DEGREES C | REAL |
3 | DEWPOINT DEPRESSION | 0.1 DEGREES C | REAL |
4 | WIND DIRECTION | DEGREES | REAL |
5 | WIND SPEED | KNOTS | REAL |
6 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| PRESSURE | ON29 TABLE Q.6 | |
| TEMPERATURE | ON29 TABLE Q.6 | |
| DEWPOINT DEPR. | ON29 TABLE Q.6 | |
| WIND | ON29 TABLE Q.6C | |
- CATEGORY 7 - CLOUD COVER
WORD | PARAMETER | UNITS | FORMAT |
1 | PRESSURE | 0.1 MILLIBARS | REAL |
2 | AMOUNT OF CLOUDS | PER CENT | REAL |
3 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| PRESSURE | ON29 TABLE Q.7 | |
| CLOUD AMOUNT | ON29 TABLE Q.7 | |
| NOT USED | BLANK | |
| NOT USED | BLANK | |
- CATEGORY 8 - ADDITIONAL DATA
WORD | PARAMETER | UNITS | FORMAT |
1 | SPECIFIED IN ON29 | VARIABLE | REAL |
| TABLE 101.1 OR | | |
| ON124 TABLE SM.8A.1 | | |
2 | FORM OF ADD'L DATA | CODE FIGURE FROM | REAL |
| | ON29 TABLE 101 OR | |
| | ON124 TABLE SM.8A | |
3 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| VALUE 1 | ON29 TABLE Q.8 OR | |
| | ON124 TABLE SM.8B | |
| VALUE 2 | ON29 TABLE Q.8A OR | |
| | ON124 TABLE SM.8C | |
| NOT USED | BLANK | |
| NOT USED | BLANK | |
- CATEGORY 51 - SURFACE DATA
WORD | PARAMETER | UNITS | FORMAT |
1 | SEA-LEVEL PRESSURE | 0.1 MILLIBARS | REAL |
2 | STATION PRESSURE | 0.1 MILLIBARS | REAL |
3 | WIND DIRECTION | DEGREES | REAL |
4 | WIND SPEED | KNOTS | REAL |
5 | AIR TEMPERATURE | 0.1 DEGREES C | REAL |
6 | DEWPOINT DEPRESSION | 0.1 DEGREES C | REAL |
7 | MAXIMUM TEMPERATURE | 0.1 DEGREES C | REAL |
8 | MINIMUM TEMPERATURE | 0.1 DEGREES C | REAL |
9 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| S-LEVEL PRESS. | ON124 TABLE SM.51 | |
| STATION PRESS. | ON124 TABLE SM.51 | |
| WIND | ON124 TABLE SM.51 | |
| AIR TEMPERATURE | ON124 TABLE SM.51 | |
10 | QUALITY MARKERS: | EACH 1-CHARACTER | CHAR*8 |
| | LEFT-JUSTIFIED | |
| DEWPOINT DEPR. | ON124 TABLE SM.51 | |
| NOT USED | BLANK | |
| NOT USED | BLANK | |
| NOT USED | BLANK | |
11 | HORIZ. VISIBILITY | WMO CODE TABLE 4300 | INTEGER |
12 | PRESENT WEATHER | WMO CODE TABLE 4677 | INTEGER |
13 | PAST WEATHER | WMO CODE TABLE 4561 | INTEGER |
14 | TOTAL CLOUD COVER N | WMO CODE TABLE 2700 | INTEGER |
15 | CLOUD COVER OF C/LN | WMO CODE TABLE 2700 | INTEGER |
16 | CLOUD TYPE OF C/L | WMO CODE TABLE 0513 | INTEGER |
17 | CLOUD HEIGHT OF C/L | WMO CODE TABLE 1600 | INTEGER |
18 | CLOUD TYPE OF C/M | WMO CODE TABLE 0515 | INTEGER |
19 | CLOUD TYPE OF C/H | WMO CODE TABLE 0509 | INTEGER |
20 | CHARACTERISTIC OF | WMO CODE TABLE 0200 | INTEGER |
| 3-HR PRESS TENDENCY | | |
21 | AMT. PRESS TENDENCY | 0.1 MILLIBARS | REAL |
| (50.0 WILL BE ADDED TO INDICATE 24-HR TENDENCY) | | |
- CATEGORY 52 - ADDITIONAL SURFACE DATA
WORD | PARAMETER | UNITS | FORMAT |
1 | 6-HR PRECIPITATION | 0.01 INCH | INTEGER |
2 | SNOW DEPTH | INCH | INTEGER |
3 | 24-HR PRECIPITATION | 0.01 INCH | INTEGER |
4 | DURATION OF PRECIP. | NO. 6-HR PERIODS | INTEGER |
5 | PERIOD OF WAVES | SECONDS | INTEGER |
6 | HEIGHT OF WAVES | 0.5 METERS | INTEGER |
7 | SWELL DIRECTION | WMO CODE TABLE 0877 | INTEGER |
8 | SWELL PERIOD | SECONDS | INTEGER |
9 | SWELL HEIGHT | 0.5 METERS | INTEGER |
10 | SEA SFC TEMPERATURE | 0.1 DEGREES C | INTEGER |
11 | SPECIAL PHEN, GEN'L | | INTEGER |
12 | SPECIAL PHEN, DET'L | | INTEGER |
13 | SHIP'S COURSE | WMO CODE TABLE 0700 | INTEGER |
14 | SHIP'S AVERAGE SPEED | WMO CODE TABLE 4451 | INTEGER |
15 | WATER EQUIVALENT OF 0.01 INCH | | INTEGER |
| SNOW AND/OR ICE | | |
- CATEGORY 9 - PLAIN LANGUAGE DATA (ALPHANUMERIC TEXT)
WORD | BYTES | PARAMETER | FORMAT |
1 | 1 | INDICATOR OF CONTENT (ON124 TABLE SM.9) | CHAR*8 |
| | (1 CHARACTER) | |
| 2-4 | PLAIN LANGUAGE DATA, TEXT CHARACTERS 1-3 | |
| 4-8 | NOT USED (BLANK) | |
2 | 1-4 | PLAIN LANGUAGE DATA, TEXT CHARACTERS 4-7 | CHAR*8 |
| 4-8 | NOT USED (BLANK) | |
3 | 1-4 | PLAIN LANGUAGE DATA, TEXT CHARACTERS 8-11 | CHAR*8 |
| 4-8 | NOT USED (BLANK) | |
- Note
- One report may unpack into more than one category having multiple levels. The unused portion of LOCRPT is not cleared.
-
Entry w3ai02() duplicates processing in w3fi64() since no assembly language code in cray w3lib.
- Author
- L. Marx
- Date
- 1990-01
Definition at line 392 of file w3fi64.f.