1module bufr_mod
2 ! MODULE bufr_mod (prefix='bufr' category='8. Low-level utilities and constants')
3 !
4 !:Purpose: This module is a holder for information that is needed from *the
5 ! Binary Universal Form for the Representation of meteorological
6 ! data* (BUFR), maintained by the World Meteorological Organization.
7 !
8 !
9 !:Routines:
10 !
11 ! - bufr_IsAtmosConstituent: determines if observation is
12 ! constituent/chemistry data
13 !
14 ! - bufr_IsIntegral: determines if vertical integral measurement
15 !
16 ! - bufr_isWindComponent: determines if a wind component variable
17 !
18 ! - bufr_isOceanObs: determines if it is an ocean observation
19 !
20 public
21
22 ! Table B:
23 ! Universal Field-Identity Numbers
24 ! (At the CMC, these have also been known as burp_id.)
25 !
26 ! Use the program codbuf to find out the meaning of these IDs.
27 !
28 integer, parameter :: bufr_suWindSpeed = 08194 ! source and units of wind speed IW, code 1855, code table
29 integer, parameter :: BUFR_NETT = 12001
30 integer, parameter :: BUFR_NEUU = 11003
31 integer, parameter :: BUFR_NEVV = 11004
32 integer, parameter :: BUFR_NEGZ = 10194
33 integer, parameter :: BUFR_NEES = 12192
34 integer, parameter :: BUFR_NEFF = 11002
35 integer, parameter :: BUFR_NEDD = 11001
36 integer, parameter :: BUFR_NEUS = 11215
37 integer, parameter :: BUFR_NEVS = 11216
38 integer, parameter :: BUFR_NETS = 12004
39 integer, parameter :: BUFR_NESS = 12203
40 integer, parameter :: BUFR_NEFS = 11012
41 integer, parameter :: BUFR_NEDS = 11011
42 integer, parameter :: BUFR_NEDZ = 10192
43 integer, parameter :: BUFR_NEPP = 07004
44 integer, parameter :: BUFR_NEPS = 10004
45 integer, parameter :: BUFR_NEPN = 10051
46 integer, parameter :: bufr_dewPoint2m = 12006 ! Dewpoint temperature at 2m
47 integer, parameter :: BUFR_NBT1 = 12062
48 integer, parameter :: BUFR_NBT2 = 12063
49 integer, parameter :: BUFR_NBT3 = 12163
50 integer, parameter :: BUFR_NEBD = 15037
51 integer, parameter :: BUFR_NERF = 15036
52 integer, parameter :: BUFR_NEHU = 13210
53 integer, parameter :: BUFR_NEHS = 13220
54 integer, parameter :: BUFR_NEZD = 15031
55 integer, parameter :: BUFR_NEFE = 15032
56 integer, parameter :: BUFR_NEZW = 15035
57 integer, parameter :: BUFR_ZTDSCORE = 40026
58 integer, parameter :: BUFR_NEAZ = 05021
59 integer, parameter :: BUFR_NEAL = 40030 ! aladin HLOS wind
60 integer, parameter :: BUFR_NEDWDP = 40032 ! derivative of HLOS wrt P
61 integer, parameter :: BUFR_NEDWDT = 40033 ! derivative of HLOS wrt T
62 integer, parameter :: BUFR_NEDW = 11200 ! Doppler wind
63 integer, parameter :: BUFR_radarPrecip = 21036 ! radar precipitation
64 integer, parameter :: BUFR_logRadarPrecip = 51036 ! radar precipitation
65 integer, parameter :: bufr_sst = 22042 ! sea/water temperature
66 integer, parameter :: bufr_soz = 07025
67 integer, parameter :: BUFR_ICEC = 20237 ! concentration (%) from ice charts
68 integer, parameter :: BUFR_ICEP = 20222 ! concentration (%) from passive microwave retrievals
69 integer, parameter :: BUFR_ICEV = 21169 ! presence of ice retrieval from Vis/IR
70 integer, parameter :: BUFR_ICES = 21199 ! backscatter anisotropy from scatterometer
71 integer, parameter :: bufr_vis = 20001 ! horizontal visibility
72 integer, parameter :: bufr_logVis = 50001 ! log(horizontal visibility)
73 integer, parameter :: bufr_gust = 11041
74 integer, parameter :: bufr_riverFlow = 23040
75 integer, parameter :: bufr_cloudInSeg = 20081
76 integer, parameter :: bufr_radvel = 21014 ! Doppler velocity (Radial Wind)
77
78 !
79 ! Table C-14: (for Code Table 08046)
80 ! Atmospheric chemical or physical constituent type
81 ! - Includes local values as well!
82 integer, parameter :: BUFR_NECH_O3 =0
83 integer, parameter :: BUFR_NECH_H2O =1
84 integer, parameter :: BUFR_NECH_CH4 =2
85 integer, parameter :: BUFR_NECH_CO2 =3
86 integer, parameter :: BUFR_NECH_CO =4
87 integer, parameter :: BUFR_NECH_NO2 =5
88 integer, parameter :: BUFR_NECH_N2O =6
89 integer, parameter :: BUFR_NECH_HCHO =7
90 integer, parameter :: BUFR_NECH_SO2 =8
91 integer, parameter :: BUFR_NECH_NH3 =9
92 integer, parameter :: BUFR_NECH_NO =11
93 integer, parameter :: BUFR_NECH_PM25 =26
94 integer, parameter :: BUFR_NECH_PM10 =27
95
96 ! Table B elements associated to constituents/chemistry
97 ! -----------------------------------------------------
98 !
99 ! Element denoting exponents accompanying obs bufr element
100 integer, parameter :: BUFR_SCALE_EXPONENT = 8090
101
102 ! Element used for denoting averaging kernel elements
103 integer, parameter :: BUFR_AVGKERN = 25143
104
105 ! Element denoting error correlation matrix elements
106 integer, parameter :: BUFR_CORREL = 33205
107
108 ! Elements for units of constituent observations
109 !
110 ! When needed, used in tandem with BUFR_NECH_* identifying the consituent
111 ! and BUFR_SCALE_EXPONENT when the input file contains an exponent for
112 ! a power ten scale factor.
113 !
114 ! For some units, multiple BUFR are available, some originally defined to
115 ! be specific to certain constituents and some being local elements devised
116 ! prior to official elements being assigned. While a single set would be
117 ! sufficient, all are included for completeness. A sufficient set might be
118 ! 15008,15026,13002,15022,15207,15027,15003,15029,15198,15201,15021,15202,15024,15028.
119
120 integer, parameter :: BUFR_UNIT_VMR = 15008 ! Volume mixing ratio (vmr)
121 integer, parameter :: BUFR_UNIT_VMR2 = 15208 ! Volume mixing ratio
122 integer, parameter :: BUFR_UNIT_MolePerMole = 15026 ! Pollutant concentration (mole/mole)
123 integer, parameter :: BUFR_UNIT_MolePerMole2 = 15197 ! Mixing ratio (mole/mole)
124 integer, parameter :: BUFR_UNIT_MMR = 13002 ! Mass mixing ratio (kg/kg)
125 integer, parameter :: BUFR_UNIT_MMR2 = 13001 ! Humidity mass mixing ratio (kg/kg) - same as above
126 integer, parameter :: BUFR_UNIT_NumberDensity = 15207 ! Number density (1/m^3)
127 integer, parameter :: BUFR_UNIT_MolarDensity = 15230 ! Molar density (mole/m^3)
128 integer, parameter :: BUFR_UNIT_Density = 15027 ! Concentration in kg/m^3
129 integer, parameter :: BUFR_UNIT_Density2 = 15223 ! Concentration = Density (kg/m^3)
130 integer, parameter :: BUFR_UNIT_AirDensity = 15194 ! Air density (kg/m^3)
131 integer, parameter :: BUFR_UNIT_PMDensity = 15195 ! Density of PM2.5 (kg/m^3)
132 integer, parameter :: BUFR_UNIT_PartPress = 15003 ! Partial pressure in Pa (not just for ozone)
133 integer, parameter :: BUFR_UNIT_PartPress2 = 15199 ! Partial pressure in Pa (same as above)
134 integer, parameter :: BUFR_UNIT_MR_NVaerosol = 15055 ! Non-volatile aerosol mixing ratio (unitless)
135 integer, parameter :: BUFR_UNIT_ExtinctCoef = 15029 ! Extinction coefficient (1/m)
136
137 ! The following elements are all vertically integrated quantities
138
139 integer, parameter :: BUFR_UNIT_DU = 15198 ! Integrate number density in Dobson units DU
140 integer, parameter :: BUFR_UNIT_DU2 = 15001 ! Total ozone in DU (same as above) - applicable for all
141 integer, parameter :: BUFR_UNIT_DU3 = 15005 ! Partial column for ozone in DU (same as above) - applicable for all
142 integer, parameter :: BUFR_UNIT_DU4 = 15045 ! Partial column for SO2 in DU (same as above) - applicable for all
143 integer, parameter :: BUFR_UNIT_IntegND = 15201 ! Integrated number density (1/m^2)
144 integer, parameter :: BUFR_UNIT_IntegND2 = 15012 ! Electron density per m^2 (1/m^2)
145 integer, parameter :: BUFR_UNIT_IntegDens = 15021 ! Integrated density (kg/m^2)
146 integer, parameter :: BUFR_UNIT_IntegDens2 = 15020 ! Integrated density for ozone (kg/m^2; same as above) - applicable to all
147 integer, parameter :: BUFR_UNIT_IntegDens3 = 15200 ! Integrated density (kg/m^2)
148 integer, parameter :: BUFR_UNIT_IntegMolarDens = 15202 ! Integrated molar density (mole/m^2)
149
150 integer, parameter :: BUFR_UNIT_OptDepth = 15024 ! Optical depth (unitless)
151 integer, parameter :: BUFR_UNIT_OptDepth2 = 15196 ! Optical depth (unitless)
152 integer, parameter :: BUFR_UNIT_OptDepth3 = 15062 ! Aerosol Optical depth (unitless)
153
154 ! Additional elements associated to chemistry
155
156 integer, parameter :: BUFR_UNIT_PhotoDissoc = 15028 ! Photodissociate rate (1/sec)
157
158 ! ----------------------------------------------
159
160contains
161
162 function bufr_IsAtmosConstituent(varNumber) result(var_chm)
163 !
164 !:Purpose: To determine whether 'varNumber' refers to constituent data from
165 ! the CH family with recognized data units.
166 !
167 implicit none
168
169 ! Arguments:
170 integer, intent(in) :: varNumber ! BUFR element number
171 ! Result:
172 logical :: var_chm
173
174 if (any(varNumber.eq. (/ BUFR_UNIT_VMR, BUFR_UNIT_VMR2, BUFR_UNIT_MolePerMole, BUFR_UNIT_MolePerMole2, &
175 BUFR_UNIT_MMR, BUFR_UNIT_MMR2, BUFR_UNIT_NumberDensity, BUFR_UNIT_MolarDensity, &
176 BUFR_UNIT_Density, BUFR_UNIT_Density2, &
177 BUFR_UNIT_AirDensity, BUFR_UNIT_PMDensity, &
178 BUFR_UNIT_OptDepth, BUFR_UNIT_OptDepth2, BUFR_UNIT_OptDepth3, BUFR_UNIT_MR_NVaerosol, &
179 BUFR_UNIT_PartPress, BUFR_UNIT_PartPress2, &
180 BUFR_UNIT_DU, BUFR_UNIT_DU2, BUFR_UNIT_DU3, BUFR_UNIT_DU4, &
181 BUFR_UNIT_IntegND, BUFR_UNIT_IntegND2, &
182 BUFR_UNIT_IntegDens, BUFR_UNIT_IntegDens2, BUFR_UNIT_IntegDens3, &
183 BUFR_UNIT_IntegMolarDens, BUFR_UNIT_ExtinctCoef, BUFR_UNIT_PhotoDissoc /) )) then
184 var_chm=.true.
185 else
186 var_chm=.false.
187 end if
188
189 end function bufr_IsAtmosConstituent
190
191
192 logical function bufr_IsIntegral(varNumber)
193 !
194 !:Purpose: To identify whether obs is a vertically integrated constituent
195 ! measurement.
196 !
197 implicit none
198
199 ! Arguments:
200 integer, intent(in) :: varNumber ! BUFR element number
201
202 if (any(varNumber .eq. (/ BUFR_UNIT_DU, BUFR_UNIT_DU2, BUFR_UNIT_DU3, BUFR_UNIT_DU4, &
203 BUFR_UNIT_IntegND, BUFR_UNIT_IntegND2, BUFR_UNIT_IntegDens, &
204 BUFR_UNIT_IntegDens2, BUFR_UNIT_IntegDens3, BUFR_UNIT_IntegMolarDens /) )) then
205 bufr_IsIntegral=.true.
206 else
207 bufr_IsIntegral=.false.
208 end if
209
210 end function bufr_IsIntegral
211
212
213 logical function bufr_isWindComponent(varNumber)
214 !
215 !:Purpose: True if the variable is a wind component
216 !
217 implicit none
218
219 ! Arguments:
220 integer, intent(in) :: varNumber ! BUFR element number
221
222 select case(varNumber)
223 case(BUFR_NEUU, BUFR_NEVV, BUFR_NEUS, BUFR_NEVS)
224 bufr_isWindComponent=.true.
225 case default
226 bufr_isWindComponent=.false.
227 end select
228
229 end function bufr_isWindComponent
230
231
232 logical function bufr_isOceanObs(varNumber)
233 !
234 !:Purpose: True if the variable is an ocean observation
235 !
236 implicit none
237
238 ! Arguments:
239 integer, intent(in) :: varNumber ! BUFR element number
240
241 select case(varNumber)
242 case(BUFR_SST)
243 bufr_isOceanObs = .true.
244 case default
245 bufr_isOceanObs = .false.
246 end select
247
248 end function bufr_isOceanObs
249
250end module bufr_mod