I have a file that has a .assoc ending, and is apparently a 'binary associated file', though I can find no information on files of that sort online. It is read by fortran and idl, is 49Mb, and I'm trying to read it into python. This is probably too much of an open question, but could anyone suggest a way to probe the file's structure to get some idea of how I could read it?
I know that the file is a map, presumably 2D, of elevations on Mars. And it has a short ascii header:
7200 3600 MOLA .05 dg/px topo 5/2002
---------------------------------------------------------
header length 14400 bytes
map X size 7200
map Y size 3600
no-data value 30303
maximum value 21197
minimum value -8204
The map is stored as an INT array with X as
longitude and Y as latitude. The map is assumed to be
global in coverage.
---------------------------------------------------------
Sorry for the ill-formed question, but general advice on how to probe an unknown file type would be much appreciated. Or if you know of this file type then that would be even better!
Here is a snippet of the idl code that reads the file:
ELMAP='elevmap.assoc'
OPENR, ELUN, ELMAP, /GET_LUN
B = ASSOC(ELUN,BYTARR(100)) ; assoc header
HEADER = STRING(B[0]) ; read the header
NLON = 0 ; 'fix' no. of longitudes
NLAT = 0 ; 'fix' no. of latitudes
READS,HEADER,NLON,NLAT ; read no. of lons/lats
EXG = NLON/360 ; longitude scale (pix/deg)
EYG = NLAT/180 ; latitude scale (pix/deg)
EMAP = ASSOC(ELUN,INTARR(1),14400)
A hexdump of the first 30 bytes (I did "od -H -N 30 elevmap.assoc") looks like this:
0000000 20202020 20202020 30303237 20202020
0000020 20202020 30363320 4f4d2030 0000414c
0000036
A hexdump of the first 30 bytes after the header ("od -H -j 14400 -N 30 elevmap.assoc", please let me know if I'm misunderstanding this) looks like this:
0034100 0e970e93 0ea50e9d 0ea50ea5 0ea50ea5
0034120 0ea50ea5 0ea40ea4 0ea20ea3 00000ea2
0034136