21 SUBROUTINE calrad_wcloud
23 use vrbls3d, only: o3, pint, pmid, t, q, qqw, qqi, qqr, f_rimef, nlice, nrain, qqs, qqg, &
25 use vrbls2d, only: czen, ivgtyp, sno, pctsno, ths, vegfrc, si, u10h, v10h, u10,&
26 v10, smstot, hbot, htop, cnvcfr
27 use masks, only: gdlat, gdlon, sm, lmh, sice
29 use gridspec_mod
, only: gridtype
30 use cmassi_mod
, only: trad_ice
31 use kinds, only: r_kind,r_single,r_double,i_kind
32 use crtm_module
, only: crtm_atmosphere_type,crtm_surface_type,crtm_geometry_type, &
33 crtm_surface_create,o3_id,co2_id,crtm_forward,mass_mixing_ratio_units, &
34 crtm_atmosphere_create, &
35 crtm_options_type,crtm_destroy,crtm_init,specific_amount_units, &
36 success,crtm_options_destroy,crtm_options_create, crtm_options_associated
38 use crtm_rtsolution_define
, only: crtm_rtsolution_type, crtm_rtsolution_create, &
39 crtm_rtsolution_destroy, crtm_rtsolution_associated
40 use crtm_spccoeff
, only: sc
41 use crtm_atmosphere_define
, only:h2o_id,crtm_atmosphere_associated, &
42 crtm_atmosphere_destroy,volume_mixing_ratio_units,crtm_atmosphere_zero
43 use crtm_surface_define
, only: crtm_surface_destroy, crtm_surface_associated, &
45 use crtm_channelinfo_define
, only: crtm_channelinfo_type
47 use crtm_parameters
, only: limit_exp,toa_pressure,max_n_layers,max_sensor_scan_angle
48 use crtm_cloud_define
, only: water_cloud,ice_cloud,rain_cloud,snow_cloud,graupel_cloud,hail_cloud
49 use message_handler
, only: success,warning, display_message
51 use params_mod, only: pi, rtd, p1000, capa, h1000, h1, g, rd, d608, qconv, small
52 use rqstfld_mod
, only: iget, id, lvls, iavblfld
53 use ctlblk_mod
, only: modelname, ivegsrc, novegtype, imp_physics, lm, spval, icu_physics,&
54 grib, cfld, fld_info, datapd, idat, im, jsta, jend, jm, me, ista, iend
81 INTEGER,
PARAMETER :: invalid_land = 0
82 INTEGER,
PARAMETER :: compacted_soil = 1
83 INTEGER,
PARAMETER :: tilled_soil = 2
84 INTEGER,
PARAMETER :: sand = 3
85 INTEGER,
PARAMETER :: rock = 4
86 INTEGER,
PARAMETER :: irrigated_low_vegetation = 5
87 INTEGER,
PARAMETER :: meadow_grass = 6
88 INTEGER,
PARAMETER :: scrub = 7
89 INTEGER,
PARAMETER :: broadleaf_forest = 8
90 INTEGER,
PARAMETER :: pine_forest = 9
91 INTEGER,
PARAMETER :: tundra = 10
92 INTEGER,
PARAMETER :: grass_soil = 11
93 INTEGER,
PARAMETER :: broadleaf_pine_forest = 12
94 INTEGER,
PARAMETER :: grass_scrub = 13
95 INTEGER,
PARAMETER :: soil_grass_scrub = 14
96 INTEGER,
PARAMETER :: urban_concrete = 15
97 INTEGER,
PARAMETER :: pine_brush = 16
98 INTEGER,
PARAMETER :: broadleaf_brush = 17
99 INTEGER,
PARAMETER :: wet_soil = 18
100 INTEGER,
PARAMETER :: scrub_soil = 19
101 INTEGER,
PARAMETER :: broadleaf70_pine30 = 20
104 integer,
allocatable:: model_to_crtm(:)
105 integer,
parameter:: ndat=100
107 integer,
parameter:: n_absorbers = 2
109 integer,
parameter:: n_aerosols = 0
111 integer(i_kind),
parameter:: n_sensors=22
112 character(len=20),
parameter,
dimension(1:n_sensors):: sensorlist= &
135 character(len=13),
parameter,
dimension(1:n_sensors):: obslist= &
158 character(len=20),
dimension(1:n_sensors):: sensorlist_local
160 integer(i_kind) sensorindex
161 integer(i_kind) lunin,nobs,nchanl,nreal
162 integer(i_kind) error_status,itype
163 integer(i_kind) err1,err2,err3,err4
164 integer(i_kind) i,j,k,msig
165 integer(i_kind) lcbot,lctop
166 integer jdn,ichan,ixchan,igot
172 real(r_kind),
parameter:: r100=100.0_r_kind
173 real,
parameter:: ozsmall = 1.e-10
175 real(r_double),
dimension(4):: sfcpct
176 real(r_kind) snodepth,vegcover
179 real(r_kind),
dimension(ista:iend,jsta:jend):: tb1,tb2,tb3,tb4
180 real(r_kind),
allocatable :: tb(:,:,:)
181 real,
dimension(im,jm):: grid1
182 real sun_zenith,sun_azimuth, dpovg, sun_zenith_rad
185 real,
parameter:: constoz = 604229.0_r_kind
188 character(13)::obstype
190 character(20)::isis_local
192 logical hirs2,msu,goessndr,hirs3,hirs4,hirs,amsua,amsub,airs,hsb &
193 ,goes_img,abi,seviri, mhs,insat3d
194 logical avhrr,avhrr_navy,lextra,ssu
195 logical ssmi,ssmis,amsre,amsre_low,amsre_mid,amsre_hig,change
196 logical ssmis_las,ssmis_uas,ssmis_env,ssmis_img
197 logical sea,mixed,land,ice,snow,toss
198 logical micrim,microwave
199 logical post_abig16, post_abig17, post_abigr
200 logical fix_abig16, fix_abig17
204 logical,
parameter :: debugprint = .false.
205 type(crtm_atmosphere_type
),
dimension(1):: atmosphere
206 type(crtm_surface_type
),
dimension(1) :: surface
207 type(crtm_geometry_type
),
dimension(1) :: geometryinfo
208 type(crtm_options_type
),
dimension(1) :: options
210 type(crtm_rtsolution_type
),
allocatable,
dimension(:,:):: rtsolution
211 type(crtm_channelinfo_type
),
allocatable,
dimension(:) :: channelinfo
213 integer ii,jj,n_clouds,n,nc
214 integer,
external :: iw3jdn
223 sensorlist_local(n) = sensorlist(n)
224 if (sensorlist(n) ==
'abi_g16')
then
225 inquire(file=
'abi_g16.SpcCoeff.bin',exist=fix_abig16)
226 if (.not.fix_abig16) sensorlist_local(n) =
'abi_gr '
228 if (sensorlist(n) ==
'abi_g17')
then
229 inquire(file=
'abi_g17.SpcCoeff.bin',exist=fix_abig17)
230 if (.not.fix_abig17) sensorlist_local(n) =
'abi_gr '
238 allocate(model_to_crtm(novegtype) )
239 model_to_crtm=(/pine_forest, broadleaf_forest, pine_forest, &
240 broadleaf_forest,broadleaf_pine_forest, scrub, scrub_soil, &
241 broadleaf_brush,broadleaf_brush, scrub, broadleaf_brush, &
242 tilled_soil, urban_concrete,tilled_soil, invalid_land, &
243 compacted_soil, invalid_land, tundra,tundra, tundra/)
244 else if(ivegsrc==0)
then
245 allocate(model_to_crtm(novegtype) )
246 model_to_crtm=(/urban_concrete, &
247 compacted_soil, irrigated_low_vegetation, grass_soil, meadow_grass, &
248 meadow_grass, meadow_grass, scrub, grass_scrub, meadow_grass, &
249 broadleaf_forest, pine_forest, broadleaf_forest, pine_forest, &
250 broadleaf_pine_forest, compacted_soil, wet_soil, wet_soil, &
251 irrigated_low_vegetation, tundra, tundra, tundra, tundra, &
253 else if(ivegsrc==2)
then
254 allocate(model_to_crtm(0:novegtype) )
255 model_to_crtm=(/compacted_soil, &
256 broadleaf_forest, broadleaf_forest, broadleaf_pine_forest, &
257 pine_forest, pine_forest, broadleaf_brush, scrub, scrub, scrub_soil, &
258 tundra, compacted_soil, tilled_soil, compacted_soil/)
260 print*,
'novegtype=',novegtype
261 print*,
'model veg type not supported by post in calling crtm '
262 print*,
'skipping generation of simulated radiance'
270 if (iget(n) > 0) post_abig16=.true.
274 if (iget(n) > 0) post_abig17=.true.
278 if (iget(n) > 0) post_abigr=.true.
282 if (iget(n) > 0) post_ahi8=.true.
286 if (iget(n) > 0) post_ssmis17=.true.
291 ifactive:
if (iget(327) > 0 .or. iget(328) > 0 .or. iget(329) > 0 &
292 .or. iget(330) > 0 .or. iget(446) > 0 .or. iget(447) > 0 &
293 .or. iget(448) > 0 .or. iget(449) > 0 .or. iget(456) > 0 &
294 .or. iget(457) > 0 .or. iget(458) > 0 .or. iget(459) > 0 &
295 .or. iget(460) > 0 .or. iget(461) > 0 .or. iget(462) > 0 &
296 .or. iget(463) > 0 .or. iget(483) > 0 .or. iget(484) > 0 &
297 .or. iget(485) > 0 .or. iget(486) > 0 .or. iget(488) > 0 &
298 .or. iget(489) > 0 .or. iget(490) > 0 .or. iget(491) > 0 &
299 .or. iget(492) > 0 .or. iget(493) > 0 .or. iget(494) > 0 &
300 .or. iget(495) > 0 .or. iget(496) > 0 .or. iget(497) > 0 &
301 .or. iget(498) > 0 .or. iget(499) > 0 .or. iget(800) > 0 &
302 .or. iget(801) > 0 .or. iget(802) > 0 .or. iget(803) > 0 &
303 .or. iget(804) > 0 .or. iget(805) > 0 .or. iget(806) > 0 &
304 .or. iget(807) > 0 .or. iget(809) > 0 &
305 .or. iget(810) > 0 .or. iget(811) > 0 .or. iget(812) > 0 &
306 .or. iget(813) > 0 .or. iget(814) > 0 .or. iget(815) > 0 &
307 .or. iget(816) > 0 .or. iget(817) > 0 .or. iget(818) > 0 &
308 .or. iget(819) > 0 .or. iget(820) > 0 .or. iget(821) > 0 &
309 .or. iget(822) > 0 .or. iget(823) > 0 .or. iget(824) > 0 &
310 .or. iget(825) > 0 .or. iget(826) > 0 .or. iget(827) > 0 &
311 .or. iget(828) > 0 .or. iget(829) > 0 .or. iget(830) > 0 &
312 .or. iget(831) > 0 .or. iget(832) > 0 .or. iget(833) > 0 &
313 .or. iget(834) > 0 .or. iget(835) > 0 .or. iget(836) > 0 &
314 .or. iget(837) > 0 .or. iget(838) > 0 .or. iget(839) > 0 &
315 .or. iget(840) > 0 .or. iget(841) > 0 .or. iget(842) > 0 &
316 .or. iget(843) > 0 .or. iget(844) > 0 .or. iget(845) > 0 &
317 .or. iget(846) > 0 .or. iget(847) > 0 .or. iget(848) > 0 &
318 .or. iget(849) > 0 .or. iget(850) > 0 .or. iget(851) > 0 &
319 .or. iget(852) > 0 .or. iget(856) > 0 .or. iget(857) > 0 &
320 .or. iget(860) > 0 .or. iget(861) > 0 &
321 .or. iget(862) > 0 .or. iget(863) > 0 .or. iget(864) > 0 &
322 .or. iget(865) > 0 .or. iget(866) > 0 .or. iget(867) > 0 &
323 .or. iget(868) > 0 .or. iget(869) > 0 .or. iget(870) > 0 &
324 .or. iget(871) > 0 .or. iget(872) > 0 .or. iget(873) > 0 &
325 .or. iget(874) > 0 .or. iget(875) > 0 .or. iget(876) > 0 &
326 .or. iget(877) > 0 .or. iget(878) > 0 .or. iget(879) > 0 &
327 .or. iget(880) > 0 .or. iget(881) > 0 .or. iget(882) > 0 &
328 .or. post_ahi8 .or. post_ssmis17 &
329 .or. post_abig16 .or. post_abig17 .or. post_abigr )
then
331 ! specify numbers of cloud species
332 ! thompson==8, ferrier==5,95, wsm6==6, lin==2
333 if(imp_physics==99 .or. imp_physics==98)
then
335 else if(imp_physics==5 .or. imp_physics==85 .or. imp_physics==95)
then
337 else if(imp_physics==8 .or. imp_physics==6 .or. imp_physics==2 &
338 .or. imp_physics==28 .or. imp_physics==11)
then
342 print*,
'Warning: number of cloud species (n_clouds) being set to zero for imp_physics=',imp_physics
345 ! initialize debug print gridpoint index to middle of tile:
349 ! initialize ozone to zeros for wrf nmm and arw for now
350 if (modelname ==
'NMM' .OR. modelname ==
'NCAR' .OR. modelname ==
'RAPR' &
352 ! compute solar zenith angle for gfs, arw now computes czen in initpost
354 jdn=iw3jdn(idat(3),idat(1),idat(2))
357 call
zensun(jdn,float(idat(4)),gdlat(i,j),gdlon(i,j) &
358 ,pi,sun_zenith,sun_azimuth)
359 sun_zenith_rad=sun_zenith/rtd
360 czen(i,j)=cos(sun_zenith_rad)
363 if(jj>=jsta .and. jj<=jend.and.debugprint) &
364 print*,
'sample GFS zenith angle=',acos(czen(ii,jj))*rtd
366 ! initialize crtm. load satellite sensor array.
367 ! the
optional arguments process_id and output_process_id limit
368 ! generation of runtime informative output to mpi task
369 ! output_process_id(which here is set to be task 0)
370 if(me==0)print*,
'success in CALRAD= ',success
371 allocate( channelinfo(n_sensors))
373 error_status = crtm_init(sensorlist_local,channelinfo, &
374 process_id=0,output_process_id=0 )
375 if(me==0)print*,
'channelinfo after init= ',channelinfo(1)%sensor_id, &
376 channelinfo(2)%sensor_id
377 if (error_status /= 0_i_kind) &
378 write(6,*)
'ERROR*** crtm_init error_status=',error_status
380 ! restrict channel list to those which are selected for simulation
381 ! in the lvls filed of wrf_cntrl.parm(does not currently apply
382 ! to all sensors / channels).
386 call select_channels_l(channelinfo(2),4,(/ 1,2,3,4 /),lvls(1:4,iget(868)),iget(868))
390 call select_channels_l(channelinfo(1),4,(/ 1,2,3,4 /),lvls(1:4,iget(872)),iget(872))
396 if (iget(n) > 0)
then
400 if (nchanl > 0 .and. nchanl <10)
then
402 if (iget(n) == 0) channelinfo(19)%Process_Channel(n-927+1)=.false.
410 if (iget(n) > 0)
then
414 if (nchanl > 0 .and. nchanl <10)
then
416 if (iget(n) == 0) channelinfo(20)%Process_Channel(n-937+1)=.false.
420 ! goes-r for nadir output
424 if (iget(n) > 0)
then
428 if (nchanl > 0 .and. nchanl <10)
then
430 if (iget(n) == 0) channelinfo(20)%Process_Channel(n-958+1)=.false.
435 ! himawari-8 ahi infrared
439 if (iget(n) > 0)
then
443 if (nchanl > 0 .and. nchanl <10)
then
445 if (iget(n) == 0) channelinfo(22)%Process_Channel(n-969+1)=.false.
450 ! ssmis f17(37h, 37v, 91h, 91v)
454 if (iget(n) > 0)
then
458 if (nchanl > 14 .and. nchanl < 19)
then
460 if (iget(n) == 0) channelinfo(11)%Process_Channel(n-825+15)=.false.
465 ! ssmi, f13-f15(19h,19v,??h,37h,37v,85h,85v)
467 call select_channels_l(channelinfo(7),7,(/ 1,2,3,4,5,6,7 /),lvls(1:7,iget(800)),iget(800))
470 call select_channels_l(channelinfo(8),7,(/ 1,2,3,4,5,6,7 /),lvls(1:7,iget(806)),iget(806))
473 call select_channels_l(channelinfo(9),7,(/ 1,2,3,4,5,6,7 /),lvls(1:7,iget(812)),iget(812))
475 ! ssmis, f16-f20(183h,19h,19v,37h,37v,91h,91v)
477 call select_channels_l(channelinfo(10),24,(/ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 /),lvls(1:24,iget(818)),iget(818))
483 call select_channels_l(channelinfo(12),24,(/ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 /),lvls(1:24,iget(832)),iget(832))
486 call select_channels_l(channelinfo(13),24,(/ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 /),lvls(1:24,iget(839)),iget(839))
489 call select_channels_l(channelinfo(14),24,(/ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 /),lvls(1:24,iget(846)),iget(846))
493 call select_channels_l(channelinfo(15),8,(/ 1,2,3,4,5,6,7,8 /),lvls(1:8,iget(876)),iget(876))
497 call select_channels_l(channelinfo(16),4,(/ 1,2,3,4 /),lvls(1:4,iget(860)),iget(860))
501 call select_channels_l(channelinfo(17),4,(/ 1,2,3,4 /),lvls(1:4,iget(864)),iget(864))
505 call select_channels_l(channelinfo(18),4,(/ 1,2,3,4 /),lvls(1:4,iget(865)),iget(865))
508 ! loop over
data types to process
509 sensordo:
do isat=1,n_sensors
511 if(me==0)print*,
'n_sensor,obstype,isis',isat,obslist(isat),sensorlist(isat)
513 obstype=obslist(isat)
514 isis=trim(sensorlist(isat))
517 (isis==
'imgr_g12' .and. (iget(327) > 0 .or. iget(328) > 0 &
518 .or. iget(329) > 0 .or. iget(330) > 0 .or. iget(456) > 0 &
519 .or. iget(457) > 0 .or. iget(458) > 0 .or. iget(459) > 0 )) .OR. &
520 (isis==
'imgr_g11' .and. (iget(446) > 0 .or. iget(447) > 0 &
521 .or. iget(448) > 0 .or. iget(449) > 0 .or. iget(460) > 0 &
522 .or. iget(461) > 0 .or. iget(462) > 0 .or. iget(463) > 0)) .OR. &
523 (isis==
'amsre_aqua' .and. (iget(483) > 0 .or. iget(484) > 0 &
524 .or. iget(485) > 0 .or. iget(486) > 0)) .OR. &
525 (isis==
'tmi_trmm' .and. (iget(488) > 0 .or. iget(489) > 0 &
526 .or. iget(490) > 0 .or. iget(491) > 0)) .OR. &
527 (isis==
'ssmi_f13' .and. iget(800) > 0 ) .OR. &
528 (isis==
'ssmi_f14' .and. iget(806) > 0 ) .OR. &
529 (isis==
'ssmi_f15' .and. iget(812) > 0 ) .OR. &
530 (isis==
'ssmis_f16' .and. iget(818) > 0) .OR. &
531 (isis==
'ssmis_f17' .and. post_ssmis17) .OR. &
532 (isis==
'ssmis_f18' .and. iget(832) > 0) .OR. &
533 (isis==
'ssmis_f19' .and. iget(839) > 0) .OR. &
534 (isis==
'ssmis_f20' .and. iget(846) > 0) .OR. &
535 (isis==
'imgr_mt2' .and. iget(860)>0) .OR. &
536 (isis==
'imgr_mt1r' .and. iget(864)>0) .OR. &
537 (isis==
'imgr_insat3d' .and. iget(865)>0) .OR. &
538 (isis==
'imgr_g13' .and. iget(868)>0) .OR. &
539 (isis==
'imgr_g15' .and. iget(872)>0) .OR. &
540 (isis==
'abi_g16' .and. post_abig16) .OR. &
541 (isis==
'abi_g17' .and. post_abig17) .OR. &
542 (isis==
'abi_gr' .and. post_abigr) .OR. &
543 (isis==
'seviri_m10' .and. iget(876)>0) .OR. &
544 (isis==
'ahi_himawari8' .and. post_ahi8) )
then
545 if(me==0)print*,
'obstype, isis= ',obstype,isis
550 hirs2 = obstype ==
'hirs2'
551 hirs3 = obstype ==
'hirs3'
552 hirs4 = obstype ==
'hirs4'
553 hirs = hirs2 .or. hirs3 .or. hirs4
554 msu = obstype ==
'msu'
555 ssu = obstype ==
'ssu'
556 goessndr = obstype ==
'sndr' .or. obstype ==
'sndrd1' .or. &
557 obstype ==
'sndrd2'.or. obstype ==
'sndrd3' .or. &
559 amsua = obstype ==
'amsua'
560 amsub = obstype ==
'amsub'
561 mhs = obstype ==
'mhs'
562 airs = obstype ==
'airs'
563 hsb = obstype ==
'hsb'
564 goes_img = obstype ==
'goes_img'
565 abi = obstype ==
'abi'
566 seviri = obstype ==
'seviri'
567 insat3d = obstype ==
'imgr_insat3d'
568 avhrr = obstype ==
'avhrr'
569 avhrr_navy = obstype ==
'avhrr_navy'
570 ssmi = obstype ==
'ssmi'
571 amsre_low = obstype ==
'amsre_low'
572 amsre_mid = obstype ==
'amsre_mid'
573 amsre_hig = obstype ==
'amsre_hig'
574 amsre = amsre_low .or. amsre_mid .or. amsre_hig
575 ssmis = obstype ==
'ssmis'
576 ssmis_las = obstype ==
'ssmis_las'
577 ssmis_uas = obstype ==
'ssmis_uas'
578 ssmis_img = obstype ==
'ssmis_img'
579 ssmis_env = obstype ==
'ssmis_env'
581 ssmis=ssmis_las.or.ssmis_uas.or.ssmis_img.or.ssmis_env.or.ssmis
583 micrim=ssmi .or. ssmis .or. amsre
585 microwave=amsua .or. amsub .or. mhs .or. msu .or. hsb .or. micrim
588 sensor_search:
do j = 1, n_sensors
590 if (isis==
'abi_g16' .and. .not.fix_abig16)
then
593 if (isis==
'abi_g17' .and. .not.fix_abig17)
then
596 if (channelinfo(j)%sensor_id == isis_local )
then
601 if (sensorindex == 0 )
then
602 write(6,*)
'SETUPRAD: ***WARNING*** problem with sensorindex=',isis,&
603 ' --> CAN NOT PROCESS isis=',isis,
' TERMINATE PROGRAM EXECUTION'
609 if(isis==
'ssmis_f19')channelinfo(sensorindex)%WMO_Satellite_Id=287
610 if(isis==
'ssmis_f20')channelinfo(sensorindex)%WMO_Satellite_Id=289
612 if(isis==
'abi_g16')channelinfo(sensorindex)%WMO_Satellite_Id=270
613 if(isis==
'abi_g16')channelinfo(sensorindex)%WMO_Sensor_Id=617
614 if(isis==
'abi_g17')channelinfo(sensorindex)%WMO_Satellite_Id=271
615 if(isis==
'abi_g17')channelinfo(sensorindex)%WMO_Sensor_Id=617
616 if(isis==
'abi_gr')channelinfo(sensorindex)%WMO_Satellite_Id=270
617 if(isis==
'abi_gr')channelinfo(sensorindex)%WMO_Sensor_Id=617
619 allocate(rtsolution(channelinfo(sensorindex)%n_channels,1))
620 allocate(tb(ista:iend,jsta:jend,channelinfo(sensorindex)%n_channels))
621 err1=0; err2=0; err3=0; err4=0
622 if(lm > max_n_layers)
then
623 write(6,*)
'CALRAD: lm > max_n_layers - '// &
624 'increase crtm max_n_layers ', &
629 CALL crtm_atmosphere_create(atmosphere(1),lm,n_absorbers,n_clouds &
631 CALL crtm_surface_create(surface(1),channelinfo(sensorindex)%n_channels)
632 CALL crtm_rtsolution_create(rtsolution,lm)
633 if (.NOT.(crtm_atmosphere_associated(atmosphere(1)))) &
634 write(6,*)
' ***ERROR** creating atmosphere.'
635 if (.NOT.(crtm_surface_associated(surface(1)))) &
636 write(6,*)
' ***ERROR** creating surface.'
637 if (.NOT.(any(crtm_rtsolution_associated(rtsolution)))) &
638 write(6,*)
' ***ERROR** creating rtsolution.'
640 atmosphere(1)%n_layers = lm
642 atmosphere(1)%absorber_id(1) = h2o_id
643 atmosphere(1)%absorber_id(2) = o3_id
644 atmosphere(1)%absorber_units(1) = mass_mixing_ratio_units
645 atmosphere(1)%absorber_units(2) = volume_mixing_ratio_units
647 atmosphere(1)%level_pressure(0) = toa_pressure
649 if(imp_physics==99 .or. imp_physics==98)
then
650 atmosphere(1)%cloud(1)%n_layers = lm
651 atmosphere(1)%cloud(1)%Type = water_cloud
652 atmosphere(1)%cloud(2)%n_layers = lm
653 atmosphere(1)%cloud(2)%Type = ice_cloud
654 else if(imp_physics==5 .or. imp_physics==85 .or. imp_physics==95)
then
655 atmosphere(1)%cloud(1)%n_layers = lm
656 atmosphere(1)%cloud(1)%Type = water_cloud
657 atmosphere(1)%cloud(2)%n_layers = lm
658 atmosphere(1)%cloud(2)%Type = ice_cloud
659 atmosphere(1)%cloud(3)%n_layers = lm
660 atmosphere(1)%cloud(3)%Type = rain_cloud
661 atmosphere(1)%cloud(4)%n_layers = lm
662 atmosphere(1)%cloud(4)%Type = snow_cloud
663 atmosphere(1)%cloud(5)%n_layers = lm
664 atmosphere(1)%cloud(5)%Type = graupel_cloud
665 atmosphere(1)%cloud(6)%n_layers = lm
666 atmosphere(1)%cloud(6)%Type = hail_cloud
667 else if(imp_physics==8 .or. imp_physics==6 .or. imp_physics==2 .or. imp_physics==28 &
668 .or. imp_physics==11)
then
669 atmosphere(1)%cloud(1)%n_layers = lm
670 atmosphere(1)%cloud(1)%Type = water_cloud
671 atmosphere(1)%cloud(2)%n_layers = lm
672 atmosphere(1)%cloud(2)%Type = ice_cloud
673 atmosphere(1)%cloud(3)%n_layers = lm
674 atmosphere(1)%cloud(3)%Type = rain_cloud
675 atmosphere(1)%cloud(4)%n_layers = lm
676 atmosphere(1)%cloud(4)%Type = snow_cloud
677 atmosphere(1)%cloud(5)%n_layers = lm
678 atmosphere(1)%cloud(5)%Type = graupel_cloud
685 surface(1)%sensordata%n_channels = channelinfo(sensorindex)%n_channels
686 surface(1)%sensordata%sensor_id = channelinfo(sensorindex)%sensor_id
687 surface(1)%sensordata%WMO_sensor_id = channelinfo(sensorindex)%WMO_sensor_id
688 surface(1)%sensordata%WMO_Satellite_id = channelinfo(sensorindex)%WMO_Satellite_id
689 surface(1)%sensordata%sensor_channel = channelinfo(sensorindex)%sensor_channel
692 nadir:
if ( (isis==
'imgr_g12' .and. (iget(327)>0 .or. &
693 iget(328)>0 .or. iget(329)>0 .or. iget(330)>0)) .or. &
694 (isis==
'imgr_g11' .and. (iget(446)>0 .or. &
695 iget(447)>0 .or. iget(448)>0 .or. iget(449)>0)) .or. &
696 (isis==
'amsre_aqua' .and. (iget(483) > 0 .or. iget(484) > 0 &
697 .or. iget(485) > 0 .or. iget(486) > 0)) .OR. &
698 (isis==
'tmi_trmm' .and. (iget(488) > 0 .or. iget(489) > 0 &
699 .or. iget(490) > 0 .or. iget(491) > 0)) .OR. &
700 (isis==
'abi_gr' .and. post_abigr) )
then
703 loopi1:
do i=ista,iend
707 if(abs(pmid(i,j,k)-spval)<=small .or. &
708 abs(t(i,j,k)-spval)<=small)
then
709 do n=1,channelinfo(sensorindex)%n_channels
718 geometryinfo(1)%sensor_zenith_angle=0.
719 geometryinfo(1)%sensor_scan_angle=0.
722 IF(geometryinfo(1)%sensor_zenith_angle <= max_sensor_scan_angle &
723 .and. geometryinfo(1)%sensor_zenith_angle >= 0.0_r_kind)
THEN
724 geometryinfo(1)%source_zenith_angle = acos(czen(i,j))*rtd
725 geometryinfo(1)%sensor_scan_angle = 0.
726 if(i==ii.and.j==jj.and.debugprint)print*,
'sample geometry ', &
727 geometryinfo(1)%sensor_zenith_angle &
728 ,geometryinfo(1)%source_zenith_angle &
731 if(modelname ==
'NCAR' .OR. modelname ==
'RAPR')
then
732 sfcpct(4)=pctsno(i,j)
733 else if(ivegsrc==1)
then
735 IF(itype == 0)itype=8
736 if(sno(i,j)<spval)
then
741 CALL snfrac(snoeqv,ivgtyp(i,j),snofrac)
743 else if(ivegsrc==2)
then
745 itype = min(max(0,ivgtyp(i,j)),13)
746 if(sno(i,j)<spval)
then
751 if(i==ii.and.j==jj.and.debugprint)print*,
'sno,itype,ivgtyp B cing snfrc = ', &
752 snoeqv,itype,ivgtyp(i,j)
753 if(sm(i,j) > 0.1)
then
756 call snfrac_gfs(snoeqv,ivgtyp(i,j),snofrac)
790 if(sm(i,j) > 0.1)
then
792 tsfc = ths(i,j)*(pint(i,j,nint(lmh(i,j))+1)/p1000)**capa
794 if(sfcpct(4) > 0.0_r_kind)
then
795 sfcpct(1) = 1.0_r_kind-sfcpct(4)
796 sfcpct(2) = 0.0_r_kind
797 sfcpct(3) = 0.0_r_kind
799 sfcpct(1) = 1.0_r_kind
800 sfcpct(2) = 0.0_r_kind
801 sfcpct(3) = 0.0_r_kind
804 tsfc = ths(i,j)*(pint(i,j,nint(lmh(i,j))+1)/p1000)**capa
806 if(sice(i,j) > 0.1)
then
807 if(sfcpct(4) > 0.0_r_kind)
then
808 sfcpct(3) = 1.0_r_kind-sfcpct(4)
809 sfcpct(1) = 0.0_r_kind
810 sfcpct(2) = 0.0_r_kind
812 sfcpct(3)= 1.0_r_kind
813 sfcpct(1) = 0.0_r_kind
814 sfcpct(2) = 0.0_r_kind
817 if(sfcpct(4) > 0.0_r_kind)
then
818 sfcpct(2)= 1.0_r_kind-sfcpct(4)
819 sfcpct(1) = 0.0_r_kind
820 sfcpct(3) = 0.0_r_kind
822 sfcpct(2)= 1.0_r_kind
823 sfcpct(1) = 0.0_r_kind
824 sfcpct(3) = 0.0_r_kind
828 if(si(i,j)/=spval)
then
835 if(ivegsrc==1 .and. itype==15 .and. sfcpct(4)<1.0_r_kind)
then
836 if(debugprint)print*,
'changing land type for veg type 15',i,j,itype,sfcpct(1:4)
844 sea = sfcpct(1) >= 0.99_r_kind
845 land = sfcpct(2) >= 0.99_r_kind
846 ice = sfcpct(3) >= 0.99_r_kind
847 snow = sfcpct(4) >= 0.99_r_kind
848 mixed = .not. sea .and. .not. ice .and. &
849 .not. land .and. .not. snow
850 if((sfcpct(1)+sfcpct(2)+sfcpct(3)+sfcpct(4)) >1._r_kind) &
851 print*,
'ERROR sfcpct ',i,j,sfcpct(1) &
852 ,sfcpct(2),sfcpct(3),sfcpct(4)
862 itype = min(max(0,ivgtyp(i,j)),novegtype)
864 itype = min(max(1,ivgtyp(i,j)),novegtype)
866 surface(1)%land_type = model_to_crtm(itype)
868 if(gridtype==
'B' .or. gridtype==
'E')
then
869 surface(1)%wind_speed = sqrt(u10h(i,j)*u10h(i,j) &
870 +v10h(i,j)*v10h(i,j))
872 surface(1)%wind_speed = sqrt(u10(i,j)*u10(i,j) &
875 surface(1)%water_coverage = sfcpct(1)
876 surface(1)%land_coverage = sfcpct(2)
877 surface(1)%ice_coverage = sfcpct(3)
878 surface(1)%snow_coverage = sfcpct(4)
880 surface(1)%land_temperature = tsfc
881 surface(1)%snow_temperature = min(tsfc,280._r_kind)
882 surface(1)%water_temperature = max(tsfc,270._r_kind)
883 surface(1)%ice_temperature = min(tsfc,280._r_kind)
884 if(smstot(i,j)/=spval)
then
885 surface(1)%soil_moisture_content = smstot(i,j)/10.
887 surface(1)%soil_moisture_content = 0.05
889 surface(1)%vegetation_fraction = vegcover
891 surface(1)%soil_temperature = 283.
893 surface(1)%snow_depth = snodepth
896 if(surface(1)%wind_speed<0. .or. surface(1)%wind_speed>200.) &
897 print*,
'bad 10 m wind'
898 if(surface(1)%water_coverage<0. .or. surface(1)%water_coverage>1.) &
899 print*,
'bad water coverage'
900 if(surface(1)%land_coverage<0. .or. surface(1)%land_coverage>1.) &
901 print*,
'bad land coverage'
902 if(surface(1)%ice_coverage<0. .or. surface(1)%ice_coverage>1.) &
903 print*,
'bad ice coverage'
904 if(surface(1)%snow_coverage<0. .or. surface(1)%snow_coverage>1.) &
905 print*,
'bad snow coverage'
906 if(surface(1)%land_temperature<0. .or. surface(1)%land_temperature>350.) &
908 if(surface(1)%soil_moisture_content<0. .or. surface(1)%soil_moisture_content>600.) &
909 print*,
'bad soil_moisture_content'
910 if(surface(1)%vegetation_fraction<0. .or. surface(1)%vegetation_fraction>1.) &
911 print*,
'bad vegetation cover'
912 if(surface(1)%snow_depth<0. .or. surface(1)%snow_depth>10000.) &
913 print*,
'bad snow_depth'
915 if(i==ii.and.j==jj.and.debugprint)print*,
'sample surface in CALRAD=', &
916 i,j,surface(1)%wind_speed,surface(1)%water_coverage, &
917 surface(1)%land_coverage,surface(1)%ice_coverage, &
918 surface(1)%snow_coverage,surface(1)%land_temperature, &
919 surface(1)%snow_temperature,surface(1)%water_temperature, &
920 surface(1)%ice_temperature,surface(1)%vegetation_fraction, &
921 surface(1)%soil_temperature,surface(1)%snow_depth, &
922 surface(1)%land_type,sm(i,j)
928 if(i==ii.and.j==jj.and.debugprint)print*,
'TOA= ',atmosphere(1)%level_pressure(0)
930 atmosphere(1)%level_pressure(k) = pint(i,j,k+1)/r100
931 atmosphere(1)%pressure(k) = pmid(i,j,k)/r100
932 atmosphere(1)%temperature(k) = t(i,j,k)
933 atmosphere(1)%absorber(k,1) = max(0. &
934 ,q(i,j,k)*h1000/(h1-q(i,j,k)))
935 atmosphere(1)%absorber(k,2) = max(ozsmall,o3(i,j,k)*constoz)
939 if(atmosphere(1)%level_pressure(k)<0. .or. atmosphere(1)%level_pressure(k)>1060.) &
940 & print*,
'bad atmosphere(1)%level_pressure' &
941 & ,i,j,k,atmosphere(1)%level_pressure(k)
942 if(atmosphere(1)%pressure(k)<0. .or. &
943 & atmosphere(1)%pressure(k)>1060.) &
944 & print*,
'bad atmosphere(1)%pressure' &
945 & ,i,j,k,atmosphere(1)%pressure(k)
946 if(atmosphere(1)%temperature(k)<0. .or. &
947 & atmosphere(1)%temperature(k)>400.) &
948 & print*,
'bad atmosphere(1)%temperature'
956 if(i==ii.and.j==jj.and.debugprint)print*,
'sample atmosphere in CALRAD=', &
957 i,j,k,atmosphere(1)%level_pressure(k),atmosphere(1)%pressure(k), &
958 atmosphere(1)%temperature(k),atmosphere(1)%absorber(k,1), &
959 atmosphere(1)%absorber(k,2)
961 dpovg=(pint(i,j,k+1)-pint(i,j,k))/g
962 if(imp_physics==99 .or. imp_physics==98)
then
963 atmosphere(1)%cloud(1)%effective_radius(k) = 10.
964 atmosphere(1)%cloud(1)%water_content(k) = max(0.,qqw(i,j,k)*dpovg)
968 atmosphere(1)%cloud(2)%effective_radius(k) = 50.
969 atmosphere(1)%cloud(2)%water_content(k) = max(0.,qqi(i,j,k)*dpovg)
971 if(atmosphere(1)%cloud(1)%water_content(k)<0. .or. &
972 atmosphere(1)%cloud(1)%water_content(k)>1.) &
973 print*,
'bad atmosphere cloud water'
974 if(atmosphere(1)%cloud(2)%water_content(k)<0. .or. &
975 atmosphere(1)%cloud(2)%water_content(k)>1.) &
976 print*,
'bad atmosphere cloud ice'
978 else if(imp_physics==5 .or. imp_physics==85 .or. imp_physics==95)
then
979 atmosphere(1)%cloud(1)%effective_radius(k) = 10.
980 atmosphere(1)%cloud(1)%water_content(k) = max(0.,qqw(i,j,k)*dpovg)
981 atmosphere(1)%cloud(2)%effective_radius(k) = 75.
982 atmosphere(1)%cloud(2)%water_content(k) = max(0.,qqi(i,j,k)*dpovg)
984 rho=pmid(i,j,k)/(rd*t(i,j,k)*(1.+d608*q(i,j,k)))
985 atmosphere(1)%cloud(3)%effective_radius(k) = 0.
986 if(nrain(i,j,k)>0.) &
987 atmosphere(1)%cloud(3)%effective_radius(k) = &
988 1.0e6*1.5*(rho*qqr(i,j,k)/(pi*rhox*nrain(i,j,k)))**(1./3.)
989 atmosphere(1)%cloud(3)%water_content(k) = max(0.,qqr(i,j,k)*dpovg)
990 if(f_rimef(i,j,k)<=5.0)
then
992 if(nlice(i,j,k)>0.) &
993 atmosphere(1)%cloud(4)%effective_radius(k) = &
994 1.0e6*1.5*(rho*qqs(i,j,k)/(pi*rhox*nlice(i,j,k)))**(1./3.)
995 atmosphere(1)%cloud(4)%water_content(k) = max(0.,qqs(i,j,k)*dpovg)
996 atmosphere(1)%cloud(5)%effective_radius(k) = 0.
997 atmosphere(1)%cloud(5)%water_content(k) =0.
998 atmosphere(1)%cloud(6)%effective_radius(k) = 0.
999 atmosphere(1)%cloud(6)%water_content(k) =0.
1000 else if(f_rimef(i,j,k)<=20.0)
then
1001 atmosphere(1)%cloud(4)%effective_radius(k) = 0.
1002 atmosphere(1)%cloud(4)%water_content(k) =0.
1004 if(nlice(i,j,k)>0.) &
1005 atmosphere(1)%cloud(5)%effective_radius(k) = &
1006 1.0e6*1.5*(rho*qqs(i,j,k)/(pi*rhox*nlice(i,j,k)))**(1./3.)
1007 atmosphere(1)%cloud(5)%water_content(k) =max(0.,qqs(i,j,k)*dpovg)
1008 atmosphere(1)%cloud(6)%effective_radius(k) = 0.
1009 atmosphere(1)%cloud(6)%water_content(k) =0.
1011 atmosphere(1)%cloud(4)%effective_radius(k) = 0.
1012 atmosphere(1)%cloud(4)%water_content(k) =0.
1013 atmosphere(1)%cloud(5)%effective_radius(k) = 0.
1014 atmosphere(1)%cloud(5)%water_content(k) =0.
1016 if(nlice(i,j,k)>0.) &
1017 atmosphere(1)%cloud(6)%effective_radius(k) = &
1018 1.0e6*1.5*(rho*qqs(i,j,k)/(pi*rhox*nlice(i,j,k)))**(1./3.)
1019 atmosphere(1)%cloud(6)%water_content(k) =max(0.,qqs(i,j,k)*dpovg)
1021 if(debugprint .and. i==im/2 .and. j==jsta) &
1022 print*,
'sample precip ice radius= ',i,j,k, f_rimef(i,j,k), &
1023 atmosphere(1)%cloud(4)%effective_radius(k), atmosphere(1)%cloud(4)%water_content(k), &
1024 atmosphere(1)%cloud(5)%effective_radius(k), atmosphere(1)%cloud(5)%water_content(k), &
1025 atmosphere(1)%cloud(6)%effective_radius(k), atmosphere(1)%cloud(6)%water_content(k)
1027 else if(imp_physics==8 .or. imp_physics==6 .or. imp_physics==2 .or. &
1028 imp_physics==28 .or. imp_physics==11)
then
1029 atmosphere(1)%cloud(1)%water_content(k)=max(0.,qqw(i,j,k)*dpovg)
1030 atmosphere(1)%cloud(2)%water_content(k)=max(0.,qqi(i,j,k)*dpovg)
1031 atmosphere(1)%cloud(3)%water_content(k)=max(0.,qqr(i,j,k)*dpovg)
1032 atmosphere(1)%cloud(4)%water_content(k)=max(0.,qqs(i,j,k)*dpovg)
1033 atmosphere(1)%cloud(5)%water_content(k)=max(0.,qqg(i,j,k)*dpovg)
1034 atmosphere(1)%cloud(1)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1035 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1036 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'C')
1037 atmosphere(1)%cloud(2)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1038 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1039 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'I')
1040 atmosphere(1)%cloud(3)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1041 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1042 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'R')
1043 atmosphere(1)%cloud(4)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1044 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1045 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'S')
1046 atmosphere(1)%cloud(5)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1047 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1048 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'G')
1053 if (abs(atmosphere(1)%pressure(k)-atmosphere(1)%pressure(k+1)) &
1055 atmosphere(1)%pressure(k)=atmosphere(1)%pressure(k)+0.005
1061 if(icu_physics==2)
then
1062 lcbot=nint(hbot(i,j))
1063 lctop=nint(htop(i,j))
1064 if (lcbot-lctop > 1)
then
1068 q_conv = cnvcfr(i,j)*qconv
1070 dpovg=(pint(i,j,k+1)-pint(i,j,k))/g
1071 if (t(i,j,k) < trad_ice)
then
1072 atmosphere(1)%cloud(2)%water_content(k) = &
1073 atmosphere(1)%cloud(2)%water_content(k) + dpovg*q_conv
1075 atmosphere(1)%cloud(1)%water_content(k) = &
1076 atmosphere(1)%cloud(1)%water_content(k) + dpovg*q_conv
1084 error_status = crtm_forward(atmosphere,surface, &
1085 geometryinfo,channelinfo(sensorindex:sensorindex), &
1087 if (error_status /=0)
then
1088 print*,
'***ERROR*** during crtm_forward call ', error_status
1089 do n=1,channelinfo(sensorindex)%n_channels
1096 do n=1,channelinfo(sensorindex)%n_channels
1097 tb(i,j,n)=rtsolution(n,1)%brightness_temperature
1103 if(i==ii.and.j==jj)
then
1104 do n=1,channelinfo(sensorindex)%n_channels
1105 3301
format(
'Sample rtsolution(',i0,
',',i0,
') in CALRAD = ',f0.3)
1106 print 3301,n,1,rtsolution(n,1)%brightness_temperature
1108 do n=1,channelinfo(sensorindex)%n_channels
1109 3302
format(
'Sample tb(',i0,
',',i0,
',',i0,
') in CALRAD = ',f0.3)
1110 print 3302,ii,jj,n,tb(ii,jj,n)
1120 do n=1,channelinfo(sensorindex)%n_channels
1135 if (isis==
'amsre_aqua')
then
1138 igot=iget(482+ixchan)
1142 grid1(i,j)=tb(i,j,ichan)
1145 if (grib==
"grib2")
then
1147 fld_info(cfld)%ifld=iavblfld(igot)
1148 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1153 if (isis==
'tmi_trmm')
then
1156 igot=iget(487+ixchan)
1160 grid1(i,j) = tb(i,j,ichan)
1163 if (grib==
"grib2")
then
1165 fld_info(cfld)%ifld=iavblfld(igot)
1166 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1172 if (isis==
'imgr_g11')
then
1179 grid1(i,j) = tb(i,j,ichan)
1182 if (grib==
"grib2")
then
1184 fld_info(cfld)%ifld=iavblfld(igot)
1185 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1191 if (isis==
'imgr_g12')
then
1194 igot=iget(326+ixchan)
1198 grid1(i,j)=tb(i,j,ichan)
1201 if (grib==
"grib2")
then
1203 fld_info(cfld)%ifld=iavblfld(igot)
1204 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1209 if (isis==
'abi_gr')
then
1213 igot=iget(957+ixchan)
1217 grid1(i,j)=tb(i,j,ichan)
1220 if(grib==
"grib2" )
then
1222 fld_info(cfld)%ifld=iavblfld(igot)
1223 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1234 nonnadir:
if((isis==
'ssmi_f13' .and. iget(800) > 0 ) .OR. &
1235 (isis==
'ssmi_f14' .and. iget(806) > 0 ) .OR. &
1236 (isis==
'ssmi_f15' .and. iget(812) > 0 ) .OR. &
1237 (isis==
'ssmis_f16' .and. iget(818) > 0) .OR. &
1238 (isis==
'ssmis_f17' .and. post_ssmis17) .OR. &
1239 (isis==
'ssmis_f18' .and. iget(832) > 0) .OR. &
1240 (isis==
'ssmis_f19' .and. iget(839) > 0) .OR. &
1241 (isis==
'ssmis_f20' .and. iget(846) > 0) .OR. &
1242 (isis==
'imgr_mt2' .and. iget(860)>0) .OR. &
1243 (isis==
'imgr_mt1r' .and. iget(864)>0) .OR. &
1244 (isis==
'imgr_insat3d' .and. iget(865)>0) .OR. &
1245 (isis==
'imgr_g13' .and. iget(868)>0) .OR. &
1246 (isis==
'imgr_g15' .and. iget(872)>0) .OR. &
1247 (isis==
'abi_g16' .and. post_abig16) .OR. &
1248 (isis==
'abi_g17' .and. post_abig17) .OR. &
1249 (isis==
'seviri_m10' .and. iget(876)>0) .OR. &
1250 (isis==
'ahi_himawari8' .and. post_ahi8) .OR. &
1251 (isis==
'imgr_g12' .and. (iget(456)>0 .or. &
1252 iget(457)>0 .or. iget(458)>0 .or. iget(459)>0)) .or. &
1253 (isis==
'imgr_g11' .and. (iget(460)>0 .or. &
1254 iget(461)>0 .or. iget(462)>0 .or. iget(463)>0)))
then
1257 loopi2:
do i=ista,iend
1261 if(abs(pmid(i,j,k)-spval)<=small .or. &
1262 abs(t(i,j,k)-spval)<=small)
then
1263 do n=1,channelinfo(sensorindex)%n_channels
1273 if(isis==
'imgr_g12')
then
1276 else if(isis==
'seviri_m10')
then
1279 else if(isis==
'imgr_g13')
then
1282 else if(isis==
'imgr_g15')
then
1285 else if(isis==
'abi_g16')
then
1288 else if(isis==
'abi_g17')
then
1291 else if(isis==
'imgr_g11')
then
1294 else if(isis==
'imgr_mt2')
then
1297 else if(isis==
'imgr_mt1r')
then
1300 else if(isis==
'imgr_insat3d')
then
1303 else if(isis==
'ahi_himawari8')
then
1309 if(isis==
'ssmis_f16'.or.isis==
'ssmis_f17'.or.isis==
'ssmis_f18'.or. &
1310 isis==
'ssmis_f19'.or.isis==
'ssmis_f20'.or.isis==
'ssmi_f13'.or. &
1311 isis==
'ssmi_f14'.or.isis==
'ssmi_f15')
then
1315 call geo_zenith_angle(i,j,gdlat(i,j),gdlon(i,j) &
1316 ,sublat,sublon,sat_zenith)
1319 geometryinfo(1)%sensor_zenith_angle=sat_zenith
1320 geometryinfo(1)%sensor_scan_angle=sat_zenith
1322 if(i==ii .and. j==jj)
then
1323 print *,
'zenith info: zenith=',sat_zenith,
' scan=',sat_zenith, &
1324 ' MAX_SENSOR_SCAN_ANGLE=',max_sensor_scan_angle
1328 IF(geometryinfo(1)%sensor_zenith_angle <= max_sensor_scan_angle &
1329 .and. geometryinfo(1)%sensor_zenith_angle >= 0.0_r_kind)
THEN
1330 geometryinfo(1)%source_zenith_angle = acos(czen(i,j))*rtd
1331 geometryinfo(1)%sensor_scan_angle = 0.
1332 if(i==ii.and.j==jj)print*,
'sample geometry ', &
1333 geometryinfo(1)%sensor_zenith_angle &
1334 ,geometryinfo(1)%source_zenith_angle &
1338 if(modelname ==
'NCAR' .OR. modelname ==
'RAPR')
then
1339 sfcpct(4)=pctsno(i,j)
1340 else if(ivegsrc==1)
then
1342 IF(itype == 0)itype=8
1343 if(sno(i,j)<spval)
then
1348 CALL snfrac(snoeqv,ivgtyp(i,j),snofrac)
1350 else if(ivegsrc==2)
then
1352 itype = min(max(0,ivgtyp(i,j)),13)
1353 if(sno(i,j)<spval)
then
1358 if(i==ii.and.j==jj)print*,
'sno,itype,ivgtyp B cing snfrc = ', &
1359 snoeqv,itype,ivgtyp(i,j)
1360 if(sm(i,j) > 0.1)
then
1363 call snfrac_gfs(snoeqv,ivgtyp(i,j),snofrac)
1370 if(sm(i,j) > 0.1)
then
1372 tsfc = ths(i,j)*(pint(i,j,nint(lmh(i,j))+1)/p1000)**capa
1374 if(sfcpct(4) > 0.0_r_kind)
then
1375 sfcpct(1) = 1.0_r_kind-sfcpct(4)
1376 sfcpct(2) = 0.0_r_kind
1377 sfcpct(3) = 0.0_r_kind
1379 sfcpct(1) = 1.0_r_kind
1380 sfcpct(2) = 0.0_r_kind
1381 sfcpct(3) = 0.0_r_kind
1384 tsfc = ths(i,j)*(pint(i,j,nint(lmh(i,j))+1)/p1000)**capa
1385 vegcover=vegfrc(i,j)
1386 if(sice(i,j) > 0.1)
then
1387 if(sfcpct(4) > 0.0_r_kind)
then
1388 sfcpct(3) = 1.0_r_kind-sfcpct(4)
1389 sfcpct(1) = 0.0_r_kind
1390 sfcpct(2) = 0.0_r_kind
1392 sfcpct(3)= 1.0_r_kind
1393 sfcpct(1) = 0.0_r_kind
1394 sfcpct(2) = 0.0_r_kind
1397 if(sfcpct(4) > 0.0_r_kind)
then
1398 sfcpct(2)= 1.0_r_kind-sfcpct(4)
1399 sfcpct(1) = 0.0_r_kind
1400 sfcpct(3) = 0.0_r_kind
1402 sfcpct(2)= 1.0_r_kind
1403 sfcpct(1) = 0.0_r_kind
1404 sfcpct(3) = 0.0_r_kind
1408 if(si(i,j)/=spval)
then
1417 if(novegtype==20 .and. itype==15 .and.sfcpct(4)<1.0_r_kind)
then
1418 if(debugprint)print*,
'changing land type for veg type 15',i,j,itype,sfcpct(1:4)
1419 sfcpct(1)=0.0_r_kind
1420 sfcpct(2)=0.0_r_kind
1421 sfcpct(3)=0.0_r_kind
1422 sfcpct(4)=1.0_r_kind
1427 sea = sfcpct(1) >= 0.99_r_kind
1428 land = sfcpct(2) >= 0.99_r_kind
1429 ice = sfcpct(3) >= 0.99_r_kind
1430 snow = sfcpct(4) >= 0.99_r_kind
1431 mixed = .not. sea .and. .not. ice .and. &
1432 .not. land .and. .not. snow
1433 if((sfcpct(1)+sfcpct(2)+sfcpct(3)+sfcpct(4)) >1._r_kind) &
1434 print*,
'ERROR sfcpct ',i,j,sfcpct(1) &
1435 ,sfcpct(2),sfcpct(3),sfcpct(4)
1445 itype = min(max(0,ivgtyp(i,j)),novegtype)
1447 itype = min(max(1,ivgtyp(i,j)),novegtype)
1449 surface(1)%land_type = model_to_crtm(itype)
1451 if(gridtype==
'B' .or. gridtype==
'E')
then
1452 surface(1)%wind_speed = sqrt(u10h(i,j)*u10h(i,j) &
1453 +v10h(i,j)*v10h(i,j))
1455 surface(1)%wind_speed = sqrt(u10(i,j)*u10(i,j) &
1459 surface(1)%water_coverage = sfcpct(1)
1460 surface(1)%land_coverage = sfcpct(2)
1461 surface(1)%ice_coverage = sfcpct(3)
1462 surface(1)%snow_coverage = sfcpct(4)
1463 surface(1)%land_temperature = tsfc
1464 surface(1)%snow_temperature = min(tsfc,280._r_kind)
1465 surface(1)%water_temperature = max(tsfc,270._r_kind)
1466 surface(1)%ice_temperature = min(tsfc,280._r_kind)
1467 if(smstot(i,j)/=spval)
then
1468 surface(1)%soil_moisture_content = smstot(i,j)/10.
1470 surface(1)%soil_moisture_content = 0.05
1472 surface(1)%vegetation_fraction = vegcover
1474 surface(1)%soil_temperature = 283.
1476 surface(1)%snow_depth = snodepth
1479 if(surface(1)%wind_speed<0. .or. surface(1)%wind_speed>200.) &
1480 print*,
'bad 10 m wind'
1481 if(surface(1)%water_coverage<0. .or. surface(1)%water_coverage>1.) &
1482 print*,
'bad water coverage'
1483 if(surface(1)%land_coverage<0. .or. surface(1)%land_coverage>1.) &
1484 print*,
'bad land coverage'
1485 if(surface(1)%ice_coverage<0. .or. surface(1)%ice_coverage>1.) &
1486 print*,
'bad ice coverage'
1487 if(surface(1)%snow_coverage<0. .or. surface(1)%snow_coverage>1.) &
1488 print*,
'bad snow coverage'
1489 if(surface(1)%land_temperature<0. .or. surface(1)%land_temperature>350.) &
1491 if(surface(1)%soil_moisture_content<0. .or. surface(1)%soil_moisture_content>600.) &
1492 print*,
'bad soil_moisture_content'
1493 if(surface(1)%vegetation_fraction<0. .or. surface(1)%vegetation_fraction>1.) &
1494 print*,
'bad vegetation cover'
1495 if(surface(1)%snow_depth<0. .or. surface(1)%snow_depth>10000.) &
1496 print*,
'bad snow_depth'
1499 if(i==ii.and.j==jj)print*,
'sample surface in CALRAD=', &
1500 i,j,surface(1)%wind_speed,surface(1)%water_coverage, &
1501 surface(1)%land_coverage,surface(1)%ice_coverage, &
1502 surface(1)%snow_coverage,surface(1)%land_temperature, &
1503 surface(1)%snow_temperature,surface(1)%water_temperature, &
1504 surface(1)%ice_temperature,surface(1)%vegetation_fraction, &
1505 surface(1)%soil_temperature,surface(1)%snow_depth, &
1506 surface(1)%land_type,sm(i,j)
1512 if(i==ii.and.j==jj)print*,
'TOA= ',atmosphere(1)%level_pressure(0)
1514 atmosphere(1)%level_pressure(k) = pint(i,j,k+1)/r100
1515 atmosphere(1)%pressure(k) = pmid(i,j,k)/r100
1516 atmosphere(1)%temperature(k) = t(i,j,k)
1517 atmosphere(1)%absorber(k,1) = max(0. &
1518 ,q(i,j,k)*h1000/(h1-q(i,j,k)))
1519 atmosphere(1)%absorber(k,2) = max(ozsmall,o3(i,j,k)*constoz)
1523 if(atmosphere(1)%level_pressure(k)<0. .or. atmosphere(1)%level_pressure(k)>1060.) &
1524 print*,
'bad atmosphere(1)%level_pressure' &
1525 ,i,j,k,atmosphere(1)%level_pressure(k)
1526 if(atmosphere(1)%pressure(k)<0. .or. &
1527 atmosphere(1)%pressure(k)>1060.) &
1528 print*,
'bad atmosphere(1)%pressure' &
1529 ,i,j,k,atmosphere(1)%pressure(k)
1530 if(atmosphere(1)%temperature(k)<0. .or. &
1531 atmosphere(1)%temperature(k)>400.) &
1532 print*,
'bad atmosphere(1)%temperature'
1540 if(i==ii.and.j==jj)print*,
'sample atmosphere in CALRAD=', &
1541 i,j,k,atmosphere(1)%level_pressure(k),atmosphere(1)%pressure(k), &
1542 atmosphere(1)%temperature(k),atmosphere(1)%absorber(k,1), &
1543 atmosphere(1)%absorber(k,2)
1545 dpovg=(pint(i,j,k+1)-pint(i,j,k))/g
1546 if(imp_physics==99 .or. imp_physics==98)
then
1547 atmosphere(1)%cloud(1)%effective_radius(k) = 10.
1548 atmosphere(1)%cloud(1)%water_content(k) = max(0.,qqw(i,j,k)*dpovg)
1552 atmosphere(1)%cloud(2)%effective_radius(k) = 50.
1553 atmosphere(1)%cloud(2)%water_content(k) = max(0.,qqi(i,j,k)*dpovg)
1555 if(atmosphere(1)%cloud(1)%water_content(k)<0. .or. &
1556 atmosphere(1)%cloud(1)%water_content(k)>1.) &
1557 print*,
'bad atmosphere cloud water'
1558 if(atmosphere(1)%cloud(2)%water_content(k)<0. .or. &
1559 atmosphere(1)%cloud(2)%water_content(k)>1.) &
1560 print*,
'bad atmosphere cloud ice'
1562 else if(imp_physics==5 .or. imp_physics==85 .or. imp_physics==95)
then
1563 atmosphere(1)%cloud(1)%effective_radius(k) = 10.
1564 atmosphere(1)%cloud(1)%water_content(k) = max(0.,qqw(i,j,k)*dpovg)
1565 atmosphere(1)%cloud(2)%effective_radius(k) = 75.
1566 atmosphere(1)%cloud(2)%water_content(k) = max(0.,qqi(i,j,k)*dpovg)
1568 rho=pmid(i,j,k)/(rd*t(i,j,k)*(1.+d608*q(i,j,k)))
1569 atmosphere(1)%cloud(3)%effective_radius(k) = 0.
1570 if(nrain(i,j,k)>0.) &
1571 atmosphere(1)%cloud(3)%effective_radius(k) = &
1572 1.0e6*1.5*(rho*qqr(i,j,k)/(pi*rhox*nrain(i,j,k)))**(1./3.)
1573 atmosphere(1)%cloud(3)%water_content(k) = max(0.,qqr(i,j,k)*dpovg)
1574 if(f_rimef(i,j,k)<=5.0)
then
1576 if(nlice(i,j,k)>0.) &
1577 atmosphere(1)%cloud(4)%effective_radius(k) = &
1578 1.0e6*1.5*(rho*qqs(i,j,k)/(pi*rhox*nlice(i,j,k)))**(1./3.)
1579 atmosphere(1)%cloud(4)%water_content(k) = max(0.,qqs(i,j,k)*dpovg)
1580 atmosphere(1)%cloud(5)%effective_radius(k) = 0.
1581 atmosphere(1)%cloud(5)%water_content(k) =0.
1582 atmosphere(1)%cloud(6)%effective_radius(k) = 0.
1583 atmosphere(1)%cloud(6)%water_content(k) =0.
1584 else if(f_rimef(i,j,k)<=20.0)
then
1585 atmosphere(1)%cloud(4)%effective_radius(k) = 0.
1586 atmosphere(1)%cloud(4)%water_content(k) =0.
1588 if(nlice(i,j,k)>0.) &
1589 atmosphere(1)%cloud(5)%effective_radius(k) = &
1590 1.0e6*1.5*(rho*qqs(i,j,k)/(pi*rhox*nlice(i,j,k)))**(1./3.)
1591 atmosphere(1)%cloud(5)%water_content(k) =max(0.,qqs(i,j,k)*dpovg)
1592 atmosphere(1)%cloud(6)%effective_radius(k) = 0.
1593 atmosphere(1)%cloud(6)%water_content(k) =0.
1595 atmosphere(1)%cloud(4)%effective_radius(k) = 0.
1596 atmosphere(1)%cloud(4)%water_content(k) =0.
1597 atmosphere(1)%cloud(5)%effective_radius(k) = 0.
1598 atmosphere(1)%cloud(5)%water_content(k) =0.
1600 if(nlice(i,j,k)>0.) &
1601 atmosphere(1)%cloud(6)%effective_radius(k) = &
1602 1.0e6*1.5*(rho*qqs(i,j,k)/(pi*rhox*nlice(i,j,k)))**(1./3.)
1603 atmosphere(1)%cloud(6)%water_content(k) =max(0.,qqs(i,j,k)*dpovg)
1605 if(debugprint .and. i==im/2 .and. j==jsta) &
1606 print*,
'sample precip ice radius= ',i,j,k, f_rimef(i,j,k), &
1607 atmosphere(1)%cloud(4)%effective_radius(k), atmosphere(1)%cloud(4)%water_content(k), &
1608 atmosphere(1)%cloud(5)%effective_radius(k), atmosphere(1)%cloud(5)%water_content(k), &
1609 atmosphere(1)%cloud(6)%effective_radius(k), atmosphere(1)%cloud(6)%water_content(k)
1611 else if(imp_physics==8 .or. imp_physics==6 .or. imp_physics==2 .or. &
1612 imp_physics==28 .or. imp_physics==11)
then
1613 atmosphere(1)%cloud(1)%water_content(k)=max(0.,qqw(i,j,k)*dpovg)
1614 atmosphere(1)%cloud(2)%water_content(k)=max(0.,qqi(i,j,k)*dpovg)
1615 atmosphere(1)%cloud(3)%water_content(k)=max(0.,qqr(i,j,k)*dpovg)
1616 atmosphere(1)%cloud(4)%water_content(k)=max(0.,qqs(i,j,k)*dpovg)
1617 atmosphere(1)%cloud(5)%water_content(k)=max(0.,qqg(i,j,k)*dpovg)
1618 atmosphere(1)%cloud(1)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1619 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1620 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'C')
1621 atmosphere(1)%cloud(2)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1622 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1623 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'I')
1624 atmosphere(1)%cloud(3)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1625 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1626 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'R')
1627 atmosphere(1)%cloud(4)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1628 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1629 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'S')
1630 atmosphere(1)%cloud(5)%effective_radius(k)=effr(pmid(i,j,k),t(i,j,k), &
1631 q(i,j,k),qqw(i,j,k),qqi(i,j,k),qqr(i,j,k),f_rimef(i,j,k),nlice(i,j,k), &
1632 nrain(i,j,k),qqs(i,j,k),qqg(i,j,k),qqnr(i,j,k),qqni(i,j,k),qqnw(i,j,k),imp_physics,
'G')
1637 if (abs(atmosphere(1)%pressure(k)-atmosphere(1)%pressure(k+1)) &
1639 atmosphere(1)%pressure(k)=atmosphere(1)%pressure(k)+0.005
1644 if(icu_physics==2)
then
1645 lcbot=nint(hbot(i,j))
1646 lctop=nint(htop(i,j))
1647 if (lcbot-lctop > 1)
then
1651 q_conv = cnvcfr(i,j)*qconv
1653 dpovg=(pint(i,j,k+1)-pint(i,j,k))/g
1654 if (t(i,j,k) < trad_ice)
then
1655 atmosphere(1)%cloud(2)%water_content(k) = &
1656 atmosphere(1)%cloud(2)%water_content(k) + dpovg*q_conv
1658 atmosphere(1)%cloud(1)%water_content(k) = &
1659 atmosphere(1)%cloud(1)%water_content(k) + dpovg*q_conv
1667 error_status = crtm_forward(atmosphere,surface, &
1668 geometryinfo,channelinfo(sensorindex:sensorindex), &
1670 if (error_status /=0)
then
1671 print*,
'***ERROR*** during crtm_forward call ', &
1673 do n=1,channelinfo(sensorindex)%n_channels
1677 do n=1,channelinfo(sensorindex)%n_channels
1678 tb(i,j,n)=rtsolution(n,1)%brightness_temperature
1680 if(i==ii.and.j==jj)
then
1681 do n=1,channelinfo(sensorindex)%n_channels
1682 3303
format(
'Sample rtsolution(',i0,
',',i0,
') in CALRAD = ',f0.3)
1683 print 3303,n,1,rtsolution(n,1)%brightness_temperature
1685 do n=1,channelinfo(sensorindex)%n_channels
1686 3304
format(
'Sample tb(',i0,
',',i0,
',',i0,
') in CALRAD = ',f0.3)
1687 print 3304,i,j,n,tb(i,j,n)
1697 do n=1,channelinfo(sensorindex)%n_channels
1708 if (isis==
'ssmi_f13')
then
1714 if(lvls(ixchan,igot)==1)
then
1718 grid1(i,j)=tb(i,j,nc)
1721 if (grib==
"grib2")
then
1723 fld_info(cfld)%ifld=iavblfld(igot)
1724 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1730 if (isis==
'ssmi_f14')
then
1736 if(lvls(ixchan,igot)==1)
then
1740 grid1(i,j)=tb(i,j,nc)
1743 if (grib==
"grib2")
then
1745 fld_info(cfld)%ifld=iavblfld(igot)
1746 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1752 if (isis==
'ssmi_f15')
then
1758 if(lvls(ixchan,igot)==1)
then
1762 grid1(i,j)=tb(i,j,nc)
1765 if (grib==
"grib2")
then
1767 fld_info(cfld)%ifld=iavblfld(igot)
1768 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1774 if (isis==
'ssmis_f16')
then
1780 print*,
'ixchan,lvls=',ixchan,lvls(ixchan,igot)
1781 if(lvls(ixchan,igot)==1)
then
1785 grid1(i,j)=tb(i,j,nc)
1788 if (grib==
"grib2")
then
1790 fld_info(cfld)%ifld=iavblfld(igot)
1791 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1797 if(isis==
'ssmis_f17')
then
1800 igot=iget(824+ixchan)
1804 grid1(i,j)=tb(i,j,ichan)
1807 if(grib==
"grib2" )
then
1809 fld_info(cfld)%ifld=iavblfld(igot)
1810 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1815 if (isis==
'ssmis_f18')
then
1821 if(lvls(ixchan,igot)==1)
then
1825 grid1(i,j)=tb(i,j,nc)
1828 if (grib==
"grib2")
then
1830 fld_info(cfld)%ifld=iavblfld(igot)
1831 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1837 if (isis==
'ssmis_f19')
then
1843 if(lvls(ixchan,igot)==1)
then
1847 grid1(i,j)=tb(i,j,nc)
1850 if (grib==
"grib2")
then
1852 fld_info(cfld)%ifld=iavblfld(igot)
1853 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1859 if (isis==
'ssmis_f20')
then
1865 if(lvls(ixchan,igot)==1)
then
1869 grid1(i,j)=tb(i,j,nc)
1872 if (grib==
"grib2")
then
1874 fld_info(cfld)%ifld=iavblfld(igot)
1875 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1881 if(isis==
'imgr_mt2')
then
1885 if(lvls(ichan,igot)==1)
then
1889 grid1(i,j)=tb(i,j,nc)
1892 if(grib==
"grib2")
then
1894 fld_info(cfld)%ifld=iavblfld(igot)
1895 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1900 if(isis==
'imgr_mt1r')
then
1904 if(lvls(ichan,igot)==1)
then
1908 grid1(i,j)=tb(i,j,nc)
1911 if(grib==
"grib2" )
then
1913 fld_info(cfld)%ifld=iavblfld(igot)
1914 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1919 if_insat3d:
if(isis==
'imgr_insat3d')
then
1923 if(lvls(ichan,igot)==1)
then
1927 grid1(i,j)=tb(i,j,nc)
1930 if(grib==
"grib2" )
then
1932 fld_info(cfld)%ifld=iavblfld(igot)
1933 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1938 if (isis==
'imgr_g11')
then
1941 igot=iget(459+ixchan)
1945 grid1(i,j)=tb(i,j,ichan)
1948 if(grib==
"grib2" )
then
1950 fld_info(cfld)%ifld=iavblfld(igot)
1951 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1956 if (isis==
'imgr_g12')
then
1959 igot=iget(455+ixchan)
1963 grid1(i,j)=tb(i,j,ichan)
1966 if(grib==
"grib2" )
then
1968 fld_info(cfld)%ifld=iavblfld(igot)
1969 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1974 if (isis==
'seviri_m10')
then
1980 if(lvls(ixchan,igot)==1)
then
1984 grid1(i,j)=tb(i,j,nc)
1987 if (grib==
"grib2")
then
1989 fld_info(cfld)%ifld=iavblfld(igot)
1990 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
1996 if (isis==
'imgr_g13')
then
2002 if(lvls(ixchan,igot)==1)
then
2006 grid1(i,j)=tb(i,j,nc)
2009 if (grib==
"grib2")
then
2011 fld_info(cfld)%ifld=iavblfld(igot)
2012 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
2018 if (isis==
'imgr_g15')
then
2024 if(lvls(ixchan,igot)==1)
then
2028 grid1(i,j)=tb(i,j,nc)
2031 if (grib==
"grib2")
then
2033 fld_info(cfld)%ifld=iavblfld(igot)
2034 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
2040 if (isis==
'abi_g16')
then
2044 igot=iget(926+ixchan)
2048 grid1(i,j)=tb(i,j,ichan)
2051 if(grib==
"grib2" )
then
2053 fld_info(cfld)%ifld=iavblfld(igot)
2054 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
2059 if (isis==
'abi_g17')
then
2063 igot=iget(936+ixchan)
2067 grid1(i,j)=tb(i,j,ichan)
2070 if(grib==
"grib2" )
then
2072 fld_info(cfld)%ifld=iavblfld(igot)
2073 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
2078 if(isis==
'ahi_himawari8')
then
2080 igot=iget(968+ichan)
2084 grid1(i,j)=tb(i,j,ichan)
2087 if(grib==
"grib2" )
then
2089 fld_info(cfld)%ifld=iavblfld(igot)
2090 datapd(1:iend-ista+1,1:jend-jsta+1,cfld)=grid1(ista:iend,jsta:jend)
2099 CALL crtm_atmosphere_destroy(atmosphere(1))
2100 CALL crtm_surface_destroy(surface(1))
2101 CALL crtm_rtsolution_destroy(rtsolution)
2102 if (crtm_atmosphere_associated(atmosphere(1))) &
2103 write(6,*)
' ***ERROR** destroying atmosphere.'
2104 if (crtm_surface_associated(surface(1))) &
2105 write(6,*)
' ***ERROR** destroying surface.'
2106 if (any(crtm_rtsolution_associated(rtsolution))) &
2107 write(6,*)
' ***ERROR** destroying rtsolution.'
2109 deallocate (rtsolution)
2114 error_status = crtm_destroy(channelinfo)
2115 if (error_status /= success) &
2116 print*,
'ERROR*** crtm_destroy error_status=',error_status
2117 deallocate(channelinfo)
2118 if (
allocated(model_to_crtm))
deallocate(model_to_crtm)
2121 end SUBROUTINE calrad_wcloud
2123 REAL FUNCTION effr(pmid,t,q,qqw,qqi,qqr,f_rimef, nlice, nrain, &
2124 qqs,qqg,qqnr,qqni,qqnw,mp_opt,species)
2134 real :: pmid,t,q,qqw,qqi,qqr,qqs,qqg,f_rimef,nlice,nrain
2135 real :: qqnr,qqni,qqnw
2136 character(LEN=1) :: species
2138 integer :: n,count,count1,mp_opt
2139 real :: rho, ncc, rhox
2140 real :: n0_s, n0_r, n0_g
2141 real :: lambdar, lambdas, lambdag
2148 real :: gamma_crg, gamma_s
2151 real :: wgamma, gammln
2153 real :: rc,am_c,bm_c,cce(3,15),ccg(3,15),ocg1(15),ocg2(15)
2156 real,
dimension(0:15),
parameter:: g_ratio = (/6,24,60,120,210, &
2157 & 336,504,720,990,1320,1716,2184,2730,3360,4080,4896/)
2159 real :: rr, mu_r, am_r, bm_r, cre(3), crg(3), ore1, org1, org2
2160 real :: mvd_r, ron_sl, ron_r0, ron_c0, ron_c1, ron_c2, obmr
2162 real :: ri, mu_i, am_i, bm_i, cie(3), cig(3), oig1, oig2, obmi
2164 real :: rs, am_s, oams, cse(3)
2165 real :: loga, a, b, tc0, smob, smo2, smoc
2166 REAL,
PARAMETER:: mu_s = 0.6357
2167 REAL,
PARAMETER:: kap0 = 490.6
2168 REAL,
PARAMETER:: kap1 = 17.46
2169 REAL,
PARAMETER:: lam0 = 20.78
2170 REAL,
PARAMETER:: lam1 = 3.29
2176 real,
parameter :: eps=0.622, beta_crg=3., beta_i=2.,beta_s=2.4
2178 real,
parameter :: min_qc=1.e-7, min_qr=1.e-7, min_qi=1.e-8,min_qs=1.e-8, min_qg=1.e-7
2179 real,
parameter :: min_c=2.e-6, min_r=20.e-6, min_i=4.e-6,min_s=20.e-6, min_g=20.e-6
2180 real,
parameter :: max_c=1.e-2, max_r=1.e-2, max_i=1.e-3,max_s=2.e-2, max_g=5.e-0
2182 real :: am_g, bm_g, mu_g
2183 real :: cgg(3), cge(3), oge1, obmg, ogg1, ogg2
2185 real :: ygra1, zans1, rg2
2186 double precision :: no_exp, no_min, lm_exp, lamg, lamc, lamr, lami, lams
2192 real :: wsm6_nci, xmi, xmitemp
2198 real,
parameter :: wsm6_cnp=3.e8, wsm6_rhor=1000.
2199 real,
parameter :: wsm6_rhos=100., wsm6_rhog=500.
2200 real,
parameter :: wsm6_dimax=500.e-6, wsm6_dicon=11.9
2201 real,
parameter :: wsm6_alpha=.12, wsm6_t0c=273.15
2202 real,
parameter :: wsm6_n0s=2.e6, wsm6_n0smax=1.e11
2203 real,
parameter :: wsm6_n0r=8.e6, wsm6_n0g=4.e6
2204 real,
parameter :: wsm6_qmin=1.e-15
2210 real,
parameter :: lin_rhoi=100., lin_rhor=1000., lin_rhos=100.
2211 real,
parameter :: lin_rhog=400., lin_cnp=3.e8
2212 real,
parameter :: lin_n0r=8.e6, lin_n0s=3.e6, lin_n0g=4.e6
2218 real,
parameter :: nthom_rhor=1000., nthom_rhos=100.
2220 real,
parameter :: nthom_rhog=500., nthom_rhoi=890.
2221 real,
parameter :: nthom_gon_min=1.e4, nthom_gon_max=3.e6
2222 real,
parameter :: nthom_nt_c=100.e6
2224 real,
parameter :: nthom_min_nci=5.e2
2225 real,
parameter :: nthom_min_ncr=1.e-6
2227 real,
parameter :: nthom_bm_s=2.0
2229 real :: nci2, ncc2, ncr2
2231 real,
dimension(10),
parameter :: &
2232 nthom_sa = (/ 5.065339, -0.062659, -3.032362, 0.029469, -0.000285, &
2233 0.31255, 0.000204, 0.003199, 0.0, -0.015952/)
2234 real,
dimension(10),
parameter :: &
2235 nthom_sb = (/ 0.476221, -0.015896, 0.165977, 0.007468, -0.000141, &
2236 0.060366, 0.000079, 0.000594, 0.0, -0.003577/)
2242 real,
parameter :: gfdl_rhoi=100., gfdl_rhor=1000., gfdl_rhos=100.
2243 real,
parameter :: gfdl_rhog=400., gfdl_cnp=3.e8
2244 real,
parameter :: gfdl_tice = 273.16
2246 real,
parameter :: gfdl_qmin = 1.0e-5, gfdl_ccn = 1.0e8, gfdl_beta = 1.22
2247 real,
parameter :: gfdl_gammar = 17.837789, gfdl_gammas = 8.2850630, gfdl_gammag = 11.631769
2248 real,
parameter :: gfdl_alphar = 0.8, gfdl_alphas = 0.25, gfdl_alphag = 0.5
2249 real,
parameter :: gfdl_n0r=8.e6, gfdl_n0s=3.e6, gfdl_n0g=4.e6
2251 real,
parameter :: gfdl_rewmin = 5.0, gfdl_rewmax = 10.0
2252 real,
parameter :: gfdl_reimin = 10.0, gfdl_reimax = 150.0
2253 real,
parameter :: gfdl_rermin = 0.0, gfdl_rermax = 10000.0
2254 real,
parameter :: gfdl_resmin = 0.0, gfdl_resmax = 10000.0
2255 real,
parameter :: gfdl_regmin = 0.0, gfdl_regmax = 10000.0
2265 elseif(mp_opt==2)
then
2283 rho=pmid/(rd*t*(1.+d608*q))
2288 SELECT CASE(species)
2292 if ( qqw>min_qc )
then
2293 effr = 1.0e6*(( 6. * rho * qqw ) / &
2294 (pi * wsm6_rhor * wsm6_cnp))**(1/3.)
2300 if ( qqr>min_qr )
then
2301 effr = 1.0e6*( ( 6. * rho * qqr ) / &
2302 ( pi * wsm6_rhor * n0_r * gamma_crg ) ) ** (1/(1+beta_crg ) )
2307 if ( qqg>min_qg )
then
2308 effr = 1.0e6*( ( 6. * rho * qqg ) / &
2309 ( pi * wsm6_rhog * n0_g * gamma_crg ) ) ** (1/(1+beta_crg ) )
2314 if ( qqs>min_qs )
then
2315 effr = 1.0e6*( ( 6. * rho * qqs ) / &
2316 ( pi * wsm6_rhos * n0_s * gamma_s ) ) ** ( 1/(1+beta_s) )
2324 if ( qqi>min_qi )
then
2333 xmitemp=rho*max(qqi,wsm6_qmin)
2334 xmitemp=sqrt(sqrt(xmitemp*xmitemp*xmitemp))
2335 xmi= min(max(5.38e7*xmitemp,1.e3),1.e6)
2336 effr = 1.0e6*max(min(wsm6_dicon * sqrt(xmi),wsm6_dimax), 1.e-25)
2341 elseif(mp_opt==2)
then
2343 SELECT CASE(species)
2347 if ( qqw > min_qc )
then
2348 effr = 1.0e6*(( 6. * rho * qqw ) / &
2349 (pi * lin_rhor * lin_cnp))**(1/3.)
2354 if ( qqr > min_qr )
then
2355 effr = 1.0e6*( ( 6. * rho * qqr ) / &
2356 ( pi * lin_rhor * n0_r * gamma_crg ) ) ** (1/(1+beta_crg ) )
2361 if ( qqi > min_qi )
then
2362 effr = 1.0e6*( ( 6. * rho * qqi ) / &
2363 ( pi * lin_rhoi * lin_cnp ) ) ** ( 1/3.)
2368 if ( qqs > min_qs )
then
2369 effr = 1.0e6*( ( 6. * rho * qqs ) / &
2370 ( pi * lin_rhos * n0_s * gamma_s ) ) ** ( 1/(1+beta_s) )
2375 if ( qqg > min_qg )
then
2376 effr = 1.0e6*( ( 6. * rho * qqg ) / &
2377 ( pi * lin_rhog * n0_g * gamma_crg ) ) ** (1/(1+beta_crg ) )
2382 elseif(mp_opt==8 .or. mp_opt==28)
then
2389 am_r = pi * nthom_rhor / 6.0
2393 cre(3) = bm_r + mu_r + 1.
2395 crg(1) = wgamma(cre(1))
2396 crg(2) = wgamma(cre(2))
2397 crg(3) = wgamma(cre(3))
2409 cce(2,n) = bm_c + n + 1.
2411 ccg(1,n) = wgamma(cce(1,n))
2412 ccg(2,n) = wgamma(cce(2,n))
2414 ocg1(n) = 1./ccg(1,n)
2415 ocg2(n) = 1./ccg(2,n)
2420 am_i = pi * nthom_rhoi / 6.0
2425 cie(2) = bm_i + mu_i + 1.
2427 cig(1) = wgamma(cie(1))
2428 cig(2) = wgamma(cie(2))
2440 cse(1) = nthom_bm_s + 1.
2446 am_g = pi * nthom_rhog / 6.0
2450 cge(3) = bm_g + mu_g + 1.
2452 cgg(1) = wgamma(cge(1))
2453 cgg(2) = wgamma(cge(2))
2454 cgg(3) = wgamma(cge(3))
2462 SELECT CASE (species)
2466 if(qqw >= min_qc)
then
2468 rc = max(1.e-12, qqw * rho)
2472 elseif (mp_opt==28)
then
2473 ncc2 = max(1.e-6, qqnw * rho)
2476 if (ncc2 < 10.e6)
then
2479 nu_c = min(15, nint(1000.e6/ncc2) + 2)
2482 lamc = (ncc2/rc)**obmr * (am_r*g_ratio(nu_c))**obmr
2484 effr = 1.0e6*max(4.01e-6, min(sngl(1.0d0*dble(3.+nu_c)/lamc),50.e-6))
2495 if( qqr > min_qr)
then
2497 rr = max(1.e-12, qqr * rho)
2498 ncr2 = max(1.e-6, qqnr * rho)
2499 lamr = (ncr2/rr)**obmr * (am_r*crg(3)*org2)**obmr
2501 effr = 1.0e6*max(50.01e-6, min(sngl(1.0d0*dble(3.+mu_r)/lamr),1999.e-6))
2514 if(qqi >= min_qi)
then
2516 ri = max(1.e-12, qqi * rho)
2517 nci2 = max(1.e-6, qqni * rho)
2519 lami = (nci2/ri)**obmi * (am_i*cig(2)*oig1)**obmi
2521 effr = 1.0e6*max(10.01e-6, min(sngl(1.0d0*dble(3.+mu_i)/lami),250.e-6))
2532 rs = max(1.e-12, qqs * rho)
2534 if(qqs >= min_qs)
then
2536 tc0 = min(-0.1, t-273.15)
2539 if (nthom_bm_s>(2.0-1.e-3) .and. nthom_bm_s<(2.0+1.e-3))
then
2542 loga = nthom_sa(1) + nthom_sa(2)*tc0 + nthom_sa(3)*nthom_bm_s+ &
2543 nthom_sa(4)*tc0*nthom_bm_s + nthom_sa(5)*tc0*tc0 +&
2544 nthom_sa(6)*nthom_bm_s*nthom_bm_s +nthom_sa(7)*tc0*tc0*nthom_bm_s + &
2545 nthom_sa(8)*tc0*nthom_bm_s*nthom_bm_s +nthom_sa(9)*tc0*tc0*tc0 + &
2546 nthom_sa(10)*nthom_bm_s*nthom_bm_s*nthom_bm_s
2550 b = nthom_sb(1) + nthom_sb(2)*tc0 + nthom_sb(3)*nthom_bm_s+ &
2551 nthom_sb(4)*tc0*nthom_bm_s + nthom_sb(5)*tc0*tc0 +&
2552 nthom_sb(6)*nthom_bm_s*nthom_bm_s +nthom_sb(7)*tc0*tc0*nthom_bm_s + &
2553 nthom_sb(8)*tc0*nthom_bm_s*nthom_bm_s +nthom_sb(9)*tc0*tc0*tc0 + &
2554 nthom_sb(10)*nthom_bm_s*nthom_bm_s*nthom_bm_s
2555 smo2 = (smob/a)**(1./b)
2559 loga = nthom_sa(1) + nthom_sa(2)*tc0 + nthom_sa(3)*cse(1) +&
2560 nthom_sa(4)*tc0*cse(1) + nthom_sa(5)*tc0*tc0 +&
2561 nthom_sa(6)*cse(1)*cse(1) + nthom_sa(7)*tc0*tc0*cse(1)+ &
2562 nthom_sa(8)*tc0*cse(1)*cse(1) +nthom_sa(9)*tc0*tc0*tc0 + &
2563 nthom_sa(10)*cse(1)*cse(1)*cse(1)
2567 b = nthom_sb(1)+ nthom_sb(2)*tc0 + nthom_sb(3)*cse(1) +&
2568 nthom_sb(4)*tc0*cse(1) + nthom_sb(5)*tc0*tc0 +&
2569 nthom_sb(6)*cse(1)*cse(1) + nthom_sb(7)*tc0*tc0*cse(1) +&
2570 nthom_sb(8)*tc0*cse(1)*cse(1) + nthom_sb(9)*tc0*tc0*tc0 + &
2571 nthom_sb(10)*cse(1)*cse(1)*cse(1)
2575 effr = 1.0e6*max(50.e-6, min(smoc/smob, 1999.e-6))
2589 if(qqg >= min_qg)
then
2591 rg2 = max(1.e-12, qqg * rho)
2593 ygra1 = alog10(max(1.e-9, rg2))
2595 zans1 = 3. + 2./7. * (ygra1+7.)
2596 zans1 = max(2., min(zans1, 7.))
2598 no_exp = 10.**(zans1)
2600 lm_exp = (no_exp*am_g*cgg(1)/rg2)**oge1
2602 lamg = lm_exp * (cgg(3)*ogg2*ogg1)**obmg
2604 effr= 1.0e6*max(99.e-6, min(sngl((3.0+mu_g)/lamg), 9999.e-6))
2613 elseif(mp_opt==11)
then
2615 SELECT CASE(species)
2620 if (qqw > min_qc)
then
2621 effr = exp(1.0 / 3.0 * log((3. * qqw ) / (4. * pi * gfdl_rhor * gfdl_ccn))) * 1.0e6
2622 effr = max(gfdl_rewmin, min(gfdl_rewmax, effr))
2629 if (qqi > min_qi)
then
2630 if ((t-gfdl_tice) < - 50)
then
2631 effr = gfdl_beta / 9.917 * exp((1 - 0.891) * log(1.0e3 * qqi)) * 1.0e3
2632 elseif ((t-gfdl_tice) < - 40.)
then
2633 effr = gfdl_beta / 9.337 * exp((1 - 0.920) * log(1.0e3 * qqi)) * 1.0e3
2634 elseif ((t-gfdl_tice) < - 30.)
then
2635 effr = gfdl_beta / 9.208 * exp((1 - 0.945) * log(1.0e3 * qqi)) * 1.0e3
2637 effr = gfdl_beta / 9.387 * exp((1 - 0.969) * log(1.0e3 * qqi)) * 1.0e3
2639 effr = max(gfdl_reimin, min(gfdl_reimax, effr))
2645 if ( qqr > min_qr )
then
2646 lambdar = exp(0.25 * log(pi * gfdl_rhor * gfdl_n0r / qqr))
2647 effr = 0.5*exp(log(gfdl_gammar / 6.) / gfdl_alphar) / lambdar * 1.0e6
2648 effr = max(gfdl_rermin, min(gfdl_rermax, effr))
2655 if ( qqs > min_qs )
then
2656 lambdas = exp(0.25 * log(pi * gfdl_rhos * gfdl_n0s / qqs))
2657 effr = 0.5 * exp(log(gfdl_gammas / 6.) / gfdl_alphas) / lambdas * 1.0e6
2658 effr = max(gfdl_resmin, min(gfdl_resmax, effr))
2664 if ( qqg > min_qg )
then
2665 lambdag = exp(0.25 * log(pi * gfdl_rhog * gfdl_n0g / qqg))
2666 effr = 0.5 * exp(log(gfdl_gammag / 6.) / gfdl_alphag) / lambdag * 1.0e6
2667 effr = max(gfdl_regmin, min(gfdl_regmax, effr))
2674 elseif(mp_opt==5.or.mp_opt==85.or.mp_opt==95)
then
2676 SELECT CASE (species)
2688 if( qqr > min_qr)
then
2690 effr=2.*1.0e6*1.5*(rho*qqr/(pi*rhox*nrain))**(1./3.)
2700 if(f_rimef<=5.0)
then
2703 effr = 2.*1.0e6*1.5*(rho*qqs/(pi*rhox*nlice))**(1./3.)
2709 if(f_rimef>5.0.and.f_rimef<=20.0)
then
2712 effr = 2.*1.0e6*1.5*(rho*qqs/(pi*rhox*nlice))**(1./3.)
2718 if(f_rimef>20.0)
then
2721 effr = 2.*1.0e6*1.5*(rho*qqs/(pi*rhox*nlice))**(1./3.)
2739 REAL FUNCTION gammln(XX)
2742 REAL,
INTENT(IN):: xx
2743 DOUBLE PRECISION,
PARAMETER:: stp = 2.5066282746310005d0
2744 DOUBLE PRECISION,
DIMENSION(6),
PARAMETER:: &
2745 cof = (/76.18009172947146d0, -86.50532032941677d0, &
2746 24.01409824083091d0, -1.231739572450155d0, &
2747 .1208650973866179d-2, -.5395239384953d-5/)
2748 DOUBLE PRECISION:: ser,tmp,x,y
2754 tmp=(x+0.5d0)*log(tmp)-tmp
2755 ser=1.000000000190015d0
2760 gammln=tmp+log(stp*ser/x)
2763 REAL FUNCTION wgamma(y)
2766 REAL,
INTENT(IN):: y
2770 wgamma = exp(gammln(y))
subroutine zensun(day, time, lat, lon, pi, sun_zenith, sun_azimuth)
This subroutine computes solar position information as a function of geographic coordinates, date and time.