> -----------------------------
> QUESTION
> -----------------------------
> Fortran 90 has a "where" function which operates as follows:
>
> Let "x" be an array, say, x(ntim,nlat,mlon)
>
> where (x .lt. -1.8) sst = -1.8
> and/or
> where (x .gt. 35.) sst = 35.0
>
>
> What is the equivalent NCL function?
>
-----------------------------
ANSWER [2 parts]
------------------------------
Part 1:
Use NCL's selection operators "<" and ">"
[http://ngwww.ucar.edu/ngdoc/ng4.1/ref/ncl/NclExpressions.html]
x = x < -1.8 ; all values less than -1.8 are replaced with -1.8
and/or
x = x > 35. ; greater 35 35
==================================================
Part 2:
A variation
where (x .eq. -999.) x = 1.e36
this type of formulation requires NCL's "mask" function
[ http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/mask.html ].
Let x@_FillValue = 1.e36
x = mask (x, x.eq.-999, False)
Dennis Shea
shea@ucar.edu
This archive was generated by hypermail 2b29 : Thu Sep 14 2000 - 16:39:54 MDT