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

subVarLevelValues(): cleanup.

parent 5f5f0b07
No related branches found
No related tags found
No related merge requests found
......@@ -403,18 +403,24 @@ HistogramSet::addVarLevelValues(const int varID, const int levelID, const Field_
}
const auto _subVarLevelValues = [](LambdaField_T_ field, int varID, int levelID, const int nlevels, int nvars, std::vector<Histogram>& hists, const size_t nhists) -> int
const auto _subVarLevelValues = [](LambdaField_T_ field, const size_t nhists, std::vector<Histogram>& hists) -> int
{
if (varID < 0 || varID >= nvars) cdo_abort("Illegal argument: varID %d is undefined (%s)", varID, __func__);
if (nhists != gridInqSize(field.grid)) cdo_abort("Grids are different (%s)", __func__);
if (levelID < 0 || levelID >= nlevels) cdo_abort("Illegal argument: levelID %d is undefined (%s)", levelID, __func__);
return histSubVarLevelValues(nhists, hists, field.vec, field.nmiss, field.getMissValue());
};
if (nhists != gridInqSize(field.grid)) cdo_abort("Grids are different (%s)", __func__);
int
HistogramSet::subVarLevelValues(const int varID, const int levelID, const Field_t &field)
{
if (varID < 0 || varID >= nvars) cdo_abort("Illegal argument: varID %d is undefined (%s)", varID, __func__);
int nign = 0;
const auto nlevels = this->var_nlevels[varID];
if (levelID < 0 || levelID >= nlevels) cdo_abort("Illegal argument: levelID %d is undefined (%s)", levelID, __func__);
nign = histSubVarLevelValues(nhists, hists, field.vec, field.nmiss, field.getMissValue());
const auto nhists = this->var_nhists[varID];
int nign = field_operation(_subVarLevelValues, field, nhists, this->histograms[varID][levelID]);
if (nign)
{
cdo_warning("%d out of %d grid values are out of bounds and have been ignored (%s)", nign, nhists, __func__);
......@@ -422,11 +428,6 @@ const auto _subVarLevelValues = [](LambdaField_T_ field, int varID, int levelID,
}
return 0;
};
int
HistogramSet::subVarLevelValues(const int varID, const int levelID, const Field_t &field) {
return field_operation(_subVarLevelValues, field, varID, levelID, this->var_nlevels[varID], this->nvars, this->histograms[varID][levelID], this->var_nhists[varID]);
}
/* unused
void
......@@ -485,4 +486,4 @@ const auto _getVarLevelPercentiles = [](LambdaField_T_ field, const int varID, c
void
HistogramSet::getVarLevelPercentiles(Field_t &field, const int varID, const int levelID, const double p) {
field_operation(_getVarLevelPercentiles, field, varID, levelID, p, this->var_nlevels[varID], nvars, this->histograms[varID][levelID], this->var_nhists[varID]);
}
\ No newline at end of file
}
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