[gradsusr] How to define a variable that is 1 if one parameter OR another parameter is in a certain range?

Stefan Gofferje stefan at saakeskus.fi
Tue Jun 18 06:04:13 EDT 2013


On 06/11/2013 06:28 PM, Goodson,Ron [Edm] wrote:
> if you have a field for which it is 1 or 0 for (cape>500) and other
> field of 1 or 0 for (li<-2) (using maskout and const) .. why not just
> add these together and if the result is > 1 ... make it = 1 ?

Works!
First I do my multiplications (AND), e.g.

'define
l1=const(const(maskout(cape255_0mb,cape255_0mb-500),1.0),0,-u)*const(const(maskout(shear01,shear01-10),1.0),0,-u)

then I add stuff, like

+const(const(maskout(hail,hail-30),1.0),0,-u)'

Finally, I set everything bigger than 1 to 1

'define level1 = const(const(maskout(l1,l1-1),1.0),0,-u))'

And the result is exactly what I wanted.

=> http://www.saakeskus.fi/180h-weather-maps/europe/europe-severe-weather

Ain't math a great thing? :D
Thanks all for the input and Ron for the solution! :)

-Stefan




More information about the gradsusr mailing list