manages the reading of PARASOL files. More...
#include <parasolfiledata.h>
Public Member Functions | |
PARASOLFileData (const string &name, const string &mode="r") | |
~PARASOLFileData () | |
const string | get_radix () |
access to the radix of the file. The 'Radix' is the filename with leader or data indicator removed (ie the ending 'L' or 'D' character). | |
const int | get_instrument () const |
access to the instrument code. -1 if unknown | |
const int | get_level () const |
access to the product level. -1 if unknown | |
const ProcessingLine | get_processing_line () const |
access to the processing line. | |
const string | get_processing_line_string () const |
access to the processing line, using a string representation, like "ocean color", "radiation budget"... | |
const char | get_processing_line_char () const |
access to the processing line, using the PARASOL character representation, like 'O' for "ocean color", 'R' for "radiation budget"... return a space character if undefined. | |
const char | get_product () const |
access to the product code (A,B,C or space character if unknown) | |
const int | get_orbit_cycle_nb () const |
access to the orbit cycle number. -1 if unknown | |
const int | get_orbit_nb () const |
access to the orbit number of the cycle. -1 if unknown | |
const char | get_reprocessing_nb () const |
access to the reprocessing number. -1 if unknown | |
void | geolocation_to_grid (const float *lat_lon, int *grid_idx) |
get the grid indices corresponding to a point given by its (lat,lon) coordinates | |
void | geolocation_to_grid (const float lat, const float lon, int &irow, int &icol) |
get the grid indices corresponding to a point given by its (lat,lon) coordinates | |
void | grid_to_geolocation (const int igrid[2], float lat_minmax[2], float lon_minmax[2]) |
get the lat,lon extrema for a grid point if the indexes are out of the grid or not valid, lat_minmax and lon_minmax are set to -1. | |
void | grid_to_geolocation (const int igrid[2], float pos[2]) |
get the geolocation for a grid point center | |
void | grid_to_geolocation (const int igrid[2], float &lat, float &lon) |
get the geolocation for a grid point center | |
void | grid_to_geolocation (const int irow, const int icol, float &lat, float &lon) |
get the geolocation for a grid point center All indices start from 1 | |
const int | get_nrow () const |
access to the number of lines of the PARASOL grid for this product | |
const int | get_ncol (const int irow=-1) const |
access to the number of valid columns of the PARASOL grid for this product | |
const int | get_ncol (const double lat) const |
access to the number of valid columns of the PARASOL grid for this product at a given latitude | |
bool | is_earth_grid (const int irow, const int icol) const |
test if the given grid indices represent an earth pixel (is it inside the sinusoidal grid) All indices start from 1 | |
const double | get_grid_lat (const int irow) const |
return the latitude of the middle of the given row in the PARASOL grid | |
void | get_record_coord (const int irec, float &lat, float &lon) |
retrieve the coordinates of the record at index irec The output coordinates are given for the center of the pixel | |
void | idata2igrid (const int irec, int igrid[2]) |
maps a record indice to its grid coordinates | |
vector< int > | get_data_dimension (const string &var_name) |
access the size of the given parametre data | |
void * | read_count_data (void *data, const char *var_name="alt", int *start=NULL, int *edges=NULL, int rank=-1) |
fill the buffer data with the values read in the PARASOL file for the given parameter (using its index). The filled buffer has only one dimension. So, for accessing to the value of a given direction (if you have load all directions values) you must use the formula : data[ record_index*nb_directions + direction_index ], record_index and direction_index starting at 0. | |
double * | read_scaled_data (double *data, const char *var_name="alt", int *start=NULL, int *edges=NULL, int rank=-1) |
read the data and apply the scaling to it. | |
void * | read_data (void *data, const char *var_name, int *start=NULL, int *stride=NULL, int *edges=NULL, int rank=-1) |
read the data and apply a scaling to them. This method implements the interface of filedata If the read data is a physical value, it will return it as double. If the variable is a bitfield, it will return it as count (unscaled). You can used unsigned char to decode it. | |
const int | get_nb_data () |
access to the number of the data record contained in the file | |
virtual void | load_geolocation_data () |
load the sequences of lines and columns indexes | |
virtual void | free_geolocation_data () |
free the sequences of lines and columns indexes | |
void | load_v_pixel () |
load the list data pixels | |
virtual const bool | is_geolocation_data_loaded () const |
check if the lines and columns indexes have already been loaded | |
const bool | contain_data (const float &lat, const float &lon, const double &time) |
const bool | contain_data (const float &lat, const float &lon, const double &time, const double &tolerance) |
check if this file has data coincident with (lat,lon,time) | |
const bool | contain_location (const float &lat, const float &lon) |
check if this file has EVENTUALLY data coincident with (lat,lon) Actually, it only tests if (lat,lon) is contained in the data's bounding rectangle. | |
const bool | contain_location (const float &lat, const float &lon, const double &tolerance) |
check if this file has EVENTUALLY data coincident with (lat,lon) Actually, it only tests if (lat,lon) is contained in the data's bounding rectangle. | |
const bool | contain_pixel (const int *pix_idx) |
check if the parasol data contain the given pixel | |
void | get_scaling (const string &var_name, double &slope, double &offset, unsigned short &nb_bytes) |
read the calibration of a parameter, using its name | |
const EntryFormat * | get_entry_format (const string &var_name) |
retrieve the entry format for the given variable | |
void | open_data_file () |
opens the data for reading | |
void | close_data_file () |
closes the file. | |
const bool | is_data_file_opened () |
unsigned short * | get_line_data () const |
unsigned short * | get_col_data () const |
const bool | get_index (const float &lat, const float &lon, int &irec) |
retrieve the record index (from 0) that contains the (lat,lon) point. If the given point isn't contained in the file, the method will return false, and idx will be set to -1 | |
const bool | get_index (const float &lat, const float &lon, int &irec, const float colocation_tolerance) |
retrieve the record index (from 0) that contains the (lat,lon) point. If the given point isn't contained in the file, the method will return false, and idx will be set to -1 | |
const bool | get_index (const int ipix[2], int &irec) |
retrieve the record index (from 0) that contains the pixel pix_idx. If the given pixel isn't contained in the file, the method will return false, and irec will be set to -1 | |
const bool | get_index (const vector< int > &ipix, int &irec) |
maps grid coordinates to the matching record indice | |
void | igrid2idata (const int igrid[2], int &irec) |
maps grid coordinates to the matching record indice | |
void | igrid2idata (const vector< int > &igrid, int &irec) |
maps grid coordinates to the matching record indice | |
virtual void | get_vindex (vector< vector< int > > &v_index, const float &lat, const float &lon, const float colocation_tolerance) |
build the list of indices of pixels that are in colocation tolerance, sorted by increasing distance to (lat,lon) If (lat,lon) is not found or out of the colocalisation_frame, returns an empty vector | |
const float | get_nearest_point_distance (const float &lat, const float &lon, const float coloc_tolerance) |
const bool | is_file_loaded () |
check if a file (wether leader or data) is currently opened | |
void | close_file () |
close an opened file (wether leader or data) | |
void | get_pixel (const int &irec, int ipix[2]) |
read the pixel (lin,col) of the given record | |
void | print_scaling_factors () |
print out the scaling factors of all parametres | |
void | print_spatio_temp_char () |
print out the spatio temporal characteristics as set in the leader file | |
void | print_techno_param () |
print out the technological paramaters as set in the leader file | |
const double | get_record_time (const int &irec) |
access the measure time of the record irec | |
virtual void | get_pixel_coord (const vector< int > &ipix, float &lat, float &lon, double &time) |
retrieve the coordinates of a pixel using its index | |
const string | get_software_version_number () const |
accessor to the version of the software used to process the file | |
virtual void | get_viewing_directions (const vector< int > &ipix, vector< Observation > &v_obs) |
build the earth viewing directions, as a segment from satellite position to viewed pixel center. All positions are stored in Earth Center Rotating carthesian coordinates. The method used is different for L1 and L2 products (L3 nbot supported at this time), because the available parametres are different. In L1, the satellite position can directly be read in the technological parametres. In L2, it must deduced from the viewing directions For directionnal products (L1), a pixel is identified by the 3 indices : [irow, icolum, idirection]. For non directionnal ones, only [irow, icolum] is used | |
virtual bool | is_viewing_directions_data_loaded () |
test if the data requested for computing the viewing directions has been loaded | |
virtual void | load_viewing_directions_data () |
load the data requested for computing the viewing directions | |
virtual void | free_viewing_directions_data () |
free the data requested for computing the viewing directions | |
virtual void | load_pix2data_map () |
build the table that maps the gridded pixels indices to their data representation Most of time, it will be exactly the same, but for instance, in the PARASOL data, it will maps the gridded pixels indices to their matching record number | |
void | get_neighbours_coord (const int irow, const int icol, int dirow_min, int dirow_max, int dicol_min, int dicol_max, vector< int > &v_irow, vector< int > &v_icol) |
computes the list of grid coordinates of the pixels that are neighbours of [irow, icol], in the area +/- [d_irow, d_icol] All indices in this method start at 1 | |
void | get_v_icol_neighbours (const int irow, const int icol, int dicol_min, int dicol_max, vector< int > &v_icol) |
computes the list of grid coordinates of the pixels that are neighbours of [irow, icol], in the area +/- [d_irow, d_icol] All indices in this method start at 1 | |
unsigned char * | get_ndir_data () const |
accessor to the number of available directions data buffer | |
Static Public Member Functions | |
static const int | get_max_direction () |
access to the maximal number of directions that can be found in a PARASOL file | |
static const double | get_filter_view_zenith_angle (const double &view_zenith_angle_filter8, const double &relative_azimuth_angle_filter8, const double &delta_thetav_cosphi, const double &delta_thetav_sinphi, const int xj) |
compute the view zenith angle for any filter, using the parametres stored in the PARASOL L1B files This method is based on the formula given in the Appendix C of the PARASOL L1B Product Guide For PARASOL, the xj values are : -6:490P, -4:443NP, -3:1020NP, -2:565NP, 0:670P, 2:763NP, 3:765NP, 4:910NP, 6:865P | |
static const double | get_filter_relative_azimuth_angle (const double &view_zenith_angle_filter8, const double &relative_azimuth_angle_filter8, const double &delta_thetav_cosphi, const double &delta_thetav_sinphi, const int xj) |
compute the relative azimuth angle for any filter, using the parametres stored in the PARASOL L1B files This method is based on the formula given in the Appendix C of the PARASOL L1B Product Guide For PARASOL, the xj values are : -6:490P, -4:443NP, -3:1020NP, -2:565NP, 0:670P, 2:763NP, 3:765NP, 4:910NP, 6:865P | |
Static Public Attributes | |
static const int | nb_parasol_direction = 16 |
static const double | satellite_altitude = 705.e3 |
static const double | pix_sz_nadir = 6e3 |
static const double | pix_sz_max = PARASOLFileData::satellite_altitude * (tan (PARASOLFileData::max_sat_nadir_angle) - tan (PARASOLFileData::max_sat_nadir_angle - PARASOLFileData::pix_obs_nadir_angle)) |
static const double | max_sat_nadir_angle = radians (75.) |
static const double | pix_obs_nadir_angle = atan2(PARASOLFileData::pix_sz_nadir / 2., PARASOLFileData::satellite_altitude) |
static const int | nb_acq_seq_max = 130 |
static const int | nb_acq_img_max = 9 |
Protected Member Functions | |
vector< int > | get_data_dimension (const int var_idx) |
access the size of the given parametre data | |
Protected Attributes | |
PARASOLLeader * | leader |
PARASOLData * | data |
manages the reading of PARASOL files.
PARASOLFileData::PARASOLFileData | ( | const string & | name, | |
const string & | mode = "r" | |||
) |
Constructor
name | the name of the file to load. Can be either the leader filename, or the data file one. |
mode | opening mode. At this time, only "r" is allowed |
PARASOLFileData::~PARASOLFileData | ( | ) |
Destructor
References data, free_geolocation_data(), and leader.
const bool PARASOLFileData::contain_data | ( | const float & | lat, | |
const float & | lon, | |||
const double & | time | |||
) |
check if this file has data coincident with (lat,lon,time)
lat | the latitude of the event | |
lon | the longitude of the event | |
time | the time of the event. If -1., time test will be ignored |
References contain_location(), and FileData::contain_time().
const bool PARASOLFileData::contain_data | ( | const float & | lat, | |
const float & | lon, | |||
const double & | time, | |||
const double & | tolerance | |||
) | [virtual] |
check if this file has data coincident with (lat,lon,time)
lat | the latitude of the event | |
lon | the longitude of the event | |
time | the time of the event. If -1., time test will be ignored | |
tolerance | colocation tolerance. |
Implements SatelliteFileData.
References contain_location(), and FileData::contain_time().
const bool PARASOLFileData::contain_location | ( | const float & | lat, | |
const float & | lon | |||
) |
check if this file has EVENTUALLY data coincident with (lat,lon) Actually, it only tests if (lat,lon) is contained in the data's bounding rectangle.
lat | the latitude of the event | |
lon | the longitude of the event |
References contain_pixel(), and geolocation_to_grid().
Referenced by contain_data().
const bool PARASOLFileData::contain_location | ( | const float & | lat, | |
const float & | lon, | |||
const double & | tolerance | |||
) | [virtual] |
check if this file has EVENTUALLY data coincident with (lat,lon) Actually, it only tests if (lat,lon) is contained in the data's bounding rectangle.
lat | the latitude of the event | |
lon | the longitude of the event | |
tolerance | colocation tolerance. |
Implements SatelliteFileData.
References contain_pixel(), geolocation_to_grid(), and grid_to_geolocation().
const bool PARASOLFileData::contain_pixel | ( | const int * | pix_idx | ) |
check if the parasol data contain the given pixel
pix_idx | the pixel indexes {line_index,column_index} |
References get_index().
Referenced by contain_location().
void PARASOLFileData::geolocation_to_grid | ( | const float * | lat_lon, | |
int * | grid_idx | |||
) |
get the grid indices corresponding to a point given by its (lat,lon) coordinates
lat_lon | [IN] the geolocation coordinates | |
grid_idx | [OUT] the indices in the POLDER grid. Format [irow,icol]. Indices start from 1 |
Referenced by contain_location(), and get_index().
void PARASOLFileData::geolocation_to_grid | ( | const float | lat, | |
const float | lon, | |||
int & | irow, | |||
int & | icol | |||
) |
get the grid indices corresponding to a point given by its (lat,lon) coordinates
g_exception | if (lat, lon) not valid Indices start from 1 |
lat | [IN] latitude | |
lon | [IN] longitude | |
irow | [OUT] grid row indice. Starts from 1 | |
icol | [OUT] grid column indice. Starts from 1 |
References FileData::check_geolocation(), and get_ncol().
vector< int > PARASOLFileData::get_data_dimension | ( | const string & | var_name | ) |
access the size of the given parametre data
var_name | the name of the variable (also known as parametre) |
References data, get_data_dimension(), and PARASOLData::get_data_entry_index().
vector< int > PARASOLFileData::get_data_dimension | ( | const int | var_idx | ) | [protected] |
access the size of the given parametre data
var_idx | the index of the variable (also known as parametre) |
References data, and PARASOLData::get_entry_block().
Referenced by get_data_dimension().
const EntryFormat * PARASOLFileData::get_entry_format | ( | const string & | var_name | ) |
retrieve the entry format for the given variable
var_name | the name of the variable |
References data, PARASOLData::get_data_file_format(), and PARASOLDataFormat::get_entry_index().
static const double PARASOLFileData::get_filter_relative_azimuth_angle | ( | const double & | view_zenith_angle_filter8, | |
const double & | relative_azimuth_angle_filter8, | |||
const double & | delta_thetav_cosphi, | |||
const double & | delta_thetav_sinphi, | |||
const int | xj | |||
) | [inline, static] |
compute the relative azimuth angle for any filter, using the parametres stored in the PARASOL L1B files This method is based on the formula given in the Appendix C of the PARASOL L1B Product Guide For PARASOL, the xj values are : -6:490P, -4:443NP, -3:1020NP, -2:565NP, 0:670P, 2:763NP, 3:765NP, 4:910NP, 6:865P
view_zenith_angle_filter8 | the view zenith angle for filter #8 | |
relative_azimuth_angle_filter8 | the relative azimuth angle for filter #8 | |
delta_thetav_cosphi | the Theta_v*Cos_Phi relative variation of viewing geometry between the filters in degrees | |
delta_thetav_sinphi | the Theta_v*Sin_Phi relative variation of viewing geometry between the filters in degrees | |
xj | index of desired filter. See Appendix C of the PARASOL L1B Product Guide for details |
static const double PARASOLFileData::get_filter_view_zenith_angle | ( | const double & | view_zenith_angle_filter8, | |
const double & | relative_azimuth_angle_filter8, | |||
const double & | delta_thetav_cosphi, | |||
const double & | delta_thetav_sinphi, | |||
const int | xj | |||
) | [inline, static] |
compute the view zenith angle for any filter, using the parametres stored in the PARASOL L1B files This method is based on the formula given in the Appendix C of the PARASOL L1B Product Guide For PARASOL, the xj values are : -6:490P, -4:443NP, -3:1020NP, -2:565NP, 0:670P, 2:763NP, 3:765NP, 4:910NP, 6:865P
view_zenith_angle_filter8 | the view zenith angle for filter #8 | |
relative_azimuth_angle_filter8 | the relative azimuth angle for filter #8 | |
delta_thetav_cosphi | the Theta_v*Cos_Phi relative variation of viewing geometry between the filters in degrees | |
delta_thetav_sinphi | the Theta_v*Sin_Phi relative variation of viewing geometry between the filters in degrees | |
xj | index of desired filter. See Appendix C of the PARASOL L1B Product Guide for details |
const double PARASOLFileData::get_grid_lat | ( | const int | irow | ) | const |
return the latitude of the middle of the given row in the PARASOL grid
irow | the indice of the row to consider. If not given, return the maximum number of colums. Start at 1 |
Referenced by grid_to_geolocation().
const bool PARASOLFileData::get_index | ( | const float & | lat, | |
const float & | lon, | |||
int & | irec | |||
) |
retrieve the record index (from 0) that contains the (lat,lon) point. If the given point isn't contained in the file, the method will return false, and idx will be set to -1
lat | [IN] the latitude | |
lon | [IN] the longitude | |
irec | [OUT] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data |
References geolocation_to_grid().
Referenced by contain_pixel(), get_index(), get_viewing_directions(), and igrid2idata().
const bool PARASOLFileData::get_index | ( | const float & | lat, | |
const float & | lon, | |||
int & | irec, | |||
const float | colocation_tolerance | |||
) | [virtual] |
retrieve the record index (from 0) that contains the (lat,lon) point. If the given point isn't contained in the file, the method will return false, and idx will be set to -1
lat | [IN] the latitude | |
lon | [IN] the longitude | |
irec | [OUT] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data | |
tolerance | colocation tolerance. |
Implements SatelliteFileData.
References geolocation_to_grid(), get_index(), and grid_to_geolocation().
const bool PARASOLFileData::get_index | ( | const int | ipix[2], | |
int & | irec | |||
) |
retrieve the record index (from 0) that contains the pixel pix_idx. If the given pixel isn't contained in the file, the method will return false, and irec will be set to -1
ipix | [IN] the indexes (line,column) of the searched parasol pixel | |
irec | [OUT] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data |
const bool PARASOLFileData::get_index | ( | const vector< int > & | ipix, | |
int & | irec | |||
) |
maps grid coordinates to the matching record indice
igrid | [IN] 2D grid coordinates [irow, icol] | |
irec | [OUT] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data |
const int PARASOLFileData::get_instrument | ( | ) | const [inline] |
access to the instrument code. -1 if unknown
const int PARASOLFileData::get_level | ( | ) | const [inline] |
access to the product level. -1 if unknown
Referenced by PARASOLData::apply_scaling().
const int PARASOLFileData::get_max_direction | ( | ) | [static] |
access to the maximal number of directions that can be found in a PARASOL file
const int PARASOLFileData::get_nb_data | ( | ) |
access to the number of the data record contained in the file
References data, and PARASOLData::get_nb_data_record().
Referenced by load_pix2data_map().
const int PARASOLFileData::get_ncol | ( | const int | irow = -1 |
) | const |
access to the number of valid columns of the PARASOL grid for this product
irow | the indice of the row to consider. If not given, return the maximum number of colums. Start at 1 |
Referenced by geolocation_to_grid(), get_v_icol_neighbours(), grid_to_geolocation(), and is_earth_grid().
const int PARASOLFileData::get_ncol | ( | const double | lat | ) | const |
access to the number of valid columns of the PARASOL grid for this product at a given latitude
lat | a latitude |
unsigned char * PARASOLFileData::get_ndir_data | ( | ) | const |
accessor to the number of available directions data buffer
void PARASOLFileData::get_neighbours_coord | ( | const int | irow, | |
const int | icol, | |||
int | dirow_min, | |||
int | dirow_max, | |||
int | dicol_min, | |||
int | dicol_max, | |||
vector< int > & | v_irow, | |||
vector< int > & | v_icol | |||
) |
computes the list of grid coordinates of the pixels that are neighbours of [irow, icol], in the area +/- [d_irow, d_icol] All indices in this method start at 1
irow | [IN] grid row indice | |
icol | [IN] grid column indice | |
d_irow | [IN] number of neighbours pixels to consider along rows | |
d_icol | [IN] number of neighbours pixels to consider along columns | |
v_irow | [OUT] indices of the neighbour pixels along rows (sorted increasing) | |
v_icol | [OUT] indices of the neighbour pixels along columns (sorted increasing) computes the list of grid coordinates of the pixels that are neighbours of [irow, icol], in the area [d_irow, d_icol] All indices in this method start at 1. |
irow | [IN] grid row indice | |
icol | [IN] grid column indice | |
dirow_min | [IN] number of north rows to consider (<=0) | |
dirow_max | [IN] number of south rows to consider | |
dicol_min | [IN] number of east columns to consider (<=0) | |
dicol_max | [IN] number of west columns to consider | |
v_irow | [OUT] indices of the neighbour pixels along rows (sorted increasing) | |
v_icol | [OUT] indices of the neighbour pixels along columns (sorted increasing) |
References get_v_icol_neighbours().
const int PARASOLFileData::get_nrow | ( | ) | const |
access to the number of lines of the PARASOL grid for this product
const int PARASOLFileData::get_orbit_cycle_nb | ( | ) | const [inline] |
access to the orbit cycle number. -1 if unknown
const int PARASOLFileData::get_orbit_nb | ( | ) | const [inline] |
access to the orbit number of the cycle. -1 if unknown
void PARASOLFileData::get_pixel | ( | const int & | irec, | |
int | ipix[2] | |||
) |
read the pixel (lin,col) of the given record
irec | [IN] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data | |
ipix | [OUT] 2D grid coordinates [irow, icol] |
Referenced by get_record_time().
virtual void PARASOLFileData::get_pixel_coord | ( | const vector< int > & | ipix, | |
float & | lat, | |||
float & | lon, | |||
double & | time | |||
) | [inline, virtual] |
retrieve the coordinates of a pixel using its index
ipix | [IN] index of the pixel | |
lat | [OUT] latitude of the pixel | |
lon | [OUT] longitude of the pixel | |
time | [OUT] timestamp of the pixel |
Implements SatelliteFileData.
const ProcessingLine PARASOLFileData::get_processing_line | ( | ) | const [inline] |
access to the processing line.
const char PARASOLFileData::get_processing_line_char | ( | ) | const |
access to the processing line, using the PARASOL character representation, like 'O' for "ocean color", 'R' for "radiation budget"... return a space character if undefined.
Referenced by get_radix().
const string PARASOLFileData::get_processing_line_string | ( | ) | const |
access to the processing line, using a string representation, like "ocean color", "radiation budget"...
const char PARASOLFileData::get_product | ( | ) | const [inline] |
access to the product code (A,B,C or space character if unknown)
const string PARASOLFileData::get_radix | ( | ) |
access to the radix of the file. The 'Radix' is the filename with leader or data indicator removed (ie the ending 'L' or 'D' character).
References get_processing_line_char().
void PARASOLFileData::get_record_coord | ( | const int | irec, | |
float & | lat, | |||
float & | lon | |||
) |
retrieve the coordinates of the record at index irec The output coordinates are given for the center of the pixel
irec | [IN] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data | |
lat | [OUT] the latitude of the record | |
lon | [OUT] the longitude of the record |
References grid_to_geolocation(), and idata2igrid().
const double PARASOLFileData::get_record_time | ( | const int & | irec | ) | [inline] |
access the measure time of the record irec
irec | [IN] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data |
References SpatioTemporalCharacteristicsRecord::desc_node_date, get_pixel(), Date::get_TAI93_time(), grid_to_geolocation(), PARASOLLeader::is_record_loaded(), leader, and Date::set_date_str().
const char PARASOLFileData::get_reprocessing_nb | ( | ) | const [inline] |
access to the reprocessing number. -1 if unknown
void PARASOLFileData::get_scaling | ( | const string & | var_name, | |
double & | slope, | |||
double & | offset, | |||
unsigned short & | nb_bytes | |||
) |
read the calibration of a parameter, using its name
var_name | the name of the parameter | |
slope | the scaling slope | |
offset | the scaling offset | |
nb_bytes | the number of bytes used by this parameter count |
References data, and PARASOLData::get_data_entry_index().
const string PARASOLFileData::get_software_version_number | ( | ) | const [inline] |
accessor to the version of the software used to process the file
void PARASOLFileData::get_v_icol_neighbours | ( | const int | irow, | |
const int | icol, | |||
int | dicol_min, | |||
int | dicol_max, | |||
vector< int > & | v_icol | |||
) |
computes the list of grid coordinates of the pixels that are neighbours of [irow, icol], in the area +/- [d_irow, d_icol] All indices in this method start at 1
irow | [IN] grid row indice | |
icol | [IN] grid column indice | |
dicol_min | [IN] number of east columns to consider (<=0) | |
dicol_max | [IN] number of west columns to consider | |
v_icol | [OUT] a sorted list of unique columns indices, mostly [icol + dicol_min -> icol + dicol_max], but also treats the case of crossing the change date meridian |
References get_ncol().
Referenced by get_neighbours_coord().
void PARASOLFileData::get_viewing_directions | ( | const vector< int > & | ipix, | |
vector< Observation > & | v_obs | |||
) | [virtual] |
build the earth viewing directions, as a segment from satellite position to viewed pixel center. All positions are stored in Earth Center Rotating carthesian coordinates. The method used is different for L1 and L2 products (L3 nbot supported at this time), because the available parametres are different. In L1, the satellite position can directly be read in the technological parametres. In L2, it must deduced from the viewing directions For directionnal products (L1), a pixel is identified by the 3 indices : [irow, icolum, idirection]. For non directionnal ones, only [irow, icolum] is used
constucts the viewing directions observations for the given grid pixel
ipix | 2D grid indices. | |
v_obs | vector of observation(s). Can contains more than one for directional products |
Reimplemented from SatelliteFileData.
References get_index(), is_viewing_directions_data_loaded(), and g_exception::set().
virtual void PARASOLFileData::get_vindex | ( | vector< vector< int > > & | v_index, | |
const float & | lat, | |||
const float & | lon, | |||
const float | colocation_tolerance | |||
) | [inline, virtual] |
build the list of indices of pixels that are in colocation tolerance, sorted by increasing distance to (lat,lon) If (lat,lon) is not found or out of the colocalisation_frame, returns an empty vector
lat | the latitude | |
lon | the longitude | |
colocation_tolerance | the acceptable bias (in km or degrees. Supposed to be in, a plane approximation) between [lat,lon] and the nearest data point. |
Implements SatelliteFileData.
void PARASOLFileData::grid_to_geolocation | ( | const int | irow, | |
const int | icol, | |||
float & | lat, | |||
float & | lon | |||
) |
get the geolocation for a grid point center All indices start from 1
irow | grid row indice | |
icol | grid column indice | |
lat | latitude at center of grid cell | |
lon | longitude at center of grid cell |
References get_grid_lat(), and get_ncol().
void PARASOLFileData::grid_to_geolocation | ( | const int | igrid[2], | |
float & | lat, | |||
float & | lon | |||
) |
get the geolocation for a grid point center
igrid | indices in the POLDER grid (line,col). Starts at 1 | |
lat | latitude at center of grid cell | |
lon | longitude at center of grid cell |
void PARASOLFileData::grid_to_geolocation | ( | const int | igrid[2], | |
float | pos[2] | |||
) |
get the geolocation for a grid point center
igrid | indices in the POLDER grid (line,col). Starts at 1 | |
pos | (lat, lon) at center of grid cell |
void PARASOLFileData::grid_to_geolocation | ( | const int | igrid[2], | |
float | lat_minmax[2], | |||
float | lon_minmax[2] | |||
) |
get the lat,lon extrema for a grid point if the indexes are out of the grid or not valid, lat_minmax and lon_minmax are set to -1.
igrid | the indexes in the POLDER grid (line,col). Starts at 1 | |
lat_minmax | 2 elements array containing the latitude extrema. Mustn't be NULL | |
lon_minmax | 2 elements array containing the longitude extrema. Can be NULL. In this case, only lat_minmax will be computed |
Referenced by contain_location(), get_index(), get_record_coord(), and get_record_time().
void PARASOLFileData::idata2igrid | ( | const int | irec, | |
int | igrid[2] | |||
) |
maps a record indice to its grid coordinates
irec | [IN] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data | |
igrid | [OUT] 2D grid coordinates [irow, icol] |
References data, PARASOLData::get_nb_data_record(), and is_geolocation_data_loaded().
Referenced by get_record_coord().
void PARASOLFileData::igrid2idata | ( | const vector< int > & | igrid, | |
int & | irec | |||
) |
maps grid coordinates to the matching record indice
igrid | [IN] 2D grid coordinates [irow, icol] | |
irec | [OUT] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data |
References get_index().
void PARASOLFileData::igrid2idata | ( | const int | igrid[2], | |
int & | irec | |||
) |
maps grid coordinates to the matching record indice
igrid | [IN] 2D grid coordinates [irow, icol] | |
irec | [OUT] indice of the record. Be careful starts at 0 here but at 2 in the PARASOL data |
bool PARASOLFileData::is_earth_grid | ( | const int | irow, | |
const int | icol | |||
) | const |
test if the given grid indices represent an earth pixel (is it inside the sinusoidal grid) All indices start from 1
irow | grid row indice | |
icol | grid column indice |
References get_ncol().
const bool PARASOLFileData::is_file_loaded | ( | ) |
check if a file (wether leader or data) is currently opened
References data, PARASOLFileReader::is_file_loaded(), and leader.
const bool PARASOLFileData::is_geolocation_data_loaded | ( | ) | const [virtual] |
check if the lines and columns indexes have already been loaded
Reimplemented from SatelliteFileData.
Referenced by idata2igrid(), and load_geolocation_data().
void * PARASOLFileData::read_count_data | ( | void * | data, | |
const char * | var_name = "alt" , |
|||
int * | start = NULL , |
|||
int * | edges = NULL , |
|||
int | rank = -1 | |||
) |
fill the buffer data with the values read in the PARASOL file for the given parameter (using its index). The filled buffer has only one dimension. So, for accessing to the value of a given direction (if you have load all directions values) you must use the formula : data[ record_index*nb_directions + direction_index ], record_index and direction_index starting at 0.
The returned buffer is a 1D linearized array, even if the read data have 2D. To know the real dimensions, you can use the "get_data_dimension" method that will return a vector containing the real dimension of the data, and access to one value can be done as y_index*X_DIM+x_index.
Let's see a little example : reading the dqx of a L1_B file
string param="dqx"; unsigned short* bit_data=NULL; // The dqx bitfield is coded on 2 bytes. So on, use an unsigned short array to read it. Set it to NULL to delegate the buffer allocation to the read_data method // read the dimensions of the variable data : for this parametre, has 2 ones, [nb_data_record,NB_PARASOL_DIRECTIONS] vector<int> dimensions=pfd.get_data_dimension(param); int nb_data_record=dimensions[0]; int nb_viewing_directions=dimensions[1]; // read the data. The dqx is a bitfield, so use the read_count_data method : scaling is not needed (and will produce invalid data) bit_data=static_cast<unsigned short*>(pfd.read_count_data(bit_data,param.c_str())); // print out the values if (bit_data!=NULL) { if (show_val_display) { cout<<"Record\tbits"<<endl; for (int i = 0 ; i<nb_data;++i) { cout<<i; for (int j=0;j < nb_viewing_directions;++j) cout<<"\t"<<MyTools::to_bit(&bit_data[i*nb_viewing_directions+j],2); // Use the MyTools::to_bit method to print out bitfield data cout<<endl; } } } // free the buffer once used delete[] bit_data; bit_data=NULL;
data | the buffer to fill. If NULL, the method does the needed allocations | |
var_name | the variable name | |
start | the start indexes of the data to read. | |
edges | the number of data to read along each direction. | |
rank | the size of the start and edges arrays |
References data, PARASOLData::get_data_file_format(), and PARASOLDataFormat::get_entry_index().
void * PARASOLFileData::read_data | ( | void * | data, | |
const char * | var_name, | |||
int * | start = NULL , |
|||
int * | stride = NULL , |
|||
int * | edges = NULL , |
|||
int | rank = -1 | |||
) | [virtual] |
read the data and apply a scaling to them. This method implements the interface of filedata If the read data is a physical value, it will return it as double. If the variable is a bitfield, it will return it as count (unscaled). You can used unsigned char to decode it.
// Initialize the PARASOL file instance PARASOLFileData pfd(filename); string param="seq_nb"; cout<<"---------- Extract Parameter "<<param<<" ----------"<<endl; // read the dimensions of the variable data : for this parametre, has 2 ones [nb_data_record],NB_PARASOL_DIRECTIONS] vector<int> dimensions=pfd.get_data_dimension(param); int nb_data_record=dimensions[0]; int nb_viewing_directions=dimensions[1]; cout<<"Dimensions : ["<<dimensions[0]<<","<<dimensions[1]<<"]"<<endl; cout<<"---------------------------------------------------"<<endl; // read the data signed short* data=NULL; // Set the data buffer to NULL to delegate its allocation to the read_data method data=static_cast<signed short*>(pfd.read_data(data,param.c_str())); // print out the values if (data!=NULL) { if (show_val_display) { for (int j = 0 ; j<nb_data_record;++j) { cout<<"Record #"<<j<<endl; for (int i = 0 ; i<nb_viewing_directions;++i) { cout<<"\t"<<data[j*nb_viewing_directions+i]; } cout<<endl; } } } // free the buffer once used delete[] data; data=NULL;
Another example : reading the dqx of the first viewing direction of a L1_B file, and print them out
// Initialize the PARASOL file instance PARASOLFileData pfd(filename); string param="dqx"; cout<<"---------- Extract Parameter "<<param<<" ----------"<<endl; // read the dimensions of the variable data : for this parametre, has 2 ones [nb_data_record],NB_PARASOL_DIRECTIONS] vector<int> dimensions=pfd.get_data_dimension(param); int nb_data_record=dimensions[0]; int nb_viewing_directions=dimensions[1]; cout<<"Dimensions : ["<<dimensions[0]<<","<<dimensions[1]<<"]"<<endl; cout<<"---------------------------------------------------"<<endl; // read the data -> set the range of the data to read int start[]={0,4}; // means : start to read the data from the first record (0), and from the 5th viewing direction (4) int edges[]={-1,1}; // means : read all the records (-1 is a kind of metaselector), and read only one viewing direction value (1) signed short* data=NULL; // Set the data buffer to NULL to delegate its allocation to the read_data method data=static_cast<signed short*>(pfd.read_data(data,param.c_str())); // print out the values if (data!=NULL) { if (show_val_display) { cout<<"Record\tbits"<<endl; for (int i = 0 ; i<nb_data_record];++i) cout<<i<<"\t"<<MyTools::to_bit(&ushort_count_data[i],2)<<endl; } } // free the buffer once used delete[] data; data=NULL;
data | a buffer that will contain the data. | |
var_name | the variable name | |
start | the start indexes of the data to read. Indexes of -1 are considered as metacharacters and will be replaced by 0. Actually, if you read a directionnal parametre, start is [start_record_index, start_direction] | |
stride | step between 2 read values (ignored at this time : 1 used by default)0. | |
edges | the number of data to read along each direction. Indexes of -1 are considered as metacharacters and will be replaced by the maximum number of values. Actually, if you read a directionnal parametre, edges is [nb_record_to_read, nb_direction_to_read] | |
rank | the size of the start and edges arrays : 1 for undirectionnal parametres, and 2 for directionnal ones. This parametre is not mandatory : if not specified, the method computes it. |
Implements FileData.
Reimplemented in PolderParasolFileData.
References read_scaled_data().
Referenced by load_viewing_directions_data().
double * PARASOLFileData::read_scaled_data | ( | double * | data, | |
const char * | var_name = "alt" , |
|||
int * | start = NULL , |
|||
int * | edges = NULL , |
|||
int | rank = -1 | |||
) |
read the data and apply the scaling to it.
// Initialize the PARASOL file instance PARASOLFileData pfd(filename); string param="seq_nb"; cout<<"---------- Extract Parameter "<<param<<" ----------"<<endl; // read the dimensions of the variable data : for this parametre, has 2 ones [nb_data_record],NB_PARASOL_DIRECTIONS] vector<int> dimensions=pfd.get_data_dimension(param); int nb_data_record=dimensions[0]; int nb_viewing_directions=dimensions[1]; cout<<"Dimensions : ["<<dimensions[0]<<","<<dimensions[1]<<"]"<<endl; cout<<"---------------------------------------------------"<<endl; // read the data signed short* data=NULL; // Set the data buffer to NULL to delegate its allocation to the read_data method data=static_cast<signed short*>(pfd.read_scaled_data(data,param.c_str())); // print out the values if (data!=NULL) { if (show_val_display) { for (int j = 0 ; j<nb_data_record;++j) { cout<<"Record #"<<j<<endl; for (int i = 0 ; i<nb_viewing_directions;++i) { cout<<"\t"<<data[j*nb_viewing_directions+i]; } cout<<endl; } } } // free the buffer once used delete[] data; data=NULL;
data | a buffer of double values that will contain the data. If NULL, the method does the needed allocations. | |
var_name | the variable name | |
start | the start index. If NULL will be 0 | |
edges | the number of values to read. If NULL will be the whole data |
References PARASOLData::apply_scaling(), data, and PARASOLData::get_data_entry_index().
Referenced by read_data().
PARASOLData* PARASOLFileData::data [protected] |
The Data reader
Referenced by close_data_file(), close_file(), get_data_dimension(), get_entry_format(), get_nb_data(), get_scaling(), idata2igrid(), is_file_loaded(), load_geolocation_data(), open_data_file(), read_count_data(), read_scaled_data(), and ~PARASOLFileData().
PARASOLLeader* PARASOLFileData::leader [protected] |
The leader reader
Referenced by close_file(), get_record_time(), is_file_loaded(), load_viewing_directions_data(), print_scaling_factors(), print_spatio_temp_char(), print_techno_param(), and ~PARASOLFileData().