1 subroutine ch_cld_sci( tdat, nv, ubdat, nubyte, i32dat, ni32, &
2 sensor_id, cloud_hgt_file )
20 integer :: npix, nlin, nbnd, nbnd_albedo, nlvl_model, scan, st_samp, &
22 common /dim_ctl/ npix, nlin, nbnd, nbnd_albedo, nlvl_model, scan, st_samp, &
24 integer :: nv, i,j,k, na, off, nubyte, ni32, sensor_id, nbnd_sfc_albedo
25 real,
dimension(nv) :: tdat
26 integer,
dimension(3) :: dim_3
27 integer*1,
dimension(nubyte) :: ubdat
28 integer,
dimension(ni32) :: i32dat
29 character(len=500) :: cloud_hgt_file
30 real,
parameter :: bad_float = -32767.
40 if( .not.
allocated(
c2_refl ) )
then
41 allocate(
c2_refl(npix, nlin, nbnd))
45 allocate(
c2_lat(npix, nlin))
46 allocate(
c2_lon(npix, nlin))
98 allocate(
c2_cth(npix,nlin))
99 allocate(
c2_ctp(npix,nlin))
100 allocate(
c2_ctt(npix,nlin))
113 na = npix * nbnd * nlin
117 c2_refl = reshape( tdat(1:na), (/ npix, nbnd, nlin /) )
120 na = npix * nbnd_albedo * nlin
121 c2_bnd_unc = reshape( tdat(1+off:na+off), (/ npix, nbnd_albedo, nlin /) )
132 c2_lat = reshape( tdat(1+off:na+off), (/ npix, nlin /) )
135 c2_lon = reshape( tdat(1+off:na+off), (/ npix, nlin /) )
138 c2_senz = reshape( tdat(1+off:na+off), (/ npix, nlin /) )
142 c2_sena = reshape( tdat(1+off:na+off), (/ npix, nlin /) )
145 c2_sola = reshape( tdat(1+off:na+off), (/ npix, nlin /) )
148 c2_solz = reshape( tdat(1+off:na+off), (/ npix, nlin /) )
152 c2_relaz = reshape( tdat(1+off:na+off), (/ npix, nlin /) )
156 na = npix * nlin * nlvl_model
157 c2_prof_mixr = reshape( tdat(1+off:na+off), (/npix, nlin,nlvl_model/) )
160 c2_prof_t = reshape( tdat(1+off:na+off), (/npix, nlin,nlvl_model/) )
163 c2_prof_p = reshape( tdat(1+off:na+off), (/npix, nlin,nlvl_model/) )
166 c2_prof_hgt = reshape( tdat(1+off:na+off), (/npix, nlin,nlvl_model/) )
170 c2_tsfc = reshape( tdat(1+off:na+off), (/npix, nlin/) )
173 c2_psfc = reshape( tdat(1+off:na+off), (/npix, nlin/) )
176 c2_wind = reshape( tdat(1+off:na+off), (/npix, nlin/) )
179 c2_tot_o3 = reshape( tdat(1+off:na+off), (/npix, nlin/) )
182 c2_ice_frac = reshape( tdat(1+off:na+off), (/npix, nlin/) )
185 c2_snow_frac = reshape( tdat(1+off:na+off), (/npix, nlin/) )
188 c2_alt_o3 = reshape( tdat(1+off:na+off), (/npix, nlin/) )
191 c2_alt_icec = reshape( tdat(1+off:na+off), (/npix, nlin/) )
194 c2_sfc_albedo = reshape( tdat(1+off: na*nbnd_sfc_albedo + off), &
195 (/npix, nlin, nbnd_sfc_albedo/))
198 off = off + na * nbnd_sfc_albedo
199 c2_cth = reshape( tdat(1+off:na+off), (/npix, nlin/) )
201 c2_ctp = reshape( tdat(1+off:na+off), (/npix, nlin/) )
203 c2_ctt = reshape( tdat(1+off:na+off), (/npix, nlin/) )
208 c2_sfc_lvl = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
211 c2_trop_lvl = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
215 c2_cld_det = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
218 c2_conf_cld = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
221 c2_clr_66 = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
224 c2_clr_95 = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
227 c2_clr_99 = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
230 c2_sno_sfc = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
233 c2_wtr_sfc = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
236 c2_coast_sfc = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
239 c2_desert_sfc = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
242 c2_lnd_sfc = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
245 c2_night = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
248 c2_glint = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
254 c2_ocean_snow = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
260 c2_lnd_snow = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
263 c2_tst_h_138 = reshape( ubdat(1+off:na+off), (/npix, nlin/) )
380 integer :: prod_num, n_prd, iprd
382 real,
dimension(n_prd,c2_npix) :: prod_array
384 integer,
parameter :: CAT_Cld_p = 469, cat_cld_t = 470, cat_cld_h = 493
385 integer,
parameter :: CAT_CER_2100 = 445
386 integer,
parameter :: CAT_CER_1600 = 446, cat_cot_2100 = 447
387 integer,
parameter :: CAT_COT_1600 = 448, cat_cer_1621 = 449
388 integer,
parameter :: CAT_COT_1621 = 450, cat_cwp_2100 = 451
389 integer,
parameter :: CAT_CWP_1621 = 452, cat_cwp_1600 = 453
394 integer,
parameter :: CAT_Cld_Top_Refl_650 = 459
395 integer,
parameter :: CAT_Cld_Top_Refl_860 = 460, cat_cld_top_refl_1200 = 461
396 integer,
parameter :: CAT_Cld_Top_Refl_1600 = 462, cat_cld_top_refl_2100 = 463
397 integer,
parameter :: CAT_Surface_Albedo_650 = 464, cat_surface_albedo_860 = 465
398 integer,
parameter :: CAT_Surface_Albedo_1200 = 466
399 integer,
parameter :: CAT_Surface_Albedo_1600 = 467
400 integer,
parameter :: CAT_Surface_Albedo_2100 = 468
402 integer,
parameter :: CAT_COT_fail_2100 = 471
403 integer,
parameter :: CAT_COT_fail_1600 = 472
404 integer,
parameter :: CAT_COT_fail_1621 = 473
405 integer,
parameter :: CAT_CER_fail_2100 = 474
406 integer,
parameter :: CAT_CER_fail_1600 = 475
407 integer,
parameter :: CAT_CER_fail_1621 = 476
408 integer,
parameter :: CAT_CMP_fail_pct_2100 = 477
409 integer,
parameter :: CAT_CMP_fail_pct_1600 = 478
410 integer,
parameter :: CAT_CMP_fail_pct_1621 = 479
411 integer,
parameter :: CAT_refl_loc_1600 = 480
412 integer,
parameter :: CAT_refl_loc_2100 = 481
413 integer,
parameter :: CAT_refl_loc_1621 = 482
415 integer,
parameter :: CAT_CER_2200 = 483
416 integer,
parameter :: CAT_COT_2200 = 484
417 integer,
parameter :: CAT_CWP_2200 = 485
419 integer,
parameter :: CAT_Cld_Top_Refl_2200 = 487
420 integer,
parameter :: CAT_Surface_Albedo_2200 = 488
421 integer,
parameter :: CAT_COT_fail_2200 = 489
422 integer,
parameter :: CAT_CER_fail_2200 = 490
423 integer,
parameter :: CAT_CMP_fail_pct_2200 = 491
424 integer,
parameter :: CAT_refl_loc_2200 = 492
426 real,
parameter :: bad_float = -32767.
430 select case( prod_num )
461 case( cat_cld_top_refl_650 )
463 case( cat_cld_top_refl_860 )
465 case( cat_cld_top_refl_1200 )
467 case( cat_cld_top_refl_1600 )
469 case( cat_cld_top_refl_2100 )
471 case( cat_cld_top_refl_2200 )
473 case( cat_surface_albedo_650 )
475 case( cat_surface_albedo_860 )
477 case( cat_surface_albedo_1200 )
479 case( cat_surface_albedo_1600 )
481 case( cat_surface_albedo_2100 )
483 case( cat_surface_albedo_2200 )
486 case( cat_cot_fail_2100 )
488 where ( prod_array < -90. ) prod_array = bad_float
489 case( cat_cot_fail_1600 )
491 where ( prod_array < -90. ) prod_array = bad_float
492 case( cat_cot_fail_1621 )
494 where ( prod_array < -90. ) prod_array = bad_float
495 case( cat_cot_fail_2200 )
497 where ( prod_array < -90. ) prod_array = bad_float
498 case( cat_cer_fail_2100 )
500 where ( prod_array < -90. ) prod_array = bad_float
501 case( cat_cer_fail_1600 )
503 where ( prod_array < -90. ) prod_array = bad_float
504 case( cat_cer_fail_1621 )
506 where ( prod_array < -90. ) prod_array = bad_float
507 case( cat_cer_fail_2200 )
509 where ( prod_array < -90. ) prod_array = bad_float
510 case( cat_cmp_fail_pct_2100 )
512 where ( prod_array < -90. ) prod_array = bad_float
513 case( cat_cmp_fail_pct_1600 )
515 where ( prod_array < -90. ) prod_array = bad_float
516 case( cat_cmp_fail_pct_1621 )
518 where ( prod_array < -90. ) prod_array = bad_float
519 case( cat_cmp_fail_pct_2200 )
521 where ( prod_array < -90. ) prod_array = bad_float
522 case( cat_refl_loc_1600 )
527 case( cat_refl_loc_2100 )
531 case( cat_refl_loc_1621 )
535 case( cat_refl_loc_2200 )
540 print*,
"Improper product ID, case encountered, ID:", prod_num
541 prod_array = bad_float
545 where(prod_array < -900. )
546 prod_array = bad_float
561 integer :: prod_num, lin_mid
562 integer*1,
dimension(c2_npix) :: bprod
563 integer,
parameter :: CAT_Cld_Sfc_Type = 454, cat_cld_phase_2100 = 455
564 integer,
parameter :: CAT_Cld_Non_Abs_Band = 456, cat_cld_phase_1600 = 457
565 integer,
parameter :: CAT_Cld_Phase_1621 = 458
566 integer,
parameter :: CAT_Cld_Phase_2200 = 486
567 integer,
parameter :: CAT_Cld_water_cloud = 440, cat_cld_ice_cloud = 441
568 integer*1 :: iand_comp = 7
574 prod_sel:
select case( prod_num )
575 case( cat_cld_sfc_type )
577 where(
cloudmask(:,lin_mid)%ocean_snow == 1 ) &
579 where(
cloudmask(:,lin_mid)%land_no_snow == 1 ) &
581 where(
cloudmask(:,lin_mid)%land_snow == 1 ) &
583 case( cat_cld_phase_2100 )
585 bprod = ibclr( bprod, 3 )
586 case( cat_cld_non_abs_band )
588 case( cat_cld_phase_1600 )
590 bprod = ibclr( bprod, 3 )
591 case( cat_cld_phase_1621 )
593 bprod = ibclr( bprod, 3 )
594 case( cat_cld_phase_2200 )
596 bprod = ibclr( bprod, 3 )
597 case( cat_cld_water_cloud )
604 case( cat_cld_ice_cloud )
609 print*,
"Improper product ID, case encountered, ID:", prod_num