12 optical_thickness_liquid, &
13 optical_thickness_ice, &
14 effective_radius_16_liquid, &
15 effective_radius_21_liquid, &
16 effective_radius_37_liquid, &
17 effective_radius_16_ice, &
18 effective_radius_21_ice, &
19 effective_radius_37_ice, &
20 cloud_top_temperature_1km, &
24 procflag_band_used_ot, &
49 character*(*),
intent(in) :: platform_name
50 logical,
intent(in) :: debug
54 real,
intent(in) :: measurements(:), cloud_top_temperature_1km, cloud_mask_SPI
55 real,
intent(in) :: RSSLiq(4), RSSIce(4)
56 integer,
intent(out) :: status
57 integer,
intent(in) :: i, j
58 integer*1,
intent(in) :: procflag_band_used_ot,cloudHeightMethod
60 real :: band_8_11_difference, xdimension, &
61 threshold_1, threshold_2, threshold_3, &
62 threshold_4, bright_temp_11, bright_temp_85, &
63 water_particle_threshold, ice_particle_threshold
64 logical :: decision_made
66 integer :: modis_c6_phase
67 real :: Re_threshold_01(3), Re_threshold_02(3)
68 real :: Tab_Water_Cloud_Effective_Radius(3), Tab_Ice_Cloud_Effective_Radius(3)
70 real :: optical_thickness_liquid, optical_thickness_ice
71 real :: effective_radius_16_liquid, effective_radius_21_liquid
72 real :: effective_radius_37_liquid, effective_radius_16_ice
73 real :: effective_radius_21_ice, effective_radius_37_ice
75 logical :: ice_re_16_retrieval_failed, ice_re_21_retrieval_failed, ice_re_37_retrieval_failed
76 logical :: liq_re_16_retrieval_failed, liq_re_21_retrieval_failed, liq_re_37_retrieval_failed
77 logical :: Optical_Thickness_Ice_failed
78 logical :: band06_reflectance_measurement_failed
80 logical :: ASL_16, ASL_21, ASL_37
81 real :: min_liq_re, max_ice_re
84 decision_made = .false.
89 cloudsummary%cloudmask_determined = .true.
90 cloudsummary%cloudobserved = .false.
91 cloudsummary%watercloud = .false.
92 cloudsummary%icecloud = .false.
93 cloudsummary%unknowncloud = .false.
98 if (.not. cloudmask%cloudmask_determined)
then
99 cloudsummary%cloudmask_determined = .false.
100 decision_made = .true.
104 if (cloudmask%night == 1)
then
105 decision_made = .true.
114 if (cloudmask%confident_cloudy .or. cloudmask%probablyclear_66 )
then
116 cloudsummary%cloudobserved = .true.
123 if ( cloud_mask_spi < 30.0 )
then
125 re_threshold_01(1) = 30.0
126 re_threshold_02(1) = 20.0
128 re_threshold_01(2) = 30.0
129 re_threshold_02(2) = 20.0
131 re_threshold_01(3) = 25.0
132 re_threshold_02(3) = 15.0
137 re_threshold_01(1) = 90.0
138 re_threshold_02(1) = 20.0
140 re_threshold_01(2) = 90.0
141 re_threshold_02(2) = 20.0
143 re_threshold_01(3) = 90.0
144 re_threshold_02(3) = 15.0
153 tab_water_cloud_effective_radius(1) = effective_radius_16_liquid
154 tab_water_cloud_effective_radius(2) = effective_radius_21_liquid
155 tab_water_cloud_effective_radius(3) = effective_radius_37_liquid
157 tab_ice_cloud_effective_radius(1) = effective_radius_16_ice
158 tab_ice_cloud_effective_radius(2) = effective_radius_21_ice
159 tab_ice_cloud_effective_radius(3) = effective_radius_37_ice
163 ice_re_16_retrieval_failed = .true.
164 ice_re_21_retrieval_failed = .true.
165 ice_re_37_retrieval_failed = .true.
167 liq_re_16_retrieval_failed = .true.
168 liq_re_21_retrieval_failed = .true.
169 liq_re_37_retrieval_failed = .true.
175 optical_thickness_ice_failed = .true.
177 band06_reflectance_measurement_failed = .true.
179 if ( optical_thickness_ice > 0.0 ) optical_thickness_ice_failed = .false.
181 if ( measurements(4) > 0.0 ) band06_reflectance_measurement_failed = .false.
183 if ( rssliq(1) > 0.0 .and. rssice(1) > 0.0 ) asl_16 = .true.
184 if ( rssliq(2) > 0.0 .and. rssice(2) > 0.0 ) asl_21 = .true.
186 rssice(3) > 0.0 ) asl_37 = .true.
189 if ( rssice(1) < 0 )
then
190 if ( tab_ice_cloud_effective_radius(1) > 0.0 ) ice_re_16_retrieval_failed = .false.
193 if ( rssice(2) < 0 )
then
194 if ( tab_ice_cloud_effective_radius(2) > 0.0 ) ice_re_21_retrieval_failed = .false.
197 if ( rssice(3) < 0 )
then
198 if ( tab_ice_cloud_effective_radius(3) > 0.0 ) ice_re_37_retrieval_failed = .false.
201 if ( rssliq(1) < 0 )
then
202 if ( tab_water_cloud_effective_radius(1) > 0.0 ) liq_re_16_retrieval_failed = .false.
205 if ( rssliq(2) < 0 )
then
206 if ( tab_water_cloud_effective_radius(2) > 0.0 ) liq_re_21_retrieval_failed = .false.
209 if ( rssliq(3) < 0 )
then
210 if ( tab_water_cloud_effective_radius(3) > 0.0 ) liq_re_37_retrieval_failed = .false.
216 if ( ir_phase%watercloud == 1 ) modis_c6_phase = modis_c6_phase + 1
217 if ( ir_phase%icecloud == 1) modis_c6_phase = modis_c6_phase - 1
221 if (procflag_band_used_ot == 3 .and. optical_thickness_liquid < 3.0d0 )
then
225 if ( measurements(
band_0163)/measurements(
band_0124) < 0.45 ) modis_c6_phase = modis_c6_phase - 1
226 if ( measurements(
band_0163)/measurements(
band_0124) > 0.70 ) modis_c6_phase = modis_c6_phase + 1
233 if ( tab_water_cloud_effective_radius(1) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 1
234 if ( tab_ice_cloud_effective_radius(1) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 1
238 if ( .not. ice_re_16_retrieval_failed .and. tab_ice_cloud_effective_radius(1) .gt. re_threshold_01(1) ) &
239 modis_c6_phase = modis_c6_phase - 1
240 if ( .not. ice_re_16_retrieval_failed .and. tab_ice_cloud_effective_radius(1) < re_threshold_02(1) ) &
241 modis_c6_phase = modis_c6_phase + 1
242 if ( ice_re_16_retrieval_failed .and. .not. liq_re_16_retrieval_failed ) modis_c6_phase = modis_c6_phase + 1
249 if ( procflag_band_used_ot == 3 .and. optical_thickness_liquid < 3.0d0 )
then
253 if( measurements(
band_0163) < 0.0d0 )
then
254 if ( measurements(
band_0213)/measurements(
band_0124) < 0.20 ) modis_c6_phase = modis_c6_phase - 2
255 if ( measurements(
band_0213)/measurements(
band_0124) > 0.45 ) modis_c6_phase = modis_c6_phase + 2
257 if ( measurements(
band_0213)/measurements(
band_0124) < 0.20 ) modis_c6_phase = modis_c6_phase - 1
258 if ( measurements(
band_0213)/measurements(
band_0124) > 0.45 ) modis_c6_phase = modis_c6_phase + 1
267 if ( band06_reflectance_measurement_failed )
then
269 if ( tab_water_cloud_effective_radius(2) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 2
270 if ( tab_ice_cloud_effective_radius(2) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 2
274 if ( tab_water_cloud_effective_radius(2) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 1
275 if ( tab_ice_cloud_effective_radius(2) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 1
281 if ( .not. ice_re_21_retrieval_failed .and. tab_ice_cloud_effective_radius(2) > re_threshold_01(2) )
then
282 if ( band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase - 2
283 if ( .not. band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase - 1
286 if( .not. ice_re_21_retrieval_failed .and. tab_ice_cloud_effective_radius(2) < re_threshold_02(2) )
then
287 if ( band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 2
288 if ( .not. band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 1
291 if( ice_re_21_retrieval_failed .and. .not. liq_re_21_retrieval_failed )
then
292 if ( band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 2
293 if ( .not. band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 1
301 if (procflag_band_used_ot /= 3 .or. (procflag_band_used_ot == 3 .and. optical_thickness_liquid >= 3.0d0 ))
then
305 if ( tab_water_cloud_effective_radius(3) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 1
306 if ( tab_ice_cloud_effective_radius(3) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 1
309 if ( .not. ice_re_37_retrieval_failed .and. tab_ice_cloud_effective_radius(3) > re_threshold_01(3) ) &
310 modis_c6_phase = modis_c6_phase - 1
311 if ( .not. ice_re_37_retrieval_failed .and. tab_ice_cloud_effective_radius(3) < re_threshold_02(3) ) &
312 modis_c6_phase = modis_c6_phase + 1
313 if ( ice_re_37_retrieval_failed .and. .not. liq_re_37_retrieval_failed ) modis_c6_phase = modis_c6_phase + 1
320 if ( cloud_top_temperature_1km < 240.0 )
then
321 if ( cloud_top_temperature_1km > 0.0 )
then
322 modis_c6_phase = modis_c6_phase - 1
326 if ( optical_thickness_liquid > 2.0d0 )
then
327 if ( cloud_top_temperature_1km >= 270.0 )
then
328 modis_c6_phase = modis_c6_phase + 20
330 if ( cloud_top_temperature_1km > 260.0 .and. cloud_top_temperature_1km < 270.0 )
then
331 modis_c6_phase = modis_c6_phase + 3
334 if ( cloud_top_temperature_1km >= 270.0 )
then
335 modis_c6_phase = modis_c6_phase + 3
337 if ( cloud_top_temperature_1km > 260.0 .and. cloud_top_temperature_1km < 270.0 )
then
338 modis_c6_phase = modis_c6_phase + 2
346 if ( .not. optical_thickness_ice_failed .and. optical_thickness_ice < 2.0 )
then
347 if ( cloudmask%test_high_138==1 .and. cloudmask%applied_highcloud138==1) modis_c6_phase = modis_c6_phase - 1
353 if (modis_c6_phase ==0 .or. modis_c6_phase == 1 .and. cloud_top_temperature_1km > 0.0)
then
355 if (optical_thickness_ice <= 40)
then
357 if (ir_phase%icecloud == 1 .and. cloud_top_temperature_1km < 240.0 .and. cloudheightmethod < 3) &
358 modis_c6_phase = modis_c6_phase - 20
361 if (ir_phase%icecloud == 1 .or. (cloud_top_temperature_1km < 240.0 .and. cloudheightmethod < 3)) &
362 modis_c6_phase = modis_c6_phase - 20
369 if ( modis_c6_phase > 0 ) cloudsummary%watercloud = .true.
370 if ( modis_c6_phase < 0 ) cloudsummary%icecloud = .true.
371 if ( modis_c6_phase == 0 ) cloudsummary%unknowncloud = .true.
381 decision_made = .true.