2 !$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 ! PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-01-23
7 ! ABSTRACT: This Fortran Module contains the declaration
8 ! of derived type gribfield.
9 ! If variable gfld is declared of type gribfield
10 ! ( i.e. TYPE(GRIBFIELD) :: GFLD ), it would have the following componenets:
12 ! gfld%version = GRIB edition number ( currently 2 )
13 ! gfld%discipline = Message Discipline ( see Code Table 0.0 )
14 ! gfld%idsect() = Contains the entries in the Identification
15 ! Section ( Section 1 )
16 ! This element is actually a pointer to an array
17 ! that holds the data.
18 ! gfld%idsect(1) = Identification of originating Centre
19 ! ( see Common Code Table C-1 )
20 ! 7 - US National Weather Service
21 ! gfld%idsect(2) = Identification of originating Sub-centre
22 ! gfld%idsect(3) = GRIB Master Tables Version Number
23 ! ( see Code Table 1.0 )
25 ! 1 - Initial operational version number
26 ! gfld%idsect(4) = GRIB Local Tables Version Number
27 ! ( see Code Table 1.1 )
28 ! 0 - Local tables not used
29 ! 1-254 - Number of local tables version used
30 ! gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)
32 ! 1 - Start of forecast
33 ! 2 - Verifying time of forecast
34 ! 3 - Observation time
35 ! gfld%idsect(6) = Year ( 4 digits )
36 ! gfld%idsect(7) = Month
37 ! gfld%idsect(8) = Day
38 ! gfld%idsect(9) = Hour
39 ! gfld%idsect(10) = Minute
40 ! gfld%idsect(11) = Second
41 ! gfld%idsect(12) = Production status of processed data
42 ! ( see Code Table 1.3 )
43 ! 0 - Operational products
44 ! 1 - Operational test products
45 ! 2 - Research products
46 ! 3 - Re-analysis products
47 ! gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )
48 ! 0 - Analysis products
49 ! 1 - Forecast products
50 ! 2 - Analysis and forecast products
51 ! 3 - Control forecast products
52 ! 4 - Perturbed forecast products
53 ! 5 - Control and perturbed forecast products
54 ! 6 - Processed satellite observations
55 ! 7 - Processed radar observations
56 ! gfld%idsectlen = Number of elements in gfld%idsect().
57 ! gfld%local() = Pointer to character array containing contents
58 ! of Local Section 2, if included
59 ! gfld%locallen = length of array gfld%local()
60 ! gfld%ifldnum = field number within GRIB message
61 ! gfld%griddef = Source of grid definition (see Code Table 3.0)
62 ! 0 - Specified in Code table 3.1
63 ! 1 - Predetermined grid Defined by originating centre
64 ! gfld%ngrdpts = Number of grid points in the defined grid.
65 ! gfld%numoct_opt = Number of octets needed for each
66 ! additional grid points definition.
67 ! Used to define number of
68 ! points in each row ( or column ) for
70 ! = 0, if using regular grid.
71 ! gfld%interp_opt = Interpretation of list for optional points
72 ! definition. (Code Table 3.11)
73 ! gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)
74 ! gfld%igdtmpl() = Contains the data values for the specified Grid
75 ! Definition Template ( NN=gfld%igdtnum ). Each
76 ! element of this integer array contains an entry (in
77 ! the order specified) of Grid Defintion Template 3.NN
78 ! This element is actually a pointer to an array
79 ! that holds the data.
80 ! gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number of
81 ! entries in Grid Defintion Template 3.NN
82 ! ( NN=gfld%igdtnum ).
83 ! gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This array
84 ! contains the number of grid points contained in
85 ! each row ( or column ). (part of Section 3)
86 ! This element is actually a pointer to an array
87 ! that holds the data. This pointer is nullified
88 ! if gfld%numoct_opt=0.
89 ! gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entries
90 ! in array ideflist. i.e. number of rows ( or columns )
91 ! for which optional grid points are defined. This value
92 ! is set to zero, if gfld%numoct_opt=0.
93 ! gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)
94 ! gfld%ipdtmpl() = Contains the data values for the specified Product
95 ! Definition Template ( N=gfdl%ipdtnum ). Each element
96 ! of this integer array contains an entry (in the
97 ! order specified) of Product Defintion Template 4.N.
98 ! This element is actually a pointer to an array
99 ! that holds the data.
100 ! gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number of
101 ! entries in Product Defintion Template 4.N
102 ! ( N=gfdl%ipdtnum ).
103 ! gfld%coord_list() = Real array containing floating point values
104 ! intended to document the vertical discretisation
105 ! associated to model data on hybrid coordinate
106 ! vertical levels. (part of Section 4)
107 ! This element is actually a pointer to an array
108 ! that holds the data.
109 ! gfld%num_coord = number of values in array gfld%coord_list().
110 ! gfld%ndpts = Number of data points unpacked and returned.
111 ! gfld%idrtnum = Data Representation Template Number
112 ! ( see Code Table 5.0)
113 ! gfld%idrtmpl() = Contains the data values for the specified Data
114 ! Representation Template ( N=gfld%idrtnum ). Each
115 ! element of this integer array contains an entry
116 ! (in the order specified) of Product Defintion
118 ! This element is actually a pointer to an array
119 ! that holds the data.
120 ! gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. number
121 ! of entries in Data Representation Template 5.N
122 ! ( N=gfld%idrtnum ).
123 ! gfld%unpacked = logical value indicating whether the bitmap and
124 ! data values were unpacked. If false,
125 ! gfld%bmap and gfld%fld pointers are nullified.
126 ! gfld%expanded = Logical value indicating whether the data field
127 ! was expanded to the grid in the case where a
128 ! bit-map is present. If true, the data points in
129 ! gfld%fld match the grid points and zeros were
130 ! inserted at grid points where data was bit-mapped
131 ! out. If false, the data values in gfld%fld were
132 ! not expanded to the grid and are just a consecutive
133 ! array of data points corresponding to each value of
135 ! gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )
136 ! 0 = bitmap applies and is included in Section 6.
137 ! 1-253 = Predefined bitmap applies
138 ! 254 = Previously defined bitmap applies to this field
139 ! 255 = Bit map does not apply to this product.
140 ! gfld%bmap() = Logical*1 array containing decoded bitmap,
141 ! if ibmap=0 or ibap=254. Otherwise nullified.
142 ! This element is actually a pointer to an array
143 ! that holds the data.
144 ! gfld%fld() = Array of gfld%ndpts unpacked data points.
145 ! This element is actually a pointer to an array
146 ! that holds the data.
149 ! PROGRAM HISTORY LOG:
152 ! USAGE: use grib_mod
155 ! LANGUAGE: Fortran 90
160 character(len=12) :: G2_VERSION="g2lib-1.0.7"
163 integer :: version,discipline
164 integer,pointer,dimension(:) :: idsect
166 character(len=1),pointer,dimension(:) :: local
169 integer :: griddef,ngrdpts
170 integer :: numoct_opt,interp_opt,num_opt
171 integer,pointer,dimension(:) :: list_opt
172 integer :: igdtnum,igdtlen
173 integer,pointer,dimension(:) :: igdtmpl
174 integer :: ipdtnum,ipdtlen
175 integer,pointer,dimension(:) :: ipdtmpl
177 real,pointer,dimension(:) :: coord_list
178 integer :: ndpts,idrtnum,idrtlen
179 integer,pointer,dimension(:) :: idrtmpl
183 logical*1,pointer,dimension(:) :: bmap
184 real,pointer,dimension(:) :: fld