Main Page | Class List | File List | Class Members | File Members

read_xrit.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include "xrit_swap.h"
#include "ccsds_time.h"
#include "read_xrit.h"

Defines

#define UNIX_EPOCH   4383
#define TAI2UNIX(day)   ( (day) - UNIX_EPOCH )
#define UNIX_SECONDS(unix_day, ms_of_day)   ( 86400*(unix_day) + (ms_of_day) / 1000)
#define ROW_QUALITY_RECORD_SIZE   ( sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint32_t) + 3*sizeof(uint8_t) )
#define XRIT_DECODE(_buffer, _i)

Functions

void xrit_resolution (int resolution)
void xrit_orientation (int orientation)
int read_xrit (const char *filename, uint16_t *counts, int *nsegments, xrit_header_t **xrit_header, xrit_rows_infos_t *rows_infos, MSG_Prologue *prologue, MSG_Epilogue *epilogue)
 loads a buffer with an MSG/SEVIRI radiances XRIT file reads a file containing MSG radiances 2-bytes counts and stores them in the 'counts' buffer. Only the 'filename' argument is mandatory. The other ones may be set to NULL if they are not to be used. If xrit_header is not set to NULL, it shall have to be freed by free_xrit_header

void free_xrit_header (xrit_header_t *xrit_header)
 frees the 'xrit_header' linked list returned by read_xrit

void print_xrit_header (xrit_header_t *xrit_header)
 prints each element of the 'xrit_header' linked list (useful for debugging purposes)


Define Documentation

#define ROW_QUALITY_RECORD_SIZE   ( sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint32_t) + 3*sizeof(uint8_t) )
 

#define TAI2UNIX day   )     ( (day) - UNIX_EPOCH )
 

#define UNIX_EPOCH   4383
 

#define UNIX_SECONDS unix_day,
ms_of_day   )     ( 86400*(unix_day) + (ms_of_day) / 1000)
 

#define XRIT_DECODE _buffer,
_i   ) 
 

Value:

((((_buffer[_xa[_i]] << 8) \
                                 + (_buffer[_xa[_i]+1])) & _xb[_i]) \
                                 >> _xc[_i])


Function Documentation

void free_xrit_header xrit_header_t xrit_header  ) 
 

frees the 'xrit_header' linked list returned by read_xrit

Parameters:
xrit_header a pointer to an xrit_header structure filled by read_xrit (if the xrit_header argument of read_xrit has been used)

void print_xrit_header xrit_header_t xrit_header  ) 
 

prints each element of the 'xrit_header' linked list (useful for debugging purposes)

a debugging purpose function that prints infos about headers found in an XRIT file

Parameters:
xrit_header pointer to an xrit_header structure filled by read_xrit (if the xrit_header argument of read_xrit has been used)

int read_xrit const char *  filename,
uint16_t *  counts,
int *  isegment,
xrit_header_t **  xrit_header,
xrit_rows_infos_t rows_infos,
MSG_Prologue prologue,
MSG_Epilogue epilogue
 

loads a buffer with an MSG/SEVIRI radiances XRIT file reads a file containing MSG radiances 2-bytes counts and stores them in the 'counts' buffer. Only the 'filename' argument is mandatory. The other ones may be set to NULL if they are not to be used. If xrit_header is not set to NULL, it shall have to be freed by free_xrit_header

read_xrit:

Parameters:
filename the name of the XRIT file to read
counts must be allocated by the user (with XRIT_NROWS*XRIT_NCOLUMNS*sizeof(uint16_t) bytes)
isegment a pointer to an int that will be filled with the index of segment to extract from the file (put it to NULL to extract all the segments, or set isegment to 0. Otherwise, isegment must be filled with a value between 1 and 8).
xrit_header a linked list containing the headers for each segment: give the adress to an (xrit_header_t *) object
rows_infos an xrit_rows_infos_t pointer that must be allocated by the user (or NULL if not used)
prologue a pointer to a MSG_Prologue structure that will be filled if prologue is not NULL
epilogue is a pointer to a MSG_Epilogue structure that should be filled if epilogue is not NULL. For the time being, the MSG_Epilogue structure is not implemented, so don't use this argument (set it to NULL).
Returns:
the number of processed segments on success, a negative value on failure

void xrit_orientation int  orientation  ) 
 

Parameters:
orientation may be
XRIT_NORTH_AT_TOP
the image will be written from north to south
XRIT_SOUTH_AT_TOP
it will be written from south to north
This function must be used BEFORE any call to read_xrit

void xrit_resolution int  resolution  ) 
 


Generated on Wed Oct 19 13:55:57 2005 for LibXRIT by doxygen 1.3.5