Skip to content

bramleyas/noaagh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOAAGH

A JavaScript wrapper for the NOAA/NWS Public API

About

This package can be used to easily access data from the National Weather Service's public API. It's stupid simple: no, really - this implementation is a bit rough. This is my first package project, and it's been a while since I've touched code. After time, this code will be way more efficient. The wrapper uses the Fetch API to access the NWS' endpoints.

Usage

All functions are named after their respective endpoints as listed in the 'Specification' tab of the API's website listed above, slashes removed and typed in camelCase. Note that arguments for coordinates must be passed as strings without spaces, as they are concatenated to the NWS endpoint format.

Direct from NWS API

GETting the response from the /glossary endpoint

const noaagh = require('noaagh');
noaagh.glossary();
/* ...'1-2-3 Rule'
'A means of avoiding winds associated with a tropical cyclone by taking into account the forecast track error of the National Weather Service'...*/

Logging the response from the /alerts/active/zone/ILC104 endpoint for Chicago, Illinois

noaagh.alertsActiveZone('ILC104').then((output) => {
  console.log(output);
});
// ...'Current watches, warning, and advisories for ILC104'...

Built-in functions

temperature(): Logging the temperature at Fox 8's studios in Cleveland, Ohio (only accepts coordinates)

noaagh.temperature('41.5303,-81.6491').then((output) => {
  console.log(output);
});
// 68

shortForecast(): Logging the general conditions at I-95 bridge collapse in Philadelphia, Pennsylvania (only accepts coordinates)

noaagh.shortForecast('40.0244,-75.0308').then((output) => {
  console.log(output);
});
// Overcast

Resources

TODO

  • Write new functions for specific applications
    • Temperature for specific location (basically done)
    • Weather condition for specific location
    • Images?
  • Clean up the code, perhaps not so repetitive
  • Provide example .js files
  • Provide more NWS resources

About

A JavaScript wrapper for the NOAA/NWS Public API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published