Author Topic: advforecast2.php  (Read 7198 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #25 on: July 16, 2017, 10:09:21 PM »
It looks like the NWS changed the HTTP return code for 'point forecast not available' from 500-Server error to 404-Not found

Makes some sense, as the 404-Not Found is the 'missing page' response for HTTP.

Change advforecast2.php V5.02 from
Code: [Select]
  preg_match('/HTTP\/1.1 (\d+)/',$html,$m);
  if(isset($m[1]) and $m[1] >= '500') {
to
Code: [Select]
  preg_match('/HTTP\/1.1 (\d+)/',$html,$m);
  if(isset($m[1]) and $m[1] >= '400') {
and it should fail-over to the Zone forecast as before (when the Point forecast isn't available).

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 321
    • Indian Trail Weather
Re: advforecast2.php
« Reply #26 on: July 16, 2017, 10:22:08 PM »
Ken,

That resolved Pittsburgh and Utica but Hessville is still coming up blank. Maybe something to do with the zone code I'm using for Hessville. I'll look into it further.

There are strange characters preceeding the temperature values for Pittsburgh and Utica.

Thanks.

Jeff
« Last Edit: July 16, 2017, 10:24:48 PM by Breezy »
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #27 on: July 16, 2017, 10:23:31 PM »
Don't forget to use ?force=1 on the URL to reload the cache (or wait for 600 seconds :) )

I'm prepping a 5.03 version with that change...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 321
    • Indian Trail Weather
Re: advforecast2.php
« Reply #28 on: July 16, 2017, 10:28:05 PM »
Hessville's zone forecast is back after using "?force=1". Also has weird characters.

Jeff
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #29 on: July 16, 2017, 10:33:10 PM »
The 'weird characters' are the 'approximate' sign .. the zone forecast (used when the point forecast is not available) uses a range of values (see the text forecast itself).  The script uses the range to determine a middle value of the range and displays that for the temperature under the icon.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #30 on: July 16, 2017, 10:36:02 PM »
And... V5.03 17-Jul-2017 is now available

Standalone users:  use the script page for download.
Saratoga Template users: use the update tool page with a query for Base-USA, Plugin-*, 16-Jul-2017

« Last Edit: July 17, 2017, 12:04:24 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 321
    • Indian Trail Weather
Re: advforecast2.php
« Reply #31 on: July 16, 2017, 10:40:30 PM »
Thanks for all of your help Ken and also for the explanation for the weird characters. When I see them I'll know that the "zone forecast" is being displayed.

Much appreciated as always !!!  =D>  Downloading your latest version.   \:D/

Jeff
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: advforecast2.php
« Reply #32 on: July 17, 2017, 12:24:21 AM »
And... V5.03 17-Jul-2017 is now available
Is the 500 to 400 the only change in 5.03, Ken?

Thanks.
John
W7JKG

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #33 on: July 17, 2017, 12:39:23 AM »
Yes, and the version comment+$Version string.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: advforecast2.php
« Reply #34 on: July 17, 2017, 01:39:06 AM »
Thanks for that, Ken.

What setting did I miss that is making all my dual icons show up small?
John
W7JKG

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #35 on: July 17, 2017, 10:53:19 AM »
You need to change DualImage.php from
Code: [Select]
$outType    = 'jpg';          # =jpg (55x55) =png (86x86) to
Code: [Select]
$outType    = 'png';          # =jpg (55x55) =png (86x86)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline spweather

  • Contributor
  • ***
  • Posts: 125
    • Sand Point Weather
Re: advforecast2.php
« Reply #36 on: July 17, 2017, 11:11:10 AM »
Thanks for the update Ken.

Instead of the $outType setting in DualImage.php, what do you thing of having DualImage.php follow $SITE['fcsticonstype'] in Settings.php?

So the same Settings.php option would control both single image and dual image icons.

Thanks,
Dennis
Regards,
Dennis

- Davis Wireless Vantage Pro2 Plus w/24hr FARS
- Davis (Ultra)Sonic Anemometer
- Boltek/MicroLDN TOA Lightening Detection
- Porcupine Labs LR4/Fluke 414D Laser Rangefinder snow depth measuring sensor


Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: advforecast2.php
« Reply #37 on: July 17, 2017, 11:16:55 AM »
You need to change DualImage.php from
Code: [Select]
$outType    = 'jpg';          # =jpg (55x55) =png (86x86) to
Code: [Select]
$outType    = 'png';          # =jpg (55x55) =png (86x86)
Thank you, Ken. Just kept missing that one. Much better now.
John
W7JKG

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #38 on: July 17, 2017, 11:27:29 AM »
Thanks for the update Ken.

Instead of the $outType setting in DualImage.php, what do you thing of having DualImage.php follow $SITE['fcsticonstype'] in Settings.php?

So the same Settings.php option would control both single image and dual image icons.

Thanks,
Dennis
I had tried that originally, but with limited success -- the reason is that loading Settings.php causes Settings-weather.php to load, along with an associated {wx}-tags.php which may cause the get-USNO-moon.php and metar-conditions to load (with the subsequent delays).  All that to just peel out one setting seemed like too much overhead for just one image, so I stuck with just having the setting locally in the script for fastest performance.

Since the majority of the template sites use the 55x55 .jpg icons, they don't have to change DualImage.php defaults at all.. only sites that elect to use the 86x86 PNG images need to make that one script change.  Folks who use the animated .gif icons from Meteotriviglio don't have a 'dual-image' capability since DualImage.php doesn't support disassembly/extract/reassembly of the animated gif icons, nor does it have static template icons to match the .gif icons.
« Last Edit: July 17, 2017, 11:31:43 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline spweather

  • Contributor
  • ***
  • Posts: 125
    • Sand Point Weather
Re: advforecast2.php
« Reply #39 on: July 17, 2017, 12:00:08 PM »
Makes sense, thanks again Ken.

Dennis
Regards,
Dennis

- Davis Wireless Vantage Pro2 Plus w/24hr FARS
- Davis (Ultra)Sonic Anemometer
- Boltek/MicroLDN TOA Lightening Detection
- Porcupine Labs LR4/Fluke 414D Laser Rangefinder snow depth measuring sensor


Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1307
  • BismarckWeather.net
    • BismarckWeather.net
Re: advforecast2.php
« Reply #40 on: July 17, 2017, 05:43:31 PM »
Something up with the forecast?  I've been only getting the zone forecast today.

http://www.bismarckweather.net/wxforecast.php
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #41 on: July 17, 2017, 06:56:52 PM »
Well, the page on the new site for that forecast https://forecast-v3.weather.gov/point/46.7762,-100.7576 shows
Quote
500 Internal Server Error
Sorry!
Looks like this page is under the weather.

Try to refresh the page, or please let us know by sending us an email including the service ID below.

Your service ID is c582557a-742d-4cd5-8aa4-5e10e25f7fd4.
so something is strange.

As does the search for Bismark,ND on the new site at https://forecast-v3.weather.gov/point/46.8083,-100.7837

So.. they may be loading point forecast data (or had a problem loading it).  Good thing the Zone failover works :)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1307
  • BismarckWeather.net
    • BismarckWeather.net
Re: advforecast2.php
« Reply #42 on: July 18, 2017, 08:46:23 AM »
Looks like it's back up and working this morning.

Thanks for checking on that.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: advforecast2.php
« Reply #43 on: July 18, 2017, 10:36:54 AM »
Running V5.03 but still got the usual error message, with the addition of a 503 Service Unavailable (something new?), rather than dropping back to the other forecast.

Code: [Select]
<!-- advforecast2.php (JSON) - V5.03 - 17-Jul-2017 on PHP 7.0.21-->
<!-- RAW NWS URL: http://forecast.weather.gov/MapClick.php?lat=33.6460&lon=-112.0070&unit=0&lg=english&FcstType=text&TextType=2 -->
<!-- zone=AZZ544 -->
<!-- corrected NWS API URL='https://api.weather.gov/points/33.646,-112.007/forecast' -->
<!-- curl fetching 'https://api.weather.gov/points/33.646,-112.007/forecast' -->
<!-- HTTP stats:  RC=503 dest=23.222.163.46 port=443 (from sce=208.131.135.7)
      Times: dns=0.053 conn=0.069 pxfer=0.122 get=0.236 total=0.358 secs -->
<!-- headers returned:
HTTP/1.1 503 Service Unavailable
Server: nginx
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Type: application/problem+json
X-Powered-By: PHP/5.6.25
Cache-Control: no-cache
Retry-After: 120
Access-Control-Allow-Origin: *
X-Server-ID: vm-bldr-nids-apiapp181.ncep.noaa.gov
X-Correlation-ID: f582fa3b-7266-472f-a7c3-2bd946f50d6b
X-Request-ID: f582fa3b-7266-472f-a7c3-2bd946f50d6b
Content-Length: 373
Date: Tue, 18 Jul 2017 14:27:57 GMT
Connection: keep-alive
Vary: Accept
 -->
<!-- Oops.. point forecast unavailable RC=503 - using Zone instead -->
<!-- curl fetching 'https://api.weather.gov/zones/JSON-LD/AZZ544/forecast' -->
<!-- HTTP stats:  RC=404 dest=23.222.163.46 port=443 (from sce=208.131.135.7)
      Times: dns=0.000 conn=0.016 pxfer=0.067 get=0.198 total=0.265 secs -->
<!-- headers returned:
HTTP/1.1 404 Not Found
Server: nginx
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Type: application/problem+json
X-Powered-By: PHP/5.6.25
Cache-Control: no-cache
Access-Control-Allow-Origin: *
X-Server-ID: vm-bldr-nids-apiapp5.ncep.noaa.gov
X-Correlation-ID: 83323958-c123-4156-a8cc-9f3d5a909cdf
X-Request-ID: 83323958-c123-4156-a8cc-9f3d5a909cdf
Date: Tue, 18 Jul 2017 14:27:57 GMT
Content-Length: 320
Connection: keep-alive
Vary: Accept
 -->
<!-- loaded (Zone forecast) https://api.weather.gov/zones/JSON-LD/AZZ544/forecast - 810 bytes -->
<!-- wrote cache file ./cache/forecast-AZZ544-0-json.txt -->
<!-- meta info re: point='33.646,-112.007' zone='AZZ544' metacache= './cache/forecast-AZZ544-0-json-meta.txt' -->
<!-- metaZoneURL='https://api.weather.gov/zones/forecast/AZZ544' -->
<!-- loaded meta info from ./cache/forecast-AZZ544-0-json-meta.txt -->
<!-- META
Array
(
    [city] => 6 Miles NE Phoenix
    [state] => AZ
    [point] => 33.646,-112.007
    [forecastOfficeURL] => https://api.weather.gov/offices/PSR
    [forecastZoneURL] => https://api.weather.gov/zones/forecast/AZZ544
    [forecastZone] => AZZ544
    [forecastHourlyURL] => https://api.weather.gov/points/33.646,-112.007/forecast/hourly
    [forecastGridDataURL] => https://api.weather.gov/gridpoints/PSR/161,65
    [observationStationsURL] => https://api.weather.gov/points/33.646,-112.007/stations
    [countyZoneURL] => https://api.weather.gov/zones/county/AZC013
    [countyZone] => AZC013
    [fireWeatherZoneURL] => https://api.weather.gov/zones/fire/AZZ132
    [fireWeatherZone] => AZZ132
    [timeZone] => America/Phoenix
    [radarStation] => KIWA
    [zoneName] => North Phoenix/Glendale
    [WFOname] => NWS Phoenix
)
 -->
<p>NWS server https://api.weather.gov/zones/JSON-LD/AZZ544/forecast has an error.</p>
<p>View the source of this page for additional information in HTML comments.</p>


Thanks.
« Last Edit: July 18, 2017, 10:38:56 AM by jgillett »
John
W7JKG

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #44 on: July 18, 2017, 01:15:26 PM »
Well, that's a new one.  A Server fault in the Point forecast and a Not Found in the Zone forecast is not something the script can gracefully recover from :(
When there's 'no data available', there can be no forecast ...

I'm hoping they'll work out the rough spots in api.weather.gov before the August 19 current target for cutover of the new weather.gov site.

Thanks for posting the details!  The diagnostic messages are very helpful.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: advforecast2.php
« Reply #45 on: July 18, 2017, 01:19:08 PM »
My pleasure, Sir. Least I can do after all my nonsense.   :roll:  Thought this one might catch your eye.

"...August 19 current target for cutover..."

Wonder what year they're talking about.
« Last Edit: July 18, 2017, 01:20:56 PM by jgillett »
John
W7JKG

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2573
    • SouthEast Lincoln, NE Weather
Re: advforecast2.php
« Reply #46 on: October 19, 2017, 08:38:05 AM »
As of yesterday afternoon advforecast2.php is falling over to a stale zone forecast here.  I deleted the cache file, but it was just recreated with the same stale data.

I went to the OAX site looking for the point forecast, and it's there.

I'm not sure what the problem is.  Here's the relevant output from advforecast2.php:

Code: [Select]
     <!-- advforecast2.php (JSON) - V5.04 - 11-Oct-2017 on PHP 5.4.19-->
<!-- RAW NWS URL: https://forecast.weather.gov/MapClick.php?CityName=Lincoln&state=NE&site=OAX&textField1=40.8164&textField2=-96.6882&e=0&TextType=2 -->
<!-- zone=NEZ066 -->
<!-- corrected NWS API URL='https://api.weather.gov/points/40.8164,-96.6882/forecast' -->
<!-- loaded cache file ./cache/forecast-NEZ066-0-json.txt - 7861 bytes -->
<!-- point forecast more than 12hrs old (age h:m:s is 18:40:18) .. use Zone forecast instead -->
<!-- curl fetching 'https://api.weather.gov/zones/JSON-LD/NEZ066/forecast' -->
<!-- HTTP stats:  RC=200 dest=23.208.142.15
      Times: dns=0.000 conn=0.010 pxfer=0.075 get=0.011 total=0.086 secs -->
<!-- loaded (Zone forecast) https://api.weather.gov/zones/JSON-LD/NEZ066/forecast - 7861 bytes -->
<!-- wrote cache file ./cache/forecast-NEZ066-0-json.txt -->
<!-- meta info re: point='40.8164,-96.6882' zone='NEZ066' metacache= './cache/forecast-NEZ066-0-json-meta.txt' -->
<!-- metaZoneURL='https://api.weather.gov/zones/forecast/NEZ066' -->
<!-- loaded meta info from ./cache/forecast-NEZ066-0-json-meta.txt -->
<!-- META
Array
(
    [city] => Lincoln
    [state] => NE
    [point] => 40.8164,-96.6882
    [forecastOfficeURL] => https://api.weather.gov/offices/OAX
    [forecastZoneURL] => https://api.weather.gov/zones/forecast/NEZ066
    [forecastZone] => NEZ066
    [forecastHourlyURL] => https://api.weather.gov/points/40.8164,-96.6882/forecast/hourly
    [forecastGridDataURL] => https://api.weather.gov/gridpoints/OAX/56,39
    [observationStationsURL] => https://api.weather.gov/points/40.8164,-96.6882/stations
    [countyZoneURL] => https://api.weather.gov/zones/county/NEC109
    [countyZone] => NEC109
    [fireWeatherZoneURL] => https://api.weather.gov/zones/fire/NEZ066
    [fireWeatherZone] => NEZ066
    [timeZone] => America/Chicago
    [radarStation] => KOAX
    [zoneName] => Lancaster
    [WFOname] => Omaha/Valley, NE
)
 -->

It looks like even though the OAX site is using the current point forecast the API isn't working.  Anything to do but wait for them to fix the issue?
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 946
    • LexMAWeather
Re: advforecast2.php
« Reply #47 on: October 19, 2017, 09:10:34 AM »
Seeing the same thing. API point forecast is stuck at 9:30am EDT Wednesday.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1307
  • BismarckWeather.net
    • BismarckWeather.net
Re: advforecast2.php
« Reply #48 on: October 19, 2017, 09:14:46 AM »
Me Three...
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 946
    • LexMAWeather
Re: advforecast2.php
« Reply #49 on: October 19, 2017, 09:32:00 AM »
I've tried a number of locations and it all comes up zone. Looks like they're mucking with it...

https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

 

anything