Commit d526ee04 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

expr::vertSTAT: changed Field to vector.

parent ff1f0daf
......@@ -155,15 +155,15 @@ static func_t fun_sym_tbl[] = {
{ FT_ZON, 0, "zonvar1", reinterpret_cast<void (*)(void)>(&zonvar1) },
// CDO field functions (Reduce level to point)
{ FT_VERT, 0, "vertmin", reinterpret_cast<void (*)(void)>(&fldmin) },
{ FT_VERT, 0, "vertmax", reinterpret_cast<void (*)(void)>(&fldmax) },
{ FT_VERT, 0, "vertsum", reinterpret_cast<void (*)(void)>(&fldsum) },
{ FT_VERT, 1, "vertmean", reinterpret_cast<void (*)(void)>(&fldmeanw) },
{ FT_VERT, 1, "vertavg", reinterpret_cast<void (*)(void)>(&fldavgw) },
{ FT_VERT, 1, "vertstd", reinterpret_cast<void (*)(void)>(&fldstdw) },
{ FT_VERT, 1, "vertstd1", reinterpret_cast<void (*)(void)>(&fldstd1w) },
{ FT_VERT, 1, "vertvar", reinterpret_cast<void (*)(void)>(&fldvarw) },
{ FT_VERT, 1, "vertvar1", reinterpret_cast<void (*)(void)>(&fldvar1w) },
{ FT_VERT, 0, "vertmin", reinterpret_cast<void (*)(void)>(&vfldmin) },
{ FT_VERT, 0, "vertmax", reinterpret_cast<void (*)(void)>(&vfldmax) },
{ FT_VERT, 0, "vertsum", reinterpret_cast<void (*)(void)>(&vfldsum) },
{ FT_VERT, 1, "vertmean", reinterpret_cast<void (*)(void)>(&vfldmeanw) },
{ FT_VERT, 1, "vertavg", reinterpret_cast<void (*)(void)>(&vfldavgw) },
{ FT_VERT, 1, "vertstd", reinterpret_cast<void (*)(void)>(&vfldstdw) },
{ FT_VERT, 1, "vertstd1", reinterpret_cast<void (*)(void)>(&vfldstd1w) },
{ FT_VERT, 1, "vertvar", reinterpret_cast<void (*)(void)>(&vfldvarw) },
{ FT_VERT, 1, "vertvar1", reinterpret_cast<void (*)(void)>(&vfldvar1w) },
{ FT_COORD, 0, "clon", nullptr },
{ FT_COORD, 0, "clat", nullptr },
......@@ -916,14 +916,13 @@ ex_fun_var(const int init, const int funcID, nodeType *p1)
else if (functype == FT_VERT)
{
Field field;
std::vector<double> weights;
if (funcflag == 1) vert_weights(p1->param.zaxisID, nlev, weights);
std::vector<double> array(nlev);
field.resize(nlev);
if (funcflag == 1) vert_weights(p1->param.zaxisID, nlev, field.weightv);
double (*exprfunc)(const Field &) = (double (*)(const Field &)) fun_sym_tbl[funcID].func;
for (size_t i = 0; i < ngp; i++)
{
for (size_t k = 0; k < nlev; k++) array[k] = p1data[k * ngp + i];
fld_field_init(field, nmiss, missval, nlev, array.data(), weights.data());
for (size_t k = 0; k < nlev; k++) field.vec[k] = p1data[k * ngp + i];
fld_field_init(field, nmiss, missval, nlev, nullptr, nullptr);
pdata[i] = exprfunc(field);
}
}
......
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