Here is the header description in C.
Note:
fread(hrpthdr,131,1,fp); fread((char *)&hrpthdr->offset_lon,42,1,fp); fread((char *)&hrpthdr->kr[0],105,1,fp); fread((char *)&hrpthdr->widthmax,15722,1,fp);The same holds for writing:
fwrite(hrpthdr,131,1,fp); fwrite((char *)&hrpthdr->offset_lon,42,1,fp); fwrite((char *)&hrpthdr->kr[0],105,1,fp); fwrite((char *)&hrpthdr->widthmax,15722,1,fp);
#define HRPTSIGN "HRPT"
#define CHRPTSIGN "CHRP"
#define SEAWSIGN "SEAW"
#define ENDHDR "END_HDR_"
#define CMAPLEN10B 1024
#define FRAMESTART "FRAME"
#define LENSATNAME 16
#define LENSIGN 4
#define ENDFLG 8
/* Sub-record for time, similar to "tm", but with 2-bytes shorts
(important for portability to e.g. Linux) */
struct tm_sh
{
short tm_sec,tm_min,tm_hour;
short tm_mday,tm_mon,tm_year,tm_wday,tm_yday;
short tm_isdst;
};
/* Sub-record with Kepler info */
typedef struct
{
long noradnr;
long internat;
long year;
float daynr;
float decayrate;
float inclination;
float raan;
float exentricity;
float perigee;
float anomaly;
float revs;
long rev_orbit;
} KEPLER;
The actual header of the file:
typedef struct
{
char sign[LENSIGN];
char satname[LENSATNAME];
char chan_tot;
char filetype;
short width,height; /* width < 2048 if zoomed */
short depth;
char offset_gmt,offset_sec;
struct tm_sh tm_comp; /* 48 */
KEPLER kepler;
char hdr_version[ENDFLG]; /* */
short hdrlen; /* length of header */
short x_offset,y_offset; /* Offset from original if zoomed */
char satdir,reserve2; /* */
struct tm_sh tm_satstrt;
char tm_comp_sat_vlg;
char fill1; /* See note! */
float offset_lon;
short dmin[8],dmax[8];
short ro,go,bo;
short fill2; /* See note! */
float kr[8],kg[8],kb[8]; /* linear combination of channels */
char channel[9]; /* selected channels; 0 = header recorded */
char fill3; /* See note! */
short widthmax;
float alphamax;
char r[5][CMAPLEN10B],g[5][CMAPLEN10B],b[5][CMAPLEN10B];
char reserve[348]; /* reserved-bytes */
char endhdr[ENDFLG]; /* 15786 */
} HRPTHDR;
Note: The element:
short hdrlen; /* length of header */gives the possibility to change header lengths without compability problems between vesrions of software used to record and versions used to process.
Each data frame is separated by a sub-header of 7 bytes:
F R A M E 29 36 [13865 bytes] F R A M E 29 36 [13865 bytes] ....etc. Calculation this number can be done as:
(nr_x*nr_ch + 852)*5/4If no frame header is recorded then ommit the number '852'.
Order of words are the same as how they are transmitted. So, if 3 channels are recorded:
The complete 10B format looks like:
typedef struct
{
char sign[LENSIGN];
char satname[LENSATNAME];
char chan_tot;
char filetype;
short width,height;
short depth;
char offset_gmt,offset_sec;
struct tm_sh tm_comp;
KEPLER kepler;
char hdr_version[ENDFLG];
short hdrlen;
short x_offset,y_offset;
char satdir,reserve2;
struct tm_sh tm_satstrt;
char tm_comp_sat_vlg;
char fill1; /* See note! */
float offset_lon;
short dmin[10],dmax[10];
short ro,go,bo;
short fill2; /* See note! */
float kr[10],kg[10],kb[10];
char channel[11];
char fill3; /* See note! */
short widthmax;
char fill4[2]; /* See note! */
float alphamax;
char r[5][CMAPLEN10B],g[5][CMAPLEN10B],b[5][CMAPLEN10B];
char reserve[330];
char endhdr[ENDFLG];
} CHRPTHDR;