Skip to content

Node.js module to get weather forecast data in JSON format from yr.no service.

License

Notifications You must be signed in to change notification settings

rhappdev/yr.no-forecast

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yr.no-forecast

Wrapper to easily get weather data for a specified location in JSON format. Uses yr.no-interface under the hood. See the API docs at yr.no.

###Usage Use the getWeather(queryStringParams, callback|stream, [VERSION]) function to get a LocationForecast object, where version represents the version of the "locationforecast" service to use. This object has functions that take a callback as parameter and are detailed in the example below.

var yrno = require('yr.no-forecast');
yrno.getWeather({
  lat: 53.3478,
  lon: 6.2597
}, function(err, location) {
  // Weather for next five days (Array with five object)
  location.getFiveDaySummary(cb);
  // Current conditions
  location.getCurrentSummary(cb);
  // Weather anytime from now till future
  location.getForecastForTime(time, cb);
}, [VERSION]);

Weather JSON Format

Format is somewhat inspired by that of forecast.io service. Not all fields will always be available. Fields that no data was retrieved for contain the null value;

{ 
    icon: 'PARTLYCLOUD',
    to: '2013-11-15T18:00:00Z',
    from: '2013-11-15T12:00:00Z',
    rain: '0.0 mm',
    temperature: '9.7 celcius',
    windDirection: { deg: '220.2', name: 'SW' },
    windSpeed: { mps: '2.7', beaufort: '2', name: 'Svak vind' },
    humidity: '27.9 percent',
    pressure: '1021.0 hPa',
    cloudiness: '0.0%',
    fog: '0.0%',
    lowClouds: '0.0%',
    mediumClouds: '0.0%',
    highClouds: '0.0%',
    dewpointTemperature: '-8.3 celcius',
    ...
}

About

Node.js module to get weather forecast data in JSON format from yr.no service.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%