Commit eee8a1a3 authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Operator will be added with (default) frequency and its id will be returned

parent 151ac52d
......@@ -321,22 +321,24 @@ static const char HURR_LONGNAME2[] = "Greatest number of consecutive hurricane
/* ECA temperature indices */
static void addWithFrequency(std::vector<std::string> &params, const char *operatorName)
static int addWithFrequency(std::vector<std::string> &params, const char *operatorName, size_t defaultDays)
{
KVList kvlist;
int opID = 0;
if (kvlist.parseArguments(1, params) != 0) cdoAbort("Argument parse error!");
auto kv = kvlist.search("freq");
if (kv && kv->nvalues > 0 )
{
if ( kv->values[0].compare("month") == 0 )
cdoOperatorAdd(operatorName, 0, 8, nullptr);
opID = cdoOperatorAdd(operatorName, 0, 8, nullptr);
else if ( kv->values[0].compare("year") == 0 )
cdoOperatorAdd(operatorName, 0, 10, nullptr);
opID = cdoOperatorAdd(operatorName, 0, 10, nullptr);
else
cdoAbort("Frequency '%s' unknown.", kv->values[0]);
}
else
cdoOperatorAdd(operatorName, 0, 31, nullptr);
opID = cdoOperatorAdd(operatorName, 0, defaultDays, nullptr);
return opID;
}
void *EcaCfd(void *process)
......@@ -353,7 +355,7 @@ void *EcaCfd(void *process)
{
auto params = cdoGetOperArgv();
params = std::vector<std::string>(params.begin() + 1, params.end());
addWithFrequency(params, "eca_cfd");
addWithFrequency(params, "eca_cfd", 31);
}
else
{
......
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