mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +08:00
@@ -148,7 +148,6 @@ namespace BlackSimPlugin
|
|||||||
for (const auto &cloudLayer : cloudLayers)
|
for (const auto &cloudLayer : cloudLayers)
|
||||||
{
|
{
|
||||||
NewCloud cloud;
|
NewCloud cloud;
|
||||||
cloud.Coverage = static_cast<char>(cloudLayer.getCoverage());
|
|
||||||
|
|
||||||
switch (cloudLayer.getCoverage())
|
switch (cloudLayer.getCoverage())
|
||||||
{
|
{
|
||||||
@@ -164,7 +163,13 @@ namespace BlackSimPlugin
|
|||||||
cloud.Icing = 0;
|
cloud.Icing = 0;
|
||||||
cloud.LowerAlt = cloudLayer.getBase().value(CLengthUnit::m());
|
cloud.LowerAlt = cloudLayer.getBase().value(CLengthUnit::m());
|
||||||
cloud.PrecipBase = 0;
|
cloud.PrecipBase = 0;
|
||||||
cloud.PrecipRate = static_cast<unsigned char>(cloudLayer.getPrecipitationRate());
|
|
||||||
|
// Light rain - when the precipitation rate is < 2.5 mm (0.098 in) per hour
|
||||||
|
// Moderate rain - when the precipitation rate is between 2.5 mm (0.098 in) - 7.6 mm (0.30 in) or 10 mm (0.39 in) per hour
|
||||||
|
// Heavy rain - when the precipitation rate is > 7.6 mm (0.30 in) per hour, or between 10 mm (0.39 in) and 50 mm (2.0 in) per hour
|
||||||
|
// Violent rain - when the precipitation rate is > 50 mm (2.0 in) per hour
|
||||||
|
|
||||||
|
cloud.PrecipRate = 2 * static_cast<unsigned char>(cloudLayer.getPrecipitationRate());
|
||||||
cloud.PrecipType = static_cast<unsigned char>(cloudLayer.getPrecipitation());
|
cloud.PrecipType = static_cast<unsigned char>(cloudLayer.getPrecipitation());
|
||||||
cloud.TopShape = 0;
|
cloud.TopShape = 0;
|
||||||
cloud.Turbulence = 0;
|
cloud.Turbulence = 0;
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ namespace BlackWxPlugin
|
|||||||
{
|
{
|
||||||
{ { {0, 0} }, { TMP, "Temperature", "K" } },
|
{ { {0, 0} }, { TMP, "Temperature", "K" } },
|
||||||
{ { {1, 1} }, { RH, "Relative Humidity", "%" } },
|
{ { {1, 1} }, { RH, "Relative Humidity", "%" } },
|
||||||
|
{ { {1, 192} }, { CRAIN, "Categorical Rain", "-" } },
|
||||||
|
{ { {1, 195} }, { CSNOW, "Categorical Snow", "-" } },
|
||||||
{ { {2, 2} }, { UGRD, "U-Component of Wind", "m s-1" } },
|
{ { {2, 2} }, { UGRD, "U-Component of Wind", "m s-1" } },
|
||||||
{ { {2, 3} }, { VGRD, "V-Component of Wind", "m s-1" } },
|
{ { {2, 3} }, { VGRD, "V-Component of Wind", "m s-1" } },
|
||||||
{ { {3, 0} }, { PRES, "Pressure", "Pa" } },
|
{ { {3, 0} }, { PRES, "Pressure", "Pa" } },
|
||||||
@@ -104,6 +106,7 @@ namespace BlackWxPlugin
|
|||||||
|
|
||||||
static const QStringList grib2Levels =
|
static const QStringList grib2Levels =
|
||||||
{
|
{
|
||||||
|
"surface",
|
||||||
"100_mb",
|
"100_mb",
|
||||||
"150_mb",
|
"150_mb",
|
||||||
"200_mb",
|
"200_mb",
|
||||||
@@ -114,6 +117,7 @@ namespace BlackWxPlugin
|
|||||||
"700_mb",
|
"700_mb",
|
||||||
"800_mb",
|
"800_mb",
|
||||||
"900_mb",
|
"900_mb",
|
||||||
|
"1000_mb",
|
||||||
"high_cloud_bottom_level",
|
"high_cloud_bottom_level",
|
||||||
"high_cloud_layer",
|
"high_cloud_layer",
|
||||||
"high_cloud_top_level",
|
"high_cloud_top_level",
|
||||||
@@ -134,6 +138,8 @@ namespace BlackWxPlugin
|
|||||||
"TMP",
|
"TMP",
|
||||||
"UGRD",
|
"UGRD",
|
||||||
"VGRD",
|
"VGRD",
|
||||||
|
"CRAIN",
|
||||||
|
"CSNOW"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::array<int, 4> cycles = { { 0, 6, 12, 18 } };
|
static const std::array<int, 4> cycles = { { 0, 6, 12, 18 } };
|
||||||
@@ -264,6 +270,16 @@ namespace BlackWxPlugin
|
|||||||
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()));
|
||||||
cloudLayer.setCoveragePercent(cloudLayerIt.value().totalCoverage);
|
cloudLayer.setCoveragePercent(cloudLayerIt.value().totalCoverage);
|
||||||
|
if (gfsGridPoint.surfaceSnowRate > 0.0)
|
||||||
|
{
|
||||||
|
cloudLayer.setPrecipitation(CCloudLayer::Snow);
|
||||||
|
cloudLayer.setPrecipitationRate(gfsGridPoint.surfaceSnowRate);
|
||||||
|
}
|
||||||
|
if (gfsGridPoint.surfaceRainRate > 0.0)
|
||||||
|
{
|
||||||
|
cloudLayer.setPrecipitation(CCloudLayer::Rain);
|
||||||
|
cloudLayer.setPrecipitationRate(gfsGridPoint.surfaceRainRate);
|
||||||
|
}
|
||||||
cloudLayers.insert(cloudLayer);
|
cloudLayers.insert(cloudLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,6 +498,8 @@ namespace BlackWxPlugin
|
|||||||
break;
|
break;
|
||||||
case PRMSL:
|
case PRMSL:
|
||||||
break;
|
break;
|
||||||
|
case PRES:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
break;
|
break;
|
||||||
@@ -530,6 +548,12 @@ namespace BlackWxPlugin
|
|||||||
case PRES:
|
case PRES:
|
||||||
setCloudLevel(gfld->fld, typeFirstFixedSurface, grib2CloudLevelHash.value(typeFirstFixedSurface));
|
setCloudLevel(gfld->fld, typeFirstFixedSurface, grib2CloudLevelHash.value(typeFirstFixedSurface));
|
||||||
break;
|
break;
|
||||||
|
case CRAIN:
|
||||||
|
setSurfaceRain(gfld->fld);
|
||||||
|
break;
|
||||||
|
case CSNOW:
|
||||||
|
setSurfaceSnow(gfld->fld);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -599,6 +623,22 @@ namespace BlackWxPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWeatherDataGfs::setSurfaceRain(const g2float *fld)
|
||||||
|
{
|
||||||
|
for (auto gridPointIt = m_gfsWeatherGrid.begin(); gridPointIt < m_gfsWeatherGrid.end(); ++gridPointIt)
|
||||||
|
{
|
||||||
|
gridPointIt->surfaceRainRate = fld[gridPointIt->fieldPosition];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWeatherDataGfs::setSurfaceSnow(const g2float *fld)
|
||||||
|
{
|
||||||
|
for (auto gridPointIt = m_gfsWeatherGrid.begin(); gridPointIt < m_gfsWeatherGrid.end(); ++gridPointIt)
|
||||||
|
{
|
||||||
|
gridPointIt->surfaceSnowRate = fld[gridPointIt->fieldPosition];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BlackCore::IWeatherData *CWeatherDataGfsFactory::create(QObject *parent)
|
BlackCore::IWeatherData *CWeatherDataGfsFactory::create(QObject *parent)
|
||||||
{
|
{
|
||||||
return new CWeatherDataGfs(parent);
|
return new CWeatherDataGfs(parent);
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ namespace BlackWxPlugin
|
|||||||
VGRD,
|
VGRD,
|
||||||
PRES,
|
PRES,
|
||||||
PRMSL,
|
PRMSL,
|
||||||
TCDC
|
TCDC,
|
||||||
|
CRAIN,
|
||||||
|
CSNOW
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Grib2FixedSurfaceTypes
|
enum Grib2FixedSurfaceTypes
|
||||||
@@ -119,6 +121,8 @@ namespace BlackWxPlugin
|
|||||||
int fieldPosition = 0;
|
int fieldPosition = 0;
|
||||||
QHash<int, GfsCloudLayer> cloudLayers;
|
QHash<int, GfsCloudLayer> cloudLayers;
|
||||||
QHash<double, GfsIsobaricLayer> isobaricLayers;
|
QHash<double, GfsIsobaricLayer> isobaricLayers;
|
||||||
|
double surfaceRainRate = 0;
|
||||||
|
double surfaceSnowRate = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
QUrl getDownloadUrl() const;
|
QUrl getDownloadUrl() const;
|
||||||
@@ -134,6 +138,8 @@ namespace BlackWxPlugin
|
|||||||
void setWindU(const g2float *fld, double level);
|
void setWindU(const g2float *fld, double level);
|
||||||
void setCloudCoverage(const g2float *fld, int level);
|
void setCloudCoverage(const g2float *fld, int level);
|
||||||
void setCloudLevel(const g2float *fld, int surfaceType, int level);
|
void setCloudLevel(const g2float *fld, int surfaceType, int level);
|
||||||
|
void setSurfaceRain(const g2float *fld);
|
||||||
|
void setSurfaceSnow(const g2float *fld);
|
||||||
|
|
||||||
BlackMisc::Weather::CWeatherGrid m_grid;
|
BlackMisc::Weather::CWeatherGrid m_grid;
|
||||||
BlackMisc::PhysicalQuantities::CLength m_maxRange;
|
BlackMisc::PhysicalQuantities::CLength m_maxRange;
|
||||||
|
|||||||
Reference in New Issue
Block a user