mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
[GFS] Use Pressure at MSL instead of surface
Pressure at surface level was the wrong value. All barometers and altimeters use pressure reduced to mean sea level. Reading that value from GFS instead returns much more reasonable values. ref T537
This commit is contained in:
committed by
Mat Sutcliffe
parent
d50811c941
commit
9d1299741e
@@ -141,6 +141,7 @@ namespace BlackWxPlugin
|
||||
|
||||
static const QStringList grib2Levels =
|
||||
{
|
||||
"mean_sea_level",
|
||||
"surface",
|
||||
"100_mb",
|
||||
"150_mb",
|
||||
@@ -329,12 +330,12 @@ namespace BlackWxPlugin
|
||||
cloudLayers.push_back(cloudLayer);
|
||||
}
|
||||
|
||||
auto surfacePressure = PhysicalQuantities::CPressure { gfsGridPoint.surfacePressure, PhysicalQuantities::CPressureUnit::Pa() };
|
||||
auto pressureAtMsl = PhysicalQuantities::CPressure { gfsGridPoint.pressureAtMsl, PhysicalQuantities::CPressureUnit::Pa() };
|
||||
|
||||
CLatitude latitude(gfsGridPoint.latitude, CAngleUnit::deg());
|
||||
CLongitude longitude(gfsGridPoint.longitude, CAngleUnit::deg());
|
||||
auto position = CCoordinateGeodetic { latitude, longitude, {0} };
|
||||
CGridPoint gridPoint({}, position, cloudLayers, temperatureLayers, {}, windLayers, surfacePressure);
|
||||
CGridPoint gridPoint({}, position, cloudLayers, temperatureLayers, {}, windLayers, pressureAtMsl);
|
||||
m_weatherGrid.push_back(gridPoint);
|
||||
}
|
||||
}
|
||||
@@ -515,7 +516,7 @@ namespace BlackWxPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
// http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_temp4-0.shtml
|
||||
// https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-0.shtml
|
||||
g2int parameterCategory = gfld->ipdtmpl[0];
|
||||
g2int parameterNumber = gfld->ipdtmpl[1];
|
||||
g2int typeFirstFixedSurface = gfld->ipdtmpl[9];
|
||||
@@ -538,6 +539,9 @@ namespace BlackWxPlugin
|
||||
case IsobaricSurface:
|
||||
level = std::round(millibarToLevel(valueFirstFixedSurface));
|
||||
break;
|
||||
case MeanSeaLevel:
|
||||
level = 0.0;
|
||||
break;
|
||||
default:
|
||||
CLogMessage(this).warning(u"Unexpected first fixed surface type: %1") << typeFirstFixedSurface;
|
||||
return;
|
||||
@@ -559,9 +563,9 @@ namespace BlackWxPlugin
|
||||
setWindV(gfld->fld, level);
|
||||
break;
|
||||
case PRMSL:
|
||||
setPressureAtMsl(gfld->fld);
|
||||
break;
|
||||
case PRES:
|
||||
setCloudPressure(gfld->fld, level);
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
@@ -694,12 +698,11 @@ namespace BlackWxPlugin
|
||||
}
|
||||
}
|
||||
|
||||
void CWeatherDataGfs::setCloudPressure(const g2float *fld, double level)
|
||||
void CWeatherDataGfs::setPressureAtMsl(const g2float *fld)
|
||||
{
|
||||
for (auto &gridPoint : m_gfsWeatherGrid)
|
||||
{
|
||||
if (level > 0) { /* todo */ }
|
||||
else { gridPoint.surfacePressure = fld[gridPoint.fieldPosition]; }
|
||||
gridPoint.pressureAtMsl = fld[gridPoint.fieldPosition];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace BlackWxPlugin
|
||||
{
|
||||
GroundOrWaterSurface = 1,
|
||||
IsobaricSurface = 100,
|
||||
MeanSeaLevel = 101,
|
||||
LowCloudBottomLevel = 212,
|
||||
LowCloudTopLevel = 213,
|
||||
LowCloudLayer = 214,
|
||||
@@ -130,7 +131,7 @@ namespace BlackWxPlugin
|
||||
double surfaceRain = 0;
|
||||
double surfaceSnow = 0;
|
||||
double surfacePrecipitationRate = 0;
|
||||
double surfacePressure = 0;
|
||||
double pressureAtMsl = 0.0;
|
||||
double surfaceTemperature = 0;
|
||||
};
|
||||
|
||||
@@ -151,7 +152,7 @@ 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 setCloudPressure(const g2float *fld, double level);
|
||||
void setPressureAtMsl(const g2float *fld);
|
||||
void setSurfaceRain(const g2float *fld);
|
||||
void setSurfaceSnow(const g2float *fld);
|
||||
void setPrecipitationRate(const g2float *fld);
|
||||
|
||||
Reference in New Issue
Block a user