[Thread Prev][Thread Next][Index]

Reading binary files



Hi,

I am trying to read a direct access binary file that has 141 records(1
header record) of 10108 bytes each.  Each data record (latitudinal row)
has a series of grid intersection points of 28 bytes in length.  These
28 byte blocks (360 blocks) consist of different variables of different
lengths (I2 and I1) and some spare bytes.  At the end of each data
record, there is a 28-byte row identifier.  I am not sure how to skip
some of the variables and the spare bytes.  I am using the following:

DEFINE AXIS/X=1:360:1 x1
DEFINE AXIS/Y=1:140:1 y1
DEFINE GRID/X=x1/Y=y1 gx1y1
FILE/FORMAT=stream/SKIP=2527/GRID=gx1y1/TYPE=I2,I2,I1,I2,I1/VAR=VAR1,
VAR2, VAR3, VAR4, VAR5 myfile.dat

The Type command doesn't let me read more than 5 variable.  Also,
defining the grid means, ferret is assuming the format is:
Header (2527 words)
50400(360x140) values of VAR1
50400 values of VAR2
.
.
50400 values of VARn
While the format is:
Header (2527 words)
1st value of VAR1
1st value of VAR2
.
.
1st value of VARn
2nd value of VAR1
.
.
2nd value of VARn
.
.
.
50400th value of VARn

Is there any way I can randomly skip bytes and read different length
variables?

Thanks,
Sushma Gupta



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement