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_n.jpg');
Or as a probability:
# Get short-term aurora probability for a given location
my $probability = $aurora->get_probability(lat => 51, lon => -2);
You can also get a forecast timeseries for the next 3 or 27 days:
# Let's switch to RFC 3339 format for the timeseries
my $aurora = NOAA::Aurora->new(date_format => 'rfc');
# Get 3-day kp forecast as a timeseries
my $forecast = $aurora->get_forecast();
# [
# {
# 'kp' => '3.67',
# 'time' => '2025-12-25 00:00:00Z'
# },
# {
# 'kp' => '2.67',
# 'time' => '2025-12-25 03:00:00Z'
# },
# ...
# ]
# Get 27-day outlook as a timeseries
my $outlook = $aurora->get_outlook();
# [
# {
# 'ap' => '28',
# 'flux' => '130',
# 'kp' => '5',
# 'time' => '2025-12-22 00:00:00Z'
# },
# {
# 'ap' => '22',
# 'flux' => '135',
# 'kp' => '5',
# 'time' => '2025-12-23 00:00:00Z'
# },
# ...
# ]
To see the comments or leave new ones, visit original article on DEV.to.
