Again, fwrite problem

Mark gemark at GEORGE2.AS.NTU.EDU.TW
Fri Apr 1 01:05:31 EST 2005


Dear Mr. Seman

Thank you very much for replying my question.
I just tried the method you provided.
Unfortunately, it can't work.
And the problem is same, still showing that:
forrtl: Bad file number
forrtl: severe (39): error during read, unit 21, file grads.fwrite

It is really weird.
File size is correct, including the information GrADS showed when fwrite.
Fortran77 program is correct.
GrADS ctl file is correct.
The first data (first time, first level) is correct, but everything goes
wrong after.

I doubt the problem is about wrap point, but I can't find any solution until
now.

Again, really appreciate your kindly help.

Mark Wang
PhD Candidate of National Taiwan University, Taipei, Taiwan

> Dear Mark,
> Have you tried an unformatted read, like this:
> open(21,file='grads.fwrite',status='old',form='unformatted',recl=41*32)
> do t=1,tt
> do k=1,L
>   inum=k+(t-1)*L
>   read(21,rec=inum) data2d
>   do j=1,32
>   do i=1,41
>     data(i,j,k) = data2d(i,j)
>   enddo
>   enddo
> enddo
> enddo
>
> with a defined 2D array "data2d(41,32)"?
>
> Also, you may want to try specifying the RECL in bytes... see, for
example:
> http://docs.sun.com/source/819-0491/2_io.html
> (the above web site was found using Google with search words: Fortran +
> read + recl)
>
> I hope this helps,
> Chuck
> --
>
> ********************************************************************
>  Charles Seman                                Charles.Seman at noaa.gov
>  U.S. Department of Commerce / NOAA / OAR
>  Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
>  201 Forrestal Road                              fax: (609) 987-5063
>  Princeton, NJ  08542                 http://www.gfdl.noaa.gov/~cjs/
> ********************************************************************
>
> "The contents of this message are mine personally and do not reflect
> any position of the Government or NOAA."



More information about the gradsusr mailing list