1 subroutine set_lvlsxml(param,ifld,irec,kpv,pv,kth,th)
49 use xml_perl_data,
only:
param_t
50 use ctlblk_mod,
only: lsm, spl, nsoil, isf_surface_physics, nfd, htfd, &
51 petabnd, nbnd, ifi_nflight, ifi_flight_levels
52 use soil,
only: sldpth,sllevel
53 use rqstfld_mod,
only : mxlvl,lvls,lvlsxml
56 type(param_t),
intent(inout) :: param
57 integer,
intent(in) :: ifld
58 integer,
intent(inout) :: irec
59 integer,
intent(in) :: kpv
60 real,
intent(in) :: pv(1:kpv)
61 integer,
intent(in) :: kth
62 real,
intent(in) :: th(1:kth)
64 real,
parameter :: small=1.e-5
65 real,
parameter :: small1=1.e-3
66 real,
parameter :: small2=1
67 integer,
parameter :: LSIG1=22,lsig2=5
68 integer i,j,l,nlevel,scalef,lvlcape,lvlcin
69 logical READTHK,logrec,found
70 REAL :: SIGO2(LSIG2+1),ASIGO2(LSIG2),DSIGO2(LSIG2)
71 REAL :: SIGO1(LSIG1+1),ASIGO1(LSIG1),DSIGO1(LSIG1)
75 nlevel=
size(param%level)
85 if(trim(param%fixed_sfc1_type)==
'isobaric_sfc')
then
86 if(index(param%shortname,
"ON_ICAO_STD_SFC")<=0)
then
90 if(abs(param%level(j)-spl(i))<small1)
then
109 if(trim(param%fixed_sfc1_type)==
'hybrid_lvl')
then
111 iloop1:
do i=1, mxlvl
112 if(nint(param%level(j))==i)
then
123 if(trim(param%fixed_sfc1_type)==
'depth_bel_land_sfc'.and. &
124 trim(param%fixed_sfc2_type)==
'depth_bel_land_sfc' )
then
128 iloop2:
do i=1, nsoil
129 if(isf_surface_physics ==3)
then
130 if(nint(param%level(j))==nint(sllevel(i)*100.))
then
137 if(nint(param%level2(j))==nint(sum(sldpth(1:i))*100.) )
then
150 if(trim(param%fixed_sfc1_type)==
'pot_vort_sfc')
then
152 scalef=param%scale_fact_fixed_sfc1(j)-6
153 if(param%scale_fact_fixed_sfc1(j)<6) scalef=0
155 if(pv(i)/=0.and.abs(param%level(j)*10.**(-1*scalef)-pv(i))<=1.e-5)
then
171 if(trim(param%fixed_sfc1_type)==
'isentropic_lvl')
then
175 if(th(i)/=0.and.abs(param%level(j)-th(i))<=1.e-5)
then
190 if(trim(param%fixed_sfc1_type)==
'spec_alt_above_mean_sea_lvl')
then
191 if(index(param%shortname,
"SPECIFIC_IFI_FLIGHT_LEVEL")>0)
then
194 iloop411:
do i=1, ifi_nflight
195 if(nint(param%level(j)/10)==nint(ifi_flight_levels(i)/10) )
then
205 write(*,*)
'ERROR: No such IFI flight level: ',param%level(j)/10
209 else if(index(param%shortname,
"IFI_FLIGHT_LEVEL")>0)
then
216 elseif(index(param%shortname,
"GTG_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL")<=0)
then
219 if(nint(param%level(j))==nint(htfd(i)) )
then
220 if(htfd(i)>300.)
then
244 if(trim(param%fixed_sfc1_type)==
'spec_pres_above_grnd')
then
246 if(trim(param%shortname)==
"MIXED_LAYER_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
247 trim(param%shortname)==
"MIXED_LAYER_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
251 param%level(1)=nint(petabnd(3)+15.)*100
252 param%level2(1)=nint(petabnd(1)-15.)*100
253 else if (trim(param%shortname)==
"UNSTABLE_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
254 trim(param%shortname)==
"UNSTABLE_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
260 else if (trim(param%shortname)==
"BEST_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
261 trim(param%shortname)==
"BEST_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
266 param%level(1)=nint(petabnd(nbnd)+15.)*100
267 param%level2(1)=nint(petabnd(1)-15.)*100
271 if(nint(param%level(j)/100.)==nint(petabnd(i)+15.))
then
279 if(nint(param%level(j)/100.) == 255)
then
285 if(.not.logrec.and.nlevel==1)
then
294 if(trim(param%fixed_sfc1_type)==
'spec_hgt_lvl_above_grnd')
then
295 if(index(param%shortname,
"SPEC_HGT_LVL_ABOVE_GRND_FDHGT")>0)
then
298 if(nint(param%level(j))==nint(htfd(i)) )
then
317 if(trim(param%shortname)==
'TMP_ON_SIGMA_LVL_HPC')
then
323 sigo2(l)=sigo2(l-1)+dsigo2(lsig2-l+2)
327 asigo2(l)=0.5*(sigo2(l)+sigo2(l+1))
339 if(abs(param%level(j)-asigo2(i)*10000)<small1)
then
351 if(index(trim(param%shortname),
'SIGMA_LVLS')>0)
then
357 sigo1(l)=sigo1(l-1)+dsigo1(lsig1-l+2)
361 asigo1(l)=0.5*(sigo1(l)+sigo1(l+1))
415 if(abs(param%level(j)-asigo1(i)*10000)<small1)
then