NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
r63w72.f
Go to the documentation of this file.
1C> @file
2C> @brief Convert w3fi63() parms to w3fi72() parms.
3C> @author Mark Iredell @date 1992-10-31
4
5C> Determines the integer PDS and GDS parameters
6C> for the GRIB1 packing routine w3fi72() given the parameters
7C> returned from the GRIB1 unpacking routine w3fi63().
8C>
9C> Program history log:
10C> - Mark Iredell 1991-10-31
11C> - Mark Iredell 1996-05-03 Corrected some level types and
12C> some data representation types
13C> - Mark Iredell 1997-02-14 Only altered ipds(26:27) for extended pds
14C> - Chris Caruso 1998-06-01 Y2K fix for year of century
15C> - Diane Stoken 2005-05-06 Recognize level 236
16C>
17C> @note kgds and igds extend beyond their dimensions here
18C> if pl parameters are present.
19C>
20C> @param[in] kpds integer (200) PDS parameters from w3fi63().
21C> @param[in] kgds integer (200) GDS parameters from w3fi63().
22C> @param[out] ipds integer (200) PDS parameters for w3fi72().
23C> @param[out] igds integer (200) GDS parameters for w3fi72().
24C>
25C> @author Mark Iredell @date 1992-10-31
26 SUBROUTINE r63w72(KPDS,KGDS,IPDS,IGDS)
27 dimension kpds(200),kgds(200),ipds(200),igds(200)
28
29C DETERMINE PRODUCT DEFINITION SECTION (PDS) PARAMETERS
30 IF(kpds(23).NE.2) THEN
31 ipds(1)=28 ! LENGTH OF PDS
32 ELSE
33 ipds(1)=45 ! LENGTH OF PDS
34 ENDIF
35 ipds(2)=kpds(19) ! PARAMETER TABLE VERSION
36 ipds(3)=kpds(1) ! ORIGINATING CENTER
37 ipds(4)=kpds(2) ! GENERATING MODEL
38 ipds(5)=kpds(3) ! GRID DEFINITION
39 ipds(6)=mod(kpds(4)/128,2) ! GDS FLAG
40 ipds(7)=mod(kpds(4)/64,2) ! BMS FLAG
41 ipds(8)=kpds(5) ! PARAMETER INDICATOR
42 ipds(9)=kpds(6) ! LEVEL TYPE
43 IF(kpds(6).EQ.101.OR.kpds(6).EQ.104.OR.kpds(6).EQ.106.OR.
44 & kpds(6).EQ.108.OR.kpds(6).EQ.110.OR.kpds(6).EQ.112.OR.
45 & kpds(6).EQ.114.OR.kpds(6).EQ.116.OR.kpds(6).EQ.121.OR.
46 & kpds(6).EQ.128.OR.kpds(6).EQ.141.OR.kpds(6).EQ.236) THEN
47 ipds(10)=mod(kpds(7)/256,256) ! LEVEL VALUE 1
48 ipds(11)=mod(kpds(7),256) ! LEVEL VALUE 2
49 ELSE
50 ipds(10)=0 ! LEVEL VALUE 1
51 ipds(11)=kpds(7) ! LEVEL VALUE 2
52 ENDIF
53 ipds(12)=kpds(8) ! YEAR OF CENTURY
54 ipds(13)=kpds(9) ! MONTH
55 ipds(14)=kpds(10) ! DAY
56 ipds(15)=kpds(11) ! HOUR
57 ipds(16)=kpds(12) ! MINUTE
58 ipds(17)=kpds(13) ! FORECAST TIME UNIT
59 ipds(18)=kpds(14) ! TIME RANGE 1
60 ipds(19)=kpds(15) ! TIME RANGE 2
61 ipds(20)=kpds(16) ! TIME RANGE INDICATOR
62 ipds(21)=kpds(17) ! NUMBER IN AVERAGE
63 ipds(22)=kpds(20) ! NUMBER MISSING IN AVERAGE
64 ipds(23)=kpds(21) ! CENTURY
65 ipds(24)=kpds(23) ! SUBCENTER
66 ipds(25)=kpds(22) ! DECIMAL SCALING
67 IF(ipds(1).GT.28) THEN
68 ipds(26)=0 ! PDS BYTE 29
69 ipds(27)=0 ! PDS BYTE 30
70 ENDIF
71
72C DETERMINE GRID DEFINITION SECTION (GDS) PARAMETERS
73 igds(1)=kgds(19) ! NUMBER OF VERTICAL COORDINATES
74 igds(2)=kgds(20) ! VERTICAL COORDINATES
75 igds(3)=kgds(1) ! DATA REPRESENTATION
76 igds(4)=kgds(2) ! (UNIQUE TO REPRESENTATION)
77 igds(5)=kgds(3) ! (UNIQUE TO REPRESENTATION)
78 igds(6)=kgds(4) ! (UNIQUE TO REPRESENTATION)
79 igds(7)=kgds(5) ! (UNIQUE TO REPRESENTATION)
80 igds(8)=kgds(6) ! (UNIQUE TO REPRESENTATION)
81 igds(9)=kgds(7) ! (UNIQUE TO REPRESENTATION)
82 igds(10)=kgds(8) ! (UNIQUE TO REPRESENTATION)
83 igds(11)=kgds(9) ! (UNIQUE TO REPRESENTATION)
84 igds(12)=kgds(10) ! (UNIQUE TO REPRESENTATION)
85 igds(13)=kgds(11) ! (UNIQUE TO REPRESENTATION)
86 igds(14)=kgds(12) ! (UNIQUE TO REPRESENTATION)
87 igds(15)=kgds(13) ! (UNIQUE TO REPRESENTATION)
88 igds(16)=kgds(14) ! (UNIQUE TO REPRESENTATION)
89 igds(17)=kgds(15) ! (UNIQUE TO REPRESENTATION)
90 igds(18)=kgds(16) ! (UNIQUE TO REPRESENTATION)
91C EXCEPTIONS FOR LATLON OR GAUSSIAN
92 IF(kgds(1).EQ.0.OR.kgds(1).EQ.4) THEN
93 igds(11)=kgds(10)
94 igds(12)=kgds(9)
95C EXCEPTIONS FOR MERCATOR
96 ELSEIF(kgds(1).EQ.1) THEN
97 igds(11)=kgds(13)
98 igds(12)=kgds(12)
99 igds(13)=kgds(9)
100 igds(14)=kgds(11)
101C EXCEPTIONS FOR LAMBERT CONFORMAL
102 ELSEIF(kgds(1).EQ.3) THEN
103 igds(15)=kgds(12)
104 igds(16)=kgds(13)
105 igds(17)=kgds(14)
106 igds(18)=kgds(15)
107 ENDIF
108C EXTENSION FOR PL PARAMETERS
109 IF(kgds(1).EQ.0.AND.kgds(19).EQ.0.AND.kgds(20).NE.255) THEN
110 DO j=1,kgds(3)
111 igds(18+j)=kgds(21+j)
112 ENDDO
113 ENDIF
114
115 RETURN
116 END
subroutine r63w72(kpds, kgds, ipds, igds)
Determines the integer PDS and GDS parameters for the GRIB1 packing routine w3fi72() given the parame...
Definition r63w72.f:27