[ncl-talk] read direct binary file

Zhifeng Yang yangzf01 at gmail.com
Wed Jun 10 10:38:22 MDT 2015


Hi

I am trying to read a binary file using the following statements

dim = (/1440, 720, 7, 2/)
amsre_data = fbindirread(swdir + sfilename, 0, dim, "float")

However, I got the errors as below.
fatal:fbindirread: The size implied by the dimension array and record
number is greater that the size of the file, can't continue

This is how FORTRAN read this file.
      CHARACTER(1) abuf(1440,720,7)
      real, dimension(1440,720,7,2) ::amsr_data

      OPEN(3,FILE=FILENAME,STATUS='OLD',RECL=7257600,
     1 ACCESS='DIRECT',FORM='UNFORMATTED')
      do ia=1,2
          READ(3,rec=ia) abuf
          do iv=1,7
                amsr_data(:,:,iv,ia)=real(ICHAR(abuf(:,:,iv)))
                where(amsr_data(:,:,iv,ia)<=250)

amsr_data(:,:,iv,ia)=amsr_data(:,:,iv,ia)*xscale(iv)+xoffset(iv)
                endwhere
          enddo
        enddo
        close(3)

I am not sure why the error happens. Here is the link to download data.
ftp://ftp.remss.com/amsre/bmaps_v07/y2007/m06/
The file name is like amsre_20070601v7.gz
<ftp://ftp.remss.com/amsre/bmaps_v07/y2007/m06/amsre_20070601v7.gz>


Thank you
Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150610/dc2ae6fb/attachment.html 


More information about the ncl-talk mailing list