diff --git a/modules/util/viirs_l1b_l2.py b/modules/util/viirs_l1b_l2.py index 90bea1116ab6edfb007d448bb8a7a80c82806984..203fd84398394d443a7e1fd4cbab7194bc01d471 100644 --- a/modules/util/viirs_l1b_l2.py +++ b/modules/util/viirs_l1b_l2.py @@ -85,6 +85,19 @@ def process_cld_prob(grd_k): return grd_k +def process_cld_prob_2(grd_k): + keep = np.invert(np.isnan(grd_k)) + num_keep = np.sum(keep) + keep_clr = np.where(keep, grd_k < 0.20, False) + keep_cld = np.where(keep, grd_k > 0.80, False) + frac_clr = np.sum(keep_clr)/num_keep + frac_cld = np.sum(keep_cld)/num_keep + if not (frac_clr >= 0.35 and frac_cld >= 0.35): + return None + grd_k = np.where(np.invert(keep), 0, grd_k) # Convert NaN to 0 + return grd_k + + def process_cld_opd(grd_k): keep = np.invert(np.isnan(grd_k)) num_keep = np.sum(keep)