Reading unformatted binary record

From: Sudipta Sarkar <ssarkar_at_nyahnyahspammersnyahnyah>
Date: Thu, 07 Dec 2006 10:53:35 -0600

Hi All,
I need some help in reading unformatted binary sequential access data
I have a series of file each of which has 12 records. Each of these
records have a 80 byte header followed by a 180x90 array of floating
point data

I have been doing the following to read as an example:

 data = fbinrecread(filename,0,-1,"byte") ; read the entire first record
into one single dimension array

head = data(0:79) ; get the header information
tdata = onedtond(byte2flt(data(80:64879)),(/180,90/)) ;get the rest of
the data, convert from byte to float and regrid to 180x90

But tdata values seems to be still in Bytes and doesnt show any floating
point values.

What am i doing wrong?

A program in Fortran for reading such files should have been like:

      REAL*4 TDATA(180,90)

      DO 10 M=1,12
      WRITE(*,*) HEAD


ncl-talk mailing list

Received on Thu Dec 07 2006 - 09:53:35 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 07 2006 - 16:52:37 MST