Author Topic: VWS Update?  (Read 2793 times)

0 Members and 1 Guest are viewing this topic.

Offline DaculaWeather

  • It's a Jeep thing... you wouldn't understand.
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3081
  • SCCA EM #156
    • North Georgia and US Weather
Re: VWS Update?
« Reply #25 on: February 22, 2017, 06:10:13 AM »
Just got it working a minute ago. The WD tags weren't populating and I finally found out how to turn it on from waiukuweather. I've always loved WD but finding out where to set things and what they all do is truly a nightmare. :-)

Offline Jester

  • Pony Up!
  • Contributor
  • ***
  • Posts: 106
  • US NAVY Retired
    • Castleton Weather, Virginia Beach, VA.
Re: VWS Update?
« Reply #26 on: February 22, 2017, 06:59:00 AM »
Just got it working a minute ago. The WD tags weren't populating and I finally found out how to turn it on from waiukuweather. I've always loved WD but finding out where to set things and what they all do is truly a nightmare. :-)

Very nice web site Steve. I'm going to go to WD I think, I haven't made up my mind yet. I'm done with VWS!

Bill
MADIS D4557
CWOP DW4557
Wunderground KVAVIRGI57
CoCoRaHS VA-VBC-13
WeatherBug p09270
Davis VP2+ 6163 VWS 15.0


Offline DaculaWeather

  • It's a Jeep thing... you wouldn't understand.
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3081
  • SCCA EM #156
    • North Georgia and US Weather
Re: VWS Update?
« Reply #27 on: February 22, 2017, 08:32:47 AM »
Just got it working a minute ago. The WD tags weren't populating and I finally found out how to turn it on from waiukuweather. I've always loved WD but finding out where to set things and what they all do is truly a nightmare. :-)

Very nice web site Steve. I'm going to go to WD I think, I haven't made up my mind yet. I'm done with VWS!

Bill
Thanks Bill!

Yea, VWS worked fine for years but when it doesn't, you can never get any real help with problems. There is tons of support for WD but it's a steep learning curve. There are so many options and settings, it's difficult to get figured out.

Offline DaculaWeather

  • It's a Jeep thing... you wouldn't understand.
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3081
  • SCCA EM #156
    • North Georgia and US Weather
Re: VWS Update?
« Reply #28 on: February 22, 2017, 08:37:47 AM »
And part of my problem is self-induced. If I would have just used a template instead of creating a site on my own, I wouldn't have so many issues. :-) The term masochist comes to mind...  ;)

Offline BrianLehan

  • Member
  • *
  • Posts: 9
    • Grace C Lehan Memorial Weather Station
Re: VWS Update?
« Reply #29 on: March 14, 2017, 02:03:53 PM »
Right now I have the normal highs/lows not working but otherwise my data is showing up on WU

Did you get that fixed? Ken conjured up a spell using the WU API that I use for that.  :grin:

So I have an API key but not sure how to get the json data populated into VMS's data store for reference throughout the day for almanac data. How are you doing that?

Offline SteveFitz1

  • Forecaster
  • *****
  • Posts: 305
    • http://www.TylerTexasWeather.Com
Re: VWS Update?
« Reply #30 on: March 14, 2017, 03:06:41 PM »
If you're just wanting to get the WU normal highs and lows into PHP variables to plug on your web page, you can get the info by using this:
Code: [Select]
<?php
  $json_string 
file_get_contents("http://api.wunderground.com/api/your-api-key-goes-here/conditions/q/pws:your-WU-station_goes_here.json");
  
$parsed_json json_decode($json_string);
  
$airport =  $parsed_json->{'almanac'}->{'airport_code'}; 
  
$norm_high $parsed_json->{'almanac'}->{'temp_high'}->{'normal'}->{'F'};
  
$norm_low $parsed_json->{'almanac'}->{'temp_low'}->{'normal'}->{'F'};
?>


Steve

Offline BrianLehan

  • Member
  • *
  • Posts: 9
    • Grace C Lehan Memorial Weather Station
Re: VWS Update?
« Reply #31 on: March 15, 2017, 12:43:47 AM »
If you're just wanting to get the WU normal highs and lows into PHP variables to plug on your web page, you can get the info by using this:
Code: [Select]
<?php
  $json_string 
file_get_contents("http://api.wunderground.com/api/your-api-key-goes-here/conditions/q/pws:your-WU-station_goes_here.json");
  
$parsed_json json_decode($json_string);
  
$airport =  $parsed_json->{'almanac'}->{'airport_code'}; 
  
$norm_high $parsed_json->{'almanac'}->{'temp_high'}->{'normal'}->{'F'};
  
$norm_low $parsed_json->{'almanac'}->{'temp_low'}->{'normal'}->{'F'};
?>


Steve
Ive been testing by pulling ".../almanac/q/Ct/hartford.json" And another URL for the warnings with the api. Are both almanac and warnings also under "conditions" as well?  I'll have to try that.

I assume I can also pull the 'record' and 'record_year' for both as well but I was hoping to store this data in the climate section of my archives as well. How would I populate that using a php script? I was thinking I could run a chron job script at midnight, post the data to a csv file then somehow insert it into the standard VWS data file and then populate my table using the existing code. Maybe too difficult and easier to leave the data stand alone and read it from there? Guess I need to learn more about php and json first before I start hacking away at the template again.

Thanks
Brian

Offline SteveFitz1

  • Forecaster
  • *****
  • Posts: 305
    • http://www.TylerTexasWeather.Com
Re: VWS Update?
« Reply #32 on: March 15, 2017, 08:47:28 AM »
Brian,

First off, yes, you can retrieve the record and record_year info in the same manner.

I need some clarification on your other questions. What do you mean by "Are both almanac and warnings also under "conditions" as well?" What does this refer to?

As far as using this data, that's easy, but it depends on how you're presenting it. What's the URL to your website? And is the "climate section of your archives" the climate subfolder under the archives folder of your VWS directory?

Steve


Offline BrianLehan

  • Member
  • *
  • Posts: 9
    • Grace C Lehan Memorial Weather Station
Re: VWS Update?
« Reply #33 on: March 15, 2017, 11:08:59 AM »
Brian,
First off, yes, you can retrieve the record and record_year info in the same manner.
I need some clarification on your other questions. What do you mean by "Are both almanac and warnings also under "conditions" as well?" What does this refer to?

As far as using this data, that's easy, but it depends on how you're presenting it. What's the URL to your website? And is the "climate section of your archives" the climate subfolder under the archives folder of your VWS directory?
Steve

Steve - The API call you used in your example was calling the observations from my own PWS, I have been using the call to the almanac files for my area. And a another call to the warnings for my area. I pulled the "observations" but did not see the almanac highs and lows or records in that return json data.

I'm still using the modified VWS template that the climate settings from WU used to populate, they are blank these days in the wu menu section of VWS. So I shut off automatic scheduled updates, and have been pulling the data from the WU API then manually entering the settings in VWS on the climate form each day after midnight. I also update the five day manually by the same method using weatherforyou data.

I'm not sure in the VWS data files if there is a separate climate file, I think all the data from WU is in the main database.csv file in the vws/data folder.

The station is up at thelehans.com

Thanks
Brian

Offline SteveFitz1

  • Forecaster
  • *****
  • Posts: 305
    • http://www.TylerTexasWeather.Com
Re: VWS Update?
« Reply #34 on: March 15, 2017, 12:00:25 PM »
Brian,

Thanks for the clarification. I now have a better understanding of your question.

You have to use separate WU API calls depending on the specific information you want, ie., almanac, conditions, etc. You can see the various calls available here https://www.wunderground.com/weather/api/d/docs. Keep in mind that only certain data is available via the free API.

If you're wanting to use some of the WU API data on your website, you could run a cron job after midnight to store data on your host, then add a little PHP code and HTML code to your site to build a table using that information. You can see how I've done this on about halfway down the right side of my homepage at www.tylertexasweather.com.

Since the data you're gathering from WU is historical data, I wouldn't be concerned with trying to integrate it into VWS data files.

Steve

Offline BrianLehan

  • Member
  • *
  • Posts: 9
    • Grace C Lehan Memorial Weather Station
Re: VWS Update?
« Reply #35 on: March 16, 2017, 08:07:38 AM »
Nice page Steve and thanks for the information but what I lack is the knowledge of how to store the results of the api calls I can make on my host.

To the best of your knowledge are there any cookie-cutter scripts or examples out there I can reference or use? I would like to store the json results in a simple csv file, but if need be in my rbase, or mysql or even access databases. I think the simple csv file is the best approach for what I want to do with the data - simple 24 hour display.

I'm in the process of moving the host to a newer version of Apache and PHP and think the new server will be better suited to run a php job at midnight then the current server is. PHP frequently stops running on the current box. I looked at the Saratoga site but didn't see anything that leaped out at me as a solution.

Offline SteveFitz1

  • Forecaster
  • *****
  • Posts: 305
    • http://www.TylerTexasWeather.Com
Re: VWS Update?
« Reply #36 on: March 16, 2017, 08:53:35 AM »
Brian,

PM me your email address.

Steve

Offline BrianLehan

  • Member
  • *
  • Posts: 9
    • Grace C Lehan Memorial Weather Station
Re: VWS Update?
« Reply #37 on: March 16, 2017, 11:50:53 AM »
In route to you.