[Thread Prev][Thread Next][Index]

Re: [ferret_users] addition in ferret



Thanks Ansley for the solution. Sorry I forgot to ask in my previous email.

If I have to take the mean for the two columns (as per in my previous email attached txt file) instead of sum, I can,t do straight forward due to missing. What I tried is:

let sum = MISSING(gp1, 0) + MISSING(gp2, 0)
let mean=sum/2

bz It will give wrong mean for missing row. Any solution to this.

--
Regards,
Nitin Patil


On Tue, Aug 19, 2014 at 11:14 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi Nitin,
In Ferret, missing + variable = missing.  (This is true for all operations, and it's probably more intuitive if you think, what should be the result if you were multiplying or dividing the variables? Missing*2 = ?)

If you want to have the sum contain any values that do exist then you'll need to fill in any missing data with zero's.  Either define new variables with an IF statement like
let gp1var = if gp1  then gp1 else 0
let gp2var = if gp2  then gp2 else 0
and add those, or you could use the MISSING function to substitute 0 where either variable is missing.
let sum = MISSING(gp1, 0) + MISSING(gp2, 0)

Ansley


On 8/19/2014 1:33 AM, Nitin Patil wrote:
Dear ferret users,

I am adding simply 2 defined variables in my script (attached) but it is not doing addition, any idea (output is also attached).

It is not accepting "...." in output file in one of the column for addition.
--
Regards,
Nitin Patil



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

Privacy Policy | Disclaimer | Accessibility Statement