Socket
Socket
Sign inDemoInstall

yr.no-forecast

Package Overview
Dependencies
27
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yr.no-forecast

Module to easily retrieve simple weather forecast for a given time and location.


Version published
Weekly downloads
6
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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',
    ...
}

Keywords

FAQs

Last updated on 26 Sep 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc