Skip to content

ctgreybeard/wunderground-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple wrapper for the weather channel's APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%