<div dir="ltr"><div><div>Hi,<br><br></div>I took a look at the fortran code in writematrix. I'm not sure exactly the problem, but that section of code is handed a 16-bit integer array to write, whereas you've provided it a formatting string for reals. Are you certain your "u" and "v" variables are of type float?<br><br><br></div>Rick</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 10, 2014 at 1:13 AM, sima sima <span dir="ltr"><<a href="mailto:simasima_64@yahoo.com" target="_blank">simasima_64@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear NCL talk<br>
<br>
I need to convert a netcdf file to text format.<br>
the netcdf file include 3d variebls in (time,latitude, longitude),<br>
here is my ncl script<br>
<br>
begin<br>
<br>
f=addfile("/home/sima/data/ECMWF_0.125_nc/<a href="http://netcdf-web224-20141210070054-17182-4152.nc" target="_blank">netcdf-web224-20141210070054-17182-4152.nc</a>","r")<br>
<br>
;print("ino mikhoone" + lst(i))<br>
<br>
u=f->u10(:,:,:)<br>
v=f->v10(:,:,:)<br>
msl=f->msl(:,:,:)<br>
times =f->time ; get all times in the file<br>
ntimes = dimsizes(times) ; number of times in the file<br>
<br>
do it=0, ntimes-1<br>
<br>
print("Time " + times(it))<br>
opt = True<br>
opt@fout = "U.txt"<br>
write_matrix (u(it,:,:), "1000f9.3", opt)<br>
<br>
opt = True<br>
opt@fout = "V.txt"<br>
write_matrix (v(it,:,:), "1000f9.3", opt)<br>
<br>
opt = True<br>
opt@fout = "MSL.txt"<br>
write_matrix (msl(it,:,:), "1000f9.3", opt)<br>
<br>
;system("echo 'tstep item layer'>> uv.txt")<br>
system("cat U.txt >> uv.txt")<br>
system("echo >> uv.txt")<br>
;system("echo 'tstep item layer'>> uv.txt")<br>
system("cat V.txt >> uv.txt")<br>
system("echo >> uv.txt")<br>
<br>
system("cat MSL.txt >> uv.txt")<br>
system("echo >> uv.txt")<br>
<br>
end do<br>
end<br>
<br>
<br>
but when I run he script I got:<br>
<br>
Copyright (C) 1995-2012 - All Rights Reserved<br>
University Corporation for Atmospheric Research<br>
NCAR Command Language Version 6.1.0-beta<br>
The use of this software is governed by a License Agreement.<br>
See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>
(0) Time 999312<br>
At line 333 of file writematrix.f (unit = 31, file = 'U.txt')<br>
Fortran runtime error: Expected REAL for item 2 in formatted transfer, got INTEGER<br>
(1000f9.3)<br>
^<br>
<br>
I always use this formating way to convert my grib. what's wrong??<br>
please help me to solve this?<br>
<br>
many thanks<br>
<span class="HOEnZb"><font color="#888888"><br>
Sima<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</font></span></blockquote></div><br></div>