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

0 Members and 1 Guest are viewing this topic.

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2485
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #75 on: November 27, 2020, 08:47:49 PM »
It doesn't work for me in debug mode.  What did I do wrong?

https://stillwaterweather.com/wx/noaarec.php?noaabug

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/2ndhome.php

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #76 on: November 27, 2020, 09:23:32 PM »
You didn't ....

If you view-source you'll see in the comments
Code: [Select]
<!-- RING NOAA -->
<!-- NOAA data FAIL -->
... and your last cache file is too old to be of any use.

Seems they are still all over the place ATM  :roll:
« Last Edit: November 27, 2020, 09:25:12 PM by the beteljuice »
Imagine what you will KNOW tomorrow !

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2485
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #77 on: December 25, 2020, 01:08:28 AM »
Sorry, but I still don't understand what I did or didn't do:

https://stillwaterweather.com/wx/noaarec.php?noaabug

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/2ndhome.php

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #78 on: December 25, 2020, 07:44:13 AM »
Same reply as I gave before Bunty - you aren't doing anything 'wrong' - It's them having problems with their servers and either redirecting to a different source (in various formats) or returning nothing !

Read the line at the bottom ....
https://w2.weather.gov/climate/getclimate.php?pil=CLI&recent=yes&wfo=oun&sid=OKC

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 #79 on: August 27, 2021, 06:20:16 PM »
IMPORTANT UPDATE v4.0 27 Aug 2021

It seems that the urls have permanently changed and a few other little things  #-o

Many thanks to his worship Ken True for finding the answers and modifying the code.  \:D/

Script available from link in first post.
Imagine what you will KNOW tomorrow !

Offline K3JAE

  • Contributor
  • ***
  • Posts: 137
  • Davis VP2 Wireless
    • K3JAE's Weather Station
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #80 on: December 09, 2021, 04:15:01 PM »
OK, I updated the script to 4.0.

Data being received - somewhat. Running DEBUG displays all items as intended.

URL to data: https://forecast.weather.gov/product.php?site=meg&issuedby=mkl&product=CLI&format=txt&version=1&glossary=0

Results in (only posting area of interest):
THE JACKSON CLIMATE NORMALS FOR TODAY
                                             NORMAL    RECORD    YEAR
 MAXIMUM TEMPERATURE (F)    53              75        2007
 MINIMUM TEMPERATURE (F)     33                9       1995

The Average High/Lows are printing to the page perfectly fine... however the MAX/MIN RECORD with year is not.

Actual page code:
Code: [Select]
<tr>
                    <td align="center" valign="top" style="background-color: #C2F7B9; font-size:8pt; text-align: center; border: 1px solid red; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; padding:2px;">
<span style="font-size:8pt"><?php langtrans('Date Record High<span style="font-weight: bold; color: red">*</span>'); ?></span><br />
<span style="font-size: 12pt; font-weight:bold"><?php echo strip_units($thisDayMax) . $uomTemp?></span><br/>
<span style="font-size:8pt"><?php echo $thisDayMaxYear?></span>
                    </td>
                    <td align="center" valign="top" style="background-color: #C2F7B9; font-size:8pt; text-align: center; border: 1px solid blue; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; padding:2px;">
<span style="font-size:8pt"><?php langtrans('Date Record Low<span style="font-weight: bold; color: red">*</span>'); ?></span><br />
<span style="font-size: 12pt; font-weight:bold"><?php echo strip_units($thisDayMin) . $uomTemp?></span><br/>
<span style="font-size:8pt"><?php echo $thisDayMinYear?></span>
                    </td>
</tr>

I even went as far as commenting out my original code (as it is above) and copy/pasting the code from the DEBUG section of noaarec.php and dropped it in it's place - exact same result.

Guidance please?


**** UPDATE *****
Problem was resolved. I had commented out the include_once('noaarec.php');  in my dashboard page and forgot to re-enable it.  ](*,)  #-o  :roll:
« Last Edit: December 09, 2021, 04:52:45 PM by K3JAE »


73's de K3JAE

John
K3JAE Weather Station

Offline tman1991

  • Senior Member
  • **
  • Posts: 57
    • http://frogville.us
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #81 on: July 09, 2024, 04:03:19 PM »
i should have posted to this thread, the latest..

Can I get some testers please?

I have noticed under some conditions the average and max highs for the day give strange answers.. It appears that NOAA has reformatted their string.

I played around with the substr commands and might have found a solution, but not sure if its universal or will now break other things.

Lines 274-276 are the new values with 277-279 the old values..

when you run this command (on your website), the box should look "correct" for your area.

https://frogville.us/noaarec.php?noaabug

this version doesnt fully fix it. took it down.. still working this and have another potential fix. will update post soon
« Last Edit: July 10, 2024, 09:43:17 AM by tman1991 »

Offline tman1991

  • Senior Member
  • **
  • Posts: 57
    • http://frogville.us
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #82 on: July 10, 2024, 11:31:08 AM »
I think i have a fix now, calling this v4.1, but again its a small situation where this problem occurs, but I think I have fixed it.

Offline ed2kayak

  • Ed
  • Forecaster
  • *****
  • Posts: 614
  • Davis Vantage Pro2 w/12 hr FARS, solar/uv
    • Cumberland Valley Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #83 on: July 10, 2024, 01:40:23 PM »
OK, here is mine working:
https://cvweather.org/noaarec.php?noaabug

Regarding the AltAjaxDashboardConfig6.php are we still using the $useWU to call this?
 I haven't used since 2019.
Thanks,
Ed
Ed
CoCoRaHS PA-CD-6,  Weather Underground KPAMECHA7, CWOP DW5425

Offline tman1991

  • Senior Member
  • **
  • Posts: 57
    • http://frogville.us
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #84 on: July 10, 2024, 07:18:35 PM »
Thanks for checking also Ed.  Whats happening is this, for whatever reason NOAA doesnt put Today's MAXIMUM temperature where it should be so its blank and the script takes Tomorrows MAXIMUM as TODAY but Tomorrow's data is formatted differently, so in this case, I had to read Tomorrows data when it was expecting it be formatted in Today's fields.

And currently Tucson is not showing Todays Max so the script update fixes it.




Offline AZClipper

  • Member
  • *
  • Posts: 22
    • Apache Junction Weather
Re: 'This day' Max / Min / Avg Temperatures (NOAA) - PHP Script
« Reply #85 on: January 30, 2025, 10:42:19 AM »
I recently noticed that the CLI report from NOAA included additional years in which the record temp occurred. I have rewritten the noaarec.php script to scrape these additional years. While doing this, I found that not all WFO's follow the exact same CLI format. For instance, Tucson issues a early morning report with only the minimum temp for today. Glasgow issues a report that is truncated (less than eighty lines). I rewrote the script to handle these discrepancies.

I'm not a skilled programmer but have done over a month of testing on the Phoenix, Tucson and Glasgow CLI reports and all seems to be working. Additional testing for your WFO would be appreciated.



The script can be downloaded from here:  https://www.apachejctwx.com/Davis/scripts/test.php


John

 

anything