OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
modis_science_module.f90
Go to the documentation of this file.
2 
3 implicit none
4 
5 private
6 
7 public:: scienceinterface
8 
9 
10 
11 contains
12 
13 subroutine scienceinterface(threshold_solar_zenith, &
14  threshold_sensor_zenith, &
15  threshold_relative_azimuth, &
16  debug, &
17  status)
18 
64  int_reflectance_water, im_cloudy_count, im_ice_cloud_count, &
65  im_successful_retrieval_count, im_undet_count, im_water_cloud_count, &
66  iterationx, number_of_iterationsx, pi, pixx, pixy
67  !use science_parameters
83  use retrieval_prep_logic, only:color_first_time, cox_munk, d2r, delta_pc, &
84  delta_ts, last_2way_angle, last_cox_munk, lastinterp_relative_azimuth, &
85  lastinterp_scat_angle, lastinterp_scat_angle_ss, &
86  lastinterp_sensor_zenith, lastinterp_solar_zenith, lastinterp_wind_speed,&
87  retr_scale_factor, solar_constant_37, solar_zenith_threshold, swir_error,&
88  unc_scale_factor, vnir_error, watervapor_error, uncertain_sf, &
89  uncertain_sf, spec_uncertain, init_retrieval, cleanup_retrieval
95  use cloud_phase, only:clouddecision
98  use names, only: my_unit_lun
103  use planck_functions, only: modis_planck
104  use ch_xfr, only: c2_scan, c2_cmp_there
105 !WDR for the new routine
106 ! out in this vers use wdr_wr_ch_vars, only: wr_ch_vars
107 
108  implicit none
109 
110  logical, intent(in) :: debug
111  real, intent(in) :: threshold_solar_zenith, &
112  threshold_sensor_zenith, &
113  threshold_relative_azimuth
114 
115  integer, intent(out) :: status
116 
117 
118  integer :: xdimension, ydimension,i,j, k,jj,count_interpolations, &
119  retrievalcount
120  integer :: retrieval_failcount, library_failcount, cloud_failcount, atmoscorr_failcount
121  integer :: cloudstatus, retrievalstatus, librarystatus, atmoscorrstatus,cloudiness_degree_250m
122  real :: diff_solar_zenith, &
123  diff_sensor_zenith, &
124  diff_relative_azimuth
125 
126  real :: scattering_angle, dscat, diff_scat_angle, diff_scat_angle_ss
127  real :: dsol, dsen, drel, diff_wind_speed
128  real :: cur_wind_speed
129  real :: cloud_top_temperature_water, cloud_top_temperature_ice, ctt_1km
130 
131  integer :: istart, iend, jstart, jend, myrad
132 
133  logical :: ldebug, sunglint_dust_test, lowvariability_confidence_test, put_back_cloud
134  logical :: ir_cloudphase_1km_watercloud, ir_cloudphase_1km_icecloud
135  integer :: model_i, model_j
136  integer :: uncertain_start
137 
138  integer :: na_band_used, r1r2wavelengthidx(2), absorbingband_index, uncertainty_nonabsorbing_1621
139  real:: corr_meas(set_number_of_bands), temp_meas(set_number_of_bands), alb_meas(set_albedo_bands)
140  character(10) :: phase
141  real :: cloud_reflectance(2),delta_reflectance(2), albedo_holder(2) , &
142  delta_transmittance(2), tauregimethreshold(2), unc_reflectance(2)
143 
144  integer :: start_time, end_time, cmax, crate
145 
146  integer :: cnt_sza, cnt_vza, cnt_raz, cnt_cm_switch, cnt_wspeed, cnt_scat, cnt_wspeed_only
147  logical :: wind_speed_only, interp_ms, interp_ss
148  real :: irw_pressure
149  real :: tc_liquid, tc_ice, pc_liquid, pc_ice, pw_liquid, pw_ice
150  real :: rad_clr(2), bt_clr(2)
151  integer :: ice_near(4), liq_near(4), nearest_used(4)
152  real :: rss_ice(4), rss_liq(4), rss_final(4)
153 
154  real :: unc_tau_real, unc_tau_1621_real, unc_tau16_real, unc_tau37_real
155  real :: unc_re21_real, unc_re16_real, unc_re37_real, unc_re1621_real
156  real :: unc_lwp21_real, unc_lwp16_real, unc_lwp37_real, unc_lwp1621_real
157 
158  real :: emission_pw(20), emission_tc(20), sigma_r37_pw(20)
159 
160  real :: alt_ray_liq, alt_ray_ice, temp_pres
161  real :: aod550, irw_dummy
162 
163  integer :: re_idx_low, re_idx_hi
164  integer :: clin ! WDR for directed processing
165 
166  real, dimension(:,:), allocatable :: aod550_store
167 
168  logical :: vis1km_test ! KGM 3-4-13
169  type(cloudphase) :: ir_cloudphase
170 
171  logical :: do_retrievals_liq(4), do_retrievals_ice(4)
172  logical :: finalize_liq(4), finalize_ice(4)
173  logical :: set_near(4)
174 
175  unc_re16_real = 0 ! WDR-UIV
176  unc_tau16_real = 0 ! WDR-UIV
177  unc_tau_1621_real = 0 ! WDR-UIV
178  unc_re1621_real = 0 ! WDR-UIV
179  unc_lwp1621_real = 0 ! WDR-UIV
180  unc_re21_real = 0 ! WDR-UIV
181  unc_lwp21_real = 0 ! WDR-UIV
182  unc_tau37_real = 0 ! WDR-UIV
183  unc_re37_real = 0 ! WDR-UIV
184  unc_lwp37_real = 0 ! WDR-UIV
185  unc_tau_real = 0 ! WDR-UIV
186 
187  re_idx_low = 0 ! WDR-UIV
188  re_idx_hi = 0 ! WDR-UIV
189 
190  status = 0
191 
192  xdimension = size(optical_thickness_final, 1)
193  ydimension = size(optical_thickness_final, 2)
194 
195 
196  lastinterp_solar_zenith = fillvalue_real
197  lastinterp_sensor_zenith = fillvalue_real
198  lastinterp_relative_azimuth = fillvalue_real
199  lastinterp_scat_angle = fillvalue_real
200  lastinterp_wind_speed = fillvalue_real
201  lastinterp_scat_angle_ss = fillvalue_real
202  count_interpolations = 0
203  retrievalcount = 0
204  retrieval_failcount = 0
205  library_failcount = 0
206  cloud_failcount = 0
207  atmoscorr_failcount = 0
208 
209 
210  cnt_sza = 0
211  cnt_vza = 0
212  cnt_raz = 0
213  cnt_cm_switch = 0
214  cnt_wspeed = 0
215  cnt_scat = 0
216  cnt_wspeed_only = 0
217 
219 
220  call init_rtm_vars
221  call init_half_radii
222 
223  cox_munk = .false.
224  last_cox_munk = .false.
225  wind_speed_only = .false.
226  interp_ms = .false.
227  interp_ss = .false.
228 
229  color_first_time = .true.
230  last_2way_angle = fillvalue_real
231 
232 
233  call set_drel(threshold_relative_azimuth, drel)
234 
236 
237 #ifndef RETRIEVE
238  allocate(aod550_store(xdimension, ydimension))
239  aod550_store = fillvalue_real
240  cloudsummary(:,:)%cloudobserved = .true.
241 #endif
242 ! WDR export the data needed for a small test
243 ! out in this vers call wr_ch_vars
244 
245 !print*, __FILE__, __LINE__, "for this line, start, end lines are: ", scn_loop_st,scn_loop_en
246  do i = 1, xdimension
247 ! do i=40, 40
248 
249 ! do not process lines 1 and 1354 of the data because there are issues with cloud mask, particularly for the last line
250 ! of the data
251  if (iterationx == 1 .and. i==1 .or. iterationx == number_of_iterationsx .and. i==xdimension ) then
252  cloudsummary(i,:)%cloudobserved = .false.
253 ! aod550_store(i,:) = fillvalue_real
254  do j=1, ydimension
255  call assign_retrieval_error(i,j)
256  retrieval_failcount = retrieval_failcount + 1
257  end do
258  cycle
259  endif
260 
261  !WDR try only the center line do j=1, ydimension
262  ! (this makes the center line a cloud edge somehow and missing data goes
263  ! there, so don't do for now
264  ! clin = ydimension / 2 + 1
265  ! do j=clin, clin
266  ! WDR switch to scn_loop_st,scn_loop_en do j=1,ydimension
268 ! do j=665, 665
269 ! WDR to see all lines, pix: print*, __FILE__, __LINE__," Doing pixel ", i, " line ", j
270 ! WDR set up the single-point model_info at chunk point i, j
271 ! (fills c2_model_info)
272  call fill_c2_mdl( i, j )
273 
274 #ifndef RETRIEVE
275 
276  if (surface_albedo(i,j,1) >= 300 .or. (cloudmask(i,j)%sunglint == 1 .and. &
277  cloudmask(i,j)%water_surface) ) then
278  aod550_store(i,j) = fillvalue_real
279  cycle
280  endif
281 
282 
283 #endif
284 
285 
286  pixx = i
287  pixy = j
288 
289  cloudsummary(i,j)%cloudmask_determined = .false.
290  cloudsummary(i,j)%cloudobserved = .false.
291  cloudsummary(i,j)%watercloud = .false.
292  cloudsummary(i,j)%icecloud = .false.
293  cloudsummary(i,j)%unknowncloud = .false.
294  csr_flag_array(i,j) = 0
295 
296  liq_near = 0
297  ice_near = 0
298 
305 
306 ! can't retrieve, sun too low or no cloud top
307  if (solar_zenith_angle(i,j) > solar_zenith_threshold .or. solar_zenith_angle(i,j) < 0. ) then
308  retrievalstatus = 1
309  call assign_retrieval_error(i,j)
310  retrieval_failcount = retrieval_failcount + 1
311  cycle
312  endif
313 
314 
316  lowvariability_confidence_test = .false.
317  na_band_used = 0
318 
319 
320 ! we have to set cloudy/not cloudy and surface type outside the cloud phase call so the retrieval actually works.
321  if (cloudmask(i,j)%cloudmask_determined) cloudsummary(i,j)%cloudmask_determined = .true.
322 
323  if (cloudmask(i,j)%confident_cloudy .or. cloudmask(i,j)%probablyclear_66) &
324  cloudsummary(i,j)%cloudobserved = .true.
325 
326  if (cloudmask(i,j)%snowice_surface) then
327  if (cloudmask(i,j)%land_surface) cloudsummary(i,j)%land_surface = .true.
328  if (cloudmask(i,j)%water_surface) cloudsummary(i,j)%ocean_surface = .true.
329  if (cloudmask(i,j)%desert_surface) cloudsummary(i,j)%desert_surface = .true.
330  if (cloudmask(i,j)%coastal_surface) cloudsummary(i,j)%coastal_surface = .true.
331  endif
332  if (cloudmask(i,j)%land_surface .or. cloudmask(i,j)%coastal_surface .or. cloudmask(i,j)%desert_surface) then
333  if (cloudsummary(i,j)%ocean_surface) then
334  cloudsummary(i,j)%coastal_surface= .true.
335  cloudsummary(i,j)%ocean_surface = .false.
336  endif
337  endif
338 
339 
340  corr_meas = fillvalue_real
341 
342 
343 
344 ! We have a cloud, now we can attempt retrieval
345  if (cloudsummary(i,j)%cloudobserved .and. cloud_top_pressure(i,j) > 0.) then
346 
347 
348 
349  if (iterationx == 1) then
350  temp_meas = band_measurements(i, :, j)
351  corr_meas = band_measurements(i, :, j)
352  else
353  temp_meas = band_measurements(i+1, :, j)
354  corr_meas = band_measurements(i+1, :, j)
355  endif
356 
357 ! DO_COX_MUNK is a model control flag. Set/unset this in mod06_run_settings.f90
358  if (cloudsummary(i,j)%ocean_surface .and. .not. cloudsummary(i,j)%snowice_surface &
359  .and. temp_meas(2) > 0. .and. do_cox_munk) then
360  cox_munk = .true.
361  else
362  cox_munk = .false.
363  endif
364 
365 
366  const_c = pi / ( cos(solar_zenith_angle(i,j)*d2r) * solar_constant_37)
367 
368 
369 #ifdef GEOS5
370 
371 #ifdef MCARS
372  model_i = i
373  model_j = j
374 #else
375  call get_model_idx_geos5(geos5_istart, geos5_jstart, latitude(i,j), longitude(i,j), model_i, model_j)
376 #endif
377 
378 #else
379  call get_model_idx(latitude(i,j), longitude(i,j), model_i, model_j)
380 #endif
381  ! WDR cur_wind_speed = model_info(model_i, model_j)%wind_speed
382  cur_wind_speed = c2_model_info%wind_speed
383 
384  call set_interp_controls(i,j, scattering_angle, cur_wind_speed, drel, &
385  threshold_solar_zenith, &
386  threshold_sensor_zenith, &
387  wind_speed_only, interp_ss, interp_ms )
388 
389 ! do k=1, model_levels
390 
391 ! print*, model_info(model_i, model_j)%pressure_profile(k), &
392 ! model_info(model_i, model_j)%temp_profile(k), &
393 ! model_info(model_i, model_j)%mixr_profile(k)
394 ! print*, c2_model_inf%pressure_profile(k), &
395 ! c2_model_info%temp_profile(k), &
396 ! c2_model_info%mixr_profile(k)
397 
398 ! end do
399 
400 
401 #ifdef RETRIEVE
402  if( librarystatus == 5 ) then ! not sure if this is best way, but
403  ! keep trying till librarystatus is not 5
404  ! for being outside the table WDR
405  interp_ms = .true.
406  interp_ss = .true.
407  endif
409  sensor_zenith_angle(i,j), &
410  relative_azimuth_angle(i,j), &
411  scattering_angle, &
412  cur_wind_speed, &
413  wind_speed_only, interp_ms, interp_ss, &
414  debug, &
415  librarystatus, i, j)
416  if( librarystatus == 5 ) then
417  call assign_retrieval_error(i,j)
418  cycle
419  endif
420 #endif
421 
422  ctt_1km = cloud_top_temperature(i,j) !(save 1km ctt for to pass to clouddecision)
423 
424 ! do the IRW retrieval
425 #ifndef RETRIEVE
426 
427  ! WDRcloud_top_pressure(i,j) = model_info(model_i, model_j)%&
428  !pressure_profile(model_info(model_i, model_j)%surface_level-6)
429  !WDR cloud_top_temperature(i,j) = model_info(model_i, model_j)%&
430  !temp_profile(model_info(model_i, model_j)%surface_level-6)
431  cloud_top_pressure(i,j) = &
432  c2_model_info%pressure_profile(c2_model_info%surface_level-6)
433  cloud_top_temperature(i,j) = &
434  c2_model_info%temp_profile(c2_model_info%surface_level-6)
435 
436 #else
437 
439 
440  if (cox_munk) then
443  sensor_zenith_angle(i,j), solar_zenith_angle(i,j), model_i, &
444  model_j, i, j)
445  else
447  surface_emissivity_land(i,j,:), &
448  sensor_zenith_angle(i,j), solar_zenith_angle(i,j), model_i, &
449  model_j, i, j)
450  endif
451 
452 ! print*, i,j, model_i, model_j
453 ! do k=1, model_levels
454 ! print*, k, model_info(model_i,model_j)%pressure_profile(k), &
455 ! model_info(model_i,model_j)%temp_profile(k), &
456 ! model_info(model_i,model_j)%mixr_profile(k)
457 ! end do
458 
459  if (cloud_height_method(i,j) == 6) then
460  ! retrieve regular temperature
461  call retrieve_irw_temp(i,j, temp_meas(band_1100), &
462  model_i, model_j, rtm_rad_atm_clr, rtm_trans_atm_clr, &
463  rtm_cloud_prof, irw_temperature(i,j), irw_pressure, irw_dummy)
465  cloud_top_pressure(i,j) = irw_pressure
466  !
467  ! now do the stuff for uncertainty
468  call retrieve_irw_temp(i,j, temp_meas(band_1100), &
469  model_i, model_j, rtm_rad_atm_clr_low, rtm_trans_atm_clr_low, &
470  rtm_cloud_prof_low , tc_low_for_delta, temp_pres, irw_dummy )
471  call retrieve_irw_temp(i,j, temp_meas(band_1100), &
472  model_i, model_j, rtm_rad_atm_clr_high, rtm_trans_atm_clr_high, &
473  rtm_cloud_prof_high, tc_high_for_delta, temp_pres, irw_dummy )
474  !
475  else if (cloud_height_method(i,j) > 0 .and. &
476  cloud_height_method(i,j) < 6) then
478  ! for uncertainty we need to find the temperature that fits a
479  ! delta_P of 50 mb
480  ! WDR call given_P_get_T(cloud_top_pressure(i,j)-delta_Pc, &
481  ! model_info(model_i, model_j), Tc_low_for_delta)
482  call given_p_get_t(cloud_top_pressure(i,j)-delta_pc, c2_model_info, &
484  ! WDR if (cloud_top_pressure(i,j) + delta_Pc > &
485  ! model_info(model_i, model_j)%Ps) then
486  if (cloud_top_pressure(i,j) + delta_pc > c2_model_info%Ps) then
488  else
489  ! WDR call given_P_get_T(cloud_top_pressure(i,j)+delta_Pc, &
490  ! model_info(model_i, model_j), Tc_high_for_delta)
491  call given_p_get_t(cloud_top_pressure(i,j)+delta_pc, c2_model_info, &
493  endif
494  endif
495 
496  ! WDR if (cloud_top_pressure(i,j) < 0. .or. cloud_top_pressure(i,j) &
497  ! > model_info(model_i, model_j)%Ps) then
498  if (cloud_top_pressure(i,j) < 0. .or. &
499  cloud_top_pressure(i,j) > c2_model_info%Ps) then
500  ! WDR cloud_top_pressure(i,j) = model_info(model_i, model_j)%Ps
503  endif
504 #endif
505 
506 ! get above-cloud water vapor
507  ! WDR call get_above_cloud_properties(model_info(model_i,model_j)%pressure_profile(:),&
508  ! model_info(model_i,model_j)%mixr_profile(:), &
509  ! model_info(model_i,model_j)%surface_level, &
510  call get_above_cloud_properties(c2_model_info%pressure_profile(:),&
511  c2_model_info%mixr_profile(:), &
512  c2_model_info%surface_level, &
513  cloud_top_pressure(i,j), &
514  abovecloud_watervapor(i,j), &
515  status )
516 
517  tc_liquid = fillvalue_real
518  tc_ice = fillvalue_real
519 
520 
521 
522 
523 ! do atmospheric correction
524 
525  ! WDR call atmospheric_correction(i,j, iterationX, corr_meas, model_info(model_i,model_j), &
526  call atmospheric_correction(i,j, iterationx, corr_meas, c2_model_info, &
527  debug, atmoscorrstatus)
528 
529 
530 ! now we need to compute derivatives that we'll hang on to in the uncertainty calculations
533  (abovecloud_watervapor(i,j)*(2.*watervapor_error))
534 
537  (2.0*delta_ts)
538 
540  (abovecloud_watervapor(i,j)*(2.*watervapor_error))
542  (abovecloud_watervapor(i,j)*(2.*watervapor_error))
543 
544 
545 
547  if (cox_munk) albedo_real4 = 0.
548 
549  rss_ice = -999.
550  rss_liq = -999.
553  alt_ray_liq = fillvalue_real
554  alt_ray_ice = fillvalue_real
555  liq_near = 0
556  ice_near = 0
557 
566 
575 
576  nearest_used = 0
577  rss_final = fillvalue_real
578 
579 #ifdef RETRIEVE
580 
581  ! 1.6 2.1 3.7 1.6-2.1
582  do_retrievals_liq = (/ .true., .true., .true., .true. /)
583  do_retrievals_ice = (/ .true., .true., .true., .true. /)
584 ! WDR we will let the existance of the 3.7 um band set the do_retrievals...
585 ! values. This will skip that code and not add my changes to corescience
586  if( c2_cmp_there(band_0370) == 0 ) then
587  do_retrievals_liq(3) = .false.
588  do_retrievals_ice(3) = .false.
589  endif
590 
591 
592  call corescience (i, j, cloudsummary(i,j), corr_meas, &
593  tc_liquid, tc_ice, &
594  debug, na_band_used, liq_near, ice_near, &
595  rss_liq, rss_ice, alt_ray_liq, alt_ray_ice, &
596  do_retrievals_liq, do_retrievals_ice, retrievalstatus)
597 
598 
599  if (allocated(tau_liquid)) then
600 
601  if (optical_thickness_liquid > 0.) then
602  tau_liquid(i,j) = nint(optical_thickness_liquid / retr_scale_factor)
603  else
605  endif
606 
607  if (optical_thickness_ice > 0.) then
608  tau_ice(i,j) = nint(optical_thickness_ice / retr_scale_factor)
609  else
610  tau_ice(i,j) = fillvalue_int2
611  endif
612 
613  if (effective_radius_21_liquid > 0.) then
614  re21_liquid(i,j) = nint(effective_radius_21_liquid / retr_scale_factor)
615  else
617  endif
618 
619  if (effective_radius_21_ice > 0.) then
620  re21_ice(i,j) = nint(effective_radius_21_ice / retr_scale_factor)
621  else
622  re21_ice(i,j) = fillvalue_int2
623  endif
624 
625  endif
626 
627 
628 #endif
629 
630 
631  if (cox_munk) &
633 
634 
635 
636  if (retrievalstatus == 0 ) retrievalcount = retrievalcount+1
637  if (retrieval_failcount /= 0) retrieval_failcount = retrieval_failcount +1
638 
639 
640 ! there was no cloud
641  else
642  ! failure before retrieval
643  retrievalstatus = 1
644  call assign_retrieval_error(i,j)
645  retrieval_failcount = retrieval_failcount + 1
646  endif
647 
648 
649 
650 ! now we do cloud phase
651  cloudsummary(i,j)%cloudmask_determined = .true.
652  cloudsummary(i,j)%cloudobserved = .false.
653  cloudsummary(i,j)%watercloud = .false.
654  cloudsummary(i,j)%icecloud = .false.
655  cloudsummary(i,j)%unknowncloud = .false.
656 
657 ! set the baum phase according to the "Cloud_Phase_Infrared_1km" SDS (to pass to cloud phase and multi-layer alg.)
658 
659  ir_cloudphase%icecloud = 0
660  ir_cloudphase%watercloud = 0
661  ir_cloudphase%unknowncloud = 1
662  if (cloud_phase_infrared(i,j) == 1) ir_cloudphase%watercloud = 1
663  if (cloud_phase_infrared(i,j) == 2) ir_cloudphase%icecloud = 1
664  if (cloud_phase_infrared(i,j) == 1 .or. cloud_phase_infrared(i,j) == 2) ir_cloudphase%unknowncloud = 0
665 
667  cloudmask(i,j), &
668  corr_meas, &
669  rss_liq, &
670  rss_ice, &
679  ctt_1km, &
680  cloud_mask_spi(2,i,j)*0.01, &
681  cloud_height_method(i,j), &
682  ir_cloudphase, &
683  processing_information(i,j)%band_used_for_optical_thickness, &
684  cloudsummary(i,j), &
685  ldebug, &
686  cloudstatus, i,j)
687 
688 ! Normally, FORCE_ICE, FORCE_WATER are false and the cloud decision
689 ! above sets the cloudsummary water or ice state
690 ! force phase to ice ( Yes, for some reason, they set the contrary state and
691 ! set the right state for cloudsummary(i,j)%icecloud, watercloud)
692  if (force_ice .and. cloudsummary(i,j)%cloudobserved) then
693  cloudsummary(i,j)%watercloud = .false.
694  cloudsummary(i,j)%icecloud = .false.
695  cloudsummary(i,j)%unknowncloud = .false.
696  cloudsummary(i,j)%icecloud = .true.
697  endif
698 ! force phase to water
699  if (force_water .and. cloudsummary(i,j)%cloudobserved) then
700  cloudsummary(i,j)%watercloud = .false.
701  cloudsummary(i,j)%icecloud = .false.
702  cloudsummary(i,j)%unknowncloud = .false.
703  cloudsummary(i,j)%watercloud = .true.
704  endif
705 
706 #ifndef RETRIEVE
707  cloudsummary(i,j)%cloudobserved = .true.
708 #endif
709 
710  if (cloudsummary(i,j)%cloudobserved) then
711 
712 ! the channels get set regardless of phase, however
713 ! 0.65um gets overwritten if rayleigh is applied later
714  atm_corr_refl(band_0065,i,j) = corr_meas(band_0065)
715  atm_corr_refl(band_0086,i,j) = corr_meas(band_0086)
716  atm_corr_refl(band_0124,i,j) = corr_meas(band_0124)
717  atm_corr_refl(band_0163,i,j) = corr_meas(band_0163)
718  atm_corr_refl(band_0213,i,j) = corr_meas(band_0213)
720 
721 
722 
723 ! set the answers based on final phase decision and do the remaining science here
724 ! we need to compute water path, multilayer and uncertainty and set the tau_out_of_bounds QA bit
725 
726 
727  if (cloudsummary(i,j)%watercloud .or. cloudsummary(i,j)%unknowncloud) then
728 
729 ! set the liquid water answers
738  if (tc_liquid > 0.) then
739  irw_temperature(i,j) = tc_liquid
740  cloud_top_temperature(i,j) = tc_liquid
741  endif
742 
743  nearest_used = liq_near
744  rss_final = rss_liq
745  emission_pw = emission_uncertainty_pw_liq
746  emission_tc = emission_uncertainty_tc_liq
747  sigma_r37_pw = sigma_r37_pw_liq
748 
749 ! set the rayleigh refl here
750  if (.not. cox_munk) then
751  if (alt_ray_liq > 0.) then
752  atm_corr_refl(band_0065, i,j) = alt_ray_liq
753  else
755  re_idx_low,re_idx_hi)
756  if (rayleigh_liq(re_idx_low) > 0. .and. rayleigh_liq(re_idx_hi) > 0.) then
757  atm_corr_refl(band_0065, i,j) = &
758  linearinterpolation( (/water_radii(re_idx_low), water_radii(re_idx_hi) /), &
759  (/rayleigh_liq(re_idx_low), rayleigh_liq(re_idx_hi)/), &
761  endif
762  endif
763  endif
764 ! set the tau out of bounds bit
765 
766  if (optical_thickness_final(i,j) > 150.) then!{
767  optical_thickness_final(i,j) = 150.
768  processing_information(i,j)%optical_thickness_outofbounds = 2
769  else!}{
770  processing_information(i,j)%optical_thickness_outofbounds = 0
771  endif!}
772 
773 
774  if (optical_thickness_16_final(i,j) > 150.) &
775  optical_thickness_16_final(i,j) = 150.
776 
777  if (optical_thickness_37_final(i,j) > 150.) &
778  optical_thickness_37_final(i,j) = 150.
779 
780  if (optical_thickness_1621_final(i,j) > 150.) &
781  optical_thickness_1621_final(i,j) = 150.
782 
783  finalize_liq = .false.
784  finalize_ice = .false.
785  if (optical_thickness_16_final(i,j) > 0. .and. effective_radius_16_final(i,j) > 0.) &
786  finalize_liq(1) = .true.
787  if (optical_thickness_final(i,j) > 0. .and. effective_radius_21_final(i,j) > 0.) &
788  finalize_liq(2) = .true.
789  if (optical_thickness_37_final(i,j) > 0. .and. effective_radius_37_final(i,j) > 0.) &
790  finalize_liq(3) = .true.
791  if (optical_thickness_1621_final(i,j) > 0. .and. effective_radius_1621_final(i,j) > 0.) &
792  finalize_liq(4) = .true.
793 
794  else if(cloudsummary(i,j)%icecloud) then
795 
796 ! set the ice cloud answers
805  if (tc_ice > 0.) then
806  irw_temperature(i,j) = tc_ice
807  cloud_top_temperature(i,j) = tc_ice
808  endif
809 
810  nearest_used = ice_near
811  rss_final = rss_ice
812  emission_pw = emission_uncertainty_pw_ice
813  emission_tc = emission_uncertainty_tc_ice
814  sigma_r37_pw = sigma_r37_pw_ice
815 
816  if (.not. cox_munk) then
817  if (alt_ray_ice > 0.) then
818  atm_corr_refl(band_0065, i,j) = alt_ray_ice
819  else
821  re_idx_low,re_idx_hi)
822  if (rayleigh_ice(re_idx_low) > 0. .and. rayleigh_ice(re_idx_hi) > 0.) then
823  atm_corr_refl(band_0065, i,j) = &
824  linearinterpolation( (/ice_radii(re_idx_low), ice_radii(re_idx_hi) /), &
825  (/rayleigh_ice(re_idx_low), rayleigh_ice(re_idx_hi)/), &
827  endif
828  endif
829  endif
830 
831 ! set the tau out of bounds bit
832 ! the new setting indicates flagging of tau only if it's more than 150. All others are considered perfectly valid
833 
834  if (optical_thickness_final(i,j) > 150.) then!{
835  optical_thickness_final(i,j) = 150.
836  processing_information(i,j)%optical_thickness_outofbounds = 2
837  else!}{
838  processing_information(i,j)%optical_thickness_outofbounds = 0
839  endif!}
840 
841 
842  if (optical_thickness_16_final(i,j) > 150.) &
843  optical_thickness_16_final(i,j) = 150.
844 
845  if (optical_thickness_37_final(i,j) > 150.) &
846  optical_thickness_37_final(i,j) = 150.
847 
848  if (optical_thickness_1621_final(i,j) > 150.) &
849  optical_thickness_1621_final(i,j) = 150.
850 
851 
852  finalize_liq = .false.
853  finalize_ice = .false.
854  if (optical_thickness_16_final(i,j) > 0. .and. effective_radius_16_final(i,j) > 0.) &
855  finalize_ice(1) = .true.
856  if (optical_thickness_final(i,j) > 0. .and. effective_radius_21_final(i,j) > 0.) &
857  finalize_ice(2) = .true.
858  if (optical_thickness_37_final(i,j) > 0. .and. effective_radius_37_final(i,j) > 0.) &
859  finalize_ice(3) = .true.
860  if (optical_thickness_1621_final(i,j) > 0. .and. effective_radius_1621_final(i,j) > 0.) &
861  finalize_ice(4) = .true.
862 
863 
864  endif
865 
866  call set_water_path_answers(i,j, finalize_liq, finalize_ice)
867 
868  if (optical_thickness_final(i,j) > 0. .and. effective_radius_21_final(i,j) > 0.) then
869  im_successful_retrieval_count = im_successful_retrieval_count + 1
870  endif
871 
872 ! assign the failure metric here:
873 
874 ! nearest_used and RSS_final
875  set_near = .false.
876  if (nearest_used(re16) == 1 .and. (.not. (optical_thickness_16_final(i,j) == max_tau_rtrieved &
877  .and. effective_radius_16_final(i,j) /= fillvalue_real))) then
878  set_near(1) = .true.
879  endif
880 
881  if (nearest_used(re21) == 1 .and. (.not. (optical_thickness_final(i,j) == max_tau_rtrieved &
882  .and. effective_radius_21_final(i,j) /= fillvalue_real))) then
883  set_near(2) = .true.
884  endif
885 
886  if (nearest_used(re37) == 1 .and. (.not. (optical_thickness_37_final(i,j) == max_tau_rtrieved &
887  .and. effective_radius_37_final(i,j) /= fillvalue_real))) then
888  set_near(3) = .true.
889  endif
890 
891  if (nearest_used(re1621) == 1) then
892  set_near(4) = .true.
893  endif
894 
895  call set_failure_answers(i,j,rss_final, set_near)
896 
897 ! compute multilayer
898  if ( (optical_thickness_final(i,j) > 0.) .and. &
899  ( c2_cmp_there(band_0935) == 1) .and. &
900  ( c2_cmp_there(band_1100) == 1) ) then
901 
904  temp_meas, &
905  cloudsummary(i,j), &
906  ir_cloudphase, &
907  ! WDR model_info(model_i,model_j)%pressure_profile,&
908  ! model_info(model_i,model_j)%mixr_profile(:), &
909  ! model_info(model_i,model_j)%temp_profile(:), &
910  ! model_info(model_i,model_j)%surface_level, &
911  c2_model_info%pressure_profile,&
912  c2_model_info%mixr_profile(:), &
913  c2_model_info%temp_profile(:), &
914  c2_model_info%surface_level, &
915  cloud_top_pressure(i,j), &
916  abovecloud_watervapor(i,j), &
917  sensor_zenith_angle(i,j), &
918  solar_zenith_angle(i,j), &
919  relative_azimuth_angle(i,j), &
922  i, j, &
923  cloud_layer_flag(i,j), ml_test_flag(i,j))
924 
925  else
926  cloud_layer_flag(i,j) = 0
927  ml_test_flag(i,j) = 0
928  endif
929 
930 
931 
932 
933 
934 ! *** ATTENTION ****
935 ! to do the 3.7um uncertainty, it is not enough to replace the re and tau with the 3.7um values. It is also
936 ! necessary to set the absorbingband_index to be 3.7um to feed the libraries in. In addition to that
937 ! the albedo_holder and R1R2wavelengthIdx arrays MUST be fed with absorbingband_index-1 !!
938 ! If you fail to do so, you will end up with a royal mess and not know why the numbers don't make sense.
939 ! -- G. Wind 7.5.2006
940 
941 
942 ! get retrieval uncertainty estimate
943 
944  if ( cloudsummary(i,j)%icecloud ) then!{
945  phase = 'ice'
946  else!}{
947  phase = 'water'
948  endif!}
949 
950 
951 
952 ! if ((nearest_used(re21) == 0 .or. (nearest_used(re21) == 1 .and. optical_thickness_final(i,j) == MAX_TAU_RTRIEVED ))&
953 ! .and. (optical_thickness_final(i,j) .ge. 0.01) .and. (effective_radius_21_final(i,j) .ge. 0.01) .and. &
954 ! (cloudsummary(i,j)%icecloud .or. cloudsummary(i,j)%watercloud .or. cloudsummary(i,j)%unknowncloud)) then!{
955 
956  ! WDR - I'm keeping original 'if' decision logic above but
957  ! cleaning it up and adding a test for na_band_used
958  if( ( nearest_used(re21) == 0 .or. ( nearest_used(re21) == 1 &
959  .and. optical_thickness_final(i,j) == max_tau_rtrieved ) ) &
960  .and. ( optical_thickness_final(i,j) .ge. 0.01 ) &
961  .and. ( effective_radius_21_final(i,j) .ge. 0.01 ) &
962  .and. ( cloudsummary(i,j)%icecloud &
963  .or. cloudsummary(i,j)%watercloud &
964  .or. cloudsummary(i,j)%unknowncloud ) &
965  .and. ( na_band_used > 0 ) ) then!{
966 
967 
968  absorbingband_index = band_0213
969 
970 !if ( na_band_used <= 0 ) then
971 ! print*, __FILE__, __LINE__," WDR BAD condition, na_band_used = ", &
972 ! na_band_used
973 !endif
974  albedo_holder = (/albedo_real4(na_band_used), &
975  albedo_real4(absorbingband_index)/)
976  cloud_reflectance = (/corr_meas(na_band_used), &
977  corr_meas(absorbingband_index)/)
978  r1r2wavelengthidx = (/na_band_used, absorbingband_index/)
979 
980  if (iterationx == 1) then
981  uncertain_start = i
982  else
983  uncertain_start = i+1
984  endif
985 
986  unc_reflectance(1) = spec_uncertain(na_band_used) * &
987  exp(band_uncertainty(uncertain_start,na_band_used, j)*1.0 / uncertain_sf(na_band_used)) * 0.01
988  unc_reflectance(2) = spec_uncertain(absorbingband_index) * &
989  exp(band_uncertainty(uncertain_start,absorbingband_index, j)*1.0 / uncertain_sf(absorbingband_index)) * 0.01
990 
991 
992  if (set_bands(na_band_used) < set_bands(band_0124)) unc_reflectance(1) = max(vnir_error, unc_reflectance(1))
993  if (set_bands(na_band_used) >= set_bands(band_0124)) unc_reflectance(1) = max(swir_error, unc_reflectance(1))
994  if (set_bands(absorbingband_index) >= set_bands(band_0124)) unc_reflectance(2) = max(swir_error, unc_reflectance(2))
995 
996 
997 
998 ! FIVE PERCENT
999 ! unc_reflectance = 0.05
1000 ! UNC_REFL + 2%
1001 ! unc_reflectance = sqrt ( unc_reflectance**2 + 0.02**2 )
1002 
1005  liquid_water_path(i,j), &
1006  phase, &
1007  r1r2wavelengthidx, &
1008  unc_reflectance, &
1009  albedo_holder, &
1010  transmittance_twoway(na_band_used), &
1011  transmittance_twoway(absorbingband_index), &
1012  meandelta_trans(na_band_used), &
1013  meandelta_trans(absorbingband_index), &
1014  transmittance_stddev(na_band_used), &
1015  transmittance_stddev(absorbingband_index), &
1016  emission_pw, emission_tc, sigma_r37_pw, &
1017  unc_tau_real , &
1018  unc_re21_real, &
1019  unc_lwp21_real, i, j)
1020 
1021  optical_thickness_error(i, j) = nint(unc_tau_real / unc_scale_factor)
1022  effective_radius_21_error(i, j) = nint(unc_re21_real / unc_scale_factor)
1023  liquid_water_path_error(i,j) = nint(unc_lwp21_real / unc_scale_factor)
1024 
1025 
1026  else!}{
1030  endif!}
1031 
1032  if ( unc_tau_real .lt. epsilon(unc_tau_real) .or. &
1033  unc_re21_real .lt. epsilon(unc_re21_real) .or. &
1034  unc_lwp21_real .lt. epsilon(unc_lwp21_real)) then!{
1035 
1039  endif!}
1040 
1041 
1042 
1043 
1044 ! get uncertainty estimate for 1.6um retrieval
1045  if ((nearest_used(re16) == 0 .or. (nearest_used(re16) == 1 .and. optical_thickness_16_final(i,j) == max_tau_rtrieved ))&
1046  .and. (optical_thickness_16_final(i,j) .ge. 0.01) .and. (effective_radius_16_final(i,j) .ge. 0.01) .and. &
1047  (cloudsummary(i,j)%icecloud .or. cloudsummary(i,j)%watercloud .or. cloudsummary(i,j)%unknowncloud) &
1048  .and. ( na_band_used > 0 ) ) then!{
1049 
1050 
1051 
1052  absorbingband_index = band_0163
1053 
1054  albedo_holder = (/albedo_real4(na_band_used), &
1055  albedo_real4(absorbingband_index)/)
1056  cloud_reflectance = (/corr_meas(na_band_used), &
1057  corr_meas(absorbingband_index)/)
1058  r1r2wavelengthidx = (/na_band_used, absorbingband_index/)
1059 
1060  if (iterationx == 1) then
1061  uncertain_start = i
1062  else
1063  uncertain_start = i+1
1064  endif
1065 
1066  unc_reflectance(1) = spec_uncertain(na_band_used) * &
1067  exp(band_uncertainty(uncertain_start,na_band_used, j)*1.0 / uncertain_sf(na_band_used)) * 0.01
1068  unc_reflectance(2) = spec_uncertain(absorbingband_index) * &
1069  exp(band_uncertainty(uncertain_start,absorbingband_index, j)*1.0 / uncertain_sf(absorbingband_index)) * 0.01
1070 
1071  if (set_bands(na_band_used) < set_bands(band_0124)) unc_reflectance(1) = max(vnir_error, unc_reflectance(1))
1072  if (set_bands(na_band_used) >= set_bands(band_0124)) unc_reflectance(1) = max(swir_error, unc_reflectance(1))
1073  if (set_bands(absorbingband_index) >= set_bands(band_0124)) unc_reflectance(2) = max(swir_error, unc_reflectance(2))
1074 
1077  liquid_water_path_16(i,j), &
1078  phase, &
1079  r1r2wavelengthidx, &
1080  unc_reflectance, &
1081  albedo_holder, &
1082  transmittance_twoway(na_band_used), &
1083  transmittance_twoway(absorbingband_index), &
1084  meandelta_trans(na_band_used), &
1085  meandelta_trans(absorbingband_index), &
1086  transmittance_stddev(na_band_used), &
1087  transmittance_stddev(absorbingband_index), &
1088  emission_pw, emission_tc, sigma_r37_pw, &
1089  unc_tau16_real , &
1090  unc_re16_real, &
1091  unc_lwp16_real, i, j)
1092 
1093  optical_thickness_16_error(i, j) = nint(unc_tau16_real / unc_scale_factor)
1094  effective_radius_16_error(i, j) = nint(unc_re16_real / unc_scale_factor)
1095  liquid_water_path_16_error(i, j) = nint(unc_lwp16_real / unc_scale_factor)
1096 
1097  else!}{
1101  endif!}
1102 
1103  if ( unc_tau16_real .lt. epsilon(unc_tau16_real) .or. &
1104  unc_re16_real .lt. epsilon(unc_re16_real) .or. &
1105  unc_lwp16_real .lt. epsilon(unc_lwp16_real) ) then!{
1109  endif!}
1110 
1111 
1112 
1113 ! get uncertainty estimate for 3.7um retrieval
1114 ! this is the initial part, without any emission uncertainty
1115 ! we are not using the transmittance table to do the atmospheric correction here, so
1116 ! for the moment uncertainty due to PW table for 3.7um is set to be 0.0
1117  if ((nearest_used(re37) == 0 .or. (nearest_used(re37) == 1 .and. optical_thickness_37_final(i,j) == max_tau_rtrieved ))&
1118  .and. (optical_thickness_37_final(i,j) .ge. 0.01) .and. (effective_radius_37_final(i,j) .ge. 0.01) .and. &
1119  (cloudsummary(i,j)%icecloud .or. cloudsummary(i,j)%watercloud .or. cloudsummary(i,j)%unknowncloud) &
1120  .and. ( na_band_used > 0 ) ) then!{
1121 
1122 
1123  absorbingband_index = band_0370
1124 
1125 
1126  albedo_holder = (/albedo_real4(na_band_used), &
1127  albedo_real4(absorbingband_index-1)/)
1128  cloud_reflectance = (/corr_meas(na_band_used), &
1129  corr_meas(absorbingband_index)/)
1130  r1r2wavelengthidx = (/na_band_used, absorbingband_index-1/)
1131 
1132  if (iterationx == 1) then
1133  uncertain_start = i
1134  else
1135  uncertain_start = i+1
1136  endif
1137 
1138  unc_reflectance(1) = spec_uncertain(na_band_used) * &
1139  exp(band_uncertainty(uncertain_start,na_band_used, j)*1.0 / uncertain_sf(na_band_used)) * 0.01
1140  unc_reflectance(2) = spec_uncertain(absorbingband_index-1) * &
1141  exp(band_uncertainty(uncertain_start,absorbingband_index-1, j)*1.0 / &
1142  uncertain_sf(absorbingband_index-1)) * 0.01
1143 
1144  if (set_bands(na_band_used) < set_bands(band_0124)) unc_reflectance(1) = max(vnir_error, unc_reflectance(1))
1145  if (set_bands(na_band_used) >= set_bands(band_0124)) unc_reflectance(1) = max(swir_error, unc_reflectance(1))
1146  if (set_bands(absorbingband_index) >= set_bands(band_0124) .and. set_bands(absorbingband_index) <= set_bands(band_0213)) &
1147  unc_reflectance(2) = max(swir_error, unc_reflectance(2))
1148 
1151  liquid_water_path_37(i,j), &
1152  phase, &
1153  r1r2wavelengthidx, &
1154  unc_reflectance, &
1155  albedo_holder, &
1156  transmittance_twoway(na_band_used), &
1157  transmittance_twoway(absorbingband_index), &
1158  meandelta_trans(na_band_used), &
1159  meandelta_trans(absorbingband_index), &
1160  transmittance_stddev(na_band_used), &
1161  transmittance_stddev(absorbingband_index), &
1162  emission_pw, emission_tc, sigma_r37_pw,&
1163  unc_tau37_real , &
1164  unc_re37_real, &
1165  unc_lwp37_real, i, j)
1166 
1167  optical_thickness_37_error(i, j) = nint(unc_tau37_real / unc_scale_factor)
1168  effective_radius_37_error(i, j) = nint(unc_re37_real / unc_scale_factor)
1169  liquid_water_path_37_error(i, j) = nint(unc_lwp37_real / unc_scale_factor)
1170 
1171  else!}{
1175  endif!}
1176 
1177  if ( unc_tau37_real .lt. epsilon(unc_tau37_real) .or. &
1178  unc_re37_real .lt. epsilon(unc_re37_real) .or. &
1179  unc_lwp37_real .lt. epsilon(unc_lwp37_real) ) then!{
1183  endif!}
1184 
1185 
1186 
1187 ! get 1621 retrieval uncertainty estimate
1188  if ((nearest_used(re1621) == 0 .or. (nearest_used(re1621) == 1 .and. optical_thickness_1621_final(i,j) == max_tau_rtrieved ))&
1189  .and. (optical_thickness_1621_final(i,j) .ge. 0.01) .and. (effective_radius_1621_final(i,j) .ge. 0.01) .and. &
1190  (cloudsummary(i,j)%icecloud .or. cloudsummary(i,j)%watercloud .or. cloudsummary(i,j)%unknowncloud) &
1191  .and. ( na_band_used > 0 ) ) then!{
1192 
1193 
1194  uncertainty_nonabsorbing_1621 = band_0163
1195  absorbingband_index = band_0213
1196 
1197 
1198  albedo_holder = (/albedo_real4(uncertainty_nonabsorbing_1621), &
1199  albedo_real4(absorbingband_index)/)
1200  cloud_reflectance = (/corr_meas(uncertainty_nonabsorbing_1621), &
1201  corr_meas(absorbingband_index)/)
1202  r1r2wavelengthidx = (/uncertainty_nonabsorbing_1621, absorbingband_index/)
1203 
1204 
1205  if (iterationx == 1) then
1206  uncertain_start = i
1207  else
1208  uncertain_start = i+1
1209  endif
1210 
1211  unc_reflectance(1) = spec_uncertain(uncertainty_nonabsorbing_1621) * &
1212  exp(band_uncertainty(uncertain_start,uncertainty_nonabsorbing_1621, j)*1.0 / &
1213  uncertain_sf(uncertainty_nonabsorbing_1621)) * 0.01
1214  unc_reflectance(2) = spec_uncertain(absorbingband_index) * &
1215  exp(band_uncertainty(uncertain_start,absorbingband_index, j)*1.0 / uncertain_sf(absorbingband_index)) * 0.01
1216 
1217  if (set_bands(uncertainty_nonabsorbing_1621) < set_bands(band_0124)) unc_reflectance(1) = max(vnir_error, unc_reflectance(1))
1218  if (set_bands(uncertainty_nonabsorbing_1621) >= set_bands(band_0124)) unc_reflectance(1) = max(swir_error, unc_reflectance(1))
1219  if (set_bands(absorbingband_index) >= set_bands(band_0124)) unc_reflectance(2) = max(swir_error, unc_reflectance(2))
1220 
1223  liquid_water_path_1621(i,j), &
1224  phase, &
1225  r1r2wavelengthidx, &
1226  unc_reflectance, &
1227  albedo_holder, &
1228  transmittance_twoway(uncertainty_nonabsorbing_1621), &
1229  transmittance_twoway(absorbingband_index), &
1230  meandelta_trans(uncertainty_nonabsorbing_1621), &
1231  meandelta_trans(absorbingband_index), &
1232  transmittance_stddev(uncertainty_nonabsorbing_1621), &
1233  transmittance_stddev(absorbingband_index), &
1234  emission_pw, emission_tc, sigma_r37_pw,&
1235  unc_tau_1621_real , &
1236  unc_re1621_real, &
1237  unc_lwp1621_real, i, j)
1238 
1239 
1240 
1241  optical_thickness_1621_error(i, j) = nint(unc_tau_1621_real / unc_scale_factor)
1242  effective_radius_1621_error(i, j) = nint(unc_re1621_real / unc_scale_factor)
1243  liquid_water_path_1621_error(i,j) = nint(unc_lwp1621_real / unc_scale_factor)
1244 
1245  else!}{
1249  endif!}
1250 
1251  if ( unc_tau_1621_real .lt. epsilon(unc_tau_1621_real) .or. &
1252  unc_re1621_real .lt. epsilon(unc_re1621_real) .or. &
1253  unc_lwp1621_real .lt. epsilon(unc_lwp1621_real)) then!{
1254 
1258  endif!}
1259 
1260 
1261  if (do_csr) then
1262 
1263 ! let us remember that band measurements are being overscanned
1264  if (iterationx == 1) then
1265  if (i==1) then
1266  istart = i
1267  iend = i+1
1268  endif
1269  else
1270  if (i==1) then
1271  istart = i
1272  iend = i+2
1273  endif
1274  endif
1275 
1276  if (i > 1 .and. i < xdimension) then
1277  istart = i-1
1278  iend = i+1
1279  endif
1280 
1281  if (iterationx < number_of_iterationsx) then
1282  if (i == xdimension) then
1283  istart = i-1
1284  iend = i+1
1285  endif
1286  else
1287  if (i == xdimension) then
1288  istart = i-1
1289  iend = i
1290  endif
1291  endif
1292 
1293 
1294  if (j == 1) then
1295  jstart = j
1296  jend = j+1
1297  endif
1298  if (j >=2 .and. j <= (ydimension-1)) then
1299  jstart = j-1
1300  jend = j+1
1301  endif
1302  if (j == ydimension) then
1303  jstart = j-1
1304  jend = j
1305  endif
1306 
1307  ! Check if 1km visible reflectance threshold or VIS/NIR ratio tests are applied and cloudy. Clear sky restoral
1308  ! Part V (CSR=3) test will only be applied over ocean if vis1km_test = .true. (i.e., either one of visible
1309  ! reflectance or VIS/NIR ratio tests are applied and cloudy).
1310  ! KGM 3-4-13
1311  vis1km_test = .false.
1312  if ((cloudmask(i,j)%applied_visiblereflectance==1 .and. cloudmask(i,j)%test_visiblereflectance==1) .or. &
1313  (cloudmask(i,j)%applied_visnirratio==1 .and. cloudmask(i,j)%test_visnirratio==1) ) vis1km_test = .true.
1314 
1315  call cloudiness_test (cloudmask(i,j), &
1316  cloudsummary(i,j), &
1317  temp_meas, &
1318  band_measurements(istart:iend,:,jstart:jend), &
1319  sunglint_dust_test, &
1320  lowvariability_confidence_test, &
1321  csr_flag_array(i,j), latitude(i,j), &
1322  cloud_height_method(i,j), vis1km_test) ! KGM 3-4-13 GW 3.28.13
1323 
1324  if (csr_flag_array(i,j) == 2 .and. cloudsummary(i,j)%ocean_surface) then
1325 #ifdef RETRIEVE
1326  call compute_aod(i, j, scattering_angle, corr_meas, cur_wind_speed, aod550)
1327 
1328  ! if the aerosol optical depth is too much then it's probably a cloud
1329  ! and we can keep the retrieval, however we will mark it as a potentially
1330  ! problematic cloud.
1331  if (aod550 > 0.95) then ! aod550 is a ln(aod+0.01) quantity
1332  csr_flag_array(i,j) = 0
1333  endif
1334 #endif
1335  endif
1336 
1337  endif
1338 
1339 #ifndef RETRIEVE
1340 
1341 
1342 
1343  if (surface_albedo(i,j,1) < 300 .and. .not. cloudmask(i,j)%desert_surface .and. &
1344  .not. cloudsummary(i,j)%snowice_surface ) then
1345 
1346 
1347 
1348  call compute_aod(i, j, scattering_angle, corr_meas, cur_wind_speed, aod550)
1349  aod550_store(i,j) = (exp(aod550) - 0.01) ! that's so it can be stored in a good way in an RE sds
1350  if (aod550_store(i,j) < 0.) aod550_store(i,j) = 0.01
1351 
1352 
1353  else
1354  aod550_store(i,j) = fillvalue_real
1355  endif
1356 
1357 #endif
1358 
1359 
1360 
1361  else
1362  retrievalstatus = 1
1363  call assign_retrieval_error(i,j)
1364  retrieval_failcount = retrieval_failcount + 1
1365  endif
1366 
1367 
1368 
1369 
1370 
1371  enddo
1372 enddo
1373 
1374 ! WDR capture the working arrays before modification
1375  call capture_arrays
1376 
1377  call cleanup_retrieval
1378 
1379 ! print*, "NUM_INTERP:", count_interpolations
1380 
1381 ! print*, "num_sza: ", cnt_sza
1382 ! print*, "num_vza: ", cnt_vza
1383 ! print*, "num_raz: ", cnt_raz
1384 ! print*, "num_scat: ", cnt_scat
1385 ! print*, "num_cm_switch: ", cnt_cm_switch
1386 ! print*, "num_wspeed: ", cnt_wspeed
1387 ! print*, "** wind speed only: ", cnt_wspeed_only
1388 
1389 ! Now that we've done the clear sky restoral, we remove the edges of the clouds (ED)
1390 ! WDR temp to set so no remove done
1391  if (do_csr) then !{
1392 
1394  csr_flag_array, &
1395  xdimension, ydimension, &
1396  status)
1397 
1398 
1399 ! reset cloudsummary variables for pixels "cleared" by CSR or ED, this step necessary
1400 ! so that "cleared" pixels in cloud optical properties SDS get set to clear, and
1401 ! so that pertainent QA can be properly identified when set GTA 6/7/05
1402 
1403 ! endif
1404 
1405 
1406  where(csr_flag_array == 2)
1407  cloudsummary%cloudobserved = .false.
1408  cloudsummary%watercloud = .false.
1409  cloudsummary%icecloud = .false.
1410  cloudsummary%unknowncloud = .false.
1411 
1431  cloud_layer_flag = 0
1432  ml_test_flag = 0
1438 
1442 
1446 
1450 
1454 
1457 
1458  end where
1459 
1460 ! Now split off the PCL retrievals
1461 ! if it's an edge pixel or a 250m variable pixels then
1462 ! split off the retrieval to the PCL storage and get rid of the value in
1463 ! main retrieval arrays
1464  call split_pcl(xdimension, ydimension)
1465 
1466  endif !}
1467 
1468 
1469 
1470 
1471 ! now we need to compute the inventory metadata that relates to the cloudiness percentage
1472 ! water cloud percentage and ice cloud percentage. We need to aggregate the little suckers
1473 
1474  do i=1, xdimension
1475  do j = 1, ydimension
1476 
1477 ! first of all we need to make sure that we have a cloud
1478  if (solar_zenith_angle(i,j) <= solar_zenith_threshold .and. &
1479  cloudsummary(i,j)%cloudobserved) then
1480  im_cloudy_count = im_cloudy_count + 1
1481 
1482 ! now that we're sure, we can count the ice and water cloud pixels
1483  if (cloudsummary(i,j)%watercloud) then
1484  im_water_cloud_count = im_water_cloud_count + 1
1485  endif
1486  if (cloudsummary(i,j)%icecloud) then
1487  im_ice_cloud_count = im_ice_cloud_count + 1
1488  endif
1489 
1490  if (cloudsummary(i,j)%unknowncloud) then
1491  im_undet_count = im_undet_count + 1
1492  endif
1493 
1494  endif
1495 
1496  end do
1497  end do
1498 
1499 
1500 ! optical_thickness_final = abovecloud_watervapor
1501 ! effective_radius_16_final = cloud_top_pressure
1502 
1503 #ifndef RETRIEVE
1504  effective_radius_21_final(:,:) = aod550_store(:,:)
1505  deallocate(aod550_store)
1506 #endif
1507 
1508 ! print*, abovecloud_watervapor(14,884), cloud_top_pressure(14,884), surface_temperature(14,884)
1509 
1510 ! WDR complete the processing_information setup with call to set_quality_data
1511  call set_quality_data( xdimension, ydimension )
1512 
1513 ! print*, optical_thickness_final(19, 1992)
1514 ! print*, effective_radius_16_final (19, 1992)
1515 ! print*, effective_radius_21_final (19, 1992)
1516 ! print*, effective_radius_37_final(19, 1992)
1517 
1518  end subroutine scienceinterface
1519 
1520 subroutine compute_aod(x, y, scat_ang, corr_meas, ws, aod550)
1522  use core_arrays
1523  use mod06_run_settings
1524  use science_parameters, only: d2r
1527 
1528  integer, intent(in) :: x, y
1529  real, intent(in) :: scat_ang, ws
1530  real, intent(inout) :: aod550
1531  real, dimension(:), intent(in) :: corr_meas
1532 
1533  external ffnet_terra, ffnet_aqua, ffnet_aqua_land, ffnet_terra_land
1534 
1535  real*8 :: input(15), output(1), input_land(14)
1536  real*8 :: ga, sza, vza, saz, vaz, raz, sca
1537  real :: check_val, temp_16
1538  integer :: i
1539 
1540  sza = solar_zenith_angle(x,y)
1541  vza = sensor_zenith_angle(x,y)
1542  saz = solar_azimuth_angle(x,y)
1543  vaz = sensor_azimuth_angle(x,y)
1544  raz = relative_azimuth_angle(x,y)
1545 
1546  ga = cos(sza*d2r) * cos(vza*d2r) + sin(sza*d2r) * sin(vza*d2r) * cos(raz*d2r)
1547 
1548  sca = cos(scat_ang*d2r)*1.0d0
1549  saz = cos(saz*d2r)*1.0d0
1550  sza = cos(sza*d2r)*1.0d0
1551  vaz = cos(vaz*d2r)*1.0d0
1552  vza = cos(vza*d2r)*1.0d0
1553 
1554 !tbsS'InputNames ocean'
1555 !S'mRef470'
1556 !aS'mRef550'
1557 !aS'mRef660'
1558 !aS'mRef870'
1559 !aS'mRef1200'
1560 !aS'mRef1600'
1561 !aS'mRef2100'
1562 !aS'ScatteringAngle'
1563 !aS'GlintAngle'
1564 !aS'SolarAzimuth'
1565 !aS'SolarZenith'
1566 !aS'SensorAzimuth'
1567 !aS'SensorZenith'
1568 !aS'cloud'
1569 !aS'wind'
1570 
1571 
1572  if (cloudsummary(x,y)%ocean_surface) then
1573 
1574  input = (/ corr_meas(band_0047)*1.0d0, &
1575  corr_meas(band_0055)*1.0d0, &
1576  corr_meas(band_0065)*1.0d0, &
1577  corr_meas(band_0086)*1.0d0, &
1578  corr_meas(band_0124)*1.0d0, &
1579  corr_meas(band_0163)*1.0d0, &
1580  corr_meas(band_0213)*1.0d0, &
1581  sca, ga, saz, sza, vaz, vza, 0.0d0, &
1582  ws*1.0d0 /)
1583 
1584  if ( corr_meas(band_0163) < 0.) then
1585 
1586  temp_16 = linearinterpolation( (/1.24, 2.13/), (/corr_meas(band_0124), corr_meas(band_0213)/), 1.63)
1587  input(6) = temp_16*1.0d0
1588 
1589  endif
1590 
1591  if (platform_name(1:4) == "Aqua") call ffnet_aqua(input, output)
1592  if (platform_name(1:5) == "Terra") call ffnet_terra(input, output)
1593  else
1594 
1595 
1596  input_land = (/ corr_meas(band_0055)*1.0d0, &
1597  corr_meas(band_0047)*1.0d0, &
1598  corr_meas(band_0065)*1.0d0, &
1599  corr_meas(band_0086)*1.0d0, &
1600  corr_meas(band_0124)*1.0d0, &
1601  corr_meas(band_0163)*1.0d0, &
1602  corr_meas(band_0213)*1.0d0, &
1603  sca, saz, sza, vaz, vza, 0.0d0, albedo_real4(band_0065)*1.0d0 /) ! this is really a 550nm albedo
1604  ! look at ancillary module and see
1605 
1606  if ( corr_meas(band_0163) < 0.) then
1607 
1608  temp_16 = linearinterpolation( (/1.24, 2.13/), (/corr_meas(band_0124), corr_meas(band_0213)/), 1.63)
1609  input(6) = temp_16*1.0d0
1610 
1611  endif
1612 
1613  if (platform_name(1:4) == "Aqua") call ffnet_aqua_land(input_land, output)
1614  if (platform_name(1:5) == "Terra") call ffnet_terra_land(input_land, output)
1615  endif
1616 
1617  aod550 = output(1) ! ln(aod+0.01)
1618 
1619 end subroutine compute_aod
1620 
1621 subroutine fill_c2_mdl( i, j )
1622  !
1623  ! WDR fill_c2_mdl will make a 'ancillary_type' structure like model_info
1624  ! has but for just 1 point of interest
1625  !
1626  ! i, j pixel, line, coordinates in the current granule chunk
1627  !
1628  ! WDR 27 Nov 2018
1629  !
1630  use core_arrays, only: c2_model_info
1634 
1635  integer, intent(in) :: i, j
1636 
1637  c2_model_info%mixr_profile = c2_prof_mixr( i, j, : )
1638  c2_model_info%temp_profile = c2_prof_t( i, j, : )
1639  c2_model_info%height_profile = c2_prof_hgt( i, j, : )
1640  c2_model_info%pressure_profile = c2_prof_p( i, j, : )
1641  ! c2_model_info%o3_profile - not used, I think
1642  c2_model_info%o3_profile = 0
1643  c2_model_info%Ts = c2_tsfc( i, j )
1644  c2_model_info%Ps = c2_psfc( i, j )
1645  c2_model_info%wind_speed = c2_wind( i, j )
1646  c2_model_info%col_o3 = c2_tot_o3( i, j )
1647  c2_model_info%seaice_fraction = c2_ice_frac( i, j )
1648  c2_model_info%snow_fraction = c2_snow_frac( i, j )
1649  c2_model_info%surface_level = c2_sfc_lvl( i, j )
1650  c2_model_info%trop_level = c2_trop_lvl( i, j )
1651  ! c2_model_info%LSM = Not sure if used again
1652  c2_model_info%LSM = 0
1653 
1654 end subroutine fill_c2_mdl
1655 
1656 end module modis_science_module
1657 
Definition: ch_xfr.f90:1
integer *2, dimension(:,:), allocatable optical_thickness_37_error
Definition: core_arrays.f90:65
real, dimension(:,:), allocatable c2_alt_icec
Definition: ch_xfr.f90:20
integer *1, dimension(:,:), allocatable c2_trop_lvl
Definition: ch_xfr.f90:24
real, dimension(:,:), allocatable c2_psfc
Definition: ch_xfr.f90:17
real, dimension(nchan, model_levels), public rtm_trans_atm_clr
Definition: rtm_support.f90:47
integer, parameter re21
real optical_thickness_16_liquid
Definition: core_arrays.f90:24
integer, dimension(:,:), allocatable c2_alt_snowice
Definition: ch_xfr.f90:25
real, dimension(nchan, model_levels), public rtm_rad_atm_clr_low
Definition: rtm_support.f90:59
real(single), dimension(:,:), allocatable liquid_water_path
Definition: core_arrays.f90:56
integer, parameter band_0124
subroutine, public scienceinterface(threshold_solar_zenith, threshold_sensor_zenith, threshold_relative_azimuth, debug, status)
integer(integer_onebyte), dimension(:,:), allocatable cloud_layer_flag
Definition: core_arrays.f90:79
real, dimension(:,:,:), allocatable c2_prof_hgt
Definition: ch_xfr.f90:16
integer *2, dimension(:,:), allocatable effective_radius_16_error
Definition: core_arrays.f90:68
real, dimension(nchan, model_levels), public rtm_trans_atm_clr_low
Definition: rtm_support.f90:58
real, dimension(2) thermal_correction_oneway_high
real, dimension(set_number_of_bands) meandelta_trans
real, dimension(2) thermal_correction_twoway_high
real, dimension(20) sigma_r37_pw_liq
subroutine set_quality_data(xsize, ysize)
integer *2, dimension(:,:), allocatable liquid_water_path_16_error
Definition: core_arrays.f90:72
subroutine set_interp_controls(i, j, scattering_angle, cur_wind_speed, drel, threshold_solar_zenith, threshold_sensor_zenith, wind_speed_only, interp_SS, interp_MS)
subroutine get_model_idx_geos5(grid_xstart, grid_ystart, lat, lon, model_i, model_j)
type(cloudmask_type), dimension(:,:), allocatable cloudmask
integer *2, dimension(:,:,:), allocatable cloud_mask_spi
real optical_thickness_1621_ice
Definition: core_arrays.f90:26
real(single), dimension(:,:), allocatable optical_thickness_37_final
Definition: core_arrays.f90:36
real(single), dimension(:,:), allocatable longitude
real, dimension(20) sigma_r37_pw_ice
real(single), dimension(:,:), allocatable effective_radius_37_final
Definition: core_arrays.f90:40
real(single), dimension(:,:), allocatable cloud_top_pressure
real effective_radius_21_ice
Definition: core_arrays.f90:27
integer, parameter band_0047
integer, parameter re37
subroutine assign_retrieval_error(xpoint, ypoint)
integer *2, dimension(:,:), allocatable optical_thickness_1621_error
Definition: core_arrays.f90:75
real function, public linearinterpolation(X, Y, XX)
real function, public scatangle(solarAng, viewAng, relAzm)
integer *2, dimension(:,:), allocatable tau_liquid
Definition: core_arrays.f90:32
real, dimension(:,:), allocatable irw_temperature
real(single), dimension(:,:), allocatable latitude
integer *2, dimension(:,:), allocatable optical_thickness_error
Definition: core_arrays.f90:63
subroutine get_model_idx(lat, lon, i, j)
real optical_thickness_ice
Definition: core_arrays.f90:23
real effective_radius_21_liquid
Definition: core_arrays.f90:27
subroutine, public libraryinterpolate(local_solarzenith, local_sensorzenith, local_relativeazimuth, local_scatangle, local_wind_speed, wind_speed_only, interp_MS, interp_SS, debug, status, i, j)
real, dimension(set_number_of_bands) transmittance_twoway
real, dimension(nchan, model_levels), public rtm_cloud_prof_high
Definition: rtm_support.f90:65
real, dimension(:,:,:), allocatable c2_prof_mixr
Definition: ch_xfr.f90:15
integer, parameter set_albedo_bands
integer *2, parameter fillvalue_int2
real, dimension(:,:,:), allocatable atm_corr_refl
character *15 platform_name
real, dimension(:,:), allocatable sensor_azimuth_angle
integer, parameter band_0370
real optical_thickness_16_ice
Definition: core_arrays.f90:24
#define real
Definition: DbAlgOcean.cpp:26
integer *1, dimension(:,:), allocatable cloud_phase_infrared
subroutine, public init_rtm_vars()
Definition: rtm_support.f90:89
integer, parameter band_1100
real effective_radius_1621_ice
Definition: core_arrays.f90:29
subroutine ffnet_aqua_land(input, output)
type(failed_type), dimension(:,:), allocatable failure_metric_1621
integer *2, dimension(:,:), allocatable liquid_water_path_error
Definition: core_arrays.f90:71
real, dimension(:,:,:), allocatable surface_albedo
integer, parameter band_0086
subroutine split_pcl(xdim, ydim)
integer, parameter band_0213
real effective_radius_37_liquid
Definition: core_arrays.f90:30
type(processflag), dimension(:,:), allocatable cloudsummary
Definition: core_arrays.f90:87
real(single), dimension(:), allocatable water_radii
integer *2, dimension(:,:), allocatable liquid_water_path_37_error
Definition: core_arrays.f90:73
real, parameter albedo_fac
real, dimension(nchan, model_levels), public rtm_trans_atm_clr_high
Definition: rtm_support.f90:63
real(single), dimension(:), allocatable library_taus
real, dimension(:,:), allocatable c2_tsfc
Definition: ch_xfr.f90:17
real, dimension(20) emission_uncertainty_tc_liq
real, dimension(nchan, model_levels), public rtm_rad_atm_clr
Definition: rtm_support.f90:48
subroutine, public get_above_cloud_properties(pprof, wprof, sfc_lev, cloud_top_pressure, abovecloud_watervapor, status)
real optical_thickness_37_liquid
Definition: core_arrays.f90:25
integer, parameter channel_37um
real optical_thickness_1621_liquid
Definition: core_arrays.f90:26
subroutine set_cox_munk_albedo(albedo, lib_albedo)
type(failed_type), dimension(:,:), allocatable failure_metric_16
real tc_low_for_delta
subroutine set_water_path_answers(i, j, finalize_liq, finalize_ice)
subroutine, public getuncertainties(thickness, re, water_path, phase, R1R2wavelengthIdx, meas_error, surface_albedo, transmittance_w1, transmittance_w2, delta_transmittance_w1, delta_transmittance_w2, transmittance_stddev_w1, transmittance_stddev_w2, emission_pw, emission_Tc, sigma_R37_pw, uTau, uRe, uWaterPath, xpoint, ypoint)
integer(integer_onebyte), dimension(:,:), allocatable csr_flag_array
Definition: core_arrays.f90:80
real, dimension(:,:), allocatable solar_zenith_angle
Definition: core_arrays.f90:6
real(single), dimension(:,:), allocatable liquid_water_path_37
Definition: core_arrays.f90:58
real, dimension(nchan, model_levels), public rtm_cloud_prof_low
Definition: rtm_support.f90:60
logical, parameter force_water
real(single), dimension(:,:), allocatable optical_thickness_final
Definition: core_arrays.f90:34
integer scn_loop_en
real(single), dimension(:,:,:), allocatable int_surface_emissivity_water
#define max(A, B)
Definition: main_biosmap.c:61
real, dimension(:,:), allocatable c2_ice_frac
Definition: ch_xfr.f90:19
real optical_thickness_37_ice
Definition: core_arrays.f90:25
endif() set(LIBS $
Definition: CMakeLists.txt:6
real optical_thickness_liquid
Definition: core_arrays.f90:23
real, dimension(nchan, model_levels), public rtm_cloud_prof
Definition: rtm_support.f90:49
type(failed_type), dimension(:,:), allocatable failure_metric
real function, public modis_planck(platform_name, TEMP, BAND, UNITS)
real(single), dimension(:,:), allocatable liquid_water_path_1621
Definition: core_arrays.f90:59
real, dimension(:), allocatable rayleigh_liq
subroutine set_failure_answers(i, j, RSS_final, set_near)
real(single), dimension(:), allocatable ice_radii
integer *2, dimension(:,:), allocatable liquid_water_path_1621_error
Definition: core_arrays.f90:77
integer scn_loop_st
subroutine, public cloudiness_test(cloudmask, process_summary, measurement, reflectance_box, not_cloud, lowvariability_confidence_test, CSR_QA, latitude, chm, vis1km_test)
subroutine, public get_rtm_parameters(platform, surface_emissivity, view_zenith, sun_zenith, i, j, x, y)
real, dimension(20) emission_uncertainty_pw_liq
type(ancillary_type), dimension(:,:), allocatable model_info
integer, parameter band_0163
real effective_radius_37_ice
Definition: core_arrays.f90:30
logical, parameter do_csr
subroutine init_retrieval(library_taus)
integer *2, dimension(:,:), allocatable re21_liquid
Definition: core_arrays.f90:32
real, dimension(:,:,:), allocatable c2_prof_p
Definition: ch_xfr.f90:16
real, dimension(:,:), allocatable precip_water_094
real(single), dimension(:,:), allocatable cloud_top_temperature
real(single), dimension(:,:,:), allocatable surface_emissivity_land
subroutine set_drel(threshold_relative_azimuth, drel)
subroutine, public atmospheric_correction(xpoint, ypoint, iteration, meas_out, model, debug, status)
integer, dimension(set_number_of_bands), parameter set_bands
type(ancillary_type) c2_model_info
#define pi
Definition: vincenty.c:23
integer, parameter my_unit_lun
Definition: names.f90:47
real(single), dimension(:,:,:), allocatable band_measurements
real effective_radius_16_liquid
Definition: core_arrays.f90:28
real, dimension(:,:), allocatable sensor_zenith_angle
integer(integer_onebyte), dimension(:,:), allocatable ml_test_flag
Definition: core_arrays.f90:79
real(single), dimension(:,:), allocatable relative_azimuth_angle
real(single), dimension(:,:), allocatable surface_temperature
subroutine ffnet_terra(input, output)
real(single), dimension(:,:,:), allocatable int_reflectance_water
integer, parameter band_0065
real(single), dimension(:,:), allocatable optical_thickness_1621_final
Definition: core_arrays.f90:37
Definition: names.f90:1
real tc_high_for_delta
subroutine phase
Definition: phase.f:2
subroutine, public corescience(xpoint, ypoint, process, measurements, Tc_liquid, Tc_ice, debug, na_band_used, nearest_liq, nearest_ice, RSS_liq, RSS_ice, alt_ray_liq, alt_ray_ice, do_retrievals_liq, do_retrievals_ice, status)
integer *2, dimension(:,:), allocatable re21_ice
Definition: core_arrays.f90:32
subroutine, public retrieve_irw_temp(x, y, I11_meas, idx_i, idx_j, clear_rad_table, clear_trans_table, cloud_prof, irw_temp, irw_pressure, irw_height)
integer *2, dimension(:,:), allocatable effective_radius_1621_error
Definition: core_arrays.f90:76
real effective_radius_16_ice
Definition: core_arrays.f90:28
integer c2_scan
Definition: ch_xfr.f90:44
type(qualityanalysis), dimension(:,:), allocatable processing_information
integer *2, dimension(:,:), allocatable effective_radius_21_error
Definition: core_arrays.f90:67
integer, parameter band_0935
integer, parameter band_0055
real(single), dimension(:,:), allocatable liquid_water_path_16
Definition: core_arrays.f90:57
integer, parameter set_number_of_bands
real(single), dimension(:,:), allocatable abovecloud_watervapor
integer *1, dimension(:,:), allocatable c2_sfc_lvl
Definition: ch_xfr.f90:24
type(failed_type), dimension(:,:), allocatable failure_metric_37
real, dimension(20) emission_uncertainty_pw_ice
real, dimension(:,:,:), allocatable band_uncertainty
real, dimension(:,:), allocatable c2_alt_o3
Definition: ch_xfr.f90:20
real(single), dimension(:,:), allocatable optical_thickness_16_final
Definition: core_arrays.f90:35
real(single), dimension(:,:), allocatable effective_radius_16_final
Definition: core_arrays.f90:38
real, dimension(set_number_of_bands) transmittance_stddev
real, dimension(:), allocatable rayleigh_ice
subroutine, public bisectionsearch(xx, x, jlo, jhi)
real, dimension(:,:), allocatable solar_azimuth_angle
real, dimension(nchan, model_levels), public rtm_rad_atm_clr_high
Definition: rtm_support.f90:64
integer *1, dimension(:,:), allocatable cloud_height_method
subroutine, public given_p_get_t(P, model_point, T)
real, dimension(2) thermal_correction_oneway_low
real, dimension(2) thermal_correction_twoway_low
integer *2, dimension(:,:), allocatable optical_thickness_16_error
Definition: core_arrays.f90:64
real transprime_1way
subroutine ffnet_terra_land(input, output)
subroutine ffnet_aqua(input, output)
real, dimension(:,:), allocatable c2_snow_frac
Definition: ch_xfr.f90:19
real, dimension(:,:), allocatable c2_wind
Definition: ch_xfr.f90:18
subroutine, public compute_multilayer_map(platform_name, BigTransTable, measurements, cloud_phase, Baum_phase, p_ncep, mixR_ncep, t_ncep, surface, MOD06_Pc, MOD06_PW, sat_zen, sol_zen, rel_az, tau, tau1621, xpoint, ypoint, mlayer, mlayer_test)
real, dimension(set_albedo_bands) albedo_real4
integer *2, dimension(:,:), allocatable tau_ice
Definition: core_arrays.f90:32
subroutine clouddecision(platform_name, cloudmask, measurements, RSSLiq, RSSIce, optical_thickness_liquid, optical_thickness_ice, effective_radius_16_liquid, effective_radius_21_liquid, effective_radius_37_liquid, effective_radius_16_ice, effective_radius_21_ice, effective_radius_37_ice, cloud_top_temperature_1km, cloud_mask_SPI, cloudHeightMethod, ir_phase, procflag_band_used_ot, cloudsummary, debug, status, i, j)
Definition: cloud_phase.f90:27
real, dimension(:,:,:,:), allocatable transmit_correction_table
integer *2, dimension(:,:), allocatable effective_radius_37_error
Definition: core_arrays.f90:69
logical, parameter force_ice
real, dimension(:,:,:), allocatable c2_prof_t
Definition: ch_xfr.f90:15
real(single), dimension(:,:), allocatable effective_radius_1621_final
Definition: core_arrays.f90:41
subroutine remove_edge_scenes(cloudmask, CSR_results, xsize, ysize, status)
real transprime_2way
logical, parameter do_cox_munk
integer, parameter re1621
real, dimension(:,:), allocatable c2_tot_o3
Definition: ch_xfr.f90:17
integer *1, dimension(:), allocatable c2_cmp_there
Definition: ch_xfr.f90:41
subroutine compute_aod(x, y, scat_ang, corr_meas, ws, aod550)
real, dimension(20) emission_uncertainty_tc_ice
integer, parameter re16
real effective_radius_1621_liquid
Definition: core_arrays.f90:29
real(single), dimension(:,:), allocatable effective_radius_21_final
Definition: core_arrays.f90:39