
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
noaa-forecasts
Advanced tools
A Promised-based library for fetching forecast data from NOAA. Promises are of the Bluebird flavor.
npm install --save noaa-forecasts
1. Get an API key from NOAA (https://www.ncdc.noaa.gov/cdo-web/token)
2. npm install noaa-forecasts
3. var noaaForecaster = require('noaa-forecasts');
4. read the docs below to figure out how which method to use :)
With this method, you're simply passing API params through to the NOAA API (where this library does very little to change what you pass in other than formatting it for the api)
To do so, pass in any of the parameters found on the NOAA REST API page The complete list of elementInputNames (ie, the data you actually care about) can be found here
Here's an example from the test file in this code base:
var moment = require('moment');
var noaaForecaster = require('../index');
var inspect = require('util').inspect;
var obj = {
listLatLon: '38.99,-77.01 37.7833,-122.4167',
product: 'time-series', // this is a default, it's not actually required
begin: moment().format('YYYY-MM-DDTHH:mm:ss'),
end: moment().add(3, 'days').format('YYYY-MM-DDTHH:mm:ss'),
qpf: 'qpf', // first elementInputName - Liquid Precipitation Amount
pop12: 'pop12' // another elementInputName - 12 hour probability of precipitation
};
var token = 'XXXXX-XXXXXXXX-XXXXXXXX-XXXXXX;
noaaForecaster.setToken(token);
noaaForecaster.getForecast(obj)
.then(function(results) {
console.log(inspect(results, { colors: true, depth: Infinity }));
});
.forecast attribute to your business objectsThe problem with using this library as a simple JSON formatter occurs when you have multiple points. In your business data, you may have something like this:
[
{ project: 1, lat: '33.00', lon: '-127.00' },
{ project: 2, lat: '33.00', lon: '-127.10' }
]
Where project: 1 has meaning to you (though it has none to the NOAA API), and you'd really just like to attach a forecast to that project: 1.
Your best attempts to make an API call for both of those points (in the same call) will get you something back like this:
[
{ 'Point1': /** forecast data **/, ... }
{ 'Point2': /** forecast data **/, ... }
]
That is, NOAA will name the points to Point1, Point2, etc... and give you no indication of which business object of yours the forecast is for. You'd have to do either a comparison of the lat/lon's or something similar to what this method will do for you - carefully remember which points you passed in, in order, and then match them up with Point1, Point2, etc (which are also ordered). Or, you can let this method do all that for you.
An example:
var moment = require('moment');
var noaaForecaster = require('../index');
var inspect = require('util').inspect;
// forecast details are applied to all the business objects. The goal being to only make 1 request, for efficiency
var forecastDetails = {
product: 'time-series', // this is a default, it's not actually required
begin: moment().format(),
end: moment().add(3, 'days').format(),
qpf: 'qpf', // Liquid Precipitation Amount
pop12: 'pop12' // 12 hour probability of precipitation
};
// each object must have a lat and a lon
var myGeoBusinessObjects = [
{ project: 1, lat: '38.99', lon: '-77.01' },
{ project: 2, lat: '38.99', lon: '-77.01' }
];
var token = 'XXXXX-XXXXXXXX-XXXXXXXX-XXXXXX;
noaaForecaster.setToken(token);
noaaForecaster.attachForecasts(myGeoBusinessObjects, forecastDetails)
.then(function(results) {
console.log(inspect(results, { colors: true, depth: Infinity }));
});
I encourage you to simply log the results to see how the data is formatted for your points.
NOTE: This method returns the original object, NOT a copy! NOTE: The location returned in the appended forecast object is the location that NOAA used, not the one you passed in. They may not be the same if NOAA truncated some of the decimal places.
To manually test, run one of the following
node bin/test-getForecast.js --token=[token]
node bin/test-attachForecasts.js --token=[token]
with the token you got from NOAA from here
Play around with the parameters in those files to get a feel for how it works.
FAQs
A Promised-based library for fetching JSON forecast data from NOAA
The npm package noaa-forecasts receives a total of 4 weekly downloads. As such, noaa-forecasts popularity was classified as not popular.
We found that noaa-forecasts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.