Public Member Functions | Static Public Member Functions

PMFileData Class Reference

Inheritance diagram for PMFileData:
Inheritance graph
[legend]
Collaboration diagram for PMFileData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PMFileData (const string &name, const string &mode="r")
 constructor
 ~PMFileData ()
 destructor
void load_geolocation_data ()
 read the geolocation data (latitude, longitude and time) This method is used to make the search of the indexes of a (lat,lon,time) point faster.
void free_geolocation_data ()
 free eventually loaded geolocation data If the geolocation data are not loaded, doesn't do anything
const bool contain_location (const float &lat, const float &lon, const double &tolerance=0.01)
 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_data (const float &lat, const float &lon, const double &time, const double &colocation_tolerance=0.01)
 check if the file has possible (lat,lon) coincidence
const float get_nearest_point_distance (const float &lat, const float &lon, const float coloc_tolerance=PMFileData::colocation_tolerance)
 compute the distance to (lat,lon) of the nearest point in the data
string get_product () const
 access to the product name
string get_version () const
 access to the version of the product
const bool get_index (const float &lat, const float &lon, int igrid[2], const float colocation_tolerance=0.01)
 find the index of the nearest point to (lat,lon) in the data. If (lat,lon) is not found or out of the colocalisation_frame, returned indexes are [-1,-1]
const bool get_index (const float &lat, const float &lon, int &idata, const float colocation_tolerance=0.01)
 find the index of the nearest point to (lat,lon) in the data. The resulting index is linearized : if the dataset has 2 dimensions, this index will be "i_x + sz_x * i_y" If (lat,lon) is not found or out of the colocalisation_frame, returned indexes are [-1,-1]
virtual void get_vindex (vector< vector< int > > &v_index, const float &lat, const float &lon, const float colocation_tolerance=0.01)
 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 int get_nb_geo_points ()
 retrieve the number of (lat,lon) pixels in the file
virtual void load_v_pixel ()
 load the list data pixels Unused for this type of product
virtual void close_data_file ()
 closes the file.
virtual void open_data_file ()
 opens the file.
virtual void get_pixel_coord (const vector< int > &ipix, float &lat, float &lon, double &time)
 retrieve the coordinates of a pixel using its index. Actuallty, the data are gridded, so the ( lat, lon ) position returned is the center of the grid cell
int get_orbit_nb () const
 orbit number getter
void geolocation_to_grid (const float *lat_lon, int *igrid)
 get the full resolution polder grid indexes corresponding to a point given by its (lat,lon) coordinates
void geolocation_to_grid (const float &lat, const float &lon, int *igrid)
 get the full resolution polder grid indexes corresponding to a point given by its (lat,lon) coordinates
void grid_to_geolocation (const int *igrid, float *lat_minmax, float *lon_minmax=NULL)
 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.
const int16 * get_irow_shift_data () const
 getter of the column shift for each row data
float32 get_node_lon () const
 getter of the ascending node longitude
void read_node_lon ()
 read the ascending node longitude in the file attributes and set it
const bool is_geolocation_data_loaded () const
 check if the geolocation data have been already loaded

Static Public Member Functions

static const int16 get_sz_grid_y ()
 accessor to the height, in pixels, of the data grid
static const int16 get_sz_grid_x ()
 accessor to the width, in pixels, of the data grid

Detailed Description

Author:
Nicolas PASCAL reading of PM ( PARASOL/POLDER-MODIS ) files

Constructor & Destructor Documentation

PMFileData::PMFileData ( const string &  name,
const string &  mode = "r" 
)

constructor

Parameters:
name the filename
mode opening mode. only "r" at this time

Member Function Documentation

const bool PMFileData::contain_data ( const float &  lat,
const float &  lon,
const double &  time,
const double &  colocation_tolerance = 0.01 
) [virtual]

check if the file has possible (lat,lon) coincidence

Warning:
it's an EVENTUAL coincidence. That is not a proof !!!
Parameters:
lat latitude
lon longitude
time time
colocation_tolerance the acceptable bias (in km or degrees. Supposed to be in, a plane approximation) between [lat,lon] and the nearest data point.
Returns:
true if can eventually contain a coincidence with the point.
Warning:
at this time always true. I don't have a good way to do it

Reimplemented from FileData.

References contain_location(), and FileData::contain_time().

const bool PMFileData::contain_location ( const float &  lat,
const float &  lon,
const double &  tolerance = 0.01 
) [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.

Parameters:
lat the latitude of the event
lon the longitude of the event
tolerance acceptable bias between the nearest point in the data and the given (lat,lon) point
Returns:
true if a point in the data has been found in the colocation frame

Reimplemented from FileData.

References get_index().

Referenced by contain_data().

void PMFileData::geolocation_to_grid ( const float *  lat_lon,
int *  igrid 
)

get the full resolution polder grid indexes corresponding to a point given by its (lat,lon) coordinates

Parameters:
lat_lon the geolocation coordinates
igrid the indexes in the reference POLDER full resolution grid, in the format [line,col] and starting from 1

Referenced by geolocation_to_grid().

void PMFileData::geolocation_to_grid ( const float &  lat,
const float &  lon,
int *  igrid 
) [inline]

get the full resolution polder grid indexes corresponding to a point given by its (lat,lon) coordinates

Parameters:
lat latitude
lon longitude
igrid the indexes in the reference POLDER full resolution grid, in the format [line,col] and starting from 1

References geolocation_to_grid().

const bool PMFileData::get_index ( const float &  lat,
const float &  lon,
int  igrid[2],
const float  colocation_tolerance = 0.01 
)

find the index of the nearest point to (lat,lon) in the data. If (lat,lon) is not found or out of the colocalisation_frame, returned indexes are [-1,-1]

Parameters:
lat the latitude
lon the longitude
igrid the indexes of the grid cell that contains the measure. {-1,-1} if no coincidence found.
colocation_tolerance the acceptable bias (in km or degrees. Supposed to be in, a plane approximation) between [lat,lon] and the nearest data point. Unused here because data are gridded
Returns:
true if the coincidence has been found

Referenced by contain_location(), and get_index().

const bool PMFileData::get_index ( const float &  lat,
const float &  lon,
int &  idata,
const float  colocation_tolerance = 0.01 
)

find the index of the nearest point to (lat,lon) in the data. The resulting index is linearized : if the dataset has 2 dimensions, this index will be "i_x + sz_x * i_y" If (lat,lon) is not found or out of the colocalisation_frame, returned indexes are [-1,-1]

Parameters:
lat the latitude
lon the longitude
idata the linearized index of the nearest measure. -1 if no coincidence found.
colocation_tolerance the acceptable bias (in km or degrees. Supposed to be in, a plane approximation) between [lat,lon] and the nearest data point. Unused here because data are gridded
Returns:
true if the coincidence has been found

References get_index().

const int16* PMFileData::get_irow_shift_data (  )  const [inline]

getter of the column shift for each row data

Returns:
the column shift data buffer
const int PMFileData::get_nb_geo_points (  )  [inline]

retrieve the number of (lat,lon) pixels in the file

Returns:
the number of (lat,lon) pixels
const float PMFileData::get_nearest_point_distance ( const float &  lat,
const float &  lon,
const float  coloc_tolerance = PMFileData::colocation_tolerance 
) [inline]

compute the distance to (lat,lon) of the nearest point in the data

Warning:
this method does not make sense for a gridded product. This code is here only to implement the interface
Parameters:
lat the latitude
lon the longitude
coloc_tolerance the -/+ maximal tolerance for 2 points considered as colocated
Returns:
the distance to the nearest point, or -1 if no point in the colocalisation frame has been found.
float32 PMFileData::get_node_lon (  )  const [inline]

getter of the ascending node longitude

Returns:
the ascending node longitude
int PMFileData::get_orbit_nb (  )  const [inline]

orbit number getter

Returns:
the orbit number
virtual void PMFileData::get_pixel_coord ( const vector< int > &  ipix,
float &  lat,
float &  lon,
double &  time 
) [inline, virtual]

retrieve the coordinates of a pixel using its index. Actuallty, the data are gridded, so the ( lat, lon ) position returned is the center of the grid cell

Parameters:
ipix [IN] index of the pixel
lat [OUT] latitude of the pixel
lon [OUT] longitude of the pixel
time [OUT] timestamp of the pixel. Unused for this product

References grid_to_geolocation().

string PMFileData::get_product (  )  const [inline]

access to the product name

Returns:
the product name
static const int16 PMFileData::get_sz_grid_x (  )  [inline, static]

accessor to the width, in pixels, of the data grid

Returns:
the width of the data grid
static const int16 PMFileData::get_sz_grid_y (  )  [inline, static]

accessor to the height, in pixels, of the data grid

Returns:
the height of the data grid
string PMFileData::get_version (  )  const [inline]

access to the version of the product

Returns:
the version of the product
virtual void PMFileData::get_vindex ( vector< vector< int > > &  v_index,
const float &  lat,
const float &  lon,
const float  colocation_tolerance = 0.01 
) [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

Parameters:
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.
Returns:
the list of indices of pixels
void PMFileData::grid_to_geolocation ( const int *  igrid,
float *  lat_minmax,
float *  lon_minmax = NULL 
)

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.

Parameters:
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
igrid the indexes in the reference POLDER grid (line,col) and so starts from 1

Referenced by get_pixel_coord().


The documentation for this class was generated from the following files: