;-------------------------------------------------------------------- ; make cloud fraction ; ; using the cloud phase which is defined as ; 0 = clear ; 1 = water ; 2 = ice ;------------------------------------------------------------------------ pro make_cld_frac_metric, phase_true, prob_cloud, cld_frac_true, cld_frac missing = -999.0 cld_frac_true = missing cld_frac = missing ;--- make input binary (0/1) masks p = prob_cloud y = phase_true ;--- make binary bin_p = p idx = where(p ne missing and finite(p) and p le 0.50,cc1) & if (cc1 gt 0) then bin_p[idx] = 0.0 idx = where(p gt 0.50,cc2) & if (cc2 gt 0) then bin_p[idx] = 1.0 idx = where(p ge 0.0,cc3) & if (cc3 gt 0) then cld_frac = mean(bin_p[idx]) ;print, "make_cld_frac_metric a ", cc1,cc2,cc3, cld_frac if (~finite(cld_frac)) then stop ;--- make binary true bin_y = y idx = where(y ne missing and finite(y) and y le 0.50,cc1) & if (cc1 gt 0) then bin_y[idx] = 0.0 idx = where(y gt 0.50,cc2) & if (cc2 gt 0) then bin_y[idx] = 1.0 idx = where(y ge 0.0,cc3) & if (cc3 gt 0) then cld_frac_true = mean(bin_y[idx]) ;print, "make_cld_frac_metric b ", cc1,cc2,cc3, cld_frac_true if (~finite(cld_frac_true)) then stop end