mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 03:45:30 +08:00
Handle undefined GRIB2 values
ref T324
This commit is contained in:
committed by
Klaus Basan
parent
24ebc2ce7f
commit
4bc1982d06
@@ -313,6 +313,8 @@ namespace BlackWxPlugin
|
|||||||
CCloudLayerList cloudLayers;
|
CCloudLayerList cloudLayers;
|
||||||
for (auto cloudLayerIt = gfsGridPoint.cloudLayers.begin(); cloudLayerIt != gfsGridPoint.cloudLayers.end(); ++cloudLayerIt)
|
for (auto cloudLayerIt = gfsGridPoint.cloudLayers.begin(); cloudLayerIt != gfsGridPoint.cloudLayers.end(); ++cloudLayerIt)
|
||||||
{
|
{
|
||||||
|
if (std::isnan(cloudLayerIt.value().bottomLevel) || std::isnan(cloudLayerIt.value().topLevel)) { continue; }
|
||||||
|
|
||||||
CCloudLayer cloudLayer;
|
CCloudLayer cloudLayer;
|
||||||
cloudLayer.setBase(CAltitude(cloudLayerIt.value().bottomLevel, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
|
cloudLayer.setBase(CAltitude(cloudLayerIt.value().bottomLevel, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
|
||||||
cloudLayer.setTop(CAltitude(cloudLayerIt.value().topLevel, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
|
cloudLayer.setTop(CAltitude(cloudLayerIt.value().topLevel, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
|
||||||
@@ -669,17 +671,21 @@ namespace BlackWxPlugin
|
|||||||
for (auto &gridPoint : m_gfsWeatherGrid)
|
for (auto &gridPoint : m_gfsWeatherGrid)
|
||||||
{
|
{
|
||||||
static const g2float minimumLayer = 0.0;
|
static const g2float minimumLayer = 0.0;
|
||||||
|
double levelFt = std::numeric_limits<double>::quiet_NaN();
|
||||||
|
g2float fieldValue = fld[gridPoint.fieldPosition];
|
||||||
|
// A value of 9.999e20 is undefined. Check that the pressure value is below
|
||||||
|
if (fieldValue < 9.998e20f) { levelFt = millibarToLevel(fld[gridPoint.fieldPosition]); }
|
||||||
switch (surfaceType)
|
switch (surfaceType)
|
||||||
{
|
{
|
||||||
case LowCloudBottomLevel:
|
case LowCloudBottomLevel:
|
||||||
case MiddleCloudBottomLevel:
|
case MiddleCloudBottomLevel:
|
||||||
case HighCloudBottomLevel:
|
case HighCloudBottomLevel:
|
||||||
if (fld[gridPoint.fieldPosition] > minimumLayer) { gridPoint.cloudLayers[level].bottomLevel = millibarToLevel(fld[gridPoint.fieldPosition]); }
|
if (fieldValue > minimumLayer) { gridPoint.cloudLayers[level].bottomLevel = levelFt; }
|
||||||
break;
|
break;
|
||||||
case LowCloudTopLevel:
|
case LowCloudTopLevel:
|
||||||
case MiddleCloudTopLevel:
|
case MiddleCloudTopLevel:
|
||||||
case HighCloudTopLevel:
|
case HighCloudTopLevel:
|
||||||
if (fld[gridPoint.fieldPosition] > minimumLayer) { gridPoint.cloudLayers[level].topLevel = millibarToLevel(fld[gridPoint.fieldPosition]); }
|
if (fieldValue > minimumLayer) { gridPoint.cloudLayers[level].topLevel = levelFt; }
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user