Thank you very much this worked!<br><br><div class="gmail_quote">On Fri, Apr 27, 2012 at 6:14 PM, Hui Wang <span dir="ltr"><<a href="mailto:hui.wang@noaa.gov" target="_blank">hui.wang@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<u></u>
<div text="#000000" bgcolor="#ffffff">
Tom,<br>
<br>
You may try the following fortran codes,<br>
<br>
real chi(nx,ny,nt)<br>
<br>
open(29,file='CHI.2000.summer.dat',access='direct',<br>
1 form='unformatted',recl=nx*ny*4)<br>
<br>
do it=1,nt<br>
read(29, rec=it) ((chi(i,j,it),i=1,nx),j=1,ny)<br>
end do<br>
<br>
For recl, it may be just "nx*ny", depending on the computer you are
using.<br>
<br>
Good luck,<br>
Hui<div><div class="h5"><br>
<br>
On 4/27/2012 8:56 PM, Thomas Robinson wrote:
</div></div><blockquote type="cite"><div><div class="h5">Aloha, <br>
<br>
I used fwrite to write out a 2d variable that varies in time, so
it has dimensions of x,y,t.<br clear="all">
<br>
nt=763<br>
'set fwrite -le -sq -cl CHI.2000.summer.dat'<br>
'set gxout fwrite'<br>
day = 360<br>
while (day <= nt)<br>
'set t ' day<br>
'd chi'<br>
day=day+1<br>
endwhile<br>
'disable fwrite'<br>
<br>
This seems to work fine. When I go to try to open it using
FORTRAN, I get an error.<br>
<br>
real chi (nx,ny,nt)<br>
open (29, file="CHI.2000.summer.dat", status="OLD", <br>
& access="sequential",form="unformatted")<br>
read(29)chi<br>
<br>
If I have my chi variable as (nx,ny) there is no problem. If I
just set nt=2, then there is a problem when I run the program:<br>
PGFIO-F-219/unformatted read/unit=29/attempt to read/write past
end of record.<br>
File name = CHI.2000.summer.dat unformatted, sequential
access record = 1<br>
In source file avg_chi.f, at line number 25<br>
<br>
<br>
I was feeling saucey and tried to change the code up adding <br>
real chi_temp(nx,ny)<br>
and I tried this:<br>
do 50 it=1,nt<br>
write (6,*)it<br>
read (29)chi_temp<br>
do 51 ix=1,nx<br>
do 52 iy=1,ny<br>
chi(ix,iy,it)=chi_temp(ix,iy)<br>
52 continue<br>
51 continue<br>
50 continue<br>
<br>
And this is what happened:<br>
1<br>
2<br>
3<br>
4<br>
PGFIO-F-217/unformatted read/unit=29/attempt to read past end of
file.<br>
File name = CHI.2000.summer.dat unformatted, sequential
access record = 4<br>
In source file avg_chi.f, at line number 29<br>
<br>
I should have about 300 time steps. Is there a limit or
something? Any help you could provide would be very much
appreciated!<br>
<br>
-- <br>
Tom Robinson<br>
At-Large Graduate Student Organization Representative<br>
Student Caucus Representative for the Graduate Student
Organization<br>
Graduate Student - Department of Meteorology<br>
<a href="tel:732-718-2323" value="+17327182323" target="_blank">732-718-2323</a><br>
<br>
</div></div><pre><fieldset></fieldset>
_______________________________________________
gradsusr mailing list
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a>
</pre>
</blockquote>
</div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Tom Robinson<br>At-Large Graduate Student Organization Representative<br>Student Caucus Representative for the Graduate Student Organization<br>Graduate Student - Department of Meteorology<br>
732-718-2323<br><br>