Enumerations | |
enum | ProcessingLevel { raw = 1 , filtered = 1 << 1 , resampled = 1 << 2 , generated = 1 << 3 , num_of_levels = 1 << 4 } |
enum | OperationMode { STD , VSTATIONS , GRID_1DINTERPOLATE , GRID_EXTRACT , GRID_EXTRACT_PTS , GRID_SMART , GRID_ALL , GRID_RESAMPLE } |
Keywords for mode of operation. Please keep all the GRID_xxx last! More... | |
enum | ThrowOptions { dothrow , nothrow } |
Functions | |
double | bearing_to_angle (const double &bearing) |
Converts a compass bearing to a trigonometric angle. More... | |
double | angle_to_bearing (const double &angle) |
Converts a trigonometric angle to a compass bearing. More... | |
double | bearing (std::string bearing_str) |
Converts a string bearing to a compass bearing. More... | |
std::string | bearing (double bearing) |
Converts a compass bearing to a string bearing. More... | |
void | stripComments (std::string &str) |
void | stripComments (std::string &str, const char &comment_mk) |
void | cleanEscapedCharacters (std::string &str, const std::vector< char > &escaped_chars) |
void | trim (std::string &s) |
Removes trailing and leading whitespaces, tabs and newlines from a string. More... | |
std::string | trim (const std::string &s) |
Removes trailing and leading whitespaces, tabs and newlines from a string. More... | |
void | replace_all (std::string &input, const std::string &search, const std::string &format) |
Replace a substring within a given string by another one. More... | |
bool | isWhitespace (const char &c) |
bool | isTwoSpaces (const char &a, const char &b) |
bool | isTwoTabs (const char &a, const char &b) |
bool | isInvalidChar (const char &c) |
bool | isQuote (const char &c) |
bool | isSpecialChar (const char &c, const std::set< char > &specialChars) |
void | removeDuplicateWhitespaces (std::string &line) |
Removes consecutive occurrences of spaces and tabs. More... | |
void | replaceWhitespaces (std::string &line, const char &rep='\0') |
Replaces spaces and tabs with a single character or removes them. More... | |
void | replaceInvalidChars (std::string &line, const char &rep='\0') |
Replaces invalid characters with a single character or removes them. More... | |
void | removeQuotes (std::string &line) |
Removes single and double quotation marks. More... | |
void | removeChars (std::string &line, const std::set< char > &specialChars) |
Removes any character present in the provided set from the given line. More... | |
void | cleanFieldName (std::string &field, const bool &clean_whitespaces=true, const char &rep='-') |
Cleans up a string to be usable as, for example, a parameter name. More... | |
size_t | count (const std::string &input, const std::string &search) |
count how many times a substring appears in a string More... | |
size_t | FNV_hash (const std::string &text) |
Fowler/Noll/Vo hash function (FNV-1a) More... | |
void | toUpper (std::string &str) |
void | toLower (std::string &str) |
std::string | strToUpper (std::string str) |
std::string | strToLower (std::string str) |
bool | isNumeric (std::string str, const unsigned int &nBase) |
bool | readKeyValuePair (const std::string &in_line, const std::string &delimiter, std::string &key, std::string &value, const bool &setToUpperCase=false) |
read a string line, parse it and save it into a map object, that is passed by reference More... | |
std::string | getLogName () |
Retrieve the user name This checks various environment variables (USERNAME, USER, LOGNAME). More... | |
std::string | getHostName () |
Retrieve the name of the computer running the binary. More... | |
std::string | getDomainName () |
Retrieve the domain name of the computer running the binary. More... | |
size_t | readLineToVec (const std::string &line_in, std::vector< double > &vec_data) |
size_t | readLineToSet (const std::string &line_in, std::set< std::string > &setString) |
size_t | readLineToVec (const std::string &line_in, std::vector< std::string > &vecString) |
size_t | readLineToVec (const std::string &line_in, std::vector< std::string > &vecString, const char &delim) |
size_t | readLineToVec (const std::string &line_in, std::vector< double > &vecRet, const char &delim) |
std::vector< std::string > | split (const std::string &s, char delimiter) |
std::vector< std::string > | split (const std::string &s, std::string delimiter) |
template<> | |
bool | convertString< std::string > (std::string &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< bool > (bool &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< double > (double &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< char > (char &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< unsigned int > (unsigned int &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
bool | convertString (Date &t, std::string str, const double &time_zone, std::ios_base &(*f)(std::ios_base &)) |
Convert a string to a date (template specialization of convertString) More... | |
template<> | |
bool | convertString< Coords > (Coords &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
void | getProjectionParameters (const Config &cfg, std::string &coordin, std::string &coordinparam, std::string &coordout, std::string &coordoutparam) |
A function that parses a Config object for COORSYS, COORDPARAM keywords in [Input] and [Output] section and sets the respective strings to the values of those keywords. More... | |
void | getProjectionParameters (const Config &cfg, std::string &coordin, std::string &coordinparam) |
A function that parses a Config object for COORSYS, COORDPARAM keywords in the [Input] section and sets the respective strings to the values of those keywords. More... | |
void | getTimeZoneParameters (const Config &cfg, double &tz_in, double &tz_out) |
A function that parses a Config object for the time_zone keyword and returns the timezone. More... | |
size_t | seek (const Date &soughtdate, const std::vector< MeteoData > &vecM, const bool &exactmatch=true) |
Search for an element at a given date in a vector of MeteoData. The position of the matching date is returned or IOUtils::npos if not found. If exactmatch=false, the position of the first element after soughtdate is returned (or IOUtils::npos if this is not possible / relevant). More... | |
double | unitsPrefix (const char &prefix) |
Convert a textual representation of a unit prefix (like 'm' or 'G') to multiplying factor. More... | |
double | unitsConversion (const double &val, std::string unitIn, std::string unitOut) |
Performs simple unit conversion (supports temperature, prefixes and exponents) NOTE "composite" units such as 'K/m' or 'N/m2' are currently NOT supported. More... | |
double | C_TO_K (const double &T) |
double | K_TO_C (const double &T) |
double | UV_TO_DW (const double &U, const double &V) |
From wind speed components (u,v) to wind direction, following standard meteorological definitions: U is positive with positive easting/longitude. V is positive with positive northing/latitude. Direction is the angle the wind comes from. More... | |
double | VWDW_TO_U (const double &VW, const double &DW) |
From wind speed and direction to u component (west-to-east) More... | |
double | VWDW_TO_V (const double &VW, const double &DW) |
From wind speed and direction to v component (south-to-north) More... | |
bool | checkEpsilonEquality (const double &val1, const double &val2, const double &epsilon) |
Check whether two values are equal regarding a certain epsilon environment (within certain radius of each other) More... | |
template<class T > | |
std::string | toString (const T &t) |
template<class T > | |
bool | convertString (T &t, std::string str, std::ios_base &(*f)(std::ios_base &)=std::dec) |
Convert a string to the requested type (template function). More... | |
template<> | |
bool | convertString< double > (double &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< std::string > (std::string &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< bool > (bool &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< char > (char &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< unsigned int > (unsigned int &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<> | |
bool | convertString< Coords > (Coords &t, std::string str, std::ios_base &(*f)(std::ios_base &)) |
template<class T > | |
void | getValueForKey (const std::map< std::string, std::string > &properties, const std::string &key, T &t, const ThrowOptions &options=IOUtils::dothrow) |
Returns, with the requested type, the value associated to a key (template function). More... | |
template<class T > | |
void | getValueForKey (const std::map< std::string, std::string > &properties, const std::string &key, std::vector< T > &vecT, const ThrowOptions &options=IOUtils::dothrow) |
Returns, with the requested type, the value associated to a key (template function). More... | |
template<class T > | |
T | standardizeNodata (const T &value, const double &plugin_nodata) |
Standardize a given value to use MeteoIO's internal nodata value (if applicable) More... | |
template<class T > | |
static void | parseArg (const std::pair< std::string, std::string > &arg, const std::string &algo, T &val) |
Parse a given named argument. More... | |
Variables | |
static const char | ALPHANUM [] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" |
static const char | NUM [] = "0123456789" |
const double | nodata = -999.0 |
This is the internal nodata value. More... | |
const unsigned int | unodata = static_cast<unsigned int>(-1) |
const int | inodata = -999 |
const short int | snodata = -999 |
const char | cnodata = std::numeric_limits<char>::max() |
const size_t | npos = static_cast<size_t>(-1) |
npos is the out-of-range value More... | |
const double | grid_epsilon = 5. |
What is an acceptable small distance on a grid, in meters. More... | |
const double | lon_epsilon = grid_epsilon / Cst::earth_R0 * Cst::to_deg |
in degrees. Small angle for longitudes, so sin(x)=x More... | |
const double | lat_epsilon = lon_epsilon |
in degrees. Small angle for latitudes. More... | |
Keywords for mode of operation. Please keep all the GRID_xxx last!
double mio::IOUtils::angle_to_bearing | ( | const double & | angle | ) |
Converts a trigonometric angle to a compass bearing.
angle | trigonometric angle (0° on the right, counterclockwise, in [0, 2PI[) |
std::string mio::IOUtils::bearing | ( | double | bearing | ) |
Converts a compass bearing to a string bearing.
bearing | (0° on top, clockwise, in [0°, 360°[) |
double mio::IOUtils::bearing | ( | std::string | bearing_str | ) |
Converts a string bearing to a compass bearing.
bearing_str | as N, NE, SSW, etc |
double mio::IOUtils::bearing_to_angle | ( | const double & | bearing | ) |
Converts a compass bearing to a trigonometric angle.
bearing | compass bearing (0° on top, clockwise, in [0°, 360°[) |
|
inline |
|
inline |
Check whether two values are equal regarding a certain epsilon environment (within certain radius of each other)
val1 | |
val2 | |
epsilon | is a radius around val1 |
void mio::IOUtils::cleanEscapedCharacters | ( | std::string & | str, |
const std::vector< char > & | escaped_chars | ||
) |
void mio::IOUtils::cleanFieldName | ( | std::string & | field, |
const bool & | clean_whitespaces = true , |
||
const char & | rep = '-' |
||
) |
Cleans up a string to be usable as, for example, a parameter name.
This replaces all whitespaces (including consecutive ones) with a single character or removes them, and removes invalid characters and quotes.
field | The string to read and modify | |
[in] | clean_whitespaces | Should tabs and spaces be replaced? (default: true) |
[in] | rep | Substitute string (default: '-'). Set to empty ('\0') to remove. |
bool mio::IOUtils::convertString | ( | Date & | t, |
std::string | str, | ||
const double & | time_zone, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
Convert a string to a date (template specialization of convertString)
The date formats that are recognized are described in the Date class.
[out] | t | The value converted to a Date object. |
[in] | str | The input string to convert; trailling whitespaces are ignored, comment after non-string values are allowed, but multiple values are not allowed. |
[in] | time_zone | The timezone the provided date is into |
[in] | f | The radix for reading numbers, such as std::dec or std::oct; default is std::dec. |
bool mio::IOUtils::convertString | ( | T & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f = std::dec |
||
) |
Convert a string to the requested type (template function).
T | [in] The type wanted for the return value (template type parameter). |
t | [out] The value converted to the requested type. |
str | [in] The input string to convert; trailling whitespaces are ignored, comment after non-string values are allowed, but multiple values are not allowed. |
f | [in] The radix for reading numbers, such as std::dec or std::oct; default is std::dec. |
bool mio::IOUtils::convertString< bool > | ( | bool & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< bool > | ( | bool & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< char > | ( | char & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< char > | ( | char & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< Coords > | ( | Coords & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< Coords > | ( | Coords & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< double > | ( | double & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< double > | ( | double & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< std::string > | ( | std::string & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< std::string > | ( | std::string & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< unsigned int > | ( | unsigned int & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
bool mio::IOUtils::convertString< unsigned int > | ( | unsigned int & | t, |
std::string | str, | ||
std::ios_base &(*)(std::ios_base &) | f | ||
) |
size_t mio::IOUtils::count | ( | const std::string & | input, |
const std::string & | search | ||
) |
count how many times a substring appears in a string
This should be quite similar to Boost::replace_all.
[in] | input | string to manipulate |
[in] | search | substring to be searched for |
size_t mio::IOUtils::FNV_hash | ( | const std::string & | text | ) |
Fowler/Noll/Vo hash function (FNV-1a)
This returns a non-cryptographic, 32 bits hash for the string given as argument (see https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function or https://tools.ietf.org/html/draft-eastlake-fnv-16)
[in] | text | string to get a hash for |
std::string mio::IOUtils::getDomainName | ( | ) |
Retrieve the domain name of the computer running the binary.
std::string mio::IOUtils::getHostName | ( | ) |
Retrieve the name of the computer running the binary.
std::string mio::IOUtils::getLogName | ( | ) |
Retrieve the user name This checks various environment variables (USERNAME, USER, LOGNAME).
void mio::IOUtils::getProjectionParameters | ( | const Config & | cfg, |
std::string & | coordin, | ||
std::string & | coordinparam | ||
) |
A function that parses a Config object for COORSYS, COORDPARAM keywords in the [Input] section and sets the respective strings to the values of those keywords.
[in] | cfg | A Config object |
[out] | coordin | The coordinate system to be used for input data |
[out] | coordinparam | The coordinate system parameters to be used for output data |
void mio::IOUtils::getProjectionParameters | ( | const Config & | cfg, |
std::string & | coordin, | ||
std::string & | coordinparam, | ||
std::string & | coordout, | ||
std::string & | coordoutparam | ||
) |
A function that parses a Config object for COORSYS, COORDPARAM keywords in [Input] and [Output] section and sets the respective strings to the values of those keywords.
[in] | cfg | A Config object |
[out] | coordin | The coordinate system to be used for input data |
[out] | coordinparam | The coordinate system parameters to be used for output data |
[out] | coordout | The coordinate system to be used for output data |
[out] | coordoutparam | The coordinate system parameters to be used for output data |
void mio::IOUtils::getTimeZoneParameters | ( | const Config & | cfg, |
double & | tz_in, | ||
double & | tz_out | ||
) |
void mio::IOUtils::getValueForKey | ( | const std::map< std::string, std::string > & | properties, |
const std::string & | key, | ||
std::vector< T > & | vecT, | ||
const ThrowOptions & | options = IOUtils::dothrow |
||
) |
Returns, with the requested type, the value associated to a key (template function).
T | [in] The type wanted for the return value (template type parameter). |
[in] | properties | A map containing all the parameters. |
[in] | key | The key of the parameter to retrieve. |
[out] | vecT | The vector of values associated to the key, each value is converted to the requested type |
[in] | options | Extra options, by default IOUtils::dothrow |
void mio::IOUtils::getValueForKey | ( | const std::map< std::string, std::string > & | properties, |
const std::string & | key, | ||
T & | t, | ||
const ThrowOptions & | options = IOUtils::dothrow |
||
) |
Returns, with the requested type, the value associated to a key (template function).
T | [in] The type wanted for the return value (template type parameter). |
[in] | properties | A map containing all the parameters. |
[in] | key | The key of the parameter to retrieve. |
[out] | t | The value associated to the key, converted to the requested type |
[in] | options | Extra options, by default IOUtils::dothrow |
|
inline |
bool mio::IOUtils::isNumeric | ( | std::string | str, |
const unsigned int & | nBase | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
Parse a given named argument.
T[in] | The type wanted for the return value (template type parameter). |
[in] | arg | key/value pair to be parsed |
[in] | algo | the name of the filter or algorithm (for error messages) |
[out] | val | the parsed value |
bool mio::IOUtils::readKeyValuePair | ( | const std::string & | in_line, |
const std::string & | delimiter, | ||
std::string & | key, | ||
std::string & | value, | ||
const bool & | setToUpperCase = false |
||
) |
read a string line, parse it and save it into a map object, that is passed by reference
in_line | (const string&) string to parse |
delimiter | (const string&) delimiter to use for the parsing |
setToUpperCase | If set to true the key will be put into upper case (for case insensitivity) |
key | retrieved key |
value | retrieved value |
size_t mio::IOUtils::readLineToSet | ( | const std::string & | line_in, |
std::set< std::string > & | setString | ||
) |
size_t mio::IOUtils::readLineToVec | ( | const std::string & | line_in, |
std::vector< double > & | vec_data | ||
) |
size_t mio::IOUtils::readLineToVec | ( | const std::string & | line_in, |
std::vector< double > & | vecRet, | ||
const char & | delim | ||
) |
size_t mio::IOUtils::readLineToVec | ( | const std::string & | line_in, |
std::vector< std::string > & | vecString | ||
) |
size_t mio::IOUtils::readLineToVec | ( | const std::string & | line_in, |
std::vector< std::string > & | vecString, | ||
const char & | delim | ||
) |
void mio::IOUtils::removeChars | ( | std::string & | line, |
const std::set< char > & | specialChars | ||
) |
Removes any character present in the provided set from the given line.
line | The string to read and modify |
specialChars | The characters to exclude |
void mio::IOUtils::removeDuplicateWhitespaces | ( | std::string & | line | ) |
Removes consecutive occurrences of spaces and tabs.
line | The string to read and modify |
void mio::IOUtils::removeQuotes | ( | std::string & | line | ) |
Removes single and double quotation marks.
line | The string to read and modify |
void mio::IOUtils::replace_all | ( | std::string & | input, |
const std::string & | search, | ||
const std::string & | format | ||
) |
Replace a substring within a given string by another one.
This should be quite similar to Boost::replace_all.
input | string to manipulate | |
[in] | search | substring to be searched for |
[in] | format | substitute string |
void mio::IOUtils::replaceInvalidChars | ( | std::string & | line, |
const char & | rep = '\0' |
||
) |
Replaces invalid characters with a single character or removes them.
line | The string to read and modify |
rep | The character to replace with (default: empty) |
void mio::IOUtils::replaceWhitespaces | ( | std::string & | line, |
const char & | rep = '\0' |
||
) |
Replaces spaces and tabs with a single character or removes them.
line | The string to read and modify |
rep | The character to replace with (default: empty) |
size_t mio::IOUtils::seek | ( | const Date & | soughtdate, |
const std::vector< MeteoData > & | vecM, | ||
const bool & | exactmatch = true |
||
) |
Search for an element at a given date in a vector of MeteoData. The position of the matching date is returned or IOUtils::npos if not found. If exactmatch=false, the position of the first element after soughtdate is returned (or IOUtils::npos if this is not possible / relevant).
[in] | soughtdate | date that should be found |
[in] | vecM | vector that should contain the data |
[in] | exactmatch | if the exact requested date is not found, return npos |
std::vector< std::string > mio::IOUtils::split | ( | const std::string & | s, |
char | delimiter | ||
) |
std::vector< std::string > mio::IOUtils::split | ( | const std::string & | s, |
std::string | delimiter | ||
) |
T mio::IOUtils::standardizeNodata | ( | const T & | value, |
const double & | plugin_nodata | ||
) |
Standardize a given value to use MeteoIO's internal nodata value (if applicable)
T[in] | The type wanted for the return value (template type parameter). |
[in] | value | the value to check/convert |
[in] | plugin_nodata | plugin-specific nodata value |
void mio::IOUtils::stripComments | ( | std::string & | str | ) |
void mio::IOUtils::stripComments | ( | std::string & | str, |
const char & | comment_mk | ||
) |
std::string mio::IOUtils::strToLower | ( | std::string | str | ) |
std::string mio::IOUtils::strToUpper | ( | std::string | str | ) |
void mio::IOUtils::toLower | ( | std::string & | str | ) |
std::string mio::IOUtils::toString | ( | const T & | t | ) |
void mio::IOUtils::toUpper | ( | std::string & | str | ) |
std::string mio::IOUtils::trim | ( | const std::string & | s | ) |
Removes trailing and leading whitespaces, tabs and newlines from a string.
s | The string to trim |
void mio::IOUtils::trim | ( | std::string & | s | ) |
Removes trailing and leading whitespaces, tabs and newlines from a string.
s | The reference of the string to trim (in/out parameter) |
double mio::IOUtils::unitsConversion | ( | const double & | val, |
std::string | unitIn, | ||
std::string | unitOut | ||
) |
Performs simple unit conversion (supports temperature, prefixes and exponents) NOTE "composite" units such as 'K/m' or 'N/m2' are currently NOT supported.
val | value to convert |
unitIn | units of the input |
unitOut | units to convert to return value, expressed in unitOut |
double mio::IOUtils::unitsPrefix | ( | const char & | prefix | ) |
Convert a textual representation of a unit prefix (like 'm' or 'G') to multiplying factor.
prefix | unit prefix return multiplying factor |
|
inline |
From wind speed components (u,v) to wind direction, following standard meteorological definitions: U is positive with positive easting/longitude. V is positive with positive northing/latitude. Direction is the angle the wind comes from.
U | (west-to-east component) |
V | (south-to-north component) |
|
inline |
From wind speed and direction to u component (west-to-east)
VW | (wind speed) |
DW | (wind direction) |
|
inline |
From wind speed and direction to v component (south-to-north)
VW | (wind speed) |
DW | (wind direction) |
|
static |
const char mio::IOUtils::cnodata = std::numeric_limits<char>::max() |
const double mio::IOUtils::grid_epsilon = 5. |
What is an acceptable small distance on a grid, in meters.
const int mio::IOUtils::inodata = -999 |
const double mio::IOUtils::lat_epsilon = lon_epsilon |
in degrees. Small angle for latitudes.
const double mio::IOUtils::lon_epsilon = grid_epsilon / Cst::earth_R0 * Cst::to_deg |
in degrees. Small angle for longitudes, so sin(x)=x
const double mio::IOUtils::nodata = -999.0 |
This is the internal nodata value.
const size_t mio::IOUtils::npos = static_cast<size_t>(-1) |
npos is the out-of-range value
|
static |
const short int mio::IOUtils::snodata = -999 |
const unsigned int mio::IOUtils::unodata = static_cast<unsigned int>(-1) |