Author Topic: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script  (Read 8983 times)

0 Members and 1 Guest are viewing this topic.

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
beteljuice NOAA this day temperature records / 'norms' - requires inclusion in a .php page

Ver #4.0 now available ... 27 Aug 2021

Data available for US only - sorry

This was originally meant to replace WU data in ALT dashboard, but is quite happy as a 'stand-alone'.
See this thread for discussion > https://www.wxforum.net/index.php?topic=37154.0

See this post for explanation of Ver #3.0 > https://www.wxforum.net/index.php?topic=37220.msg384607#msg384607

The script file can be used as a stand-alone - NO dependences - Be aware units are deg F
For stand-alone use php variables available are:
   $thisDayMax, $thisDayMaxYear
   $thisDayMin, $thisDayMinYear
   $thisDayMaxAvg (Norm)
   $thisDayMinAvg (Norm)
   
See running in debug mode and get zip > FROM HERE <

betel_noaa.zip contains:

noaarec.php    include file that does all the work
patch.html      replacement for section of ALT dashboard / example of useage
README.txt     Do what it says !

Upon execution a cachefile will be created called noaarecdat.txt

TIP - Get noaarec.php?noaabug working BEFORE you commit to modifying dashboard

Ver #3.0
noaarec.php - Improved debug, error handling, comments.
                    copes with upto 48hrs of NOAA errors.
patch.html   - No change
README.txt  - Minor change

Ver #4.0
noaarec.php - Mods by Ken True for url changes and call methodology (Thanks  ;) )

Use or abuse - upto you  :-P
« Last Edit: August 27, 2021, 06:23:06 PM by the beteljuice »
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #1 on: June 20, 2019, 08:11:18 AM »
Version #2 - 20th June 2019

See above - improved debug and instructions ...
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Feedback Please ..... Temperatures (NOAA) - PHP Script
« Reply #2 on: June 24, 2019, 07:01:10 AM »
Knock ... Knock ...

Feedback please.

Topics concerning WD alt-dashboard and loss of WU 'this date' temps.
 views > 2000, posts > 200

This replacement, which can also be used in any (US) template / page.
 views 200, others posts 0  #-o

Is anyone using it ?
Is there anything that readers of this post / debug / demo page don't understand ?  :shock:
Is there anybody out there   :???:
Imagine what you will KNOW tomorrow !

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #3 on: June 25, 2019, 11:21:28 AM »
Working good here - www.mikeymsweather.com

Thanks

Cheers

 [tup]

MikeyM

Offline tbrasel

  • Contributor
  • ***
  • Posts: 141
    • Northwest Arkansas Weather.com
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #4 on: June 25, 2019, 01:07:11 PM »
Yes, I am using your script without any issues.

Thank you.
Best Regards
tbrasel

Bentonville Arkansas, USA
Hardware: Davis 6153 - Wireless Vantage Pro2 with FARS
Software: VWS V15.00
Website: https://www.nwarwx.com

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 558
    • Up Country Maui Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #5 on: June 25, 2019, 05:31:15 PM »
Hi beteljuice,

Got this started on the other topic and thank you for finding a solution to this issues that WU has dropped.

Working just fine so far as long as our NWS does not do any changes as they sometimes do.

I see on the other WD Forum that they are having issues with this. Here: https://www.weather-watch.com/smf/index.php/topic,68068.0.html

Thank you again for all that you have done and I will post it on the other part as resolved.

Best Regards,

--Stan Y.
   Maui, Hawaii
« Last Edit: June 26, 2019, 12:25:12 PM by Silversword »
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #6 on: June 25, 2019, 09:35:03 PM »
You should know that I'm using your script on my testing site, and it's working just fine. [tup]
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #7 on: June 26, 2019, 11:36:25 AM »
Working fine here - http://tiggrweather.net/. And I know it's right - one does not forget temps like this ORH (record setting anniversary is today, 26 June 1990)...
John
W7JKG

Offline thebigboi

  • Member
  • *
  • Posts: 24
    • Murfreesboro Weather Station
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #8 on: June 26, 2019, 12:18:01 PM »
Can you please look at my site http://murfreesboroweather.com/ and tell me what I'm doing wrong. thanks.

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 558
    • Up Country Maui Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #9 on: June 26, 2019, 12:29:45 PM »
Can you please look at my site http://murfreesboroweather.com/ and tell me what I'm doing wrong. thanks.

Hi,

I think you need to put this line into your dashboard script:

include_once('noaarec.php');

Hope that is the issue with yours as I had that issue.

Regards,

--Stan Y.
   Maui, Hawaii
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #10 on: June 26, 2019, 05:35:47 PM »
@thebigboi

Strange .... ATM NOAA don't have any record highs for you (although they do tomorrow)
http://murfreesboroweather.com/noaarec.php?noaabug

Code: [Select]
...............................................................
TEMPERATURE (F)
 TODAY
  MINIMUM         70    406 AM  51    1974  68      2

PRECIPITATION (IN)
  TODAY            0.00          3.23 1994   0.12  -0.12
  MONTH TO DATE    6.60                      3.63   2.97
  SINCE JAN 1     36.07                     24.93  11.14

It looks like noaarec.php is crashing in an unexpected way.

.... the beteljuice is investigating - thank you.
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #11 on: June 26, 2019, 05:45:08 PM »
@thebigboi

Ahhh . your TZ has been set to UTC

Try moving the include further up the page OR setting your TZ in noaarec.php

See if that fixes things .....

EDIT: Suddenly working on both your site and my test - must have been some unforeseen corruption on NOAA page.

You still need to fix your TZ problem ..
« Last Edit: June 26, 2019, 06:18:06 PM by the beteljuice »
Imagine what you will KNOW tomorrow !

Offline thebigboi

  • Member
  • *
  • Posts: 24
    • Murfreesboro Weather Station
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #12 on: June 26, 2019, 06:58:57 PM »
It looks like that did the trick. Thanks so much. I will watch and compare to the NOAA site. Right now, I have been locked out for being on their site too long. Like you noticed I don't know where it would get the high.

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #13 on: June 26, 2019, 09:36:22 PM »
Anyone a member of this forum https://www.weather-watch.com/smf/index.php/topic,68068.0.html and can give them "the nod" ?
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
UPDATE: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #14 on: June 27, 2019, 06:52:45 AM »
UPDATE V2.1

noaarec.php - error handling for complete line of data missing (NOAA problem)

See first post for link .........
Imagine what you will KNOW tomorrow !

Offline ed2kayak

  • Ed
  • Forecaster
  • *****
  • Posts: 613
  • Davis Vantage Pro2 w/12 hr FARS, solar/uv
    • Cumberland Valley Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #15 on: June 27, 2019, 08:47:09 AM »
I updated to v2.1
Only made changes in 1 file noaarec.php
Getting error -
 ** NO MAXIMUM temp line found !! **

** NO MINIMUM temp line found !! **

Worked previously, debug mode  does shows max/min temps.

cvweather.org

Thanks for your work on this project. Appreciate it!

Ed
« Last Edit: June 27, 2019, 08:49:07 AM by ed2kayak »
Ed
CoCoRaHS PA-CD-6,  Weather Underground KPAMECHA7, CWOP DW5425

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1308
  • BismarckWeather.net
    • BismarckWeather.net
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #16 on: June 27, 2019, 12:54:06 PM »
OK, I had it working for like 5 minutes.  Then it quit.  What am I missing?

https://www.bismarckweather.net/noaarec.php?noaabug

I'm at 2.1, but getting:
** NO MAXIMUM temp line found !! **

** NO MINIMUM temp line found !! **
« Last Edit: June 27, 2019, 12:56:42 PM by 92merc »
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1308
  • BismarckWeather.net
    • BismarckWeather.net
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #17 on: June 27, 2019, 01:11:18 PM »
I'm guessing it has to be something in the way it's included into my standard ajax-dashboard.  I've added in the TZ setting to noaarec.php.  I've moved the include basically to the top.

But the debug page shows the right data.
https://www.bismarckweather.net/noaarec.php?noaabug
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline thebigboi

  • Member
  • *
  • Posts: 24
    • Murfreesboro Weather Station
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #18 on: June 27, 2019, 02:16:33 PM »
Well, it looks like the issues from yesterday have come back again today. It does not appear it is anything wrong with the script but rather the fact that the NOAA site does not publish the high temperatures (max and avg.) for much of the day. I ran the debug and it is returning the exact same thing as the NOAA site shows which is no max and avg. high temperatures. Oddly, it does show that very information for the next day. Is there any way to harvest that information and save it for the following day? The only reason I say that is that NOAA site is consistent in that it seems to always show the information for the next day.

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1308
  • BismarckWeather.net
    • BismarckWeather.net
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #19 on: June 27, 2019, 04:01:11 PM »
I've reverted my dashboard back to my own homebrewed solution until an answer is found.  It's easy for me to rename and flip back for testing.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
update fix: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #20 on: June 27, 2019, 04:36:44 PM »
Apologies to all !

beteljuice schoolboy error - missed $ on a var name  :oops: #-o

I don't have a working site, so can only test with the debug, which bulldozed through the problem.

Should be OK now. You'll all soon tell me if it isn't  \:D/
Imagine what you will KNOW tomorrow !

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1308
  • BismarckWeather.net
    • BismarckWeather.net
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #21 on: June 27, 2019, 04:54:54 PM »
After blowing away the noaarecdat.php file, I'm still getting erroneous data.

The debug pulls the right data.  But the noaarecdat.php file has the bad data, and the info on screen has the bad data.

I have the include statement in my dashboard.  And then this data for displaying it.

Code: [Select]
<tr style="text-align:center">
<td>Normal High: &nbsp;<?php echo $thisDayMaxAvg?>&deg;F</td>
<td>Normal Low: &nbsp;<?php echo $thisDayMinAvg?>&deg;F</td>
</tr>
<tr style="text-align:center">
<td>Record High: &nbsp;<?php echo $thisDayMax?>&deg;F &nbsp;<?php echo $thisDayMaxYear?></td>
<td>Record Low: &nbsp;<?php echo $thisDayMin?>&deg;F &nbsp;<?php echo $thisDayMinYear?></td>
</tr>
« Last Edit: June 27, 2019, 04:57:02 PM by 92merc »
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #22 on: June 27, 2019, 05:32:55 PM »
Everybody hold fire whilst I triple check my new error handling ....  :oops:
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #23 on: June 27, 2019, 05:48:39 PM »
Must be having a bad bald day .... o/p logic in totally the wrong place.

Hopefully correct now ???
Imagine what you will KNOW tomorrow !

Offline ed2kayak

  • Ed
  • Forecaster
  • *****
  • Posts: 613
  • Davis Vantage Pro2 w/12 hr FARS, solar/uv
    • Cumberland Valley Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #24 on: June 27, 2019, 06:13:47 PM »
Not working for me? :?

cvweather.org

Ed
Ed
CoCoRaHS PA-CD-6,  Weather Underground KPAMECHA7, CWOP DW5425

 

anything