Skip to content

Commit

Permalink
Better error message when allowed missing value count is exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
mpartio committed Jun 6, 2024
1 parent 08a5561 commit df97b20
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions himan-plugins/source/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,14 @@ himan::HPWriteStatus writer::ToFile(std::shared_ptr<info<T>> theInfo, std::share

if (aggregationPeriodCheck && allowedMissing < theInfo->Data().MissingCount())
{
itsLogger.Fatal(fmt::format("Parameter {} for leadtime {} contains more missing values ({}) than allowed ({})",
theInfo->Param().Name(), theInfo->Time().Step(), theInfo->Data().MissingCount(),
allowedMissing));
exit(1);
size_t m = theInfo->Data().MissingCount();
double exceedance = static_cast<double>(m - allowedMissing) / static_cast<double>(allowedMissing) * 100.0;

itsLogger.Fatal(
fmt::format("Parameter {} leadtime {} contains more missing values than allowed (allowed={}, missing={}, "
"exceedance={:.2f}%)",
theInfo->Param().Name(), theInfo->Time().Step(), allowedMissing, m, exceedance));
himan::Abort();
}

timer t;
Expand Down

0 comments on commit df97b20

Please sign in to comment.