[Thread Prev][Thread Next][Index]

RE: [ferret_users] average values excluding zeroes

Dear Nitin,

You could define a missing value (set var/bad or similar if memory serves ok) and then set your zeros to the missing value.

Or maybe you can define zero as missing value straight away.

Best wishes,



From: owner-ferret_users@xxxxxxxx [mailto:owner-ferret_users@xxxxxxxx] On Behalf Of Nitin Patil
Sent: 03 December 2014 15:13
To: ferret_users@xxxxxxxx
Subject: [ferret_users] average values excluding zeroes


Dear ferret users,


I am averaging the area of interest and I am getting the mean, standard deviation which counts zero also to get mean. How to exclude the zero in the selected area grids and get the real mean value.


Here is my script:


let xci = {77,79,79,83,83,84,84,83,83,82,82,80,80,79,79,76,76,73,73,72,72,74,74,75,75,77,77}

let yci = {27,27,25,25,24,24,21,20,20,19,18,18,17,17,16,16,15,15,15,18,21,21,23,23,24,24,24}

let ci = pt_in_poly(rf[d=1],xci, yci)

let ci_data = if ci eq 1 then ci*rf[d=1,l=18050:18171]


let temp=ci_data[x=65:95@ave,y=5:40@ave]

let sum=MISSING(temp,0)

let sum_good=IFV temp then 1 else 0

let count=sum_good

let mean=sum/count


stat mean

sh sym stat*

let varmean = ($stat_mean)

let varstd = ($stat_std)

list/norowlab/nohead/append/file=CI.txt varmean, varstd





Nitin Patil



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement