[gradsusr] opening text file data
James Ciarlo`
james.ciarlo at physics.org
Fri Feb 11 09:09:00 EST 2011
Zablone,
In that case, I haven't succesfully reached that point.
I have set script.gs as:
'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'
And dummy.ctl as:
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
I opened grads and entered 'script.gs' and got this:
Warning: OPTIONS keyword "template" is used, but the
DSET entry contains no substitution templates.
And I also acquired the file 7hA01.out.bin
Then I ran the script control.gs, that is:
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
And I got this message:
Syntax Error
Error occurred on line 1
In file control.gs
I changed it to:
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
And got this:
Non-numeric args to numeric operation
Error occurred on line 2
In file control.gs
Obviously I am not doing this the proper way. How do I do this please?
On 11 February 2011 13:04, Zablone Owiti <zablonowiti at yahoo.com> wrote:
> James,
>
> You cannot open the 7hA0.out.bin file directly as you attempted. You need
> to open it via a Control file that was done by Jennifer. The control file
> is:
>
> 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
>
>
> *===================================================*
> *ZABLONE OWITI
> GRADUATE STUDENT
> Nanjing University of Information, Science and Technology
> College of Atmospheric Science
>
> Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China
> *
> Tel: +86-25-58731402
> Fax: +86-25-58731456
> *Mob. 15077895632*
> *Website: www.nuist.edu.cn
> **====================================================
> "The real art of conversation is not only to say the right thing at the
> right time, but also to leave unsaid the wrong thing at the tempting
> moment."
>
> *
>
> *From:* James Ciarlo` <james.ciarlo at physics.org>
>
> *To:* GrADS Users Forum <gradsusr at gradsusr.org>
> *Cc:*
> *Sent:* Friday, 11 February 2011 6:40 PM
>
> *Subject:* Re: [gradsusr] opening text file data
>
> Hi,
>
> sorry I took long to answer. Thank you all for your help
>
> Jennifer, I have copied the first script you wrote into a script.gs, and
> the second into a dummy.ctl
> Then I opened grads and ran script.gs and got the following error:
>
> Warning: OPTIONS keyword "template" is used, but the
> DSET entry contains no substitution templates.
>
> Then I changed the contents of dummy.ctl to the third set and ran
> script.gs and I obtained 7hA01.out.bin
> However when I tried using open with grads I got the following error
>
> ga-> open 7hA01.out.bin
> Scanning description file: 7hA01.out.bin
> Open Error: Unknown keyword in description file
> --> The invalid description file record is:
> -->
> o-ER`0Ej.Eá¦3E=E3;E;E5:E{7E¤ø1E\31Eá0Eáº+Eͼ+EÍL5E2E)<9Eu;Eׯ;Eq)<EH=EÉ2E
> û9EìY1E¤¨2E-Eq¥/E\[6Ef6Eìq9Ef¦;E)ô=E
> The data file was not opened.
>
> James
>
>
> On 9 February 2011 18:27, 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
>
>
>
>
>
>
> _______________________________________________
> 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/20110211/7dd498b7/attachment-0003.html
More information about the gradsusr
mailing list