[Thread Prev][Thread Next][Index]

Question on reading binary data files



Hi, everybody,

 

I have a problem about reading unformatted binary data file written by Fortran.

That is, I have an array of 300*166*8 ( in x, y, z direction respectively) and I write it into an unformatted file:

=============================================================

Common conc(300,166,8)

…….

Open(1, file=’Myfile’, form=’unformatted’ )

         ……..

         Write(1) conc

         ……..

         End 

=============================================================

 

Then I’d like to use ferret to read in the entire data in the binary file ”Myfile”. I first just make a test. Therefore I only read in the first layer of data, and I use below commands:

 

=============================================================

    Define axis/x=1:300:1 xax

    Define axis/y=1:166:1 yax

  Define grid/x=xax/y=yax mygrid

 

    File/format=stream/skip=1/var=conc/grid=mygrid  "Myfile"

 

    List conc[x=150,y=1:166]

=============================================================

 

The result is ok. Then, I’d like to read in the whole 3 dimensional data. I use the commands below:

 

=============================================================

    Define axis/x=1:300:1 xax

Define axis/y=1:166:1 yax

Define axis/z=1:8:1   zax

  Define grid/x=xax/y=yax/z=zax  mygrid

 

    File/format=stream/skip=1/var=conc/grid=mygrid  "Myfile"

 

    List conc[x=150,y=1:166, z=1]

=============================================================

But this time, Ferret gives me the error information: “Size of file Myfile doesn’t match size specified by variables/grid list conc[x=150,y=1:166, z=1]”

Dose anybody can answer the question? Thank you in advance.

 

                                                                                                                   Peter

 

 

 

 

 

 

 

 

 


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement