diff --git a/src/plugins/simulator/fscommon/fsuipc.cpp b/src/plugins/simulator/fscommon/fsuipc.cpp index 9daa3d49c..1c442ced6 100644 --- a/src/plugins/simulator/fscommon/fsuipc.cpp +++ b/src/plugins/simulator/fscommon/fsuipc.cpp @@ -148,7 +148,6 @@ namespace BlackSimPlugin for (const auto &cloudLayer : cloudLayers) { NewCloud cloud; - cloud.Coverage = static_cast(cloudLayer.getCoverage()); switch (cloudLayer.getCoverage()) { @@ -164,7 +163,13 @@ namespace BlackSimPlugin cloud.Icing = 0; cloud.LowerAlt = cloudLayer.getBase().value(CLengthUnit::m()); cloud.PrecipBase = 0; - cloud.PrecipRate = static_cast(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(cloudLayer.getPrecipitationRate()); cloud.PrecipType = static_cast(cloudLayer.getPrecipitation()); cloud.TopShape = 0; cloud.Turbulence = 0; diff --git a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp index a428d2514..13f03ca12 100644 --- a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp +++ b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp @@ -31,6 +31,8 @@ namespace BlackWxPlugin { { { {0, 0} }, { TMP, "Temperature", "K" } }, { { {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, 3} }, { VGRD, "V-Component of Wind", "m s-1" } }, { { {3, 0} }, { PRES, "Pressure", "Pa" } }, @@ -104,6 +106,7 @@ namespace BlackWxPlugin static const QStringList grib2Levels = { + "surface", "100_mb", "150_mb", "200_mb", @@ -114,6 +117,7 @@ namespace BlackWxPlugin "700_mb", "800_mb", "900_mb", + "1000_mb", "high_cloud_bottom_level", "high_cloud_layer", "high_cloud_top_level", @@ -134,6 +138,8 @@ namespace BlackWxPlugin "TMP", "UGRD", "VGRD", + "CRAIN", + "CSNOW" }; static const std::array cycles = { { 0, 6, 12, 18 } }; @@ -264,6 +270,16 @@ namespace BlackWxPlugin cloudLayer.setBase(CAltitude(cloudLayerIt.value().bottomLevel, CAltitude::MeanSeaLevel, CLengthUnit::ft())); cloudLayer.setTop(CAltitude(cloudLayerIt.value().topLevel, CAltitude::MeanSeaLevel, CLengthUnit::ft())); 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); } @@ -482,6 +498,8 @@ namespace BlackWxPlugin break; case PRMSL: break; + case PRES: + break; default: Q_ASSERT(false); break; @@ -530,6 +548,12 @@ namespace BlackWxPlugin case PRES: setCloudLevel(gfld->fld, typeFirstFixedSurface, grib2CloudLevelHash.value(typeFirstFixedSurface)); break; + case CRAIN: + setSurfaceRain(gfld->fld); + break; + case CSNOW: + setSurfaceSnow(gfld->fld); + break; default: 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) { return new CWeatherDataGfs(parent); diff --git a/src/plugins/weatherdata/gfs/weatherdatagfs.h b/src/plugins/weatherdata/gfs/weatherdatagfs.h index 844b0d27b..8174bbb44 100644 --- a/src/plugins/weatherdata/gfs/weatherdatagfs.h +++ b/src/plugins/weatherdata/gfs/weatherdatagfs.h @@ -71,7 +71,9 @@ namespace BlackWxPlugin VGRD, PRES, PRMSL, - TCDC + TCDC, + CRAIN, + CSNOW }; enum Grib2FixedSurfaceTypes @@ -119,6 +121,8 @@ namespace BlackWxPlugin int fieldPosition = 0; QHash cloudLayers; QHash isobaricLayers; + double surfaceRainRate = 0; + double surfaceSnowRate = 0; }; QUrl getDownloadUrl() const; @@ -134,6 +138,8 @@ namespace BlackWxPlugin void setWindU(const g2float *fld, double level); void setCloudCoverage(const g2float *fld, 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::PhysicalQuantities::CLength m_maxRange;