Skip to content

kiranshashiny/Weather_Channel_Bluemix_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Weather_Channel_Bluemix_API

Retrieving weather data from the Weather channel using Bluemix.

http://www.usatoday.com/story/tech/2015/03/31/ibm-weather-channel-cloud-collaboration/70682492/?cm_mc_uid=37247814973514823030142&cm_mc_sid_50200000=1483074785

This API lets you get current and forecast weather data from the Weather channel and use it for our business.

One would login to the Bluemix - get a set of credentials and then using some of the common API - get the data back in JSON format and use it for applications.

In this repository I have one such sample that will give you an insight on how to request for a three day data and examine the result in JSON format.

To start with:

Register or Login to console.ng.bluemix.net

click on Create Service

screen shot 2016-12-30 at 10 51 06 am

Search for the Weather Company Data

screen shot 2016-12-30 at 10 52 01 am

Create the service with the default credentials screen shot 2016-12-30 at 10 54 04 am

Once the service is created: Click on Service Credentials and view it, keep this data aside as we would need it for querying data.

screen shot 2016-12-30 at 10 56 22 am

now, a sample of what we would like to see and how to get that data.

https://www.ng.bluemix.net/docs/services/Weather/index-gentopic1.html#weather_sample1

A Typical Rest Curl API command to get 3 day data would look like :

/v1/geocode/12.97/77.59/forecast/daily/3day.json

Where the 12.97 and 77.59 is the Latitude and Longitude of location Bangalore and today's date is 29 December as seen in "fcst" report shown below.

For more information or tutorials or samples on the APIs -look up this URL.

https://twcservice.mybluemix.net/rest-api/

screen shot 2016-12-30 at 10 58 58 am

To start with my samples : run the getthreedaydata.sh in this repository, and it returns the output in a file called data.json

This data.json results file is the JSON response in text format and contains a load of valid information for forecast for the next 3 days.

Has several key value pairs like max_temp, min_temp, Lunar(to say if it is a New Moon or not )

This file has to be parsed in Python to get the results for 3 day temperature details.

Run the script:

$python parsedata.py

Here you will see that I have printed a small subset of data that I was able to parse from the JSON results. You will see today was a Full Moon day, max temperature, minimum temperature, date ( in epoch -that has to converted to human readable format later ) and some narrative about the day's weather.

This data is just a sample of how the IBM's Weather company data relates to what is seen on the Google's Weather forecast and you will notice they are somewhat similar in terms of temperature and other data.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors