<div dir="ltr"><div>Jim,</div><div>Thanks very much for pointing out to me the issue of wrongly subsetting the output line. Somehow I had it in my mind that Grads takes the first line as a control character, so that the the second line is referred to as the first. I was  obviously wrong.</div><div>With your modification of my script, the error disappears, which is a very big advance, but then it writes the header (correctly) and three blank lines after.</div><div>Thanks for your assistance, though I still have the printing of blanks to sort out.<br></div><div>Zilore<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 17, 2018 at 9:22 AM James T. Potemra <<a href="mailto:jimp@hawaii.edu" target="_blank">jimp@hawaii.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Zilore,<br>
<br>
I don't think you need to subset the output by line; each of "set lon", <br>
"set lat", and "d t2" should only result in a single line of output.  <br>
Therefore you don't need the extra lines with "... = sublin(result,2)" <br>
in your script.  This is trying to read the second line of output and <br>
you only have one.  This is why you are not getting any output in the file.<br>
<br>
The "unknown command" is, I think, a result of not capturing the output <br>
of the write statement.  The following should work.<br>
<br>
---------------<br>
<br>
'open wrfout_d01_2018-12-02_00.ctl'<br>
************************<br>
'set lon 30.13'<br>
    xlon=subwrd(result,4)<br>
'set lat -1.97'<br>
    xlat=subwrd(result,4)<br>
<br>
  rc = write('wrfout_t2.txt', 'Temp at Lon. 'xlon 'Lat. 'xlat)<br>
<br>
count = 1<br>
while (count <=3)<br>
    'set t 'count<br>
    'd t2'<br>
    temp=subwrd(result,4)<br>
<br>
*Save data to file<br>
    rc = write('wrfout_t2.txt', temp, append)<br>
    count = count + 1<br>
endwhile<br>
<br>
rc = close('wrfout_t2.txt')<br>
<br>
---------------<br>
<br>
Jim<br>
<br>
On 12/16/18 8:44 PM, Zilore Mumba wrote:<br>
> I want to write data at all time steps to a file, i.e at a fixed<br>
> longitude and latitude for t=1 to t=9 for a 48 hour forecast run of<br>
> the WRF output, I want all 9 temperatures in a file at that location.<br>
> I wrote the following script<br>
><br>
> 'open wrfout_d01_2018-12-02_00.ctl'<br>
> ************************<br>
> 'set lon 30.13'<br>
>     lons=sublin(result,2)<br>
>     xlon=subwrd(lons,4)<br>
> 'set lat -1.97'<br>
>     lats=sublin(result,2)<br>
>     xlat=subwrd(lats,4)<br>
><br>
>   write('wrfout_t2.txt', 'Temp at Lon. 'xlon 'Lat. 'xlat)<br>
><br>
> count = 1<br>
> while (count <=3)<br>
>     'set t 'count<br>
>     'd t2'<br>
>     tmp=sublin(result,2)<br>
>     temp=subwrd(tmp,4)<br>
><br>
> *Save data to file<br>
>     write('wrfout_t2.txt', temp, append)<br>
>     count = count + 1<br>
> endwhile<br>
><br>
> The above script writes "Temp at Lon.  'Lat. " in the file "wrfout_t2"<br>
> as per the first write statement. Then there is no other entry in the<br>
> file, but an error on the terminal "unknown command 0". This error is<br>
> repeated 4 times<br>
> How do I go about achieving what an trying to do?<br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div>