WSL/SLF GitLab Repository

Commit 3a47af61 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

More clang warnings fixed

parent 4802ecd0
......@@ -39,7 +39,7 @@ IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
ELSE()
#we consider that all other compilers support "-" options and silently ignore what they don't know
SET(WARNINGS "-Wall -Wno-long-long")
SET(DEEP_WARNINGS "-Wunused-value -Wshadow -Wpointer-arith -Wconversion -Winline -Wdisabled-optimization") #-Wfloat-equal -Wpadded
SET(DEEP_WARNINGS "-Wunused-value -Wshadow -Wpointer-arith -Wconversion -Winline -Wdisabled-optimization -Wctor-dtor-privacy") #-Wfloat-equal -Wpadded
SET(EXTRA_WARNINGS "-Wextra -pedantic -Weffc++ ${DEEP_WARNINGS}")
SET(OPTIM "-g -O3 -DNDEBUG -DNOSAFECHECKS")
SET(ARCH_SAFE "")
......@@ -51,6 +51,7 @@ ELSE()
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(PROFILING "-pg -fprofile-arcs") #add ${PROFILING} to the CFLAGS when necessary
SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -Wunsafe-loop-optimizations -Wvector-operation-performance")
IF(NOT ANDROID)
SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -ansi")
IF(WIN32) #for gcc on windows
......
......@@ -22,7 +22,7 @@ using namespace std;
namespace mio {
const std::string Config::defaultSection = "GENERAL";
const char* Config::defaultSection = "GENERAL";
//Constructors
Config::Config() : properties(), imported(), sourcename(), configRootDir()
......@@ -36,11 +36,6 @@ Config::Config(const std::string& i_filename) : properties(), imported(), source
addFile(i_filename);
}
ConfigProxy Config::get(const std::string& key, const IOUtils::ThrowOptions& opt) const
{
return ConfigProxy(*this, key, Config::defaultSection, opt);
}
ConfigProxy Config::get(const std::string& key, const std::string& section, const IOUtils::ThrowOptions& opt) const
{
return ConfigProxy(*this, key, section, opt);
......@@ -61,12 +56,6 @@ void Config::addCmdLine(const std::string& cmd_line)
parseCmdLine(cmd_line);
}
void Config::addKey(const std::string& key, const std::string& value)
{
const std::string section=defaultSection;
addKey(key, section, value);
}
void Config::addKey(const std::string& key, const std::string& section, const std::string& value)
{
properties[ IOUtils::strToUpper(section) + "::" + IOUtils::strToUpper(key) ] = value;
......@@ -195,7 +184,7 @@ void Config::parseFile(const std::string& filename)
throw FileAccessException(filename, AT);
}
std::string section=defaultSection;
std::string section( defaultSection );
const char eoln = IOUtils::getEoln(fin); //get the end of line character for the file
unsigned int linenr = 0;
std::vector<std::string> import_after; //files to import after the current one
......@@ -222,7 +211,7 @@ void Config::parseFile(const std::string& filename)
addFile(file_name);
import_after.pop_back();
}
//HACK: since HNW is now obsolete, check for keys related to HNW to warn the user
for (map<string,string>::const_iterator it=properties.begin(); it != properties.end(); ++it) {
const size_t found_obsoleteHNW = (it->first).find("HNW", 0);
......@@ -278,14 +267,14 @@ void Config::parseLine(const unsigned int& linenr, std::vector<std::string> &imp
} else {
ostringstream tmp;
tmp << linenr;
const string key_msg = (key.empty())? "" : "key "+key+" ";
const string key_value_link = (key.empty() && !value.empty())? "value " : "";
const string value_msg = (value.empty())? "" : value+" " ;
const string keyvalue_msg = (key.empty() && value.empty())? "key/value " : key_msg+key_value_link+value_msg;
const string section_msg = (section.empty())? "" : "in section "+section+" ";
const string source_msg = (sourcename.empty())? "" : "from \""+sourcename+"\" at line "+tmp.str();
throw InvalidFormatException("Error reading "+keyvalue_msg+section_msg+source_msg, AT);
}
......@@ -347,7 +336,7 @@ std::string Config::extract_section(std::string key) const
key.erase(key.begin(), key.begin() + pos + 2); //delete section name
return sectionname;
}
return defaultSection;
return string( defaultSection );
}
std::string Config::clean_import_path(const std::string& in_path) const
......@@ -385,7 +374,7 @@ void Config::write(const std::string& filename) const
const size_t key_start = key_full.find_first_of(":");
const string value = it->second;
if (value.empty()) continue;
if (key_start!=string::npos) //start after the "::" marking the section prefix
fout << key_full.substr(key_start+2) << " = " << value << endl;
else //every key should have a section prefix, but just in case...
......
......@@ -90,14 +90,6 @@ class Config {
*/
void addCmdLine(const std::string& cmd_line);
/**
* @brief Add a specific key/value pair to the internal key/value map object.
* key is case insensitive
* @param[in] key string representing the key to be added
* @param[in] value string representing the matching value to be added
*/
void addKey(const std::string& key, const std::string& value);
/**
* @brief Add a specific key/value pair to the internal key/value map object.
* key and section are case insensitive
......@@ -112,7 +104,7 @@ class Config {
* @param[in] key string representing the key to be added
* @param[in] section std::string representing a section name; the key has to be part of this section
*/
void deleteKey(const std::string& key, const std::string& section=Config::defaultSection);
void deleteKey(const std::string& key, const std::string& section);
/**
* @brief Delete keys matching a specific pattern from the internal map object, key/section are case insensitive
......@@ -124,7 +116,7 @@ class Config {
* cfg.deleteKeys("STATION", "Input");
* @endcode
*/
void deleteKeys(const std::string& keymatch, const std::string& section=Config::defaultSection, const bool& anywhere=false);
void deleteKeys(const std::string& keymatch, const std::string& section, const bool& anywhere=false);
/**
* @brief Returns the filename that the Config object was constructed with.
......@@ -144,7 +136,7 @@ class Config {
* @param[in] section std::string representing a section name; the key has to be part of this section
* @return true if the key exists
*/
bool keyExists(const std::string& key, const std::string& section=Config::defaultSection) const;
bool keyExists(const std::string& key, const std::string& section) const;
/**
* @brief Print the content of the Config object (usefull for debugging)
......@@ -155,13 +147,6 @@ class Config {
friend std::iostream& operator<<(std::iostream& os, const Config& cfg);
friend std::iostream& operator>>(std::iostream& is, Config& cfg);
template <typename T> std::vector<T> getValue(const std::string& key, const IOUtils::ThrowOptions& opt=IOUtils::dothrow) const
{
std::vector<T> tmp;
getValue(key, Config::defaultSection, tmp, opt);
return tmp;
}
template <typename T> std::vector<T> getValue(const std::string& key, const std::string& section,
const IOUtils::ThrowOptions& opt=IOUtils::dothrow) const
{
......@@ -306,9 +291,7 @@ class Config {
* @endcode
*/
size_t findKeys(std::vector<std::string>& vecResult,
const std::string& keymatch, std::string section=Config::defaultSection, const bool& anywhere=false) const;
static const std::string defaultSection;
const std::string& keymatch, std::string section, const bool& anywhere=false) const;
private:
void parseCmdLine(const std::string& cmd_line);
......@@ -321,6 +304,7 @@ class Config {
std::vector<std::string> imported; //list of files already imported (to avoid circular references)
std::string sourcename; //description of the data source for the key/value pair
std::string configRootDir; //directory of the root config file
static const char* defaultSection;
}; //end class definition Config
class ConfigProxy {
......
......@@ -42,7 +42,7 @@ using namespace std;
namespace mio {
#if defined(MSG_BOX)
void messageBox(const std::string& msg) {
void inline messageBox(const std::string& msg) {
#if defined(__linux) && !defined(ANDROID) && !defined(__CYGWIN__)
const string box_msg = msg + "\n\nPlease check the terminal for more information!";
MessageBoxX11("Oops, something went wrong!", box_msg.c_str());
......
......@@ -455,7 +455,7 @@ bool convertString(Date& t, const std::string& str, const double& time_zone, std
stripComments(timezone_iso);
const double tz = (timezone_iso.empty())? time_zone : Date::parseTimeZone(timezone_iso);
if(tz==nodata) return false;
t.setDate(year, month, day, hour, minute, (unsigned)0, tz);
t.setDate(year, month, day, hour, minute, static_cast<unsigned>(0), tz);
return true;
} else if (sscanf(c_str, "%d-%u-%uT%u:%u%31s", &year, &month, &day, &hour, &minute, rest) >= 5) {
......@@ -463,7 +463,7 @@ bool convertString(Date& t, const std::string& str, const double& time_zone, std
stripComments(timezone_iso);
const double tz = (timezone_iso.empty())? time_zone : Date::parseTimeZone(timezone_iso);
if(tz==nodata) return false;
t.setDate(year, month, day, hour, minute, (unsigned)0, tz);
t.setDate(year, month, day, hour, minute, static_cast<unsigned>(0), tz);
return true;
} else if (sscanf(c_str, "%d-%u-%u%31s", &year, &month, &day, rest) >= 3) {
......@@ -471,7 +471,7 @@ bool convertString(Date& t, const std::string& str, const double& time_zone, std
stripComments(timezone_iso);
const double tz = (timezone_iso.empty())? time_zone : Date::parseTimeZone(timezone_iso);
if(tz==nodata) return false;
t.setDate(year, month, day, (unsigned)0, (unsigned)0, (unsigned)0, tz);
t.setDate(year, month, day, static_cast<unsigned>(0), static_cast<unsigned>(0), static_cast<unsigned>(0), tz);
return true;
} else if (sscanf(c_str, "%u:%u%31s", &hour, &minute, rest) >= 2) {
......@@ -479,7 +479,7 @@ bool convertString(Date& t, const std::string& str, const double& time_zone, std
stripComments(timezone_iso);
const double tz = (timezone_iso.empty())? time_zone : Date::parseTimeZone(timezone_iso);
if(tz==nodata) return false;
t.setDate( ((double)hour)/24. + ((double)minute)/24./60. , tz);
t.setDate( (static_cast<double>(hour))/24. + (static_cast<double>(minute))/24./60. , tz);
return true;
} else {
......@@ -582,8 +582,8 @@ size_t seek(const Date& soughtdate, const std::vector<MeteoData>& vecM, const bo
const double end_date = vecM.back().date.getJulian(true);
const double curr_date = soughtdate.getJulian(true);
const double raw_pos = (curr_date-start_date) / (end_date-start_date) * static_cast<double>(max_idx); //always >=0
const size_t start_idx = (size_t)floor(raw_pos*.9);
const size_t end_idx = std::min( (size_t)ceil(raw_pos*1.1), max_idx);
const size_t start_idx = static_cast<size_t>( floor(raw_pos*.9) );
const size_t end_idx = std::min( static_cast<size_t>( ceil(raw_pos*1.1) ), max_idx);
//first and last index of the search interval, either using our initial guess or the full vector
size_t first = (curr_date >= vecM[start_idx].date.getJulian(true))? start_idx : 0;
......
......@@ -177,8 +177,10 @@ namespace Optim {
}
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundefined-reinterpret-cast"
#endif
//see http://metamerist.com/cbrt/cbrt.htm
template <int n> inline float nth_rootf(float x) {
const bool sgn = (x<0.)? true : false;
......@@ -207,7 +209,9 @@ namespace Optim {
if (sgn) return -x;
else return x;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/**
* @brief Optimized version of cubic root
......
......@@ -162,7 +162,6 @@ void Coords::moveByBearing(const double& i_bearing, const double& i_distance) {
case GEO_VINCENTY:
VincentyInverse(latitude, longitude, i_distance, i_bearing, new_lat, new_lon);
break;
throw InvalidArgumentException("Unrecognized geodesic distance algorithm selected", AT);
}
setLatLon(new_lat, new_lon, altitude, true);
......@@ -1576,7 +1575,6 @@ void Coords::distance(const Coords& destination, double& o_distance, double& o_b
case GEO_VINCENTY:
o_distance = VincentyDistance(latitude, longitude, destination.getLat(), destination.getLon(), o_bearing);
break;
throw InvalidArgumentException("Unrecognized geodesic distance algorithm selected", AT);
}
}
}
......@@ -1605,7 +1603,6 @@ void Coords::WGS84_to_local(double lat_in, double long_in, double& east_out, dou
case GEO_VINCENTY:
dist = VincentyDistance(ref_latitude, ref_longitude, lat_in, long_in, alpha);
break;
throw InvalidArgumentException("Unrecognized geodesic distance algorithm selected", AT);
}
east_out = dist*sin(alpha*Cst::to_rad);
......@@ -1638,7 +1635,6 @@ void Coords::local_to_WGS84(double east_in, double north_in, double& lat_out, do
case GEO_VINCENTY:
VincentyInverse(ref_latitude, ref_longitude, dist, bearing, lat_out, long_out);
break;
throw InvalidArgumentException("Unrecognized geodesic distance algorithm selected", AT);
}
}
}
......
......@@ -1159,7 +1159,6 @@ const string Date::toString(FORMATS type, const bool& gmt) const
<< setw(2) << setfill('0') << getDayOfWeek(gmt);
break;
}
throw InvalidArgumentException("Wrong date conversion format requested", AT);
}
return tmpstr.str();
......
......@@ -32,16 +32,16 @@ namespace mio {
* This plugin reads the ASCII data produced by the automatic weather stations by <A href="http://www.alpug.ch/">ALPUG</A>. The metadata
* for the stations must be provided in an additional file as well as the "description" of the fields that must be provided through the configuration
* key ALPUG_FIELDS.
*
*
* @section alpug_format Format
* The files are named with the following schema: {YY}{ID}.met where {YY} represents the last two digits of the year and {ID} is the station ID.
*
*
* The files contain all the measurements but no metadata and no header. The following fields can be present:
* @code
* cod area,cod,id_AWS,date hour,Mean Wind,MaxWind,WD,AT (C),HR %, SWOR,HS (cm),empty,HTS0 (cm),empty,6697,empty,GST (C),empty,????,empty,TSS (C),ISWR,P(hpa)
* @endcode
*
* The metadata are provided in a separate file. This comma delimited file can contain comments (same syntax as for the configuration files) and must contain
*
* The metadata are provided in a separate file. This comma delimited file can contain comments (same syntax as for the configuration files) and must contain
* first the station ID (as used in the meteo data file name and in the configuration file), a full name, the decimal latitude, decimal longitude and the altitude.
* @code
* #ID,name,lat,lon,alt
......@@ -50,7 +50,7 @@ namespace mio {
* @endcode
*
* @section alpug_units Units
* Temperatures are in Celsius, relative humidity between 0 and 100%, snow heights in cm. The timestamp is formatted as <a href="https://de.wikipedia.org/wiki/DIN_1355-1">DIN 1355</A>,
* Temperatures are in Celsius, relative humidity between 0 and 100%, snow heights in cm. The timestamp is formatted as <a href="https://de.wikipedia.org/wiki/DIN_1355-1">DIN 1355</A>,
* that is as "DD.MM.YYYY HH:MIN".
*
* @section alpug_keywords Keywords
......@@ -62,7 +62,7 @@ namespace mio {
* - ALPUG_FIELDS: comma delimited list of fields. The fields <b>MUST</b> use the \ref meteoparam "MeteoData" naming scheme. Unknown or ignored fields are replaced by "%".
* - WRAP_MONTH: which month (numerical) triggers the start of a new file (belonging to the next year. Default: 10); [Input] section
* - METAFILE: file within METEOPATH that contains the stations' metadata; [Input] section
*
*
* @code
* METEO = ALPUG
* METEOPATH = ./Met_files
......@@ -73,12 +73,12 @@ namespace mio {
* @endcode
*/
const std::string ALPUG::dflt_extension = ".met";
const char* ALPUG::dflt_extension = ".met";
const double ALPUG::plugin_nodata = -999.; //plugin specific nodata value. It can also be read by the plugin (depending on what is appropriate)
const size_t ALPUG::max_buffered_lines = 4; //how many lines to keep in buffer in order to detect and silently skip duplicates
ALPUG::ALPUG(const std::string& configfile)
: cfg(configfile), vecMeta(), LinesBuffer(), vecIDs(), vecFields(),
ALPUG::ALPUG(const std::string& configfile)
: cfg(configfile), vecMeta(), LinesBuffer(), vecIDs(), vecFields(),
coordin(), coordinparam(), coordout(), coordoutparam(), inpath(), outpath(),
in_dflt_TZ(0.), out_dflt_TZ(0.), wrap_month(10)
{
......@@ -86,7 +86,7 @@ ALPUG::ALPUG(const std::string& configfile)
}
ALPUG::ALPUG(const Config& cfgreader)
: cfg(cfgreader), vecMeta(), LinesBuffer(), vecIDs(), vecFields(),
: cfg(cfgreader), vecMeta(), LinesBuffer(), vecIDs(), vecFields(),
coordin(), coordinparam(), coordout(), coordoutparam(), inpath(), outpath(),
in_dflt_TZ(0.), out_dflt_TZ(0.), wrap_month(10)
{
......@@ -111,7 +111,7 @@ void ALPUG::parseInputOutputSection()
cfg.getValues("STATION", "Input", vecIDs);
readMetaData();
cfg.getValue("WRAP_MONTH", "Input", wrap_month, IOUtils::nothrow);
const string fields = cfg.get("ALPUG_FIELDS", "Input");
IOUtils::readLineToVec(fields, vecFields, ',');
if (vecFields.empty())
......@@ -131,7 +131,7 @@ void ALPUG::readMetaData()
vecMeta.clear();
vecMeta.resize( nr_ids );
vector<bool> foundID(nr_ids, false);
const string filename = cfg.get("METAFILE", "Input");
const string metafile = inpath + "/" + filename;
if (!IOUtils::fileExists(metafile)) throw FileAccessException(metafile, AT); //prevent invalid filenames
......@@ -152,7 +152,7 @@ void ALPUG::readMetaData()
string line;
linenr++;
getline(fin, line, eoln); //read complete line of data
//strip comments, white spaces and skip empty lines
IOUtils::stripComments(line);
IOUtils::trim(line);
......@@ -165,14 +165,14 @@ void ALPUG::readMetaData()
ss << "Error in file \'" << metafile << "\' at line" <<linenr << ": invalid number of columns";
throw InvalidFormatException(ss.str(), AT);
}
const string line_id = vecLine[0];
for(size_t ii=0; ii<nr_ids; ++ii) {
if (line_id==vecIDs[ii]) { //station ID found in the input list
if (foundID[ii])
throw InvalidFormatException("Error: station "+line_id+" appears multiple times in metafile \'"+metafile+"\'", AT);
vector<double> tmpdata = vector<double>(vecLine.size());
for (size_t jj=2; jj<5; jj++) {
if (!IOUtils::convertString(tmpdata[jj], vecLine[jj], std::dec))
......@@ -191,7 +191,7 @@ void ALPUG::readMetaData()
fin.close();
throw;
}
string msg;
for (size_t ii=0; ii<nr_ids; ++ii) {
if (!foundID[ii]) {
......@@ -246,13 +246,13 @@ Date ALPUG::parseDINDate(const std::string& datum) const
unsigned int month, day, hour, minute;
double second;
char rest[32] = "";
if (sscanf(datum.c_str(), "%u.%u.%d %u:%u:%lg%31s", &day, &month, &year, &hour, &minute, &second, rest) >= 6) {
return Date(year, month, day, hour, minute, in_dflt_TZ);
} else if (sscanf(datum.c_str(), "%u.%u.%d %u:%u%31s", &day, &month, &year, &hour, &minute, rest) >= 5) {
return Date(year, month, day, hour, minute, in_dflt_TZ);
}
return Date();
}
......@@ -261,7 +261,7 @@ Date ALPUG::parseDINDate(const std::string& datum) const
bool ALPUG::parseLine(const std::string& filename, const size_t& nr_of_data_fields, const Date& dateStart, const Date& dateEnd, const std::string& line, MeteoData &md, bool &isValid) const
{
md.reset();
isValid = false;
vector<string> tmp_vec;
if (IOUtils::readLineToVec(line, tmp_vec, ',') == nr_of_data_fields){
......@@ -272,23 +272,23 @@ bool ALPUG::parseLine(const std::string& filename, const size_t& nr_of_data_fiel
Date date = parseDINDate(tmp_vec[ii]);
if (date.isUndef())
throw InvalidFormatException("Invalid date \'"+tmp_vec[ii]+"\' in file \'"+filename+"\'", AT);
if (date<dateStart) return true;
if (date>dateEnd) return false;
md.setDate(date);
continue;
}
double val;
IOUtils::convertString(val, tmp_vec[ii]);
if (field=="TA" || field=="TSG" || field=="TSS")
val += Cst::t_water_freezing_pt;
else if (field=="RH" || field=="HS")
val *= 0.01;
else if (field=="P")
val *= 100.;
md(field) = val;
}
isValid = true;
......@@ -302,29 +302,29 @@ bool ALPUG::parseLine(const std::string& filename, const size_t& nr_of_data_fiel
}
//since ALPUG files seem to often contain duplicate lines, just skip them
bool ALPUG::isDuplicate(const std::string& line)
bool ALPUG::isDuplicate(const std::string& line)
{
for(size_t ii=0; ii<LinesBuffer.size(); ++ii) {
if (line==LinesBuffer[ii]) return true;
}
if (LinesBuffer.size()>max_buffered_lines) LinesBuffer.pop_front();
LinesBuffer.push_back( line );
return false;
}
void ALPUG::readMetoFile(const size_t& station_index, const Date& dateStart, const Date& dateEnd,
void ALPUG::readMetoFile(const size_t& station_index, const Date& dateStart, const Date& dateEnd,
std::vector<MeteoData>& vecM)
{
vecM.clear();
int start_year, start_month, start_day;
int end_year, end_month, end_day;
dateStart.getDate(start_year, start_month, start_day);
dateEnd.getDate(end_year, end_month, end_day);
if (start_month>=wrap_month) start_year++;
if (end_month>=wrap_month) end_year++;
const string station_id = vecIDs[station_index];
Date prev_date(0., 0.);
list<string> dirlist = IOUtils::readDirectory( inpath, station_id+dflt_extension );
......@@ -332,21 +332,21 @@ void ALPUG::readMetoFile(const size_t& station_index, const Date& dateStart, con
const std::string msg = "No data file found for station "+station_id+" in \'"+inpath+"\'"+". Files should be named as {YY}{station_id}"+dflt_extension+" with {YY} the last two digits of the year.";
throw NoAvailableDataException(msg, AT);
}
for (int year=start_year; year<=end_year; ++year) {
stringstream ss;
ss << year;
const string filename = ss.str().substr(2,2) + station_id + dflt_extension;
if (std::find(dirlist.begin(), dirlist.end(), filename) == dirlist.end()) //this file does not exist
continue;
const string file_and_path = inpath + "/" + filename;
if (!IOUtils::fileExists(file_and_path)) throw FileAccessException(file_and_path, AT); //prevent invalid filenames
errno = 0;
std::ifstream fin(file_and_path.c_str(), ios::in|ios::binary); //ascii does end of line translation, which messes up the pointer code
if (fin.fail())
if (fin.fail())
throw FileAccessException("Could not open \'" + file_and_path +"\'. Possible reason: " + strerror(errno) + "\n", AT);
const char eoln = smet::SMETCommon::getEoln(fin); //get the end of line character for the file
const size_t nr_of_data_fields = vecFields.size();
unsigned int nr_line = 0.;
......@@ -357,7 +357,7 @@ void ALPUG::readMetoFile(const size_t& station_index, const Date& dateStart, con
nr_line++;
if (line.empty()) continue; //Pure comment lines and empty lines are ignored
//if (isDuplicate(line)) continue;
Coords pos;
MeteoData md(Date(), vecMeta[station_index]);
bool isValid;
......@@ -375,7 +375,7 @@ void ALPUG::readMetoFile(const size_t& station_index, const Date& dateStart, con
print_warning = true;
}
}
fin.close();
}
}
......
......@@ -65,9 +65,9 @@ class ALPUG : public IOInterface {
bool isDuplicate(const std::string& line) ;
Date parseDINDate(const std::string& datum) const;
bool parseLine(const std::string& filename, const size_t& nr_of_data_fields, const Date& dateStart, const Date& dateEnd, const std::string& line, MeteoData &md, bool &isValid) const;
void readMetoFile(const size_t& station_index, const Date& dateStart, const Date& dateEnd,
void readMetoFile(const size_t& station_index, const Date& dateStart, const Date& dateEnd,
std::vector<MeteoData>& vecM);
const Config cfg;
std::vector<StationData> vecMeta;
std::deque<std::string> LinesBuffer;
......@@ -76,10 +76,10 @@ class ALPUG : public IOInterface {
std::string inpath, outpath;
double in_dflt_TZ, out_dflt_TZ;
unsigned short wrap_month;
static const double plugin_nodata; //plugin specific nodata value, e.g. -999
static const size_t max_buffered_lines; //how many lines to keep in buffer to check for duplicates?
static const std::string dflt_extension;
static const char* dflt_extension;
};
} //namespace
......
......@@ -46,7 +46,7 @@ namespace mio {
*/
const double ARPSIO::plugin_nodata = -999.; //plugin specific nodata value
const std::string ARPSIO::default_ext=".asc"; //filename extension
const char* ARPSIO::default_ext=".asc"; //filename extension
ARPSIO::ARPSIO(const std::string& configfile)
: cfg(configfile),
......
......@@ -87,7 +87,7 @@ class ARPSIO : public IOInterface {
FILE *fin;
std::string filename;
static const double plugin_nodata; //plugin specific nodata value, e.g. -999
static const std::string default_ext;
static const char* default_ext;
std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
std::string grid2dpath_in; //where are input grids stored
std::string ext; //file extension
......
......@@ -24,15 +24,15 @@ namespace mio {
/**
* @page smetio SMET
* @section smetio_format Format
* The Station meteo data files is a station centered, ascii file format that has been designed with flexibility and ease of use in mind. Please refer to its
* <a href="../SMET_specifications.pdf">official format specification</a> for more information (including the list of standard parameters: TA, TSS, TSG,
* The Station meteo data files is a station centered, ascii file format that has been designed with flexibility and ease of use in mind. Please refer to its
* <a href="../SMET_specifications.pdf">official format specification</a> for more information (including the list of standard parameters: TA, TSS, TSG,
* RH, VW, DW, ISWR, OSWR, ILWR, OLWR, PINT, PSUM, HS). For PINT, it is assumed that the intensity (in mm/h) is valid for the whole period between the actual
* time step and the previous one.
*
*
* This plugin can also provide Points Of Interest, given as a SMET file containing either latitude/longitude/altitude or easting/northing/altitude. For the latter,
* the header must contain the epsg code (see example below).
*
* Non-standard parameters can also be given, such as extra snow temperatures. These parameters will then take the name that has been given in "fields", converted to uppercase.
* Non-standard parameters can also be given, such as extra snow temperatures. These parameters will then take the name that has been given in "fields", converted to uppercase.
* It is usually a good idea to number these parameters, such as TS1, TS2, TS3 for a serie of temperatures at various positions.
*
* @section smetio_units Units
......@@ -73,7 +73,7 @@ namespace mio {
*
*/
const std::string SMETIO::dflt_extension = ".smet";
const char* SMETIO::dflt_extension = ".smet";
SMETIO::SMETIO(const std::string& configfile)
: cfg(configfile),
......