Page 1 of 1

currentUS and metarCustom Blocks Not Working

Posted: Wed Oct 18, 2023 12:04 am
by gjstenbe
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!

Re: currentUS and metarCustom Blocks Not Working

Posted: Wed Oct 18, 2023 11:49 am
by lemimi
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

Re: currentUS and metarCustom Blocks Not Working

Posted: Wed Oct 18, 2023 3:20 pm
by gjstenbe
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!

Re: currentUS and metarCustom Blocks Not Working

Posted: Wed Oct 18, 2023 9:50 pm
by gjstenbe
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

Re: currentUS and metarCustom Blocks Not Working

Posted: Sun Nov 05, 2023 6:13 pm
by alexvanuxem
hi

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

kr

alex

Re: currentUS and metarCustom Blocks Not Working

Posted: Tue Nov 07, 2023 8:07 am
by alexvanuxem
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

Re: currentUS and metarCustom Blocks Not Working

Posted: Tue Nov 07, 2023 5:25 pm
by alexvanuxem
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

Re: currentUS and metarCustom Blocks Not Working

Posted: Wed Nov 08, 2023 1:03 pm
by lemimi
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

Re: currentUS and metarCustom Blocks Not Working

Posted: Wed Nov 08, 2023 3:05 pm
by alexvanuxem
cheers!!

:D

Re: currentUS and metarCustom Blocks Not Working

Posted: Wed Nov 08, 2023 5:14 pm
by alexvanuxem
can you do the same exercise for the metarWeather block,

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

thx

Re: currentUS and metarCustom Blocks Not Working

Posted: Fri Nov 10, 2023 8:56 pm
by El_Viejo
Modified lodData.php. Now the block works fine.
Thank you very much for your contribution.

Re: currentUS and metarCustom Blocks Not Working

Posted: Sat Nov 11, 2023 4:38 pm
by davidefa
Here both blocks updated.

Re: currentUS and metarCustom Blocks Not Working

Posted: Sat Nov 11, 2023 6:18 pm
by El_Viejo
Once again, thank you very much davidefa