NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fi69.f
Go to the documentation of this file.
1C> @file
2C> @brief Convert pds to 25, or 27 word array.
3C> @author Ralph Jones @date 1991-05-14
4
5C> Converts an edition 1 grib produce definition section (pds)
6C> to a 25, or 27 word integer array.
7C>
8C> Program history log:
9C> - Ralph Jones 1991-05-14
10C> - Ralph Jones 1992-09-25 Change level to use one or two words
11C> - Ralph Jones 1993-01-08 Change for time range indicator if 10
12C> - Ralph Jones 1993-03-29 Add save statement
13C> - Ralph Jones 1993-10-21 Changes for on388 rev. oct 9,1993, new
14C> levels 125, 200, 201.
15C> - Ralph Jones 1994-04-14 Changes for on388 rev. mar 24,1994, new
16C> levels 115, 116.
17C> - Ralph Jones 1994-12-04 Changes for 27 word integer array if
18C> pds is greater than 28 bytes.
19C> - Ralph Jones 1995-09-07 Changes for level 117, 119.
20C> - Stephen Gilbert 1998-12-21 Replaced Function ICHAR with mova2i.
21C>
22C> @param[in] PDS 28 to 100 character product definition section (pds) .
23C> @param[out] ID 25, or 27 word integer array.
24C>
25C> @note List caveats, other helpful hints or information.
26C>
27C> @author Ralph Jones @date 1991-05-14
28 SUBROUTINE w3fi69 (PDS, ID)
29C
30 INTEGER ID(*)
31C
32 CHARACTER * 1 PDS(*)
33C
34 SAVE
35C
36C ID(1) = NUMBER OF BYTES IN PDS
37C ID(2) = PARAMETER TABLE VERSION NUMBER
38C ID(3) = IDENTIFICATION OF ORIGINATING CENTER
39C ID(4) = MODEL IDENTIFICATION (ALLOCATED BY ORIGINATING CENTER)
40C ID(5) = GRID IDENTIFICATION
41C ID(6) = 0 IF NO GDS SECTION, 1 IF GDS SECTION IS INCLUDED
42C ID(7) = 0 IF NO BMS SECTION, 1 IF BMS SECTION IS INCLUDED
43C ID(8) = INDICATOR OF PARAMETER AND UNITS
44C ID(9) = INDICATOR OF TYPE OF LEVEL OR LAYER
45C ID(10) = LEVEL 1
46C ID(11) = LEVEL 2
47C ID(12) = YEAR OF CENTURY
48C ID(13) = MONTH OF YEAR
49C ID(14) = DAY OF MONTH
50C ID(15) = HOUR OF DAY
51C ID(16) = MINUTE OF HOUR (IN MOST CASES SET TO 0)
52C ID(17) = FCST TIME UNIT
53C ID(18) = P1 PERIOD OF TIME
54C ID(19) = P2 PERIOD OF TIME
55C ID(20) = TIME RANGE INDICATOR
56C ID(21) = NUMBER INCLUDED IN AVERAGE
57C ID(22) = NUMBER MISSING FROM AVERAGES OR ACCUMULATIONS
58C ID(23) = CENTURY
59C ID(24) = IDENTIFICATION OF SUB-CENTER (TABLE 0 - PART 2)
60C ID(25) = SCALING POWER OF 10
61C ID(26) = FLAG BYTE, 8 ON/OFF FLAGS
62C BIT NUMBER VALUE ID(26) DEFINITION
63C 1 0 0 FULL FCST FIELD
64C 1 128 FCST ERROR FIELD
65C 2 0 0 ORIGINAL FCST FIELD
66C 1 64 BIAS CORRECTED FCST FIELD
67C 3 0 0 ORIGINAL RESOLUTION RETAINED
68C 1 32 SMOOTHED FIELD
69C NOTE: ID(26) CAN BE THE SUM OF BITS 1, 2, 3.
70C BITS 4-8 NOT USED, SET TO ZERO.
71C IF ID(1) IS 28, YOU DO NOT NEED ID(26) AND ID(27).
72C ID(27) = UNUSED, SET TO 0 SO PDS BYTE 30 IS SET TO ZERO.$
73C
74 id(1) = mova2i(pds(1)) * 65536 + mova2i(pds(2)) * 256 +
75 & mova2i(pds(3))
76 id(2) = mova2i(pds(4))
77 id(3) = mova2i(pds(5))
78 id(4) = mova2i(pds(6))
79 id(5) = mova2i(pds(7))
80 id(6) = iand(ishft(mova2i(pds(8)),-7),1)
81 id(7) = iand(ishft(mova2i(pds(8)),-6),1)
82 id(8) = mova2i(pds(9))
83 id(9) = mova2i(pds(10))
84 i9 = mova2i(pds(10))
85C
86C TEST ID(9) FOR 1-100, 102,103, 105, 107, 109,
87C 111,113,115,117,119,160,200,201, IF TRUE, SET ID(10) TO 0,
88C AND STORE 16 BIT VALUE (BYTES 11 & 12) THE LEVEL IN ID(11).
89C
90 IF ((i9.GE.1.AND.i9.LE.100).OR.i9.EQ.102.OR.
91 & i9.EQ.103.OR.i9.EQ.105.OR.i9.EQ.107.OR.
92 & i9.EQ.109.OR.i9.EQ.111.OR.i9.EQ.113.OR.
93 & i9.EQ.115.OR.i9.EQ.117.OR.i9.EQ.119.OR.
94 & i9.EQ.125.OR.i9.EQ.160.OR.i9.EQ.200.OR.
95 & i9.EQ.201) THEN
96 level = mova2i(pds(11)) * 256 + mova2i(pds(12))
97 IF (iand(level,32768).NE.0) THEN
98 level = -iand(level,32767)
99 END IF
100 id(10) = 0
101 id(11) = level
102 ELSE
103 id(10) = mova2i(pds(11))
104 id(11) = mova2i(pds(12))
105 END IF
106 id(12) = mova2i(pds(13))
107 id(13) = mova2i(pds(14))
108 id(14) = mova2i(pds(15))
109 id(15) = mova2i(pds(16))
110 id(16) = mova2i(pds(17))
111 id(17) = mova2i(pds(18))
112 id(18) = mova2i(pds(19))
113 id(19) = mova2i(pds(20))
114 id(20) = mova2i(pds(21))
115C
116C IF TIME RANGE IDICATOR IS 10, P1 IS PACKED INTO
117C PDS BYTES 19-20. PUT THEM IN P1 AND SET P2 TO ZERO.
118C
119 IF (id(20).EQ.10) THEN
120 id(18) = id(18) * 256 + id(19)
121 id(19) = 0
122 END IF
123 id(21) = mova2i(pds(22)) * 256 + mova2i(pds(23))
124 id(22) = mova2i(pds(24))
125 id(23) = mova2i(pds(25))
126 id(24) = mova2i(pds(26))
127 iscale = mova2i(pds(27)) * 256 + mova2i(pds(28))
128 IF (iand(iscale,32768).NE.0) THEN
129 iscale = -iand(iscale,32767)
130 END IF
131 id(25) = iscale
132 IF (id(1).GT.28) THEN
133 id(26) = mova2i(pds(29))
134 id(27) = mova2i(pds(30))
135 END IF
136C
137 RETURN
138 END
integer function mova2i(a)
This Function copies a bit string from a Character*1 variable to an integer variable.
Definition mova2i.f:25
subroutine w3fi69(pds, id)
Converts an edition 1 grib produce definition section (pds) to a 25, or 27 word integer array.
Definition w3fi69.f:29