Retrieve precipitation rate from GFS data

refs #663
This commit is contained in:
Roland Winklmeier
2016-06-10 10:27:53 +02:00
parent eeab2b0568
commit 7ca5d63ce5
5 changed files with 29 additions and 20 deletions

View File

@@ -30,7 +30,7 @@ namespace BlackMisc
CCloudLayer::CCloudLayer(BlackMisc::Aviation::CAltitude base, CCloudLayer::CCloudLayer(BlackMisc::Aviation::CAltitude base,
BlackMisc::Aviation::CAltitude top, BlackMisc::Aviation::CAltitude top,
int precipitationRate, double precipitationRate,
Precipitation precipitation, Precipitation precipitation,
Clouds clouds, Clouds clouds,
Coverage coverage) : Coverage coverage) :

View File

@@ -85,7 +85,7 @@ namespace BlackMisc
//! Constructor //! Constructor
CCloudLayer(BlackMisc::Aviation::CAltitude base, CCloudLayer(BlackMisc::Aviation::CAltitude base,
BlackMisc::Aviation::CAltitude top, BlackMisc::Aviation::CAltitude top,
int precipitationRate, double precipitationRate,
Precipitation precipitation, Precipitation precipitation,
Clouds clouds, Clouds clouds,
Coverage coverage); Coverage coverage);
@@ -103,10 +103,10 @@ namespace BlackMisc
BlackMisc::Aviation::CAltitude getTop() const { return m_top; } BlackMisc::Aviation::CAltitude getTop() const { return m_top; }
//! Set precipitation rate //! Set precipitation rate
void setPrecipitationRate(int rate) { m_precipitationRate = rate; } void setPrecipitationRate(double rate) { m_precipitationRate = rate; }
//! Get precipitation rate //! Get precipitation rate
int getPrecipitationRate() const { return m_precipitationRate; } double getPrecipitationRate() const { return m_precipitationRate; }
//! Set precipitation //! Set precipitation
void setPrecipitation(Precipitation type) { m_precipitation = type; } void setPrecipitation(Precipitation type) { m_precipitation = type; }
@@ -144,7 +144,7 @@ namespace BlackMisc
private: private:
BlackMisc::Aviation::CAltitude m_base; BlackMisc::Aviation::CAltitude m_base;
BlackMisc::Aviation::CAltitude m_top; BlackMisc::Aviation::CAltitude m_top;
int m_precipitationRate = 0; double m_precipitationRate = 0;
Precipitation m_precipitation = NoPrecipitation; Precipitation m_precipitation = NoPrecipitation;
Clouds m_clouds = NoClouds; Clouds m_clouds = NoClouds;
int m_coveragePercent; int m_coveragePercent;

View File

@@ -93,7 +93,7 @@ namespace BlackMisc
static const CCloudLayer cloudLayer( static const CCloudLayer cloudLayer(
CAltitude(0, CAltitude::MeanSeaLevel, CLengthUnit::m()), CAltitude(0, CAltitude::MeanSeaLevel, CLengthUnit::m()),
CAltitude(5000, CAltitude::MeanSeaLevel, CLengthUnit::m()), CAltitude(5000, CAltitude::MeanSeaLevel, CLengthUnit::m()),
5, CCloudLayer::NoPrecipitation, CCloudLayer::NoClouds, 0, CCloudLayer::NoPrecipitation, CCloudLayer::NoClouds,
CCloudLayer::None); CCloudLayer::None);
static const CWindLayer windLayer( static const CWindLayer windLayer(

View File

@@ -33,6 +33,7 @@ namespace BlackWxPlugin
{ {
{ { {0, 0} }, { TMP, "Temperature", "K" } }, { { {0, 0} }, { TMP, "Temperature", "K" } },
{ { {1, 1} }, { RH, "Relative Humidity", "%" } }, { { {1, 1} }, { RH, "Relative Humidity", "%" } },
{ { {1, 7} }, { PRATE, "Precipitation Rate", "kg m-2 s-1" } },
{ { {1, 192} }, { CRAIN, "Categorical Rain", "-" } }, { { {1, 192} }, { CRAIN, "Categorical Rain", "-" } },
{ { {1, 195} }, { CSNOW, "Categorical Snow", "-" } }, { { {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" } },
@@ -133,6 +134,7 @@ namespace BlackWxPlugin
static const QStringList grib2Variables = static const QStringList grib2Variables =
{ {
"PRATE",
"PRES", "PRES",
"PRMSL", "PRMSL",
"RH", "RH",
@@ -280,16 +282,9 @@ 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) if (gfsGridPoint.surfaceSnow > 0.0) { cloudLayer.setPrecipitation(CCloudLayer::Snow); }
{ if (gfsGridPoint.surfaceRain > 0.0) { cloudLayer.setPrecipitation(CCloudLayer::Rain); }
cloudLayer.setPrecipitation(CCloudLayer::Snow); cloudLayer.setPrecipitationRate(gfsGridPoint.surfacePrecipitationRate);
cloudLayer.setPrecipitationRate(gfsGridPoint.surfaceSnowRate);
}
if (gfsGridPoint.surfaceRainRate > 0.0)
{
cloudLayer.setPrecipitation(CCloudLayer::Rain);
cloudLayer.setPrecipitationRate(gfsGridPoint.surfaceRainRate);
}
cloudLayer.setClouds(CCloudLayer::CloudsUnknown); cloudLayer.setClouds(CCloudLayer::CloudsUnknown);
cloudLayers.insert(cloudLayer); cloudLayers.insert(cloudLayer);
} }
@@ -576,6 +571,9 @@ namespace BlackWxPlugin
case PRES: case PRES:
setCloudLevel(gfld->fld, typeFirstFixedSurface, grib2CloudLevelHash.value(typeFirstFixedSurface)); setCloudLevel(gfld->fld, typeFirstFixedSurface, grib2CloudLevelHash.value(typeFirstFixedSurface));
break; break;
case PRATE:
setPrecipitationRate(gfld->fld);
break;
case CRAIN: case CRAIN:
setSurfaceRain(gfld->fld); setSurfaceRain(gfld->fld);
break; break;
@@ -665,7 +663,7 @@ namespace BlackWxPlugin
{ {
for (auto &gridPoint : m_gfsWeatherGrid) for (auto &gridPoint : m_gfsWeatherGrid)
{ {
gridPoint.surfaceRainRate = fld[gridPoint.fieldPosition]; gridPoint.surfaceRain = fld[gridPoint.fieldPosition];
} }
} }
@@ -673,7 +671,15 @@ namespace BlackWxPlugin
{ {
for (auto &gridPoint : m_gfsWeatherGrid) for (auto &gridPoint : m_gfsWeatherGrid)
{ {
gridPoint.surfaceSnowRate = fld[gridPoint.fieldPosition]; gridPoint.surfaceSnow = fld[gridPoint.fieldPosition];
}
}
void CWeatherDataGfs::setPrecipitationRate(const g2float *fld)
{
for (auto &gridPoint : m_gfsWeatherGrid)
{
gridPoint.surfacePrecipitationRate = fld[gridPoint.fieldPosition];
} }
} }

View File

@@ -71,6 +71,7 @@ namespace BlackWxPlugin
RH, RH,
UGRD, UGRD,
VGRD, VGRD,
PRATE,
PRES, PRES,
PRMSL, PRMSL,
TCDC, TCDC,
@@ -124,8 +125,9 @@ 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 surfaceRain = 0;
double surfaceSnowRate = 0; double surfaceSnow = 0;
double surfacePrecipitationRate = 0;
double surfacePressure = 0; double surfacePressure = 0;
double surfaceTemperature = 0; double surfaceTemperature = 0;
}; };
@@ -146,6 +148,7 @@ namespace BlackWxPlugin
void setCloudPressure(const g2float *fld, double level); void setCloudPressure(const g2float *fld, double level);
void setSurfaceRain(const g2float *fld); void setSurfaceRain(const g2float *fld);
void setSurfaceSnow(const g2float *fld); void setSurfaceSnow(const g2float *fld);
void setPrecipitationRate(const g2float *fld);
BlackMisc::PhysicalQuantities::CTemperature calculateDewPoint(const BlackMisc::PhysicalQuantities::CTemperature &temperature, double relativeHumidity); BlackMisc::PhysicalQuantities::CTemperature calculateDewPoint(const BlackMisc::PhysicalQuantities::CTemperature &temperature, double relativeHumidity);