npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

weather-underground-node

v1.3.0

Published

Weather underground client for node.js - NEW 2019 API from The Weather Company (IBM) only for PWS owners

Downloads

38

Readme

Weather underground client for node.js

npm version Npm download GitHub stars GitHub issues License

NPM


NEW 2019 API from The Weather Company (IBM) only for PWS owners

The Weather Company (IBM), which acquired Weather Underground in 2012, withdrew the API Weather Underground in March 2019 (see: End of Service for the Weather Underground API last update 20-02-2020 by WaybackMachine)

But IBM itself has decided that the owners / contributors of Personal Weather Station (PWS) will continue to be eligible for a free replacement API service selected from our standard IBM/Weather Company standard offerings that contain:

  • Current observations from the PWS network
  • 5 day daily forecast
  • PWS historical data
  • PWS lookup by geocode, zip code and location
  • Call volume: 1500/day, 30/minute

(see: Weather Underground API update last update 20-04-2020 by WaybackMachine)

From Friday, March 22, 2019, IBM will begin turning off the keys associated with personal weather stations (PWSs) on the old Weather Underground API http://api.wunderground.com/api/.

In order to use the new API made available by the Wheater company (IBM) accessible from the new endpoint https://api.weather.com you need to get the new api key. Go to WU - Personal Weather Station Network login/register and then to API Keys

APIs for Personal Weather Station Contributors https://docs.google.com/document/d/1eKCnKXI9xnoMGRRzOL1xPCBihNV2rOet08qpE_gArAY/edit

Install

npm install --save weather-underground-node

var WeatherUndergroundNode = require('weather-underground-node');
var myApyKey = 'B5792DB9271ED8697F671F8FBBE49E43';
var wunderground = new WeatherUndergroundNode(myApyKey);

How To Use

The syntax follows a simple pattern:

    wunderground.[resource call(s)].request(function (err, response) {
                console.log(response);
        }););

or with sync method

    const result = await wunderground.[resource call(s)].requestSync();

The available resource calls are the following (you must include one in your request):

  • PWSCurrentConditions

  • PWSDailySummary7Day

  • PWSRecentHistory1Day

  • PWSRecentHistory7Day

  • PWSHistoryHourly

  • PWSHistoryAll

  • PWSHistoryDaily

  • ForecastDaily

  • LocationSearch

  • LocationPoint

  • LocationNear

The documentation for each resource can be found here: APIs documentation for PWS Contributors.

So to get the current conditions you would use the following code, where IROME7475 is a PWS station ID:

wunderground.PWSCurrentConditions("IROME7475").request(function (err, response) {
    console.log(response);
});

To get 5 day forecast by postal code:

wunderground.ForecastDaily().FiveDay().ByPostalCode("00178", "IT").Language("en-EN").request(function (err, response) {
        console.log(response);
});

To get 5 day forecast by geocode wit Italian language:

wunderground.ForecastDaily().FiveDay().ByGeocode("41.89", "12.444").Language("it-IT").request(function (err, response) {(function (err, response) {
        console.log(response);
});

To get daily historic data:

wunderground.PWSHistoryDaily("IROME7475", "20190309").request(function (err, response) {
        console.log(response);
});

Units

Imperial/english units can be requested by adding InImperialUnits() or InEnglishUnits() to the chain. (default: Metric units)

Running Unit Tests and Code coverage

In order to run unit tests you need to include your apykey and your PWS station id in .env file and set in the root directory.

NODE_ENV=test
WU_APY_KEY=B5792DB9271ED8697F671F8FBBE49E43
WU_STATION_ID=YOUR_STATION_ID_HERE

Then simply run test this command: npm run test

For code coverage run this command: npm run coverage

License

This project is released under The MIT License (MIT)