Skip to content
Snippets Groups Projects
Commit f3414919 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

percMethod: changed type to string.

parent 8527e8ff
No related branches found
No related tags found
No related merge requests found
Pipeline #25629 passed
......@@ -43,7 +43,7 @@ Ydrunpctl(void *process)
const auto pn = parameter_to_double(cdo_operator_argv(0));
const auto ndates = parameter_to_int(cdo_operator_argv(1));
char *percMethod = nullptr, *readMethod = nullptr;
std::string percMethod, readMethod;
if (cdo_operator_argc() > 2)
{
auto params = cdo_get_oper_argv();
......@@ -51,16 +51,12 @@ Ydrunpctl(void *process)
KVList kvlist;
if (kvlist.parse_arguments(cdo_operator_argc() - 2, params) != 0) cdo_abort("Argument parse error!");
auto kv = kvlist.search("pm");
if (kv && kv->nvalues > 0) percMethod = strdup(kv->values[0].c_str());
if (kv && kv->nvalues > 0) percMethod = parameter_to_word(kv->values[0]);
kv = kvlist.search("rm");
if (kv && kv->nvalues > 0) readMethod = strdup(kv->values[0].c_str());
if (kv && kv->nvalues > 0) readMethod = parameter_to_word(kv->values[0]);
}
if (percMethod)
{
if (strcmp(percMethod, "r8") == 0) percentile_set_method("rtype8");
free(percMethod);
}
if (percMethod == "r8") percentile_set_method("rtype8");
const auto streamID1 = cdo_open_read(0);
const auto streamID2 = cdo_open_read(1);
......@@ -235,7 +231,7 @@ Ydrunpctl(void *process)
tsID++;
}
if (readMethod && readMethod[0] == 'c' && cdo_assert_files_only())
if (readMethod == "c" && cdo_assert_files_only())
{
const auto endYear = cdiDateTimes[ndates - 1].date.year;
const auto cdiStream = streamOpenRead(cdo_get_stream_name(0));
......@@ -289,15 +285,13 @@ Ydrunpctl(void *process)
}
}
if (missTimes != ndates - 1) cdo_abort("Addding the missing values when using the 'readMethodar' method was not possible");
if (missTimes != ndates - 1) cdo_abort("Addding the missing values when using the 'readMethod' method was not possible");
streamClose(cdiStream);
}
else if (readMethod && readMethod[0] == 'c')
else if (readMethod == "c")
cdo_warning("Operators cannot be piped in circular mode");
if (readMethod) free(readMethod);
/*
int outyear = 1e9;
for (dayOfYear = 0; dayOfYear < MaxDays; dayOfYear++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment