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.
191 if ( rssice(1) < 0 )
then
192 if ( tab_ice_cloud_effective_radius(1) > 0.0 ) ice_re_16_retrieval_failed = .false.
195 if ( rssice(2) < 0 )
then
196 if ( tab_ice_cloud_effective_radius(2) > 0.0 ) ice_re_21_retrieval_failed = .false.
199 if ( rssice(3) < 0 )
then
200 if ( tab_ice_cloud_effective_radius(3) > 0.0 ) ice_re_37_retrieval_failed = .false.
203 if ( rssliq(1) < 0 )
then
204 if ( tab_water_cloud_effective_radius(1) > 0.0 ) liq_re_16_retrieval_failed = .false.
207 if ( rssliq(2) < 0 )
then
208 if ( tab_water_cloud_effective_radius(2) > 0.0 ) liq_re_21_retrieval_failed = .false.
211 if ( rssliq(3) < 0 )
then
212 if ( tab_water_cloud_effective_radius(3) > 0.0 ) liq_re_37_retrieval_failed = .false.
218 if ( ir_phase%watercloud == 1 ) modis_c6_phase = modis_c6_phase + 1
219 if ( ir_phase%icecloud == 1) modis_c6_phase = modis_c6_phase - 1
223 if (procflag_band_used_ot == 3 .and. optical_thickness_liquid < 3.0d0 )
then
227 if ( measurements(
band_0163)/measurements(
band_0124) < 0.45 ) modis_c6_phase = modis_c6_phase - 1
228 if ( measurements(
band_0163)/measurements(
band_0124) > 0.70 ) modis_c6_phase = modis_c6_phase + 1
235 if ( tab_water_cloud_effective_radius(1) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 1
236 if ( tab_ice_cloud_effective_radius(1) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 1
240 if ( .not. ice_re_16_retrieval_failed .and. tab_ice_cloud_effective_radius(1) .gt. re_threshold_01(1) ) &
241 modis_c6_phase = modis_c6_phase - 1
242 if ( .not. ice_re_16_retrieval_failed .and. tab_ice_cloud_effective_radius(1) < re_threshold_02(1) ) &
243 modis_c6_phase = modis_c6_phase + 1
244 if ( ice_re_16_retrieval_failed .and. .not. liq_re_16_retrieval_failed ) modis_c6_phase = modis_c6_phase + 1
251 if ( procflag_band_used_ot == 3 .and. optical_thickness_liquid < 3.0d0 )
then
255 if( measurements(
band_0163) < 0.0d0 )
then
256 if ( measurements(
band_0213)/measurements(
band_0124) < 0.20 ) modis_c6_phase = modis_c6_phase - 2
257 if ( measurements(
band_0213)/measurements(
band_0124) > 0.45 ) modis_c6_phase = modis_c6_phase + 2
259 if ( measurements(
band_0213)/measurements(
band_0124) < 0.20 ) modis_c6_phase = modis_c6_phase - 1
260 if ( measurements(
band_0213)/measurements(
band_0124) > 0.45 ) modis_c6_phase = modis_c6_phase + 1
269 if ( band06_reflectance_measurement_failed )
then
271 if ( tab_water_cloud_effective_radius(2) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 2
272 if ( tab_ice_cloud_effective_radius(2) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 2
276 if ( tab_water_cloud_effective_radius(2) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 1
277 if ( tab_ice_cloud_effective_radius(2) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 1
283 if ( .not. ice_re_21_retrieval_failed .and. tab_ice_cloud_effective_radius(2) > re_threshold_01(2) )
then
284 if ( band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase - 2
285 if ( .not. band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase - 1
288 if( .not. ice_re_21_retrieval_failed .and. tab_ice_cloud_effective_radius(2) < re_threshold_02(2) )
then
289 if ( band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 2
290 if ( .not. band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 1
293 if( ice_re_21_retrieval_failed .and. .not. liq_re_21_retrieval_failed )
then
294 if ( band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 2
295 if ( .not. band06_reflectance_measurement_failed ) modis_c6_phase = modis_c6_phase + 1
303 if (procflag_band_used_ot /= 3 .or. (procflag_band_used_ot == 3 .and. optical_thickness_liquid >= 3.0d0 ))
then
307 if ( tab_water_cloud_effective_radius(3) < min_liq_re + 0.01 ) modis_c6_phase = modis_c6_phase + 1
308 if ( tab_ice_cloud_effective_radius(3) > max_ice_re - 0.01 ) modis_c6_phase = modis_c6_phase - 1
311 if ( .not. ice_re_37_retrieval_failed .and. tab_ice_cloud_effective_radius(3) > re_threshold_01(3) ) &
312 modis_c6_phase = modis_c6_phase - 1
313 if ( .not. ice_re_37_retrieval_failed .and. tab_ice_cloud_effective_radius(3) < re_threshold_02(3) ) &
314 modis_c6_phase = modis_c6_phase + 1
315 if ( ice_re_37_retrieval_failed .and. .not. liq_re_37_retrieval_failed ) modis_c6_phase = modis_c6_phase + 1
322 if ( cloud_top_temperature_1km < 240.0 )
then
323 if ( cloud_top_temperature_1km > 0.0 )
then
324 modis_c6_phase = modis_c6_phase - 1
328 if ( optical_thickness_liquid > 2.0d0 )
then
329 if ( cloud_top_temperature_1km >= 270.0 )
then
330 modis_c6_phase = modis_c6_phase + 20
332 if ( cloud_top_temperature_1km > 260.0 .and. cloud_top_temperature_1km < 270.0 )
then
333 modis_c6_phase = modis_c6_phase + 3
336 if ( cloud_top_temperature_1km >= 270.0 )
then
337 modis_c6_phase = modis_c6_phase + 3
339 if ( cloud_top_temperature_1km > 260.0 .and. cloud_top_temperature_1km < 270.0 )
then
340 modis_c6_phase = modis_c6_phase + 2
348 if ( .not. optical_thickness_ice_failed .and. optical_thickness_ice < 2.0 )
then
349 if ( cloudmask%test_high_138==1 .and. cloudmask%applied_highcloud138==1) modis_c6_phase = modis_c6_phase - 1
355 if (modis_c6_phase ==0 .or. modis_c6_phase == 1 .and. cloud_top_temperature_1km > 0.0)
then
357 if (optical_thickness_ice <= 40)
then
359 if (ir_phase%icecloud == 1 .and. cloud_top_temperature_1km < 240.0 .and. cloudheightmethod < 3) &
360 modis_c6_phase = modis_c6_phase - 20
363 if (ir_phase%icecloud == 1 .or. (cloud_top_temperature_1km < 240.0 .and. cloudheightmethod < 3)) &
364 modis_c6_phase = modis_c6_phase - 20
371 if ( modis_c6_phase > 0 ) cloudsummary%watercloud = .true.
372 if ( modis_c6_phase < 0 ) cloudsummary%icecloud = .true.
373 if ( modis_c6_phase == 0 ) cloudsummary%unknowncloud = .true.
383 decision_made = .true.