Skip to content

Commit

Permalink
visibility: check that cloudiness data is found before accessing it
Browse files Browse the repository at this point in the history
  • Loading branch information
mpartio committed May 31, 2024
1 parent 3430d59 commit d069434
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions himan-plugins/source/visibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ void visibility::Calculate(shared_ptr<info<double>> myTargetInfo, unsigned short
level lowest_hybrid = util::CreateHybridLevel(myTargetInfo->Producer(), "last");
auto NInfo = Fetch(forecastTime, lowest_hybrid, NParam, forecastType, false);

if (!NInfo)
{
myThreadedLogger.Warning(fmt::format("Skipping step {}, level {}", static_cast<string>(forecastTime.Step()),
static_cast<string>(forecastLevel)));
return;
}

// Make sure that "stLimit" value matches the numbering scheme of the data
double NScale = (NInfo->Param().Name() == "N-PRCNT" ? 100. : 1.);
const double _stLimit = stLimit * NScale;
Expand Down

0 comments on commit d069434

Please sign in to comment.