if/endif use with defined variables

Eduardo Agosta Scarel eduardo.agosta at GMAIL.COM
Fri Apr 2 11:00:37 EDT 2010


Ciao Davide,

Mille grazie per il tuo aiuto.

Questa informazione era quella che me mancava per trovare la via.

Ho potuto fare quello que voleva.

Salutti.

Eduardo.


2010/4/2 Davide Sacchetti <davide.sacchetti at arpal.org>

> operators like '>' work for just numbers, not for fields ...
> I mean: 5>4 is correct, while vmerId >= 5.0 (pay attention to the
> missing 'I' in your script) is not correct: if you want to compare
> fields to numbers use maskout function.
>
> Also if vmerid is a single value field, grads thinks it is a "field": to
> retrive the value you may use "query defval vmerid" or simply "display
> vmerid" and then parse 'result' using subwrd function.
>
> hoping I could help
> Bye bye
> Davide
>
> On Fri, 2010-04-02 at 09:10 -0300, Eduardo Agosta Scarel 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
> >
>
>
> --
> Sacchetti Davide
> Centro Funzionale Meteo Idrologico di Protezione Civile della Regione
> Liguria
> ARPAL Unità Tecnica Complessa di livello Regionale
> V.le Brigare Partigiane 2 16121 Genova (I)
> tel: +39 010 6437535                    fax: +39 010 6437520
> mail: davide.sacchetti at arpal.org     web: www.meteoliguria.it
>



-- 
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/77fa12e0/attachment.html 


More information about the gradsusr mailing list