Author Topic: NOAA style files  (Read 11893 times)

AstroSteve

  • Gentle Breeze
  • **
  • Posts: 42
    • KJ6IIW
    • KCAACTON3
  • Station Details: Davis Vantage Pro 2 Wireless, iMac 27"
NOAA style files
« on: December 19, 2013, 04:43:05 PM »
Up until October, I was running WeatherDisplay on a Windows PC. My website uses the template created by Ken at Saratoga Weather.  When I switched to a Mac, I started running WeatherCat because I didn't like the Mac version of WD.  The only down side of switching is I lost the ability to view some pages in Ken's template that use the dailynoaa and climatedataout files that WD creates, specifically the Detail (wx...detail.php), Summary (wx....summary.php) and Monthly Records (wxnoaarecords.php) pages.

While poking around my site, I discovered that Ken had written a script to parse the STMONTHLY ouptput and put it in a style similar to the NOAA report and had an idea. What if I took the script that Ken wrote and add to it to create a dailynoaareport and climatedataout.html file on a regular basis, both as the current month and with the month and year too.  The attached stmonthlytoWDfiles.php file is the result of that thought.

I have a cron job run every hour at 5 minutes before the hour that runs the script.  The top line of the file is required for the script to run on my hosting company. You can remove it if it's not needed.  As written, the script need to be in the same directory that your reports will be in, if you want to have it somewhere else, just update the path in the file_put_contents line around line 308-312. You will also need to adjust the path to the settings and common file to point to the proper location.

After I had that script working, I needed to get the data from past months so there were no holes in my reports.  I still had the files from when I was running WD, but was missing 2 months worth. I have WeatherCat upload the MySql so the data was available, I just needed to write a script to create the files.  That's handled by the createclimate.php and createnoaa.php scripts.

You need to put your database information in the proper spots around line 36 in both files then upload them to the directory where you are storing your noaa files. When you run the, enter the year and month that you want to convert and hit enter.  The resulting report will be printed on you screen and a matching file on your server. Just keep running the report for all the months and years you want to convert.

DISCLAIMER:  I am self taught in programing.  I'm sure there are better and more efficient ways to do what these scripts do, but they work and that's all I care about.  :)  Feel free to modify and improve them. 

I would not have been able to create these scripts without the work done by Ken, thank you Ken!

Steve

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 2795
    • CW9739
    • ISCOTLAN25
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, soil/leaf station, extra temp stations, no U.V. WeatherLink IP.
Re: NOAA style files
« Reply #1 on: December 19, 2013, 05:15:28 PM »
Nice work Steve  [tup]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 5006
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, MacBook Pro (Early 2011), macOS 10.13.6, WeatherCat 3
Thanks Steve!! (Re: NOAA style files)
« Reply #2 on: December 19, 2013, 08:45:10 PM »
Dear Steve, Stu, and WeatherCat fans,

Nice work Steve  [tup]

Yeah, just what Stu said!!  [bounce]

Seriously, Thanks for the effort! 

If we all contribute a little something we end up so much better off than if were all by ourselves.  That's what makes this community - GREAT!

Cheers, Edouard  [cheers1]

monymony

  • Strong Breeze
  • ***
  • Posts: 164
  • CoCoRaHS - MD-CC-16
    • EW3643
    • KMDELKTO10
    • Cecil County Maryland Weather
  • Station Details: Davis Vantage Pro 2
Re: NOAA style files
« Reply #3 on: January 10, 2014, 07:35:05 PM »
AstroSteve,


Can you provide a link to your website to see these scripts in action?


I am been thinking of trying to create these scripts myself but this might just save me from recreating the wheel.


Thanks!



AstroSteve

  • Gentle Breeze
  • **
  • Posts: 42
    • KJ6IIW
    • KCAACTON3
  • Station Details: Davis Vantage Pro 2 Wireless, iMac 27"
Re: NOAA style files
« Reply #4 on: January 10, 2014, 08:23:58 PM »
My website is http://www.actonastro.com/weather/current.php and the results of the scripts can be seen by clicking on Temperature (or Rail, Wind or Barometer), then selecting Detail, Summary or Records. 

What you'll see on my website is actually the results my scripts, displayed by a script from Wildwood Weather, http://weather.wildwoodnaturist.com/downloads.php, in a template from Saratoga Weather, http://saratoga-weather.org/template/index.php.  The output of my script goes in to dailynoaareport*.htm and climatedataout*.html files formatted like Weather Display creates so Wildwood's script can parse it and create the pages you see. You can see the actual files at http://www.actonastro.com/weather/wc/climatedataout12014.html and http://www.actonastro.com/weather/wc/dailynoaareport12014.htm.  Replace the month and year to see other ones or take it out to see the daily ones, which are identical to the current month files.

monymony

  • Strong Breeze
  • ***
  • Posts: 164
  • CoCoRaHS - MD-CC-16
    • EW3643
    • KMDELKTO10
    • Cecil County Maryland Weather
  • Station Details: Davis Vantage Pro 2
Re: NOAA style files
« Reply #5 on: January 10, 2014, 08:47:47 PM »
This is exactly what I have been looking for to add to my site! THANK YOU !!!


BTW, I happened to notice that your NOAA IOD page is not working.  Saratoga put a fix out for this at the end of December that you might want to look at.  It can be found under http://saratoga-weather.org/scripts-images.php#NOAAIOD and look for the December 28th update.



AstroSteve

  • Gentle Breeze
  • **
  • Posts: 42
    • KJ6IIW
    • KCAACTON3
  • Station Details: Davis Vantage Pro 2 Wireless, iMac 27"
Re: NOAA style files
« Reply #6 on: January 10, 2014, 11:00:32 PM »
Glad to help. Thank you for the heads up on the NOAA IOD.

monymony

  • Strong Breeze
  • ***
  • Posts: 164
  • CoCoRaHS - MD-CC-16
    • EW3643
    • KMDELKTO10
    • Cecil County Maryland Weather
  • Station Details: Davis Vantage Pro 2
Re: NOAA style files
« Reply #7 on: January 12, 2014, 11:00:44 PM »
Hi Steve,


Great scripts!


I have been able to generate the noaa and climate files from your scripts for my records back to 2007.  I did notice that the initial setting of MaxHi=0 caused some of my records to not import properly when the high temperature was less than 32F for any particular day.  Fix was easy where I just changed the initial variable setting to make it set to -50 instead of 0 and everything worked properly. 

I did notice on your wxnoaarecords.php that you are showing the barometer high and lows for each day.  Did you do something else to get this data as your scripts don't seem to cover this? 


Thanks again!!


Jay



AstroSteve

  • Gentle Breeze
  • **
  • Posts: 42
    • KJ6IIW
    • KCAACTON3
  • Station Details: Davis Vantage Pro 2 Wireless, iMac 27"
Re: NOAA style files
« Reply #8 on: January 13, 2014, 02:41:05 AM »
Jay,

I'm glad you found the scripts useful.  I guess I should have taken in to account people that live in areas where the high doesn't get above freezing sometimes. LOL!

The wxnoaarecords.php script comes from Wildwood Weather. It parses every climatedataout file and figures out the records for all the different readings.

Steve

monymony

  • Strong Breeze
  • ***
  • Posts: 164
  • CoCoRaHS - MD-CC-16
    • EW3643
    • KMDELKTO10
    • Cecil County Maryland Weather
  • Station Details: Davis Vantage Pro 2
Re: NOAA style files
« Reply #9 on: January 13, 2014, 10:06:26 PM »
Hi Steve,


I got it working.   I had to update the wxnoaarecords-include.php file to change all the references from "WD" (and 'WD') to "WCT" (and 'WCT').


At some point I will probably play with this more as just showing the barometer as an average for the day as it is currently missing my Hurricane Sandy extreme low pressure of 28.23in but any coding by me is down the road.  My first task coding-wise is to  first get my manual snow totals to show on my webpage.  I am really hoping this feature to store snow totals gets added to WC v2.  I am guessing snow information is not something you have to worry about in California!


Jay









elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 5006
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, MacBook Pro (Early 2011), macOS 10.13.6, WeatherCat 3
Almost don't need rain data in CA!! (Re: NOAA style files)
« Reply #10 on: January 14, 2014, 10:02:27 PM »
Dear Jay, Steve, and WeatherCat extreme weather observers,

I am guessing snow information is not something you have to worry about in California!

Snow he says . . . . .   I could almost get rid of my rain gauge!!  The grand total of rainfall for January 2014 to date is . . . . 0.01"!  (0.25mm)

Us Californians sure are singing . . . . . . how dry I am!!

Cheers, Edouard  [cheers1]

AstroSteve

  • Gentle Breeze
  • **
  • Posts: 42
    • KJ6IIW
    • KCAACTON3
  • Station Details: Davis Vantage Pro 2 Wireless, iMac 27"
Re: NOAA style files
« Reply #11 on: January 14, 2014, 10:18:07 PM »
Wow, your drought is over! I have 0.00" so far, 0.06" in December, the second driest in 19 years.

staze

  • Strong Breeze
  • ***
  • Posts: 194
    • CW9669
    • KORSPRIN10
    • Everybody Staze...
  • Station Details: Davis Vantage Vue, Weather Envoy, Weatherlink USB, Mac Mini Server (Late 2012), macOS 10.13
Re: NOAA style files
« Reply #12 on: March 31, 2014, 07:05:26 PM »
All,

I must be missing something with all of this. Where is the common.php file from? Settings I'm guessing is the Weather-Settings.php from the template files, but I'm not 100% on this.

Thanks!
"You mean, you'll put down your rock and I'll put down my sword and we'll try and kill each other like civilized people?"

AstroSteve

  • Gentle Breeze
  • **
  • Posts: 42
    • KJ6IIW
    • KCAACTON3
  • Station Details: Davis Vantage Pro 2 Wireless, iMac 27"
Re: NOAA style files
« Reply #13 on: March 31, 2014, 07:21:47 PM »
No, the Settings.php is a different file then the Settings-weather.php file.  Both the commpn.php and Settings.php are in the same directory as the Settings-weather.php file.

staze

  • Strong Breeze
  • ***
  • Posts: 194
    • CW9669
    • KORSPRIN10
    • Everybody Staze...
  • Station Details: Davis Vantage Vue, Weather Envoy, Weatherlink USB, Mac Mini Server (Late 2012), macOS 10.13
Re: NOAA style files
« Reply #14 on: March 31, 2014, 07:42:48 PM »
Interesting...

I'm seeing Settings here: http://saratoga-weather.org/wxtemplates/Settings-config-USA.php

Ah, okay, I found common.php in the Base-USA here: http://saratoga-weather.org/wxtemplates/install.php

Guess I didn't realize you needed the whole Base-USA directory... We should write up some directions for this... or just get Stu to implement NOAA outputs... =)
"You mean, you'll put down your rock and I'll put down my sword and we'll try and kill each other like civilized people?"