[gradsusr] How to write data in a file

sushant puranik sushantpuranik at gmail.com
Thu Sep 29 00:44:39 EDT 2011


Thanks Nick. Got the solution

On Wed, Sep 28, 2011 at 6:14 PM, Nick Heath <nkh09 at fsu.edu> wrote:

> Hey,
>
> At the end of your script, after 'd avez' add this line..
> average=subwrd(result,4)
> write(test.txt,average)
>
> When you display a variable with a single value, GrADS writes the value to
> the terminal in a format like this
> Result value = xxxx
> So, you just have to tell it to grab the xxxx part of the output.
>
> Hope that helps!
> -Nick
>
> That should do it
>
> ----- Original Message -----
> From: Arlindo da Silva <dasilva at alum.mit.edu>
> Date: Wednesday, September 28, 2011 12:28 pm
> Subject: Re: [gradsusr] How to write data in a file
> To: GrADS Users Forum <gradsusr at gradsusr.org>
>
> > On Wed, Sep 28, 2011 at 12:56 AM, sushant puranik
> > <sushantpuranik at gmail.com>wrote:
> >
> > > Hi
> > > I am trying to make average of vorticity over four points as
> > >
> > > set lev 850
> > > define zeta=hcurl(uwnd,vwnd.2)
> > > set lat 12.5
> > > set lon 100
> > > define z1=zeta
> > > clear
> > > set lat 10
> > > set lon 100
> > > define z2=zeta
> > > clear
> > > set lat 12.5
> > > set lon 97.5
> > > define z3=zeta
> > > clear
> > > set lat 10
> > > set lon 97.5
> > > define z4=zeta
> > > clear
> > > define avez=(z1+z2+z3+z4)/4
> > > d avez
> > > write (testz.txt,te)
> > >
> > >
> > > But the output file remains blank.
> > >
> > > whats wrong with the script?
> > >
> > >
> > What kind of script is this? Exec? Recall that write() is a gs script
> > function, not something you call from the "ga->" command line. Read
> > thesection of the User's Guide on scripts:
> >
> >     http://grads.iges.org/grads/gadoc/script.html#intro
> >
> > Make sure you define the variable "te" that you are writing to the
> > file, and
> > that the file name is a string.
> >
> > --
> > Arlindo da Silva
> > dasilva at alum.mit.edu
> >
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>



-- 
सुशांत पुराणिक
वातावरणशास्त्र व अवकाशशास्त्र विभाग,
पुणे विद्यापीठ
पुणे-०७, महाराष्ट्र
भारत.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110929/661c915a/attachment-0003.html 


More information about the gradsusr mailing list