UPP (develop)
Loading...
Searching...
No Matches
xml_perl_data.f
Go to the documentation of this file.
1 module xml_perl_data
2!------------------------------------------------------------------------
14!------------------------------------------------------------------------
19!
20 implicit none
21!
25 integer :: nfcst,nbc,list,iout,ntstm, &
28
33 integer :: post_avblfldidx=-9999
34 character(len=80) :: shortname=''
35 character(len=300) :: longname=''
36 integer :: mass_windpoint=1
37 character(len=30) :: pdstmpl='tmpl4_0'
38 character(len=30) :: pname=''
39 character(len=10) :: table_info=''
40 character(len=80) :: stats_proc=''
41 character(len=80) :: fixed_sfc1_type=''
42 integer, dimension(:), pointer :: scale_fact_fixed_sfc1 => null()
43 real, dimension(:), pointer :: level => null()
44 character(len=80) :: fixed_sfc2_type=''
45 integer, dimension(:), pointer :: scale_fact_fixed_sfc2 => null()
46 real, dimension(:), pointer :: level2 => null()
47 character(len=80) :: aerosol_type=''
48 character(len=80) :: prob_type=''
49 character(len=80) :: typ_intvl_size=''
50 integer :: scale_fact_1st_size=0
51 real :: scale_val_1st_size=0.0
52 integer :: scale_fact_2nd_size=0
53 real :: scale_val_2nd_size=0.0
54 character(len=80) :: typ_intvl_wvlen=''
55 integer :: scale_fact_1st_wvlen=0
56 real :: scale_val_1st_wvlen=0.0
57 integer :: scale_fact_2nd_wvlen=0
58 real :: scale_val_2nd_wvlen=0.0
59 integer :: scale_fact_lower_limit=0
60 real :: scale_val_lower_limit=0.0
61 integer :: scale_fact_upper_limit=0
62 real :: scale_val_upper_limit=0.0
63 real, dimension(:), pointer :: scale => null()
64 integer :: stat_miss_val=0
65 integer :: leng_time_range_prev=0
66 integer :: time_inc_betwn_succ_fld=0
67 character(len=80) :: type_of_time_inc=''
68 character(len=20) :: stat_unit_time_key_succ=''
69 character(len=20) :: bit_map_flag=''
70 end type param_t
72
77 character(len=20) :: datset=''
78 integer :: grid_num=255
79 character(len=20) :: sub_center=''
80 character(len=20) :: version_no=''
81 character(len=20) :: local_table_vers_no=''
82 character(len=20) :: sigreftime=''
83 character(len=20) :: prod_status=''
84 character(len=20) :: data_type=''
85 character(len=20) :: gen_proc_type=''
86 character(len=30) :: time_range_unit=''
87 character(len=50) :: orig_center=''
88 character(len=30) :: gen_proc=''
89 character(len=50) :: packing_method=''
90 character(len=30) :: order_of_sptdiff='1st_ord_sptdiff'
91 character(len=20) :: field_datatype=''
92 character(len=30) :: comprs_type=''
97 character(len=50) :: type_ens_fcst=''
98 character(len=50) :: type_derived_fcst=''
99 type(param_t), dimension(:), pointer :: param => null()
100 end type paramset_t
106 type(param_t), dimension(:), pointer :: param => null()
107 end type post_avblfld_t
109
113 type (paramset_t), dimension(:), pointer :: paramset
116 contains
118 subroutine read_postxconfig()
119
120 use rqstfld_mod,only: num_post_afld,mxlvl,lvlsxml
121 use ctlblk_mod, only:tprec,tclod,trdlw,trdsw,tsrfc &
122 ,tmaxmin,td3d,me,filenameflat
123 implicit none
124
125! Read in the flat file postxconfig-NT.txt
126! for current working parameters and param
127 integer paramset_count, param_count
128
129! temp array count
130 integer cc
131 integer level_array_count
132 integer cv
133 integer level2_array_count
134 integer scale_array_count
135 integer i,j
136
137! evil for empty default char "?"
138 character(len=80) testcharname
139 character dummy_char
140 integer testintname
141
142! open the Post flat file
143! open(UNIT=22,file="postxconfig-NT.txt", &
144 open(unit=22,file=trim(filenameflat), &
145 form="formatted", access="sequential", &
146 status="old", position="rewind")
147
148! Take the first line as paramset_count
149 read(22,*)paramset_count
150
151! Allocate paramset array size
152 allocate(paramset(paramset_count))
153
154! Take the second line as param_count (on n..1 down loop)
155! stored as FILO
156
157! Initialize num_post_afld here
158 num_post_afld = 0
159
160 do i = paramset_count, 1, -1
161 read(22,*)param_count
162
163 allocate(paramset(i)%param(param_count))
164
165! LinGan lvlsxml is now a sum of flat file read out
166! Also allocate lvlsxml for rqstfld_mod
167 num_post_afld = num_post_afld + param_count
168
169 end do
170
171 if(allocated(lvlsxml)) deallocate(lvlsxml)
172 allocate(lvlsxml(mxlvl,num_post_afld))
173
174! For each paramset_count to read in all 16 control contain
175 do i = 1, paramset_count
176! allocate array size from param for current paramset
177! filter_char_inp is to check if "?" is found
178! then replace to empty string because it means no input.
179 read(22,*)paramset(i)%datset
180 call filter_char_inp(paramset(i)%datset)
181
182 param_count = size (paramset(i)%param)
183
184 read(22,*)paramset(i)%grid_num
185 read(22,*)paramset(i)%sub_center
186 call filter_char_inp(paramset(i)%sub_center)
187 read(22,*)paramset(i)%version_no
188 call filter_char_inp(paramset(i)%version_no)
189 read(22,*)paramset(i)%local_table_vers_no
190 call filter_char_inp(paramset(i)%local_table_vers_no)
191 read(22,*)paramset(i)%sigreftime
192 call filter_char_inp(paramset(i)%sigreftime)
193 read(22,*)paramset(i)%prod_status
194 call filter_char_inp(paramset(i)%prod_status)
195 read(22,*)paramset(i)%data_type
196 call filter_char_inp(paramset(i)%data_type)
197 read(22,*)paramset(i)%gen_proc_type
198 call filter_char_inp(paramset(i)%gen_proc_type)
199 read(22,*)paramset(i)%time_range_unit
200 call filter_char_inp(paramset(i)%time_range_unit)
201 read(22,*)paramset(i)%orig_center
202 call filter_char_inp(paramset(i)%orig_center)
203 read(22,*)paramset(i)%gen_proc
204 call filter_char_inp(paramset(i)%gen_proc)
205 read(22,*)paramset(i)%packing_method
206 call filter_char_inp(paramset(i)%packing_method)
207 read(22,*)paramset(i)%order_of_sptdiff
208 read(22,*)paramset(i)%field_datatype
209 call filter_char_inp(paramset(i)%field_datatype)
210 read(22,*)paramset(i)%comprs_type
211 call filter_char_inp(paramset(i)%comprs_type)
212 if(paramset(i)%gen_proc_type=='ens_fcst')then
213 read(22,*)paramset(i)%type_ens_fcst
214 call filter_char_inp(paramset(i)%type_ens_fcst)
215 tprec = 6 ! always 6 hr bucket for gefs
216 tclod = tprec
217 trdlw = tprec
218 trdsw = tprec
219 tsrfc = tprec
220 tmaxmin = tprec
221 td3d = tprec
222 end if
223! Loop param_count (param datas 161) for gfsprs
224 do j = 1, param_count
225 read(22,*)paramset(i)%param(j)%post_avblfldidx
226 read(22,*)paramset(i)%param(j)%shortname
227 read(22,'(A300)')paramset(i)%param(j)%longname
228 call filter_char_inp(paramset(i)%param(j)%longname)
229
230 read(22,*)paramset(i)%param(j)%mass_windpoint
231 read(22,*)paramset(i)%param(j)%pdstmpl
232 read(22,*)paramset(i)%param(j)%pname
233 call filter_char_inp(paramset(i)%param(j)%pname)
234
235 read(22,*)paramset(i)%param(j)%table_info
236 call filter_char_inp(paramset(i)%param(j)%table_info)
237 read(22,*)paramset(i)%param(j)%stats_proc
238 call filter_char_inp(paramset(i)%param(j)%stats_proc)
239 read(22,*)paramset(i)%param(j)%fixed_sfc1_type
240 call filter_char_inp(paramset(i)%param(j)%fixed_sfc1_type)
241! Read array count for scale_fact_fixed_sfc1
242 read(22,*)cc
243!
244 allocate( paramset(i)%param(j)%scale_fact_fixed_sfc1(1))
245
246 if (cc > 0) then
247!
248 deallocate( paramset(i)%param(j)%scale_fact_fixed_sfc1)
249
250 allocate( paramset(i)%param(j)%scale_fact_fixed_sfc1(cc))
251 read(22,*)paramset(i)%param(j)%scale_fact_fixed_sfc1
252 else
253! If array count is zero dummy out the line
254!
255 paramset(i)%param(j)%scale_fact_fixed_sfc1(1)=0
256
257 read(22,*)dummy_char
258 endif
259
260 read(22,*)level_array_count
261 allocate( paramset(i)%param(j)%level(1))
262 if (level_array_count > 0) then
263 deallocate( paramset(i)%param(j)%level)
264 allocate( paramset(i)%param(j)%level(level_array_count))
265 read(22,*)paramset(i)%param(j)%level
266 else
267 paramset(i)%param(j)%level(1)=0
268 read(22,*)dummy_char
269 endif
270
271 read(22,*)paramset(i)%param(j)%fixed_sfc2_type
272 call filter_char_inp(paramset(i)%param(j)%fixed_sfc2_type)
273 read(22,*)cv
274 allocate( paramset(i)%param(j)%scale_fact_fixed_sfc2(1))
275 if (cv > 0) then
276 deallocate(paramset(i)%param(j)%scale_fact_fixed_sfc2)
277 allocate(paramset(i)%param(j)%scale_fact_fixed_sfc2(cv))
278 read(22,*)paramset(i)%param(j)%scale_fact_fixed_sfc2
279 else
280 paramset(i)%param(j)%scale_fact_fixed_sfc2(1)=0
281 read(22,*)dummy_char
282 endif
283
284 read(22,*)level2_array_count
285 if (level2_array_count > 0) then
286 allocate(paramset(i)%param(j)%level2(level2_array_count))
287 read(22,*)paramset(i)%param(j)%level2
288 else
289 read(22,*)dummy_char
290 endif
291
292 read(22,*)paramset(i)%param(j)%aerosol_type
293 call filter_char_inp(paramset(i)%param(j)%aerosol_type)
294 read(22,*)paramset(i)%param(j)%prob_type
295 call filter_char_inp(paramset(i)%param(j)%prob_type)
296 read(22,*)paramset(i)%param(j)%typ_intvl_size
297 call filter_char_inp(paramset(i)%param(j)%typ_intvl_size)
298
299 read(22,*)paramset(i)%param(j)%scale_fact_1st_size
300 read(22,*)paramset(i)%param(j)%scale_val_1st_size
301 read(22,*)paramset(i)%param(j)%scale_fact_2nd_size
302 read(22,*)paramset(i)%param(j)%scale_val_2nd_size
303 read(22,*)paramset(i)%param(j)%typ_intvl_wvlen
304 call filter_char_inp(paramset(i)%param(j)%typ_intvl_wvlen)
305
306 read(22,*)paramset(i)%param(j)%scale_fact_1st_wvlen
307 read(22,*)paramset(i)%param(j)%scale_val_1st_wvlen
308 read(22,*)paramset(i)%param(j)%scale_fact_2nd_wvlen
309 read(22,*)paramset(i)%param(j)%scale_val_2nd_wvlen
310 read(22,*)paramset(i)%param(j)%scale_fact_lower_limit
311 read(22,*)paramset(i)%param(j)%scale_val_lower_limit
312 read(22,*)paramset(i)%param(j)%scale_fact_upper_limit
313 read(22,*)paramset(i)%param(j)%scale_val_upper_limit
314 read(22,*)scale_array_count
315 allocate(paramset(i)%param(j)%scale(1))
316 if (scale_array_count > 0) then
317 deallocate(paramset(i)%param(j)%scale)
318 allocate(paramset(i)%param(j)%scale(scale_array_count))
319 read(22,*)paramset(i)%param(j)%scale
320 else
321 paramset(i)%param(j)%scale(1)=0
322 read(22,*)dummy_char
323 endif
324 read(22,*)paramset(i)%param(j)%stat_miss_val
325 read(22,*)paramset(i)%param(j)%leng_time_range_prev
326 read(22,*)paramset(i)%param(j)%time_inc_betwn_succ_fld
327 read(22,*)paramset(i)%param(j)%type_of_time_inc
328
329 call filter_char_inp(paramset(i)%param(j)%type_of_time_inc)
330 read(22,*)paramset(i)%param(j)%stat_unit_time_key_succ
331 call filter_char_inp(paramset(i)%param(j)%stat_unit_time_key_succ)
332 read(22,*)paramset(i)%param(j)%bit_map_flag
333 call filter_char_inp(paramset(i)%param(j)%bit_map_flag)
334
335! End of reading param
336 end do
337
338 post_avblflds%param => paramset(i)%param
339
340! End of reading paramset
341 end do
342 close (unit=22)
343
344 end subroutine read_postxconfig
345
348 subroutine filter_char_inp (inpchar)
349 implicit none
350 character, intent(inout) :: inpchar
351 if (inpchar == "?") then
352 inpchar = ""
353 endif
354 end subroutine filter_char_inp
355
356 end module
integer ntstm
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer ncp
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer iout
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
type(post_avblfld_t), save post_avblflds
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
type(paramset_t), dimension(:), pointer paramset
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer nboco
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer nshde
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer nradl
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer list
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer idtad
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer imdlty
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer nddamp
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer nbc
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer nfcst
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
integer nrads
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...
Parameters that are used to read in Perl XML processed flat file and handle parameter marshalling for...