Author Topic: Freeze Data Script  (Read 5732 times)

0 Members and 1 Guest are viewing this topic.

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Freeze Data Script
« on: November 08, 2014, 08:24:16 PM »
Example: http://weather.wildwoodnaturist.com/wxfreeze.php
Download at : http://weather.wildwoodnaturist.com/downloadsCVW.php

This script is designed as an add-on page for the PHP templates available from Saratoga Weather. It uses the NOAA Reports created and uploaded to your website to display the first and last freeze dates, number of days where the minimum and maximum temperatures were at or below freezing, and the most consecutive days at or below freezing for each year. It also displays the average, earliest, and latest dates of first and last freezes for all years for which you have data. For those in the Northern Hemisphere, a year is from July 1 to June 30.

It is strongly recommended that you have a minimum of one full year of data for best results.

Due to not having psychic ability to determine if a freeze is the last one for that year, the Last Freeze column for the current year will not be updated until the the latest freeze of any year for which you have data. For example, if the latest freeze of any of the previous years of your data is April 17, the latest freeze column for the current year will not be updated until April 17 of the current year.

Requirements:

    You need to be uploading the NOAA report files to your website.
    PHP5 on your website

The only settings you should typically need to change is the $start_year in the settings section of the wxfreeze.php file. Set to the first year of NOAA reports that you have. If you did not start recording data until after the first freeze of the year, you should increase the $start_year setting by one. For example, if your first NOAA report is for December 2010 and you have already had freezes earlier that year, you should set $start_year to 2011 instead of 2010 to avoid skewing the results.

If you have missing or incorrect data in your NOAA Reports files and cannot or do not wish to add/correct the data in in your weather software, you can manually provide the data in a csv file. Open the sample wxreportsmmyyyy.csv file included in the zip download in a spreadsheet. Enter the necessary data in the appropriate column. You only need to add data for the values you wish to add or correct. Do not make any changes to the header row. Save the updated file as wxreportmmyyyy.csv where mm is the month number (2 characters) and yyyy is the year (i.e. wxreports062012.csv for June 2012). Upload to the same folder where the NOAA reports are located. If you have bad data for an item but do not know what the correct value should be, you can enter a 'D' (without the quote marks) for that item and day and the scripts will ignore the data for that day.
Murry

Offline Andy G

  • Forecaster
  • *****
  • Posts: 306
    • SunPrairieWeather.com
Re: Freeze Data Script
« Reply #1 on: November 09, 2014, 01:18:39 AM »
Nice script Murray Thanks alot as always. http://www.sunprairieweather.com/wxfreeze.php
Andy
Once you can accept the universe as being something expanding into an infinite nothing which is something, wearing stripes with plaid is easy.
~Einstein


SunPrairieWeather.com
Davis VP2 24 FARS

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2297
    • CNYWeather
Re: Freeze Data Script
« Reply #2 on: November 09, 2014, 08:53:09 AM »
Thank you again Murry!!
Tony




Offline SteveFitz1

  • Forecaster
  • *****
  • Posts: 521
    • Tyler Texas Weather
Re: Freeze Data Script
« Reply #3 on: November 09, 2014, 01:09:50 PM »
Great script, Murry. I was considering doing something like this and you saved me the effort.  :grin:

I appreciate your work.

Steve

Offline tnwxman

  • Forecaster
  • *****
  • Posts: 423
  • KK4QXH
    • Weather for Lebanon, TN 37087
Re: Freeze Data Script
« Reply #4 on: November 09, 2014, 03:34:24 PM »
Hi Murry,

I have my WeatherLink NOAA reports in a sub directory off my main web directory. That directory is called NOAA-reports. I also upload my Weather Display reports to the main directory at my website. My Weather Display data only goes back to 2010 but my Weather Link goes back to 1995. How do I get the freeze data script to read that data (WL) instead of the WD data? Please advise.

Thanks.
Bob
Bob
KK4QXH

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: Freeze Data Script
« Reply #5 on: November 09, 2014, 04:22:10 PM »
Hi Murry,

I have my WeatherLink NOAA reports in a sub directory off my main web directory. That directory is called NOAA-reports. I also upload my Weather Display reports to the main directory at my website. My Weather Display data only goes back to 2010 but my Weather Link goes back to 1995. How do I get the freeze data script to read that data (WL) instead of the WD data? Please advise.

Thanks.
Bob

Bob,
In the settings section of the wxfreeze.php, add the following:
$SITE['WXsoftware']     = 'WL';
$SITE['NOAAdir']           = './NOAA-reports/';

This will cause the script to look for weatherlink style NOAA reports instead of the Weather Display reports.
Murry

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: Freeze Data Script
« Reply #6 on: November 09, 2014, 05:15:20 PM »
I want to use this script but I don't have enough data.  :-(




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline tnwxman

  • Forecaster
  • *****
  • Posts: 423
  • KK4QXH
    • Weather for Lebanon, TN 37087
Re: Freeze Data Script
« Reply #7 on: November 09, 2014, 05:46:12 PM »
That did it Murry, Thank you! GREAT SCRIPT. Thanks again.
Bob
KK4QXH

Offline Andy G

  • Forecaster
  • *****
  • Posts: 306
    • SunPrairieWeather.com
Re: Freeze Data Script
« Reply #8 on: November 09, 2014, 06:03:37 PM »
Hi Murry,

I have my WeatherLink NOAA reports in a sub directory off my main web directory. That directory is called NOAA-reports. I also upload my Weather Display reports to the main directory at my website. My Weather Display data only goes back to 2010 but my Weather Link goes back to 1995. How do I get the freeze data script to read that data (WL) instead of the WD data? Please advise.

Thanks.
Bob

Hi Bob

I might want to do something similar. I was wondering what format you "export from weather link". I print to a pdf file and print to paper and put it in a binder every month. Also what do you name them so they are readable to a script.

Thanks Andy
Once you can accept the universe as being something expanding into an infinite nothing which is something, wearing stripes with plaid is easy.
~Einstein


SunPrairieWeather.com
Davis VP2 24 FARS

Offline jay_hoehn

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 656
    • Jay's Woodcrafts
Re: Freeze Data Script
« Reply #9 on: November 10, 2014, 12:05:04 AM »
Murry,

I love this script.  Great work  Very interesting to see the yearly differences on the dates and number of freezing days.
http://jayswoodfurniture.com/wx/wxfreeze.php

Thanks,

Jay
Davis Vantage Pro2 Plus
VVP
Weather Display


Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Re: Freeze Data Script
« Reply #10 on: November 10, 2014, 08:57:12 AM »
Murry

Another GREAT script - THANKS   =D>

Cheers

 :grin:

MikeyM


Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Re: Freeze Data Script
« Reply #11 on: November 10, 2014, 11:57:05 AM »
Great script Murry!

I have also installed the Detail/Summary scripts but can't get them to display any data. All the display fields are blank. Must be a reference issue but, so far, I haven't been able to locate it.

You can find it on my alternate webpage under the "Historical" menu link:
What I don't understand is that the Freeze and Records scripts work just fine but not the others. I have not installed the graphs yet but plan to do so once I get the rest of them working correctly.

Any help would be appreciated!
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: Freeze Data Script
« Reply #12 on: November 10, 2014, 01:40:52 PM »
Great script Murry!

I have also installed the Detail/Summary scripts but can't get them to display any data. All the display fields are blank. Must be a reference issue but, so far, I haven't been able to locate it.

You can find it on my alternate webpage under the "Historical" menu link:
What I don't understand is that the Freeze and Records scripts work just fine but not the others. I have not installed the graphs yet but plan to do so once I get the rest of them working correctly.

Any help would be appreciated!
For the Detail/Summary scripts, the path to the NOAA reports are in the wxreports-settings.php file.
$path_dailynoaa = $SITE['NOAAdir'];   // path to NOAA reports
The $SITE['NOAAdir'] is normally defined in the Settings-weather.php file.
Murry

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Re: Freeze Data Script
« Reply #13 on: November 10, 2014, 03:52:28 PM »
Great script Murry!

I have also installed the Detail/Summary scripts but can't get them to display any data. All the display fields are blank. Must be a reference issue but, so far, I haven't been able to locate it.

You can find it on my alternate webpage under the "Historical" menu link:
What I don't understand is that the Freeze and Records scripts work just fine but not the others. I have not installed the graphs yet but plan to do so once I get the rest of them working correctly.

Any help would be appreciated!
For the Detail/Summary scripts, the path to the NOAA reports are in the wxreports-settings.php file.
$path_dailynoaa = $SITE['NOAAdir'];   // path to NOAA reports
The $SITE['NOAAdir'] is normally defined in the Settings-weather.php file.

Okay, changed the NOAAdir setting but still doesn't work. Here is what I have in the two files you mention above:

EDIT: Works fine now. I discovered I had not place a trailing "/" in the directory specification.  :oops:


wxreports-settings.php:

  $path_dailynoaa = './noaa/'; //$SITE['NOAAdir'];   // path to NOAA reports


settings-weather.php:

  $SITE['NOAAdir']        = './noaa/';   // relative location of the NOAA report files


« Last Edit: November 10, 2014, 03:57:16 PM by W3DRM »
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Re: Freeze Data Script
« Reply #14 on: November 10, 2014, 04:08:26 PM »
Found one more thing that isn't working correctly - some of the characters in the Wind Color Coding Chart aren't being displayed correctly. I sus[ect it has something to do with the use of "$SITE['charset'] = 'UTF-8859-1';" being used to set the charset in the code.

This is what my screen looks like:



Any ideas as to what to change?
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: Freeze Data Script
« Reply #15 on: November 10, 2014, 04:18:12 PM »
Save it with Notepad. It may have saved it in a different format.




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Re: Freeze Data Script
« Reply #16 on: November 10, 2014, 04:30:25 PM »
Save it with Notepad. It may have saved it in a different format.

No, that isn't it. I use Coffee Cup HTML editor which doesn't mess with the file formatting. I really think it has something to do with the fact the code is specifying UTF-8859-1 which I am not sure is a valid charset designation. I've seen ISO-8859-1 but not UTF-8859-1. I tried changing it to ISO... but it didn't correct the problem.

Interestingly, when I look at Murry's own website, he has the following charset designation "<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />" and Ken True uses "$SITE['charset'] = 'ISO-8859-1'; // default character set for webpages (iso-8859-1=latin)" in his settings.php for the template standard.
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: Freeze Data Script
« Reply #17 on: November 10, 2014, 04:44:25 PM »
Sorry Don. Shows how much I know.  :lol:




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline jay_hoehn

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 656
    • Jay's Woodcrafts
Re: Freeze Data Script
« Reply #18 on: November 10, 2014, 04:53:42 PM »
Don,

I think the UTF is a typo.  It should be ISO  W3C wouldn't validate with UTF but did validate with ISO.  I know that may not solve the issue you are having, but I just thought I'd chime in.

Jay
Davis Vantage Pro2 Plus
VVP
Weather Display


Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Re: Freeze Data Script
« Reply #19 on: November 10, 2014, 05:05:31 PM »
Ryan & Jay,

Thanks for the inputs. I'm still looking to see what is going on. Anyway, while researchign this issue, I stumbled on a link that may be of interest to all of us regarding webpage encoding and why UTF-8 is the recommended encoding designation to be used on all of our websites. See the link below:
It's a bit of a long read but does give a good explanation and background of what all this various encoding means.
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Re: Freeze Data Script
« Reply #20 on: November 10, 2014, 05:21:42 PM »
Well, it must have had something to do with the actual characters within the wxwindsummary.php file itself. I deleted and then manually typed-in a new dash for each one deleted. The problem has gone away. I also changed the charset from UTF-8859-1 to ISO-8859-1 and all appears to good now.

EDIT: Found two more files that needed to be updated to eliminate the crazy characters. They are as follows:
  • wxwinddetail.php
  • wxwindseason.php
I think this is the last change needed to make it all work as it should.
« Last Edit: November 10, 2014, 05:35:17 PM by W3DRM »
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: Freeze Data Script
« Reply #21 on: November 10, 2014, 05:39:30 PM »
Found one more thing that isn't working correctly - some of the characters in the Wind Color Coding Chart aren't being displayed correctly. I sus[ect it has something to do with the use of "$SITE['charset'] = 'UTF-8859-1';" being used to set the charset in the code.

This is what my screen looks like:



Any ideas as to what to change?

Since this is not related to the Freeze Date script, I replied in the Detail/Summary topic at http://www.wxforum.net/index.php?topic=14077.msg233633#msg233633
Murry

Offline MesquiteWx

  • Forecaster
  • *****
  • Posts: 610
    • Mesquite Weather
Re: Freeze Data Script
« Reply #22 on: November 16, 2014, 07:23:18 PM »
Which file does this use, dailynoaareport, cimatedataout, or noaareportyearXXXX.htm?

I have all three of them in my root but it doesn't show anything on the freeze data page.

-Thanks

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: Freeze Data Script
« Reply #23 on: November 16, 2014, 08:35:26 PM »
Which file does this use, dailynoaareport, cimatedataout, or noaareportyearXXXX.htm?

I have all three of them in my root but it doesn't show anything on the freeze data page.

-Thanks

It uses the dailynoaareport files. The path is normally set in the Settings-weather.php included with the Saratoga template.
$SITE['NOAAdir']           = './';   // relative location of the stored NOAA report files directory.
Make sure it has a trailing slash.
Murry

Offline MesquiteWx

  • Forecaster
  • *****
  • Posts: 610
    • Mesquite Weather
Re: Freeze Data Script
« Reply #24 on: November 16, 2014, 09:42:31 PM »
Thanks, I just checked my Settings-weather.php and it was missing the $SITE['NOAAdir']           = './';   // relative location of the stored NOAA report files directory.

I added it to that file but still not display the data from the dailynoaareport files.

Something is mucked somewhere, I am just not sure as to where.

 

anything