Hi Eric,<br>Great! it did work.<br>Thanks,<br>Krishna<br><br><div class="gmail_quote">On Mon, Jul 6, 2009 at 10:42 PM, Eric Altshuler <span dir="ltr"><<a href="mailto:ela@cola.iges.org">ela@cola.iges.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello Krishna,<br>
<br>
I made a slight mistake in my reply, the script line for writing the values to the file should have single quotes around the file name:<br>
<div class="im"><br>
rc=write('temp_30m.dat',variables2)<br>
<br>
</div>I would be very surprised if this doesn't work for you, because I tested it myself and it worked fine.<br>
<font color="#888888"><br>
Eric<br>
</font><div class="im"><br>
----- Original Message -----<br>
From: "Krishna Santhanam" <<a href="mailto:ksanthanam@PRECISIONWIND.COM">ksanthanam@PRECISIONWIND.COM</a>><br>
To: <a href="mailto:GRADSUSR@LIST.CINECA.IT">GRADSUSR@LIST.CINECA.IT</a><br>
</div><div><div></div><div class="h5">Sent: Tuesday, July 7, 2009 12:12:16 AM GMT -05:00 US/Canada Eastern<br>
Subject: Re: NARR data analysis<br>
<br>
Hi Eric,<br>
It works. Thanks for the technical description, some how the "rc=write(temp.dat,variables2)" command doesn't work but "write(temp.dat,variables2) produces values.<br>
Thanks again,<br>
Krishna<br>
<br>
<br>
On Mon, Jul 6, 2009 at 7:43 PM, Eric Altshuler < <a href="mailto:ela@cola.iges.org">ela@cola.iges.org</a> > wrote:<br>
<br>
<br>
Hello Krishna,<br>
<br>
When you are displaying data that is preprojected (i.e. the grads descriptor file includes a PDEF specification), any 'display' command will produce the following message in the command window:<br>
<br>
Notice: Automatic Grid Interpolation Taking Place<br>
<br>
In a script, when you display a variable, the script variable 'result' captures the messages that grads would have sent to the command window. When the data is preprojected, the message about grid interpolation appears first. So you might have the following response to the command 'd ugrd30m':<br>
<br>
Notice: Automatic Grid Interpolation Taking Place<br>
Result value = 5.26342<br>
<br>
To retrieve the numerical value, you need to change the following line in your script:<br>
<br>
dum1=sublin(result,1)<br>
<br>
to the following:<br>
<br>
dum1=sublin(result,2)<br>
<br>
Note that this is not necessary when using non-preprojected data (i.e. the ctl file does not have a PDEF specification), because the message about grid interpolation won't be generated.<br>
<br>
You should also use the following syntax for the write function:<br>
<br>
rc=write(temp_30m.dat,variables2)<br>
<br>
instead of:<br>
<br>
<br>
write(temp_30m.dat,variables2)<br>
<br>
Although the latter syntax will write to the file successfully, it will also cause an error message "Unknown command: 0". The former syntax is the correct one to use.<br>
<br>
Best regards,<br>
<br>
Eric L. Altshuler<br>
Assistant Research Scientist<br>
Center for Ocean-Land-Atmosphere Studies<br>
4041 Powder Mill Road, Suite 302<br>
Calverton, MD 20705-3106<br>
USA<br>
<br>
E-mail: <a href="mailto:ela@cola.iges.org">ela@cola.iges.org</a><br>
Phone: (301) 902-1257<br>
Fax: (301) 595-9793<br>
<br>
<br>
<br>
<br>
----- Original Message -----<br>
From: "Krishna Santhanam" < <a href="mailto:ksanthanam@PRECISIONWIND.COM">ksanthanam@PRECISIONWIND.COM</a> ><br>
To: <a href="mailto:GRADSUSR@LIST.CINECA.IT">GRADSUSR@LIST.CINECA.IT</a><br>
Sent: Sunday, July 5, 2009 3:09:30 PM GMT -05:00 US/Canada Eastern<br>
Subject: NARR data analysis<br>
<br>
Hi all,<br>
I am trying to write u and v wind component from NARR data into a file. The<br>
text file that is written is having no value but "interpolation" . Could<br>
anyone help me how to solve this issue.<br>
By the way here is the grads script that i used<br>
____________________<br>
<br>
function main()<br>
'open narr-a_221_20010101_0000_000.ctl'<br>
cntt=1<br>
say "cntt ="cntt<br>
cntx=290<br>
while(cntx<=350)<br>
cnty=60<br>
while(cnty<=100)<br>
count=1<br>
count1=count+7<br>
while(count<=count1)<br>
'set t 'count<br>
'set x 'cntx<br>
'set y 'cnty<br>
'set z 1'<br>
'd ugrd30m.'cntt<br>
dum1=sublin(result,1)<br>
x13=subwrd(dum1,4)<br>
'd vgrd30m.'cntt<br>
dum1=sublin(result,1)<br>
x23=subwrd(dum1,4)<br>
variables2=x13' 'x23<br>
write(temp_30m.dat,variables2)<br>
count=count+1<br>
endwhile<br>
cnty=cnty+1<br>
endwhile<br>
cntx=cntx+1<br>
endwhile<br>
---------------------------------------<br>
<br>
Thanks,<br>
Krishna<br>
<br>
<br>
<br>
--<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>------------------------------------------<br>Krishnaraj Santhanam PhD<br>Project Manager,<br>Precision Wind LLC<br>Anderson Hall PSL<br>Las Cruces, NM 88003<br>
Ph: (510)3256574<br>-------------------------------------------<br>