Thanks Nick. Got the solution<br><br><div class="gmail_quote">On Wed, Sep 28, 2011 at 6:14 PM, Nick Heath <span dir="ltr"><<a href="mailto:nkh09@fsu.edu">nkh09@fsu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey,<br>
<br>
At the end of your script, after 'd avez' add this line..<br>
average=subwrd(result,4)<br>
write(test.txt,average)<br>
<br>
When you display a variable with a single value, GrADS writes the value to the terminal in a format like this<br>
Result value = xxxx<br>
So, you just have to tell it to grab the xxxx part of the output.<br>
<br>
Hope that helps!<br>
-Nick<br>
<br>
That should do it<br>
<div><div></div><div class="h5"><br>
----- Original Message -----<br>
From: Arlindo da Silva <<a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a>><br>
Date: Wednesday, September 28, 2011 12:28 pm<br>
Subject: Re: [gradsusr] How to write data in a file<br>
To: GrADS Users Forum <<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a>><br>
<br>
> On Wed, Sep 28, 2011 at 12:56 AM, sushant puranik<br>
> <<a href="mailto:sushantpuranik@gmail.com">sushantpuranik@gmail.com</a>>wrote:<br>
><br>
> > Hi<br>
> > I am trying to make average of vorticity over four points as<br>
> ><br>
> > set lev 850<br>
> > define zeta=hcurl(uwnd,vwnd.2)<br>
> > set lat 12.5<br>
> > set lon 100<br>
> > define z1=zeta<br>
> > clear<br>
> > set lat 10<br>
> > set lon 100<br>
> > define z2=zeta<br>
> > clear<br>
> > set lat 12.5<br>
> > set lon 97.5<br>
> > define z3=zeta<br>
> > clear<br>
> > set lat 10<br>
> > set lon 97.5<br>
> > define z4=zeta<br>
> > clear<br>
> > define avez=(z1+z2+z3+z4)/4<br>
> > d avez<br>
> > write (testz.txt,te)<br>
> ><br>
> ><br>
> > But the output file remains blank.<br>
> ><br>
> > whats wrong with the script?<br>
> ><br>
> ><br>
> What kind of script is this? Exec? Recall that write() is a gs script<br>
> function, not something you call from the "ga->" command line. Read<br>
</div></div>> thesection of the User's Guide on scripts:<br>
<div class="im">><br>
> <a href="http://grads.iges.org/grads/gadoc/script.html#intro" target="_blank">http://grads.iges.org/grads/gadoc/script.html#intro</a><br>
><br>
> Make sure you define the variable "te" that you are writing to the<br>
> file, and<br>
> that the file name is a string.<br>
><br>
> --<br>
> Arlindo da Silva<br>
> <a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a><br>
><br>
</div>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>सुशांत पुराणिक <br>वातावरणशास्त्र व अवकाशशास्त्र विभाग,<br>पुणे विद्यापीठ <br>पुणे-०७, महाराष्ट्र <br>भारत. <br><br><br><br>