Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

CERESFileData Class Reference

#include <ceresfiledata.h>

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

List of all members.

Public Member Functions

 CERESFileData (const string &name, const string &mode="r")
 ~CERESFileData ()
void set_lat_lon_index_max ()
const string get_product () const
const string get_platform () const
const string get_instrument () const
const string get_version () const
const string get_radix () const
virtual const bool get_index (const float &lat, const float &lon, const double time, int &index, const float coloc_tolerance=CERESFileData::colocation_tolerance)
 search the index of the nearest point in the data to (lat , lon ) It uses a brute force search on the whole data. For better performances, override this method, and use more specifics way like sort the pixels by increasing (lat,lon) then dichotomic search on it... Only the points that have a distance to ( lat, lon ) inferior to coloc_tolerance will be considered
virtual const float get_nearest_point_distance (const float &lat, const float &lon, int &coincidence_idx, float coloc_tolerance=CERESFileData::colocation_tolerance)
 compute the distance to (lat,lon) of the nearest point in the data Only the points that have a distance to ( lat, lon ) inferior to coloc_tolerance will be considered In the method, calls the get_index method
virtual const bool contain_location (const float &lat, const float &lon, float tolerance=CERESFileData::colocation_tolerance)
 check if this file has data coincident with ( lat , lon ) at a distance not bigger than tolerance
virtual void load_geolocation_data ()
 read the geolocations data and put it in memory This method is used to make the search of the indexes of a (lat,lon,time) point faster.
virtual void free_geolocation_data ()
 free eventually loaded geolocation data
virtual const bool is_geolocation_data_loaded () const
 check if the geolocation data have been already loaded
const int get_nb_geo_points () const
 access the number of differents geographical points in the file
const bool get_index (const float &lat, const float &lon, int &nearest_pix_idx, const float colocation_tolerance=CERESFileData::colocation_tolerance)
 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]
virtual void get_vindex (vector< vector< int > > &v_index, const float &lat, const float &lon, const float colocation_tolerance=CERESFileData::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=CERESFileData::colocation_tolerance)
 compute the distance to (lat,lon) of the nearest point in the data If coloc_tolerance is given, it will compute only the distance of the points that have a distance to ( lat, lon ) inferior to coloc_tolerance
const bool contain_location (const float &lat, const float &lon, const double &tolerance=CERESFileData::colocation_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_data (const float &lat, const float &lon, const double &time, const double &colocation_tolerance=CERESFileData::colocation_tolerance)
 check if the file has possible (lat,lon) coincidence
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

Static Public Member Functions

static const float get_ceres_lon (const float &lon)
 convert a usual longitude in degrees (-180->180) to a longitude in CERES convention (0->360 where the 0 is the greenwich mereidian)
static const float get_ceres_lat (const float &lat)
 convert a usual latitude in degrees (-90->90) to a colatitude, the convention used in CERES files (colat=90-lat)

Protected Member Functions

void init ()
void parse_filename (const string &short_filename)
bool check_filename (const string &short_filename) const
const string get_time_sds_name (const string product="") const
virtual void load_v_pixel ()
 load the list data pixels

Protected Attributes

string product
string platform
string instrument
string version
int lat_lon_index_max [1]

Static Protected Attributes

static const string latitude_sds_name = "Colatitude of CERES FOV at surface"
static const string longitude_sds_name = "Longitude of CERES FOV at surface"
static const float colocation_tolerance = 0.2

Detailed Description

class managing the reading of the CERES file data. CERES products managed : CRS ; SSF ;

Author:
nicolas PASCAL

Constructor & Destructor Documentation

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

Constructor

Parameters:
name the name (path+filename) of the file to be opened
mode the opening mode. LIMITATION : only "r" mode treated at this time

References init().

CERESFileData::~CERESFileData (  ) 

Member Function Documentation

const bool CERESFileData::contain_data ( const float &  lat,
const float &  lon,
const double &  time,
const double &  colocation_tolerance = CERESFileData::colocation_tolerance 
) [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 CERESFileData::contain_location ( const float &  lat,
const float &  lon,
float  tolerance = CERESFileData::colocation_tolerance 
) [virtual]

check if this file has data coincident with ( lat , lon ) at a distance not bigger than tolerance

Parameters:
lat the latitude of the event
lon the longitude of the event
Returns:

References get_index(), and is_geolocation_data_loaded().

Referenced by contain_data().

const bool CERESFileData::contain_location ( const float &  lat,
const float &  lon,
const double &  tolerance = CERESFileData::colocation_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.

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().

const float CERESFileData::get_ceres_lat ( const float &  lat  )  [static]

convert a usual latitude in degrees (-90->90) to a colatitude, the convention used in CERES files (colat=90-lat)

Parameters:
lat a latitude
Returns:
the colatitude corresponding to lat

Referenced by get_index(), and get_nearest_point_distance().

const float CERESFileData::get_ceres_lon ( const float &  lon  )  [static]

convert a usual longitude in degrees (-180->180) to a longitude in CERES convention (0->360 where the 0 is the greenwich mereidian)

Parameters:
lon a usual longitude
Returns:
the longitude used in CERES

Referenced by get_index(), and get_nearest_point_distance().

const bool CERESFileData::get_index ( const float &  lat,
const float &  lon,
int &  nearest_pix_idx,
const float  colocation_tolerance = CERESFileData::colocation_tolerance 
)

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
nearest_pix_idx the 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.
Returns:
true if the coincidence has been found

References get_index().

const bool CERESFileData::get_index ( const float &  lat,
const float &  lon,
const double  time,
int &  index,
const float  coloc_tolerance = CERESFileData::colocation_tolerance 
) [virtual]

search the index of the nearest point in the data to (lat , lon ) It uses a brute force search on the whole data. For better performances, override this method, and use more specifics way like sort the pixels by increasing (lat,lon) then dichotomic search on it... Only the points that have a distance to ( lat, lon ) inferior to coloc_tolerance will be considered

Parameters:
lat the latitude
lon the longitude
time the time of the observation. If -1., skipped
index the index of the eventual coincidence (or -1)
coloc_tolerance the frame in which 2 points are considered as colocated
Returns:
true if coincidence found

References FileData::contain_time(), free_geolocation_data(), get_ceres_lat(), get_ceres_lon(), get_nb_geo_points(), is_geolocation_data_loaded(), SatelliteFileData::lat_data, load_geolocation_data(), and SatelliteFileData::lon_data.

Referenced by contain_location(), get_index(), and get_nearest_point_distance().

const string CERESFileData::get_instrument (  )  const [inline]

read the instrument in use in this product

Returns:
the instrument
const int CERESFileData::get_nb_geo_points (  )  const

access the number of differents geographical points in the file

Returns:
the number of different points

Referenced by get_index().

const float CERESFileData::get_nearest_point_distance ( const float &  lat,
const float &  lon,
const float  coloc_tolerance = CERESFileData::colocation_tolerance 
)

compute the distance to (lat,lon) of the nearest point in the data If coloc_tolerance is given, it will compute only the distance of the points that have a distance to ( lat, lon ) inferior to coloc_tolerance

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.

References free_geolocation_data(), get_index(), is_geolocation_data_loaded(), SatelliteFileData::lat_data, load_geolocation_data(), and SatelliteFileData::lon_data.

const float CERESFileData::get_nearest_point_distance ( const float &  lat,
const float &  lon,
int &  coincidence_idx,
float  coloc_tolerance = CERESFileData::colocation_tolerance 
) [virtual]

compute the distance to (lat,lon) of the nearest point in the data Only the points that have a distance to ( lat, lon ) inferior to coloc_tolerance will be considered In the method, calls the get_index method

Parameters:
lat the latitude
lon the longitude
coloc_tolerance the frame in which 2 points are considered as colocated
coincidence_idx the index of the eventual coincidence
Returns:
the distance to the nearest point, or -1 if no point in the colocalisation frame has been found.

References get_ceres_lat(), get_ceres_lon(), get_index(), SatelliteFileData::lat_data, and SatelliteFileData::lon_data.

virtual void CERESFileData::get_pixel_coord ( const vector< int > &  ipix,
float &  lat,
float &  lon,
double &  time 
) [inline, virtual]

retrieve the coordinates of a pixel using its index

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
const string CERESFileData::get_platform (  )  const [inline]

read the platform used in this product

Returns:
the platform
const string CERESFileData::get_product (  )  const [inline]

read the product name (CRS,...)

Returns:
the product name
const string CERESFileData::get_radix (  )  const

return the radix of the file, actually the file name without the date and the dot. Ex : the radix of the file "CER_CRS_Terra-FM2-MODIS_Sample_000000.2001010101" is "CER_CRS_Terra-FM2-MODIS_Sample_000000"

Returns:
the radix
const string CERESFileData::get_version (  )  const [inline]

access the version of the CERES file

Returns:
the version
virtual void CERESFileData::get_vindex ( vector< vector< int > > &  v_index,
const float &  lat,
const float &  lon,
const float  colocation_tolerance = CERESFileData::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

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 CERESFileData::init (  )  [protected]
void CERESFileData::set_lat_lon_index_max (  ) 

Set the latitude and longitude indexes extrema

References HDFFileData::free_hdf_file(), HDFFileData::hdf_file, HDFFileData::is_hdf_file_loaded(), and HDFFileData::load_hdf_file().

Referenced by init().


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