69 use vrbls3d, only: zint, pint, t, pmid, q, f_rimef
70 use vrbls2d, only: ths, qs, qvg, qv2m, tsnow, tg, smstav, smstot, &
71 cmc, sno, snoavg, psfcavg, t10avg, snonc, ivgtyp, &
72 si, potevp, dzice, qwbs, vegfrc, isltyp, pshltr, &
73 tshltr, qshltr, mrshltr, maxtshltr, mintshltr, &
74 maxrhshltr, minrhshltr, u10, psfcavg, v10, u10max, &
75 v10max, th10, t10m, q10, wspd10max, &
76 wspd10umax, wspd10vmax, prec, sr, &
77 cprate, avgcprate, avgprec, acprec, cuprec, ancprc, &
78 lspa, acsnow, acsnom, snowfall,ssroff, bgroff, &
79 runoff, pcp_bucket, rainnc_bucket, snow_bucket, &
80 snownc, tmax, graup_bucket, graupelnc, qrmax, sfclhx,&
81 rainc_bucket, sfcshx, subshx, snopcx, sfcuvx, &
82 sfcvx, smcwlt, suntime, pd, sfcux, sfcuxi, sfcvxi, sfcevp, z0, &
83 ustar, mdltaux, mdltauy, gtaux, gtauy, twbs, &
84 sfcexc, grnflx, islope, czmean, czen, rswin,akhsavg ,&
85 akmsavg, u10h, v10h,snfden,sndepac,qvl1, &
86 spduv10mean,swradmean,swnormmean,prate_max,fprate_max &
87 ,fieldcapa,edir,ecan,etrans,esnow,u10mean,v10mean, &
88 avgedir,avgecan,avgetrans,avgesnow,acgraup,acfrain, &
89 acond,maxqshltr,minqshltr,avgpotevp,avgprec_cont, &
90 avgcprate_cont,sst,pcp_bucket1,rainnc_bucket1, &
91 snow_bucket1, rainc_bucket1, graup_bucket1, &
92 shdmin, shdmax, lai, ch10,cd10,landfrac,paha,pahi, &
93 tecan,tetran,tedir,twa
94 use soil, only: stc, sllevel, sldpth, smc, sh2o
95 use masks, only: lmh, sm, sice, htm, gdlat, gdlon
97 use params_mod, only: p1000, capa, h1m12, pq0, a2,a3, a4, h1, d00, d01,&
98 eps, oneps, d001, h99999, h100, small, h10e5, &
99 elocp, g, xlai, tfrz, rd
100 use ctlblk_mod
, only: jsta, jend, lm, spval, grib, cfld, fld_info, &
101 datapd, nsoil, isf_surface_physics, tprec, ifmin,&
102 modelname, tmaxmin, pthresh, dtq2, dt, nphs, &
103 ifhr, prec_acc_dt, sdat, ihrst, jsta_2l, jend_2u,&
104 lp1, imp_physics, me, asrfc, tsrfc, pt, pdtop, &
105 mpi_comm_comp, im, jm, prec_acc_dt1
106 use rqstfld_mod
, only: iget, lvls, id, iavblfld, lvlsxml
107 use grib2_module, only: read_grib2_head, read_grib2_sngle
121 real,
PARAMETER :: ptrace = 0.000254e0
124 integer,
parameter :: nalg=5, nosoiltype=9
125 real,
PARAMETER :: c2k = 273.15, sec2hr = 1./3600.
129 integer,
dimension(im,jsta:jend) :: nroots, iwx1
130 real,
allocatable,
dimension(:,:) :: zsfc, psfc, tsfc, qsfc, &
131 rhsfc, thsfc, dwpsfc, p1d, &
133 smcdry, smcmax,doms, domr, &
134 domip, domzr, rsmin, smcref,&
135 rcq, rct, rcsoil, gc, rcs
137 real,
dimension(im,jsta:jend) :: evp
138 real,
dimension(im,jsta_2l:jend_2u) :: egrid1, egrid2
139 real,
dimension(im,jsta_2l:jend_2u) :: grid2
140 real,
dimension(im,jm) :: grid1
141 real,
dimension(im,jsta_2l:jend_2u) :: iceg
143 real,
allocatable,
dimension(:,:,:) :: sleet, rain, freezr, snow
147 REAL totprcp, snowratio,t2,rainl
150 integer i,j,iwx,itmaxmin,ifincr,isvalue,ii,jj, &
151 itprec,itsrfc,l,ls,iveg,llmh, &
152 ivg,irtn,iseed, icat, cnt_snowratio(10),icnt_snow_rain_mixed
154 real rdtphs,tlow,tsfck,qsat,dtop,dbot,sneqv,rrnum,sfcprs,sfcq, &
155 rc,sfctmp,sncovr,factrs,solar, s,tk,tl,w,t2c,dlt,ape, &
156 qv,e,dwpt,dum1,dum2,dum3,dum1s,dum3s,dum21,dum216,es
158 character(len=256) :: ffgfile
159 character(len=256) :: arifile
163 logical,
parameter :: debugprint = .false.
176 IF ( (iget(024)>0).OR.(iget(025)>0).OR. &
177 (iget(026)>0).OR.(iget(027)>0).OR. &
178 (iget(028)>0).OR.(iget(029)>0).OR. &
180 (iget(034)>0).OR.(iget(076)>0) )
THEN
182 allocate(zsfc(im,jsta:jend), psfc(im,jsta:jend), tsfc(im,jsta:jend)&
183 ,rhsfc(im,jsta:jend), thsfc(im,jsta:jend), qsfc(im,jsta:jend))
193 IF(zint(i,j,lm+1) < spval) &
194 zsfc(i,j) = zint(i,j,lm+1)
195 psfc(i,j) = pint(i,j,nint(lmh(i,j))+1)
198 thsfc(i,j) = ths(i,j)
200 IF(thsfc(i,j) /= spval .and. psfc(i,j) /= spval) &
201 tsfc(i,j) = thsfc(i,j)*(psfc(i,j)/p1000)**capa
210 IF(tsfc(i,j) < spval)
then
211 IF(qs(i,j)<spval) qsfc(i,j) = max(h1m12,qs(i,j))
214 IF(modelname ==
'RAPR')
THEN
215 qsat = max(0.0001,pq0/psfc(i,j)*exp(a2*(tsfck-a3)/(tsfck-a4)))
216 elseif (modelname ==
'GFS')
then
218 qsat = con_eps*es/(psfc(i,j)+con_epsm1*es)
220 qsat = pq0/psfc(i,j)*exp(a2*(tsfck-a3)/(tsfck-a4))
222 rhsfc(i,j) = max(d01, min(h1,qsfc(i,j)/qsat))
224 qsfc(i,j) = rhsfc(i,j)*qsat
225 rhsfc(i,j) = rhsfc(i,j) * 100.0
226 evp(i,j) = d001*psfc(i,j)*qsfc(i,j)/(eps+oneps*qsfc(i,j))
248 IF (iget(024)>0)
THEN
249 if(grib ==
'grib2')
then
251 fld_info(cfld)%ifld = iavblfld(iget(024))
256 datapd(i,j,cfld) = psfc(i,jj)
263 IF (iget(025)>0)
THEN
265 if(grib ==
'grib2')
then
267 fld_info(cfld)%ifld = iavblfld(iget(025))
272 datapd(i,j,cfld) = zsfc(i,jj)
277 if (
allocated(zsfc))
deallocate(zsfc)
278 if (
allocated(psfc))
deallocate(psfc)
281 IF (iget(026)>0)
THEN
282 if(grib ==
'grib2')
then
284 fld_info(cfld)%ifld = iavblfld(iget(026))
289 datapd(i,j,cfld) = tsfc(i,jj)
294 if (
allocated(tsfc))
deallocate(tsfc)
297 IF (iget(027)>0)
THEN
298 if(grib==
'grib2')
then
300 fld_info(cfld)%ifld=iavblfld(iget(027))
305 datapd(i,j,cfld) = thsfc(i,jj)
310 if (
allocated(thsfc))
deallocate(thsfc)
313 IF (iget(028)>0)
THEN
315 if(grib==
'grib2')
then
317 fld_info(cfld)%ifld=iavblfld(iget(028))
322 datapd(i,j,cfld) = qsfc(i,jj)
327 if (
allocated(qsfc))
deallocate(qsfc)
330 IF (iget(029)>0)
THEN
331 allocate(dwpsfc(im,jsta:jend))
332 CALL dewpoint(evp,dwpsfc)
333 if(grib==
'grib2')
then
335 fld_info(cfld)%ifld=iavblfld(iget(029))
340 datapd(i,j,cfld) = dwpsfc(i,jj)
344 if (
allocated(dwpsfc))
deallocate(dwpsfc)
348 IF (iget(076)>0)
THEN
349 CALL bound(rhsfc,h1,h100)
350 if(grib==
'grib2')
then
352 fld_info(cfld)%ifld=iavblfld(iget(076))
357 datapd(i,j,cfld) = rhsfc(i,jj)
362 if (
allocated(rhsfc))
deallocate(rhsfc)
369 IF (iget(762)>0)
THEN
370 if(grib==
'grib2')
then
372 fld_info(cfld)%ifld=iavblfld(iget(762))
377 datapd(i,j,cfld) = qvg(i,jj)
385 IF (iget(760)>0)
THEN
386 if(grib==
'grib2')
then
388 fld_info(cfld)%ifld=iavblfld(iget(760))
393 datapd(i,j,cfld) = qv2m(i,jj)
400 IF (iget(761)>0)
THEN
401 if(grib==
'grib2')
then
403 fld_info(cfld)%ifld=iavblfld(iget(761))
408 datapd(i,j,cfld) = tsnow(i,jj)
415 IF (iget(724)>0)
THEN
416 if(grib==
'grib2')
then
418 fld_info(cfld)%ifld=iavblfld(iget(724))
423 datapd(i,j,cfld) = snfden(i,jj)
430 IF (iget(725)>0)
THEN
435 ifincr = mod(ifhr,itprec)
436 IF(ifmin >= 1)ifincr = mod(ifhr*60+ifmin,itprec*60)
443 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
449 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
451 IF (id(18)<0) id(18) = 0
452 if(grib==
'grib2')
then
454 fld_info(cfld)%ifld=iavblfld(iget(725))
455 fld_info(cfld)%ntrange=1
456 fld_info(cfld)%tinvstat=ifhr-id(18)
461 datapd(i,j,cfld) = sndepac(i,jj)
476 IF (iget(116)>0)
THEN
477 IF (lvls(l,iget(116))>0)
THEN
478 IF(isf_surface_physics==3)
THEN
479 if(grib==
'grib2')
then
481 fld_info(cfld)%ifld=iavblfld(iget(116))
482 fld_info(cfld)%lvl=lvlsxml(l,iget(116))
487 datapd(i,j,cfld) = stc(i,jj,l)
496 dtop = dtop + sldpth(ls)
498 dbot = dtop + sldpth(l)
499 if(grib==
'grib2')
then
501 fld_info(cfld)%ifld=iavblfld(iget(116))
502 fld_info(cfld)%lvl=lvlsxml(l,iget(116))
507 datapd(i,j,cfld) = stc(i,jj,l)
517 IF (iget(117)>0)
THEN
518 IF (lvls(l,iget(117))>0)
THEN
519 IF(isf_surface_physics==3)
THEN
520 if(grib==
'grib2')
then
522 fld_info(cfld)%ifld=iavblfld(iget(117))
523 fld_info(cfld)%lvl=lvlsxml(l,iget(117))
528 datapd(i,j,cfld) = smc(i,jj,l)
535 dtop = dtop + sldpth(ls)
537 dbot = dtop + sldpth(l)
538 if(grib==
'grib2')
then
540 fld_info(cfld)%ifld=iavblfld(iget(117))
541 fld_info(cfld)%lvl=lvlsxml(l,iget(117))
546 datapd(i,j,cfld) = smc(i,jj,l)
554 IF (iget(225)>0)
THEN
555 IF (lvls(l,iget(225))>0)
THEN
556 IF(isf_surface_physics==3)
THEN
557 if(grib==
'grib2')
then
559 fld_info(cfld)%ifld=iavblfld(iget(225))
560 fld_info(cfld)%lvl=lvlsxml(l,iget(225))
565 datapd(i,j,cfld) = sh2o(i,jj,l)
572 dtop = dtop + sldpth(ls)
574 dbot = dtop + sldpth(l)
575 if(grib==
'grib2')
then
577 fld_info(cfld)%ifld=iavblfld(iget(225))
578 fld_info(cfld)%lvl=lvlsxml(l,iget(225))
583 datapd(i,j,cfld) = sh2o(i,jj,l)
594 IF (iget(115)>0.or.iget(571)>0)
THEN
596 if(grib==
'grib2')
then
598 fld_info(cfld)%ifld=iavblfld(iget(115))
603 datapd(i,j,cfld) = tg(i,jj)
608 if(iget(571)>0.and.grib==
'grib2')
then
610 fld_info(cfld)%ifld=iavblfld(iget(571))
615 datapd(i,j,cfld) = tg(i,jj)
622 IF (iget(171)>0)
THEN
626 IF(smstav(i,j) /= spval)
THEN
627 grid1(i,j) = smstav(i,j)*100.
633 if(grib==
'grib2')
then
635 fld_info(cfld)%ifld=iavblfld(iget(171))
640 datapd(i,j,cfld) = grid1(i,jj)
647 IF (iget(036)>0)
THEN
651 IF(smstot(i,j)/=spval)
THEN
652 IF(sm(i,j) > small .AND. sice(i,j) < small)
THEN
655 grid1(i,j) = smstot(i,j)
662 if(grib==
'grib2')
then
664 fld_info(cfld)%ifld=iavblfld(iget(036))
669 datapd(i,j,cfld) = grid1(i,jj)
676 IF ( iget(118)>0 )
THEN
677 IF(modelname ==
'RAPR')
THEN
681 IF(cmc(i,j) /= spval)
then
682 grid1(i,j) = cmc(i,j)
692 IF(cmc(i,j) /= spval)
then
693 grid1(i,j) = cmc(i,j)*1000.
700 if(grib==
'grib2')
then
702 fld_info(cfld)%ifld=iavblfld(iget(118))
707 datapd(i,j,cfld) = grid1(i,jj)
714 IF ( iget(119)>0 )
THEN
716 if(grib==
'grib2')
then
718 fld_info(cfld)%ifld=iavblfld(iget(119))
723 datapd(i,j,cfld) = sno(i,jj)
730 IF ( iget(500)>0 )
THEN
736 grid1(i,j) = snoavg(i,j)
737 if (snoavg(i,j) /= spval) grid1(i,j) = 100.*snoavg(i,j)
740 CALL bound(grid1,d00,h100)
744 ifincr = mod(ifhr,itsrfc)
745 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
750 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
756 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
758 IF (id(18)<0) id(18) = 0
759 if(grib==
'grib2')
then
761 fld_info(cfld)%ifld=iavblfld(iget(500))
763 fld_info(cfld)%ntrange=1
765 fld_info(cfld)%ntrange=0
767 fld_info(cfld)%tinvstat=ifhr-id(18)
774 datapd(i,j,cfld) = grid1(i,jj)
781 IF ( iget(501)>0 )
THEN
791 if(grib==
'grib2')
then
793 fld_info(cfld)%ifld=iavblfld(iget(501))
794 fld_info(cfld)%ntrange=ifhr-id(18)
795 fld_info(cfld)%tinvstat=1
800 datapd(i,j,cfld) = psfcavg(i,jj)
807 IF ( iget(502)>0 )
THEN
818 id(10) = mod(isvalue/256,256)
819 id(11) = mod(isvalue,256)
820 if(grib==
'grib2')
then
822 fld_info(cfld)%ifld=iavblfld(iget(502))
823 fld_info(cfld)%ntrange=ifhr-id(18)
824 fld_info(cfld)%tinvstat=1
829 datapd(i,j,cfld) = t10avg(i,jj)
836 IF ( iget(244)>0 )
THEN
840 grid1(i,j) = snonc(i,j)
846 if (itprec /= 0)
then
847 ifincr = mod(ifhr,itprec)
848 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
855 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
861 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
863 IF (id(18)<0) id(18) = 0
865 if(grib==
'grib2')
then
867 fld_info(cfld)%ifld=iavblfld(iget(244))
868 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
873 IF ( iget(120)>0 )
THEN
878 IF ( sno(i,j) /= spval )
THEN
882 CALL snfrac(sneqv,iveg,sncovr)
883 grid1(i,j) = sncovr*100.
887 CALL bound(grid1,d00,h100)
888 if(grib==
'grib2')
then
890 fld_info(cfld)%ifld=iavblfld(iget(120))
895 datapd(i,j,cfld) = grid1(i,jj)
901 IF ( iget(224)>0 )
THEN
909 IF(si(i,j) /= spval) grid1(i,j) = si(i,j)*0.001
913 if(grib==
'grib2')
then
915 fld_info(cfld)%ifld=iavblfld(iget(224))
920 datapd(i,j,cfld) = grid1(i,jj)
926 IF ( iget(242)>0 )
THEN
927 if(grib==
'grib2')
then
929 fld_info(cfld)%ifld=iavblfld(iget(242))
934 datapd(i,j,cfld) = potevp(i,jj)
940 IF ( iget(349)>0 )
THEN
941 if(grib==
'grib2')
then
943 fld_info(cfld)%ifld=iavblfld(iget(349))
948 datapd(i,j,cfld) = dzice(i,jj)
956 IF (modelname ==
'NCAR'.OR. modelname ==
'NMM' &
957 .OR. modelname ==
'FV3R' .OR. modelname ==
'RAPR')
THEN
966 IF ( iget(228)>0 .OR. iget(229)>0 &
967 .OR.iget(230)>0 .OR. iget(231)>0 &
968 .OR.iget(232)>0 .OR. iget(233)>0)
THEN
970 allocate(smcdry(im,jsta:jend), &
971 smcmax(im,jsta:jend))
978 IF( (modelname/=
'RAPR') .AND. (abs(sm(i,j)-0.) < 1.0e-5) .AND. &
979 & (abs(sice(i,j)-0.) < 1.0e-5) )
THEN
980 CALL etcalc(qwbs(i,j),potevp(i,j),sno(i,j),vegfrc(i,j) &
981 & , isltyp(i,j),sh2o(i,j,1:1),cmc(i,j) &
982 & , ecan(i,j),edir(i,j),etrans(i,j),esnow(i,j) &
983 & , smcdry(i,j),smcmax(i,j) )
995 IF ( iget(228)>0 )
THEN
996 if(grib==
'grib2')
then
998 fld_info(cfld)%ifld=iavblfld(iget(228))
1003 datapd(i,j,cfld) = ecan(i,jj)
1009 IF ( iget(229)>0 )
THEN
1010 if(grib==
'grib2')
then
1012 fld_info(cfld)%ifld=iavblfld(iget(229))
1017 datapd(i,j,cfld) = edir(i,jj)
1023 IF ( iget(230)>0 )
THEN
1024 if(grib==
'grib2')
then
1026 fld_info(cfld)%ifld=iavblfld(iget(230))
1027 datapd(1:im,1:jend-jsta+1,cfld) = etrans(1:im,jsta:jend)
1031 IF ( iget(231)>0 )
THEN
1032 if(grib==
'grib2')
then
1034 fld_info(cfld)%ifld=iavblfld(iget(231))
1035 datapd(1:im,1:jend-jsta+1,cfld) = esnow(1:im,jsta:jend)
1039 IF ( iget(232)>0 )
THEN
1040 if(grib==
'grib2')
then
1042 fld_info(cfld)%ifld=iavblfld(iget(232))
1047 datapd(i,j,cfld) = smcdry(i,jj)
1053 IF ( iget(233)>0 )
THEN
1054 if(grib==
'grib2')
then
1056 fld_info(cfld)%ifld=iavblfld(iget(233))
1061 datapd(i,j,cfld) = smcmax(i,jj)
1072 if (
allocated(smcdry))
deallocate(smcdry)
1073 if (
allocated(smcmax))
deallocate(smcmax)
1077 IF ( iget(512)>0 )
THEN
1078 if(grib==
'grib2')
then
1080 fld_info(cfld)%ifld=iavblfld(iget(512))
1085 datapd(i,j,cfld) = acond(i,jj)
1091 IF ( iget(513)>0 )
THEN
1093 itsrfc = nint(tsrfc)
1094 IF(itsrfc /= 0)
then
1095 ifincr = mod(ifhr,itsrfc)
1096 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
1101 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1104 id(18) = ifhr-itsrfc
1106 id(18) = ifhr-ifincr
1107 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1109 IF (id(18)<0) id(18) = 0
1110 if(grib==
'grib2')
then
1112 fld_info(cfld)%ifld=iavblfld(iget(513))
1114 fld_info(cfld)%ntrange=1
1116 fld_info(cfld)%ntrange=0
1118 fld_info(cfld)%tinvstat=ifhr-id(18)
1123 datapd(i,j,cfld) = avgecan(i,jj)
1129 IF ( iget(514)>0 )
THEN
1131 itsrfc = nint(tsrfc)
1132 IF(itsrfc /= 0)
then
1133 ifincr = mod(ifhr,itsrfc)
1134 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
1139 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1142 id(18) = ifhr-itsrfc
1144 id(18) = ifhr-ifincr
1145 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1147 IF (id(18)<0) id(18) = 0
1148 if(grib==
'grib2')
then
1150 fld_info(cfld)%ifld=iavblfld(iget(514))
1152 fld_info(cfld)%ntrange=1
1154 fld_info(cfld)%ntrange=0
1156 fld_info(cfld)%tinvstat=ifhr-id(18)
1161 datapd(i,j,cfld) = avgedir(i,jj)
1167 IF ( iget(515)>0 )
THEN
1169 itsrfc = nint(tsrfc)
1170 IF(itsrfc /= 0)
then
1171 ifincr = mod(ifhr,itsrfc)
1172 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
1177 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1180 id(18) = ifhr-itsrfc
1182 id(18) = ifhr-ifincr
1183 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1185 IF (id(18)<0) id(18) = 0
1186 if(grib==
'grib2')
then
1188 fld_info(cfld)%ifld=iavblfld(iget(515))
1190 fld_info(cfld)%ntrange=1
1192 fld_info(cfld)%ntrange=0
1194 fld_info(cfld)%tinvstat=ifhr-id(18)
1195 datapd(1:im,1:jend-jsta+1,cfld) = avgetrans(1:im,jsta:jend)
1199 IF ( iget(516)>0 )
THEN
1201 itsrfc = nint(tsrfc)
1202 IF(itsrfc /= 0)
then
1203 ifincr = mod(ifhr,itsrfc)
1204 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
1209 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1212 id(18) = ifhr-itsrfc
1214 id(18) = ifhr-ifincr
1215 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1217 IF (id(18)<0) id(18) = 0
1218 if(grib==
'grib2')
then
1220 fld_info(cfld)%ifld=iavblfld(iget(516))
1222 fld_info(cfld)%ntrange=1
1224 fld_info(cfld)%ntrange=0
1226 fld_info(cfld)%tinvstat=ifhr-id(18)
1227 datapd(1:im,1:jend-jsta+1,cfld) = avgesnow(1:im,jsta:jend)
1231 IF ( iget(996)>0 )
THEN
1232 if(grib==
'grib2')
then
1234 fld_info(cfld)%ifld=iavblfld(iget(996))
1239 datapd(i,j,cfld) = landfrac(i,jj)
1245 IF ( iget(997)>0 )
THEN
1246 if(grib==
'grib2')
then
1248 fld_info(cfld)%ifld=iavblfld(iget(997))
1253 datapd(i,j,cfld) = pahi(i,jj)
1259 IF ( iget(998)>0 )
THEN
1260 if(grib==
'grib2')
then
1262 fld_info(cfld)%ifld=iavblfld(iget(998))
1267 datapd(i,j,cfld) = twa(i,jj)
1273 IF ( iget(999)>0 )
THEN
1277 grid1(i,j) = tecan(i,j)
1281 itprec = nint(tprec)
1282 if (itprec /= 0)
then
1283 ifincr = mod(ifhr,itprec)
1284 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
1290 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1293 id(18) = ifhr-itprec
1295 id(18) = ifhr-ifincr
1296 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1298 IF (id(18)<0) id(18) = 0
1299 if(grib==
'grib2')
then
1301 fld_info(cfld)%ifld=iavblfld(iget(999))
1302 fld_info(cfld)%ntrange=1
1303 fld_info(cfld)%tinvstat=ifhr-id(18)
1308 datapd(i,j,cfld) = grid1(i,jj)
1314 IF ( iget(1000)>0 )
THEN
1318 grid1(i,j) = tetran(i,j)
1322 itprec = nint(tprec)
1323 if (itprec /= 0)
then
1324 ifincr = mod(ifhr,itprec)
1325 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
1331 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1334 id(18) = ifhr-itprec
1336 id(18) = ifhr-ifincr
1337 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1339 IF (id(18)<0) id(18) = 0
1340 if(grib==
'grib2')
then
1342 fld_info(cfld)%ifld=iavblfld(iget(1000))
1343 fld_info(cfld)%ntrange=1
1344 fld_info(cfld)%tinvstat=ifhr-id(18)
1349 datapd(i,j,cfld) = grid1(i,jj)
1355 IF ( iget(1001)>0 )
THEN
1359 grid1(i,j) = tedir(i,j)
1363 itprec = nint(tprec)
1364 if (itprec /= 0)
then
1365 ifincr = mod(ifhr,itprec)
1366 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
1372 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1375 id(18) = ifhr-itprec
1377 id(18) = ifhr-ifincr
1378 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1380 IF (id(18)<0) id(18) = 0
1381 if(grib==
'grib2')
then
1383 fld_info(cfld)%ifld=iavblfld(iget(1001))
1384 fld_info(cfld)%ntrange=1
1385 fld_info(cfld)%tinvstat=ifhr-id(18)
1390 datapd(i,j,cfld) = grid1(i,jj)
1397 IF (iget(1002)>0)
THEN
1405 IF(paha(i,j)/=spval)
THEN
1406 grid1(i,j)=-1.*paha(i,j)*rrnum
1408 grid1(i,j)=paha(i,j)
1413 itsrfc = nint(tsrfc)
1414 IF(itsrfc /= 0)
then
1415 ifincr = mod(ifhr,itsrfc)
1416 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
1421 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1424 id(18) = ifhr-itsrfc
1426 id(18) = ifhr-ifincr
1427 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1429 IF (id(18)<0) id(18) = 0
1430 if(grib==
'grib2')
then
1432 fld_info(cfld)%ifld=iavblfld(iget(1002))
1434 fld_info(cfld)%ntrange=1
1436 fld_info(cfld)%ntrange=0
1438 fld_info(cfld)%tinvstat=ifhr-id(18)
1439 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1449 IF ( (iget(106)>0).OR.(iget(112)>0).OR. &
1450 (iget(113)>0).OR.(iget(114)>0).OR. &
1451 (iget(138)>0).OR.(iget(414)>0).OR. &
1452 (iget(546)>0).OR.(iget(547)>0).OR. &
1453 (iget(548)>0).OR.(iget(739)>0).OR. &
1456 if (.not.
allocated(psfc))
allocate(psfc(im,jsta:jend))
1459 IF(modelname ==
'NCAR' .OR. modelname==
'RSM'.OR. modelname==
'RAPR')
THEN
1462 tlow = t(i,j,nint(lmh(i,j)))
1463 psfc(i,j) = pint(i,j,nint(lmh(i,j))+1)
1464 pshltr(i,j) = psfc(i,j)*exp(-0.068283/tlow)
1475 IF (iget(106)>0)
THEN
1481 if(tshltr(i,j)/=spval)grid1(i,j)=tshltr(i,j)*(pshltr(i,j)*1.e-5)**capa
1482 IF(grid1(i,j)<200)print*,
'ABNORMAL 2MT ',i,j, &
1483 tshltr(i,j),pshltr(i,j)
1489 if(grib==
'grib2')
then
1491 fld_info(cfld)%ifld=iavblfld(iget(106))
1492 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
1497 IF (iget(546)>0)
THEN
1504 if(grib==
'grib2')
then
1506 fld_info(cfld)%ifld=iavblfld(iget(546))
1507 datapd(1:im,1:jend-jsta+1,cfld) = tshltr(1:im,jsta:jend)
1512 IF (iget(112)>0)
THEN
1515 grid1(i,j) = qshltr(i,j)
1518 CALL bound(grid1,h1m12,h99999)
1519 if(grib==
'grib2')
then
1521 fld_info(cfld)%ifld=iavblfld(iget(112))
1522 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
1527 IF (iget(414)>0)
THEN
1530 grid1(i,j) = mrshltr(i,j)
1533 if(grib==
'grib2')
then
1535 fld_info(cfld)%ifld=iavblfld(iget(414))
1536 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1541 allocate(p1d(im,jsta:jend), t1d(im,jsta:jend))
1542 IF ((iget(113)>0) .OR.(iget(547)>0).OR.(iget(548)>0))
THEN
1549 qv = max(1.e-5,(qshltr(i,j)/(1.-qshltr(i,j))))
1550 e = pshltr(i,j)/100.*qv/(0.62197+qv)
1551 dwpt = (243.5*log(e)-440.8)/(19.48-log(e))+273.15
1559 IF(qshltr(i,j)<spval.and.pshltr(i,j)<spval)
THEN
1560 evp(i,j) = pshltr(i,j)*qshltr(i,j)/(eps+oneps*qshltr(i,j))
1561 evp(i,j) = evp(i,j)*d001
1567 CALL dewpoint(evp,egrid1(1,jsta))
1570 IF (iget(113)>0)
THEN
1572 if(modelname==
'RAPR')
THEN
1576 t2=tshltr(i,j)*(pshltr(i,j)*1.e-5)**capa
1577 if(qshltr(i,j)/=spval)grid1(i,j)=min(egrid1(i,j),t2)
1583 if(qshltr(i,j)/=spval) grid1(i,j) = egrid1(i,j)
1587 if(grib==
'grib2')
then
1589 fld_info(cfld)%ifld=iavblfld(iget(113))
1590 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1597 IF (iget(771)>0)
THEN
1600 evp(i,j)=p1d(i,j)*qvl1(i,j)/(eps+oneps*qvl1(i,j))
1601 evp(i,j)=evp(i,j)*d001
1604 CALL dewpoint(evp,egrid1(1,jsta))
1610 if(qvl1(i,j)/=spval)grid1(i,j) = min(egrid1(i,j),t1d(i,j))
1613 if(grib==
'grib2')
then
1615 fld_info(cfld)%ifld=iavblfld(iget(771))
1616 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1622 IF ((iget(547)>0).OR.(iget(548)>0))
THEN
1627 if(tshltr(i,j)/=spval.and.pshltr(i,j)/=spval.and.qshltr(i,j)/=spval)
then
1629 grid1(i,j)=max(0.,tshltr(i,j)*(pshltr(i,j)*1.e-5)**capa-egrid1(i,j))
1632 ape=(h10e5/pshltr(i,j))**capa
1633 grid2(i,j)=tshltr(i,j)*exp(elocp*qshltr(i,j)*ape/tshltr(i,j))
1642 IF (iget(547)>0)
THEN
1643 if(grib==
'grib2')
then
1645 fld_info(cfld)%ifld=iavblfld(iget(547))
1646 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1650 IF (iget(548)>0)
THEN
1651 if(grib==
'grib2')
then
1653 fld_info(cfld)%ifld=iavblfld(iget(548))
1654 datapd(1:im,1:jend-jsta+1,cfld)=grid2(1:im,jsta:jend)
1663 IF (iget(114) > 0 .OR. iget(808) > 0)
THEN
1664 allocate(q1d(im,jsta:jend))
1668 IF(modelname==
'RAPR')
THEN
1669 llmh = nint(lmh(i,j))
1671 p1d(i,j) = pmid(i,j,llmh)
1672 t1d(i,j) = t(i,j,llmh)
1674 p1d(i,j) = pshltr(i,j)
1675 t1d(i,j) = tshltr(i,j)*(pshltr(i,j)*1.e-5)**capa
1677 q1d(i,j) = qshltr(i,j)
1681 CALL calrh(p1d,t1d,q1d,egrid1(1,jsta))
1683 if (
allocated(q1d))
deallocate(q1d)
1687 if(qshltr(i,j) /= spval)
then
1688 grid1(i,j) = egrid1(i,j)*100.
1694 CALL bound(grid1,h1,h100)
1695 IF (iget(114) > 0)
THEN
1696 if(grib ==
'grib2')
then
1698 fld_info(cfld)%ifld = iavblfld(iget(114))
1703 datapd(i,j,cfld) = grid1(i,jj)
1714 if(t1d(i,j)/=spval.and.u10h(i,j)/=spval.and.v10h(i,j)<spval)
then
1715 dum1 = (t1d(i,j)-tfrz)*1.8+32.
1716 dum2 = sqrt(u10h(i,j)**2.0+v10h(i,j)**2.0)/0.44704
1717 dum3 = egrid1(i,j) * 100.0
1720 IF(dum1 <= 50.)
THEN
1722 grid2(i,j) = 35.74 + 0.6215*dum1 &
1723 - 35.75*dum216 + 0.4275*dum1*dum216
1724 grid2(i,j) =(grid2(i,j)-32.)/1.8+tfrz
1725 ELSE IF(dum1 > 80.)
THEN
1728 grid2(i,j) = -42.379 + 2.04901523*dum1 &
1729 + 10.14333127*dum3 &
1730 - 0.22475541*dum1*dum3 &
1731 - 0.00683783*dum1s &
1732 - 0.05481717*dum3s &
1733 + 0.00122874*dum1s*dum3 &
1734 + 0.00085282*dum1*dum3s &
1735 - 0.00000199*dum1s*dum3s
1736 grid2(i,j) = (grid2(i,j)-32.)/1.8 + tfrz
1738 grid2(i,j) = t1d(i,j)
1746 if(grib ==
'grib2')
then
1748 fld_info(cfld)%ifld = iavblfld(iget(808))
1753 datapd(i,j,cfld) = grid2(i,jj)
1762 if (
allocated(p1d))
deallocate (p1d)
1763 if (
allocated(t1d))
deallocate (t1d)
1766 IF (iget(138)>0)
THEN
1772 if(grib==
'grib2')
then
1774 fld_info(cfld)%ifld=iavblfld(iget(138))
1779 datapd(i,j,cfld) = pshltr(i,jj)
1788 IF (iget(345)>0)
THEN
1795 tmaxmin = max(tmaxmin,1.)
1797 itmaxmin = int(tmaxmin)
1798 IF(itmaxmin /= 0)
then
1799 ifincr = mod(ifhr,itmaxmin)
1800 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itmaxmin*60)
1805 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1808 id(18) = ifhr-itmaxmin
1810 id(18) = ifhr-ifincr
1811 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1813 IF (id(18)<0) id(18) = 0
1814 if(grib==
'grib2')
then
1816 fld_info(cfld)%ifld=iavblfld(iget(345))
1817 if(itmaxmin==0)
then
1818 fld_info(cfld)%ntrange=0
1820 fld_info(cfld)%ntrange=1
1822 fld_info(cfld)%tinvstat=ifhr-id(18)
1823 if(ifhr==0) fld_info(cfld)%tinvstat=0
1828 datapd(i,j,cfld) = maxtshltr(i,jj)
1835 IF (iget(346)>0)
THEN
1843 itmaxmin = int(tmaxmin)
1844 IF(itmaxmin /= 0)
then
1845 ifincr = mod(ifhr,itmaxmin)
1846 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itmaxmin*60)
1851 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1854 id(18) = ifhr-itmaxmin
1856 id(18) = ifhr-ifincr
1857 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1859 IF (id(18)<0) id(18) = 0
1860 if(grib==
'grib2')
then
1862 fld_info(cfld)%ifld=iavblfld(iget(346))
1863 if(itmaxmin==0)
then
1864 fld_info(cfld)%ntrange=0
1866 fld_info(cfld)%ntrange=1
1868 fld_info(cfld)%tinvstat=ifhr-id(18)
1869 if(ifhr==0) fld_info(cfld)%tinvstat=0
1874 datapd(i,j,cfld) = mintshltr(i,jj)
1881 IF (iget(347)>0)
THEN
1885 if(maxrhshltr(i,j)/=spval) grid1(i,j)=maxrhshltr(i,j)*100.
1890 itmaxmin = int(tmaxmin)
1891 IF(itmaxmin /= 0)
then
1892 ifincr = mod(ifhr,itmaxmin)
1893 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itmaxmin*60)
1898 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1901 id(18) = ifhr-itmaxmin
1903 id(18) = ifhr-ifincr
1904 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1906 IF (id(18)<0) id(18) = 0
1907 if(grib==
'grib2')
then
1909 fld_info(cfld)%ifld=iavblfld(iget(347))
1910 if(itmaxmin==0)
then
1911 fld_info(cfld)%ntrange=0
1915 fld_info(cfld)%ntrange=1
1918 fld_info(cfld)%tinvstat=ifhr-id(18)
1919 if(ifhr==0) fld_info(cfld)%tinvstat=0
1926 datapd(i,j,cfld) = grid1(i,jj)
1933 IF (iget(348)>0)
THEN
1937 if(minrhshltr(i,j)/=spval) grid1(i,j)=minrhshltr(i,j)*100.
1942 itmaxmin = int(tmaxmin)
1943 IF(itmaxmin /= 0)
then
1944 ifincr = mod(ifhr,itmaxmin)
1945 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itmaxmin*60)
1950 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1953 id(18) = ifhr-itmaxmin
1955 id(18) = ifhr-ifincr
1956 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
1958 IF (id(18)<0) id(18) = 0
1959 if(grib==
'grib2')
then
1961 fld_info(cfld)%ifld=iavblfld(iget(348))
1962 if(itmaxmin==0)
then
1963 fld_info(cfld)%ntrange=0
1967 fld_info(cfld)%ntrange=1
1970 fld_info(cfld)%tinvstat=ifhr-id(18)
1971 if(ifhr==0) fld_info(cfld)%tinvstat=0
1976 datapd(i,j,cfld) = grid1(i,jj)
1984 IF (iget(510)>0)
THEN
1986 itmaxmin = int(tmaxmin)
1987 IF(itmaxmin /= 0)
then
1988 ifincr = mod(ifhr,itmaxmin)
1989 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itmaxmin*60)
1994 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
1997 id(18) = ifhr-itmaxmin
1999 id(18) = ifhr-ifincr
2000 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2002 IF (id(18)<0) id(18) = 0
2003 if(grib==
'grib2')
then
2005 fld_info(cfld)%ifld=iavblfld(iget(510))
2006 if(itmaxmin==0)
then
2007 fld_info(cfld)%ntrange=0
2009 fld_info(cfld)%ntrange=1
2011 fld_info(cfld)%tinvstat=ifhr-id(18)
2016 datapd(i,j,cfld) = maxqshltr(i,jj)
2023 IF (iget(511)>0)
THEN
2025 itmaxmin = int(tmaxmin)
2026 IF(itmaxmin /= 0)
then
2027 ifincr = mod(ifhr,itmaxmin)
2028 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itmaxmin*60)
2033 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
2036 id(18) = ifhr-itmaxmin
2038 id(18) = ifhr-ifincr
2039 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2041 IF (id(18)<0) id(18) = 0
2042 if(grib==
'grib2')
then
2044 fld_info(cfld)%ifld=iavblfld(iget(511))
2045 if(itmaxmin==0)
then
2046 fld_info(cfld)%ntrange=0
2048 fld_info(cfld)%ntrange=1
2050 fld_info(cfld)%tinvstat=ifhr-id(18)
2055 datapd(i,j,cfld) = minqshltr(i,jj)
2063 IF (iget(739)>0)
THEN
2067 if(t(i,j,lm)/=spval.and.pmid(i,j,lm)/=spval.and.smoke(i,j,lm,1)/=spval)&
2068 grid1(i,j) = (1./rd)*(pmid(i,j,lm)/t(i,j,lm))*smoke(i,j,lm,1)
2071 if(grib==
'grib2')
then
2073 fld_info(cfld)%ifld=iavblfld(iget(739))
2074 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
2080 IF ( (iget(064)>0).OR.(iget(065)>0).OR. &
2081 (iget(506)>0).OR.(iget(507)>0) )
THEN
2084 IF ((iget(064)>0).OR.(iget(065)>0))
THEN
2088 grid1(i,j) = u10(i,j)
2089 grid2(i,j) = v10(i,j)
2092 if(grib==
'grib2')
then
2094 fld_info(cfld)%ifld=iavblfld(iget(064))
2099 datapd(i,j,cfld) = grid1(i,jj)
2103 fld_info(cfld)%ifld=iavblfld(iget(065))
2108 datapd(i,j,cfld) = grid2(i,jj)
2114 IF (iget(730)>0)
THEN
2118 grid1(i,j)=spduv10mean(i,j)
2121 if(grib==
'grib2')
then
2124 fld_info(cfld)%ifld=iavblfld(iget(730))
2125 if(fld_info(cfld)%ntrange==0)
then
2126 if (ifhr==0 .and. ifmin==0)
then
2127 fld_info(cfld)%tinvstat=0
2129 fld_info(cfld)%tinvstat=ifincr
2131 fld_info(cfld)%ntrange=1
2133 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
2138 IF (iget(731)>0)
THEN
2142 grid1(i,j)=u10mean(i,j)
2145 if(grib==
'grib2')
then
2147 fld_info(cfld)%ifld=iavblfld(iget(731))
2148 if(fld_info(cfld)%ntrange==0)
then
2149 if (ifhr==0 .and. ifmin==0)
then
2150 fld_info(cfld)%tinvstat=0
2152 fld_info(cfld)%tinvstat=ifincr
2154 fld_info(cfld)%ntrange=1
2156 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
2160 IF (iget(732)>0)
THEN
2164 grid1(i,j)=v10mean(i,j)
2167 if(grib==
'grib2')
then
2169 fld_info(cfld)%ifld=iavblfld(iget(732))
2170 if(fld_info(cfld)%ntrange==0)
then
2171 if (ifhr==0 .and. ifmin==0)
then
2172 fld_info(cfld)%tinvstat=0
2174 fld_info(cfld)%tinvstat=ifincr
2176 fld_info(cfld)%ntrange=1
2178 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
2182 IF (iget(733)>0 )
THEN
2186 grid1(i,j) = swradmean(i,j)
2189 if(grib==
'grib2')
then
2191 fld_info(cfld)%ifld=iavblfld(iget(733))
2192 if(fld_info(cfld)%ntrange==0)
then
2193 if (ifhr==0 .and. ifmin==0)
then
2194 fld_info(cfld)%tinvstat=0
2196 fld_info(cfld)%tinvstat=ifincr
2198 fld_info(cfld)%ntrange=1
2200 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
2204 IF (iget(734)>0 )
THEN
2208 grid1(i,j) = swnormmean(i,j)
2211 if(grib==
'grib2')
then
2213 fld_info(cfld)%ifld=iavblfld(iget(734))
2214 if(fld_info(cfld)%ntrange==0)
then
2215 if (ifhr==0 .and. ifmin==0)
then
2216 fld_info(cfld)%tinvstat=0
2218 fld_info(cfld)%tinvstat=ifincr
2220 fld_info(cfld)%ntrange=1
2222 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
2226 IF ((iget(506)>0).OR.(iget(507)>0))
THEN
2238 grid1(i,j) = u10max(i,j)
2239 grid2(i,j) = v10max(i,j)
2242 if(grib==
'grib2')
then
2244 fld_info(cfld)%ifld=iavblfld(iget(506))
2245 fld_info(cfld)%ntrange=ifhr-id(18)
2246 fld_info(cfld)%tinvstat=1
2251 datapd(i,j,cfld) = grid1(i,jj)
2255 fld_info(cfld)%ifld=iavblfld(iget(507))
2256 fld_info(cfld)%ntrange=ifhr-id(18)
2257 fld_info(cfld)%tinvstat=1
2262 datapd(i,j,cfld) = grid2(i,jj)
2272 IF (iget(158)>0)
THEN
2276 grid1(i,j)=th10(i,j)
2279 if(grib==
'grib2')
then
2281 fld_info(cfld)%ifld=iavblfld(iget(158))
2286 datapd(i,j,cfld) = grid1(i,jj)
2294 IF (iget(505)>0)
THEN
2298 grid1(i,j)=t10m(i,j)
2301 if(grib==
'grib2')
then
2303 fld_info(cfld)%ifld=iavblfld(iget(505))
2308 datapd(i,j,cfld) = grid1(i,jj)
2316 IF (iget(159)>0)
THEN
2320 grid1(i,j) = q10(i,j)
2323 if(grib==
'grib2')
then
2325 fld_info(cfld)%ifld=iavblfld(iget(159))
2330 datapd(i,j,cfld) = grid1(i,jj)
2340 IF (iget(422)>0)
THEN
2344 grid1(i,j) = wspd10max(i,j)
2347 if(grib==
'grib2')
then
2349 fld_info(cfld)%ifld=iavblfld(iget(422))
2351 fld_info(cfld)%tinvstat=0
2353 fld_info(cfld)%tinvstat=1
2355 fld_info(cfld)%ntrange=1
2360 datapd(i,j,cfld) = grid1(i,jj)
2368 IF (iget(783)>0)
THEN
2372 grid1(i,j) = wspd10umax(i,j)
2375 if(grib==
'grib2')
then
2377 fld_info(cfld)%ifld=iavblfld(iget(783))
2379 fld_info(cfld)%tinvstat=0
2381 fld_info(cfld)%tinvstat=1
2383 fld_info(cfld)%ntrange=1
2388 datapd(i,j,cfld) = grid1(i,jj)
2396 IF (iget(784)>0)
THEN
2400 grid1(i,j) = wspd10vmax(i,j)
2403 if(grib==
'grib2')
then
2405 fld_info(cfld)%ifld=iavblfld(iget(784))
2407 fld_info(cfld)%tinvstat=0
2409 fld_info(cfld)%tinvstat=1
2411 fld_info(cfld)%ntrange=1
2416 datapd(i,j,cfld) = grid1(i,jj)
2428 IF (iget(588)>0)
THEN
2430 CALL calvessel(iceg(1,jsta))
2434 grid1(i,j) = iceg(i,j)
2438 if(grib==
'grib2')
then
2440 fld_info(cfld)%ifld=iavblfld(iget(588))
2442 fld_info(cfld)%tinvstat=0
2444 fld_info(cfld)%tinvstat=1
2446 fld_info(cfld)%ntrange=1
2452 datapd(i,j,cfld) = grid1(i,jj)
2475 IF (iget(172)>0)
THEN
2479 IF (prec(i,j) <= pthresh .OR. sr(i,j)==spval)
THEN
2482 grid1(i,j) = sr(i,j)*100.
2486 if(grib==
'grib2')
then
2488 fld_info(cfld)%ifld=iavblfld(iget(172))
2493 datapd(i,j,cfld) = grid1(i,jj)
2501 IF (iget(249)>0)
THEN
2508 if(cprate(i,j)/=spval) grid1(i,j) = cprate(i,j)*rdtphs
2512 if(grib==
'grib2')
then
2514 fld_info(cfld)%ifld=iavblfld(iget(249))
2519 datapd(i,j,cfld) = grid1(i,jj)
2526 IF (iget(167)>0)
THEN
2534 if(prec(i,j)/=spval)
then
2535 IF(modelname /=
'RSM')
THEN
2536 grid1(i,j) = prec(i,j)*rdtphs*1000.
2538 grid1(i,j) = prec(i,j)
2543 if(grib==
'grib2')
then
2545 fld_info(cfld)%ifld=iavblfld(iget(167))
2550 datapd(i,j,cfld) = grid1(i,jj)
2557 IF (iget(508)>0)
THEN
2562 if(prate_max(i,j)/=spval) grid1(i,j)=prate_max(i,j)*sec2hr
2565 if(grib==
'grib2')
then
2567 fld_info(cfld)%ifld=iavblfld(iget(508))
2568 fld_info(cfld)%lvl=lvlsxml(1,iget(508))
2569 fld_info(cfld)%tinvstat=1
2571 fld_info(cfld)%ntrange=1
2573 fld_info(cfld)%ntrange=0
2579 datapd(i,j,cfld) = grid1(i,jj)
2586 IF (iget(509)>0)
THEN
2591 if(fprate_max(i,j)/=spval) grid1(i,j)=fprate_max(i,j)*sec2hr
2594 if(grib==
'grib2')
then
2596 fld_info(cfld)%ifld=iavblfld(iget(509))
2597 fld_info(cfld)%lvl=lvlsxml(1,iget(509))
2598 fld_info(cfld)%tinvstat=1
2600 fld_info(cfld)%ntrange=1
2602 fld_info(cfld)%ntrange=0
2608 datapd(i,j,cfld) = grid1(i,jj)
2615 IF (iget(272)>0)
THEN
2618 itprec = nint(tprec)
2620 if (itprec /= 0)
then
2621 ifincr = mod(ifhr,itprec)
2622 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
2629 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
2632 id(18) = ifhr-itprec
2634 id(18) = ifhr-ifincr
2635 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2637 IF (id(18)<0) id(18) = 0
2642 if(avgcprate(i,j)/=spval) grid1(i,j) = avgcprate(i,j)*rdtphs
2649 if(grib==
'grib2')
then
2651 fld_info(cfld)%ifld=iavblfld(iget(272))
2654 fld_info(cfld)%ntrange=0
2656 fld_info(cfld)%ntrange=1
2658 fld_info(cfld)%tinvstat=ifhr-id(18)
2664 datapd(i,j,cfld) = grid1(i,jj)
2671 IF (iget(271)>0)
THEN
2675 itprec = nint(tprec)
2677 if (itprec /= 0)
then
2678 ifincr = mod(ifhr,itprec)
2679 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
2686 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
2689 id(18) = ifhr-itprec
2691 id(18) = ifhr-ifincr
2692 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2694 IF (id(18)<0) id(18) = 0
2699 if(avgprec(i,j)/=spval) grid1(i,j) = avgprec(i,j)*rdtphs
2703 if(grib==
'grib2')
then
2705 fld_info(cfld)%ifld=iavblfld(iget(271))
2708 fld_info(cfld)%ntrange=0
2710 fld_info(cfld)%ntrange=1
2712 fld_info(cfld)%tinvstat=ifhr-id(18)
2718 datapd(i,j,cfld) = grid1(i,jj)
2725 IF (iget(087)>0)
THEN
2727 itprec = nint(tprec)
2729 if (itprec /= 0)
then
2730 ifincr = mod(ifhr,itprec)
2731 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
2738 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
2741 id(18) = ifhr-itprec
2743 id(18) = ifhr-ifincr
2744 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2746 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
2750 IF(avgprec(i,j) < spval)
THEN
2751 grid1(i,j) = avgprec(i,j)*float(id(19)-id(18))*3600.*1000./dtq2
2771 IF(acprec(i,j) < spval)
THEN
2772 grid1(i,j) = acprec(i,j)*1000.
2784 IF (id(18)<0) id(18) = 0
2786 if(grib==
'grib2')
then
2788 fld_info(cfld)%ifld=iavblfld(iget(087))
2789 fld_info(cfld)%ntrange=1
2790 fld_info(cfld)%tinvstat=ifhr-id(18)
2796 datapd(i,j,cfld) = grid1(i,jj)
2818 IF (iget(417)>0)
THEN
2820 itprec = nint(tprec)
2822 if (itprec /= 0)
then
2823 ifincr = mod(ifhr,itprec)
2824 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
2831 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
2834 id(18) = ifhr-itprec
2836 id(18) = ifhr-ifincr
2837 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2839 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
2844 IF(avgprec_cont(i,j) < spval)
THEN
2845 grid2(i,j) = avgprec_cont(i,j)*float(ifhr)*3600.*1000./dtq2
2852 IF (id(18)<0) id(18) = 0
2853 if(grib==
'grib2')
then
2855 if(modelname ==
'GFS' .OR. modelname ==
'FV3R')
then
2857 fld_info(cfld)%ifld=iavblfld(iget(417))
2858 fld_info(cfld)%ntrange=1
2859 fld_info(cfld)%tinvstat=ifhr
2865 datapd(i,j,cfld) = grid2(i,jj)
2873 IF (iget(033)>0)
THEN
2875 itprec = nint(tprec)
2877 if (itprec /= 0)
then
2878 ifincr = mod(ifhr,itprec)
2879 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
2886 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
2889 id(18) = ifhr-itprec
2891 id(18) = ifhr-ifincr
2892 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2894 IF (id(18)<0) id(18) = 0
2895 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
2899 IF(avgcprate(i,j) < spval)
THEN
2900 grid1(i,j) = avgcprate(i,j)* &
2901 float(id(19)-id(18))*3600.*1000./dtq2
2921 IF(cuprec(i,j) < spval)
THEN
2922 grid1(i,j) = cuprec(i,j)*1000.
2930 if(grib==
'grib2')
then
2932 fld_info(cfld)%ifld=iavblfld(iget(033))
2933 fld_info(cfld)%ntrange=1
2934 fld_info(cfld)%tinvstat=ifhr-id(18)
2939 datapd(i,j,cfld) = grid1(i,jj)
2959 IF (iget(418)>0)
THEN
2961 itprec = nint(tprec)
2963 if (itprec /= 0)
then
2964 ifincr = mod(ifhr,itprec)
2965 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
2972 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
2975 id(18) = ifhr-itprec
2977 id(18) = ifhr-ifincr
2978 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
2980 IF (id(18)<0) id(18) = 0
2981 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
2986 IF(avgcprate_cont(i,j) < spval)
THEN
2987 grid2(i,j) = avgcprate_cont(i,j)*float(ifhr)*3600.*1000./dtq2
2995 if(grib==
'grib2')
then
2997 if(modelname ==
'GFS' .OR. modelname ==
'FV3R')
then
2999 fld_info(cfld)%ifld=iavblfld(iget(418))
3000 fld_info(cfld)%ntrange=1
3001 fld_info(cfld)%tinvstat=ifhr
3006 datapd(i,j,cfld) = grid2(i,jj)
3014 IF (iget(034)>0)
THEN
3017 itprec = nint(tprec)
3019 if (itprec /= 0)
then
3020 ifincr = mod(ifhr,itprec)
3021 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3028 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3031 id(18) = ifhr-itprec
3033 id(18) = ifhr-ifincr
3034 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3036 IF (id(18)<0) id(18) = 0
3037 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
3041 IF(avgcprate(i,j) < spval .AND. avgprec(i,j) < spval)
then
3042 grid1(i,j) = ( avgprec(i,j) - avgcprate(i,j) ) * &
3043 float(id(19)-id(18))*3600.*1000./dtq2
3064 grid1(i,j) = ancprc(i,j)*1000.
3069 if(grib==
'grib2')
then
3071 fld_info(cfld)%ifld=iavblfld(iget(034))
3072 fld_info(cfld)%ntrange=1
3073 fld_info(cfld)%tinvstat=ifhr-id(18)
3078 datapd(i,j,cfld) = grid1(i,jj)
3098 IF (iget(419)>0)
THEN
3100 itprec = nint(tprec)
3102 if (itprec /= 0)
then
3103 ifincr = mod(ifhr,itprec)
3104 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3111 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3114 id(18) = ifhr-itprec
3116 id(18) = ifhr-ifincr
3117 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3119 IF (id(18)<0) id(18) = 0
3120 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
3125 IF(avgcprate_cont(i,j) < spval .AND. avgprec_cont(i,j) < spval)
THEN
3126 grid2(i,j) = (avgprec_cont(i,j) - avgcprate_cont(i,j)) &
3127 *float(ifhr)*3600.*1000./dtq2
3135 if(grib==
'grib2')
then
3137 if(modelname ==
'GFS' .OR. modelname ==
'FV3R')
then
3139 fld_info(cfld)%ifld=iavblfld(iget(419))
3140 fld_info(cfld)%ntrange=1
3141 fld_info(cfld)%tinvstat=ifhr
3146 datapd(i,j,cfld) = grid2(i,jj)
3154 IF (iget(256)>0)
THEN
3159 IF(lspa(i,j)<=-1.0e-6)
THEN
3160 if(acprec(i,j)/=spval) grid1(i,j) = acprec(i,j)*1000
3162 if(lspa(i,j)/=spval) grid1(i,j) = lspa(i,j)*1000.
3167 itprec = nint(tprec)
3169 if (itprec /= 0)
then
3170 ifincr = mod(ifhr,itprec)
3171 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3178 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3181 id(18) = ifhr-itprec
3183 id(18) = ifhr-ifincr
3184 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3186 IF (id(18)<0) id(18) = 0
3188 if(grib==
'grib2')
then
3190 fld_info(cfld)%ifld=iavblfld(iget(256))
3191 fld_info(cfld)%ntrange=1
3192 fld_info(cfld)%tinvstat=ifhr-id(18)
3197 datapd(i,j,cfld) = grid1(i,jj)
3204 IF (iget(035)>0)
THEN
3209 grid1(i,j) = acsnow(i,j)
3213 itprec = nint(tprec)
3215 if (itprec /= 0)
then
3216 ifincr = mod(ifhr,itprec)
3217 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3224 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3227 id(18) = ifhr-itprec
3229 id(18) = ifhr-ifincr
3230 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3232 IF (id(18)<0) id(18) = 0
3233 if(grib==
'grib2')
then
3235 fld_info(cfld)%ifld=iavblfld(iget(035))
3236 fld_info(cfld)%ntrange=1
3237 fld_info(cfld)%tinvstat=ifhr-id(18)
3242 datapd(i,j,cfld) = grid1(i,jj)
3249 IF (iget(746)>0)
THEN
3253 grid1(i,j) = acgraup(i,j)
3257 itprec = nint(tprec)
3259 if (itprec /= 0)
then
3260 ifincr = mod(ifhr,itprec)
3261 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3268 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3271 id(18) = ifhr-itprec
3273 id(18) = ifhr-ifincr
3274 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3276 IF (id(18)<0) id(18) = 0
3277 if(grib==
'grib2')
then
3279 fld_info(cfld)%ifld=iavblfld(iget(746))
3280 fld_info(cfld)%ntrange=1
3281 fld_info(cfld)%tinvstat=ifhr-id(18)
3286 datapd(i,j,cfld) = grid1(i,jj)
3293 IF (iget(782)>0)
THEN
3297 grid1(i,j) = acfrain(i,j)
3301 itprec = nint(tprec)
3303 if (itprec /= 0)
then
3304 ifincr = mod(ifhr,itprec)
3305 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3312 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3315 id(18) = ifhr-itprec
3317 id(18) = ifhr-ifincr
3318 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3320 IF (id(18)<0) id(18) = 0
3321 if(grib==
'grib2')
then
3323 fld_info(cfld)%ifld=iavblfld(iget(782))
3324 fld_info(cfld)%ntrange=1
3325 fld_info(cfld)%tinvstat=ifhr-id(18)
3330 datapd(i,j,cfld) = grid1(i,jj)
3337 IF (iget(121)>0)
THEN
3342 grid1(i,j) = acsnom(i,j)
3346 itprec = nint(tprec)
3348 if (itprec /= 0)
then
3349 ifincr = mod(ifhr,itprec)
3350 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3357 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3360 id(18) = ifhr-itprec
3362 id(18) = ifhr-ifincr
3363 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3365 IF (id(18)<0) id(18) = 0
3366 if(grib==
'grib2')
then
3368 fld_info(cfld)%ifld=iavblfld(iget(121))
3369 fld_info(cfld)%ntrange=1
3370 fld_info(cfld)%tinvstat=ifhr-id(18)
3375 datapd(i,j,cfld) = grid1(i,jj)
3382 IF (iget(405)>0)
THEN
3386 grid1(i,j) = snowfall(i,j)
3390 itprec = nint(tprec)
3392 if (itprec /= 0)
then
3393 ifincr = mod(ifhr,itprec)
3394 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3401 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3404 id(18) = ifhr-itprec
3406 id(18) = ifhr-ifincr
3407 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3409 IF (id(18)<0) id(18) = 0
3410 IF(itprec < 0)id(1:25)=0
3411 if(grib==
'grib2')
then
3413 fld_info(cfld)%ifld=iavblfld(iget(405))
3414 fld_info(cfld)%ntrange=1
3415 fld_info(cfld)%tinvstat=ifhr-id(18)
3420 datapd(i,j,cfld) = grid1(i,jj)
3427 IF (iget(122)>0)
THEN
3432 grid1(i,j) = ssroff(i,j)
3436 itprec = nint(tprec)
3438 if (itprec /= 0)
then
3439 ifincr = mod(ifhr,itprec)
3440 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3447 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3450 id(18) = ifhr-itprec
3452 id(18) = ifhr-ifincr
3453 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3455 IF (id(18)<0) id(18) = 0
3457 IF (modelname==
'RAPR')
THEN
3464 if(grib==
'grib2')
then
3466 fld_info(cfld)%ifld=iavblfld(iget(122))
3467 fld_info(cfld)%ntrange=1
3468 fld_info(cfld)%tinvstat=ifhr-id(18)
3473 datapd(i,j,cfld) = grid1(i,jj)
3480 IF (iget(123)>0)
THEN
3485 grid1(i,j) = bgroff(i,j)
3489 itprec = nint(tprec)
3491 if (itprec /= 0)
then
3492 ifincr = mod(ifhr,itprec)
3493 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3500 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3503 id(18) = ifhr-itprec
3505 id(18) = ifhr-ifincr
3506 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3508 IF (id(18)<0) id(18) = 0
3510 IF (modelname==
'RAPR')
THEN
3517 if(grib==
'grib2')
then
3519 fld_info(cfld)%ifld=iavblfld(iget(123))
3520 fld_info(cfld)%ntrange=1
3521 fld_info(cfld)%tinvstat=ifhr-id(18)
3526 datapd(i,j,cfld) = grid1(i,jj)
3533 IF (iget(343)>0)
THEN
3537 grid1(i,j) = runoff(i,j)
3541 itprec = nint(tprec)
3544 if(modelname ==
'GFS')itprec=nint(tmaxmin)
3546 if (itprec /= 0)
then
3547 ifincr = mod(ifhr,itprec)
3548 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3555 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3558 id(18) = ifhr-itprec
3560 id(18) = ifhr-ifincr
3561 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3563 IF (id(18)<0) id(18) = 0
3564 if(grib==
'grib2')
then
3566 fld_info(cfld)%ifld=iavblfld(iget(343))
3567 fld_info(cfld)%ntrange=1
3568 fld_info(cfld)%tinvstat=ifhr-id(18)
3573 datapd(i,j,cfld) = grid1(i,jj)
3581 IF (iget(434)>0.)
THEN
3588 grid1(i,j) = pcp_bucket(i,j)
3593 itprec = nint(tprec)
3595 if (itprec /= 0)
then
3596 ifincr = mod(ifhr,itprec)
3597 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3602 if(modelname==
'NCAR' .OR. modelname==
'RAPR') ifincr = nint(prec_acc_dt)/60
3605 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3608 id(18) = ifhr-itprec
3610 id(18) = ifhr-ifincr
3611 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3613 IF (id(18)<0) id(18) = 0
3614 if(grib==
'grib2')
then
3616 fld_info(cfld)%ifld=iavblfld(iget(434))
3618 fld_info(cfld)%ntrange=(ifhr-id(18))/itprec
3620 fld_info(cfld)%ntrange=0
3622 fld_info(cfld)%tinvstat=itprec
3623 if(fld_info(cfld)%ntrange==0)
then
3625 fld_info(cfld)%tinvstat=0
3627 fld_info(cfld)%tinvstat=1
3629 fld_info(cfld)%ntrange=1
3635 datapd(i,j,cfld) = grid1(i,jj)
3643 IF (iget(435)>0.)
THEN
3650 grid1(i,j) = rainc_bucket(i,j)
3655 itprec = nint(tprec)
3657 if (itprec /= 0)
then
3658 ifincr = mod(ifhr,itprec)
3659 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3664 if(modelname==
'NCAR' .OR. modelname==
'RAPR') ifincr = nint(prec_acc_dt)/60
3668 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3671 id(18) = ifhr-itprec
3673 id(18) = ifhr-ifincr
3674 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3676 IF (id(18)<0) id(18) = 0
3679 if(debugprint .and. me==0)
then
3680 print *,
'PREC_ACC_DT,ID(18),ID(19)',prec_acc_dt,id(18),id(19)
3683 if(grib==
'grib2')
then
3685 fld_info(cfld)%ifld=iavblfld(iget(435))
3687 fld_info(cfld)%ntrange=(ifhr-id(18))/itprec
3689 fld_info(cfld)%ntrange=0
3691 fld_info(cfld)%tinvstat=itprec
3692 if(fld_info(cfld)%ntrange==0)
then
3694 fld_info(cfld)%tinvstat=0
3696 fld_info(cfld)%tinvstat=1
3698 fld_info(cfld)%ntrange=1
3704 datapd(i,j,cfld) = grid1(i,jj)
3711 IF (iget(436)>0.)
THEN
3718 grid1(i,j) = rainnc_bucket(i,j)
3723 itprec = nint(tprec)
3725 if (itprec /= 0)
then
3726 ifincr = mod(ifhr,itprec)
3727 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3732 if(modelname==
'NCAR' .OR. modelname==
'RAPR') ifincr = nint(prec_acc_dt)/60
3735 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3738 id(18) = ifhr-itprec
3740 id(18) = ifhr-ifincr
3741 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3743 IF (id(18)<0) id(18) = 0
3744 if(grib==
'grib2')
then
3746 fld_info(cfld)%ifld=iavblfld(iget(436))
3748 fld_info(cfld)%ntrange=(ifhr-id(18))/itprec
3750 fld_info(cfld)%ntrange=0
3752 fld_info(cfld)%tinvstat=itprec
3753 if(fld_info(cfld)%ntrange==0)
then
3755 fld_info(cfld)%tinvstat=0
3757 fld_info(cfld)%tinvstat=1
3759 fld_info(cfld)%ntrange=1
3765 datapd(i,j,cfld) = grid1(i,jj)
3772 IF (iget(437)>0.)
THEN
3776 grid1(i,j) = snow_bucket(i,j)
3780 itprec = nint(tprec)
3782 if (itprec /= 0)
then
3783 ifincr = mod(ifhr,itprec)
3784 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3789 if(modelname==
'NCAR' .OR. modelname==
'RAPR') ifincr = nint(prec_acc_dt)/60
3792 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3795 id(18) = ifhr-itprec
3797 id(18) = ifhr-ifincr
3798 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3800 IF (id(18)<0) id(18) = 0
3802 if(grib==
'grib2')
then
3804 fld_info(cfld)%ifld=iavblfld(iget(437))
3806 fld_info(cfld)%ntrange=(ifhr-id(18))/itprec
3808 fld_info(cfld)%ntrange=0
3810 fld_info(cfld)%tinvstat=itprec
3811 if(fld_info(cfld)%ntrange==0)
then
3813 fld_info(cfld)%tinvstat=0
3815 fld_info(cfld)%tinvstat=1
3817 fld_info(cfld)%ntrange=1
3823 datapd(i,j,cfld) = grid1(i,jj)
3830 IF (iget(775)>0.)
THEN
3834 grid1(i,j) = graup_bucket(i,j)
3838 itprec = nint(tprec)
3840 if (itprec /= 0)
then
3841 ifincr = mod(ifhr,itprec)
3842 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
3847 if(modelname==
'NCAR' .OR. modelname==
'RAPR') ifincr = nint(prec_acc_dt)/60
3850 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
3853 id(18) = ifhr-itprec
3855 id(18) = ifhr-ifincr
3856 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
3858 IF (id(18)<0) id(18) = 0
3860 if(grib==
'grib2')
then
3862 fld_info(cfld)%ifld=iavblfld(iget(775))
3864 fld_info(cfld)%ntrange=(ifhr-id(18))/itprec
3866 fld_info(cfld)%ntrange=0
3868 fld_info(cfld)%tinvstat=itprec
3869 if(fld_info(cfld)%ntrange==0)
then
3871 fld_info(cfld)%tinvstat=0
3873 fld_info(cfld)%tinvstat=1
3875 fld_info(cfld)%ntrange=1
3881 datapd(i,j,cfld) = grid1(i,jj)
3889 IF (iget(913).GT.0)
THEN
3890 ffgfile=
'ffg_01h.grib2'
3891 call qpf_comp(913,ffgfile,1)
3893 IF (iget(914).GT.0)
THEN
3894 IF (ifhr .EQ. 1)
THEN
3895 ffgfile=
'ffg_01h.grib2'
3896 call qpf_comp(914,ffgfile,1)
3897 ELSEIF (ifhr .EQ. 3)
THEN
3898 ffgfile=
'ffg_03h.grib2'
3899 call qpf_comp(914,ffgfile,3)
3900 ELSEIF (ifhr .EQ. 6)
THEN
3901 ffgfile=
'ffg_06h.grib2'
3902 call qpf_comp(914,ffgfile,6)
3903 ELSEIF (ifhr .EQ. 12)
THEN
3904 ffgfile=
'ffg_12h.grib2'
3905 call qpf_comp(914,ffgfile,12)
3907 ffgfile=
'ffg_01h.grib2'
3908 call qpf_comp(914,ffgfile,0)
3915 IF (iget(915).GT.0)
THEN
3916 arifile=
'ari2y_01h.grib2'
3917 call qpf_comp(915,arifile,1)
3919 IF (iget(916).GT.0)
THEN
3920 IF (ifhr .EQ. 1)
THEN
3921 arifile=
'ari2y_01h.grib2'
3922 call qpf_comp(916,arifile,1)
3923 ELSEIF (ifhr .EQ. 3)
THEN
3924 arifile=
'ari2y_03h.grib2'
3925 call qpf_comp(916,arifile,3)
3926 ELSEIF (ifhr .EQ. 6)
THEN
3927 arifile=
'ari2y_06h.grib2'
3928 call qpf_comp(916,arifile,6)
3929 ELSEIF (ifhr .EQ. 12)
THEN
3930 arifile=
'ari2y_12h.grib2'
3931 call qpf_comp(916,arifile,12)
3932 ELSEIF (ifhr .EQ. 24)
THEN
3933 arifile=
'ari2y_24h.grib2'
3934 call qpf_comp(916,arifile,24)
3936 arifile=
'ari2y_01h.grib2'
3937 call qpf_comp(916,arifile,0)
3941 IF (iget(917).GT.0)
THEN
3942 arifile=
'ari5y_01h.grib2'
3943 call qpf_comp(917,arifile,1)
3945 IF (iget(918).GT.0)
THEN
3946 IF (ifhr .EQ. 1)
THEN
3947 arifile=
'ari5y_01h.grib2'
3948 call qpf_comp(918,arifile,1)
3949 ELSEIF (ifhr .EQ. 3)
THEN
3950 arifile=
'ari5y_03h.grib2'
3951 call qpf_comp(918,arifile,3)
3952 ELSEIF (ifhr .EQ. 6)
THEN
3953 arifile=
'ari5y_06h.grib2'
3954 call qpf_comp(918,arifile,6)
3955 ELSEIF (ifhr .EQ. 12)
THEN
3956 arifile=
'ari5y_12h.grib2'
3957 call qpf_comp(918,arifile,12)
3958 ELSEIF (ifhr .EQ. 24)
THEN
3959 arifile=
'ari5y_24h.grib2'
3960 call qpf_comp(918,arifile,24)
3962 arifile=
'ari5y_01h.grib2'
3963 call qpf_comp(918,arifile,0)
3967 IF (iget(919).GT.0)
THEN
3968 arifile=
'ari10y_01h.grib2'
3969 call qpf_comp(919,arifile,1)
3971 IF (iget(920).GT.0)
THEN
3972 IF (ifhr .EQ. 1)
THEN
3973 arifile=
'ari10y_01h.grib2'
3974 call qpf_comp(920,arifile,1)
3975 ELSEIF (ifhr .EQ. 3)
THEN
3976 arifile=
'ari10y_03h.grib2'
3977 call qpf_comp(920,arifile,3)
3978 ELSEIF (ifhr .EQ. 6)
THEN
3979 arifile=
'ari10y_06h.grib2'
3980 call qpf_comp(920,arifile,6)
3981 ELSEIF (ifhr .EQ. 12)
THEN
3982 arifile=
'ari10y_12h.grib2'
3983 call qpf_comp(920,arifile,12)
3984 ELSEIF (ifhr .EQ. 24)
THEN
3985 arifile=
'ari10y_24h.grib2'
3986 call qpf_comp(920,arifile,24)
3988 arifile=
'ari10y_01h.grib2'
3989 call qpf_comp(920,arifile,0)
3993 IF (iget(921).GT.0)
THEN
3994 arifile=
'ari100y_01h.grib2'
3995 call qpf_comp(921,arifile,1)
3997 IF (iget(922).GT.0)
THEN
3998 IF (ifhr .EQ. 1)
THEN
3999 arifile=
'ari100y_01h.grib2'
4000 call qpf_comp(922,arifile,1)
4001 ELSEIF (ifhr .EQ. 3)
THEN
4002 arifile=
'ari100y_03h.grib2'
4003 call qpf_comp(922,arifile,3)
4004 ELSEIF (ifhr .EQ. 6)
THEN
4005 arifile=
'ari100y_06h.grib2'
4006 call qpf_comp(922,arifile,6)
4007 ELSEIF (ifhr .EQ. 12)
THEN
4008 arifile=
'ari100y_12h.grib2'
4009 call qpf_comp(922,arifile,12)
4010 ELSEIF (ifhr .EQ. 24)
THEN
4011 arifile=
'ari100y_24h.grib2'
4012 call qpf_comp(922,arifile,24)
4014 arifile=
'ari100y_01h.grib2'
4015 call qpf_comp(922,arifile,0)
4022 IF (iget(526)>0.)
THEN
4026 IF (ifhr == 0 .AND. ifmin == 0)
THEN
4029 grid1(i,j) = pcp_bucket1(i,j)
4033 ifincr = nint(prec_acc_dt1)
4034 if(grib==
'grib2')
then
4036 fld_info(cfld)%ifld=iavblfld(iget(518))
4037 if(fld_info(cfld)%ntrange==0)
then
4038 if (ifhr==0 .and. ifmin==0)
then
4039 fld_info(cfld)%tinvstat=0
4041 fld_info(cfld)%tinvstat=ifincr
4043 fld_info(cfld)%ntrange=1
4049 datapd(i,j,cfld) = grid1(i,jj)
4055 IF (iget(527)>0.)
THEN
4059 IF (ifhr == 0 .AND. ifmin == 0)
THEN
4062 grid1(i,j) = rainc_bucket1(i,j)
4066 ifincr = nint(prec_acc_dt1)
4067 if(grib==
'grib2')
then
4069 fld_info(cfld)%ifld=iavblfld(iget(519))
4070 if(fld_info(cfld)%ntrange==0)
then
4071 if (ifhr==0 .and. ifmin==0)
then
4072 fld_info(cfld)%tinvstat=0
4074 fld_info(cfld)%tinvstat=ifincr
4076 fld_info(cfld)%ntrange=1
4082 datapd(i,j,cfld) = grid1(i,jj)
4088 IF (iget(528)>0.)
THEN
4092 IF (ifhr == 0 .AND. ifmin == 0)
THEN
4095 grid1(i,j) = rainnc_bucket1(i,j)
4099 ifincr = nint(prec_acc_dt1)
4100 if(grib==
'grib2')
then
4102 fld_info(cfld)%ifld=iavblfld(iget(520))
4103 if(fld_info(cfld)%ntrange==0)
then
4104 if (ifhr==0 .and. ifmin==0)
then
4105 fld_info(cfld)%tinvstat=0
4107 fld_info(cfld)%tinvstat=ifincr
4109 fld_info(cfld)%ntrange=1
4115 datapd(i,j,cfld) = grid1(i,jj)
4121 IF (iget(529)>0.)
THEN
4125 IF (ifhr == 0 .AND. ifmin == 0)
THEN
4128 grid1(i,j) = snow_bucket1(i,j)
4132 ifincr = nint(prec_acc_dt1)
4134 if(grib==
'grib2')
then
4136 fld_info(cfld)%ifld=iavblfld(iget(521))
4137 if(fld_info(cfld)%ntrange==0)
then
4138 if (ifhr==0 .and. ifmin==0)
then
4139 fld_info(cfld)%tinvstat=0
4141 fld_info(cfld)%tinvstat=ifincr
4143 fld_info(cfld)%ntrange=1
4149 datapd(i,j,cfld) = grid1(i,jj)
4155 IF (iget(530)>0.)
THEN
4159 IF (ifhr == 0 .AND. ifmin == 0)
THEN
4162 grid1(i,j) = graup_bucket1(i,j)
4166 ifincr = nint(prec_acc_dt1)
4168 if(grib==
'grib2')
then
4170 fld_info(cfld)%ifld=iavblfld(iget(522))
4171 if(fld_info(cfld)%ntrange==0)
then
4172 if (ifhr==0 .and. ifmin==0)
then
4173 fld_info(cfld)%tinvstat=0
4175 fld_info(cfld)%tinvstat=ifincr
4177 fld_info(cfld)%ntrange=1
4183 datapd(i,j,cfld) = grid1(i,jj)
4191 IF (iget(160)>0 .OR.(iget(247)>0))
THEN
4193 allocate(sleet(im,jsta:jend,nalg), rain(im,jsta:jend,nalg), &
4194 freezr(im,jsta:jend,nalg), snow(im,jsta:jend,nalg))
4195 allocate(zwet(im,jsta:jend))
4196 CALL calwxt_post(t,q,pmid,pint,htm,lmh,prec,zint,iwx1,zwet)
4200 IF (iget(160)>0)
THEN
4204 IF(zwet(i,j)<spval)
THEN
4206 snow(i,j,1) = mod(iwx,2)
4207 sleet(i,j,1) = mod(iwx,4)/2
4208 freezr(i,j,1) = mod(iwx,8)/4
4212 sleet(i,j,1) = spval
4213 freezr(i,j,1) = spval
4221 IF (iget(247)>0)
THEN
4224 grid1(i,j) = zwet(i,j)
4227 if(grib==
'grib2')
then
4229 fld_info(cfld)%ifld=iavblfld(iget(247))
4234 datapd(i,j,cfld) = grid1(i,jj)
4245 IF (iget(160)>0)
THEN
4247 CALL calwxt_ramer_post(t,q,pmid,pint,lmh,prec,iwx1)
4256 snow(i,j,2) = mod(iwx,2)
4257 sleet(i,j,2) = mod(iwx,4)/2
4258 freezr(i,j,2) = mod(iwx,8)/4
4264 iseed=44641*(int(sdat(1)-1)*24*31+int(sdat(2))*24+ihrst)+ &
4265 & mod(ifhr*60+ifmin,44641)+4357
4267 CALL calwxt_bourg_post(im,jm,jsta_2l,jend_2u,jsta,jend,lm,lp1,&
4268 & iseed,g,pthresh, &
4269 & t,q,pmid,pint,lmh,prec,zint,iwx1,me)
4279 snow(i,j,3) = mod(iwx,2)
4280 sleet(i,j,3) = mod(iwx,4)/2
4281 freezr(i,j,3) = mod(iwx,8)/4
4287 CALL calwxt_revised_post(t,q,pmid,pint,htm,lmh,prec,zint,iwx1)
4295 snow(i,j,4) = mod(iwx,2)
4296 sleet(i,j,4) = mod(iwx,4)/2
4297 freezr(i,j,4) = mod(iwx,8)/4
4304 IF(imp_physics==5 .or. imp_physics==85 .or. imp_physics==95)
then
4305 CALL calwxt_explicit_post(lmh,ths,pmid,prec,sr,f_rimef,iwx1)
4321 snow(i,j,5) = mod(iwx,2)
4322 sleet(i,j,5) = mod(iwx,4)/2
4323 freezr(i,j,5) = mod(iwx,8)/4
4328 allocate(domr(im,jsta:jend), doms(im,jsta:jend), &
4329 domzr(im,jsta:jend), domip(im,jsta:jend))
4330 CALL calwxt_dominant_post(prec(1,jsta_2l),rain,freezr,sleet,snow, &
4331 domr,domzr,domip,doms)
4338 if(prec(i,j) /= spval) grid1(i,j) = doms(i,j)
4341 if(grib==
'grib2')
then
4343 fld_info(cfld)%ifld=iavblfld(iget(551))
4348 datapd(i,j,cfld) = grid1(i,jj)
4357 if(prec(i,j)/=spval) grid1(i,j) = domip(i,j)
4360 if(grib==
'grib2')
then
4362 fld_info(cfld)%ifld=iavblfld(iget(552))
4367 datapd(i,j,cfld) = grid1(i,jj)
4382 if(prec(i,j)/=spval)grid1(i,j) = domzr(i,j)
4385 if(grib==
'grib2')
then
4387 fld_info(cfld)%ifld=iavblfld(iget(553))
4392 datapd(i,j,cfld) = grid1(i,jj)
4401 if(prec(i,j)/=spval)grid1(i,j) = domr(i,j)
4404 if(grib==
'grib2')
then
4406 fld_info(cfld)%ifld=iavblfld(iget(160))
4411 datapd(i,j,cfld) = grid1(i,jj)
4419 IF (iget(317)>0)
THEN
4421 if (.not.
allocated(sleet))
allocate(sleet(im,jsta:jend,nalg))
4422 if (.not.
allocated(rain))
allocate(rain(im,jsta:jend,nalg))
4423 if (.not.
allocated(freezr))
allocate(freezr(im,jsta:jend,nalg))
4424 if (.not.
allocated(snow))
allocate(snow(im,jsta:jend,nalg))
4425 if (.not.
allocated(zwet))
allocate(zwet(im,jsta:jend))
4426 CALL calwxt_post(t,q,pmid,pint,htm,lmh,avgprec,zint,iwx1,zwet)
4431 IF(zwet(i,j)<spval)
THEN
4433 snow(i,j,1) = mod(iwx,2)
4434 sleet(i,j,1) = mod(iwx,4)/2
4435 freezr(i,j,1) = mod(iwx,8)/4
4439 sleet(i,j,1) = spval
4440 freezr(i,j,1) = spval
4445 if (
allocated(zwet))
deallocate(zwet)
4455 CALL calwxt_ramer_post(t,q,pmid,pint,lmh,avgprec,iwx1)
4464 snow(i,j,2) = mod(iwx,2)
4465 sleet(i,j,2) = mod(iwx,4)/2
4466 freezr(i,j,2) = mod(iwx,8)/4
4472 iseed=44641*(int(sdat(1)-1)*24*31+int(sdat(2))*24+ihrst)+ &
4473 & mod(ifhr*60+ifmin,44641)+4357
4475 CALL calwxt_bourg_post(im,jm,jsta_2l,jend_2u,jsta,jend,lm,lp1,&
4476 & iseed,g,pthresh, &
4477 & t,q,pmid,pint,lmh,avgprec,zint,iwx1,me)
4487 snow(i,j,3) = mod(iwx,2)
4488 sleet(i,j,3) = mod(iwx,4)/2
4489 freezr(i,j,3) = mod(iwx,8)/4
4495 CALL calwxt_revised_post(t,q,pmid,pint,htm,lmh,avgprec,zint,iwx1)
4504 snow(i,j,4) = mod(iwx,2)
4505 sleet(i,j,4) = mod(iwx,4)/2
4506 freezr(i,j,4) = mod(iwx,8)/4
4514 IF(imp_physics == 5)
then
4515 CALL calwxt_explicit_post(lmh,ths,pmid,avgprec,sr,f_rimef,iwx1)
4531 snow(i,j,5) = mod(iwx,2)
4532 sleet(i,j,5) = mod(iwx,4)/2
4533 freezr(i,j,5) = mod(iwx,8)/4
4543 if (.not.
allocated(domr))
allocate(domr(im,jsta:jend))
4544 if (.not.
allocated(doms))
allocate(doms(im,jsta:jend))
4545 if (.not.
allocated(domzr))
allocate(domzr(im,jsta:jend))
4546 if (.not.
allocated(domip))
allocate(domip(im,jsta:jend))
4548 CALL calwxt_dominant_post(avgprec,rain,freezr,sleet,snow, &
4549 domr,domzr,domip,doms)
4552 itprec = nint(tprec)
4554 if (itprec /= 0)
then
4555 ifincr = mod(ifhr,itprec)
4556 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
4563 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
4566 id(18) = ifhr-itprec
4568 id(18) = ifhr-ifincr
4569 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
4580 if(avgprec(i,j) /= spval) grid1(i,j) = doms(i,j)
4584 if(grib==
'grib2')
then
4586 fld_info(cfld)%ifld=iavblfld(iget(555))
4588 fld_info(cfld)%ntrange=0
4590 fld_info(cfld)%ntrange=1
4592 fld_info(cfld)%tinvstat=ifhr-id(18)
4598 datapd(i,j,cfld) = grid1(i,jj)
4604 itprec = nint(tprec)
4606 if (itprec /= 0)
then
4607 ifincr = mod(ifhr,itprec)
4608 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
4615 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
4618 id(18) = ifhr-itprec
4620 id(18) = ifhr-ifincr
4621 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
4627 if(avgprec(i,j)/=spval) grid1(i,j) = domip(i,j)
4630 if(grib==
'grib2')
then
4632 fld_info(cfld)%ifld=iavblfld(iget(556))
4634 fld_info(cfld)%ntrange=0
4636 fld_info(cfld)%ntrange=1
4638 fld_info(cfld)%tinvstat=ifhr-id(18)
4644 datapd(i,j,cfld) = grid1(i,jj)
4651 itprec = nint(tprec)
4653 if (itprec /= 0)
then
4654 ifincr = mod(ifhr,itprec)
4655 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
4662 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
4665 id(18) = ifhr-itprec
4667 id(18) = ifhr-ifincr
4668 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
4680 if(avgprec(i,j)/=spval) grid1(i,j) = domzr(i,j)
4683 if(grib==
'grib2')
then
4685 fld_info(cfld)%ifld=iavblfld(iget(557))
4687 fld_info(cfld)%ntrange=0
4689 fld_info(cfld)%ntrange=1
4691 fld_info(cfld)%tinvstat=ifhr-id(18)
4697 datapd(i,j,cfld) = grid1(i,jj)
4704 itprec = nint(tprec)
4706 if (itprec /= 0)
then
4707 ifincr = mod(ifhr,itprec)
4708 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
4716 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
4719 id(18) = ifhr-itprec
4721 id(18) = ifhr-ifincr
4722 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
4728 if(avgprec(i,j)/=spval) grid1(i,j) = domr(i,j)
4731 if(grib==
'grib2')
then
4733 fld_info(cfld)%ifld=iavblfld(iget(317))
4735 fld_info(cfld)%ntrange=0
4737 fld_info(cfld)%ntrange=1
4739 fld_info(cfld)%tinvstat=ifhr-id(18)
4745 datapd(i,j,cfld) = grid1(i,jj)
4752 if (
allocated(rain))
deallocate(rain)
4753 if (
allocated(snow))
deallocate(snow)
4754 if (
allocated(sleet))
deallocate(sleet)
4755 if (
allocated(freezr))
deallocate(freezr)
4758 IF (iget(407)>0 .or. iget(559)>0 .or. &
4759 iget(560)>0 .or. iget(561)>0)
THEN
4761 if (.not.
allocated(domr))
allocate(domr(im,jsta:jend))
4762 if (.not.
allocated(doms))
allocate(doms(im,jsta:jend))
4763 if (.not.
allocated(domzr))
allocate(domzr(im,jsta:jend))
4764 if (.not.
allocated(domip))
allocate(domip(im,jsta:jend))
4779 totprcp = (rainc_bucket(i,j) + rainnc_bucket(i,j))*1.e-3
4781 if(graup_bucket(i,j)*1.e-3 > totprcp)
then
4782 print *,
'WARNING - Graupel is higher that total precip at point',i,j
4783 print *,
'totprcp,graup_bucket(i,j),snow_bucket(i,j),rainnc_bucket',&
4784 totprcp,graup_bucket(i,j),snow_bucket(i,j),rainnc_bucket(i,j)
4791 if (totprcp-graup_bucket(i,j)*1.e-3 > 0.0000001) &
4797 snowratio = snow_bucket(i,j)*1.e-3 / (totprcp-graup_bucket(i,j)*1.e-3)
4801 t2 = tshltr(i,j)*(pshltr(i,j)*1.e-5)**capa
4808 if( (snownc(i,j)/dt > 0.2e-9 .and. snowratio>=0.25) &
4810 (totprcp>0.00001.and.snowratio>=0.25))
then
4812 if (t2>=276.15)
then
4823 rainl = (1. - sr(i,j))*prec(i,j)/dt
4826 if((rainl > 2.8e-9 .and. snowratio<0.60) .or. &
4827 (totprcp>0.00001 .and. snowratio<0.60))
then
4829 if (t2>=273.15)
then
4844 if(graupelnc(i,j)/dt > 1.e-9)
then
4845 if (t2<=276.15)
then
4851 if (qrmax(i,j)>0.000005)
then
4852 if(graupelnc(i,j) > 0.5*snownc(i,j))
then
4861 if ((graupelnc(i,j)/dt) > rainl)
then
4868 else if (rainl > (4.*graupelnc(i,j)/dt))
then
4893 write (6,*)
' Snow/rain ratio'
4894 write (6,*)
' max/min 1h-SNOWFALL in [cm]', &
4895 maxval(snow_bucket)*0.1,minval(snow_bucket)*0.1
4900 if (snow_bucket(i,j)*0.1<0.1*float(icat).and. &
4901 snow_bucket(i,j)*0.1>0.1*float(icat-1))
then
4902 cnt_snowratio(icat)=cnt_snowratio(icat)+1
4908 write (6,*)
'Snow ratio point counts'
4910 write (6,*) icat, cnt_snowratio(icat)
4913 icnt_snow_rain_mixed = 0
4916 if (domr(i,j)==1 .and. doms(i,j)==1)
then
4917 icnt_snow_rain_mixed = icnt_snow_rain_mixed + 1
4922 write (6,*)
'No. of mixed snow/rain p-type diagnosed=', &
4923 icnt_snow_rain_mixed
4930 grid1(i,j)=doms(i,j)
4933 if(grib==
'grib2')
then
4935 fld_info(cfld)%ifld=iavblfld(iget(559))
4940 datapd(i,j,cfld) = grid1(i,jj)
4948 grid1(i,j) = domip(i,j)
4954 if(grib==
'grib2')
then
4956 fld_info(cfld)%ifld=iavblfld(iget(560))
4961 datapd(i,j,cfld) = grid1(i,jj)
4973 grid1(i,j) = domzr(i,j)
4976 if(grib==
'grib2')
then
4978 fld_info(cfld)%ifld=iavblfld(iget(561))
4983 datapd(i,j,cfld) = grid1(i,jj)
4991 grid1(i,j) = domr(i,j)
4994 if(grib==
'grib2')
then
4996 fld_info(cfld)%ifld=iavblfld(iget(407))
5001 datapd(i,j,cfld) = grid1(i,jj)
5008 if (
allocated(psfc))
deallocate(psfc)
5009 if (
allocated(domr))
deallocate(domr)
5010 if (
allocated(doms))
deallocate(doms)
5011 if (
allocated(domzr))
deallocate(domzr)
5012 if (
allocated(domip))
deallocate(domip)
5018 IF (iget(042)>0)
THEN
5019 IF(modelname ==
'NCAR'.OR.modelname==
'RSM' .OR. &
5020 modelname==
'RAPR')
THEN
5031 IF(sfclhx(i,j)/=spval)
THEN
5032 grid1(i,j)=-1.*sfclhx(i,j)*rrnum
5034 grid1(i,j)=sfclhx(i,j)
5039 itsrfc = nint(tsrfc)
5040 IF(itsrfc /= 0)
then
5041 ifincr = mod(ifhr,itsrfc)
5042 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5047 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5050 id(18) = ifhr-itsrfc
5052 id(18) = ifhr-ifincr
5053 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5055 IF (id(18)<0) id(18) = 0
5056 if(grib==
'grib2')
then
5058 fld_info(cfld)%ifld=iavblfld(iget(042))
5060 fld_info(cfld)%ntrange=1
5062 fld_info(cfld)%ntrange=0
5064 fld_info(cfld)%tinvstat=ifhr-id(18)
5065 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5071 IF (iget(043)>0)
THEN
5072 IF(modelname ==
'NCAR'.OR.modelname==
'RSM' .OR. &
5073 modelname==
'RAPR')
THEN
5084 IF(sfcshx(i,j)/=spval)
THEN
5085 grid1(i,j) = -1.* sfcshx(i,j)*rrnum
5087 grid1(i,j)=sfcshx(i,j)
5092 itsrfc = nint(tsrfc)
5093 IF(itsrfc /= 0)
then
5094 ifincr = mod(ifhr,itsrfc)
5095 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5100 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5103 id(18) = ifhr-itsrfc
5105 id(18) = ifhr-ifincr
5106 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5108 IF (id(18)<0) id(18) = 0
5110 if(grib==
'grib2')
then
5112 fld_info(cfld)%ifld=iavblfld(iget(043))
5114 fld_info(cfld)%ntrange=1
5116 fld_info(cfld)%ntrange=0
5118 fld_info(cfld)%tinvstat=ifhr-id(18)
5119 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5124 IF (iget(135)>0)
THEN
5125 IF(modelname ==
'NCAR'.OR.modelname==
'RSM' .OR. &
5126 modelname==
'RAPR')
THEN
5138 if(subshx(i,j)/=spval) grid1(i,j) = subshx(i,j)*rrnum
5142 itsrfc = nint(tsrfc)
5143 IF(itsrfc /= 0)
then
5144 ifincr = mod(ifhr,itsrfc)
5145 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5150 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5153 id(18) = ifhr-itsrfc
5155 id(18) = ifhr-ifincr
5156 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5158 IF (id(18)<0) id(18) = 0
5160 if(grib==
'grib2')
then
5162 fld_info(cfld)%ifld=iavblfld(iget(135))
5164 fld_info(cfld)%ntrange=1
5166 fld_info(cfld)%ntrange=0
5168 fld_info(cfld)%tinvstat=ifhr-id(18)
5169 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5174 IF (iget(136)>0)
THEN
5175 IF(modelname ==
'NCAR'.OR.modelname==
'RSM' .OR. &
5176 modelname==
'RAPR')
THEN
5188 if(snopcx(i,j)/=spval) grid1(i,j) = snopcx(i,j)*rrnum
5192 itsrfc = nint(tsrfc)
5193 IF(itsrfc /= 0)
then
5194 ifincr = mod(ifhr,itsrfc)
5195 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5200 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5203 id(18) = ifhr-itsrfc
5205 id(18) = ifhr-ifincr
5206 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5208 IF (id(18)<0) id(18) = 0
5210 if(grib==
'grib2')
then
5212 fld_info(cfld)%ifld=iavblfld(iget(136))
5214 fld_info(cfld)%ntrange=1
5216 fld_info(cfld)%ntrange=0
5218 fld_info(cfld)%tinvstat=ifhr-id(18)
5219 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5224 IF (iget(046)>0)
THEN
5225 IF(modelname ==
'NCAR'.OR.modelname==
'RSM' .OR. &
5226 modelname==
'RAPR')
THEN
5237 IF(sfcuvx(i,j)/=spval)
THEN
5238 grid1(i,j) = sfcuvx(i,j)*rrnum
5240 grid1(i,j) = sfcuvx(i,j)
5245 itsrfc = nint(tsrfc)
5246 IF(itsrfc /= 0)
then
5247 ifincr = mod(ifhr,itsrfc)
5248 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5253 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5256 id(18) = ifhr-itsrfc
5258 id(18) = ifhr-ifincr
5259 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5261 IF (id(18)<0) id(18) = 0
5263 if(grib==
'grib2')
then
5265 fld_info(cfld)%ifld=iavblfld(iget(046))
5267 fld_info(cfld)%ntrange=1
5269 fld_info(cfld)%ntrange=0
5271 fld_info(cfld)%tinvstat=ifhr-id(18)
5272 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5277 IF (iget(269)>0)
THEN
5278 IF(modelname ==
'NCAR'.OR.modelname==
'RSM' .OR. &
5279 modelname==
'RAPR')
THEN
5291 if(sfcux(i,j)/=spval) grid1(i,j) = sfcux(i,j)*rrnum
5295 itsrfc = nint(tsrfc)
5296 IF(itsrfc /= 0)
then
5297 ifincr = mod(ifhr,itsrfc)
5298 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5303 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5306 id(18) = ifhr-itsrfc
5308 id(18) = ifhr-ifincr
5309 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5311 IF (id(18)<0) id(18) = 0
5313 if(grib==
'grib2')
then
5315 fld_info(cfld)%ifld=iavblfld(iget(269))
5317 fld_info(cfld)%ntrange=1
5319 fld_info(cfld)%ntrange=0
5321 fld_info(cfld)%tinvstat=ifhr-id(18)
5322 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5327 IF (iget(270)>0)
THEN
5328 IF(modelname ==
'NCAR'.OR.modelname==
'RSM' .OR. &
5329 modelname==
'RAPR')
THEN
5341 if(sfcvx(i,j)/=spval) grid1(i,j) = sfcvx(i,j)*rrnum
5345 itsrfc = nint(tsrfc)
5346 IF(itsrfc /= 0)
then
5347 ifincr = mod(ifhr,itsrfc)
5348 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5353 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5356 id(18) = ifhr-itsrfc
5358 id(18) = ifhr-ifincr
5359 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5361 IF (id(18)<0) id(18) = 0
5363 if(grib==
'grib2')
then
5365 fld_info(cfld)%ifld=iavblfld(iget(270))
5367 fld_info(cfld)%ntrange=1
5369 fld_info(cfld)%ntrange=0
5371 fld_info(cfld)%tinvstat=ifhr-id(18)
5372 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5377 IF (iget(047)>0)
THEN
5381 if(sfcevp(i,j)/=spval) grid1(i,j) = sfcevp(i,j)*1000.
5385 itprec = nint(tprec)
5387 if (itprec /= 0)
then
5388 ifincr = mod(ifhr,itprec)
5389 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
5396 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5399 id(18) = ifhr-itprec
5401 id(18) = ifhr-ifincr
5402 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5404 IF (id(18)<0) id(18) = 0
5405 if(grib==
'grib2')
then
5407 fld_info(cfld)%ifld=iavblfld(iget(047))
5409 fld_info(cfld)%ntrange=1
5411 fld_info(cfld)%ntrange=0
5413 fld_info(cfld)%tinvstat=ifhr-id(18)
5414 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5420 IF (iget(137)>0)
THEN
5424 if(potevp(i,j)/=spval) grid1(i,j) = potevp(i,j)*1000.
5428 itprec = nint(tprec)
5430 if (itprec /= 0)
then
5431 ifincr = mod(ifhr,itprec)
5432 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
5439 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5442 id(18) = ifhr-itprec
5444 id(18) = ifhr-ifincr
5445 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5447 IF (id(18)<0) id(18) = 0
5448 if(grib==
'grib2')
then
5450 fld_info(cfld)%ifld=iavblfld(iget(137))
5452 fld_info(cfld)%ntrange=1
5454 fld_info(cfld)%ntrange=0
5456 fld_info(cfld)%tinvstat=ifhr-id(18)
5457 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5462 IF (iget(044)>0)
THEN
5465 grid1(i,j) = z0(i,j)
5468 if(grib==
'grib2')
then
5470 fld_info(cfld)%ifld=iavblfld(iget(044))
5471 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5476 IF (iget(045)>0)
THEN
5479 grid1(i,j) = ustar(i,j)
5482 if(grib==
'grib2')
then
5484 fld_info(cfld)%ifld=iavblfld(iget(045))
5485 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5491 IF (iget(132)>0)
THEN
5493 CALL caldrg(egrid1(1,jsta_2l))
5496 IF(ustar(i,j) < spval) grid1(i,j)=egrid1(i,j)
5499 if(grib==
'grib2')
then
5501 fld_info(cfld)%ifld=iavblfld(iget(132))
5502 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5506 write_cd:
IF(iget(922)>0)
THEN
5509 grid1(i,j)=cd10(i,j)
5512 if(grib==
'grib2')
then
5514 fld_info(cfld)%ifld=iavblfld(iget(922))
5515 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5518 write_ch:
IF(iget(923)>0)
THEN
5521 grid1(i,j)=ch10(i,j)
5524 if(grib==
'grib2')
then
5526 fld_info(cfld)%ifld=iavblfld(iget(923))
5527 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5532 IF ( (iget(900)>0) .OR. (iget(901)>0) )
THEN
5535 IF (iget(900)>0)
THEN
5538 grid1(i,j)=mdltaux(i,j)
5541 if(grib==
'grib2')
then
5543 fld_info(cfld)%ifld=iavblfld(iget(900))
5544 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5550 IF (iget(901)>0)
THEN
5553 grid1(i,j)=mdltauy(i,j)
5556 if(grib==
'grib2')
then
5558 fld_info(cfld)%ifld=iavblfld(iget(901))
5559 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5565 IF ( (iget(133)>0) .OR. (iget(134)>0) )
THEN
5568 IF(modelname /=
'FV3R') &
5569 CALL caltau(egrid1(1,jsta),egrid2(1,jsta))
5573 IF (iget(133)>0)
THEN
5576 IF(modelname ==
'FV3R')
THEN
5577 grid1(i,j)=sfcuxi(i,j)
5579 grid1(i,j)=egrid1(i,j)
5584 if(grib==
'grib2')
then
5586 fld_info(cfld)%ifld=iavblfld(iget(133))
5587 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5592 IF (iget(134)>0)
THEN
5595 IF(modelname ==
'FV3R')
THEN
5596 grid1(i,j)=sfcvxi(i,j)
5598 grid1(i,j)=egrid2(i,j)
5602 if(grib==
'grib2')
then
5604 fld_info(cfld)%ifld=iavblfld(iget(134))
5605 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5611 IF ( (iget(315)>0) .OR. (iget(316)>0) )
THEN
5614 IF (iget(315)>0)
THEN
5617 grid1(i,j) = gtaux(i,j)
5621 itsrfc = nint(tsrfc)
5622 IF(itsrfc /= 0)
then
5623 ifincr = mod(ifhr,itsrfc)
5624 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5629 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5632 id(18) = ifhr-itsrfc
5634 id(18) = ifhr-ifincr
5635 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5637 IF (id(18)<0) id(18) = 0
5638 if(grib==
'grib2')
then
5640 fld_info(cfld)%ifld=iavblfld(iget(315))
5642 fld_info(cfld)%ntrange=0
5644 fld_info(cfld)%ntrange=1
5646 fld_info(cfld)%tinvstat=ifhr-id(18)
5647 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5652 IF (iget(316)>0)
THEN
5655 grid1(i,j)=gtauy(i,j)
5659 itsrfc = nint(tsrfc)
5660 IF(itsrfc /= 0)
then
5661 ifincr = mod(ifhr,itsrfc)
5662 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
5667 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
5670 id(18) = ifhr-itsrfc
5672 id(18) = ifhr-ifincr
5673 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
5675 IF (id(18)<0) id(18) = 0
5676 if(grib==
'grib2')
then
5678 fld_info(cfld)%ifld=iavblfld(iget(316))
5680 fld_info(cfld)%ntrange=0
5682 fld_info(cfld)%ntrange=1
5684 fld_info(cfld)%tinvstat=ifhr-id(18)
5685 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5691 IF (iget(154)>0)
THEN
5694 IF(modelname==
'NCAR'.OR.modelname==
'RSM' .OR. &
5695 modelname==
'RAPR')
THEN
5699 grid1(i,j) = twbs(i,j)
5706 IF(twbs(i,j) < spval) grid1(i,j) = -twbs(i,j)
5710 if(grib==
'grib2')
then
5712 fld_info(cfld)%ifld=iavblfld(iget(154))
5713 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5718 IF (iget(155)>0)
THEN
5721 IF(modelname==
'NCAR'.OR.modelname==
'RSM' .OR. &
5722 modelname==
'RAPR')
THEN
5726 grid1(i,j) = qwbs(i,j)
5733 IF(qwbs(i,j) < spval) grid1(i,j) = -qwbs(i,j)
5737 if(grib==
'grib2')
then
5739 fld_info(cfld)%ifld=iavblfld(iget(155))
5740 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5745 IF (iget(169)>0)
THEN
5748 grid1(i,j)=sfcexc(i,j)
5751 if(grib==
'grib2')
then
5753 fld_info(cfld)%ifld=iavblfld(iget(169))
5754 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5759 IF (iget(170)>0)
THEN
5763 if(vegfrc(i,j)/=spval) grid1(i,j)=vegfrc(i,j)*100.
5766 if(grib==
'grib2')
then
5768 fld_info(cfld)%ifld=iavblfld(iget(170))
5769 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5775 IF (iget(726)>0)
THEN
5779 if(shdmin(i,j)/=spval) grid1(i,j)=shdmin(i,j)*100.
5782 if(grib==
'grib2')
then
5784 fld_info(cfld)%ifld=iavblfld(iget(726))
5785 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5790 IF (iget(729)>0)
THEN
5794 if(shdmax(i,j)/=spval) grid1(i,j)=shdmax(i,j)*100.
5797 if(grib==
'grib2')
then
5799 fld_info(cfld)%ifld=iavblfld(iget(729))
5800 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5805 IF (modelname ==
'NCAR'.OR.modelname==
'NMM' .OR. &
5806 modelname ==
'FV3R' .OR. modelname==
'RAPR')
THEN
5807 IF (isf_surface_physics == 2 .OR. modelname==
'RAPR')
THEN
5808 IF (iget(254)>0)
THEN
5811 IF (modelname==
'RAPR')
THEN
5818 if(grib==
'grib2')
then
5820 fld_info(cfld)%ifld=iavblfld(iget(254))
5821 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5828 IF (iget(152)>0)
THEN
5831 grid1(i,j)=grnflx(i,j)
5834 if(grib==
'grib2')
then
5836 fld_info(cfld)%ifld=iavblfld(iget(152))
5837 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5841 IF (iget(218)>0)
THEN
5844 grid1(i,j) = float(ivgtyp(i,j))
5847 if(grib==
'grib2')
then
5849 fld_info(cfld)%ifld=iavblfld(iget(218))
5850 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5855 IF (iget(219)>0)
THEN
5858 grid1(i,j) = float(isltyp(i,j))
5861 if(grib==
'grib2')
then
5863 fld_info(cfld)%ifld=iavblfld(iget(219))
5864 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5868 IF (iget(223)>0)
THEN
5871 grid1(i,j) = float(islope(i,j))
5874 if(grib==
'grib2')
then
5876 fld_info(cfld)%ifld=iavblfld(iget(223))
5877 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5884 IF (modelname ==
'NCAR'.OR.modelname==
'NMM' .OR. &
5885 modelname ==
'FV3R' .OR. modelname==
'RAPR')
THEN
5886 IF (iget(220)>0 .OR. iget(234)>0 &
5887 & .OR. iget(235)>0 .OR. iget(236)>0 &
5888 & .OR. iget(237)>0 .OR. iget(238)>0 &
5889 & .OR. iget(239)>0 .OR. iget(240)>0 &
5890 & .OR. iget(241)>0 )
THEN
5891 IF (isf_surface_physics == 2)
THEN
5893 allocate(rsmin(im,jsta:jend), smcref(im,jsta:jend), gc(im,jsta:jend), &
5894 rcq(im,jsta:jend), rct(im,jsta:jend), rcsoil(im,jsta:jend), rcs(im,jsta:jend))
5897 IF( (abs(sm(i,j)-0.) < 1.0e-5) .AND. &
5898 & (abs(sice(i,j)-0.) < 1.0e-5) )
THEN
5899 IF(czmean(i,j)>1.e-6)
THEN
5900 factrs = czen(i,j)/czmean(i,j)
5905 llmh = nint(lmh(i,j))
5906 solar = rswin(i,j)*factrs
5907 sfctmp = t(i,j,llmh)
5909 sfcprs = pint(i,j,llmh+1)
5917 CALL canres(solar,sfctmp,sfcq,sfcprs &
5918 & ,sh2o(i,j,1:nsoil),gc(i,j),rc,ivg,isltyp(i,j) &
5919 & ,rsmin(i,j),nroots(i,j),smcwlt(i,j),smcref(i,j) &
5920 & ,rcs(i,j),rcq(i,j),rct(i,j),rcsoil(i,j),sldpth)
5921 IF(abs(smcwlt(i,j)-0.5)<1.e-5)print*, &
5922 &
'LARGE SMCWLT',i,j,sm(i,j),isltyp(i,j),smcwlt(i,j)
5937 IF (iget(220)>0 )
THEN
5940 grid1(i,j) = gc(i,j)
5943 if(grib==
'grib2')
then
5945 fld_info(cfld)%ifld=iavblfld(iget(220))
5946 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5950 IF (iget(234)>0 )
THEN
5953 grid1(i,j) = rsmin(i,j)
5956 if(grib==
'grib2')
then
5958 fld_info(cfld)%ifld=iavblfld(iget(234))
5959 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5963 IF (iget(235)>0 )
THEN
5966 grid1(i,j) = float(nroots(i,j))
5969 if(grib==
'grib2')
then
5971 fld_info(cfld)%ifld=iavblfld(iget(235))
5972 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5976 IF (iget(236)>0 )
THEN
5979 grid1(i,j) = smcwlt(i,j)
5982 if(grib==
'grib2')
then
5984 fld_info(cfld)%ifld=iavblfld(iget(236))
5985 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
5989 IF (iget(237)>0 )
THEN
5992 grid1(i,j) = smcref(i,j)
5995 if(grib==
'grib2')
then
5997 fld_info(cfld)%ifld=iavblfld(iget(237))
5998 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6002 IF (iget(238)>0 )
THEN
6005 grid1(i,j) = rcs(i,j)
6008 if(grib==
'grib2')
then
6010 fld_info(cfld)%ifld=iavblfld(iget(238))
6011 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6015 IF (iget(239)>0 )
THEN
6018 grid1(i,j) = rct(i,j)
6021 if(grib==
'grib2')
then
6023 fld_info(cfld)%ifld=iavblfld(iget(239))
6024 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6028 IF (iget(240)>0 )
THEN
6031 grid1(i,j) = rcq(i,j)
6034 if(grib==
'grib2')
then
6036 fld_info(cfld)%ifld=iavblfld(iget(240))
6037 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6041 IF (iget(241)>0 )
THEN
6044 grid1(i,j) = rcsoil(i,j)
6047 if(grib==
'grib2')
then
6049 fld_info(cfld)%ifld=iavblfld(iget(241))
6050 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6054 if (
allocated(rsmin))
deallocate(rsmin)
6055 if (
allocated(smcref))
deallocate(smcref)
6056 if (
allocated(rcq))
deallocate(rcq)
6057 if (
allocated(rct))
deallocate(rct)
6058 if (
allocated(rcsoil))
deallocate(rcsoil)
6059 if (
allocated(rcs))
deallocate(rcs)
6060 if (
allocated(gc))
deallocate(gc)
6067 IF(modelname ==
'GFS')
THEN
6073 grid1(i,j) = smcwlt(i,j)
6081 if(grib==
'grib2')
then
6083 fld_info(cfld)%ifld=iavblfld(iget(236))
6088 datapd(i,j,cfld) = grid1(i,jj)
6098 grid1(i,j) = fieldcapa(i,j)
6106 if(grib==
'grib2')
then
6108 fld_info(cfld)%ifld=iavblfld(iget(397))
6113 datapd(i,j,cfld) = grid1(i,jj)
6123 grid1(i,j) = suntime(i,j)
6127 itsrfc = nint(tsrfc)
6128 IF(itsrfc /= 0)
then
6129 ifincr = mod(ifhr,itsrfc)
6130 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
6135 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
6138 id(18) = ifhr-itsrfc
6140 id(18) = ifhr-ifincr
6141 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
6143 IF (id(18)<0) id(18) = 0
6144 if(grib==
'grib2')
then
6146 fld_info(cfld)%ifld=iavblfld(iget(396))
6148 fld_info(cfld)%ntrange=1
6150 fld_info(cfld)%ntrange=0
6152 fld_info(cfld)%tinvstat=ifhr-id(18)
6157 datapd(i,j,cfld) = grid1(i,jj)
6167 grid1(i,j) = avgpotevp(i,j)
6171 itsrfc = nint(tsrfc)
6172 IF(itsrfc /= 0)
then
6173 ifincr = mod(ifhr,itsrfc)
6174 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itsrfc*60)
6179 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
6182 id(18) = ifhr-itsrfc
6184 id(18) = ifhr-ifincr
6185 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
6187 IF (id(18)<0) id(18) = 0
6188 if(grib==
'grib2')
then
6190 fld_info(cfld)%ifld=iavblfld(iget(517))
6192 fld_info(cfld)%ntrange=1
6194 fld_info(cfld)%ntrange=0
6196 fld_info(cfld)%tinvstat=ifhr-id(18)
6201 datapd(i,j,cfld) = grid1(i,jj)
6210 IF (iget(282)>0)
THEN
6217 if(grib==
'grib2')
then
6219 fld_info(cfld)%ifld=iavblfld(iget(282))
6220 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6225 IF (iget(283)>0)
THEN
6234 IF(pmid(1,1,l)>=(pdtop+pt))
EXIT
6238 CALL mpi_bcast(l,1,mpi_integer,0,mpi_comm_comp,irtn)
6239 if(grib==
'grib2')
then
6241 fld_info(cfld)%ifld=iavblfld(iget(283))
6242 fld_info(cfld)%lvl1=1
6243 fld_info(cfld)%lvl2=l
6244 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6249 IF (iget(273)>0)
THEN
6258 IF((pint(1,1,lm+1)-pd(1,1))<=(pint(1,1,l)+1.00))
EXIT
6262 CALL mpi_bcast(l,1,mpi_integer,0,mpi_comm_comp,irtn)
6263 if(grib==
'grib2')
then
6265 fld_info(cfld)%ifld=iavblfld(iget(273))
6266 fld_info(cfld)%lvl1=l
6267 fld_info(cfld)%lvl2=lm+1
6268 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6274 IF (iget(503)>0)
THEN
6277 grid1(i,j)=akhsavg(i,j)
6289 if(grib==
'grib2')
then
6291 fld_info(cfld)%ifld=iavblfld(iget(503))
6292 fld_info(cfld)%ntrange=ifhr-id(18)
6293 fld_info(cfld)%tinvstat=1
6294 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6299 IF (iget(504)>0)
THEN
6302 grid1(i,j)=akmsavg(i,j)
6314 if(grib==
'grib2')
then
6316 fld_info(cfld)%ifld=iavblfld(iget(504))
6317 fld_info(cfld)%ntrange=ifhr-id(18)
6318 fld_info(cfld)%tinvstat=1
6319 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
6327 subroutine qpf_comp(igetfld,compfile,fcst)
6332 use ctlblk_mod
, only: spval,jsta,jend,im,dtq2,ifhr,ifmin,tprec,grib, &
6333 modelname,jm,cfld,datapd,fld_info,jsta_2l,jend_2u
6334 use rqstfld_mod
, only: iget, id, lvls, iavblfld
6335 use grib2_module, only: read_grib2_head, read_grib2_sngle
6336 use vrbls2d, only: avgprec, avgprec_cont
6338 character(len=256),
intent(in) :: compfile
6339 integer,
intent(in) :: igetfld,fcst
6340 integer :: trange,invstat
6341 real,
dimension(IM,JM) :: outgrid
6343 real,
allocatable,
dimension(:,:) :: mscvalue
6345 integer :: nx, ny, nz, ntot, mscnlon, mscnlat, height
6346 integer :: itprec, ifincr
6347 real :: rlonmin, rlatmax
6350 logical :: file_exists
6352 integer :: i, j, k, jj
6355 INQUIRE(file=compfile, exist=file_exists)
6356 if (file_exists)
then
6357 call read_grib2_head(compfile,nx,ny,nz,rlonmin,rlatmax,&
6361 if (.not.
allocated(mscvalue))
then
6362 allocate(mscvalue(mscnlon,mscnlat))
6365 call read_grib2_sngle(compfile,ntot,height,mscvalue)
6367 write(*,*)
'WARNING: FFG file not available for hour: ', fcst
6372 itprec = nint(tprec)
6373 if (itprec /= 0)
then
6374 ifincr = mod(ifhr,itprec)
6375 IF(ifmin >= 1)ifincr= mod(ifhr*60+ifmin,itprec*60)
6381 IF(ifmin >= 1)id(19)=ifhr*60+ifmin
6384 id(18) = ifhr-itprec
6386 id(18) = ifhr-ifincr
6387 IF(ifmin >= 1)id(18)=ifhr*60+ifmin-ifincr
6391 IF(modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
6393 IF (file_exists)
THEN
6396 IF (ifhr .EQ. 0 .OR. fcst .EQ. 0)
THEN
6398 ELSE IF (mscvalue(i,j) .LE. 0.0)
THEN
6400 ELSE IF (fcst .EQ. 1 .AND. avgprec(i,j)*float(id(19)-id(18))*3600.*1000./dtq2 .GT. mscvalue(i,j))
THEN
6402 ELSE IF (fcst .GT. 1 .AND. avgprec_cont(i,j)*float(ifhr)*3600.*1000./dtq2 .GT. mscvalue(i,j))
THEN
6410 outgrid = 0.0*avgprec
6415 IF (id(18).LT.0) id(18) = 0
6418 IF(fcst .EQ. 1)
THEN
6420 trange = (ifhr-id(18))/itprec
6425 IF(trange .EQ. 0)
THEN
6426 IF (ifhr .EQ. 0)
THEN
6435 IF (ifhr .EQ. fcst)
THEN
6442 IF(grib==
'grib2')
then
6444 fld_info(cfld)%ifld=iavblfld(iget(igetfld))
6445 fld_info(cfld)%ntrange=trange
6446 fld_info(cfld)%tinvstat=invstat
6451 datapd(i,j,cfld) = outgrid(i,jj)
6458 end subroutine qpf_comp
elemental real function, public fpvsnew(t)
calcape() computes CAPE/CINS and other storm related variables.