Author Topic: advforecast2.php  (Read 984 times)

0 Members and 1 Guest are viewing this topic.

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
advforecast2.php
« on: May 23, 2018, 07:05:26 AM »
This isn't clear how to autoforce forecast. Do I change
Code: [Select]
  $_REQUEST['force']="0"; to
Code: [Select]
  $_REQUEST['force']="1";
Or just change
Code: [Select]
$forceBackup = false;
if ($Force > 1) {$forceBackup = true; }
to
Code: [Select]
$forceBackup = true;
if ($Force > 1) {$forceBackup = true; }

Or change both?

[/code]
Code: [Select]
// You can now force the cache to update by adding ?force=1 to the end of the URL

if ( empty($_REQUEST['force']) )
        $_REQUEST['force']="0";

$Force = $_REQUEST['force'];

$forceBackup = false;
if ($Force > 1) {$forceBackup = true; }
« Last Edit: May 23, 2018, 07:11:25 AM by ValentineWeather »
Randy

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 336
    • LexMAWeather
Re: advforecast2.php
« Reply #1 on: May 23, 2018, 07:42:40 AM »
Exactly what the comment says: add

Code: [Select]
?force=1
to the end of the URL (not in the code, the browser).

E.g., myweather.com/advforecast2.php?force=1



Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #2 on: May 23, 2018, 09:35:47 AM »
Okay thanks, I've never seen that before added at end of php code.
Randy

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #3 on: May 23, 2018, 10:09:31 AM »
I can't find on my website where the browser opens advforecast2.php directly and if I add the force inside Settings.php it fails to open. I can change inside wxforecast.php but I don't think its doing anything because its defaulting to settings.php

The reason I'm doing this is the manual force has become ridiculous 10-20 times a day now. Its driving users away because many don't understand why website doesn't have forecast half the time.  ](*,)
Randy

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1158
  • unnamed weather station, Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: advforecast2.php
« Reply #4 on: May 23, 2018, 10:47:44 AM »
Randy, on your home page you have "7 DAY forecast" in the nav bar (2nd item down). Simply go into the flyout-menu.xml file on your server and modify the URL for that entry to "wxforecast.php?force=1". That way anybody selecting the 7 DAY forecast item from your nav bar will automatically run the force on the forecast. If you don't want it that way simply use https://www.valentinenebraska.net/wxforecast.php?force=1 as your URL to get to your 7 day forecast. There is no reason to go into the code as you have done.

HTH.
« Last Edit: May 23, 2018, 10:49:55 AM by jgillett »
John
W7JKG
BUY FROM AMAZON  HERE... Thank You! :-)

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #5 on: May 23, 2018, 10:57:32 AM »
Let me try again John..I was a blank page before.
Randy

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #6 on: May 23, 2018, 11:00:32 AM »
Working now...Thankyou.  \:D/
Must of had something wrong.
Randy

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 336
    • LexMAWeather
Re: advforecast2.php
« Reply #7 on: May 23, 2018, 11:02:16 AM »
Lets circle back here and get a problem statement. Is the forecast not refreshing regularly? Once the cache file is 10 minutes old (see "$refreshTime in advforecast2.php) it should not matter whether force is set or not - a new forecast should be fetched.


Offline jgillett

  • Forecaster
  • *****
  • Posts: 1158
  • unnamed weather station, Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: advforecast2.php
« Reply #8 on: May 23, 2018, 11:04:33 AM »
Working now...Thankyou.  \:D/
Must of had something wrong.
It is correct in your xml file.
John
W7JKG
BUY FROM AMAZON  HERE... Thank You! :-)

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #9 on: May 23, 2018, 11:35:23 AM »
Lets circle back here and get a problem statement. Is the forecast not refreshing regularly? Once the cache file is 10 minutes old (see "$refreshTime in advforecast2.php) it should not matter whether force is set or not - a new forecast should be fetched.

Yes its become a problem starting with the API issues some forecast offices worse than others I'm told. Maybe I should up the refresh time. Currently

$refreshTime = 600; // default refresh of cache 600=10 minutes

I'm using $Version = 'advforecast2.php (multi) - V4.05 - 21-May-2018';
Randy

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6876
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #10 on: May 23, 2018, 01:19:07 PM »
Version 4.05 doesn't use api.weather.gov -- it 'scrapes' the point-printable forecast page.  Activating a force-a-fetch-on-every-load is NOT a good idea -- it slows down your site and unnecessarily loads the forecast.weather.gov site (which can get your server's IP address blocked by them).

It's better to find exactly what the root cause of the issues are and address that.

One thing to try changing is the forecast URL in Settings.php.
You have
Code: [Select]
http://forecast.weather.gov/MapClick.php?lat=42.87049&lon=-100.55677633445953&unit=0&lg=english&FcstType=text&TextType=2 -- doing a lookup on Valentine, NE makes the current printable forecast as
Code: [Select]
https://forecast.weather.gov/MapClick.php?lat=42.8738&lon=-100.5506&unit=0&lg=english&FcstType=text&TextType=2It may be the unnecessarily long lat/long specs are causing intermittent issues.

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

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #11 on: May 23, 2018, 01:31:00 PM »
Thanks for catching that Ken. I took the force off and changed the coordinates, will see if that clears it up. 
Randy

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6876
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #12 on: May 23, 2018, 01:33:04 PM »
The newer versions of forecast.weather.gov (and the api.weather.gov site) are somewhat twitchy about having more than 4 decimal places on lat/long.  The api.weather.gov insists on exactly 4 places (with trailing zeroes).  Go figure.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #13 on: May 23, 2018, 04:46:20 PM »
No problems since changing to just 4 decimals. By this time yesterday I had half dozen force update request.
My decimals are little different than what Ken had, I used my local NP forecast office.

https://forecast.weather.gov/MapClick.php?lat=42.8741&lon=-100.5511#.WwXSIrsVGpo
Randy

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 334
    • Beachhouse Weather
Re: advforecast2.php
« Reply #14 on: May 25, 2018, 12:33:14 AM »
I'm getting this error with the New Advforecast2 installed?????

Warning: strlen() expects parameter 1 to be string, array given in /home/****/public_html/advforecast2.php on line 601

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6876
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php
« Reply #15 on: May 25, 2018, 01:14:55 AM »
Hmmm... hadn't seen that one before.

Lines 600-602 are
Code: [Select]
if (isset($FCSTJSON['geometry']) and
    strlen($FCSTJSON['geometry']) > 6 and
   strpos($FCSTJSON['geometry'], 'POINT') !== false) { // got a point forecast

Your cache file for that forecast shows
Code: [Select]
{
    "@context": {
        "wx": "https://api.weather.gov/ontology#",
        "geo": "http://www.opengis.net/ont/geosparql#",
        "unit": "http://codes.wmo.int/common/unit/",
        "@vocab": "https://api.weather.gov/ontology#"
    },
    "geometry": {},
    "updated": "2018-05-25T03:30:17+00:00",
    "units": "us",
    "forecastGenerator": "BaselineForecastGenerator",
    "generatedAt": "2018-05-25T04:57:46+00:00",
    "updateTime": "2018-05-25T03:30:17+00:00",
    "validTimes": "2018-05-24T21:00:00+00:00/P7DT17H",
    "elevation": {
        "value": 9.1440000000000001,
        "unitCode": "unit:m"
    },
    "periods": [
so the "geometry" entry is an empty array.  I also note that your point-forecast is not currently available, and you're getting a zone forecast instead.  I'd never seen an empty "geometry" entry in the zone forecast.. A normal one looks like
Code: [Select]
"geometry": "GEOMETRYCOLLECTION (POINT (-93.337348681493 45.019380528644), POLYGON ((-93.352280551998 45.030196194185, -93.352647981926 45.008824953451, -93.322420181345 45.008562878332, -93.32204601069 45.029934099997, -93.352280551998 45.030196194185)))",
Maybe it's a new wrinkle to have an empty "geometry" be an empty array...

Try changing those three lines to be
Code: [Select]
if (isset($FCSTJSON['geometry']) and !is_array($FCSTJSON['geometry']) and
    strlen($FCSTJSON['geometry']) > 6 and
   strpos($FCSTJSON['geometry'], 'POINT') !== false) { // got a point forecast
since we are really expecting a string from the JSON.

Let me know how that works out...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline azkiwi

  • Contributor
  • ***
  • Posts: 135
    • Maricopa, Sonoran Desert, Arizona
Re: advforecast2.php
« Reply #16 on: May 25, 2018, 04:50:34 AM »
I just started (today) getting a similar message  - just different line number --

Warning: strlen() expects parameter 1 to be string, array given in /home/content/26/9257026/html/weather/advforecast2.php on line 491


Ken

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 336
    • LexMAWeather
Re: advforecast2.php
« Reply #17 on: May 25, 2018, 05:22:31 AM »
UGH....  I just ran into this yesterday because I have been using the information returned by:

     https://api.weather.gov/zones/forecast/(Zone ID)
     https://api.weather.gov/zones/county/(County ID)

to get additional polygon information for zones and counties to add to my alert maps. Luckily I cached the old information, but there was a change over the last day or two: The ld+json data no longer returns anything in the "geometry" item.  "geo+json" must be specified to get it:

Code: [Select]
      curl_setopt($ch,CURLOPT_HTTPHEADER,                          // request GEO-JSON format
                  array (
                    "Accept: application/geo+json"
                  ));

Unfortunately, for my case, the format change from the ld -> geo change required some further code changes. It looks like a similar deal for the forecast.

Here is what gets returned for me with ld+json:

Code: [Select]
{
    "@context": {
        "wx": "https://api.weather.gov/ontology#",
        "geo": "http://www.opengis.net/ont/geosparql#",
        "unit": "http://codes.wmo.int/common/unit/",
        "@vocab": "https://api.weather.gov/ontology#"
    },
    "geometry": {},
    "updated": "2018-05-25T07:55:20+00:00",
    "units": "us",
    "forecastGenerator": "BaselineForecastGenerator",
    "generatedAt": "2018-05-25T09:04:43+00:00",
    "updateTime": "2018-05-25T07:55:20+00:00",
    "validTimes": "2018-05-25T01:00:00+00:00/P8DT6H",
    "elevation": {
        "value": 67.970399999999998,
        "unitCode": "unit:m"
    },
    "periods": [
        {
            "number": 1,
            "name": "Overnight",
            "startTime": "2018-05-25T05:00:00-04:00",
            "endTime": "2018-05-25T06:00:00-04:00",
            "isDaytime": false,
            "temperature": 53,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "8 mph",
            "windDirection": "SW",
            "icon": "https://api.weather.gov/icons/land/night/few?size=medium",
            "shortForecast": "Mostly Clear",
            "detailedForecast": "Mostly clear, with a low around 53. Southwest wind around 8 mph."
        },
        {
            "number": 2,
            "name": "Friday",
            "startTime": "2018-05-25T06:00:00-04:00",
            "endTime": "2018-05-25T18:00:00-04:00",
            "isDaytime": true,
            "temperature": 88,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "8 to 15 mph",
            "windDirection": "W",
            "icon": "https://api.weather.gov/icons/land/day/few?size=medium",
            "shortForecast": "Sunny",
            "detailedForecast": "Sunny, with a high near 88. West wind 8 to 15 mph, with gusts as high as 29 mph."
        },
        {
            "number": 3,
            "name": "Friday Night",
            "startTime": "2018-05-25T18:00:00-04:00",
            "endTime": "2018-05-26T06:00:00-04:00",
            "isDaytime": false,
            "temperature": 63,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "7 to 13 mph",
            "windDirection": "SW",
            "icon": "https://api.weather.gov/icons/land/night/sct?size=medium",
            "shortForecast": "Partly Cloudy",
            "detailedForecast": "Partly cloudy, with a low around 63. Southwest wind 7 to 13 mph, with gusts as high as 23 mph."
        },
        {
            "number": 4,
            "name": "Saturday",
            "startTime": "2018-05-26T06:00:00-04:00",
            "endTime": "2018-05-26T18:00:00-04:00",
            "isDaytime": true,
            "temperature": 84,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "3 to 13 mph",
            "windDirection": "NW",
            "icon": "https://api.weather.gov/icons/land/day/sct/tsra_hi,30?size=medium",
            "shortForecast": "Mostly Sunny then Chance Showers And Thunderstorms",
            "detailedForecast": "A chance of showers and thunderstorms after 2pm. Mostly sunny, with a high near 84. Northwest wind 3 to 13 mph. Chance of precipitation is 30%. New rainfall amounts less than a tenth of an inch possible."
        },
        {
            "number": 5,
            "name": "Saturday Night",
            "startTime": "2018-05-26T18:00:00-04:00",
            "endTime": "2018-05-27T06:00:00-04:00",
            "isDaytime": false,
            "temperature": 55,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "7 to 12 mph",
            "windDirection": "NE",
            "icon": "https://api.weather.gov/icons/land/night/tsra,50?size=medium",
            "shortForecast": "Chance Showers And Thunderstorms",
            "detailedForecast": "A chance of showers and thunderstorms. Cloudy, with a low around 55. Northeast wind 7 to 12 mph. Chance of precipitation is 50%."
        },
        {
            "number": 6,
            "name": "Sunday",
            "startTime": "2018-05-27T06:00:00-04:00",
            "endTime": "2018-05-27T18:00:00-04:00",
            "isDaytime": true,
            "temperature": 58,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "9 mph",
            "windDirection": "NE",
            "icon": "https://api.weather.gov/icons/land/day/tsra,60/tsra,50?size=medium",
            "shortForecast": "Showers And Thunderstorms Likely",
            "detailedForecast": "Showers and thunderstorms likely. Cloudy, with a high near 58. Chance of precipitation is 60%."
        },
        {
            "number": 7,
            "name": "Sunday Night",
            "startTime": "2018-05-27T18:00:00-04:00",
            "endTime": "2018-05-28T06:00:00-04:00",
            "isDaytime": false,
            "temperature": 51,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "5 to 8 mph",
            "windDirection": "NE",
            "icon": "https://api.weather.gov/icons/land/night/rain_showers,30/rain_showers?size=medium",
            "shortForecast": "Chance Rain Showers",
            "detailedForecast": "A chance of rain showers before 2am, then patchy fog and a slight chance of rain showers. Cloudy, with a low around 51. Chance of precipitation is 30%."
        },
        {
            "number": 8,
            "name": "Memorial Day",
            "startTime": "2018-05-28T06:00:00-04:00",
            "endTime": "2018-05-28T18:00:00-04:00",
            "isDaytime": true,
            "temperature": 68,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "5 mph",
            "windDirection": "E",
            "icon": "https://api.weather.gov/icons/land/day/rain_showers?size=medium",
            "shortForecast": "Slight Chance Rain Showers",
            "detailedForecast": "A slight chance of rain showers before 5pm. Cloudy, with a high near 68."
        },
        {
            "number": 9,
            "name": "Monday Night",
            "startTime": "2018-05-28T18:00:00-04:00",
            "endTime": "2018-05-29T06:00:00-04:00",
            "isDaytime": false,
            "temperature": 57,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "6 mph",
            "windDirection": "SW",
            "icon": "https://api.weather.gov/icons/land/night/bkn/fog?size=medium",
            "shortForecast": "Mostly Cloudy then Patchy Fog",
            "detailedForecast": "Patchy fog after midnight. Mostly cloudy, with a low around 57."
        },
        {
            "number": 10,
            "name": "Tuesday",
            "startTime": "2018-05-29T06:00:00-04:00",
            "endTime": "2018-05-29T18:00:00-04:00",
            "isDaytime": true,
            "temperature": 82,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "6 mph",
            "windDirection": "NW",
            "icon": "https://api.weather.gov/icons/land/day/fog/sct?size=medium",
            "shortForecast": "Patchy Fog then Mostly Sunny",
            "detailedForecast": "Patchy fog before 8am. Mostly sunny, with a high near 82."
        },
        {
            "number": 11,
            "name": "Tuesday Night",
            "startTime": "2018-05-29T18:00:00-04:00",
            "endTime": "2018-05-30T06:00:00-04:00",
            "isDaytime": false,
            "temperature": 55,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "5 mph",
            "windDirection": "N",
            "icon": "https://api.weather.gov/icons/land/night/few?size=medium",
            "shortForecast": "Mostly Clear",
            "detailedForecast": "Mostly clear, with a low around 55."
        },
        {
            "number": 12,
            "name": "Wednesday",
            "startTime": "2018-05-30T06:00:00-04:00",
            "endTime": "2018-05-30T18:00:00-04:00",
            "isDaytime": true,
            "temperature": 79,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "5 mph",
            "windDirection": "E",
            "icon": "https://api.weather.gov/icons/land/day/few?size=medium",
            "shortForecast": "Sunny",
            "detailedForecast": "Sunny, with a high near 79."
        },
        {
            "number": 13,
            "name": "Wednesday Night",
            "startTime": "2018-05-30T18:00:00-04:00",
            "endTime": "2018-05-31T06:00:00-04:00",
            "isDaytime": false,
            "temperature": 55,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "5 mph",
            "windDirection": "SW",
            "icon": "https://api.weather.gov/icons/land/night/few?size=medium",
            "shortForecast": "Mostly Clear",
            "detailedForecast": "Mostly clear, with a low around 55."
        },
        {
            "number": 14,
            "name": "Thursday",
            "startTime": "2018-05-31T06:00:00-04:00",
            "endTime": "2018-05-31T18:00:00-04:00",
            "isDaytime": true,
            "temperature": 80,
            "temperatureUnit": "F",
            "temperatureTrend": null,
            "windSpeed": "7 mph",
            "windDirection": "SW",
            "icon": "https://api.weather.gov/icons/land/day/sct?size=medium",
            "shortForecast": "Mostly Sunny",
            "detailedForecast": "Mostly sunny, with a high near 80."
        }
    ]
}

If I include the whole geo+json I go over the character limit for the post, but here is the significant snippet:

Code: [Select]
    "@context": [
        "https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld",
        {
            "wx": "https://api.weather.gov/ontology#",
            "geo": "http://www.opengis.net/ont/geosparql#",
            "unit": "http://codes.wmo.int/common/unit/",
            "@vocab": "https://api.weather.gov/ontology#"
        }
    ],
    "type": "Feature",
    "geometry": {
        "type": "GeometryCollection",
        "geometries": [
            {
                "type": "Point",
                "coordinates": [
                    -71.228896500000005,
                    42.449024100000003
                ]
            },
            {
                "type": "Polygon",
                "coordinates": [
                    [
                        [
                            -71.240829500000004,
                            42.461619499999998
                        ],
                        [
                            -71.245964700000002,
                            42.4402179
                        ],
                        [
                            -71.216966600000006,
                            42.436427100000003
                        ],
                        [
                            -71.211825300000001,
                            42.457828300000003
                        ],
                        [
                            -71.240829500000004,
                            42.461619499999998
                        ]
                    ]
                ]
            }
        ]
    },

Sigh......

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #18 on: May 25, 2018, 06:52:30 AM »
Everyone using the 5.xx version try the older updated version V4.05

https://saratoga-weather.org/advforecast2-V4.05.php?sce=view

Seems to load better if you change Settings.php to match NWS location using zip or town name and only carry 4 decimals. I was using a custom location with a string of 9 decimals and was getting multiple force updates daily until I changed to match.

 https://forecast.weather.gov/MapClick.php?textField1=41.1403&textField2=-100.7601#.Wwfr831Eqpo
« Last Edit: May 25, 2018, 07:03:22 AM by ValentineWeather »
Randy

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 334
    • Beachhouse Weather
Re: advforecast2.php
« Reply #19 on: May 25, 2018, 07:39:24 AM »
Hmmm... hadn't seen that one before.

Lines 600-602 are
Code: [Select]
if (isset($FCSTJSON['geometry']) and
    strlen($FCSTJSON['geometry']) > 6 and
   strpos($FCSTJSON['geometry'], 'POINT') !== false) { // got a point forecast

Your cache file for that forecast shows
Code: [Select]
{
    "@context": {
        "wx": "https://api.weather.gov/ontology#",
        "geo": "http://www.opengis.net/ont/geosparql#",
        "unit": "http://codes.wmo.int/common/unit/",
        "@vocab": "https://api.weather.gov/ontology#"
    },
    "geometry": {},
    "updated": "2018-05-25T03:30:17+00:00",
    "units": "us",
    "forecastGenerator": "BaselineForecastGenerator",
    "generatedAt": "2018-05-25T04:57:46+00:00",
    "updateTime": "2018-05-25T03:30:17+00:00",
    "validTimes": "2018-05-24T21:00:00+00:00/P7DT17H",
    "elevation": {
        "value": 9.1440000000000001,
        "unitCode": "unit:m"
    },
    "periods": [
so the "geometry" entry is an empty array.  I also note that your point-forecast is not currently available, and you're getting a zone forecast instead.  I'd never seen an empty "geometry" entry in the zone forecast.. A normal one looks like
Code: [Select]
"geometry": "GEOMETRYCOLLECTION (POINT (-93.337348681493 45.019380528644), POLYGON ((-93.352280551998 45.030196194185, -93.352647981926 45.008824953451, -93.322420181345 45.008562878332, -93.32204601069 45.029934099997, -93.352280551998 45.030196194185)))",
Maybe it's a new wrinkle to have an empty "geometry" be an empty array...

Try changing those three lines to be
Code: [Select]
if (isset($FCSTJSON['geometry']) and !is_array($FCSTJSON['geometry']) and
    strlen($FCSTJSON['geometry']) > 6 and
   strpos($FCSTJSON['geometry'], 'POINT') !== false) { // got a point forecast
since we are really expecting a string from the JSON.

Let me know how that works out...
Hi Ken Thank you that seems to have taken care of the error I am getting this now on the forecast page but am guessing it is a NOAA issue??

The detailed point forecast weather data is not currently available.
The zone forecast data for WAZ021 (South Washington Coast) will be displayed
until the point forecast data is again available.
If this persists, contact the NWS Portland, OR WFO
at (503) 261-9246 or email at w-pqr.webmaster@noaa.gov
to have them update the point forecast for /gridpoints/PQR/76,150 on api.weather.gov

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 336
    • LexMAWeather
Re: advforecast2.php
« Reply #20 on: May 25, 2018, 07:42:45 AM »
At this point it looks like this is a real change in the returned data from NWS, so there are two workarounds right now until the code is updated:

1) Use the 4.0x version.

2) Use the 5.0x version with "is_array" change from Ken and deal with always getting a zone forecast.

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2036
    • SouthEast Lincoln, NE Weather
Re: advforecast2.php
« Reply #21 on: May 25, 2018, 08:19:51 AM »
Thanks, Ken.  The fix described above clears up the array-based error, but I'm still getting zone forecasts.

So, I've reverted to the old-new v4.05 advforecast2.php in order to display point forecasts until the NWS figures this one out.
Regards, Jerry Wilkins
gwwilk@inebraska.com

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 3231
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: advforecast2.php
« Reply #22 on: May 25, 2018, 08:30:46 AM »
I have the 4.01 version and I am getting this:

Quote
The detailed point forecast weather data is not currently available.
The zone forecast data for MIZ018 (Presque Isle) will be displayed
until the point forecast data is again available.
If this persists, contact the NWS Gaylord, MI WFO
at 989-731-3384 or email at w-apx.webmaster@noaa.gov
to have them update the point forecast for /gridpoints/APX/85,80 on api.weather.gov

I tried the URL force option to no avail.

I just now tried the 4-decimal lat/lon recommendation and it seems to have worked...

p.s. I had previously copied/pasted the lat/lon from my Blitzortung detector GUI which was crazy precise but easy to do.

Greg H.
« Last Edit: May 25, 2018, 08:33:24 AM by miraculon »


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 3231
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: advforecast2.php
« Reply #23 on: May 25, 2018, 08:35:17 AM »
Oh shoot, I got an old forecast from March....
I just made things worse...

Back to 5.07 and the zone forecast. At least it is current.

Greg H.
« Last Edit: May 25, 2018, 09:14:12 AM by miraculon »


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 5472
Re: advforecast2.php
« Reply #24 on: May 25, 2018, 08:58:05 AM »
Randy