WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Custom Website Templates => Topic started by: saratogaWX on May 24, 2016, 11:20:12 AM

Title: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: saratogaWX on May 24, 2016, 11:20:12 AM
But.. all is not lost.  They have activated HTTP access to an older site which contains the METAR data in the same format.

The METAR information is used in the Saratoga template set for current conditions (all WX software plugins except Weather-Display) and for the wxmetar.php page.
A new version of get-metar-conditions-inc.php (V1.14 23-May-2016) is available on the updates page (http://saratoga-weather.org/wxtemplates/updates.php) Query for Base-*,Plugin-* 23-May-2016 or direct download here (http://saratoga-weather.org/get-metar-conditions-inc.php?sce=view)

The URLs used are changing
from:  http://weather.noaa.gov/pub/data/observations/metar/stations/<ICAO>.TXT
to:     http://tgftp.nws.noaa.gov/data/observations/metar/stations/<ICAO>.TXT


Please do your updates before June 15, 2016 -- the weather.noaa.gov site will be taken offline then and your conditions and metar displays will cease to function on your website if you have not updated the get-metar-conditions-inc.php script to V1.14.  The V1.14 script works NOW and will work after the NWS site decommission.

Thanks to Wim for reminding me about this upcoming change so we (collectively) can be ready.

Best regards,
Ken
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Jasiu on May 24, 2016, 11:39:25 AM
Do you know of any similar change with the forecast site? I have a cron job that runs every 15 mins to get the forecast (and alerts) and I'll occasionally get an email from my provider with an output message from the job (see below) indicating that a redirect was seen. It isn't happening all that often and sometimes comes in spurts for up to an hour. I started seeing these on May 18.

Quote
<!-- redirect found in
HTTP/1.1 200 OK
Server: Apache
X-NIDS-ServerID: vm-lnx-nids-www34
X-Powered-By: PHP/5.3.3
X-UA-Compatible: IE=Edge
Access-Control-Allow-Origin: *
Content-Type: text/html
Date: Tue, 24 May 2016 09:45:01 GMT
Content-Length: 123
Connection: close

&lt;script language='javascript'&gt;window.location.href='http://forecast.weather.gov/MapClick.php?zoneid=MAZ014&amp;zflg=1'&lt;/script&gt; -->

If this has nothing to do with the original subject, I'll create a new question.

Thanks!
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Jáchym on May 24, 2016, 11:39:49 AM
Thanks Ken!
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Jasiu on May 24, 2016, 12:08:25 PM
I'll note that I got an "unable to load" display rather than my current condition displayed until I deleted the current METAR cache file. All is well otherwise.
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: saratogaWX on May 24, 2016, 12:33:39 PM
Do you know of any similar change with the forecast site? I have a cron job that runs every 15 mins to get the forecast (and alerts) and I'll occasionally get an email from my provider with an output message from the job (see below) indicating that a redirect was seen. It isn't happening all that often and sometimes comes in spurts for up to an hour. I started seeing these on May 18.

Quote
<!-- redirect found in
HTTP/1.1 200 OK
Server: Apache
X-NIDS-ServerID: vm-lnx-nids-www34
X-Powered-By: PHP/5.3.3
X-UA-Compatible: IE=Edge
Access-Control-Allow-Origin: *
Content-Type: text/html
Date: Tue, 24 May 2016 09:45:01 GMT
Content-Length: 123
Connection: close

&lt;script language='javascript'&gt;window.location.href='http://forecast.weather.gov/MapClick.php?zoneid=MAZ014&amp;zflg=1'&lt;/script&gt; -->

If this has nothing to do with the original subject, I'll create a new question.

Thanks!

The redirect issue is unrelated to this change (but no need to create a separate topic).  The NWS is decommissioning the weather.noaa.gov website.  That was used by my scripts to get METAR information.  It is used by others for text forecasts, radar images, etc.  The tgftp.nws.noaa.gov site (in existence for many years) was formerly only useable by FTP, but HTTP access has been enabled, and the same document tree (minus the /pub/) exists on the tgftp.nws.noaa.gov site (a blessing for us).

Your issue is with the forecast.weather.gov website.  They have a funky way of doing redirects (with a JavaScript location setting v.s. the normal HTTP 302 redirect with a Location: header) when the normal point-printable forecast is not available -- the redirect sends you to the text-only Zone forecast for the area instead.  My advforecast2.php script detects that, and just parses the text-only forecast to extract and interpolate icons and temperatures for the display.  The point forecast nonavailability happens when they're updating their database, doing maintenance, or something causes a disconnect in their forecast database:webserver connection.

Hope this helps...
Best regards,
Ken

 
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Jasiu on May 24, 2016, 12:58:32 PM
Thanks for the detailed explanation, Ken!!
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Joel on May 24, 2016, 01:23:03 PM
Thanks for the reminder !
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Mearns on June 12, 2016, 12:25:46 PM
Earlier today I updated my get-metar-conditions-inc.php to V1.14 23-May-2016.  All works okay but whereas before my cloud height was shown in feet it is now shown in metres.  I have not changed anything else and as I've not looked at this for many years (and with my limited knowledge) I can't recall how to change cloud height back to feet.  Any help greatly appreciated! http://www.glenbervie-weather.org/wxmetar.php (http://www.glenbervie-weather.org/wxmetar.php)
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Jasiu on June 12, 2016, 01:58:54 PM
Ken will probably chime in here, but until then maybe I can get you close.

In the file get-metar-conditions.php, search for the variable $doMetric. It gets set at the top of the function mtr_get_cloud_cover() based upon the units of temperature used. If you are using C (which I assume you are), then $doMetric gets set true and when CLOUD-DETAILS are processed later in the function, the metric conversion of the value is used.

         $mtrInfo['CLOUDS'] = $cloudCode[$pieces[1]];
         $altitude = (integer) 100 * $pieces[2];  // units are feet
         $altitudeM = round($altitude/3.28084);
         if(!isset($mtrInfo['CLOUD-DETAILS'])) {$mtrInfo['CLOUD-DETAILS'] = '';}
         if($doMetric) {
            $mtrInfo['CLOUD-DETAILS'] .= $cloudCode[$pieces[1]]." ${altitudeM} m\t";
         } else {
            $mtrInfo['CLOUD-DETAILS'] .= $cloudCode[$pieces[1]]." ${altitude} ft\t";
         }


So you'd have to modify the code in one place or the other to display feet.
Title: Re: NOAA NWS decomissioning weather.noaa.gov website June 15, 2016 (METAR source)
Post by: Mearns on June 12, 2016, 03:31:19 PM
Brilliant!! Thanks very much Jasiu. Once you had pointed me to the correct bit I managed to work it out and my cloud bases are now in feet. =D&gt;