if/endif use with defined variables

Matt Alonso matt.alonso at GMAIL.COM
Fri Apr 2 08:30:38 EDT 2010


Hi Eduardo,

Forgive me if I'm addressing the wrong issue again but should your if
statement have "vmerid >= 5.0" instead of "vmerd >= 5.0"?

Also, for what it is worth, GRADSUSR at list.cineca.it is the old grad's user
list, you can find info about the new one here:

http://gradsusr.org/mailman/listinfo/gradsusr

Matt

On Fri, Apr 2, 2010 at 8:10 AM, Eduardo Agosta Scarel <
eduardo.agosta at gmail.com> wrote:

> Hello Matt and Grads' Users,
>
> you are righ and I am sorry for the mistake. I wrote a quick script as an
> example.
>
> The corrected way is:
>
> j=1
> i=0
> while (j < 31)
> 'set t 27'
> 'set lat 0'
> 'set lon 0 360'
> 'define vmerid=ave(vwnd(t='j'), lat=0, lat=10)'
> v='vmerid'
> if (vmerd >= 5.0 & vmerid <= 5.0)
>    i=i+1
> endif
> j=j+1
> endwhile
>
> Anyway that is not the problem.
> What I want to do is to evaluate every value obtained for the defined
> vmerid variable against the thresholds in order to count those cases.
>
> Thank you for your help.
>
> Eduardo.
>
>
>
> 2010/4/2 Matt Alonso <matt.alonso at gmail.com>
>
>  I might be missing something but it doesn't look like j will ever be
>> anything other than 1. Is that what you are intending to do?
>>
>> Sent from my Verizon Wireless BlackBerry
>> ------------------------------
>> *From: * Eduardo Agosta Scarel <eduardo.agosta at GMAIL.COM>
>> *Date: *Fri, 2 Apr 2010 08:50:23 -0300
>> *To: *<GRADSUSR at LIST.CINECA.IT>
>> *Subject: *if/endif use with defined variables
>>
>> Hi you all!
>>
>> I am trying to use the values obtained for a defined variable within an
>> if/endif construction, but it appears that the script does not read in fact
>> every value (which must be compared with a certain threshold).
>>
>> Any suggestion for that?
>>
>> I will much appreciate.
>>
>> Eduardo.
>>
>>
>> PS: E.g. of what I want to do: to count the numbers of days when the
>> defined variable is below or over a threshold:
>>
>> j=1
>> i=0
>> while (j < 31)
>> 'set t 27'
>> 'set lat 0'
>> 'set lon 0 360'
>> 'define vmerid=ave(vwnd(t='j'), lat=0, lat=10)'
>> v='vmerid'
>> if (vmerd >= 5.0 & vmerid <= 5.0)
>>    i=i+1
>> endif
>> enwhile
>>
>>
>>
>> --
>>
>> eduardo.agosta at conicet.gov.ar
>> eduardo_agosta at uca.edu.ar
>>
>
>
>
> --
> Eduardo Agosta Scarel
>
> eduardo.agosta at conicet.gov.ar
> eduardo_agosta at uca.edu.ar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100402/116014ec/attachment.html 


More information about the gradsusr mailing list