[gradsusr] How to define a variable that is 1 if one parameter OR another parameter is in a certain range?
Goodson,Ron [Edm]
Ron.Goodson at EC.gc.ca
Tue Jun 11 16:13:43 EDT 2013
reading what I wrote .. meant to say
field of 1 or 0 for cape>500 && li <-2
field of 1 or 0 for prate > 20
.. then add the two together and if >1 (eg 1 or 2) .. use that to
simulate the OR.
but you probably figured that out ...
good luck
ron
-----Original Message-----
From: gradsusr-bounces at gradsusr.org
[mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Stefan Gofferje
Sent: June 11, 2013 1:41 PM
To: GrADS Users Forum
Subject: Re: [gradsusr] How to define a variable that is 1 if one
parameter OR another parameter is in a certain range?
Hmmm, could that be so easy? I'm going to test.
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 ?
>
> would that work.
>
>
> ron
>
>
>
> -----Original Message-----
> From: gradsusr-bounces at gradsusr.org
> [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Stefan Gofferje
> Sent: June 11, 2013 3:55 AM
> To: GrADS Users Forum
> Subject: Re: [gradsusr] How to define a variable that is 1 if one
> parameter OR another parameter is in a certain range?
>
> Hi Jeff,
>
> I thought about that but unfortunately, that doesn't work because I
> don't only plot the information. I also evaluate the parameter in
> another script to trigger actions and evaluating multiple parameter in
> that script would get pretty nesty soon.
> There must be some mathematical way to express this in a define
> expression...
>
> -Stefan
>
> On 06/10/2013 07:42 PM, Jeff Duda wrote:
>> Stefan,
>> Define two separate fields, one for each side of the disjunction.
>> Just make sure to use the same color table for both displays so that
>> in the end it appears you are displaying just one field.
>>
>> Jeff Duda
>>
>>
>> On Mon, Jun 10, 2013 at 2:54 AM, Stefan Gofferje <stefan at saakeskus.fi
>> <mailto:stefan at saakeskus.fi>> wrote:
>>
>> 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
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>>
>>
>> --
>> Jeff Duda
>> Graduate research assistant
>> University of Oklahoma School of Meteorology Center for Analysis and
>> Prediction of Storms
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr
More information about the gradsusr
mailing list