#include <parasoldata.h>
Public Member Functions | |
PARASOLData (const string data_filename="") | |
void | print_data_file_descriptor () |
virtual void | print_data () |
bool | read_data (void *buf, const int ¶m_index, int *start, int *edges, const int rank) |
read the data in the parasol data file | |
const PARASOLDataFormat * | get_data_file_format () |
access to the data file format for a given product | |
const int | get_nb_data_record () const |
access to the number of data' records contained in the file | |
const int | get_sz_data_record () const |
access to the size of one data record | |
const int | get_data_entry_index (const string &var_name) const |
retrieve the index of a parameter's in the data record If the entry isn't a parameter,throws an bad_parametre Exception | |
const int | get_nb_val (const string &var_name, const int edges=-1, const int dir_idx=-1) const |
retrieve the number of values that will be read for the given variable using the given indexes | |
const int | get_nb_val (const int &var_index, const int edges=-1, const int dir_idx=-1) const |
retrieve the number of values that will be read for the given variable using the given indexes | |
Public Attributes | |
DataFileDescriptorRecord * | data_file_descriptor |
Protected Member Functions | |
virtual void | read_data_file (const string &data_filename) |
const bool | is_record_loaded (const Record &rec) |
check if a record has been read. | |
void | free_records () |
Free the objects used to store the values read in the file records. | |
PARASOLFileRecord * | init_record (const Record &rec) |
Initialize a record class. | |
const int | get_record_offset (const Record &rec) |
access to ones record file offset If the record isn't in the data data file, it returns -1 | |
virtual const RecordFormat * | get_record_format (const Record &rec) |
access to the RecordFormat object that describes the name, type, offset and length of each record entry | |
PARASOLFileRecord * | get_record (const Record &rec) |
access to one record entry | |
vector< EntryBlock > | get_entry_block (const Record rec, const int entry_idx) const |
This method implements the interface of PARASOLFileReader, which is an abstraction for describing a group of repeated entries either in a data record or in a leader one. In th particular case of data record (so on, here), nb_val as the particular meaning of "number of viewing directions". | |
template<class T > | |
void | apply_scaling (double *scaled_data, const T *count_data, const double &slope, const double &offset, const int &nb_val, const T count_fill_value=T(0)) |
access to the offset of an entry, relative to the record start | |
Protected Attributes | |
string | filename |
DataRecord * | data |
Friends | |
class | PARASOLFileData |
Interface for managing the reading of a PARASOL data file.
void PARASOLData::apply_scaling | ( | double * | scaled_data, | |
const T * | count_data, | |||
const double & | slope, | |||
const double & | offset, | |||
const int & | nb_val, | |||
const T | count_fill_value = T(0) | |||
) | [protected] |
access to the offset of an entry, relative to the record start
rec | the concerned record. Unused here. Set it to DATA | |
entry_idx | index of the entry | |
record_idx | index of the data record to read | |
direction_index | index of the direction (useful only for directionnal parameters) | |
val_index | unused |
scaled_data | the output scaled data. Must be allocated | |
count_data | the input count data. Musn't be NULL | |
slope | the slope | |
offset | the offset | |
nb_val | the number of values |
References PARASOLFileData::get_level().
Referenced by PARASOLFileData::read_scaled_data().
const int PARASOLData::get_data_entry_index | ( | const string & | var_name | ) | const |
retrieve the index of a parameter's in the data record If the entry isn't a parameter,throws an bad_parametre Exception
var_name | the name of the variable |
References PARASOLDataFormat::get_entry_index().
Referenced by PARASOLFileData::get_data_dimension(), PARASOLFileData::get_scaling(), and PARASOLFileData::read_scaled_data().
const PARASOLDataFormat* PARASOLData::get_data_file_format | ( | ) | [inline] |
access to the data file format for a given product
Referenced by PARASOLFileData::get_entry_format(), get_record_format(), print_data_file_descriptor(), PARASOLFileData::read_count_data(), and read_data().
vector< EntryBlock > PARASOLData::get_entry_block | ( | const Record | rec, | |
const int | entry_idx | |||
) | const [protected, virtual] |
This method implements the interface of PARASOLFileReader, which is an abstraction for describing a group of repeated entries either in a data record or in a leader one. In th particular case of data record (so on, here), nb_val as the particular meaning of "number of viewing directions".
record_code | the code of the record | |
entry_group_start | the first entry of the group | |
entry_group_end | (output) the last entry of the group. For entries of one value, the next entrie | |
nb_val | (output) the number of viewing directions. For entries of one value, 1 returns the size (in bytes) an a group that contains the given entry. If the entry is not repeated in a record, returns 0 |
bad_parametre_idx | if the entry idx is invalid for the current product |
entry_idx | index of the entry (product specific) |
bad_parametre_idx | if the entry idx is invalid for the current product |
entry_idx | index of the entry (product specific) |
bad_parametre_idx | if the entry idx is invalid for the current product |
entry_idx | index of the entry (product specific) |
rec | current record | |
entry_idx | indice of the entry |
Implements PARASOLFileReader.
References get_nb_data_record(), get_sz_data_record(), and g_exception::set().
Referenced by PARASOLFileData::get_data_dimension(), get_nb_val(), and read_data().
const int PARASOLData::get_nb_data_record | ( | ) | const |
access to the number of data' records contained in the file
References DataFileDescriptorRecord::nb_data_rec.
Referenced by get_entry_block(), PARASOLFileData::get_nb_data(), PARASOLFileData::idata2igrid(), and PARASOLFileData::load_geolocation_data().
const int PARASOLData::get_nb_val | ( | const string & | var_name, | |
const int | edges = -1 , |
|||
const int | dir_idx = -1 | |||
) | const |
retrieve the number of values that will be read for the given variable using the given indexes
var_name | the name of the variable | |
edges | the number of records to read. -1 = all | |
dir_idx | the index of the direction to read (for directionnal parameters). -1 = all |
References PARASOLDataFormat::get_entry_index().
const int PARASOLData::get_nb_val | ( | const int & | var_index, | |
const int | edges = -1 , |
|||
const int | dir_idx = -1 | |||
) | const |
retrieve the number of values that will be read for the given variable using the given indexes
var_index | the index of the variable | |
edges | the number of records to read. -1 = all | |
dir_idx | the index of the direction to read (for directionnal parameters). -1 = all |
References get_entry_block(), and DataFileDescriptorRecord::nb_data_rec.
PARASOLFileRecord * PARASOLData::get_record | ( | const Record & | rec | ) | [protected, virtual] |
access to one record entry
rec | the record code |
Implements PARASOLFileReader.
Referenced by is_record_loaded().
const RecordFormat * PARASOLData::get_record_format | ( | const Record & | rec | ) | [protected, virtual] |
access to the RecordFormat object that describes the name, type, offset and length of each record entry
rec | the record code |
Implements PARASOLFileReader.
References get_data_file_format().
const int PARASOLData::get_record_offset | ( | const Record & | rec | ) | [protected, virtual] |
access to ones record file offset If the record isn't in the data data file, it returns -1
rec | the record code |
Implements PARASOLFileReader.
References init_record(), is_record_loaded(), PARASOLFileReader::read_record(), and PARASOLFileRecord::rec_len.
Referenced by read_data().
const int PARASOLData::get_sz_data_record | ( | ) | const |
access to the size of one data record
References DataFileDescriptorRecord::one_data_rec_len.
Referenced by get_entry_block().
PARASOLFileRecord * PARASOLData::init_record | ( | const Record & | rec | ) | [protected, virtual] |
Initialize a record class.
rec | the record code |
Implements PARASOLFileReader.
Referenced by get_record_offset().
const bool PARASOLData::is_record_loaded | ( | const Record & | rec | ) | [protected, virtual] |
check if a record has been read.
Implements PARASOLFileReader.
References get_record().
Referenced by get_record_offset().
void PARASOLData::print_data_file_descriptor | ( | ) |
Print the data file descriptor on the standard output
References DataFileDescriptorRecord::data_rec_data_len, DataFileDescriptorRecord::data_rec_prefix_len, DataFileDescriptorRecord::data_rec_suffix_len, DataFileDescriptorRecord::file_nb, DataFileDescriptorRecord::filename, get_data_file_format(), DataFileDescriptorRecord::nb_data_rec, DataFileDescriptorRecord::one_data_rec_len, PARASOLFileRecord::rec_len, PARASOLFileRecord::rec_nb, DataFileDescriptorRecord::ref_doc_id, DataFileDescriptorRecord::ref_doc_version, and DataFileDescriptorRecord::soft_version.
bool PARASOLData::read_data | ( | void * | buf, | |
const int & | param_index, | |||
int * | start, | |||
int * | edges, | |||
const int | rank | |||
) |
read the data in the parasol data file
buf | the buffer to be fill. MUST BE ALLOCATED | |
param_index | the index of the parameter to extract | |
start | the start data record index. DON'T USE IT | |
edges | the number of data records to read. DON'T USE IT | |
dir_idx | the index of the direction for directionnal parameters. DON'T USE IT |
References PARASOLFileReader::fill_buffer_default(), get_data_file_format(), get_entry_block(), PARASOLFileReader::get_entry_offset(), get_record_offset(), PARASOLFileFormat::get_size_of(), PARASOLFileReader::inc_ptr(), PARASOLFileReader::is_file_loaded(), and PARASOLFileReader::swap_endianess().