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

node-weather-service

v1.0.1

Published

Node.js wrapper for the api.weather.gov api.

Downloads

11

Readme

Node weather service

An api.weather.gov node.js wrapper

This is a fairly simple API to use, it's really just a couple commands. Honestly, the hardest part is navigating the screwed up documentation all the data that is used has-- it took me like 20 minutes to figure out what the hell a 'gridpoint' is; I'll make an attempt to leave decent docs, but I'm not the best at it lol.

Methods

It's really just the NWS API

I'll just list the functions, hopefully my jsdoc is decent enoguh to carry me... If you need more clarification, take a look at this.

  • getAlerts
  • getGlossary
  • getGridPoint
  • getStations
  • getOffices
  • getPoint
  • getRadar
  • getProducts
  • getZones

Getting started

In lieu of actual documentation, I'll give a basic getting started thing for each command.

Everything should start with this

import weather from 'node-weather-service';

getAlerts

weather.getAlerts({ // This script gets all alerts
// between June 23, 2021 and June 24, 2021
start: '2021-06-23T09:07:21-07:00', // Start time
end: '2021-06-24T09:07:21-07:00'
}) // End time
.then((alerts) => { // Once request is finished
	console.log(alerts);
});

getGlossary

weather.getGlossary() // This is probably the simplest method in this api,
// it's literally just one function call with no args
.then((glossary) => {
console.log(glossary);
});

getGridPoint

weather.getGridPoint(null, 40.7, -74, { // Get hourly forecast from NYC
useLatLon: true, // Use lattitude and longitude instead of the weird
// coordinate system
forecast: true, // Get forecast data
hourly: true
}) // Make data hourly
.then((gridPoint) => {
	console.log(gridPoint);
});

getStations

weather.getStations({ id: 'K12N' }) // Get data from K12N Station
.then((stations) => {
	console.log(stations);
});

getOffices

weather.getOffices({ id: 'OKX' }) // Gets data from OKX
// office
.then((offices) => {
	console.log(offices);
});

getPoint

weather.getPoint({ lat: 40.7, lon: -74 }) // The chad version of
// getGridPoint
.then((point) => {
	console.log(point);
});

getRadar

Note: Currently throwing 503 errors even when used through official channels, so IDEK whats wrong, but I can't test right now. So this might be horribly broken.
weather.getRadar({ stationid: 'K12N', stations: true })
// Get radar data from station K12N
.then((radar) => {
	console.log(radar);
});

getProducts

weather.getProducts({ // Get all items of type ABV at OKX I don't really
// know what this does, but it works, so eh
locations: true, // Sort by location
types: true, // Sort by type
typeid: 'ABV', // Type ID
locationid: 'OKX'
}) // Location ID
.then((products) => {
	console.log(products);
});

getZones

weather.getZones({ // Get zone data of type land, id ANZ338
type: 'land',
zoneid: 'ANZ338',
forecast: true
})
.then((zone) => {
	console.log(zone);
});

That's pretty much it.

If you have any questions, shoot me an email at [email protected], or dm me on twitter @omanthehuman1, or just raise an issue, and I should respond pretty quickly. Contributions are greatly appreciated, to either my code or this dumpster fire of a readme. Oh yea, MIT license, do whatever you want with my code but I'm not liable if anything goes wrong, no warranty, etc