wunderground-node

0.3.3 • Public • Published

wunderground-node

Build Status MIT Licence npm version devDependency Status Code Climate

A simple wrapper for the Wundeground API for Node.js

Install

$ npm install wunderground-node --save

Usage

var wunderground = require('wunderground-node');
var client = new wunderground('<api_key_here', 'Boston', 'MA');

Examples

Full Init

var wunderground = require('wunderground-node');
var client = new wunderground('<api_key_here', 'Boston', 'MA');

//Gets the forecast in Boston for today
client.forecast('forecast', '', function(err, data){
	if(err) throw err;
	console.log(data);
});

//Gets a summary of the weather in Boston on May 21st, 2011
client.history('history', '20110521', '', function(err,data){
	if(err) throw err;
	console.log(data);
});

//Gets a summary of the weather in Boston between the dates May 21st - May 28th of this year.
client.planner('planner', '05210528', '', function(err, data){
	if(err) throw err;
	console.log(data);
});

Half Init

var wunderground = require('wunderground-node');
var client = new wunderground('<api_key_here'>);
var opts = {
  city: 'Boston',
  state: 'MA'
};

//Gets the forecast in Boston for today
client.forecast('forecast', opts, function(err, data){
  if(err) throw err;
  console.log(data);
});

//Gets a summary of the weather in Boston on May 21st, 2011
client.history('history', '20110521', opts, function(err,data){
  if(err) throw err;
  console.log(data);
});

//Gets a summary of the weather in Boston between the dates May 21st - May 28th of this year.
client.planner('planner', '05210528', opts, function(err, data){
  if(err) throw err;
  console.log(data);
});

No Init

var wunderground = require('wunderground-node');
var client = new wunderground();
var opts = {
  key: '<api_key_here>',
  city: 'Boston',
  state: 'MA'
};

//Gets the forecast in Boston for today
client.forecast('forecast', opts, function(err, data){
  if(err) throw err;
  console.log(data);
});

//Gets a summary of the weather in Boston on May 21st, 2011
client.history('history', '20110521', opts, function(err,data){
  if(err) throw err;
  console.log(data);
});

//Gets a summary of the weather in Boston between the dates May 21st - May 28th of this year.
client.planner('planner', '05210528', opts, function(err, data){
  if(err) throw err;
  console.log(data);
});

Configuration

When configuring a new wunderground client, you must provide the following:

Params

  • key - Wunderground API key
  • city - city for weather
  • state - state for weather

All params are initially optional and can be overwritten using an opts object.

API

conditions:

Gets the conditions for a specific location

forecast:

Gets the forecast for a specific location

forecast10day:

Gets the forecast 10 days in advance for a specific location

hourly:

Gets the hourly conditions for a specific location

hourly10day:

Gets the hourly conditions 10 days in advance for a specific location

alerts:

Gets the alerts for a specific location

almanac:

Gets the average low and high temperatures

astronomy

Gets the moon phases, sunrise and sunset times

currentHurricane

Gets information on current hurricanes and tropical storms

geolookup

Gets the city name, zip/postal code, latitude & longitude coordinates

history('YYYYMMDD')

Gets the summary of the weather on the specificed date. Must be passed into the function in the format: YYYYMMDD

planner('MMDDMMDD')

Gets the summary based on the time interval specified. Must be passed into the function in the format: MMDDMMDD

rawtide

Gets raw tidal information

satellite

Gets the URL to the .gif visual and infrared satellite images

tide

Gets tidal information

webcams

Gets the locations of nearby weather stations and URLs for images from their web cams

yesterday

Gets the summary of the weather for yesterday

#Testing $ mocha

Contributing

See Issues

License

This code is licensed under the MIT license. Full license text is available in LICENSE

forthebadge

Readme

Keywords

none

Package Sidebar

Install

npm i wunderground-node

Weekly Downloads

2

Version

0.3.3

License

MIT

Last publish

Collaborators

  • dmccrevan