Darksky API Guide - POSOCO/wind-forecast GitHub Wiki

The site that we are using to get the wind data is Darksky.net

The site provides a beautiful visual interface to see the weather forecast data and the past weather data

Forecast Request returns the current weather conditions, a minute-by-minute forecast for the next hour (where available), an hour-by-hour forecast for the next 48 hours, and a day-by-day forecast for the next week.

Usage

  1. https://api.darksky.net/forecast/[key]/[latitude],[longitude]
  2. Example for mumbai forecast request would be https://api.darksky.net/forecast/<api_key>/19.0827699,72.7411179
  3. Beautify the json response in a site like http://codebeautify.org/jsonviewer
  4. Get the next 48 hour wind forecast in the hourly.data section of the JSON

Time Machine Request returns the observed (in the past) or forecasted (in the future) hour-by-hour weather and daily weather conditions for a particular date

Usage

  1. https://api.darksky.net/forecast/[key]/[latitude],[longitude],[time]
  2. Example for mumbai time machine request for the timestamp 1496950200 (Friday, June 9, 2017 1:00:00 AM GMT+05:30) would be https://api.darksky.net/forecast/<api_key>/19.0827699,72.7411179,1496950200
  3. Beautify the json response in a site like http://codebeautify.org/jsonviewer
  4. Get the 24 hour wind data of the requested timestamp date in the hourly.data section of the JSON

The JSON can also be obtained in our apps using the above http API so that we can develop custom to cater our domain specific needs that require wind data

Notes

  1. Use https://www.epochconverter.com/ to convert unix timestamp to human readable time and viseversa. This can be useful to us while testing the api for weather data in the browser by typing in the api url.
  2. The json data section we get will of the form
                      {
				"time": 1497029400,
				"summary": "Light Rain",
				"icon": "rain",
				"precipIntensity": 0.0108,
				"precipProbability": 0.52,
				"precipType": "rain",
				"temperature": 84.95,
				"apparentTemperature": 95.9,
				"dewPoint": 77.39,
				"humidity": 0.78,
				"windSpeed": 9.12,
				"windBearing": 220,
				"cloudCover": 0.44,
				"pressure": 1005.98,
				"ozone": 273.73
			}
  1. To get unix timestamp from Date object in javascript use the following code
var unix_tmpstmp = Math.floor(new Date().getTime() / 1000);
⚠️ **GitHub.com Fallback** ⚠️