;$Id$ ;-------------------------------------------------------------------------------------------------------------------- ; use the ecm table to find cloud probabilities ; input: Ecm_Lut - a table in structure ; Sfc_Idx - ecm surface type ; Classifier_Data - a vector of classifier values ; Solzen - solar zenith angle ; Glintzen - glint zenith angle ; Tsfc - surface temperature ; Zsfc - surface elevation ; Coast - Coast Mask (0/1) ; Prior_Yes_In - input prior yes value (not from the ecm lut) ; ; output: Post_Prob_By_Class - posterior probability of yes for each classifier ; Post_Prob - posterior probability of yes from all classifiers ;-------------------------------------------------------------------------------------------------------------------- pro use_ecm_v1_5_lut, Ecm_Lut, Sfc_Idx, Classifier_Data, Solzen, Glintzen, Tsfc, Zsfc, Coast, $ Prior_Yes_In,Post_Prob_By_Class, Post_Prob ;--- initialize Missing = -999.0 Cond_Ratio = make_array(Ecm_Lut.N_Class,/Float,Value=1.0) Prior_Yes = Ecm_Lut.Prior_Prob[Sfc_Idx-1] ; Not Used if (Prior_Yes_In ne Missing) then begin Prior_Yes = Prior_Yes_In endif ;--- loop over each classifier for Class_Idx = 0, Ecm_Lut.N_Class - 1 do begin ;--- apply filters if (Classifier_Data[Class_Idx] eq Missing) then goto, cycle if (Ecm_Lut.Class_Sfc_Type_Flag[Class_Idx,Sfc_Idx-1] eq 0) then goto, cycle if (Solzen lt Ecm_Lut.Class_Solzen_Min[Class_Idx]) then goto, cycle if (Solzen gt Ecm_Lut.Class_Solzen_Max[Class_Idx]) then goto, cycle if (Glintzen lt Ecm_Lut.Class_Glintzen_Min[Class_Idx]) then goto, cycle if (Glintzen gt Ecm_Lut.Class_Glintzen_Max[Class_Idx]) then goto, cycle if (Tsfc lt Ecm_Lut.Class_Tsfc_Min[Class_Idx]) then goto, cycle if (Tsfc gt Ecm_Lut.Class_Tsfc_Max[Class_Idx]) then goto, cycle if (Zsfc lt Ecm_Lut.Class_Zsfc_Min[Class_Idx]) then goto, cycle if (Zsfc gt Ecm_Lut.Class_Zsfc_Max[Class_Idx]) then goto, cycle if (Coast lt Ecm_Lut.Class_Coast_Min[Class_Idx]) then goto, cycle if (Coast gt Ecm_Lut.Class_Coast_Max[Class_Idx]) then goto, cycle ;--- interpolate class conditional values Bin_Idx = fix((Classifier_Data[Class_Idx] - Ecm_Lut.Class_Bin_Start[Class_Idx,Sfc_Idx-1]) / $ Ecm_Lut.Class_Bin_Size[Class_Idx,Sfc_Idx-1]) Bin_Idx = max([0,min([Ecm_Lut.N_Bins-1,Bin_Idx])]) Cond_Ratio[Class_Idx] = Ecm_Lut.Class_Cond_Ratio[Bin_Idx,Class_Idx,Sfc_Idx-1] r = Cond_Ratio[Class_Idx] cycle: ;--- compute probability for this classifier r = Cond_Ratio[Class_Idx] Post_Prob_By_Class[Class_Idx] = 1.0 / (1.0 + r/Prior_Yes - r) endfor ;---- compute final probability from all classifiers r = product(Cond_Ratio) Post_Prob = 1.0 / (1.0 + r/Prior_Yes - r) ;-- constrain if (r lt 0.001) then Post_Prob = 1.0 if (r gt 99.0) then Post_Prob = 0.0 end