MeteoIODoc 20241005.2ccf54a9
mio::IOUtils Namespace Reference

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 >
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...
 

Enumeration Type Documentation

◆ OperationMode

Keywords for mode of operation. Please keep all the GRID_xxx last!

Enumerator
STD 

default: extract timeseries from timeseries or grids from grids or spatially interpolate timeseries

VSTATIONS 

extract virtual stations as specified in the ini file

GRID_1DINTERPOLATE 

temporally interpolate existing grids (must be enumerated before GRID_EXTRACT)

GRID_EXTRACT 

extract data from grids at locations provided in the ini file

GRID_EXTRACT_PTS 

as GRID_EXTRACT, but queries plugin only for virtual stations points, instead of full grids

GRID_SMART 

extract all relevant grid points from a provided grid

GRID_ALL 

extract all grid points from a provided grid

GRID_RESAMPLE 

generate a grid at a different resolution

◆ ProcessingLevel

Enumerator
raw 
filtered 
resampled 
generated 
num_of_levels 

◆ ThrowOptions

Enumerator
dothrow 
nothrow 

Function Documentation

◆ angle_to_bearing()

double mio::IOUtils::angle_to_bearing ( const double &  angle)

Converts a trigonometric angle to a compass bearing.

Parameters
angletrigonometric angle (0° on the right, counterclockwise, in [0, 2PI[)
Returns
bearing (0° on top, clockwise, in [0°, 360°[)

◆ bearing() [1/2]

std::string mio::IOUtils::bearing ( double  bearing)

Converts a compass bearing to a string bearing.

Parameters
bearing(0° on top, clockwise, in [0°, 360°[)
Returns
bearing_str as N, NE, SSW, etc

◆ bearing() [2/2]

double mio::IOUtils::bearing ( std::string  bearing_str)

Converts a string bearing to a compass bearing.

Parameters
bearing_stras N, NE, SSW, etc
Returns
bearing (0° on top, clockwise, in [0°, 360°[)

◆ bearing_to_angle()

double mio::IOUtils::bearing_to_angle ( const double &  bearing)

Converts a compass bearing to a trigonometric angle.

Parameters
bearingcompass bearing (0° on top, clockwise, in [0°, 360°[)
Returns
trigonometric angle (0° on the right, counterclockwise, in [0, 2PI[)

◆ C_TO_K()

double mio::IOUtils::C_TO_K ( const double &  T)
inline

◆ checkEpsilonEquality()

bool mio::IOUtils::checkEpsilonEquality ( const double &  val1,
const double &  val2,
const double &  epsilon 
)
inline

Check whether two values are equal regarding a certain epsilon environment (within certain radius of each other)

Parameters
val1
val2
epsilonis a radius around val1
Returns
true if val2 is within the radius around val1, false otherwise.

◆ cleanEscapedCharacters()

void mio::IOUtils::cleanEscapedCharacters ( std::string &  str,
const std::vector< char > &  escaped_chars 
)

◆ cleanFieldName()

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.

Parameters
fieldThe string to read and modify
[in]clean_whitespacesShould tabs and spaces be replaced? (default: true)
[in]repSubstitute string (default: '-'). Set to empty ('\0') to remove.

◆ convertString() [1/2]

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.

Parameters
[out]tThe value converted to a Date object.
[in]strThe input string to convert; trailling whitespaces are ignored, comment after non-string values are allowed, but multiple values are not allowed.
[in]time_zoneThe timezone the provided date is into
[in]fThe radix for reading numbers, such as std::dec or std::oct; default is std::dec.
Returns
true if everything went fine, false otherwise

◆ convertString() [2/2]

template<class T >
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).

Template Parameters
T[in] The type wanted for the return value (template type parameter).
Parameters
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.
Returns
true if everything went fine, false otherwise

◆ convertString< bool >() [1/2]

template<>
bool mio::IOUtils::convertString< bool > ( bool &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< bool >() [2/2]

template<>
bool mio::IOUtils::convertString< bool > ( bool &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< char >() [1/2]

template<>
bool mio::IOUtils::convertString< char > ( char &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< char >() [2/2]

template<>
bool mio::IOUtils::convertString< char > ( char &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< Coords >() [1/2]

template<>
bool mio::IOUtils::convertString< Coords > ( Coords t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< Coords >() [2/2]

template<>
bool mio::IOUtils::convertString< Coords > ( Coords t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< double >() [1/2]

template<>
bool mio::IOUtils::convertString< double > ( double &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< double >() [2/2]

template<>
bool mio::IOUtils::convertString< double > ( double &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< std::string >() [1/2]

template<>
bool mio::IOUtils::convertString< std::string > ( std::string &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< std::string >() [2/2]

template<>
bool mio::IOUtils::convertString< std::string > ( std::string &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< unsigned int >() [1/2]

template<>
bool mio::IOUtils::convertString< unsigned int > ( unsigned int &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ convertString< unsigned int >() [2/2]

template<>
bool mio::IOUtils::convertString< unsigned int > ( unsigned int &  t,
std::string  str,
std::ios_base &(*)(std::ios_base &)  f 
)

◆ count()

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.

Parameters
[in]inputstring to manipulate
[in]searchsubstring to be searched for
Returns
number of non-overlapping matches or std::string::npos if nothing could be found (empty "search", etc)

◆ FNV_hash()

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)

Parameters
[in]textstring to get a hash for
Returns
32 bits hash

◆ getDomainName()

std::string mio::IOUtils::getDomainName ( )

Retrieve the domain name of the computer running the binary.

Returns
domain with TLD

◆ getHostName()

std::string mio::IOUtils::getHostName ( )

Retrieve the name of the computer running the binary.

Returns
host name

◆ getLogName()

std::string mio::IOUtils::getLogName ( )

Retrieve the user name This checks various environment variables (USERNAME, USER, LOGNAME).

Returns
user name

◆ getProjectionParameters() [1/2]

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.

Parameters
[in]cfgA Config object
[out]coordinThe coordinate system to be used for input data
[out]coordinparamThe coordinate system parameters to be used for output data

◆ getProjectionParameters() [2/2]

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.

Parameters
[in]cfgA Config object
[out]coordinThe coordinate system to be used for input data
[out]coordinparamThe coordinate system parameters to be used for output data
[out]coordoutThe coordinate system to be used for output data
[out]coordoutparamThe coordinate system parameters to be used for output data

◆ getTimeZoneParameters()

void mio::IOUtils::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.

Parameters
[in]cfgA Config object
[out]tz_invalue to be used for the input timezone
[out]tz_outvalue to be used for the output timezone

◆ getValueForKey() [1/2]

template<class T >
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).

Template Parameters
T[in] The type wanted for the return value (template type parameter).
Parameters
[in]propertiesA map containing all the parameters.
[in]keyThe key of the parameter to retrieve.
[out]vecTThe vector of values associated to the key, each value is converted to the requested type
[in]optionsExtra options, by default IOUtils::dothrow

◆ getValueForKey() [2/2]

template<class T >
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).

Template Parameters
T[in] The type wanted for the return value (template type parameter).
Parameters
[in]propertiesA map containing all the parameters.
[in]keyThe key of the parameter to retrieve.
[out]tThe value associated to the key, converted to the requested type
[in]optionsExtra options, by default IOUtils::dothrow

◆ isInvalidChar()

bool mio::IOUtils::isInvalidChar ( const char &  c)
inline

◆ isNumeric()

bool mio::IOUtils::isNumeric ( std::string  str,
const unsigned int &  nBase 
)

◆ isQuote()

bool mio::IOUtils::isQuote ( const char &  c)
inline

◆ isSpecialChar()

bool mio::IOUtils::isSpecialChar ( const char &  c,
const std::set< char > &  specialChars 
)
inline

◆ isTwoSpaces()

bool mio::IOUtils::isTwoSpaces ( const char &  a,
const char &  b 
)
inline

◆ isTwoTabs()

bool mio::IOUtils::isTwoTabs ( const char &  a,
const char &  b 
)
inline

◆ isWhitespace()

bool mio::IOUtils::isWhitespace ( const char &  c)
inline

◆ K_TO_C()

double mio::IOUtils::K_TO_C ( const double &  T)
inline

◆ parseArg()

template<class T >
static void mio::IOUtils::parseArg ( const std::pair< std::string, std::string > &  arg,
const std::string &  algo,
T &  val 
)
static

Parse a given named argument.

Template Parameters
T[in]The type wanted for the return value (template type parameter).
Parameters
[in]argkey/value pair to be parsed
[in]algothe name of the filter or algorithm (for error messages)
[out]valthe parsed value

◆ readKeyValuePair()

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

Parameters
in_line(const string&) string to parse
delimiter(const string&) delimiter to use for the parsing
setToUpperCaseIf set to true the key will be put into upper case (for case insensitivity)
keyretrieved key
valueretrieved value
Returns
(bool) true when line is empty

◆ readLineToSet()

size_t mio::IOUtils::readLineToSet ( const std::string &  line_in,
std::set< std::string > &  setString 
)

◆ readLineToVec() [1/4]

size_t mio::IOUtils::readLineToVec ( const std::string &  line_in,
std::vector< double > &  vec_data 
)

◆ readLineToVec() [2/4]

size_t mio::IOUtils::readLineToVec ( const std::string &  line_in,
std::vector< double > &  vecRet,
const char &  delim 
)

◆ readLineToVec() [3/4]

size_t mio::IOUtils::readLineToVec ( const std::string &  line_in,
std::vector< std::string > &  vecString 
)

◆ readLineToVec() [4/4]

size_t mio::IOUtils::readLineToVec ( const std::string &  line_in,
std::vector< std::string > &  vecString,
const char &  delim 
)

◆ removeChars()

void mio::IOUtils::removeChars ( std::string &  line,
const std::set< char > &  specialChars 
)

Removes any character present in the provided set from the given line.

Parameters
lineThe string to read and modify
specialCharsThe characters to exclude

◆ removeDuplicateWhitespaces()

void mio::IOUtils::removeDuplicateWhitespaces ( std::string &  line)

Removes consecutive occurrences of spaces and tabs.

Parameters
lineThe string to read and modify

◆ removeQuotes()

void mio::IOUtils::removeQuotes ( std::string &  line)

Removes single and double quotation marks.

Parameters
lineThe string to read and modify

◆ replace_all()

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.

Parameters
inputstring to manipulate
[in]searchsubstring to be searched for
[in]formatsubstitute string

◆ replaceInvalidChars()

void mio::IOUtils::replaceInvalidChars ( std::string &  line,
const char &  rep = '\0' 
)

Replaces invalid characters with a single character or removes them.

Parameters
lineThe string to read and modify
repThe character to replace with (default: empty)

◆ replaceWhitespaces()

void mio::IOUtils::replaceWhitespaces ( std::string &  line,
const char &  rep = '\0' 
)

Replaces spaces and tabs with a single character or removes them.

Parameters
lineThe string to read and modify
repThe character to replace with (default: empty)

◆ seek()

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).

Parameters
[in]soughtdatedate that should be found
[in]vecMvector that should contain the data
[in]exactmatchif the exact requested date is not found, return npos

◆ split() [1/2]

std::vector< std::string > mio::IOUtils::split ( const std::string &  s,
char  delimiter 
)

◆ split() [2/2]

std::vector< std::string > mio::IOUtils::split ( const std::string &  s,
std::string  delimiter 
)

◆ standardizeNodata()

template<class T >
T mio::IOUtils::standardizeNodata ( const T &  value,
const double &  plugin_nodata 
)

Standardize a given value to use MeteoIO's internal nodata value (if applicable)

Template Parameters
T[in]The type wanted for the return value (template type parameter).
Parameters
[in]valuethe value to check/convert
[in]plugin_nodataplugin-specific nodata value
Returns
checked/converted value

◆ stripComments() [1/2]

void mio::IOUtils::stripComments ( std::string &  str)

◆ stripComments() [2/2]

void mio::IOUtils::stripComments ( std::string &  str,
const char &  comment_mk 
)

◆ strToLower()

std::string mio::IOUtils::strToLower ( std::string  str)

◆ strToUpper()

std::string mio::IOUtils::strToUpper ( std::string  str)

◆ toLower()

void mio::IOUtils::toLower ( std::string &  str)

◆ toString()

template<class T >
std::string mio::IOUtils::toString ( const T &  t)

◆ toUpper()

void mio::IOUtils::toUpper ( std::string &  str)

◆ trim() [1/2]

std::string mio::IOUtils::trim ( const std::string &  s)

Removes trailing and leading whitespaces, tabs and newlines from a string.

Parameters
sThe string to trim
Returns
The trimmed string

◆ trim() [2/2]

void mio::IOUtils::trim ( std::string &  s)

Removes trailing and leading whitespaces, tabs and newlines from a string.

Parameters
sThe reference of the string to trim (in/out parameter)

◆ unitsConversion()

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.

Parameters
valvalue to convert
unitInunits of the input
unitOutunits to convert to return value, expressed in unitOut

◆ unitsPrefix()

double mio::IOUtils::unitsPrefix ( const char &  prefix)

Convert a textual representation of a unit prefix (like 'm' or 'G') to multiplying factor.

Parameters
prefixunit prefix return multiplying factor

◆ UV_TO_DW()

double mio::IOUtils::UV_TO_DW ( const double &  U,
const double &  V 
)
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.

Parameters
U(west-to-east component)
V(south-to-north component)
Returns
Wind direction in degrees, defined as the direction the wind is coming from.

◆ VWDW_TO_U()

double mio::IOUtils::VWDW_TO_U ( const double &  VW,
const double &  DW 
)
inline

From wind speed and direction to u component (west-to-east)

Parameters
VW(wind speed)
DW(wind direction)
Returns
U component of wind.

◆ VWDW_TO_V()

double mio::IOUtils::VWDW_TO_V ( const double &  VW,
const double &  DW 
)
inline

From wind speed and direction to v component (south-to-north)

Parameters
VW(wind speed)
DW(wind direction)
Returns
V component of wind.

Variable Documentation

◆ ALPHANUM

const char mio::IOUtils::ALPHANUM[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
static

◆ cnodata

const char mio::IOUtils::cnodata = std::numeric_limits<char>::max()

◆ grid_epsilon

const double mio::IOUtils::grid_epsilon = 5.

What is an acceptable small distance on a grid, in meters.

◆ inodata

const int mio::IOUtils::inodata = -999

◆ lat_epsilon

const double mio::IOUtils::lat_epsilon = lon_epsilon

in degrees. Small angle for latitudes.

◆ lon_epsilon

const double mio::IOUtils::lon_epsilon = grid_epsilon / Cst::earth_R0 * Cst::to_deg

in degrees. Small angle for longitudes, so sin(x)=x

◆ nodata

const double mio::IOUtils::nodata = -999.0

This is the internal nodata value.

◆ npos

const size_t mio::IOUtils::npos = static_cast<size_t>(-1)

npos is the out-of-range value

◆ NUM

const char mio::IOUtils::NUM[] = "0123456789"
static

◆ snodata

const short int mio::IOUtils::snodata = -999

◆ unodata

const unsigned int mio::IOUtils::unodata = static_cast<unsigned int>(-1)