Setting a missing value
How can I set a missing value over land ?
Consider the following problem: You have a global data set with values overocean and over land but currently you're only interested in quantities over theocean. Replacing all land values with a correct missing value is necessary ifyou want to use ferret transformations such as @ave.
! Use a topography dataset (for example etopo120) to define
! a ocean mask. This mask must be first interpolated onto the
! correct grid i.e.
! topography data set
set data etopo120
! file containing my_var
set data my_file
! set an explicit region for example
define region/x=100W:30E/y=10S:90N NA
! define an ocean mask
LET ocean = if rose[d=etopo120,gxy=my_var] le 0 then 1
! Note: in this IF construct the "ELSE" clause is omitted. This tells Ferret
! that those values which would satisfy the ELSE condition are undefined
! (i.e. are missing in ocean).
! define a new variable that has a missing values over land
define variable/title="var_ocean" var_ocean = ocean * my_var
! make a two dimensional plot of the values over the ocean only
! since there is now a correct missing value over land you can make a plot
! showing the averaged over the ocean only. i.e.
Contributed by Christof Appenzeller of Universitat Bern
Last modified: Nov 6,1996