using lat as a varbale in script.

Arlindo da Silva dasilva at ALUM.MIT.EDU
Tue Aug 12 15:02:14 EDT 2008


On Tue, Aug 12, 2008 at 9:05 AM, Rahul S <rahulsivan at tropmet.res.in> wrote:

> On Sun, 10 Aug 2008 09:54:51 -0400, Arlindo da Silva wrote
> > On Sun, Aug 10, 2008 at 7:02 AM, Rahul Sivan <rahulsivan at tropmet.res.in>
> wrote:
> > > hello grads users.......
> > >           I would like to know how can I use lat as a variable in grads
> > > script. when I use lat for some numeric operations... for eg..
> > > sn = math_sin(lat),  error message comes as 'Non-numeric args to
> numeric
> > > operation'.
> >
> > The first point to understand is that GrADS Scripting does not provide
> > *direct* access to GrADS data variables (those coming from files or
> > defines), although there are ways to access specific values in these.
> > GrADS scripting allows you to automate GrADS command line operations.
> > For example, if you would like to pre-compute the sine(latitude), you
> > would simply issue a define command from your gs script,
> >
> > 'define sn = sin(lat)'
> >
> > The math_sin() function is used for computing the sine of numbers that
> > appear in the script, say
> >
> > sn = math_sin(3.141516/4)
> >
> >   You find useful to read this section of the User's Guide:
> >
> >           http://grads.iges.org/grads/gadoc/script.html
> >
> >    Good Luck,
> >
> >       Arlindo
> >
> > --
> > Arlindo da Silva
> > dasilva at alum.mit.edu
>
> thankyou for the reply....
>
>  My problem is that only...accessing variables that come from define
> commands into the
> script. some of functions that ar available in grads such as hcurl, mag etc
> canot be use
> d in script. and if we use define command and assign the value to a
> variable, we cannot
> use it in calculations in script.
>
> any solution to this problem?
>
> If I use define command in every line, problem occurs when I am time
> averaging my
> calculated parameter. the values of the parameters which I use to calcuate
> may be
> defined only the first time interval. the variation with time I canot get,
> I suppose.
> If loop may be ok...... but that is possible through scripting language
> only......
>


GrADS is powerful for a number of things, but I am afraid that operating
directly on the gridded values is not one of these things. Personally, I
ended up switching to python/pygrads when my work takes me in this
direction.  However, people have been able to do pretty amazing with gs
scripts, let's if someone else can suggest something for your problem.

       Arlindo.

--
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20080812/159068b0/attachment.html 


More information about the gradsusr mailing list