WSL/SLF GitLab Repository

Commit 337c1b83 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The EXCLUDE/KEEP/MERGE keys (as well as the associated stationIDs) were case...

The EXCLUDE/KEEP/MERGE keys (as well as the associated stationIDs) were case sensitive and this was making trouble. This is now case-insensitive. A warning flag has been changed for Clang to prevent reporting fake warnings (the flag does not make sense at all and only exists for compatibility reasons).
parent 0244c760
......@@ -38,7 +38,7 @@ IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
ENDIF(GUI_EXCEPTIONS)
ELSE()
#we consider that all other compilers support "-" options and silently ignore what they don't know
SET(WARNINGS "-Wall -Wno-long-long")
SET(WARNINGS "-Wall -Wno-long-long -Wswitch")
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")
......@@ -81,7 +81,7 @@ ELSE()
SET(PROFILING "-pg") #add ${PROFILING} to the CFLAGS when necessary
SET(EXTRA "${EXTRA} -fcolor-diagnostics") #-fapple-pragma-pack does not seems necessary; -ftrapv should be replaced by sanitize=integer
SET(OPTIM "${OPTIM} -flto")
SET(WARNINGS "${WARNINGS} -Weverything -Wno-date-time -Wno-float-equal -Wno-documentation -Wno-documentation-unknown-command -Wno-old-style-cast -Wno-padded -Wno-missing-noreturn -Wno-weak-vtables") #obviously, we should try to fix the warnings!
SET(WARNINGS "${WARNINGS} -Weverything -Wno-date-time -Wno-float-equal -Wno-documentation -Wno-documentation-unknown-command -Wno-old-style-cast -Wno-padded -Wno-missing-noreturn -Wno-weak-vtables -Wno-switch-enum") #obviously, we should try to fix the warnings! Keeping in mind that some of these W are half buggy...
SET(DEEP_WARNINGS "${DEEP_WARNINGS} -Rpass=.*")
SET(LEAKS_CHECK OFF CACHE BOOL "Set to ON to dynamically check for memory corruption (and do the same for applications linked with MeteoIO)")
IF (LEAKS_CHECK)
......
......@@ -434,7 +434,7 @@ void IOHandler::create_merge_map()
const size_t found = merge_keys[ii].find_first_of(":");
if (found==std::string::npos) continue;
const string station( merge_keys[ii].substr(0,found) );
const string station( IOUtils::strToUpper(merge_keys[ii].substr(0,found)) );
std::vector<std::string> vecString;
cfg.getValue(merge_keys[ii], "Input", vecString);
if (vecString.empty()) throw InvalidArgumentException("Empty value for key \""+merge_keys[ii]+"\"", AT);
......@@ -464,7 +464,7 @@ void IOHandler::create_merge_map()
void IOHandler::merge_stations(STATIONS_SET& vecStation) const
{
for (size_t ii=0; ii<vecStation.size(); ii++) {
const string toStationID = vecStation[ii].stationID;
const string toStationID = IOUtils::strToUpper(vecStation[ii].stationID);
//we do not support "chain merge": station A merging station B and station C merging station A
if ( std::find(merged_stations.begin(), merged_stations.end(), toStationID)!=merged_stations.end() ) continue;
......@@ -476,7 +476,8 @@ void IOHandler::merge_stations(STATIONS_SET& vecStation) const
const string fromStationID( merge_from[idx] );
for (size_t jj=0; jj<vecStation.size(); jj++) {
if (vecStation[jj].stationID==fromStationID) vecStation[ii].merge( vecStation[jj] );
const string curr_station = IOUtils::strToUpper(vecStation[jj].stationID);
if (curr_station==fromStationID) vecStation[ii].merge( vecStation[jj] );
}
}
}
......@@ -498,8 +499,8 @@ void IOHandler::merge_stations(std::vector<METEO_SET>& vecVecMeteo) const
{
for (size_t ii=0; ii<vecVecMeteo.size(); ii++) {
if (vecVecMeteo[ii].empty()) continue;
const string toStationID = vecVecMeteo[ii][0].meta.stationID;
const string toStationID = IOUtils::strToUpper(vecVecMeteo[ii][0].meta.stationID);
//we do not support "chain merge": station A merging station B and station C merging station A
if ( std::find(merged_stations.begin(), merged_stations.end(), toStationID)!=merged_stations.end() ) continue;
......@@ -509,10 +510,10 @@ void IOHandler::merge_stations(std::vector<METEO_SET>& vecVecMeteo) const
const vector<string> &merge_from( it->second );
for (size_t idx=0; idx<merge_from.size(); ++idx) {
const string fromStationID( merge_from[idx] );
for (size_t jj=0; jj<vecVecMeteo.size(); jj++) {
if (vecVecMeteo[jj].empty()) continue;
if (vecVecMeteo[jj][0].meta.stationID==fromStationID)
const string curr_station = IOUtils::strToUpper(vecVecMeteo[jj][0].meta.stationID);
if (curr_station==fromStationID)
MeteoData::mergeTimeSeries(vecVecMeteo[ii], vecVecMeteo[jj]);
}
}
......@@ -520,7 +521,7 @@ void IOHandler::merge_stations(std::vector<METEO_SET>& vecVecMeteo) const
//remove the stations that have been merged into other ones
for (size_t ii=0; ii<vecVecMeteo.size(); ii++) {
const string toStationID = vecVecMeteo[ii][0].meta.stationID;
const string toStationID = IOUtils::strToUpper(vecVecMeteo[ii][0].meta.stationID);
const vector<string>::const_iterator it = std::find(merged_stations.begin(), merged_stations.end(), toStationID);
if ( it!=merged_stations.end() ) {
std::swap( vecVecMeteo[ii], vecVecMeteo.back() );
......@@ -580,7 +581,7 @@ void IOHandler::create_exclude_map()
const size_t found = exclude_keys[ii].find_first_of(":");
if (found==std::string::npos) continue;
const string station( exclude_keys[ii].substr(0,found) );
const string station( IOUtils::strToUpper(exclude_keys[ii].substr(0,found)) );
std::vector<std::string> vecString;
cfg.getValue(exclude_keys[ii], "Input", vecString);
if (vecString.empty()) throw InvalidArgumentException("Empty value for key \""+exclude_keys[ii]+"\"", AT);
......@@ -643,7 +644,7 @@ void IOHandler::create_keep_map()
const size_t found = keep_keys[ii].find_first_of(":");
if (found==std::string::npos) continue;
const string station( keep_keys[ii].substr(0,found) );
const string station( IOUtils::strToUpper(keep_keys[ii].substr(0,found)) );
std::vector<std::string> vecString;
cfg.getValue(keep_keys[ii], "Input", vecString);
if (vecString.empty()) throw InvalidArgumentException("Empty value for key \""+keep_keys[ii]+"\"", AT);
......@@ -665,7 +666,7 @@ void IOHandler::exclude_params(std::vector<METEO_SET>& vecVecMeteo) const
for (size_t station=0; station<vecVecMeteo.size(); ++station) { //loop over the stations
if (vecVecMeteo[station].empty()) continue;
const string stationID = vecVecMeteo[station][0].meta.stationID;
const string stationID = IOUtils::strToUpper(vecVecMeteo[station][0].meta.stationID);
const map< string, set<string> >::const_iterator it = excluded_params.find(stationID);
if (it == excluded_params.end()) continue;
......@@ -692,7 +693,7 @@ void IOHandler::keep_params(std::vector<METEO_SET>& vecVecMeteo) const
for (size_t station=0; station<vecVecMeteo.size(); ++station) { //loop over the stations
if (vecVecMeteo[station].empty()) continue;
const string stationID = vecVecMeteo[station][0].meta.stationID;
const string stationID = IOUtils::strToUpper(vecVecMeteo[station][0].meta.stationID);
const map< string, set<string> >::const_iterator it = kept_params.find(stationID);
if (it == kept_params.end()) continue;
......
......@@ -466,7 +466,7 @@ void MeteoData::merge(const MeteoData& meteo2)
//extra parameters only in meteo2 -> add them
if (nrExtra1==0) {
for (size_t ii=0; ii<nrExtra2; ii++) {
const size_t new_idx = addParameter( meteo2.extra_param_name[nrOfParameters+ii] );
const size_t new_idx = addParameter( meteo2.extra_param_name[ii] );
data[new_idx] = meteo2.data[nrOfParameters+ii];
}
return;
......@@ -476,10 +476,10 @@ void MeteoData::merge(const MeteoData& meteo2)
std::vector<bool> meteo2_flags(nrExtra2, false); //to keep track of which elements have been copied
//merge the extra field of the current meteodata
for (size_t ii=0; ii<nrExtra1; ii++) {
const std::string curr_name = extra_param_name[nrOfParameters+ii];
const std::string curr_name = extra_param_name[ii];
//look for this parameter in meteo2
for (size_t jj=0; jj<nrExtra2; jj++) {
if (meteo2.extra_param_name[nrOfParameters+jj]==curr_name ) {
if (meteo2.extra_param_name[jj]==curr_name ) {
meteo2_flags[jj] = true;
if (data[nrOfParameters+ii]==IOUtils::nodata) data[nrOfParameters+ii]=meteo2.data[nrOfParameters+jj];
break;
......@@ -489,7 +489,7 @@ void MeteoData::merge(const MeteoData& meteo2)
//merge the extra fields of meteo2 that were NOT in the current meteodata
for (size_t ii=0; ii<nrExtra2; ii++) {
if (meteo2_flags[ii]==false) {
const size_t new_idx = addParameter( meteo2.extra_param_name[nrOfParameters+ii] );
const size_t new_idx = addParameter( meteo2.extra_param_name[ii] );
data[new_idx] = meteo2.data[nrOfParameters+ii];
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment