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({
start: '2021-06-23T09:07:21-07:00',
end: '2021-06-24T09:07:21-07:00'
})
.then((alerts) => {
console.log(alerts);
});
getGlossary
weather.getGlossary()
.then((glossary) => {
console.log(glossary);
});
getGridPoint
weather.getGridPoint(null, 40.7, -74, {
useLatLon: true,
forecast: true,
hourly: true
})
.then((gridPoint) => {
console.log(gridPoint);
});
getStations
weather.getStations({ id: 'K12N' })
.then((stations) => {
console.log(stations);
});
getOffices
weather.getOffices({ id: 'OKX' })
.then((offices) => {
console.log(offices);
});
getPoint
weather.getPoint({ lat: 40.7, lon: -74 })
.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 })
.then((radar) => {
console.log(radar);
});
getProducts
weather.getProducts({
locations: true,
types: true,
typeid: 'ABV',
locationid: 'OKX'
})
.then((products) => {
console.log(products);
});
getZones
weather.getZones({
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 oranroha@gmail.com, 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