<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body 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<br>
<br>
On 4/27/2012 8:56 PM, Thomas Robinson wrote:
<blockquote
cite="mid:CABa1TPgicAvyTKbT-aXbMGfZdHnsm3Zz2c9NQAU51WrSn4-o8g@mail.gmail.com"
type="cite">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 moz-do-not-send="true" href="tel:732-718-2323"
value="+17327182323" target="_blank">732-718-2323</a><br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
gradsusr mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a>
<a class="moz-txt-link-freetext" href="http://gradsusr.org/mailman/listinfo/gradsusr">http://gradsusr.org/mailman/listinfo/gradsusr</a>
</pre>
</blockquote>
</body>
</html>