Giter VIP home page Giter VIP logo

wunderground-node's Introduction

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

wunderground-node's People

Contributors

dmccrevan avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ctgreybeard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.