Binary to Ascii conversion

Diane Stokes Diane.Stokes at NOAA.GOV
Thu Feb 22 17:05:58 EST 2007


If you don't need the data in binary (which is what you have in file
yiki.dat), you can skip the "gxout fwrite" lines and use "gxout print"
instead.  Eg, in a grads script:

'set gxout print'
'set t 613 697'
'display tloop(mean(soilw,lon=95.5,lon=112.5,lat=31.5,lat=42.5))'
rc=write(yiki.txt,result)
say 'return code from write is: 'rc
rc=close(yiki.txt)
say 'return code from close is: 'rc

In the above, the output from the display command gets stored in
variable "result" and you write the contents of "result" to ascii file
yiki.txt.

See the doc for 'set prnopts' at
http://grads.iges.org/grads/gadoc/gradcomdsetprnopts.html
if you want to change the format of the text output.

    Diane


Yitbarek Kifle wrote:
> Dear all,
>
> As a new and inexperienced user of Grads,i have come with a problem of
> converting the Grads time series binary output to Ascii format.I have read
> almost all such problems on the users group list but that doesn't seem to
> help me. Here is the discription of what i did,
>
> 'set gxout fwrite'
> 'set fwrite yiki.dat'
> set t 613 697
> d tloop(mean(soilw,lon=95.5,lon=112.5,lat=31.5,lat=42.5))
> disable fwrite
>
> i have the file Yiki.dat.
>
> Would somebody please tell me what to do next in step by step basis,as I do
> not have a programming skill?
>
> thanks in advance.
>



More information about the gradsusr mailing list