WSL/SLF GitLab Repository

Commit 232ce17c authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The Passive_T filter has been reworked and renamed as ProcPassiveT. A proper...

The Passive_T filter has been reworked and renamed as ProcPassiveT. A proper documentation has been written for it.

All the cout have been replaced by cerr in order to avoid messing with the end user's application. Some old commented out code has been removed.
parent af79494f
......@@ -311,13 +311,13 @@ void BufferedIOHandler::readMeteoData(const Date& date_start, const Date& date_e
size_t pos_end = IOUtils::seek(date_end, vec_buffer_meteo[ii], false);//HACK:: edit IOUtils::seek to accept an offset
if (pos_end == IOUtils::npos) pos_end = vec_buffer_meteo[ii].size() - 1; //just copy until the end of the buffer
//cout << "Station " << ii << ": pos_start=" << pos_start << " pos_end=" << pos_end << endl;
//cerr << "Station " << ii << ": pos_start=" << pos_start << " pos_end=" << pos_end << endl;
if (vec_buffer_meteo[ii][pos_end].date > date_end){
if (pos_end > pos_start) pos_end--;
} else {
pos_end++;
}
//cout << "Station " << ii << ": pos_start=" << pos_start << " pos_end=" << pos_end << endl;
//cerr << "Station " << ii << ": pos_start=" << pos_start << " pos_end=" << pos_end << endl;
vecMeteo[ii].insert(vecMeteo[ii].begin(), vec_buffer_meteo[ii].begin()+pos_start, vec_buffer_meteo[ii].begin()+pos_end);
}
}
......
......@@ -302,11 +302,11 @@ void DEMObject::printFailures() {
for ( unsigned int i = 0; i < ncols; i++ ) {
if((slope(i,j)==IOUtils::nodata) && (grid2D(i,j)!=IOUtils::nodata)) {
if(header==true) {
cout << "[i] DEM slope could not be computed at the following points \n";
cout << "[i]\tGrid Point\tElevation\tSlope\n";
cerr << "[i] DEM slope could not be computed at the following points \n";
cerr << "[i]\tGrid Point\tElevation\tSlope\n";
header=false;
}
cout << "[i]\t(" << i << "," << j << ")" << "\t\t" << grid2D(i,j) << "\t\t" << slope(i,j) << "\n";
cerr << "[i]\t(" << i << "," << j << ")" << "\t\t" << grid2D(i,j) << "\t\t" << slope(i,j) << "\n";
}
}
}
......@@ -317,17 +317,17 @@ void DEMObject::printFailures() {
for ( unsigned int i = 0; i < ncols; i++ ) {
if((curvature(i,j)==IOUtils::nodata) && (grid2D(i,j)!=IOUtils::nodata)) {
if(header==true) {
cout << "[i] DEM curvature could not be computed at the following points \n";
cout << "[i]\tGrid Point\tElevation\tCurvature\n";
cerr << "[i] DEM curvature could not be computed at the following points \n";
cerr << "[i]\tGrid Point\tElevation\tCurvature\n";
header=false;
}
cout << "[i]\t(" << i << "," << j << ")" << "\t\t" << grid2D(i,j) << "\t\t" << curvature(i,j) << "\n";
cerr << "[i]\t(" << i << "," << j << ")" << "\t\t" << grid2D(i,j) << "\t\t" << curvature(i,j) << "\n";
}
}
}
}
if(header==false) {
cout << std::endl;
cerr << std::endl;
}
}
......@@ -689,7 +689,7 @@ void DEMObject::CalculateAziSlopeCurve(slope_type algorithm) {
//Inform the user is some points have unexpectidly not been computed
//(ie: there was an altitude but some parameters could not be computed)
if(slope_failures>0 || curvature_failures>0) {
cout << "[W] DEMObject: " << slope_failures << " point(s) have an elevation but no slope, " << curvature_failures << " point(s) have an elevation but no curvature." << std::endl;
cerr << "[W] DEMObject: " << slope_failures << " point(s) have an elevation but no slope, " << curvature_failures << " point(s) have an elevation but no curvature." << std::endl;
}
} // end of CalculateAziSlope
......
......@@ -189,18 +189,13 @@ bool FilterAlgorithms::getWindowData(const std::string& filtername, const std::v
}
}
//Date gap(vecM[startposition].date - vecM[endposition].date);
//cout << "The final gap is " << gap << " windowposition: " << windowposition << endl;
//Push all relevant data elements into the vector vecWindow
//cout << "Start: " << startposition << " End: " << endposition << endl;
for (unsigned int ii=startposition+1; (ii--) > endposition; ){
const double& tmp = vecM[ii](paramindex);
if (tmp != IOUtils::nodata) {
vecWindow.push_back(tmp);
if (vecDate != NULL) (*vecDate).push_back(vecM[ii].date);
}
//cout << ii << ": pushed at vecM[" << ii << "] " << " : " << endl;
}
return true;
......@@ -268,18 +263,18 @@ void FilterAlgorithms::ExpSmoothingProcess(const std::vector<MeteoData>& vecM, c
if (windowposition == "left"){
vecTmpWindow.erase(vecTmpWindow.begin()+posfind+1, vecTmpWindow.end()); //delete all after posfind
vecWindowM[ii](paramindex) = ExpSmoothingAlgorithm(vecTmpWindow, paramindex, alpha);
//cout << "ExpSmoothing: " << vecWindowM[ii](paramindex) << endl;
//cerr << "ExpSmoothing: " << vecWindowM[ii](paramindex) << endl;
} else if (windowposition == "right"){
vecTmpWindow.erase(vecTmpWindow.begin(), vecTmpWindow.begin()+posfind); //delete all before posfind
std::reverse(vecTmpWindow.begin(), vecTmpWindow.end()); //reverse the vector, posfind most significant
vecWindowM[ii](paramindex) = ExpSmoothingAlgorithm(vecTmpWindow, paramindex, alpha);
//cout << "ExpSmoothing: " << vecWindowM[ii](paramindex) << endl;
//cerr << "ExpSmoothing: " << vecWindowM[ii](paramindex) << endl;
} else { //centered window - regroup according to time difference with posfind
for (unsigned int jj=0; jj<vecTmpWindow.size(); jj++)
vecTmpWindow[jj].date=Date(abs(vecWindowM[ii].date.getJulianDate() - vecTmpWindow[jj].date.getJulianDate()));
std::sort(vecTmpWindow.begin(), vecTmpWindow.end(), compareMeteoData);
vecWindowM[ii](paramindex) = ExpSmoothingAlgorithm(vecTmpWindow, paramindex, alpha);
//cout << "ExpSmoothing: " << vecWindowM[ii](paramindex) << endl;
//cerr << "ExpSmoothing: " << vecWindowM[ii](paramindex) << endl;
}
}
}
......@@ -323,18 +318,18 @@ void FilterAlgorithms::WMASmoothingProcess(const std::vector<MeteoData>& vecM, c
if (windowposition == "left"){
vecTmpWindow.erase(vecTmpWindow.begin()+posfind+1, vecTmpWindow.end()); //delete all after posfind
vecWindowM[ii](paramindex) = WMASmoothingAlgorithm(vecTmpWindow, paramindex);
//cout << "WMASmoothing: " << vecWindowM[ii](paramindex) << endl;
//cerr << "WMASmoothing: " << vecWindowM[ii](paramindex) << endl;
} else if (windowposition == "right"){
vecTmpWindow.erase(vecTmpWindow.begin(), vecTmpWindow.begin()+posfind); //delete all before posfind
std::reverse(vecTmpWindow.begin(), vecTmpWindow.end()); //reverse the vector, posfind most significant
vecWindowM[ii](paramindex) = WMASmoothingAlgorithm(vecTmpWindow, paramindex);
//cout << "WMASmoothing: " << vecWindowM[ii](paramindex) << endl;
//cerr << "WMASmoothing: " << vecWindowM[ii](paramindex) << endl;
} else { //centered window - regroup according to time difference with posfind
for (unsigned int jj=0; jj<vecTmpWindow.size(); jj++)
vecTmpWindow[jj].date=Date(abs(vecWindowM[ii].date.getJulianDate() - vecTmpWindow[jj].date.getJulianDate()));
std::sort(vecTmpWindow.begin(), vecTmpWindow.end(), compareMeteoData);
vecWindowM[ii](paramindex) = WMASmoothingAlgorithm(vecTmpWindow, paramindex);
//cout << "WMASmoothing: " << vecWindowM[ii](paramindex) << endl;
//cerr << "WMASmoothing: " << vecWindowM[ii](paramindex) << endl;
}
}
}
......@@ -428,17 +423,17 @@ unsigned int FilterAlgorithms::getWindowData(const std::string& filtername, cons
}
//Date gap(vecM[startposition].date - vecM[endposition].date);
//cout << "The final gap is " << gap << " windowposition: " << windowposition << endl;
//cerr << "The final gap is " << gap << " windowposition: " << windowposition << endl;
//Push all relevant data elements into the vector vecResult
//cout << "POS" << pos << " start: " << startposition << " end: " << endposition << endl;
//cerr << "POS" << pos << " start: " << startposition << " end: " << endposition << endl;
unsigned int posofposition = IOUtils::npos;
unsigned int counter = 0;
for (unsigned int ii=endposition; ii<startposition+1; ii++){
vecResult.push_back(vecM[ii]);
if (date == vecM[ii].date) posofposition=counter;
counter++;
//cout << ii << ": pushed at vecM[" << ii << "] " << " : " << endl;
//cerr << ii << ": pushed at vecM[" << ii << "] " << " : " << endl;
}
return posofposition;
......@@ -587,12 +582,10 @@ void FilterAlgorithms::MinMaxFilter(const std::vector<MeteoData>& /*vecM*/, cons
if (value<doubleArgs[0]){
if (isSoft) value=doubleArgs[0];
else value=IOUtils::nodata;
//cout << "Changed: " << value << endl;
}
if (value>doubleArgs[1]){
if (isSoft) value=doubleArgs[1];
else value=IOUtils::nodata;
//cout << "Changed: " << value << endl;
}
}
}
......@@ -876,7 +869,6 @@ void FilterAlgorithms::AccumulateProcess(const std::vector<MeteoData>& vecM, con
vecWindowM[ii](paramindex) = sum;
else
vecWindowM[ii](paramindex) = IOUtils::nodata;
//cout << "sum: " << vecWindowM[ii](paramindex) << endl;
} else {
throw IOException("Could not find an element to start accumulation", AT);
}
......
......@@ -324,7 +324,6 @@ void IOHandler::parse_copy_config()
if ((name_of_copy.length() > 0) && (initial_name.length() > 0)){
copy_parameter.push_back(initial_name);
copy_name.push_back(name_of_copy);
//cout << "Param: " << initial_name << " copied to name: " << name_of_copy << endl;
enable_copying = true;
}
}
......
......@@ -225,7 +225,6 @@ size_t IOManager::getMeteoData(const Date& i_date, METEO_TIMESERIE& vecMeteo)
for (size_t ii=0; ii<vec_cache.size(); ii++){//resampling for every station
if ((IOManager::resampled & processing_level) == IOManager::resampled){
//cout << "Resampling data for station " << ii << " (" << vec_cache[ii].size() << " elements)" << endl;
const size_t position = meteoprocessor.resample(i_date, vec_cache[ii]);
if (position != IOUtils::npos)
......
......@@ -290,7 +290,7 @@ void IOUtils::readDirectory(const std::string& path, std::list<std::string>& dir
const size_t path_length = path.length();
if (path_length > (MAX_PATH - 3)) {
std::cout << "Path " << path << "is too long (" << path_length << " characters)" << std::endl;
std::cerr << "Path " << path << "is too long (" << path_length << " characters)" << std::endl;
throw FileAccessException("Error opening directory " + path, AT);
}
......@@ -384,9 +384,7 @@ void IOUtils::readKeyValueHeader(std::map<std::string,std::string>& headermap,
for (size_t ii=0; ii< linecount; ii++){
if (std::getline(fin, line, eol)) {
//cout << line <<endl;
linenr++;
bool result = IOUtils::readKeyValuePair(line, delimiter, headermap);
if (!result) { // means if ((key == "") || (value==""))
......@@ -414,7 +412,6 @@ char IOUtils::getEoln(std::istream& fin)
if ((tmp == '\r') || (tmp == '\n')) {
char peekc = tmp;
//cout << (int)tmp << endl;
while ((!fin.eof() && ((peekc=='\r') || (peekc=='\n')))) {
tmp = peekc;
fin.get(peekc);
......
......@@ -658,7 +658,7 @@ double USERInterpolation::getQualityRating()
const std::string filename = getGridFileName();
if (!IOUtils::validFileName(filename)) {
cout << "[E] Invalid grid filename for USER interpolation algorithm: " << filename << "\n";
cerr << "[E] Invalid grid filename for USER interpolation algorithm: " << filename << "\n";
return 0.0;
}
if(IOUtils::fileExists(filename)) {
......@@ -790,9 +790,9 @@ double OrdinaryKrigingAlgorithm::computeVariogram()
try {
variogram.setModel(vario_model, dist, vari);
} catch(const IOException&) {
cout << "[E] Variogram data points:\n";
cerr << "[E] Variogram data points:\n";
for(unsigned int ii=0; ii<dist.size(); ii++) {
cout << dist[ii] << " " << vari[ii] << endl;
cerr << dist[ii] << " " << vari[ii] << endl;
}
throw IOException("The variogram model "+variogram.getName()+" could not be fitted to the available data!", AT);
}
......
......@@ -63,7 +63,7 @@ IOInterface* DEMLoader::generateIOInterface(
else
io = new ARCIO(cfg); //default IOinterface
}catch (const IOException&){
std::cout << "Problem with IOInterface ganeration in DEMLoader singleton, cause: "
std::cerr << "Problem with IOInterface ganeration in DEMLoader singleton, cause: "
<< e.what() << std::endl;
return NULL ;
}
......@@ -91,7 +91,7 @@ const DEMObject& DEMLoader::internal_loadSubDEM(const std::string cDemFile,
demMapType::iterator iter = demMap.find(s);
if( iter != demMap.end() ){
const DEMObject& res = iter->second; //found in map, return it
std::cout << "DEMLoader : " << s << " already loaded" << std::endl;
std::cerr << "DEMLoader : " << s << " already loaded" << std::endl;
return res;
}
......@@ -102,7 +102,7 @@ const DEMObject& DEMLoader::internal_loadSubDEM(const std::string cDemFile,
if( iter == demMap.end() ){
IOInterface* io = this->generateIOInterface(cDemFile, cDemCoordSystem, cInterfaceType);
if (io!=NULL){
std::cout << "DEMLoader : " << s << " loading ..." << std::endl;
std::cerr << "DEMLoader : " << s << " loading ..." << std::endl;
DEMObject dem;
dem.setUpdatePpt(DEMObject::NO_UPDATE);
//read file ...
......@@ -123,12 +123,12 @@ const DEMObject& DEMLoader::internal_loadSubDEM(const std::string cDemFile,
urcorner.getGridJ() -llcorner.getGridJ()+1);
demMap.insert(demPairType(s, sub_dem));// critical operation
std::cout << "DEMLoader : " << s << " loaded !!" << std::endl;
std::cerr << "DEMLoader : " << s << " loaded !!" << std::endl;
delete io;
}
}
}catch (const IOException& e){
std::cout << "Problem while extracting subDEM in DEMLoader, cause: "
std::cerr << "Problem while extracting subDEM in DEMLoader, cause: "
<< e.what() << std::endl;
DEMObject dem;
demMap.insert(demPairType(s, dem));
......@@ -148,7 +148,7 @@ const DEMObject& DEMLoader::internal_loadFullDEM(const std::string cDemFile,
demMapType::iterator iter = demMap.find(s);
if( iter != demMap.end() ){
const DEMObject& res = iter->second; //found in map, return it
std::cout << "DEMLoader : " << s << " already loaded" << std::endl;
std::cerr << "DEMLoader : " << s << " already loaded" << std::endl;
return res;
}
......@@ -159,17 +159,17 @@ const DEMObject& DEMLoader::internal_loadFullDEM(const std::string cDemFile,
try{
IOInterface* io = this->generateIOInterface(cDemFile, cDemCoordSystem, cInterfaceType);
if (io!=NULL){
std::cout << "DEMLoader : " << s << " loading ..." << std::endl;
std::cerr << "DEMLoader : " << s << " loading ..." << std::endl;
DEMObject dem;
dem.setUpdatePpt(DEMObject::NO_UPDATE);
io->readDEM(dem);
//read file ...
demMap.insert(demPairType(s, dem));// critical operation
std::cout << "DEMLoader : " << s << " loaded !!" << std::endl;
std::cerr << "DEMLoader : " << s << " loaded !!" << std::endl;
delete io;
}
}catch (const IOException& e){
std::cout << "Problem while reading dem file in DEMLoader, cause: "
std::cerr << "Problem while reading dem file in DEMLoader, cause: "
<< e.what() << std::endl;
DEMObject dem;
demMap.insert(demPairType(s, dem));
......
......@@ -72,7 +72,7 @@ jdoubleArray __internalWrapper
DEMLoader::loadSubDEM(cDemFile, cDemCoordSystem, cIOInterface, demXll, demYll, demXrt, demYrt) :
DEMLoader::loadFullDEM(cDemFile, cDemCoordSystem, cIOInterface);
if (dem.nrows<1 || dem.ncols<2 ){
std::cout << "Problem with DEM creation : " << std::endl;
std::cerr << "Problem with DEM creation : " << std::endl;
//error
return jMakeError(env, -2.f);
}
......@@ -134,11 +134,11 @@ jdoubleArray __internalWrapper
mi.interpolate(interpolation_type, p);
}
catch(const IOException e){
std::cout << "Interpolation failed : " << e.what() << std::endl;
std::cerr << "Interpolation failed : " << e.what() << std::endl;
success = false;
}
catch(...){
std::cout << "Interpolation failed for some reason ?!? " << std::endl;
std::cerr << "Interpolation failed for some reason ?!? " << std::endl;
success = false;
}
tmpEnd = clock(); //end
......@@ -150,7 +150,7 @@ jdoubleArray __internalWrapper
if(bClusterization)
p.clusterization(vecClusterThresholds, vecClusterIds);
}catch(...){
std::cout << "Extra process failed " << std::endl;
std::cerr << "Extra process failed " << std::endl;
}
tmpEnd = clock(); //end
const double msExtra = (tmpEnd - tmpStart)/1000.0;
......@@ -169,10 +169,10 @@ jdoubleArray __internalWrapper
//times[3] = msExtra;
env->SetDoubleArrayRegion(out, 3, 3, times);
free(times);
std::cout << " - time to load DEM : " << msDemLoading << std::endl;
std::cout << " - time to load Data : " << msDataLoading << std::endl;
std::cout << " - time to interpolate: " << msInterpolation << std::endl;
std::cout << " - time to do cluster/polygonize: " << msExtra << std::endl;
std::cerr << " - time to load DEM : " << msDemLoading << std::endl;
std::cerr << " - time to load Data : " << msDataLoading << std::endl;
std::cerr << " - time to interpolate: " << msInterpolation << std::endl;
std::cerr << " - time to do cluster/polygonize: " << msExtra << std::endl;
/************************************************************************/
......
......@@ -25,7 +25,7 @@ void loadMeteoAndStationData(double* cMetadata, double* cData,
std::vector<StationData>& vecStation, std::vector<MeteoData>& vecData,
enum MeteoData::Parameters& interpolation_type){
std::cout << "loadMeteoAndStationData " << algorithm << "*" << nbStation << std::endl;
std::cerr << "loadMeteoAndStationData " << algorithm << "*" << nbStation << std::endl;
const Date date_in;
Coords position(metaCoordinateSystem, "");
......@@ -182,7 +182,7 @@ double* executeInterpolationSubDem(char* algorithm, char* iointerface,
DEMLoader::loadSubDEM(demFile, demCoordSystem, iointerface, demXll, demYll, demXrt, demYrt) :
DEMLoader::loadFullDEM(demFile, demCoordSystem, iointerface);
if (dem.ncols<1 || dem.ncols<2 ){
std::cout << "Problem with DEM creation : " << std::endl;
std::cerr << "Problem with DEM creation : " << std::endl;
//error
return makeError(-2.);
}
......@@ -212,11 +212,11 @@ double* executeInterpolationSubDem(char* algorithm, char* iointerface,
mi.interpolate(interpolation_type, p);
}
catch(const IOException){
std::cout << "Interpolation failed " << std::endl;
std::cerr << "Interpolation failed " << std::endl;
success = false;
}
catch(...){
std::cout << "Interpolation failed for some reason ?!? " << std::endl;
std::cerr << "Interpolation failed for some reason ?!? " << std::endl;
success = false;
}
......@@ -237,9 +237,9 @@ double* executeInterpolationSubDem(char* algorithm, char* iointerface,
tmpEnd = clock(); //end
const double msInterpolation = (tmpEnd - tmpStart)/1000.0;
std::cout << " - time to load DEM : " << msDemLoading << std::endl;
std::cout << " - time to load Data : " << msDataLoading << std::endl;
std::cout << " - time to interpolate: " << msInterpolation << std::endl;
std::cerr << " - time to load DEM : " << msDemLoading << std::endl;
std::cerr << " - time to load Data : " << msDataLoading << std::endl;
std::cerr << " - time to interpolate: " << msInterpolation << std::endl;
//put the different process in the result
out[3] = msDemLoading;
out[4] = msDataLoading;
......
......@@ -174,7 +174,6 @@ char SMETCommon::getEoln(std::istream& fin)
if ((tmp == '\r') || (tmp == '\n')) {
char peekc = tmp;
//cout << (int)tmp << endl;
while ((!fin.eof() && ((peekc=='\r') || (peekc=='\n')))) {
tmp = peekc;
fin.get(peekc);
......@@ -919,7 +918,7 @@ void SMETReader::checkSignature(const std::vector<std::string>& vecSignature, bo
throw SMETException("Unsupported file format version for file " + filename, SMET_AT);
if(version=="0.9" || version=="0.95" || version=="0.99" || version=="1.0") {
cout << "[W] SMET specification 1.1 changes the priorities of units_multiplier and units_offset. "
cerr << "[W] SMET specification 1.1 changes the priorities of units_multiplier and units_offset. "
<< "Please check/update your files and bring them to 1.1!!" << endl;
}
......@@ -934,7 +933,7 @@ void SMETReader::checkSignature(const std::vector<std::string>& vecSignature, bo
void SMETReader::read(const std::string& i_timestamp_start, const std::string& i_timestamp_end,
std::vector<std::string>& vec_timestamp, std::vector<double>& vec_data)
{
{
if (!timestamp_present){
read(vec_timestamp, vec_data);
} else {
......@@ -1047,13 +1046,13 @@ void SMETReader::read(std::vector<double>& vec_data)
}
void SMETReader::read_data_ascii(std::ifstream& fin, std::vector<std::string>& vec_timestamp, std::vector<double>& vec_data)
{
{
size_t nr_of_data_fields = nr_of_fields;
if (timestamp_present) nr_of_data_fields++;
vector<string> tmp_vec;
string line;
streampos current_fpointer = -1;
streampos current_fpointer = -1;
while (!fin.eof()){
line = "";
......@@ -1061,13 +1060,13 @@ void SMETReader::read_data_ascii(std::ifstream& fin, std::vector<std::string>& v
getline(fin, line, eoln);
SMETCommon::stripComments(line);
SMETCommon::trim(line);
if (line == "") continue; //Pure comment lines and empty lines are ignored
if (line == "") continue; //Pure comment lines and empty lines are ignored
if (SMETCommon::readLineToVec(line, tmp_vec) == nr_of_data_fields){
try {
size_t shift = 0;
if (julian_interval && julian_present){
const double current_julian = SMETCommon::convert_to_double(tmp_vec[julian_field]);
const double current_julian = SMETCommon::convert_to_double(tmp_vec[julian_field]);
if (current_julian < julian_start)
continue; //skip lines that don't hold the dates we're interested in
else if (current_julian > julian_end)
......@@ -1075,7 +1074,7 @@ void SMETReader::read_data_ascii(std::ifstream& fin, std::vector<std::string>& v
}
if (timestamp_interval && timestamp_present){
const string& current_timestamp = tmp_vec[timestamp_field];
const string& current_timestamp = tmp_vec[timestamp_field];
if (current_timestamp < timestamp_start)
continue; //skip lines that don't hold the dates we're interested in
else if (current_timestamp > timestamp_end)
......@@ -1097,10 +1096,10 @@ void SMETReader::read_data_ascii(std::ifstream& fin, std::vector<std::string>& v
}
current_fpointer = tmp_fpointer;
} catch(SMETException&) {
std::cout << "Error reading file \"" << filename << "\" at line \"" << line << "\"" << std::endl;
std::cerr << "Error reading file \"" << filename << "\" at line \"" << line << "\"" << std::endl;
throw;
}
} else {
} else {
std::stringstream ss;
ss << "File \'" << filename << "\' declares " << nr_of_data_fields << " columns ";
ss << "but this does not match the following line:\n" << line;
......
......@@ -12,7 +12,7 @@ SET(meteofilters_sources
meteofilters/FilterTukey.cc
meteofilters/FilterRate.cc
meteofilters/FilterHNWMelt.cc
meteofilters/FilterPassiveT.cc
meteofilters/ProcPassiveT.cc
meteofilters/ProcUndercatch.cc
meteofilters/ProcAdd.cc
meteofilters/ProcMult.cc
......
......@@ -85,7 +85,6 @@ void FilterMAD::MAD_filter_point(const std::vector<const MeteoData*>& vec_window
const double upper_lim = median + 3.*sigma;
const double lower_lim = median - 3.*sigma;
//cout << lower_lim << " " << value << " " << upper_lim << endl;
if( (value>upper_lim) || (value<lower_lim) ) {
value = IOUtils::nodata;
}
......
......@@ -34,7 +34,7 @@ FilterMeanAvg::FilterMeanAvg(const std::vector<std::string>& vec_args) : Windowe
}
void FilterMeanAvg::process(const unsigned int& index, const std::vector<MeteoData>& ivec,
std::vector<MeteoData>& ovec)
std::vector<MeteoData>& ovec)
{
ovec.clear();
ovec.reserve(ivec.size());
......@@ -45,9 +45,6 @@ void FilterMeanAvg::process(const unsigned int& index, const std::vector<MeteoDa
const vector<const MeteoData*>& vec_window = get_window(ii, ivec);
//cout << "left : "<<elements_left << endl << "right: "<<elements_right << endl;
//cout << "size : "<<vec_window.size() << endl;
if (is_soft){
if (vec_window.size() > 0){
value = calc_avg(index, vec_window);
......@@ -61,9 +58,6 @@ void FilterMeanAvg::process(const unsigned int& index, const std::vector<MeteoDa
value = IOUtils::nodata;
}
}
//cout << endl << "Final value: " << value << " (" << ovec[ii].date.toString(Date::ISO) << ")" << endl;
//cout << "============================" << endl;
}
}
......@@ -85,7 +79,6 @@ double FilterMeanAvg::calc_avg(const unsigned int& index, const std::vector<cons
if (value != IOUtils::nodata){
sum += value;
counter++;
//cout << "Adding value: " << value << "(" << (*vec_window[ii]).date.toString(Date::ISO) << ")" << endl;
}
}
......@@ -119,4 +112,4 @@ void FilterMeanAvg::parse_args(std::vector<std::string> vec_args)
min_time_span = Duration(filter_args[1] / 86400.0, 0.);
}
}
} //namespace
......@@ -45,9 +45,6 @@ void FilterMedianAvg::process(const unsigned int& index, const std::vector<Meteo
const vector<const MeteoData*>& vec_window = get_window(ii, ivec);
//cout << "left : "<<elements_left << endl << "right: "<<elements_right << endl;
//cout << "size : "<<vec_window.size() << endl;
if (is_soft){
if (vec_window.size() > 0){
value = calc_median(index, vec_window);
......@@ -61,9 +58,6 @@ void FilterMedianAvg::process(const unsigned int& index, const std::vector<Meteo
value = IOUtils::nodata;
}
}
//cout << endl << "Final value: " << value << " (" << ovec[ii].date.toString(Date::ISO) << ")" << endl;
//cout << "============================" << endl;
}
}
......@@ -121,4 +115,4 @@ void FilterMedianAvg::parse_args(std::vector<std::string> vec_args)
min_time_span = Duration(filter_args[1] / 86400.0, 0.);
}
}
} //namespace
......@@ -15,18 +15,23 @@
You should have received a copy of the GNU Lesser General Public License
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
#include <meteoio/meteofilters/FilterPassiveT.h>
#include <meteoio/meteofilters/ProcPassiveT.h>
using namespace std;
namespace mio {
FilterPassiveT::FilterPassiveT(const std::vector<std::string>& vec_args) : FilterBlock("PASSIVE_T") {
const double ProcPassiveT::dflt_albedo = .23;
const double ProcPassiveT::soil_albedo = .23; //grass
const double ProcPassiveT::snow_albedo = .56; //white surface
const double ProcPassiveT::snow_thresh = .1; //if snow height greater than this threshold -> snow albedo
ProcPassiveT::ProcPassiveT(const std::vector<std::string>& vec_args) : ProcessingBlock("PASSIVE_T") {
parse_args(vec_args);
properties.stage = ProcessingProperties::second; //for the rest: default values
}
void FilterPassiveT::process(const unsigned int& index, const std::vector<MeteoData>& ivec,
void ProcPassiveT::process(const unsigned int& index, const std::vector<MeteoData>& ivec,
std::vector<MeteoData>& ovec)
{
if(index!=MeteoData::TA) {
......@@ -43,40 +48,50 @@ void FilterPassiveT::process(const unsigned int& index, const std::vector<MeteoD
double& tmp = ovec[ii](index);
if(tmp == IOUtils::nodata) continue; //preserve nodata values
if(type==nakamura) {
const double iswr = ivec[ii](MeteoData::ISWR);
const double ta = ivec[ii](MeteoData::TA);
const double vw = ivec[ii](MeteoData::VW);
if(iswr==