[Thread Prev][Thread Next][Index]

Re: [ferret_users] Missing value



Hi Laurie,
Try this:

let sst1=IF SST[d=1] LT 21 THEN (-1E+34) ELSE SST[d=1]
let sst2=IF SST[d=2] LT 21 THEN (-1E+34) ELSE SST[d=2]

set var/bad=-1E+34 sst1;set var/bad=-1E+34 sst2

let tan1 = MISSING(sst1,sst2);let tan2 = MISSING(sst2,sst1)

let tan = (tan1 + tan2)/2

It's important to set the missing value as bad so that the MISSING function can be used properly. This function replaces the missing values in sst1 with sst2 and the missing values in sst2 with sst1. Then you take the mean. The missing points will be averaging the same number, so it will come out fine. An ELIF statement could have been used here, but FERRET doesn't allow ELIF for arrays, only point values, I believe.

Steve


Quoting Laurie C G Menviel <menviel@hawaii.edu>:

HI,

I have some netcdf SST data files where some values are bad, so I have to set them as missing values:
I do:
------------------------------------------------------------
use coral198511.s04m3pfv50-sst-16b.nc.nc
use coral198512.s04m3pfv50-sst-16b.nc.nc

let sst1=IF SST[d=1] LT 21 THEN (-1E+34) ELSE SST[d=1]
let sst2=IF SST[d=2] LT 21 THEN (-1E+34) ELSE SST[d=2]

let tan=(sst1+sst2)/2
------------------------------------------------------------
The problem with this method is that if there is a missing value at a grid point for either sst1 or sst2 then there will be a missing value in tan also. Is there a method for the missing value not to add up?
i.e. if at one grid point sst1=-1E+34 then tan=sst2 (having an addition of more than 2, it would be great if this was done automatically)
Thanks
laurie






=======================================================
Stephen R. Guimond
Graduate Research Assistant
Center for Ocean-Atmospheric Prediction Studies (COAPS)
Tallahassee, FL 32304
=======================================================


----------------------------------------------------------------



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement