WSL/SLF GitLab Repository

Commit 9854aed8 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The proper gracerc file (that has to be copied in $HOME/.grace) has been...

The proper gracerc file (that has to be copied in $HOME/.grace) has been committed. In order for the direct import of smet files, the smet2agr.sh script must be in the PATH.

Minor code cleanup in the filters.
parent f4637fe4
......@@ -77,7 +77,7 @@ void ProcAdd::parse_args(const std::vector<std::string>& vec_args)
if (!IOUtils::convertString(offset, vec_args[0]))
throw InvalidArgumentException("Invalid offset \""+vec_args[0]+"\" specified for the "+getName()+" filter. If correcting for a period, please specify the period!", AT);
} else if (nrArgs==2) {
const string type_str=IOUtils::strToUpper( vec_args[0] );
const std::string type_str( IOUtils::strToUpper( vec_args[0] ) );
if (type_str=="MONTHLY") type='m';
else if (type_str=="DAILY") type='d';
else if (type_str=="HOURLY") type='h';
......@@ -87,8 +87,8 @@ void ProcAdd::parse_args(const std::vector<std::string>& vec_args)
//if this is a relative path, prefix the path with the current path
const std::string in_filename( vec_args[1] );
const std::string prefix = ( FileUtils::isAbsolutePath(in_filename) )? "" : root_path+"/";
const std::string path = FileUtils::getPath(prefix+in_filename, true); //clean & resolve path
const std::string filename = path + "/" + FileUtils::getFilename(in_filename);
const std::string path( FileUtils::getPath(prefix+in_filename, true) ); //clean & resolve path
const std::string filename( path + "/" + FileUtils::getFilename(in_filename) );
ProcessingBlock::readCorrections(getName(), filename, type, 0., vecOffsets);
} else
throw InvalidArgumentException("Wrong number of arguments for filter " + getName(), AT);
......
......@@ -78,7 +78,7 @@ void ProcMult::parse_args(const std::vector<std::string>& vec_args)
if (!IOUtils::convertString(factor, vec_args[0]))
throw InvalidArgumentException("Invalid factor \""+vec_args[0]+"\" specified for the "+getName()+" filter. If correcting for a period, please specify the period!", AT);
} else if (nrArgs==2) {
const string type_str=IOUtils::strToUpper( vec_args[0] );
const std::string type_str( IOUtils::strToUpper( vec_args[0] ) );
if (type_str=="MONTHLY") type='m';
else if (type_str=="DAILY") type='d';
else if (type_str=="HOURLY") type='h';
......@@ -86,10 +86,10 @@ void ProcMult::parse_args(const std::vector<std::string>& vec_args)
throw InvalidArgumentException("Invalid period \""+type_str+"\" specified for the "+getName()+" filter", AT);
//if this is a relative path, prefix the path with the current path
const std::string in_filename = vec_args[1];
const std::string in_filename( vec_args[1] );
const std::string prefix = ( FileUtils::isAbsolutePath(in_filename) )? "" : root_path+"/";
const std::string path = FileUtils::getPath(prefix+in_filename, true); //clean & resolve path
const std::string filename = path + "/" + FileUtils::getFilename(in_filename);
const std::string path( FileUtils::getPath(prefix+in_filename, true) ); //clean & resolve path
const std::string filename( path + "/" + FileUtils::getFilename(in_filename) );
ProcessingBlock::readCorrections(getName(), filename, type, 1., vecFactors);
} else
throw InvalidArgumentException("Wrong number of arguments for filter " + getName(), AT);
......
......@@ -229,7 +229,7 @@ std::string ProcessingBlock::getName() const {
void ProcessingBlock::readCorrections(const std::string& filter, const std::string& filename, const char& c_type, const double& init, std::vector<double> &corrections)
{
std::ifstream fin(filename.c_str());
std::ifstream fin( filename.c_str() );
if (fin.fail()) {
std::ostringstream ss;
ss << "Filter " << filter << ": ";
......@@ -256,7 +256,7 @@ void ProcessingBlock::readCorrections(const std::string& filter, const std::stri
IOUtils::trim(line);
if (line.empty()) continue;
std::istringstream iss(line);
std::istringstream iss( line );
iss.setf(std::ios::fixed);
iss.precision(std::numeric_limits<double>::digits10);
iss >> std::skipws >> index;
......
DEFINE IFILTER "gzip -dc %s" PATTERN "*.gz"
DEFINE OFILTER "gzip -9 - > %s" PATTERN "*.gz"
DEFINE IFILTER "bzip2 -dc %s" PATTERN "*.bz2"
DEFINE OFILTER "bzip2 -9 - > %s" PATTERN "*.bz2"
DEFINE IFILTER "smet2agr.sh %s" PATTERN "*.smet"
\ No newline at end of file
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