nabeelio / phpvms

virtual airline management
http://www.phpvms.net
BSD 3-Clause "New" or "Revised" License
174 stars 144 forks source link

Barometer error in METAR decoding #948

Closed arthurpar06 closed 3 years ago

arthurpar06 commented 4 years ago

On the dashboard page, the current weather forecast for the airport is displayed with a decoding of the metar and therefore its barometer. If we are in America or at least with a metar in InHg and not in hPa. The barometer is displayed in InHg in the Hpa box and therefore in the InHg box it is the conversion of the latter. It should therefore display the barometer in InHg and its conversion to hPa

image For example at PHNL (Honolulu)

FatihKoz commented 4 years ago

Current code always shows the metar reported pressure on the left, then converts it on the right ... Even if you set it to show inHg with $metar['barometer']['inHg'] , it puts the metar recorded value there. As a simple workaround, I removed the unit names from the widget and displaying raw values without units.

Also while checking the metar decoding functions found a little error at App/Support/Metar.php line 175

SKC means Sky Clear (or Clear Skies) but it is translated as "no significant changes expected" (which is NOSIG)

While fixing the pressure problem this little text change would be nice to have.

FatihKoz commented 3 years ago

While working on the TAF update I think I may have found the cause of this problem;

If the airport reports the pressure as hPa (Q1028 for exp) then the display and conversion to inHg is correct. But if the airport reports the pressue as inHg (A3036 for exp) then the conversion is wrong.

My assumption here, that the decoder is always identifying the reported pressure as hPa and building its calculations on that, this also causes the wrongly displayed labels. Decoder always assigns the reported value to hPa.

If needed I can share my solution for the display part, right now I am checking the icao code in the blade (as a workaround) and if the airport resides in a country where pressures are reported as inHg I am using the correct unit type + not showing the wrongly converted value.

As far as I know, there are only 3 countries in the world using inHg as their reported pressure for aviation, these are Canada - Japan and United States. So workaround was easy to manage.

hpa-inhg inhg

FatihKoz commented 3 years ago

Should be closed ... We had two or more PR's for Metar Decoding and mentioned issue was solved with them.