currentUS and metarCustom Blocks Not Working

Post Reply
gjstenbe
Observer
Observer
Posts: 14
Joined: Sun Jan 07, 2018 8:51 pm
Location: Yukon, OK, USA
Station model: Davis Vantage Pro 2
Software: Weather Display
Contact:

currentUS and metarCustom Blocks Not Working

Post by gjstenbe » Wed Oct 18, 2023 12:04 am

Greetings everyone. In the process of finalizing my new weather website at my new home in Oklahoma (used to live in the Houston area; new site is at https://www.nicholscreekwx.com). I'm utilizing a stock and then a customized currentUS block to show METAR observations for airports in my immediate vicinity, and then some in other locations that I am interested in following. I know the list is sort of long, but it has always seemed to perform well on cache expiration (or maybe I just don't notice slower load times because it is further down on my page; they are in the right column below the Storm Prediction Center's convective outlook block, and the severe weather probability block).

Things have been working great for the past several weeks with no noticed trouble as I've been tweaking the site. However, this morning I noticed that both of the blocks were empty, and remained empty across several page refreshes. Then, poof, the data started coming in. The problem is that while it looks like it is pulling data for the ICAO codes I'm requesting, instead of labeling them with the airport's name/code, it shows "Unknown Station" for each line item.

Also, I haven't tested in a few days, but the metarCustom block returns (or at least shows) no data on the lines. I've tried ICAO codes for airports all over the place, and nada. Coincidence?

FYI, I did delete the cache files for the two currentUS blocks, and I'm seeing the same thing ("Unknown Station"). Also, for a while this afternoon, all of the locations dropped off again before everything repopulated with data, but still with the "Unknown Station" labels. In case it matters, for the Current Regional Observations block (the one I customized) is pulling the following airport codes: KOKC,KPWA,KHSD,KRCE,KTIK,KGOK,KOUN,KEND. The stock currentUS block right below is pulling these codes: KIAH,KDWH,KSGR,KGLS,KAMA,KMLC,KBRO,KHRL,KPIL,KBTR,TJSJ.

I do know that aviationweather.gov launched their new website yesterday. Wondering if that might have something to do with the trouble with either or both of the blocks?

I don't mind popping the hood and throwing some code at the trouble, but to be honest, this one has me a little stumped. Anyone having the same trouble, or have any thoughts, ideas, suggestions? Any help/guidance is much appreciated! Thanks in advance!

User avatar
lemimi
Advisor
Advisor
Posts: 95
Joined: Wed Dec 12, 2018 3:31 pm
Location: France - Normandie
Station model: Brandson 304557
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by lemimi » Wed Oct 18, 2023 11:49 am

Hello,
The MetarCustom block points to a URL that no longer exists on their server :-(
https://aviationweather.gov/metar/data? ... =0&hours=0
So no more data, at least, for now...
Have a nice day... Michel

gjstenbe
Observer
Observer
Posts: 14
Joined: Sun Jan 07, 2018 8:51 pm
Location: Yukon, OK, USA
Station model: Davis Vantage Pro 2
Software: Weather Display
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by gjstenbe » Wed Oct 18, 2023 3:20 pm

Hi lemimi, and thanks for the response. Looks like one mystery solved, at least concerning the metarCustom block - and an apparent direct result of the move to the new aviationweather.gov website on 16 Oct 2023. The new URL is now https://aviationweather.gov/data/metar/ in case anyone wants to look at it.

Unfortunately, it appears that the new site doesn't offer a decoded METAR option anymore, and it looks like the keywords in a decoded data set are what this block is looking for to parse the returned information. So while the data is there, this block isn't set up to handle the raw METAR returns.

I'm still investigating the source of the "Unknown Station" return in the currentUS block. If anyone sees the problem there jump out at you, please let me know. If I find anything, I'll post back here as well. Thanks!

gjstenbe
Observer
Observer
Posts: 14
Joined: Sun Jan 07, 2018 8:51 pm
Location: Yukon, OK, USA
Station model: Davis Vantage Pro 2
Software: Weather Display
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by gjstenbe » Wed Oct 18, 2023 9:50 pm

It appears that I have had success with the currentUS block! After digging around a little bit on the site, I was able to locate the new location for METARS.

If you change line 16 in the block's loadData.php file from the link that's there
(original code: $url = "https://www.aviationweather.gov/metar/d ... =0&hours=0";)
to the following, it appears to have worked:

Code: Select all

$url = "https://aviationweather.gov/cgi-bin/data/metar.php?ids=".$code."&hours=0&order=id%2C-obs&sep=true";
I am now seeing proper station names and no more "Unknown Station". I'm going to give up on the metarCustom block for now, as that looks to be (at least to this armchair novice PHP programmer) to be a pretty major undertaking.

Anyway, hopefully these discoveries will help someone else out. Thanks to everyone here for making this forum a great resource! Cheers!

Greg

alexvanuxem
Forecaster
Forecaster
Posts: 185
Joined: Mon Jan 31, 2022 4:41 pm
Location: Sint-Katelijne-Waver, Belgium
Station model: Davis Vantage Pro 2
Software: Meteobridge
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by alexvanuxem » Sun Nov 05, 2023 6:13 pm

hi

https://api.checkwx.com/metar/ is still working , but no idea to code it.

kr

alex
Image

alexvanuxem
Forecaster
Forecaster
Posts: 185
Joined: Mon Jan 31, 2022 4:41 pm
Location: Sint-Katelijne-Waver, Belgium
Station model: Davis Vantage Pro 2
Software: Meteobridge
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by alexvanuxem » Tue Nov 07, 2023 8:07 am

the url format needed is slightly changed for the metarCustom block.

https://aviationweather.gov/data/api/#/Data/dataMetars

it seems like it should be something like this:

https://aviationweather.gov/api/data/me ... lse&latest

EBBR is for Brussels Airport as an example

https://aviationweather.gov/data/api/help/

I'm having a crack at the code, but currently without succes.

KR

Alex
Image

alexvanuxem
Forecaster
Forecaster
Posts: 185
Joined: Mon Jan 31, 2022 4:41 pm
Location: Sint-Katelijne-Waver, Belgium
Station model: Davis Vantage Pro 2
Software: Meteobridge
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by alexvanuxem » Tue Nov 07, 2023 5:25 pm

I'm trying to solve this , but my knowledge of php is too low.

the url in loadData.php should be
https://aviationweather.gov/api/data/me ... =0&hours=0

if a replace the &code with EBBR (brussels)

https://aviationweather.gov/api/data/me ... =0&hours=0

i get
METAR for EBBR (Brussels Intl, VL, BE) observed at 1650 UTC 07 Nov 2023
Text: EBBR 071650Z 23012KT CAVOK 09/06 Q1011 NOSIG
Temperature: 9C (48.2 F)
Dewpoint: 6C (42.8 F)
Altimeter: 29.85 inches Hg (1011.0 mb)
Winds: from 230 degrees at 12 knots
Visibility: 6+ sm
Ceiling: ceiling and visibility are OK
Clouds: unknown

but no data in the metarcustomblock.

paging @davidefa
Image

User avatar
lemimi
Advisor
Advisor
Posts: 95
Joined: Wed Dec 12, 2018 3:31 pm
Location: France - Normandie
Station model: Brandson 304557
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by lemimi » Wed Nov 08, 2023 1:03 pm

Hello all of you,
After a lot of research I think I discovered the right URL :-)
If it works for me, it should work for you too.
Modify line 16 of the loadData.php file of the metarCustom block with this:

Code: Select all

$url = "https://aviationweather.gov/cgi-bin/data/metar.php?ids=".$code."&hours=0&order=id%2C-obs&sep=true&format=html";
The block in action, full page, at this address:
https://www.lemimi.fr/template/indexFul ... etarCustom
and at the bottom right on Template: (Link expired)
https://www.lemimi.fr/template/indexDesktop.php (Link expired)
Have a nice day... Michel
Last edited by lemimi on Fri Nov 10, 2023 10:02 pm, edited 2 times in total.

alexvanuxem
Forecaster
Forecaster
Posts: 185
Joined: Mon Jan 31, 2022 4:41 pm
Location: Sint-Katelijne-Waver, Belgium
Station model: Davis Vantage Pro 2
Software: Meteobridge
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by alexvanuxem » Wed Nov 08, 2023 3:05 pm

cheers!!

:D
Image

alexvanuxem
Forecaster
Forecaster
Posts: 185
Joined: Mon Jan 31, 2022 4:41 pm
Location: Sint-Katelijne-Waver, Belgium
Station model: Davis Vantage Pro 2
Software: Meteobridge
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by alexvanuxem » Wed Nov 08, 2023 5:14 pm

can you do the same exercise for the metarWeather block,

I know I'm pushing it.....

thx
Image

El_Viejo
Advisor
Advisor
Posts: 80
Joined: Wed Sep 11, 2019 3:56 pm
Location: Derio - Bizkaia - Spain
Station model: Netatmo

Re: currentUS and metarCustom Blocks Not Working

Post by El_Viejo » Fri Nov 10, 2023 8:56 pm

Modified lodData.php. Now the block works fine.
Thank you very much for your contribution.

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: currentUS and metarCustom Blocks Not Working

Post by davidefa » Sat Nov 11, 2023 4:38 pm

Here both blocks updated.
Attachments
metarWeather_3.2.zip
(413.7 KiB) Downloaded 40 times
metarCustom_1.2.zip
(2.9 KiB) Downloaded 39 times
Image

El_Viejo
Advisor
Advisor
Posts: 80
Joined: Wed Sep 11, 2019 3:56 pm
Location: Derio - Bizkaia - Spain
Station model: Netatmo

Re: currentUS and metarCustom Blocks Not Working

Post by El_Viejo » Sat Nov 11, 2023 6:18 pm

Once again, thank you very much davidefa

Post Reply