Here is the header description in C.
Note:
fread(hrpthdr,131,1,fp); fread((char *)&hrpthdr->offset_lon,15,1,fp); fread((char *)&hrpthdr->widthmax,110,1,fp);The same holds for writing:
fwrite(hrpthdr,131,1,fp); fwrite((char *)&hrpthdr->offset_lon,15,1,fp); fwrite((char *)&hrpthdr->widthmax,110,1,fp);
#define HRPTSIGN "M2HR" // Meteor-N2
#define HRPTSIGN "MHRP" // Meteor-N1
#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) Total 18 bytes */
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 12*4=48 bytes */
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]; // 4
char satname[LENSATNAME]; // 16
char chan_tot; // 1
char filetype; // 1
short width,height; // 4 width < 2048 if zoomed
short depth; // 2
char offset_gmt,offset_sec; // 2
struct tm_sh tm_comp; // 18
KEPLER kepler; // 48
char hdr_version[ENDFLG]; // 8
short hdrlen; // 2 length of header
short x_offset,y_offset; // 4 Offset from original if zoomed
char satdir,reserve2; // 2
struct tm_sh tm_satstrt; // 18
char tm_comp_sat_vlg; // 1
char fill1; // 1 (not written!)
// end-of-part 1, 131 'real' bytes
float offset_lon; // 4
char channel[11]; // 11
char fill2; // 1 (not written!)
// end-of-part 2, 15 'real' bytes
short widthmax; // 2
float alphamax; // 4
char reserve[96]; // 96 reserved-bytes
char endhdr[ENDFLG]; // 8
// end-of-part 3, 110 'real' bytes
} HRPTHDR;
// total: 131+15+110=256 bytes