blib/lib/NOAA/Aurora.pm

filter: Statementstmt 100% 139 / 139 Branchbran 95.0% 57 / 60 Conditioncond 85.3% 35 / 41 MC/DCmcdc 69.5% 16 / 23 Subroutinesub 100% 19 / 19 Podpod 100% 6 / 6 totaltotal 94.4% 272 / 288 CC 52 SCAR 18.1
CC
52
Cov
96%
_parse_geo
12.0
get_probability
7.0
get_image
7.0
CRAP 6.1
↑ Summary
1 package NOAA::Aurora;
2  
3 3 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use parent 'Weather::API::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Weather::API::Base qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 NOAA::Aurora - Simple client for NOAA's Aurora Forecast Service
13  
14 =cut
15  
16 3 our $VERSION = '0.2';
17  
18 =head1 SYNOPSIS
19  
20 use NOAA::Aurora;
21  
22 # Constructor can use RFC 3339 or ISO instead of timestamps for timeseries
23 my $aurora = NOAA::Aurora->new(date_format => 'rfc');
24  
25 # Save the latest probability map to an image file
26 $aurora->get_image(hemisphere => 'north', output => 'aurora_north.jpg');
27  
28 # Get aurora probability for a given location
29 my $probability = $aurora->get_probability(lat => 51.2, lon => -1.8);
30  
31 # Get 3-day forecast as a timeseries
32 my $forecast = $aurora->get_forecast();
33  
34 # Get 27-day outlook as a timeseries
35 my $outlook = $aurora->get_outlook();
36  
37 =head1 DESCRIPTION
38  
39 NOAA::Aurora provides basic access to the L<NOAA Space Weather Prediction Center (SWPC)|https://www.swpc.noaa.gov/>
40 Aurora Forecast API. This service provides real-time aurora forecasts based on solar activity and geomagnetic conditions.
41  
42 The module fetches aurora probability data, latest aurora images, and the 3-day aurora forecast.
43  
44 Responses are cached (by default for 120 sec).
45  
46 =head1 CONSTRUCTOR
47  
48 =head2 C<new>
49  
50 my $aurora = NOAA::Aurora->new(
51 cache => $cache_secs?,
52 swpc => $swpc_services_subdomain,
53 date_format => $unix_rfc_or_iso,
54 timeout => $timeout_sec?,
55 agent => $user_agent_string?,
56 ua => $lwp_ua?,
57 );
58
59 Optional parameters:
60  
61 =over 4
62  
63 =item * C<cache> : Will cache results for the specified seconds. Default: C<120>.
64  
65 =item * C<swpc> : Space Weather Prediction Center subdomain. Default: C<services.swpc.noaa.gov>.
66  
67 =item * C<date_format> : Format for functions that return dates/timestamps.
68 Can be C<unix> (unix timestamp), C<rfc> (for I<YYYY-MM-DD HH:mm:ssZ>) or C<iso> (for I<YYYY-MM-DDTHH:mm:ssZ>).
69 Default: C<unix>.
70  
71 =item * C<timeout> : Timeout for requests in secs. Default: C<30>.
72  
73 =item * C<agent> : Customize the user agent string.
74  
75 =item * C<ua> : Pass your own L<LWP::UserAgent> to customise further.
76  
77 =back
78  
79 Note that the module base is L<Weather::API::Base>, so some additional parameters
80 are inherited - see the base module for details.
81  
82 =head1 METHODS
83  
84 =head2 C<get_image>
85  
86 my $image_data = $aurora->get_image(
87 hemisphere => $hem,
88 output => $filename?
89 );
90  
91 Returns the latest aurora oval image for the specified hemisphere in jpg data.
92 Optionally will save it to $filename.
93 Function caches the results (see constructor).
94  
95 Optional parameters:
96  
97 =over 4
98  
99 =item * C<hemisphere> : C<north> or C<south> (accepts abbreviations). Default: C<north>.
100  
101 =item * C<output> : If specified will save to specified jpg file.
102  
103 =back
104  
105 =head2 C<get_probability>
106  
107 my $probability = $aurora->get_probability(
108 lat => $lat,
109 lon => $lon,
110 hash => $return_hash?
111 );
112  
113 Fetches the aurora probability at a specific latitude and longitude (where negative longitude means west) if specified,
114 otherwise will return all the globe. Can return the original NOAA JSON string, or
115 decode it into a Perl hash of hashes:
116  
117 {
118 $longitude1 => {$latitude1 => $prob},
119 ...
120 }
121  
122 Probability given as an integer percentage value (0-100). Granularity is 1 degree.
123 Point lookups accept signed longitude (-180 to 180); whole-grid responses keep
124 NOAA's original longitude keys (0 to 359).
125 In Perl hash mode, 0 probability locations will be ommitted from the response.
126  
127 The function caches the results (see constructor), so subsequent calls will not
128 require downloading and decoding.
129  
130 Optional parameters:
131  
132 =over 4
133  
134 =item * C<hash> : If true, will return Perl hash instead of JSON.
135  
136 =back
137  
138 =head2 C<get_forecast>
139  
140 my $forecast = $aurora->get_forecast(
141 format => $output?
142 );
143  
144 Retrieves NOAA's 3-day space forecast (preferred over the geomagnetic forecast due
145 to more frequent / twice daily update) and by default returns an arrayref of hashes:
146  
147 [{time => $timestamp, kp => $kp_value},...]
148  
149 The timestamp will be at the start of the 3h time range NOAA returns.
150  
151 Optional parameters:
152  
153 =over 4
154  
155 =item * C<format> : If C<'text'> is specified as the format, raw text output will be returned
156 instead of an array with the timeseries.
157  
158 =back
159  
160 =head2 C<get_outlook>
161  
162 my $outlook = $aurora->get_outlook(
163 format => $output?
164 );
165  
166 Retrieves NOAA's 27-day outlook with the forecasted daily values for the 10.7cm Solar
167 radio flux, the Planetary A Index and the largest Kp index. By default returns an
168 arrayref of hashes:
169  
170 [
171 {
172 time => $timestamp,
173 flux => $flux_value,
174 ap => $a_index,
175 kp => $max_kp_value
176 }, ...
177 ]
178  
179 =over 4
180  
181 =item * C<format> : If C<'text'> is specified as the format, raw text output will be returned
182 instead of an array with the timeseries.
183  
184 =back
185  
186 =head1 UTILITY FUNCTIONS
187  
188 =head2 C<kp_to_g>
189  
190 my $g_index = kp_to_g($kp_index);
191  
192 Pass the Kp index and get the G-Index (Geomagnetic storm from G1 to G5) or 0 if
193 the Kp is not indicative of a Geomagnetic Storm. Fractional kp is rounded half up
194 (e.g. kp >= 4.5 -> G1).
195  
196 =cut
197  
198 8 ▶sub new {
Subroutine new: called CC=6 SCAR=17.9
Pod documented
199 8 my ($class, %args) = @_;
200  
201 8 my $self = $class->SUPER::new(%args);
202  
203 8 $self->{data} = {};
204 8 ▶ $self->{cache} = $args{cache} // 120;
Condition100%2/2
$args{"cache"} // 120
l!l
26
MC/DC100%1/1
$args{"cache"} // 120
$args{"cache"}
Truth table100%2/2
A
A= $args{"cache"}
Aresult
11
00
205 8 ▶ $self->{swpc} = $args{swpc} || 'services.swpc.noaa.gov';
Condition100%2/2
$args{'swpc'} || 'services.swpc.noaa.gov'
l!l
17
MC/DC100%1/1
$args{'swpc'} || 'services.swpc.noaa.gov'
$args{'swpc'}
Truth table100%2/2
A
A= $args{'swpc'}
Aresult
11
00
206 8 $self->{swpc} =~ s#^http(?:s)?://##;
207 # Time delimiter for rfc/iso
208 8 ▶ my $time_f = lc($args{date_format} || '');
Condition100%2/2
$args{'date_format'} || ''
l!l
26
MC/DC100%1/1
$args{'date_format'} || ''
$args{'date_format'}
Truth table100%2/2
A
A= $args{'date_format'}
Aresult
11
00
209 8 ▶ $self->{td} = ' ' if $time_f eq 'rfc';
Branch: 1 branch
BranchTrueFalseTotal
if $time_f eq "rfc" 1 7 8
210 8 ▶ $self->{td} = 'T' if $time_f eq 'iso';
Branch: 1 branch
BranchTrueFalseTotal
if $time_f eq "iso" 1 7 8
211  
212 8 return $self;
213 }
214  
215 8 ▶sub get_image {
Subroutine get_image: called CC=7 SCAR=19.5
Pod documented
216 8 my $self = shift;
217 8 my %args = @_;
218 8 ▶ $args{hem} ||= $args{hemisphere} || '';
Condition100%5/5
$args{"hem"} ||= $args{"hemisphere"} || ""
l!l&&r!l&&!r
116
$args{'hemisphere'} || ''
l!l
16
MC/DC100%2/2
$args{"hem"} ||= $args{"hemisphere"} || ""
$args{"hem"} $args{'hemisphere'}
Truth table100%3/3
A ||= B
A= $args{"hem"}B= $args{'hemisphere'}
ABresult
1X1
011
000
219  
220 8 ▶ my $h = $args{hem} =~ /^s/i ? 'south' : 'north';
Branch: 1 branch
BranchTrueFalseTotal
$args{'hem'} =~ /^s/i ? : 2 6 8
221 8 ▶ my $data = $self->_get_cache($h) || $self->_set_cache(
Condition66%2/3
$self->_get_cache($h) || $self->_set_cache($h, $self->_get_output($self->_get_ua("$self->{'swpc'}/images/animations/ovation/$h/latest.jpg")))
l!l&&r!l&&!r
260
MC/DC0%0/2
$self->_get_cache($h) || $self->_set_cache($h, $self->_get_output($self->_get_ua("$self->{'swpc'}/images/animations/ovation/$h/latest.jpg")))
$self->_get_cache($h) $self->_set_cache($h, $self->_get_output($self->_get_ua("$self->{'swpc'}/images/animations/ovation/$h/latest.jpg")))
Truth table66%2/3
A || B
A= $self->_get_cache($h)B= $self->_set_cache($h, $self->_get_output($self->_get_ua("$self->{'swpc'}/images/animations/ovation/$h/latest.jpg")))
ABresult
1X1
011
000
222 $h,
223 $self->_get_output(
224 $self->_get_ua(
225 "$self->{swpc}/images/animations/ovation/$h/latest.jpg"
226 )
227 )
228 );
229  
230 8 ▶ if ($args{output}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"output"}) 1 7 8
231 1 ▶ open(my $fh, '>:raw', $args{output}) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">:raw", $args{"output"} or die $! 1 0 1
232 1 print $fh $data;
233 1 close($fh);
234 }
235  
236 8 return $data;
237 }
238  
239 15 ▶sub get_probability {
Subroutine get_probability: called CC=7 SCAR=19.5
Pod documented
240 15 my $self = shift;
241 15 my %args = @_;
242  
243 15 my ($json, $hash) = $self->_get_probabilities;
244  
245 15 ▶ if (defined $args{lat} && defined $args{lon}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"lat"} and defined $args{"lon"}) 12 3 15
Condition66%2/3
defined $args{"lat"} and defined $args{"lon"}
!ll&&!rl&&r
3012
MC/DC50%1/2
defined $args{"lat"} and defined $args{"lon"}
defined $args{"lat"} defined $args{"lon"}
Truth table66%2/3
A and B
A= defined $args{"lat"}B= defined $args{"lon"}
ABresult
0X0
100
111
246 12 $args{$_} = sprintf("%.0f", $args{$_}) for qw/lat lon/;
247 12 Weather::API::Base::_verify_lat_lon(\%args);
248 10 my $column = $hash->{$args{lon} % 360};
249 10 ▶ return $column ? ($column->{0 + $args{lat}} || 0) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$column ? : 9 1 10
Condition50%1/2
$$column{0 + $args{"lat"}} or 0
l!l
90
MC/DC0%0/1
$$column{0 + $args{"lat"}} or 0
$$column{0 + $args{"lat"}}
Truth table50%1/2
A
A= $$column{0 + $args{"lat"}}
Aresult
11
00
250 }
251  
252 3 ▶ return $args{hash} ? $hash : $json;
Branch: 1 branch
BranchTrueFalseTotal
$args{'hash'} ? : 2 1 3
253 }
254  
255 8 ▶sub _get_text_source {
Subroutine _get_text_source: called CC=4 SCAR=13.9
256 8 my $self = shift;
257 8 my $source = shift;
258 8 my %args = @_;
259 8 my $url = "$self->{swpc}/text/$source.txt";
260 8 my $resp = $self->_get_ua($url);
261 8 my $content = $resp->decoded_content;
262  
263 8 ▶ return $content if $args{format} && $args{format} eq 'text';
Branch: 1 branch
BranchTrueFalseTotal
if $args{"format"} and $args{"format"} eq "text" 2 6 8
Condition100%3/3
$args{"format"} and $args{"format"} eq "text"
!ll&&!rl&&r
512
MC/DC100%2/2
$args{"format"} and $args{"format"} eq "text"
$args{"format"} $args{"format"} eq "text"
Truth table100%3/3
A and B
A= $args{"format"}B= $args{"format"} eq "text"
ABresult
0X0
100
111
264  
265 6 ▶ return $source eq '3-day-forecast'
Branch: 1 branch
BranchTrueFalseTotal
$source eq '3-day-forecast' ? : 3 3 6
266 ? $self->_parse_geo($content)
267 : $self->_parse_outlook($content);
268 }
269  
270 4 ▶sub get_forecast {
Subroutine get_forecast: called CC=1 SCAR=0.0
Pod documented
271 4 my $self = shift;
272 4 return $self->_get_text_source('3-day-forecast', @_);
273 }
274  
275 4 ▶sub get_outlook {
Subroutine get_outlook: called CC=1 SCAR=0.0
Pod documented
276 4 my $self = shift;
277 4 return $self->_get_text_source('27-day-outlook', @_);
278 }
279  
280 7 ▶sub kp_to_g {
Subroutine kp_to_g: called CC=7 SCAR=19.5
Pod documented
281 7 my $kp = shift;
282 7 ▶ return 0 if !$kp || $kp < 4.5;
Branch: 1 branch
BranchTrueFalseTotal
if not $kp or $kp < "4.5" 1 6 7
Condition66%2/3
not $kp or $kp < "4.5"
l!l&&r!l&&!r
016
MC/DC50%1/2
not $kp or $kp < "4.5"
not $kp $kp < "4.5"
Truth table66%2/3
not(A) or B
A= not $kpB= $kp < "4.5"
ABresult
1X1
011
000
283 6 ▶ return 'G1' if $kp < 5.5;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < "5.5" 1 5 6
284 5 ▶ return 'G2' if $kp < 6.5;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < "6.5" 1 4 5
285 4 ▶ return 'G3' if $kp < 7.5;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < "7.5" 1 3 4
286 3 ▶ return 'G4' if $kp < 9;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < 9 2 1 3
287 1 return 'G5';
288 }
289  
290 15 ▶sub _get_probabilities {
Subroutine _get_probabilities: called CC=3 SCAR=11.0
291 15 my $self = shift;
292 15 my $json = $self->_get_cache('json');
293 15 my $hash = $self->_get_cache('hash');
294 15 ▶ return ($json, $hash) if $json && $hash;
Branch: 1 branch
BranchTrueFalseTotal
if $json and $hash 13 2 15
Condition66%2/3
$json and $hash
!ll&&!rl&&r
2013
MC/DC50%1/2
$json and $hash
$json $hash
Truth table66%2/3
A and B
A= $jsonB= $hash
ABresult
0X0
100
111
295 2 return $self->_refresh_probability;
296 }
297  
298 2 ▶sub _refresh_probability {
Subroutine _refresh_probability: called CC=3 SCAR=11.0
299 2 my $self = shift;
300 2 my $resp = $self->_get_ua("$self->{swpc}/json/ovation_aurora_latest.json");
301 2 my $json = $resp->decoded_content;
302 2 my %raw = $self->_get_output($resp, 1);
303 2 $self->_set_cache('json', $json);
304 2 my %hash;
305 2 foreach (@{$raw{coordinates}}) {
306 65165 ▶ $hash{$_->[0]}->{$_->[1]} = $_->[2] if $_->[2];
Branch: 1 branch
BranchTrueFalseTotal
if $_->[2] 20389 44776 65165
307 }
308 2 $self->_set_cache('hash', \%hash);
309 2 return ($json, \%hash);
310 }
311  
312 38 ▶sub _get_cache {
Subroutine _get_cache: called CC=4 SCAR=13.9
313 38 my $self = shift;
314 38 my $key = shift;
315  
316 return
317 unless $self->{cache} && $self->{data}->{$key}
318 38 ▶ && (time() - $self->{data}->{$key}->{ts} <= $self->{cache});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"cache"} and $self->{"data"}{$key} and time - $self->{"data"}{$key}{"ts"} <= $self->{"cache"} 10 28 38
Condition83%5/6
$self->{"cache"} and $self->{"data"}{$key} and time - $self->{"data"}{$key}{"ts"} <= $self->{"cache"}
!ll&&!rl&&r
10028
$self->{"cache"} and $self->{"data"}{$key}
!ll&&!rl&&r
3728
MC/DC66%2/3
$self->{"cache"} and $self->{"data"}{$key} and time - $self->{"data"}{$key}{"ts"} <= $self->{"cache"}
$self->{"cache"} $self->{"data"}{$key} time - $self->{"data"}{$key}{"ts"} <= $self->{"cache"}
Truth table75%3/4
A and B and C
A= $self->{"cache"}B= $self->{"data"}{$key}C= time - $self->{"data"}{$key}{"ts"} <= $self->{"cache"}
ABCresult
0XX0
10X0
1100
1111
319  
320 28 return $self->{data}->{$key}->{data};
321 }
322  
323 10 ▶sub _set_cache {
Subroutine _set_cache: called CC=1 SCAR=0.0
324 10 my $self = shift;
325 10 my $key = shift;
326 10 my $data = shift;
327  
328 10 $self->{data}->{$key}->{ts} = time();
329 10 $self->{data}->{$key}->{data} = $data;
330  
331 10 return $data;
332 }
333  
334 # Parse from last day to first, passing ref_month being the last month processed
335 6 ▶sub _parse_mon_day {
Subroutine _parse_mon_day: called CC=4 SCAR=13.9
336 6 my ($date, $ref_year, $ref_mon) = @_;
337 6 my ($mon, $day) = split /\s+/, $date;
338 6 $mon = mon_to_num($mon);
339  
340 6 ▶ $ref_year-- if $ref_mon && $mon > $ref_mon;
Branch: 1 branch
BranchTrueFalseTotal
if $ref_mon and $mon > $ref_mon 1 5 6
Condition100%3/3
$ref_mon and $mon > $ref_mon
!ll&&!rl&&r
231
MC/DC100%2/2
$ref_mon and $mon > $ref_mon
$ref_mon $mon > $ref_mon
Truth table100%3/3
A and B
A= $ref_monB= $mon > $ref_mon
ABresult
0X0
100
111
341 6 $date = sprintf("%d-%02d-%02d", $ref_year, $mon, $day);
342  
343 6 ▶ return wantarray ? ($date, $mon) : $date;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 4 6
344 }
345  
346 3 ▶sub _parse_geo {
Subroutine _parse_geo: called CC=12 SCAR=24.9
347 3 my ($self, $data) = @_;
348 3 my @lines = split /\n/, $data;
349 3 my $g = qr/(?:\(G\d\)\s+)?/;
350
351 # Find year in the "NOAA Kp index breakdown" or "breakdown" line
352 3 my $year;
353 3 ▶ while (defined(my $line = shift @lines)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = shift @lines)) 26 1 27
354 26 ▶ if ($line =~ /Kp index breakdown\s+.*(\d{4})/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /Kp index breakdown\s+.*(\d{4})/i) 2 24 26
355 2 $year = $1;
356 2 last;
357 }
358 }
359  
360 3 ▶ return [] unless $year;
Branch: 1 branch
BranchTrueFalseTotal
unless $year 1 2 3
361  
362 # Date headers
363 2 my @dates;
364 2 ▶ while (defined(my $line = shift @lines)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = shift @lines)) 4 0 4
365 4 ▶ if ($line =~ /^\s*([A-Za-z]{3}\s+\d+)\s+([A-Za-z]{3}\s+\d+)\s+([A-Za-z]{3}\s+\d+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\s*([A-Za-z]{3}\s+\d+)\s+([A-Za-z]{3}\s+\d+)\s+([A-Za-z]{3}\s+\d+)/) 2 2 4
366 2 my ($dt3, $ref_mon) = _parse_mon_day($3, $year);
367 2 @dates = map {scalar _parse_mon_day($_, $year, $ref_mon)} ($1, $2);
368 2 push @dates, $dt3;
369 2 last;
370 }
371 }
372  
373 2 ▶ return [] unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 2 2
374  
375 2 my %kp_data;
376 2 ▶ my $td = $self->{td} || ' ';
Condition100%2/2
$self->{'td'} || ' '
l!l
11
MC/DC100%1/1
$self->{'td'} || ' '
$self->{'td'}
Truth table100%2/2
A
A= $self->{'td'}
Aresult
11
00
377 2 foreach my $line (@lines) {
378 81 ▶ if ($line =~ /^\s*(\d{2})-\d{2}UT\s+([\d.]+)\s+$g([\d.]+)\s+$g([\d.]+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\s*(\d{2})-\d{2}UT\s+([\d.]+)\s+$g([\d.]+)\s+$g([\d.]+)/) 16 65 81
379 16 my ($t, @kp) = ($1, $2, $3, $4);
380 16 my @times = map {"$_$td$t:00:00Z"} @dates;
381 16 ▶ @times = map {datetime_to_ts($_)} @times unless $self->{td};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"td"} 8 8 16
382 16 $kp_data{$times[$_]} = $kp[$_] for 0..2;
383 }
384 }
385  
386 2 my @result = map {{time => $_, kp => $kp_data{$_}}} sort keys %kp_data;
387 2 return \@result;
388 }
389  
390 3 ▶sub _parse_outlook {
Subroutine _parse_outlook: called CC=5 SCAR=16.1
391 3 my ($self, $data) = @_;
392 3 my @lines = split /\n/, $data;
393 3 my @result;
394  
395 3 ▶ my $td = $self->{td} || ' ';
Condition100%2/2
$self->{'td'} || ' '
l!l
12
MC/DC100%1/1
$self->{'td'} || ' '
$self->{'td'}
Truth table100%2/2
A
A= $self->{'td'}
Aresult
11
00
396 3 foreach my $line (@lines) {
397 79 ▶ if ($line =~ /^\s*(\d{4})\s+([A-Z][a-z]{2})\s+(\d{2})\s+(\d+)\s+(\d+)\s+(\d+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\s*(\d{4})\s+([A-Z][a-z]{2})\s+(\d{2})\s+(\d+)\s+(\d+)\s+(\d+)/) 54 25 79
398 54 my ($year, $mon_str, $day, $flux, $ap, $kp) = ($1, $2, $3, $4, $5, $6);
399 54 my $mnum = mon_to_num($mon_str);
400
401 54 my $dt = sprintf("$year-%02d-%02d${td}00:00:00Z", $mnum, $day);
402 54 ▶ my $ts = $self->{td} ? $dt : datetime_to_ts($dt);
Branch: 1 branch
BranchTrueFalseTotal
$self->{'td'} ? : 27 27 54
403
404 54 push @result, {
405 time => $ts,
406 flux => $flux,
407 ap => $ap,
408 kp => $kp,
409 };
410 }
411 }
412 3 return \@result;
413 }
414  
415 =head1 AUTHOR
416  
417 Dimitrios Kechagias, C<< <dkechag at cpan.org> >>
418  
419 =head1 BUGS
420  
421 Please report any bugs or feature requests either on L<GitHub|https://github.com/dkechag/NOAA-Aurora> (preferred), or on RT (via the email
422 C<bug-noaa-aurora at rt.cpan.org> or L<web interface|https://rt.cpan.org/NoAuth/ReportBug.html?Queue=NOAA-Aurora>).
423  
424 =head1 GIT
425  
426 L<https://github.com/dkechag/NOAA-Aurora>
427  
428 =head1 LICENSE AND COPYRIGHT
429  
430 This software is copyright (c) 2025 by Dimitrios Kechagias.
431  
432 This is free software; you can redistribute it and/or modify it under
433 the same terms as the Perl 5 programming language system itself.
434  
435 =cut
436  
437 3 1;
↑ Summary