The SMETWriter class that enables to write a SMET formatted file. The user constructs a SMETWriter class and fills in the header values Finally the user may call write(...) and pass the data to be written.
- Author
- Thomas Egger
- Date
- 2011-07-14
#include <libsmet.h>
|
| SMETWriter (const std::string &in_filename, const SMETType &in_type=ASCII) |
| The constructor allows to set the filename, the type and whether the file should be gzipped. More...
|
|
| SMETWriter (const std::string &in_filename, const std::string &in_fields, const double &in_nodata) |
| The constructor allows to append data to an existing file. More...
|
|
void | set_header_value (const std::string &key, const std::string &value) |
| Set a key, value pair in the SMET header (both strings) More...
|
|
void | set_header_value (const std::string &key, const double &value) |
| Set a double value for a string key in a SMET header. More...
|
|
void | write (const std::vector< std::string > &vec_timestamp, const std::vector< double > &data) |
| Write a SMET file, providing ASCII ISO formatted timestamps and data. More...
|
|
void | write (const std::vector< double > &data) |
| Write a SMET file, providing a vector of doubles. More...
|
|
void | set_precision (const std::vector< int > &vec_precision) |
| Set precision for each field (except timestamp), otherwise a default precision of 3 is used for each column. More...
|
|
void | set_width (const std::vector< int > &vec_width) |
| Set width for each field (except timestamp), otherwise a default width of 8 is used for each column. More...
|
|
const std::string | toString () const |
|
smet::SMETWriter::SMETWriter |
( |
const std::string & |
in_filename, |
|
|
const SMETType & |
in_type = ASCII |
|
) |
| |
The constructor allows to set the filename, the type and whether the file should be gzipped.
- Parameters
-
[in] | in_filename | The filename of the SMET file to be written |
[in] | in_type | The type of the SMET file, i.e. smet::ASCII or smet::BINARY (default: ASCII) |
smet::SMETWriter::SMETWriter |
( |
const std::string & |
in_filename, |
|
|
const std::string & |
in_fields, |
|
|
const double & |
in_nodata |
|
) |
| |
The constructor allows to append data to an existing file.
- Parameters
-
[in] | in_filename | The filename of the SMET file to be written |
[in] | in_fields | The fields that should be written in order to check that we write the same data at the same place. |
[in] | in_nodata | Value representing nodata |
void smet::SMETWriter::set_header_value |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| |
Set a key, value pair in the SMET header (both strings)
- Parameters
-
[in] | key | A string key to set in the header (overwritten if already present) |
[in] | value | A string value associated with the key |
void smet::SMETWriter::set_header_value |
( |
const std::string & |
key, |
|
|
const double & |
value |
|
) |
| |
Set a double value for a string key in a SMET header.
- Parameters
-
[in] | key | A string key to set in the header (overwritten if already present) |
[in] | value | A double value to be converted into a string and stored in the header |
void smet::SMETWriter::set_precision |
( |
const std::vector< int > & |
vec_precision | ) |
|
Set precision for each field (except timestamp), otherwise a default precision of 3 is used for each column.
- Parameters
-
[in] | vec_precision | Set the precision for every column to be written (timestamp is not counted if present) |
void smet::SMETWriter::set_width |
( |
const std::vector< int > & |
vec_width | ) |
|
Set width for each field (except timestamp), otherwise a default width of 8 is used for each column.
- Parameters
-
[in] | vec_width | Set the width for every column to be written (timestamp is not counted if present) |
const std::string smet::SMETWriter::toString |
( |
| ) |
const |
void smet::SMETWriter::write |
( |
const std::vector< std::string > & |
vec_timestamp, |
|
|
const std::vector< double > & |
data |
|
) |
| |
Write a SMET file, providing ASCII ISO formatted timestamps and data.
- Parameters
-
[in] | vec_timestamp | A vector with one ASCII date/time combined string for each line |
[in] | data | All the data to be written sequentially into the columns, the data is aligned sequentially, not per line; Total size of the vector: Total size of the vector: vec_timestamp.size() * nr_of_fields (timestamp is not counted as field) |
void smet::SMETWriter::write |
( |
const std::vector< double > & |
data | ) |
|
Write a SMET file, providing a vector of doubles.
- Parameters
-
[in] | data | All the data to be written sequentially into the columns, the data is aligned sequentially, not per line; |
The documentation for this class was generated from the following files: