-$fp = 0; # the DXLog fcb
-$date = 0; # the unix time of the WWV (notional)
-$sfi = 0; # the current SFI value
-$k = 0; # the current K value
-$a = 0; # the current A value
-$forecast = ""; # the current geomagnetic forecast
-$node = ""; # originating node
-$from = ""; # who this came from
-@allowed = (); # if present only these callsigns are regarded as valid WWV updators
-@denied = (); # if present ignore any wwv from these callsigns
+$fp = 0; # the DXLog fcb
+$date = 0; # the unix time of the WWV (notional)
+$sfi = 0; # the current SFI value
+$k = 0; # the current K value
+$a = 0; # the current A value
+$forecast = ""; # the current geomagnetic forecast
+$node = ""; # originating node
+$from = ""; # who this came from
+@allowed = (); # if present only these callsigns are regarded as valid WWV updators
+@denied = (); # if present ignore any wwv from these callsigns
my $dirprefix = "$main::data/wwv";
my $param = "$dirprefix/param";
sub init
{
$fp = DXLog::new('wwv', 'dat', 'm');
my $dirprefix = "$main::data/wwv";
my $param = "$dirprefix/param";
sub init
{
$fp = DXLog::new('wwv', 'dat', 'm');
- my $fh = new FileHandle;
- open $fh, "> $param" or confess "can't open $param $!";
- print $fh "# Geomagnetic data parameter file last mod:", scalar gmtime, "\n";
- print $fh "\$date = $date;\n";
- print $fh "\$sfi = $sfi;\n";
- print $fh "\$a = $a;\n";
- print $fh "\$k = $k;\n";
- print $fh "\$from = '$from';\n";
- print $fh "\$node = '$node';\n";
- print $fh "\@denied = qw(", join(' ', @denied), ");\n" if @denied > 0;
- print $fh "\@allowed = qw(", join(' ', @allowed), ");\n" if @allowed > 0;
- close $fh;
-
- # log it
- $fp->writeunix($date, "$from^$date^$sfi^$a^$k^$forecast^$node");
+ my $fh = new FileHandle;
+ open $fh, "> $param" or confess "can't open $param $!";
+ print $fh "# Geomagnetic data parameter file last mod:", scalar gmtime, "\n";
+ print $fh "\$date = $date;\n";
+ print $fh "\$sfi = $sfi;\n";
+ print $fh "\$a = $a;\n";
+ print $fh "\$k = $k;\n";
+ print $fh "\$from = '$from';\n";
+ print $fh "\$node = '$node';\n";
+ print $fh "\@denied = qw(", join(' ', @denied), ");\n" if @denied > 0;
+ print $fh "\@allowed = qw(", join(' ', @allowed), ");\n" if @allowed > 0;
+ close $fh;
+
+ # log it
+ $fp->writeunix($date, "$from^$date^$sfi^$a^$k^$forecast^$node");
- my ($mydate, $mytime, $mysfi, $mya, $myk, $myforecast, $myfrom, $mynode) = @_;
- if ((@allowed && grep {$_ eq $from} @allowed) ||
- (@denied && !grep {$_ eq $from} @denied) ||
- (@allowed == 0 && @denied == 0)) {
-
- my $trydate = cltounix($mydate, sprintf("%02d18Z", $mytime));
- if ($trydate >= $date) {
- $sfi = 0 + $mysfi;
- $k = 0 + $myk;
- $a = 0 + $mya;
- $forecast = $myforecast;
- $date = $trydate;
- $from = $myfrom;
- $node = $mynode;
-
- store();
+ my ($mydate, $mytime, $mysfi, $mya, $myk, $myforecast, $myfrom, $mynode) = @_;
+ if ((@allowed && grep {$_ eq $from} @allowed) ||
+ (@denied && !grep {$_ eq $from} @denied) ||
+ (@allowed == 0 && @denied == 0)) {
+
+ # my $trydate = cltounix($mydate, sprintf("%02d18Z", $mytime));
+ if ($mydate >= $date) {
+ $sfi = 0 + $mysfi;
+ $k = 0 + $myk;
+ $a = 0 + $mya;
+ $forecast = $myforecast;
+ $date = $mydate;
+ $from = $myfrom;
+ $node = $mynode;
+
+ store();
+ }
- my $flag = shift;
- if ($flag eq '+') {
- push @allowed, map {uc $_} @_;
- } else {
- my $c;
- foreach $c (@_) {
- @allowed = map {$_ ne uc $c} @allowed;
- }
- }
- store();
+ my $flag = shift;
+ if ($flag eq '+') {
+ push @allowed, map {uc $_} @_;
+ } else {
+ my $c;
+ foreach $c (@_) {
+ @allowed = map {$_ ne uc $c} @allowed;
+ }
+ }
+ store();
- my $flag = shift;
- if ($flag eq '+') {
- push @denied, map {uc $_} @_;
- } else {
- my $c;
- foreach $c (@_) {
- @denied = map {$_ ne uc $c} @denied;
- }
- }
- store();
+ my $flag = shift;
+ if ($flag eq '+') {
+ push @denied, map {uc $_} @_;
+ } else {
+ my $c;
+ foreach $c (@_) {
+ @denied = map {$_ ne uc $c} @denied;
+ }
+ }
+ store();
- next if \$count < $from;
- push \@out, print_item(\$ref);
- last LOOP if \$count >= \$to; # stop after n
+ next if \$count < \$from;
+ push \@out, \$ref;
+ last if \$count >= \$to; # stop after n
- $self->close; # close any open files
-
- my $fh = $self->open(@date);
-LOOP:
- while ($count < $to) {
- my @spots = ();
+ $fp->close; # close any open files
+
+ my $fh = $fp->open(@date);
+ for ($count = 0; $count < $to; ) {
+ my @in = ();
- eval $eval; # do the search on this file
- return ("Spot search error", $@) if $@;
+ eval $eval; # do the search on this file
+ return ("Geomag search error", $@) if $@;
+ last if $count >= $to; # stop after n
return sprintf("$d %02d %5d %3d %3d %-37s <%s>", $t, $ref[2], $ref[3], $ref[4], $ref[5], $ref[0]);
}
return sprintf("$d %02d %5d %3d %3d %-37s <%s>", $t, $ref[2], $ref[3], $ref[4], $ref[5], $ref[0]);
}
+#
+# read in this month's data
+#
+sub readfile
+{
+ my @date = $fp->unixtoj(shift);
+ my $fh = $fp->open(@date);
+ my @spots = ();
+ my @in;
+
+ if ($fh) {
+ while (<$fh>) {
+ chomp;
+ push @in, [ split '\^' ] if length > 2;
+ }
+ }
+ return @in;
+}