[Thread Prev][Thread Next][Index]
Re: [ferret_users] Missing value
Hi Laurie,
Here is one way to solve it. You have to define a new
variable which contains good values if either sst1 or sst2 exists.
Use this variable in an IF condition to remove missing values from
normal addition. See the simple example below.
Please let me know if you have any problems with this method.
Regards,
Jaison
!------------example.jnl-------------------------------------------
let var1 = XSEQUENCE({26,28,30,32,34,10,38}) ! 6th value is < 21
let var2 = XSEQUENCE({27,29,31,10,35,37,39}) ! 4th value is < 21
! set < 21 as bad values
let sst1 = IF var1 GE 21 THEN var1
let sst2 = IF var2 GE 21 THEN var2
let sst0 = IF sst1 THEN sst1 ELSE sst2 ! good values if either sst1 or sst2
! exists
let tan0 = (sst1+sst2)/2
let tan = IF tan0 THEN tan0 ELSE sst0 ! replace the missing values with
! sst0
list sst1,sst2,tan0,tan
!----------end of example.jnl-----------------------------------------------
On Thu, 20 Jul 2006, Laurie C G Menviel wrote:
> 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
>
>
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement