Author Topic: NWS Detailed Point Forecast Problem  (Read 3551 times)

0 Members and 1 Guest are viewing this topic.

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 483
    • Lake Huron Weather
Re: NWS Detailed Point Forecast Problem
« Reply #25 on: December 20, 2017, 11:53:10 AM »
Ok, everybody...  I think we've still got time to set up a GoFundMe page and still order that Superman cape shipped via Amazon Prime for Ken!!!   UU \:D/

Thanks Ken...that worked perfectly!!!  At least I can still follow directions (sometimes<grin>).  I don't know exactly what you do for a living nor who you work for or if maybe you work for yourself but one thing is for certain they just don't know what a treasure they must have with you 'cause I know the folks here have one!!!!!!!!!!  Thanks again!!!  =D&gt;

Merry Christmas!!!!
Ed

Yep, agree completely  =D&gt;

Davis Vantage Pro2, Serial Data Logger
WD 10.37S-(b60), VWS V15.00p03, Weatherlink 6.0.3,  Fling 2.35, Broadwave 2.0, Win 7 Pro 64Bit
KMICHEBO10 - CW3699 - Cheboygan, MI

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 3939
    • KomokaWeather
Re: NWS Detailed Point Forecast Problem
« Reply #26 on: December 20, 2017, 12:40:00 PM »
Ditto!
There are a lot of knowledgeable and helpful people here on the forum yet it still amazes me how thorough and to the point Ken can get in analyzing and remedying the things that occur in running our setups.  He is so helpful, yet great in detailing the issue and resolution so that we can hopefully understand and use it on our own in future issues =D&gt;

Thank you Ken, and Merry and Safe Christmas,
Paul

 

Offline tshattuck

  • Senior Contributor
  • ****
  • Posts: 240
    • Your Local Weather - Clay, NY
Re: NWS Detailed Point Forecast Problem
« Reply #27 on: December 21, 2017, 06:12:18 PM »
Folks:
I finally gave up on the NWS getting their Forecast API stabilized. :-x  The Point Forecast has been continually going up and down on an almost daily basis for several weeks.
 
I had a user of my website complain to me yesterday that the NWS forecast displayed on my website home page is useless. The best part was he asked what did I do wrong in setting up the website! So that pushed me to revert back to advforecast2.php v.4.02 and now the NWS forecasts are working correctly. I really didn't want to go backwards but the NWS didn't leave me much choice. It will be interesting to see how this all plays out over the coming months.

Never a dull moment with the NWS.  :roll:

Best regards
« Last Edit: December 21, 2017, 06:14:42 PM by tshattuck »

Offline RickNY

  • Senior Member
  • **
  • Posts: 97
    • College Hills Weather - Farmingville, NY
Re: NWS Detailed Point Forecast Problem
« Reply #28 on: December 22, 2017, 07:28:24 AM »

I think forecast-v3.weather.gov is not right at the moment.. Its not completely down, but its returning all kinds of invalid data.. Example "Cloudy, with a high near 9.96921E+36. Heat index values as high as 9.96921E+36. Southwest wind around 1.1472352069703E+37 mph. Chance of precipitation is 9.96921E+36%. New ice accumulation of 1.993842E+37 to 1.993842E+37 inches possible." -- from https://forecast-v3.weather.gov/point/40.8936,-73.2412




Offline Jasiu

  • Senior Contributor
  • ****
  • Posts: 246
Re: NWS Detailed Point Forecast Problem
« Reply #29 on: December 22, 2017, 09:30:51 AM »
I think the problems are limited to particular locations as I've not had any problems (Boston area) in a while. Although I'm calling BS on the specificity (and it's making me dizzy)  :grin: :

Quote
Freezing rain likely before 6pm, then snow likely before 7pm, then snow likely and sleet likely between 7pm and 8pm, then freezing rain likely between 8pm and 9pm, then a chance of rain between 9pm and midnight, then freezing rain likely.

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1150
  • unnamed weather station, Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: NWS Detailed Point Forecast Problem
« Reply #30 on: December 22, 2017, 10:13:43 AM »
I think the problems are limited to particular locations as I've not had any problems (Boston area) in a while. Although I'm calling BS on the specificity (and it's making me dizzy)  :grin: :
Agreed for Phoenix. The problems continue here on a pretty regular basis but fortunately NWS hasn't killed it nationwide - yet. ?force=1 almost always fixes the problem.
John
W7JKG
BUY FROM AMAZON  HERE... Thank You! :-)

Offline Jasiu

  • Senior Contributor
  • ****
  • Posts: 246
Re: NWS Detailed Point Forecast Problem
« Reply #31 on: December 26, 2017, 10:13:45 AM »
I guess I jinxed myself because now I'm getting week-old zone forecasts...   :-x


Offline spweather

  • Senior Member
  • **
  • Posts: 84
    • Sand Point Weather
Re: NWS Detailed Point Forecast Problem
« Reply #32 on: December 26, 2017, 12:02:40 PM »
Quote
I think the problems are limited to particular locations as I've not had any problems (Boston area) in a while. Although I'm calling BS on the specificity (and it's making me dizzy)

I was going to comment, to agree with this statement, with all those folks having problems, I had not noticed any problems at all.

But I didn't want to jinx myself.

Quote
I guess I jinxed myself because now I'm getting week-old zone forecasts...

Rats! I have to agree with Jasiu again. Out of the blue it has affected my area, this A.M. my forecast reflected erroneous (possibly old) data.

What I don't understand is that the force=1 option did not appear to do anything to my page. I finally went into the remote server with FTP and deleted the forecast-MIZ049-0-json.txt file and that appears to have corrected (for now) my bad data.

Dennis

Davis Wireless Vantage Pro2 Plus w/24hr FARS, Boltek/NexStorm/StormVue NGX/MicroLDN TOA, WL, WD


Offline jgillett

  • Forecaster
  • *****
  • Posts: 1150
  • unnamed weather station, Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: NWS Detailed Point Forecast Problem
« Reply #33 on: December 26, 2017, 12:07:41 PM »
What I don't understand is that the force=1 option did not appear to do anything to my page.
I have found that sometimes it takes more than one application of the force item to correct errors. When it doesn't work it seems to mean NWS is in there right now messing around.
John
W7JKG
BUY FROM AMAZON  HERE... Thank You! :-)

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6620
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Detailed Point Forecast Problem
« Reply #34 on: December 26, 2017, 12:16:28 PM »
All the ?force=1 does is to try and reload the point-forecast JSON file from api.weather.gov.  If it gets a good response (HTTP return code 200), then it stores that in the cache file.  The contents of the JSON may be bad (due to internal issues in the api.weather.gov server), and the script does not address that - it uses a HTTP failure code to load the Zone forecast JSON instead (if api.weather.gov responds that way).  You won't get an offer of '?force=1' unless both the point and Zone forecasts get HTTP failures from api.weather.gov.  The data is not checked (since there's no good way to do a check for good-HTTP-response-but-returns-bad-data).

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 SoMDWx

  • Forecaster
  • *****
  • Posts: 803
    • Southern Maryland Weather
Re: NWS Detailed Point Forecast Problem
« Reply #35 on: December 27, 2017, 12:04:36 PM »
Having the same issue here... Getting "complaints" from the tenants....

Here is the printout from the advforecast2.php results:

<!-- advforecast2.php (JSON) - V5.04 - 11-Oct-2017 on PHP 5.6.32-->
<!-- RAW NWS URL: http://forecast.weather.gov/MapClick.php?lat=38.2604&lon=-76.4459&unit=0&lg=english&FcstType=text&TextType=2 -->
<!-- zone=MDZ017 -->
<!-- corrected NWS API URL='https://api.weather.gov/points/38.2604,-76.4459/forecast' -->
<!-- loaded cache file ./forecast-MDZ017-0-json.txt - 67960 bytes -->
<!-- point forecast more than 12hrs old (age h:m:s is 341:32:43) .. use Zone forecast instead -->
<!-- curl fetching 'https://api.weather.gov/zones/JSON-LD/MDZ017/forecast' -->
<!-- HTTP stats:  RC=200 dest=23.218.148.208 port=443 (from sce=192.252.144.35)
      Times: dns=0.029 conn=0.043 pxfer=0.114 get=0.037 total=0.151 secs -->
<!-- loaded (Zone forecast) https://api.weather.gov/zones/JSON-LD/MDZ017/forecast - 67835 bytes -->
<!-- wrote cache file ./forecast-MDZ017-0-json.txt -->
<!-- meta info re: point='38.2604,-76.4459' zone='MDZ017' metacache= './forecast-MDZ017-0-json-meta.txt' -->
<!-- metaZoneURL='https://api.weather.gov/zones/forecast/MDZ017' -->
<!-- loaded meta info from ./forecast-MDZ017-0-json-meta.txt -->
<!-- META
Array
(
    [city] => Lexington Park
    [state] => MD
    [point] => 38.2604,-76.4459
    [forecastOfficeURL] => https://api.weather.gov/offices/LWX
    [forecastZoneURL] => https://api.weather.gov/zones/forecast/MDZ017
    [forecastZone] => MDZ017
    [forecastHourlyURL] => https://api.weather.gov/gridpoints/LWX/120,45/forecast/hourly
    [forecastGridDataURL] => https://api.weather.gov/gridpoints/LWX/120,45
    [observationStationsURL] => https://api.weather.gov/gridpoints/LWX/120,45/stations
    [countyZoneURL] => https://api.weather.gov/zones/county/MDC037
    [countyZone] => MDC037
    [fireWeatherZoneURL] => https://api.weather.gov/zones/fire/MDZ017
    [fireWeatherZone] => MDZ017
    [timeZone] => America/New_York
    [radarStation] => KDOX
    [zoneName] => St. Marys
    [WFOname] => Baltimore/Washington
)
 -->
Jim Wyman
Southern Maryland Weather
http://somdweather.com
http://scit.somdweather.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6620
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Detailed Point Forecast Problem
« Reply #36 on: December 27, 2017, 12:38:53 PM »
Looks like

<!-- point forecast more than 12hrs old (age h:m:s is 341:32:43) .. use Zone forecast instead -->

the Zone forecast was selected due to the age of the point forecast.

The Zone forecast age is NOT checked, so if it's 'old' too, it still gets displayed.

Both issues are caused by NWS problems getting the GFS data to the api.weather.gov server for publishing.
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 wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1214
    • Support site Leuven Template and scripts
Re: NWS Detailed Point Forecast Problem
« Reply #37 on: December 27, 2017, 01:30:42 PM »
Looks like

<!-- point forecast more than 12hrs old (age h:m:s is 341:32:43) .. use Zone forecast instead -->
the Zone forecast was selected due to the age of the point forecast.
The Zone forecast age is NOT checked, so if it's 'old' too, it still gets displayed.
Both issues are caused by NWS problems getting the GFS data to the api.weather.gov server for publishing.
@saratogaWX
Hello Ken,
http://somdweather.com/somd_main_content.php
The advforecast2.php (JSON) - V5.04 - 11-Oct-201 comments say the forecast is over 12 hours old. See attached html txt

But when I load the data in the browser it correctly follows the redirect and a recent forecast is returned (all times are in UTC.)
https://api.weather.gov/points/38.2604,-76.4459/forecast =>23.218.166.94:443 => http code 301 =>
https://api.weather.gov/gridpoints/LWX/120,45/forecast
Returned data contains the date/time entries
Code: [Select]
   "properties": {
        "updated": "2017-12-27T15:27:32+00:00",
        "units": "us",
        "forecastGenerator": "BaselineForecastGenerator",
        "generatedAt": "2017-12-27T17:59:28+00:00",
        "updateTime": "2017-12-27T15:27:32+00:00",
        "validTimes": "2017-12-27T09:00:00+00:00/P7DT16H",

What date/time is checked to decide the forecast is to old?

When I use on my test site, the same coordinates 38.2604,-76.4459, the recent forecast is always returned.

Wim

Vantage VUE with a WLIP connected to a Meteobridge used for https://weer.sluispark.be/
Same VUE+WLIP uploads to WL.com(2.0)  used for https://sluispark.be/weather28/
Vantage VP2 with a USB logger/Meteobridge for https://www.weerstation-herent.be/
Envoy with a WLIP uploads to WL.com(1.0) as a backup / test for the same site.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6620
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Detailed Point Forecast Problem
« Reply #38 on: December 27, 2017, 03:31:31 PM »
Hi Wim,
It uses
Code: [Select]
  preg_match('!"updated":\s+"([^"]+)"!is', $html, $matches);
  if (isset($matches[1])) {
    $age = time() - strtotime($matches[1]);
    if ($age > 12 * 60 * 60) {
      $agehms = sec2hmsADV($age);
      $Status.= "<!-- point forecast more than 12hrs old (age h:m:s is $agehms) .. use Zone forecast instead -->\n";
      $Force = 2;
      $usingFile = "(Zone forecast)";
      $html = fetchUrlWithoutHanging($backupfileName, $cacheName);
      $lastURL = $backupfileName; // remember if error encountered
      $fSize = strlen($html);
      $Status.= "<!-- loaded $usingFile $backupfileName - $fSize bytes -->\n";
to check the 'age' of the forecast v.s. the internal "updated": info in the JSON.

From SoMDWx example, the cache file was loaded, so I can't tell if the 301 was previously followed by code
Code: [Select]
if ($Force == 1 or !file_exists($cacheName) or (file_exists($cacheName) and filemtime($cacheName) + $refreshTime < time())) {
  $html = fetchUrlWithoutHanging($fileName, $cacheName);
  preg_match('/HTTP\/1.1 (\d+)/', $html, $m);
  if (isset($m[1]) and $m[1] >= '400') {
    $Force = 2;
    $Status.= "<!-- Oops.. point forecast unavailable RC=" . $m[1] . " - using Zone instead -->\n";
  }
  else {
    $lastURL = $fileName; // remember if error encountered
    $fSize = strlen($html);
    $Status.= "<!-- loaded $fileName - $fSize bytes -->\n";
    if (preg_match('/Location: (.*)\r\n/Uis', $html, $matches)) {
      $newLoc = $matches[1];
      $newurl = APIURL . $newLoc;
      $usingFile = "(retry forecast)";
      $html = fetchUrlWithoutHanging($newurl, $cacheName);
      $fSize = strlen($html);
      $Status.= "<!-- loaded $usingFile $newurl - $fSize bytes -->\n";
    }
...
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 saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6620
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Detailed Point Forecast Problem
« Reply #39 on: December 27, 2017, 05:37:22 PM »
Just some notes about the api.weather.gov JSON responses that I've found out (over time) since they aren't officially documented.

1) a HTTP return code of 200 yields a complete response, but sometimes, the data in the point-forecast response is bogus with temps/winds in scientific notation 1E37 values).  That seems to be a glitch in their internal loading of the GFS to the api servers.
2) a HTTP return code of 400 (or 50x) means not available.  Previously, a 503 meant not available, then later codes in the 40x range meant the same thing.  When that happens, the script automatically tries the Zone forecast feed.
3) a HTTP return code of 30x is new for the point-forecast, but those are handled by trying the Location: URL in the header automatically.  In Wim's example above, the point-forecast URL responded with a gridpoint forecast URL instead (hadn't seen that before) but.. it too was more than 12hrs old
Quote
<!-- corrected NWS API URL='https://api.weather.gov/points/38.2604,-76.4459/forecast' -->
<!-- curl fetching 'https://api.weather.gov/points/38.2604,-76.4459/forecast' -->
<!-- HTTP stats:  RC=301 dest=104.91.32.186 port=443 (from sce=192.252.144.35)
      Times: dns=0.041 conn=0.051 pxfer=0.108 get=0.206 total=0.314 secs -->
<!-- headers returned:
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.2
Content-Type: application/problem+json
Location: /gridpoints/LWX/120,45/forecast
Access-Control-Allow-Origin: *
X-Server-ID: vm-bldr-nids-apiapp45.ncep.noaa.gov
X-Correlation-ID: eabf937d-0cb9-4628-984f-997cb35eaadc
X-Request-ID: eabf937d-0cb9-4628-984f-997cb35eaadc
Pragma: no-cache
Content-Length: 349
Cache-Control: private, must-revalidate, max-age=600
Expires: Wed, 27 Dec 2017 18:20:30 GMT
Date: Wed, 27 Dec 2017 18:10:30 GMT
Connection: keep-alive
Vary: Accept
 -->
<!-- loaded https://api.weather.gov/points/38.2604,-76.4459/forecast - 886 bytes -->
<!-- curl fetching 'https://api.weather.gov/gridpoints/LWX/120,45/forecast' -->
<!-- HTTP stats:  RC=200 dest=104.91.32.186 port=443 (from sce=192.252.144.35)
      Times: dns=0.000 conn=0.009 pxfer=0.069 get=0.124 total=0.193 secs -->
<!-- loaded (retry forecast) https://api.weather.gov/gridpoints/LWX/120,45/forecast - 10333 bytes -->
<!-- wrote cache file ./forecast-MDZ017-0-json.txt -->
<!-- point forecast more than 12hrs old (age h:m:s is 18:42:07) .. use Zone forecast instead -->
<!-- curl fetching 'https://api.weather.gov/zones/JSON-LD/MDZ017/forecast' -->
<!-- HTTP stats:  RC=200 dest=104.91.32.186 port=443 (from sce=192.252.144.35)
      Times: dns=0.000 conn=0.009 pxfer=0.058 get=0.022 total=0.080 secs -->
<!-- loaded (Zone forecast) https://api.weather.gov/zones/JSON-LD/MDZ017/forecast - 67960 bytes -->
<!-- wrote cache file ./forecast-MDZ017-0-json.txt -->
so the Zone forecast was fetched and used instead.

It is a challenge to keep up with the ongoing development of api.weather.gov as the HTTP responses have changed over time, and they still haven't got reliable data loading for api.weather.gov data from the GFS system. 

For those not wanting to experience the issues, reverting to V4.02 of advforecast2.php will work as a page-scraper on the existing weather.gov website, but will break when they finally implement the V3 version of their site.
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 Jasiu

  • Senior Contributor
  • ****
  • Posts: 246
Re: NWS Detailed Point Forecast Problem
« Reply #40 on: December 27, 2017, 05:54:39 PM »
I've been seeing the redirect for some time and just never got around to asking about it (since it seems to take care of itself...).

Code: [Select]
<!-- curl fetching 'https://api.weather.gov/points/42.4399,-71.2405/forecast' -->
<!-- HTTP stats:  RC=301 dest=23.52.160.34 port=443 (from sce=74.208.114.109)
      Times: dns=0.253 conn=0.286 pxfer=0.359 get=0.328 total=0.687 secs -->
<!-- headers returned:
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.2
Content-Type: application/problem+json
Location: /gridpoints/BOX/64,79/forecast
Access-Control-Allow-Origin: *
X-Server-ID: vm-bldr-nids-apiapp20.ncep.noaa.gov
X-Correlation-ID: 1a7bc867-92c0-44eb-90d1-f5b2b29dfc24
X-Request-ID: 1a7bc867-92c0-44eb-90d1-f5b2b29dfc24
Pragma: no-cache
Content-Length: 348
Cache-Control: private, must-revalidate, max-age=600
Expires: Wed, 27 Dec 2017 23:01:11 GMT
Date: Wed, 27 Dec 2017 22:51:11 GMT
Connection: keep-alive
Vary: Accept
 -->
<!-- loaded https://api.weather.gov/points/42.4399,-71.2405/forecast - 884 bytes -->
<!-- curl fetching 'https://api.weather.gov/gridpoints/BOX/64,79/forecast' -->
<!-- HTTP stats:  RC=200 dest=23.52.160.34 port=443 (from sce=74.208.114.109)
      Times: dns=0.000 conn=0.036 pxfer=0.112 get=1.189 total=1.301 secs -->
<!-- loaded (retry forecast) https://api.weather.gov/gridpoints/BOX/64,79/forecast - 10047 bytes -->
<!-- wrote cache file ./cache/forecast-MAZ014-0-json.txt -->

I don't remember when I first saw this but it has been consistent since then.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6620
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Detailed Point Forecast Problem
« Reply #41 on: December 28, 2017, 04:00:51 PM »
Sigh.. I just checked out https://forecast-v3.weather.gov/documentation and found:
Quote
How do I discover weather data using the API?

The API uses linked data to allow applications to discover content. Similar to a web site that provides HTML links to help users navigate to each page; linked data helps applications navigate to each endpoint. The /points/location endpoint is the most common endpoint to discover additional API content given the popularity of weather data based upon a location (latitude and longitude).

For example, to discover the endpoint of the raw forecast, the application would first request:

https://api.weather.gov/points/39.7456,-97.0892

This response tells the application where to find relative information–including office, zone and forecast data–for a given point. The application can then use the linked data in the previous response to locate the raw forecast:

https://api.weather.gov/gridpoints/TOP/31,80

If an application knows the office and grid position for a location (through caching—a similar concept to a bookmark for users), the link data would not be needed to locate the content for raw forecast data.

So this is a new method, (and somewhat ill-conceived which requires TWO accesses instead of ONE) to get the point-forecast data based on a lat/long point.  Grrrr... I'll be updating the script to use this as the 'new normal' from them. Based on my quick tests, sometimes the gridpoint URL returns with a 503 (so the Zone failover works).  Sometimes it just returns the 'point' data. 

<rant>
IMHO, an api query should either return the data requested or fail if the data is not available -- returning a 301-Moved Permanently to a different API URI is just a waste of effort and doubles the required accesses to their servers for a point-forecast request.  It would be MUCH better if they just honored the point-forecast request and internally returned the proper gridpoint data as the request.. that would make much more sense from a canonical API standpoint.  The redirect should be reserved to direct to a Zone forecast if the point is not available (as with the current weather.gov handling).
</rant>
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 tmabell

  • Senior Contributor
  • ****
  • Posts: 199
Re: NWS Detailed Point Forecast Problem
« Reply #42 on: December 30, 2017, 10:49:38 AM »
Today I noticed that my system is lacking the font used in DualImage.php.  It calls for this font: fradmcn.ttf.  I know how to obtain it but I'm wondering first if I am missing something?

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 646
  • BismarckWeather.net
    • BismarckWeather.net
Re: NWS Detailed Point Forecast Problem
« Reply #43 on: December 30, 2017, 11:03:47 AM »
For the past few days, I'll get reverted to the point cast.  I usually just go into my cache folder and delete the 3 JSON files, refresh the page, and it's back.  Today, that didn't work.  I got this instead.

"Sorry.. the forecast for Bismarck is not available at this time.

NWS server https://api.weather.gov/points/46.7762,-100.7576/forecast has an error.

View the source of this page for additional information in HTML comments."

I changed to the V4 of the forecast and it's back for now.
http://www.BismarckWeather.net
Davis VP2, Cumulus, Blitzortung, Bloomsky, Saratoga Scripts

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6620
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Detailed Point Forecast Problem
« Reply #44 on: December 30, 2017, 03:23:58 PM »
Today I noticed that my system is lacking the font used in DualImage.php.  It calls for this font: fradmcn.ttf.  I know how to obtain it but I'm wondering first if I am missing something?
The fradmcn.ttf file should be in your ./forecast/icon-templates directory along with the .png icon template images.
For the past few days, I'll get reverted to the point cast.  I usually just go into my cache folder and delete the 3 JSON files, refresh the page, and it's back.  Today, that didn't work.  I got this instead.

"Sorry.. the forecast for Bismarck is not available at this time.

NWS server https://api.weather.gov/points/46.7762,-100.7576/forecast has an error.

View the source of this page for additional information in HTML comments."

I changed to the V4 of the forecast and it's back for now.
Yes, there's been a slew of 503-Server error responses from api.weather.gov lately.  Given it's coming up to a holiday, I doubt that a webmaster is minding the store there..  Moving back to 4.02 is a good choice for now.
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 tmabell

  • Senior Contributor
  • ****
  • Posts: 199
Re: NWS Detailed Point Forecast Problem
« Reply #45 on: December 30, 2017, 07:41:48 PM »
Yes it is located there.  What drew my attention to it was these warnings thrown by PHP7.2:

Code: [Select]
[Sat Dec 30 18:46:12.389872 2017] [php7:warn] [pid 10156:tid 780] [client 192.168.10.156:51814] PHP Warning:  imagettfbbox(): Invalid font filename in C:\\www\\DualImage.php on line 452, referer: https://mymishawakaweather.com/4cast.php
[Sat Dec 30 18:46:12.389872 2017] [php7:warn] [pid 10156:tid 780] [client 192.168.10.156:51814] PHP Warning:  imagettftext(): Invalid font filename in C:\\www\\DualImage.php on line 416, referer: https://mymishawakaweather.com/4cast.php
[Sat Dec 30 18:46:12.389872 2017] [php7:warn] [pid 10156:tid 780] [client 192.168.10.156:51814] PHP Warning:  imagettfbbox(): Invalid font filename in C:\\www\\DualImage.php on line 452, referer: https://mymishawakaweather.com/4cast.php
[Sat Dec 30 18:46:12.389872 2017] [php7:warn] [pid 10156:tid 780] [client 192.168.10.156:51814] PHP Warning:  imagettftext(): Invalid font filename in C:\\www\\DualImage.php on line 408, referer: https://mymishawakaweather.com/4cast.php
[Sat Dec 30 18:46:12.391872 2017] [php7:warn] [pid 10156:tid 568] [client 192.168.10.156:51815] PHP Warning:  imagettfbbox(): Invalid font filename in C:\\www\\DualImage.php on line 452, referer: https://mymishawakaweather.com/4cast.php
[Sat Dec 30 18:46:12.391872 2017] [php7:warn] [pid 10156:tid 568] [client 192.168.10.156:51815] PHP Warning:  imagettftext(): Invalid font filename in C:\\www\\DualImage.php on line 416, referer: https://mymishawakaweather.com/4cast.php
[Sat Dec 30 18:46:12.391872 2017] [php7:warn] [pid 10156:tid 568] [client 192.168.10.156:51815] PHP Warning:  imagettfbbox(): Invalid font filename in C:\\www\\DualImage.php on line 452, referer: https://mymishawakaweather.com/4cast.php
[Sat Dec 30 18:46:12.391872 2017] [php7:warn] [pid 10156:tid 568] [client 192.168.10.156:51815] PHP Warning:  imagettftext(): Invalid font filename in C:\\www\\DualImage.php on line 408, referer: https://mymishawakaweather.com/4cast.php

If I change line 147 to this:

Code: [Select]
$TTfont = 'c:/www/forecast/icon-templates/fradmcn.ttf'; // location/name of TTF font to write PoP on image
The warning notice stops but whats odd is that there is no difference in the appearance of the page from before the change to after.  It makes me wonder if it's a bogus notice?

https://mymishawakaweather.comadvforecast3.php  (My beta test script)
https://mymishawakaweather.com/DualImage.php?sce=view



« Last Edit: December 30, 2017, 07:44:22 PM by tmabell »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6620
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Detailed Point Forecast Problem
« Reply #46 on: December 30, 2017, 08:05:58 PM »
You should never have to change the $TTfont to use absolute addressing.  It should be left as relative addressing as in the distribution of
Code: [Select]
$TTfont = $imgBaseDir . 'fradmcn.ttf'; // location/name of TTF font to write PoP on image
with
Code: [Select]
$imgBaseDir = './forecast/icon-templates/'; # directory for png image sources WITH trailing '/'
I'm running PHP 7.1.12 with GD 2.1.0.  You're running PHP  7.2.0 with GD 2.1.0 .. it may just be a foible with 7.2.0 -- I have to wait for Plesk to release PHP 7.2.0 so I can do further tests.  Also.. you're running Apache on a Windows server (I'm running Apache on a Linux(CentOS) server.
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 tmabell

  • Senior Contributor
  • ****
  • Posts: 199
Re: NWS Detailed Point Forecast Problem
« Reply #47 on: December 30, 2017, 08:14:57 PM »
I'm told time and time again about how Apache on Windows can be a strange beast.

Offline tmabell

  • Senior Contributor
  • ****
  • Posts: 199
Re: NWS Detailed Point Forecast Problem
« Reply #48 on: December 31, 2017, 09:32:08 AM »
I'm always learning so with that in mind I'm wondering why using relative paths is so strongly prefered over absolute paths.

Offline Jasiu

  • Senior Contributor
  • ****
  • Posts: 246
Re: NWS Detailed Point Forecast Problem
« Reply #49 on: December 31, 2017, 10:10:56 AM »
I'm always learning so with that in mind I'm wondering why using relative paths is so strongly prefered over absolute paths.

In particular, with code that is distributed to so many of us, it just can't work any other way because Ken has no way to know what our absolute paths are, much less the capacity to customize versions for each user.

In my own case, I always have a "sandbox" version of my site up where I test things before going live, and the only way that can work is if all paths are relative (there is no one "right" absolute path).  For example, my sandbox is using the new forecast API right now (which happens to be working at this moment) while my life site is running the older version.