DEV Community

Cover image for NOAA::Aurora for Space Weather Forecasts
Dimitrios Kechagias
Dimitrios Kechagias

Posted on

NOAA::Aurora for Space Weather Forecasts

With the current solar maximum, I wanted to add aurora forecasting features to my iOS weather app, Xasteria. Instead of fetching text files from NOAA, I thought it would be nice for my weather proxy server to handle that. Hence I developed NOAA::Aurora and released it to CPAN.

The module provides a convenient interface to the NOAA Space Weather Prediction Center (SWPC), handling data fetching, parsing, and caching.

Usage

Simple OO interface, you can get short term aurora probability either as a map:

use NOAA::Aurora;

my $aurora = NOAA::Aurora->new();

# Short-term forecast map for the Northern hemisphere
$aurora->get_image(hemisphere => 'north', output => 'aurora_north.jpg');
Enter fullscreen mode Exit fullscreen mode

aurora forecast

Or as a probability:

# Get short-term aurora probability for a given location
my $probability = $aurora->get_probability(lat => 51, lon => -2);
Enter fullscreen mode Exit fullscreen mode

You can also get a forecast timeseries for the next 3 or 27 days:

# Get 3-day kp forecast as a timeseries
my $forecast = $aurora->get_forecast();

# Get 27-day outlook as a timeseries
my $outlook = $aurora->get_outlook();
Enter fullscreen mode Exit fullscreen mode

Top comments (0)