Commit 43581eb2 authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Also add missing check for last period to ECA1

parent 10bc9a75
......@@ -164,12 +164,7 @@ eca1(const ECA_REQUEST_1 &request)
if (nsets == 0)
{
if (cmplen != 0 && itsID == 0 && request.var1.f2 == &vfarnum2)
{
field_fill(var12[levelID], missval);
var12[levelID].nmiss = gridsize;
}
else if (request.var1.f2 != &vfarnum2)
if (request.var1.f2 != &vfarnum2)
{
field_fill(var12[levelID], missval);
var12[levelID].nmiss = gridsize;
......@@ -252,7 +247,7 @@ eca1(const ECA_REQUEST_1 &request)
if (IS_SET(request.var1.f3))
{
if (cmplen != 0 && request.var1.f2 == &vfarnum2)
if (request.var1.f2 == &vfarnum2)
{
auto &array1 = field3.vec_d;
const auto &array2 = var12[levelID].vec_d;
......@@ -288,6 +283,31 @@ eca1(const ECA_REQUEST_1 &request)
itsID++;
}
if (request.var1.f2 == &vfarnum2 )
{
for (int levelID = 0; levelID < nlevels; levelID++)
{
if (nrecs == 0)
{
request.var1.f3(var13[levelID], var12[levelID]);
}
else
{
auto &array1 = var13[levelID].vec_d;
const auto &array2 = var12[levelID].vec_d;
const auto missval2 = field2.missval;
const auto len = field1.size;
for (size_t i = 0; i < len; i++)
{
if ( DBL_IS_EQUAL(array2[i], nsets) || array2[i] > nsets)
array1[i] = missval2;
}
}
}
}
if (nrecs == 0 && nsets == 0) break;
if (request.var1.epilog == MEAN || request.var1.epilog == PERCENT_OF_TIME)
......@@ -590,14 +610,14 @@ eca2(const ECA_REQUEST_2 &request)
{
for (size_t i = 0; i < len; i++)
{
if (!DBL_IS_EQUAL(array2[i], missvaltemp) && !DBL_IS_EQUAL(array2[i], 0.0)) array1[i] = field3.missval;
if (!DBL_IS_EQUAL(array2[i], missvaltemp) && !DBL_IS_EQUAL(array2[i], 0.0)) array1[i] = 0.0;
}
}
else
{
for (size_t i = 0; i < len; i++)
{
if (!DBL_IS_EQUAL(array2[i], 0.0)) array1[i] = field3.missval;
if (!DBL_IS_EQUAL(array2[i], 0.0)) array1[i] = 0.0;
}
}
request.var1.f5(var15[levelID], field3, request.var1.f5arg);
......
Markdown is supported
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