blib/lib/NOAA/Aurora.pm

filter: Statementstmt 100% 138 / 138 Branchbran 94.8% 55 / 58 Conditioncond 87.8% 36 / 41 MC/DCmcdc 73.9% 17 / 23 Subroutinesub 100% 19 / 19 Podpod 100% 6 / 6 totaltotal 95.0% 271 / 285 CC 51 SCAR 17.9
CC
51
Cov
97%
_parse_geo
12.0
get_image
7.0
kp_to_g
7.0
CRAP 6.0
↑ 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.1';
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 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 In Perl hash mode, 0 probability locations will be ommitted from the response.
124  
125 The function caches the results (see constructor), so subsequent calls will not
126 require downloading and decoding.
127  
128 Optional parameters:
129  
130 =over 4
131  
132 =item * C<hash> : If true, will return Perl hash instead of JSON.
133  
134 =back
135  
136 =head2 C<get_forecast>
137  
138 my $forecast = $aurora->get_forecast(
139 format => $output?
140 );
141  
142 Retrieves NOAA's 3-day space forecast (preferred over the geomagnetic forecast due
143 to more frequent / twice daily update) and by default returns an arrayref of hashes:
144  
145 [{time => $timestamp, kp => $kp_value},...]
146  
147 The timestamp will be at the start of the 3h time range NOAA returns.
148  
149 Optional parameters:
150  
151 =over 4
152  
153 =item * C<format> : If C<'text'> is specified as the format, raw text output will be returned
154 instead of an array with the timeseries.
155  
156 =back
157  
158 =head2 C<get_outlook>
159  
160 my $outlook = $aurora->get_outlook(
161 format => $output?
162 );
163  
164 Retrieves NOAA's 27-day outlook with the forecasted daily values for the 10.7cm Solar
165 radio flux, the Planetary A Index and the largest Kp index. By default returns an
166 arrayref of hashes:
167  
168 [
169 {
170 time => $timestamp,
171 flux => $flux_value,
172 ap => $a_index,
173 kp => $max_kp_value
174 }, ...
175 ]
176  
177 =over 4
178  
179 =item * C<format> : If C<'text'> is specified as the format, raw text output will be returned
180 instead of an array with the timeseries.
181  
182 =back
183  
184 =head1 UTILITY FUNCTIONS
185  
186 =head2 C<kp_to_g>
187  
188 my $g_index = kp_to_g($kp_index);
189  
190 Pass the Kp index and get the G-Index (Geomagnetic storm from G1 to G5) or 0 if
191 the Kp is not indicative of a Geomagnetic Storm. Fractional kp is rounded half up
192 (e.g. kp >= 4.5 -> G1).
193  
194 =cut
195  
196 8 ▶sub new {
Subroutine new: called CC=6 SCAR=17.9
Pod documented
197 8 my ($class, %args) = @_;
198  
199 8 my $self = $class->SUPER::new(%args);
200  
201 8 $self->{data} = {};
202 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
203 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
204 8 $self->{swpc} =~ s#^http(?:s)?://##;
205 # Time delimiter for rfc/iso
206 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
207 8 ▶ $self->{td} = ' ' if $time_f eq 'rfc';
Branch: 1 branch
BranchTrueFalseTotal
if $time_f eq "rfc" 1 7 8
208 8 ▶ $self->{td} = 'T' if $time_f eq 'iso';
Branch: 1 branch
BranchTrueFalseTotal
if $time_f eq "iso" 1 7 8
209  
210 8 return $self;
211 }
212  
213 8 ▶sub get_image {
Subroutine get_image: called CC=7 SCAR=19.5
Pod documented
214 8 my $self = shift;
215 8 my %args = @_;
216 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
217  
218 8 ▶ my $h = $args{hem} =~ /^s/i ? 'south' : 'north';
Branch: 1 branch
BranchTrueFalseTotal
$args{'hem'} =~ /^s/i ? : 2 6 8
219 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
220 $h,
221 $self->_get_output(
222 $self->_get_ua(
223 "$self->{swpc}/images/animations/ovation/$h/latest.jpg"
224 )
225 )
226 );
227  
228 8 ▶ if ($args{output}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"output"}) 1 7 8
229 1 ▶ open(my $fh, '>:raw', $args{output}) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">:raw", $args{"output"} or die $! 1 0 1
230 1 print $fh $data;
231 1 close($fh);
232 }
233  
234 8 return $data;
235 }
236  
237 8 ▶sub get_probability {
Subroutine get_probability: called CC=6 SCAR=17.9
Pod documented
238 8 my $self = shift;
239 8 my %args = @_;
240  
241 8 my ($json, $hash) = $self->_get_probabilities;
242  
243 8 ▶ if (defined $args{lat} && defined $args{lon}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"lat"} and defined $args{"lon"}) 6 2 8
Condition66%2/3
defined $args{"lat"} and defined $args{"lon"}
!ll&&!rl&&r
206
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
244 6 $args{$_} = sprintf("%.0f", $args{$_}) for qw/lat lon/;
245 6 Weather::API::Base::_verify_lat_lon(\%args);
246 4 ▶ return $hash->{$args{lon}}->{$args{lat}} || 0;
Condition100%2/2
$$hash{$args{'lon'}}{$args{'lat'}} || 0
l!l
31
MC/DC100%1/1
$$hash{$args{'lon'}}{$args{'lat'}} || 0
$$hash{$args{'lon'}}{$args{'lat'}}
Truth table100%2/2
A
A= $$hash{$args{'lon'}}{$args{'lat'}}
Aresult
11
00
247 }
248  
249 2 ▶ return $args{hash} ? $hash : $json;
Branch: 1 branch
BranchTrueFalseTotal
$args{'hash'} ? : 1 1 2
250 }
251  
252 8 ▶sub _get_text_source {
Subroutine _get_text_source: called CC=4 SCAR=13.9
253 8 my $self = shift;
254 8 my $source = shift;
255 8 my %args = @_;
256 8 my $url = "$self->{swpc}/text/$source.txt";
257 8 my $resp = $self->_get_ua($url);
258 8 my $content = $resp->decoded_content;
259  
260 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
261  
262 6 ▶ return $source eq '3-day-forecast'
Branch: 1 branch
BranchTrueFalseTotal
$source eq '3-day-forecast' ? : 3 3 6
263 ? $self->_parse_geo($content)
264 : $self->_parse_outlook($content);
265 }
266  
267 4 ▶sub get_forecast {
Subroutine get_forecast: called CC=1 SCAR=0.0
Pod documented
268 4 my $self = shift;
269 4 return $self->_get_text_source('3-day-forecast', @_);
270 }
271  
272 4 ▶sub get_outlook {
Subroutine get_outlook: called CC=1 SCAR=0.0
Pod documented
273 4 my $self = shift;
274 4 return $self->_get_text_source('27-day-outlook', @_);
275 }
276  
277 7 ▶sub kp_to_g {
Subroutine kp_to_g: called CC=7 SCAR=19.5
Pod documented
278 7 my $kp = shift;
279 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
280 6 ▶ return 'G1' if $kp < 5.5;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < "5.5" 1 5 6
281 5 ▶ return 'G2' if $kp < 6.5;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < "6.5" 1 4 5
282 4 ▶ return 'G3' if $kp < 7.5;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < "7.5" 1 3 4
283 3 ▶ return 'G4' if $kp < 9;
Branch: 1 branch
BranchTrueFalseTotal
if $kp < 9 2 1 3
284 1 return 'G5';
285 }
286  
287 8 ▶sub _get_probabilities {
Subroutine _get_probabilities: called CC=3 SCAR=11.0
288 8 my $self = shift;
289 8 my $json = $self->_get_cache('json');
290 8 my $hash = $self->_get_cache('hash');
291 8 ▶ return ($json, $hash) if $json && $hash;
Branch: 1 branch
BranchTrueFalseTotal
if $json and $hash 6 2 8
Condition66%2/3
$json and $hash
!ll&&!rl&&r
206
MC/DC50%1/2
$json and $hash
$json $hash
Truth table66%2/3
A and B
A= $jsonB= $hash
ABresult
0X0
100
111
292 2 return $self->_refresh_probability;
293 }
294  
295 2 ▶sub _refresh_probability {
Subroutine _refresh_probability: called CC=3 SCAR=11.0
296 2 my $self = shift;
297 2 my $resp = $self->_get_ua("$self->{swpc}/json/ovation_aurora_latest.json");
298 2 my $json = $resp->decoded_content;
299 2 my %raw = $self->_get_output($resp, 1);
300 2 $self->_set_cache('json', $json);
301 2 my %hash;
302 2 foreach (@{$raw{coordinates}}) {
303 65162 ▶ $hash{$_->[0]}->{$_->[1]} = $_->[2] if $_->[2];
Branch: 1 branch
BranchTrueFalseTotal
if $_->[2] 18313 46849 65162
304 }
305 2 $self->_set_cache('hash', \%hash);
306 2 return ($json, \%hash);
307 }
308  
309 24 ▶sub _get_cache {
Subroutine _get_cache: called CC=4 SCAR=13.9
310 24 my $self = shift;
311 24 my $key = shift;
312  
313 return
314 unless $self->{cache} && $self->{data}->{$key}
315 24 ▶ && (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 14 24
Condition83%5/6
$self->{"cache"} and $self->{"data"}{$key} and time - $self->{"data"}{$key}{"ts"} <= $self->{"cache"}
!ll&&!rl&&r
10014
$self->{"cache"} and $self->{"data"}{$key}
!ll&&!rl&&r
3714
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
316  
317 14 return $self->{data}->{$key}->{data};
318 }
319  
320 10 ▶sub _set_cache {
Subroutine _set_cache: called CC=1 SCAR=0.0
321 10 my $self = shift;
322 10 my $key = shift;
323 10 my $data = shift;
324  
325 10 $self->{data}->{$key}->{ts} = time();
326 10 $self->{data}->{$key}->{data} = $data;
327  
328 10 return $data;
329 }
330  
331 # Parse from last day to first, passing ref_month being the last month processed
332 6 ▶sub _parse_mon_day {
Subroutine _parse_mon_day: called CC=4 SCAR=13.9
333 6 my ($date, $ref_year, $ref_mon) = @_;
334 6 my ($mon, $day) = split /\s+/, $date;
335 6 $mon = mon_to_num($mon);
336  
337 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
338 6 $date = sprintf("%d-%02d-%02d", $ref_year, $mon, $day);
339  
340 6 ▶ return wantarray ? ($date, $mon) : $date;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 4 6
341 }
342  
343 3 ▶sub _parse_geo {
Subroutine _parse_geo: called CC=12 SCAR=24.9
344 3 my ($self, $data) = @_;
345 3 my @lines = split /\n/, $data;
346 3 my $g = qr/(?:\(G\d\)\s+)?/;
347
348 # Find year in the "NOAA Kp index breakdown" or "breakdown" line
349 3 my $year;
350 3 ▶ while (defined(my $line = shift @lines)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = shift @lines)) 26 1 27
351 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
352 2 $year = $1;
353 2 last;
354 }
355 }
356  
357 3 ▶ return [] unless $year;
Branch: 1 branch
BranchTrueFalseTotal
unless $year 1 2 3
358  
359 # Date headers
360 2 my @dates;
361 2 ▶ while (defined(my $line = shift @lines)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = shift @lines)) 4 0 4
362 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
363 2 my ($dt3, $ref_mon) = _parse_mon_day($3, $year);
364 2 @dates = map {scalar _parse_mon_day($_, $year, $ref_mon)} ($1, $2);
365 2 push @dates, $dt3;
366 2 last;
367 }
368 }
369  
370 2 ▶ return [] unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 2 2
371  
372 2 my %kp_data;
373 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
374 2 foreach my $line (@lines) {
375 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
376 16 my ($t, @kp) = ($1, $2, $3, $4);
377 16 my @times = map {"$_$td$t:00:00Z"} @dates;
378 16 ▶ @times = map {datetime_to_ts($_)} @times unless $self->{td};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"td"} 8 8 16
379 16 $kp_data{$times[$_]} = $kp[$_] for 0..2;
380 }
381 }
382  
383 2 my @result = map {{time => $_, kp => $kp_data{$_}}} sort keys %kp_data;
384 2 return \@result;
385 }
386  
387 3 ▶sub _parse_outlook {
Subroutine _parse_outlook: called CC=5 SCAR=16.1
388 3 my ($self, $data) = @_;
389 3 my @lines = split /\n/, $data;
390 3 my @result;
391  
392 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
393 3 foreach my $line (@lines) {
394 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
395 54 my ($year, $mon_str, $day, $flux, $ap, $kp) = ($1, $2, $3, $4, $5, $6);
396 54 my $mnum = mon_to_num($mon_str);
397
398 54 my $dt = sprintf("$year-%02d-%02d${td}00:00:00Z", $mnum, $day);
399 54 ▶ my $ts = $self->{td} ? $dt : datetime_to_ts($dt);
Branch: 1 branch
BranchTrueFalseTotal
$self->{'td'} ? : 27 27 54
400
401 54 push @result, {
402 time => $ts,
403 flux => $flux,
404 ap => $ap,
405 kp => $kp,
406 };
407 }
408 }
409 3 return \@result;
410 }
411  
412 =head1 AUTHOR
413  
414 Dimitrios Kechagias, C<< <dkechag at cpan.org> >>
415  
416 =head1 BUGS
417  
418 Please report any bugs or feature requests either on L<GitHub|https://github.com/dkechag/NOAA-Aurora> (preferred), or on RT (via the email
419 C<bug-noaa-aurora at rt.cpan.org> or L<web interface|https://rt.cpan.org/NoAuth/ReportBug.html?Queue=NOAA-Aurora>).
420  
421 =head1 GIT
422  
423 L<https://github.com/dkechag/NOAA-Aurora>
424  
425 =head1 LICENSE AND COPYRIGHT
426  
427 This software is copyright (c) 2025 by Dimitrios Kechagias.
428  
429 This is free software; you can redistribute it and/or modify it under
430 the same terms as the Perl 5 programming language system itself.
431  
432 =cut
433  
434 3 1;
↑ Summary