Notifications
Clear all

10/18/2023 Map Stopped Working?
Visit this post for the fix

Wrong light color

37 Posts
3 Users
0 Reactions
2,804 Views
(@julien220)
Eminent Member
Joined: 4 years ago
Posts: 21
 

Hi Mark

I have just noticed a color discrepancy. The Military airport LSME shows VFR on the map instead of LIFR. Here is the printout of the link you provided above, note that I included the two last METARs, as the current one, showing the wrong information, does not report a flight category, whereas the one before did, and I don't really understand why... I went a few hours back in time and this seems like a random thing...

<METAR>

<raw_text>LSME 050050Z AUTO 00000KT 0900NDV R04/1500VP2000U R22/1000VP2000D BCFG FEW180 02/02 Q1013 RMK</raw_text>

<station_id>LSME</station_id>

<observation_time>2021-02-05T00:50:00Z</observation_time>

<latitude>47.1</latitude>

<longitude>8.3</longitude>

<temp_c>2.0</temp_c>

<dewpoint_c>2.0</dewpoint_c>

<wind_dir_degrees>0</wind_dir_degrees>

<wind_speed_kt>0</wind_speed_kt>

<altim_in_hg>29.911417</altim_in_hg>

<quality_control_flags>

<auto>TRUE</auto>

</quality_control_flags>

<wx_string>BCFG</wx_string>

<sky_condition sky_cover="FEW" cloud_base_ft_agl="18000"/>

<metar_type>METAR</metar_type>

<elevation_m>427.0</elevation_m>

</METAR>
<METAR>
<raw_text>LSME 050020Z AUTO 00000KT 0750NDV R04/1300VP2000N R22/0750VP2000D BCFG FEW210 02/02 Q1013 RMK</raw_text>
<station_id>LSME</station_id>
<observation_time>2021-02-05T00:20:00Z</observation_time>
<latitude>47.1</latitude>
<longitude>8.3</longitude>
<temp_c>2.0</temp_c>
<dewpoint_c>2.0</dewpoint_c>
<wind_dir_degrees>0</wind_dir_degrees>
<wind_speed_kt>0</wind_speed_kt>
<visibility_statute_mi>1.24</visibility_statute_mi>
<altim_in_hg>29.911417</altim_in_hg>
<quality_control_flags>
<auto>TRUE</auto>
</quality_control_flags>
<wx_string>BCFG</wx_string>
<sky_conditionsky_cover="FEW"cloud_base_ft_agl="21000"/>
<flight_category>IFR</flight_category>
<metar_type>METAR</metar_type>
<elevation_m>427.0</elevation_m>
</METAR>
 
What I also noticed is that the visibility is not reported in the most recent METAR, could this be linked with the flight category not being reported, as well as the LiveSectional software reporting it as VFR weather?
 
Julien

   
ReplyQuote
Mark Harris
(@markyharris)
Member Admin Registered
Joined: 5 years ago
Posts: 559
 

Being a non-US airport, the METAR data may be structured differently. If you will do me a favor and post the same data for the same airport once you notice that the LED is properly reporting the weather then I can compare the two and figure out what might be going on. - Mark


   
ReplyQuote
(@julien220)
Eminent Member
Joined: 4 years ago
Posts: 21
 

Hi Mark

Here is an example where the LED reports the right color. Note that in this example the visibility and flight category are reported, as opposed to when the LED displayed the wrong color.

<METAR>
<raw_text>LSME 091520Z 05003KT 9999 SCT009 OVC016 01/M01 Q1002 RMK WHT</raw_text>
<station_id>LSME</station_id>
<observation_time>2021-02-09T15:20:00Z</observation_time>
<latitude>47.1</latitude>
<longitude>8.3</longitude>
<temp_c>1.0</temp_c>
<dewpoint_c>-1.0</dewpoint_c>
<wind_dir_degrees>50</wind_dir_degrees>
<wind_speed_kt>3</wind_speed_kt>
<visibility_statute_mi>6.21</visibility_statute_mi>
<altim_in_hg>29.586615</altim_in_hg>
<sky_conditionsky_cover="SCT"cloud_base_ft_agl="900"/>
<sky_conditionsky_cover="OVC"cloud_base_ft_agl="1600"/>
<flight_category>MVFR</flight_category>
<metar_type>METAR</metar_type>
<elevation_m>427.0</elevation_m>
</METAR>
 
Julien

   
ReplyQuote
Mark Harris
(@markyharris)
Member Admin Registered
Joined: 5 years ago
Posts: 559
 

Thanks Julien, I'll have to look at the routine in relation to the XML data being returned to see if there is a difference that is causing the software to decode it differently. Feel free to nudge me from time to time so I don't let this fall through the cracks. - Mark


   
ReplyQuote
(@julien220)
Eminent Member
Joined: 4 years ago
Posts: 21
 

From what I understand, by looking at the METAR decoding routine, the software checks for a flight_category report in the XML data. If not provided, it checks sky_conditionsky_cover, then visibility_statute_mi.

When I get the wrong color displayed, it is, from what I have seen, because neither see a flight_category or a visibility_statute_mi are available and therefore the software might not be displaying the right color as it can only judge the weather from sky_conditionsky_cover, which might not be the limiting factor. So my questions about this are:

- Is it possible to get the visibility from another source? Maybe the data is available as visibility_kilometers somewhere else?

- Wouldn't a fallback procedure, such as "if visibility_statute_mi N/A = no_WX_data", be a good transition solution, while we figure a way to decode these special METARs? If you do not judge it necessary to be added to the LiveSectional code, I could modify my unit accordingly, I would just need and appreciate some coding/wording advice 😇 

Julien

 


   
ReplyQuote
Mark Harris
(@markyharris)
Member Admin Registered
Joined: 5 years ago
Posts: 559
 

Yes, that would work fine. It's odd that the METAR would not provide either the flight_category and the visibility and cloud cover. Why publish a METAR at all if that's the case.

As far as another source, the FAA does provide other weather products but none that I know of that provide different data. So if you know of another source that can be poled by an automated script, please let me know and I'll be happy to investigate. - Mark


   
ReplyQuote
(@julien220)
Eminent Member
Joined: 4 years ago
Posts: 21
 

Well the METAR is technically published with a visibility, in one of the above examples it was 0900NDV, being 900m = 0,55mi, No Directional Variation, which is apparently a thing at Swiss military airports. So the METAR is available for people to decode themselves, but I guess the FAA cannot decode the meaning of NDV, as I have yet to see the visibility correctly reported when NDV was in the METAR.

Regarding another source, I just noticed that the Airport Editor page reports the METAR and flight category correctly, even when the XML file does not list a category or visibility! Could the flight category be extracted from this source?

Capture d’écran 2021 02 10 à 23.45.03

Still, just in case of a need for a fallback procedure, could you help me write that code part and specify where I should insert it in the METAR decode routine? I'm guessing it should look something along the lines of the following, but I really know too little about coding to really know:

if metar.find('./forecast/visibility_statute_mi') is not None: #check XML if visibility value exists
visibility_statute_mi = metar.find('./forecast/visibility_statute_mi').text #get visibility number
visibility_statute_mi = float(visibility_statute_mi)

if visibility_statute_mi < 1.0:
flightcategory = "LIFR"

elif 1.0 <= visibility_statute_mi < 3.0:
flightcategory = "IFR"

elif 3.0 <= visibility_statute_mi <= 5.0 and flightcategory != "IFR": #if Flight Category was already set to IFR by clouds, it can't be reduced to MVFR
flightcategory = "MVFR"

elif metar.find('./forecast/visibility_statute_mi') is None:
color = color_nowx

Thanks a lot for your help.

 

Julien


   
ReplyQuote
(@julien220)
Eminent Member
Joined: 4 years ago
Posts: 21
 

Never mind, I think I figured out the fallback by modifying the code as follows:

if metar.find('./forecast/visibility_statute_mi') is not None: #check XML if visibility value exists
visibility_statute_mi = metar.find('./forecast/visibility_statute_mi').text #get visibility number
visibility_statute_mi = float(visibility_statute_mi)

if visibility_statute_mi < 1.0:
flightcategory = "LIFR"

elif 1.0 <= visibility_statute_mi < 3.0:
flightcategory = "IFR"

elif 3.0 <= visibility_statute_mi <= 5.0 and flightcategory != "IFR": #if Flight Category was already set to IFR by clouds, it can't be reduced to MVFR
flightcategory = "MVFR"

else:
flightcategory = "NULL"


This seems to work as I intended, it does not display weather when there could be a discrepancy. I'll check to make sure this does not have any unwanted consequences. Please tell me if you think this workaround isn't a good idea.

Julien


   
ReplyQuote
Mark Harris
(@markyharris)
Member Admin Registered
Joined: 5 years ago
Posts: 559
 

Nice job! Please let us know if this works the way you are expecting. Then I'll look at the code to see if I can/should include this. Thanks - Mark


   
ReplyQuote
(@captain_ron)
Estimable Member
Joined: 5 years ago
Posts: 162
Topic starter  

I'm seeing a conflict between what the category is in the airports editor page and the map as shown.

Screen Shot 2021 02 16 at 11.48.59 AM

 

IMG 1057

Foreflight is showing the airports as VFR

 


   
ReplyQuote
Mark Harris
(@markyharris)
Member Admin Registered
Joined: 5 years ago
Posts: 559
 

Ron, I have to use 2 different weather products for this information. One for the LED's and another for editor. I found that the two products are not synced, so I'm not surprised that there are discrepancies. Also, the data provided on the editor is not updated live. You would have to refresh the page to update the weather, so this could be older data. 

Next time you see this, please refresh the editor and see if it becomes more in line with the LED's. If its still way off, then I've got some detective work to do. Let me know. - Mark


   
ReplyQuote
(@captain_ron)
Estimable Member
Joined: 5 years ago
Posts: 162
Topic starter  

@markyharris Interesting. I think I did reboot the RPI but I'll pay attention next time. Thanks for the info.


   
ReplyQuote
(@julien220)
Eminent Member
Joined: 4 years ago
Posts: 21
 
Posted by: @markyharris

I have to use 2 different weather products for this information. One for the LED's and another for editor.

Hi Mark, may I ask which source you use for the editor? In which file of the NeoSectional folder is this coded?

 

Julien


   
ReplyQuote
Mark Harris
(@markyharris)
Member Admin Registered
Joined: 5 years ago
Posts: 559
 

Hi Julien,

I needed to use AJAX to inject the METAR data into the 'apedit.html' file depending on what the weather is when the editor was loaded. So I had to use the api provided by 'api.weather.gov'. See https://www.weather.gov/documentation/services-web-api for details.

The code that handles this is at the beginning of 'base.html' in the '/templates' directory. https://github.com/markyharris/livesectional/blob/master/templates/base.html

The 'get_badge' routine in 'base.html' is called towards the bottom of 'apedit.html'. https://github.com/markyharris/livesectional/blob/master/templates/apedit.html

Let me know if you have questions about it. - Mark

 


   
ReplyQuote
(@julien220)
Eminent Member
Joined: 4 years ago
Posts: 21
 
I think I found a bug in the METAR Decode Routine to create flight category via cloud cover and/or visibility when flight category is not reported.
 
This is the corresponding METAR
<METAR>
<raw_text>LSMM 172050Z AUTO 26004KT 220V340 7000NDV -SHRASN FEW006 BKN013 OVC016 01/01 Q1021 RMK</raw_text>
<station_id>LSMM</station_id>
<observation_time>2021-03-17T20:50:00Z</observation_time>
<latitude>46.75</latitude>
<longitude>8.12</longitude>
<temp_c>1.0</temp_c>
<dewpoint_c>1.0</dewpoint_c>
<wind_dir_degrees>260</wind_dir_degrees>
<wind_speed_kt>4</wind_speed_kt>
<altim_in_hg>30.147638</altim_in_hg>
<quality_control_flags>
<auto>TRUE</auto>
</quality_control_flags>
<wx_string>-SHRA SN</wx_string>
<sky_conditionsky_cover="FEW"cloud_base_ft_agl="600"/>
<sky_conditionsky_cover="BKN"cloud_base_ft_agl="1300"/>
<sky_conditionsky_cover="OVC"cloud_base_ft_agl="1600"/>
<metar_type>METAR</metar_type>
<elevation_m>570.0</elevation_m>
</METAR>

And the corresponding extract of the logfile

[I 210317 22:21:04 metar-v4:1159] LSMM Not Reporting Flight Category through the API.

[I 210317 22:21:04 metar-v4:1166] FAA xml data does is NOT providing the forecast field for this airport

[D 210317 22:21:04 metar-v4:1169] Sky Cover = FEW

[D 210317 22:21:04 metar-v4:1169] Sky Cover = BKN

[D 210317 22:21:04 metar-v4:1169] Sky Cover = OVC

[D 210317 22:21:04 metar-v4:1184] Cloud Base = 1600

[D 210317 22:21:04 metar-v4:1233] LSMM flight category is Decode script-determined as MVFR

Shouldn't the Cloud Base be 1300 in this case, refering to the BKN013, which is more limiting than the OVC016?

 

- Julien


   
ReplyQuote
Page 2 / 3
Share: