#include <filedata.h>
Public Member Functions | |
FileData (const string &name="", const string &mode="r") | |
Build a generic file reader interface. | |
FileData (const FileData &fd) | |
Copy constructor. | |
FileData & | operator= (const FileData &fd) |
Affectation operator. | |
virtual | ~FileData () |
Destructor. | |
const string | get_name () const |
file name accessor | |
virtual string | get_filename () |
alias to get_name method, dfor data2grid/mapsoperator compatibility | |
const Date | get_date () const |
return the date of data' acquisition start | |
const bool | contain_time (const double time=-1.) const |
test if the file contains data that occur at time If time is -1 (deault), always return true | |
virtual void * | read_data (void *data, const char *sds_name, int *start=NULL, int *stride=NULL, int *edges=NULL, int rank=-1)=0 |
Read the selected data in the file. | |
double | get_time_coverage () const |
virtual void | close_data_file () |
closes the file | |
virtual void | open_data_file () |
open the file | |
virtual const bool | contain_location (const float &lat, const float &lon, const double &tolerance) |
check if this file has eventually data coincident with (lat,lon) | |
virtual const bool | contain_data (const float &lat, const float &lon, const double &time, const double &colocation_tolerance) |
check if the file has possible (lat,lon) coincidence | |
virtual void | load_geolocation_data () |
read the geolocations data and put it in memory | |
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 | |
virtual void | get_dataset_fill_value (const string &ds_name, void *fillvalue) |
read the given dataset's fill value TODO Same method with many names of this method transfered from filedatareader. Need to be reformatted after functionnal tests with Data2Grid/MapsOperator | |
virtual vector< int > | get_dataset_dimension (const string &sds_name) |
return the given dataset size along each axis | |
template<class X > | |
void | get_fillValue (const string &ds_name, X &fillValue) |
read the given dataset's fill value | |
virtual void | get_fillValue (const string &ds_name, void *fillValue) |
template<class X > | |
void | get_fill_value (const string &ds_name, X &fillValue) |
virtual void | get_fill_value (const string &ds_name, void *fillValue) |
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 | get_viewing_directions (const vector< int > &ipix, vector< Observation > &v_obs) |
constucts the viewing directions observations for the given pixel | |
Static Public Member Functions | |
static void | check_geolocation (const float lat, const float lon) |
check the validity of the (lat, lon) coordinates. If lat not in [-90, 90] or lon not in [-180, 180], raise an exception | |
Protected Member Functions | |
void | set_name (const string &name) |
void | set_date (const Date &d) |
Protected Attributes | |
string | name |
string | mode |
Date * | date |
double | time_coverage |
Generic class managing the reading. It describes the data generally
FileData::FileData | ( | const string & | name = "" , |
|
const string & | mode = "r" | |||
) |
Build a generic file reader interface.
bad_file | if the name given in parametre doesn't exist or is NULL | |
bad_file_opening_mode | :
|
name | the name of the file (path included) we want to parse / | |
mode | the file's opening mode for this file. At this time, only "r" is allowed |
References date.
FileData::FileData | ( | const FileData & | fd | ) |
void FileData::check_geolocation | ( | const float | lat, | |
const float | lon | |||
) | [static] |
check the validity of the (lat, lon) coordinates. If lat not in [-90, 90] or lon not in [-180, 180], raise an exception
lat | latitude | |
lon | longitude |
Referenced by PARASOLFileData::geolocation_to_grid().
virtual void FileData::close_data_file | ( | ) | [inline, virtual] |
closes the file
Reimplemented in CALIOPFileData, CERESFileData, CLOUDSATFileData, DARDARFileData, ECMWFFileData, GribFileData, HDF5FileData, HDFFileData, IIRFileData, MerisFileData, MODISFileData, NETCDFFileData, OMIFileData, PARASOLFileData, PMFileData, PolderParasolFileData, and SatelliteFileData.
virtual const bool FileData::contain_data | ( | const float & | lat, | |
const float & | lon, | |||
const double & | time, | |||
const double & | colocation_tolerance | |||
) | [inline, virtual] |
check if the file has possible (lat,lon) coincidence
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. |
Reimplemented in CALIOPFileData, CERESFileData, CLOUDSATFileData, DARDARFileData, IIRFileData, MODISFileData, OMIFileData, PARASOLFileData, PMFileData, and SatelliteFileData.
virtual const bool FileData::contain_location | ( | const float & | lat, | |
const float & | lon, | |||
const double & | tolerance | |||
) | [inline, virtual] |
check if this file has eventually data coincident with (lat,lon)
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 |
Reimplemented in CALIOPFileData, CERESFileData, CLOUDSATFileData, DARDARFileData, IIRFileData, MODISFileData, OMIFileData, PARASOLFileData, PMFileData, and SatelliteFileData.
const bool FileData::contain_time | ( | const double | time = -1. |
) | const |
test if the file contains data that occur at time If time is -1 (deault), always return true
time | a measure time using TAI93 convention (number of seconds since 1993/01/01 at 00:00:00) |
References date, Date::get_TAI93_time(), and time_coverage.
Referenced by PMFileData::contain_data(), PARASOLFileData::contain_data(), OMIFileData::contain_data(), MODISFileData::contain_data(), IIRFileData::contain_data(), DARDARFileData::contain_data(), CLOUDSATFileData::contain_data(), CERESFileData::contain_data(), CALIOPFileData::contain_data(), and CERESFileData::get_index().
virtual void FileData::free_geolocation_data | ( | ) | [inline, virtual] |
free eventually loaded geolocation data
Reimplemented in CALIOPFileData, CERESFileData, CLOUDSATFileData, DARDARFileData, ECMWFFileData, IIRFileData, MODISFileData, PARASOLFileData, PMFileData, and SatelliteFileData.
virtual vector<int> FileData::get_dataset_dimension | ( | const string & | sds_name | ) | [inline, virtual] |
return the given dataset size along each axis
ds_name | [IN] dataset name |
Reimplemented in GribFileData, HDF5FileData, HDFFileData, MerisFileData, NETCDFFileData, and PolderParasolFileData.
virtual void FileData::get_dataset_fill_value | ( | const string & | ds_name, | |
void * | fillvalue | |||
) | [inline, virtual] |
read the given dataset's fill value TODO Same method with many names of this method transfered from filedatareader. Need to be reformatted after functionnal tests with Data2Grid/MapsOperator
ds_name | [IN] dataset name | |
fillvalue | [OUT] fill value. |
Reimplemented in GribFileData, HDF5FileData, HDFFileData, MerisFileData, NETCDFFileData, and PolderParasolFileData.
const Date FileData::get_date | ( | ) | const [inline] |
return the date of data' acquisition start
References date.
Referenced by IIRFileData::contains_data_at().
virtual string FileData::get_filename | ( | ) | [inline, virtual] |
alias to get_name method, dfor data2grid/mapsoperator compatibility
Reimplemented in MerisFileData.
References get_name().
void FileData::get_fillValue | ( | const string & | ds_name, | |
X & | fillValue | |||
) | [inline] |
read the given dataset's fill value
ds_name | [IN] dataset name | |
fillvalue | [OUT] fill value. |
const string FileData::get_name | ( | ) | const [inline] |
file name accessor
References name.
Referenced by get_filename(), MODISFileData::init(), CERESFileData::init(), CALIOPFileData::is_same_orbit(), and HDFFileData::load_hdf_file().
virtual void FileData::get_viewing_directions | ( | const vector< int > & | ipix, | |
vector< Observation > & | v_obs | |||
) | [inline, virtual] |
constucts the viewing directions observations for the given pixel
ipix | pixel indice(s) | |
v_obs | vector of observation(s) for the given pixel |
Reimplemented in CALIOPFileData, PARASOLFileData, and SatelliteFileData.
virtual const bool FileData::is_geolocation_data_loaded | ( | ) | const [inline, virtual] |
check if the geolocation data have been already loaded
Reimplemented in CALIOPFileData, CERESFileData, IIRFileData, MODISFileData, PARASOLFileData, PMFileData, and SatelliteFileData.
virtual void FileData::load_geolocation_data | ( | ) | [inline, virtual] |
read the geolocations data and put it in memory
Reimplemented in CALIOPFileData, CERESFileData, CLOUDSATFileData, DARDARFileData, IIRFileData, MODISFileData, OMIFileData, PARASOLFileData, PMFileData, and SatelliteFileData.
virtual void FileData::open_data_file | ( | ) | [inline, virtual] |
open the file
Reimplemented in CALIOPFileData, CERESFileData, CLOUDSATFileData, DARDARFileData, ECMWFFileData, GribFileData, HDF5FileData, HDFFileData, IIRFileData, MerisFileData, MODISFileData, NETCDFFileData, OMIFileData, PARASOLFileData, PMFileData, PolderParasolFileData, and SatelliteFileData.
virtual void* FileData::read_data | ( | void * | data, | |
const char * | sds_name, | |||
int * | start = NULL , |
|||
int * | stride = NULL , |
|||
int * | edges = NULL , |
|||
int | rank = -1 | |||
) | [pure virtual] |
Read the selected data in the file.
data | the buffer to fill with the read values. Can be NULL. In this case, the allocation is done by the method | |
sds_name | the name of the sds (Scientific Data Set) we want to access. | |
start | begining of the selection. If NULL, start at (0,0) if rank is 2 ; (0,0,0) if rank is 3... | |
stride | step between 2 interesting values. If NULL, this step is set to 1 in each dimension (ie all values will be read) | |
edges | number of values to be read in each dimension. if NULL, it will be all data along each dimension. | |
rank | the dimension of start, stride and edges |
Implemented in ECMWFFileData, GribFileData, HDF5FileData, HDFFileData, MerisFileData, NETCDFFileData, PARASOLFileData, and PolderParasolFileData.
Referenced by GMAOFileData::load_height_level(), and GMAOFileData::load_time_level().
void FileData::set_date | ( | const Date & | d | ) | [inline, protected] |
void FileData::set_name | ( | const string & | name | ) | [inline, protected] |
set the name of the file
_name | the new name |
Date* FileData::date [protected] |
the date when the data have been acquired
Referenced by contain_time(), FileData(), get_date(), MODISFileData::get_radix(), MeteoFileData::get_time_index(), MeteoFileData::get_time_max(), MeteoFileData::get_time_min(), DARDARFileData::load_geolocation_data(), operator=(), MODISFileData::parse_filename(), GMAOFileData::parse_filename(), ECMWFFileData::parse_filename(), set_date(), and ~FileData().
string FileData::mode [protected] |
the opening mode : only "r" supported at this time
Referenced by FileData(), GribFileData::open_data_file(), and operator=().
string FileData::name [protected] |
the name of the file (with its path)
Reimplemented in HDF5FileData.
Referenced by FileData(), NETCDFFileData::get_dataset_dimension(), get_name(), GribFileData::open_data_file(), operator=(), GribFileData::print_keys(), and NETCDFFileData::read_data().
double FileData::time_coverage [protected] |
the duration of the acquisition
Referenced by contain_time(), ECMWFFileData::ECMWFFileData(), MeteoFileData::get_time_index(), MeteoFileData::get_time_max(), CERESFileData::init(), MeteoFileData::MeteoFileData(), ECMWFFileData::parse_filename(), and MODISFileData::set_time_coverage().