27 use xml_perl_data,
only:
param_t
28 use ctlblk_mod,
only: lsm, spl, nsoil, isf_surface_physics, nfd, htfd, &
29 petabnd, nbnd, ifi_nflight, ifi_flight_levels
30 use soil,
only: sldpth,sllevel
31 use rqstfld_mod,
only : mxlvl,lvls,lvlsxml
34 type(
param_t),
intent(inout) :: param
35 integer,
intent(in) :: ifld
36 integer,
intent(inout) :: irec
37 integer,
intent(in) :: kpv
38 real,
intent(in) :: pv(1:kpv)
39 integer,
intent(in) :: kth
40 real,
intent(in) :: th(1:kth)
42 real,
parameter :: small=1.e-5
43 real,
parameter :: small1=1.e-3
44 real,
parameter :: small2=1
45 integer,
parameter :: LSIG1=22,lsig2=5
46 integer i,j,l,nlevel,scalef,lvlcape,lvlcin
47 logical READTHK,logrec,found
48 REAL :: SIGO2(LSIG2+1),ASIGO2(LSIG2),DSIGO2(LSIG2)
49 REAL :: SIGO1(LSIG1+1),ASIGO1(LSIG1),DSIGO1(LSIG1)
53 nlevel=
size(param%level)
63 if(trim(param%fixed_sfc1_type)==
'isobaric_sfc')
then
64 if(index(param%shortname,
"ON_ICAO_STD_SFC")<=0)
then
68 if(abs(param%level(j)-spl(i))<small1)
then
87 if(trim(param%fixed_sfc1_type)==
'hybrid_lvl')
then
90 if(nint(param%level(j))==i)
then
101 if(trim(param%fixed_sfc1_type)==
'depth_bel_land_sfc'.and. &
102 trim(param%fixed_sfc2_type)==
'depth_bel_land_sfc' )
then
106 iloop2:
do i=1, nsoil
107 if(isf_surface_physics ==3)
then
108 if(nint(param%level(j))==nint(sllevel(i)*100.))
then
115 if(nint(param%level2(j))==nint(sum(sldpth(1:i))*100.) )
then
128 if(trim(param%fixed_sfc1_type)==
'pot_vort_sfc')
then
130 scalef=param%scale_fact_fixed_sfc1(j)-6
131 if(param%scale_fact_fixed_sfc1(j)<6) scalef=0
133 if(pv(i)/=0.and.abs(param%level(j)*10.**(-1*scalef)-pv(i))<=1.e-5)
then
149 if(trim(param%fixed_sfc1_type)==
'isentropic_lvl')
then
153 if(th(i)/=0.and.abs(param%level(j)-th(i))<=1.e-5)
then
168 if(trim(param%fixed_sfc1_type)==
'spec_alt_above_mean_sea_lvl')
then
169 if(index(param%shortname,
"SPECIFIC_IFI_FLIGHT_LEVEL")>0)
then
172 iloop411:
do i=1, ifi_nflight
173 if(nint(param%level(j)/10)==nint(ifi_flight_levels(i)/10) )
then
183 write(*,*)
'ERROR: No such IFI flight level: ',param%level(j)/10
187 else if(index(param%shortname,
"IFI_FLIGHT_LEVEL")>0)
then
194 elseif(index(param%shortname,
"GTG_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL")<=0)
then
197 if(nint(param%level(j))==nint(htfd(i)) )
then
198 if(htfd(i)>300.)
then
222 if(trim(param%fixed_sfc1_type)==
'spec_pres_above_grnd')
then
224 if(trim(param%shortname)==
"MIXED_LAYER_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
225 trim(param%shortname)==
"MIXED_LAYER_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
229 param%level(1)=nint(petabnd(3)+15.)*100
230 param%level2(1)=nint(petabnd(1)-15.)*100
231 else if (trim(param%shortname)==
"UNSTABLE_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
232 trim(param%shortname)==
"UNSTABLE_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
238 else if (trim(param%shortname)==
"BEST_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
239 trim(param%shortname)==
"BEST_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
244 param%level(1)=nint(petabnd(nbnd)+15.)*100
245 param%level2(1)=nint(petabnd(1)-15.)*100
249 if(nint(param%level(j)/100.)==nint(petabnd(i)+15.))
then
257 if(nint(param%level(j)/100.) == 255)
then
263 if(.not.logrec.and.nlevel==1)
then
272 if(trim(param%fixed_sfc1_type)==
'spec_hgt_lvl_above_grnd')
then
273 if(index(param%shortname,
"SPEC_HGT_LVL_ABOVE_GRND_FDHGT")>0)
then
276 if(nint(param%level(j))==nint(htfd(i)) )
then
295 if(trim(param%shortname)==
'TMP_ON_SIGMA_LVL_HPC')
then
301 sigo2(l)=sigo2(l-1)+dsigo2(lsig2-l+2)
305 asigo2(l)=0.5*(sigo2(l)+sigo2(l+1))
317 if(abs(param%level(j)-asigo2(i)*10000)<small1)
then
329 if(index(trim(param%shortname),
'SIGMA_LVLS')>0)
then
335 sigo1(l)=sigo1(l-1)+dsigo1(lsig1-l+2)
339 asigo1(l)=0.5*(sigo1(l)+sigo1(l+1))
393 if(abs(param%level(j)-asigo1(i)*10000)<small1)
then
subroutine set_lvlsxml(param, ifld, irec, kpv, pv, kth, th)
Sets field levels (LVLS and LVLSXML) from POST xml CONTROL FILE requested fields.