[Thread Prev][Thread Next][Index]

Re: [ferret_users] reading FORTRAN sequential access data - simplequestion



Hi Jaison,

| 1. Sequential access files with all the data written in a single
|       stretch (as Bob wanted) should be readed in Ferret as
|       "Format=STREAM" with /SKIP=1. (Don't be annoyed, it will
|        work !!!). SKIP=1 will remove the first record information
|        then the data is exactly same as that of "Direct Access".
|        You have to specify TYPE=R4 or R8 according to your Fortran
|        program.

I may be missing something, but what's the unit of "skip"?
Is it a 4-byte word?   Otherwise, I don't understand why
your Case_2 works.  But, if the unit of "skip" is a 4-byte
word, what would you do if you want to skip the first three
bytes of your binary file, for example?


| 2. Sequential access files with data written inside the loop (as
|        in the example i suggested earlier) should be readed in
|        Ferret as "Format=UNFORMATTED". Ferret will support only
|        REAL*4 and not REAL*8 types.

I've never used "Format=UNFORMATTED", but it's very interesting.
If you write a sequential file as you do in Case_3, each
element (a real*4 number) of the array is surrounded by
a header and trailer in the file.  So, Ferret assumes this,
when given format=unformatted . . .  This is an odd thing
to do, because your file will be three times the size of the
real*4 array itself.

Regards,
Ryo

========= Quoting from Jaison's message =====================

Common to all cases
-------------------
       open(unit=10,access='sequential',form='unformatted',
      #              file='seq.bin')


case 1
------
   Fortran

       real*4 hrmean(nx,ny,nz)
       ..................
       write(10) hrmean

   Ferret

       file/skip=1/format=stream/type=R4/var=hrmean/\
                       grid=mygrid  seq.bin

case 2
------
   Fortran

       real*8 hrmean(nx,ny,nz)
       ..................
       write(10) hrmean

   Ferret

       file/skip=1/format=stream/type=R8/var=hrmean/\
                     grid=mygrid  seq.bin

case 3
------

   Fortran

       real*4 hrmean(nx,ny,nz)
       ...............
       DO k =1,nz
           Do j = 1,ny
               Do i = 1,nx
                     write(10) hrmean(i,j,k)
               ENDDO
           ENDDO
       ENDDO

   Ferret

       file/format=unformatted/type=R4/var=hrmean/\
                    grid=mygrid  seq.bin

case 4
------

   Fortran

       real*8 hrmean(nx,ny,nz)
       ...............
       DO k =1,nz
           Do j = 1,ny
               Do i = 1,nx
                     write(10) hrmean(i,j,k)
               ENDDO
           ENDDO
       ENDDO

   Ferret

       Ferret is not able to handle this dataset.


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement