;The function meanbadval2 finds the mean of a collection of points excluding ;any points with a chosen bad value. ;Use is as follows: ; m=meanbadval(variable,badval) ;Where ; input | variable = a vector to be averaged excluding badval ; | badval = the value of points to be excluded from average ; ; output | m = the average of variable excluding badval ; ;Note: If there are no good points the average is returned as -999. ; meanbadval.pro is similar to this function but assumes badval=-999. ; ;Written by BWBerger 1999(?) function meanbadval2,variable,badval g=where(variable ne badval,gc) if gc ge 1 then begin if gc ge 2 then begin mn=mean(variable(g)) endif else begin mn=variable(g) print,'Only one good val for meanbadval2. mn=variable(g).' endelse endif else begin mn=-999. print,'No good vals for meanbadval2. mn=-999.' endelse return,mn end