Public Member Functions | Protected Member Functions | Protected Attributes

MeteoFileData Class Reference

#include <meteofiledata.h>

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

List of all members.

Public Member Functions

 MeteoFileData (const std::string &name, const std::string &mode="r")
 constructor
virtual ~MeteoFileData ()
 destructor
const unsigned short get_nb_height_level ()
 access to the number of height levels
const double * get_height_level ()
 return the height level values
const unsigned short get_nb_time_level ()
 access to the number of time levels load the time level if needed
const double * get_time_level ()
 return the time level values load the time level if needed
virtual double get_time_min () const
 access to the time of the start of the acquisition
virtual double get_time_max () const
 access to the time of the end of the acquisition
virtual const int get_lat_index (const float &lat) const
 return the index of the grid latitude that is the nearest to lat.
virtual const int get_lon_index (const float &lon) const
 return the index of the grid longitude that is the nearest to lon.
virtual const int get_time_index (const double &time) const
 return the index of the grid time that is the nearest to lon.
virtual const bool get_index (const float &lat, const float &lon, int *index) const
 search the indexes of the data coincident with the point (lat,lon) If the coincidence can't be found, the output indexes index will be set to {-1,-1}
virtual const bool get_index (const float &lat, const float &lon, const double &time, int *index)
 search the indexes of the data coincident with the point (lat,lon,time) If the coincidence can't be found, the output indexes index will be set to {-1,-1,-1}
short get_nb_time_level () const
 get the number of time levels for this type of meteo file
double get_delta_time () const
 accessor to the time step between 2 successive time
double get_delta_lat () const
 accessor to the time step between 2 successive grid latitudes
double get_delta_lon () const
 accessor to the time step between 2 successive grid longitudes

Protected Member Functions

virtual bool check_filename (const std::string &filename) const =0
 check is a the file seems to be a valid meteo data file The analysis is done with a filename parsing, not with parsing the data inside
virtual void parse_filename (const std::string &filename)=0
 extract some informations using the filename (acquisition start time,etc) PRECONDITION the file name must be valid. The validity check is done by check_filename
virtual const bool is_height_level_loaded () const
 check if the height levels have already been set
virtual void load_height_level ()
 if not already set, read the height levels in the file To implement this interface : the method must :

  • set the nb_height_level attribute
  • fill the height_level array with the height stamp of each level

void free_height_level ()
 if loaded, free the height levels If the product is a 2D one, no height levels are defined. In this case, nothing's done.
virtual const bool is_time_level_loaded () const
 check if the time levels have already been set
virtual void load_time_level ()=0
 if not already set, read the time levels in the file To implement this interface : the method must :

  • set the nb_time_level attribute
  • fill the time_level array with the time stamp of each level

void free_time_level ()
 if loaded, free the time levels

Protected Attributes

double delta_time
 The time resolution.
double delta_lat
 The average step between two latitudes.
double delta_lon
 The average step between two longitudes.
short nb_height_level
 The number of different heights levels (depend of the meteo file).
double * height_level
 the height levels (the Z axis for 3D products) For 2D products, will always be NULL
short nb_time_level
 The number of different times levels (depend of the meteo file).
double * time_level
 the time stamp of each measure

Detailed Description

Generic abstract interface to manage the reading of meteo files

Author:
Nicolas PASCAL

Constructor & Destructor Documentation

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

constructor

Parameters:
name the filename (with the path)
mode opening mode. only "r" at this time

References delta_lat, delta_lon, delta_time, height_level, nb_height_level, nb_time_level, FileData::time_coverage, and time_level.


Member Function Documentation

virtual bool MeteoFileData::check_filename ( const std::string &  filename  )  const [protected, pure virtual]

check is a the file seems to be a valid meteo data file The analysis is done with a filename parsing, not with parsing the data inside

Parameters:
filename the filename without its path
Returns:
true if the filename seems to be valid, false else or in case of problem (exception...)
double MeteoFileData::get_delta_lat (  )  const [inline]

accessor to the time step between 2 successive grid latitudes

Returns:
the minimal latitude step

References delta_lat.

double MeteoFileData::get_delta_lon (  )  const [inline]

accessor to the time step between 2 successive grid longitudes

Returns:
the minimal longitude step

References delta_lon.

double MeteoFileData::get_delta_time (  )  const [inline]

accessor to the time step between 2 successive time

Returns:
the minimal time step

References delta_time.

const double * MeteoFileData::get_height_level (  ) 

return the height level values

Returns:
the height values vector

References height_level.

const bool MeteoFileData::get_index ( const float &  lat,
const float &  lon,
int *  index 
) const [virtual]

search the indexes of the data coincident with the point (lat,lon) If the coincidence can't be found, the output indexes index will be set to {-1,-1}

Parameters:
lat the latitude
lon the longitude
index the output indexes as a 2 values array. Mustn't be NULL
Returns:
true if the coincidence has been found

References get_lat_index(), and get_lon_index().

const bool MeteoFileData::get_index ( const float &  lat,
const float &  lon,
const double &  time,
int *  index 
) [virtual]

search the indexes of the data coincident with the point (lat,lon,time) If the coincidence can't be found, the output indexes index will be set to {-1,-1,-1}

Parameters:
lat the latitude
lon the longitude
time the time (using TAI convention : in sec since the 1993/01/01)
index the output indexes as a 3 values array. Mustn't be NULL
Returns:
true if the coincidence has been found

References get_lat_index(), get_lon_index(), get_time_index(), load_time_level(), and time_level.

const int MeteoFileData::get_lat_index ( const float &  lat  )  const [virtual]

return the index of the grid latitude that is the nearest to lat.

Parameters:
lat the latitude
Returns:
the index, or -1 if out of range

References delta_lat.

Referenced by get_index().

const int MeteoFileData::get_lon_index ( const float &  lon  )  const [virtual]

return the index of the grid longitude that is the nearest to lon.

Parameters:
lon the longitude
Returns:
the index, or -1 if out of range

References delta_lon.

Referenced by get_index().

const unsigned short MeteoFileData::get_nb_height_level (  ) 

access to the number of height levels

Returns:
the number of height levels

References nb_height_level.

short MeteoFileData::get_nb_time_level (  )  const [inline]

get the number of time levels for this type of meteo file

Returns:
the number of time levels

References nb_time_level.

const unsigned short MeteoFileData::get_nb_time_level (  ) 

access to the number of time levels load the time level if needed

Returns:
the number of time levels

References nb_time_level.

const int MeteoFileData::get_time_index ( const double &  time  )  const [virtual]

return the index of the grid time that is the nearest to lon.

Parameters:
time the time
Returns:
the index, or -1 if out of range

References FileData::date, delta_time, Date::get_TAI93_time(), nb_time_level, and FileData::time_coverage.

Referenced by get_index().

const double * MeteoFileData::get_time_level (  ) 

return the time level values load the time level if needed

Returns:
the time values vector

References time_level.

double MeteoFileData::get_time_max (  )  const [virtual]

access to the time of the end of the acquisition

Returns:
the time of the end of the acquisition (using TAI convention : in sec since the 1993/01/01)

References FileData::date, Date::get_TAI93_time(), and FileData::time_coverage.

double MeteoFileData::get_time_min (  )  const [virtual]

access to the time of the start of the acquisition

Returns:
the time of the begining of the acquisition (using TAI convention : in sec since the 1993/01/01)

References FileData::date, and Date::get_TAI93_time().

const bool MeteoFileData::is_height_level_loaded (  )  const [protected, virtual]

check if the height levels have already been set

Warning:
for 2D products (that aven't got height levels) return true
Returns:
true if the height levels are set

References height_level.

const bool MeteoFileData::is_time_level_loaded (  )  const [protected, virtual]

check if the time levels have already been set

Returns:
true if the time levels are set

References time_level.

virtual void MeteoFileData::parse_filename ( const std::string &  filename  )  [protected, pure virtual]

extract some informations using the filename (acquisition start time,etc) PRECONDITION the file name must be valid. The validity check is done by check_filename

Parameters:
filename the filename without its path

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