<div dir="ltr">On Tue, Aug 12, 2008 at 9:05 AM, Rahul S <span dir="ltr">&lt;<a href="mailto:rahulsivan@tropmet.res.in">rahulsivan@tropmet.res.in</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sun, 10 Aug 2008 09:54:51 -0400, Arlindo da Silva wrote<br>
<div><div></div><div class="Wj3C7c">&gt; On Sun, Aug 10, 2008 at 7:02 AM, Rahul Sivan &lt;<a href="mailto:rahulsivan@tropmet.res.in">rahulsivan@tropmet.res.in</a>&gt; wrote:<br>
&gt; &gt; hello grads users.......<br>
&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; I would like to know how can I use lat as a variable in grads<br>
&gt; &gt; script. when I use lat for some numeric operations... for eg..<br>
&gt; &gt; sn = math_sin(lat), &nbsp;error message comes as &#39;Non-numeric args to numeric<br>
&gt; &gt; operation&#39;.<br>
&gt;<br>
&gt; The first point to understand is that GrADS Scripting does not provide<br>
&gt; *direct* access to GrADS data variables (those coming from files or<br>
&gt; defines), although there are ways to access specific values in these.<br>
&gt; GrADS scripting allows you to automate GrADS command line operations.<br>
&gt; For example, if you would like to pre-compute the sine(latitude), you<br>
&gt; would simply issue a define command from your gs script,<br>
&gt;<br>
&gt; &#39;define sn = sin(lat)&#39;<br>
&gt;<br>
&gt; The math_sin() function is used for computing the sine of numbers that<br>
&gt; appear in the script, say<br>
&gt;<br>
&gt; sn = math_sin(3.141516/4)<br>
&gt;<br>
&gt; &nbsp; You find useful to read this section of the User&#39;s Guide:<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://grads.iges.org/grads/gadoc/script.html" target="_blank">http://grads.iges.org/grads/gadoc/script.html</a><br>
&gt;<br>
&gt; &nbsp; &nbsp;Good Luck,<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; Arlindo<br>
&gt;<br>
&gt; --<br>
&gt; Arlindo da Silva<br>
&gt; <a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a><br>
<br>
</div></div>thankyou for the reply....<br>
<br>
&nbsp;My problem is that only...accessing variables that come from define commands into the<br>
script. some of functions that ar available in grads such as hcurl, mag etc canot be use<br>
d in script. and if we use define command and assign the value to a variable, we cannot<br>
use it in calculations in script.<br>
<br>
any solution to this problem?<br>
<br>
If I use define command in every line, problem occurs when I am time averaging my<br>
calculated parameter. the values of the parameters which I use to calcuate may be<br>
defined only the first time interval. the variation with time I canot get, I suppose.<br>
If loop may be ok...... but that is possible through scripting language only......<br>
</blockquote><div><br><br>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.&nbsp; However, people have been able to do pretty amazing with gs scripts, let&#39;s if someone else can suggest something for your problem.<br>
&nbsp;</div></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Arlindo.<br><br>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a><br>
</div>