[gradsusr] opening text file data

LeeJoice, Robert N rnleejoi at nps.edu
Sat Mar 5 08:25:57 EST 2011


Jennifer,

Do you have to only output a single variable to each binary data file?  I
could see the utility of this to create line graphs within GrADS from text
data.  

Robert LeeJoice


On 2/9/11 11:27 AM, "Jennifer Adams" <jma at cola.iges.org> wrote:

> James, 
> Before GrADS can handle your data, you need to convert it from text to binary.
> Try something like this:
> 
> 'open dummy.ctl'
> file=7hA01.out.txt
> nlinesinfile=755
> i=1
> 'set gxout fwrite'
> 'set fwrite 7hA01.out.bin'
> while (i<=nlinesinfile)
>  res = read(file)
>  line2=sublin(res,2)
>  val = subwrd(line2,2)
>  'd 'val
>  i=i+1
> endwhile
> 'disable fwrite'
> 
> ...dummy.ctl looks like this:
> 
> dset foo
> options template
> undef -9.99e8
> xdef 1 linear 1 1
> ydef 1 linear 1 1
> zdef 1 linear 1 1
> tdef 755 linear 0Z01JAN1948 1mo
> vars 1
> foo 0 99 foo
> endvars
> 
> ... and your new GrADS data set looks like this:
> 
> dset ^7hA01.out.bin
> undef -9.99e8
> xdef 1 linear 1 1
> ydef 1 linear 1 1
> zdef 1 linear 1 1
> tdef 755 linear 0Z01JAN1948 1mo
> vars 1
> var 0 99 var
> endvars
> 
> 
> --Jennifer
> 
> 
> 
> On Feb 7, 2011, at 10:48 AM, James Ciarlo` wrote:
> 
>> Hi,
>> 
>> I have several text files such as the one I attached and I need to open them
>> which GrADS but I cannot understand how to do so. Can someone help me please?
>> 
>> James
>>  <7hA01.out.txt>_______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
> 
>  
> --
> Jennifer M. Adams
> IGES/COLA
> 4041 Powder Mill Road, Suite 302
> Calverton, MD 20705
> jma at cola.iges.org
> 
> 
>  
> 
> 
> 
> _______________________________________________
> 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/20110305/c6c35b9c/attachment.html 


More information about the gradsusr mailing list