[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
Mon Jun 10 03:54:28 EDT 2013


Hi,

how would one define a variable that is 1 if one parameter OR another
parameter is in a certain range?

I have found a way of expressing "AND" by masking out values, then
const'ing them and const'ing them again, resulting in a result of 1 if
the variable is in the desired range, e.g. cape>500 and li<-2 in this
case. When I then simply multiply the 2 expressions, I get 1 if
expression 1 AND expression 2 are within the desired range and 0 (or U)
if either of them isn't.

'define tstorm =
const(const(maskout(cape255_0mb,cape255_0mb-500),1.0),0,-u)*
const(const(maskout(no4lftxsfc,(-1*no4lftxsfc)-2),1.0),0,-u)'

Now, how would I express e.g. ((cape>500 AND li<-2) OR prate>20) in a
similar way?

Ideas, anyone?

-Stefan




More information about the gradsusr mailing list