Skip to content

Commit

Permalink
Track changes in Kelso data set names.
Browse files Browse the repository at this point in the history
He renamed the data sets for the Chinese and Russian ASAT test debris.
The old names are retained as synonyms. The data supporting the synonyms
etc got refactired from the test into Astro::SpaceTrack so I could
display the notes in names->( 'celestrak' )
  • Loading branch information
trwyant committed Apr 26, 2024
1 parent de2f078 commit 94bb874
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 31 deletions.
60 changes: 42 additions & 18 deletions lib/Astro/SpaceTrack.pm
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,29 @@ my %catalogs = ( # Catalog names (and other info) for each source.
oneweb => { name => 'OneWeb' },
swarm => { name => 'Swarm' },
gnss => { name => 'GNSS navigational satellites' },
'1982-092' => { name => 'Russian ASAT Test Debris (COSMOS 1408)' },
'1999-025' => { name => 'Fengyun 1C debris' },
'1982-092' => {
name => 'Russian ASAT Test Debris (COSMOS 1408)',
note => q/'cosmos-1408-debris' as of April 26 2024/,
ignore => 1, # Ignore in xt/author/celestrak_datasets.t
},
'cosmos-1408-debris' => {
name => 'Russian ASAT Test Debris (COSMOS 1408)',
},
'1999-025' => {
name => 'Fengyun 1C debris',
note => q/'fengyun-1c-debris' as of April 26 2024/,
ignore => 1, # Ignore in xt/author/celestrak_datasets.t
},
'fengyun-1c-debris' => {
name => 'Fengyun 1C debris',
},
'cosmos-2251-debris' => { name => 'Cosmos 2251 debris' },
'iridium-33-debris' => { name => 'Iridium 33 debris' },
'2012-044' => { name => 'BREEZE-M R/B Breakup (2012-044C)' },
'2012-044' => {
name => 'BREEZE-M R/B Breakup (2012-044C)',
note => 'Fetchable as of November 16 2021, but not on web page',
ignore => 1, # Ignore in xt/author/celestrak_datasets.t
},
# Removed 2022-05-12
# '2019-006' => { name => 'Indian ASAT Test Debris' },
},
Expand Down Expand Up @@ -342,12 +360,13 @@ my %catalogs = ( # Catalog names (and other info) for each source.
rms => 1,
match => 1,
},
ses => {
name => 'SES',
# source => 'SES-11P',
rms => 1,
match => 1,
},
# Removed 2024-04-26
#ses => {
# name => 'SES',
# # source => 'SES-11P',
# rms => 1,
# match => 1,
#},
telesat => {
name => 'Telesat',
# source => 'Telesat-E',
Expand Down Expand Up @@ -1092,14 +1111,17 @@ There are no arguments.
}
}

# Given a catalog name, return the catalog, which MUST NOT be modified.
# UNSUPPORTED AND SUBJECT TO CHANGE OR REMOVAL WITHOUT NOTICE!
# If you have a use for this information, please let me know and I will
# see about putting together something I believe I can support.
sub __catalog {
my ( undef, $name ) = @_;
$catalogs{$name}
or Carp::confess "Bug - catalog $name does not exist";
return $catalogs{$name};
my ( $self, $name ) = @_;
$name = lc $name;
my $src = $catalogs{$name};
$name eq 'spacetrack'
and $src = $src->[ $self->getv( 'space_track_version' ) ];
return $src;
}

=for html <a name="celestrak"></a>
Expand Down Expand Up @@ -2983,26 +3005,28 @@ since all it is doing is returning data kept by this module.

sub names {
my ( $self, $name ) = @_;
$name = lc $name;
delete $self->{_pragmata};

$catalogs{$name} or return HTTP::Response->new(
my $src = $self->__catalog( $name )
or return HTTP::Response->new(
HTTP_NOT_FOUND, "Data source '$name' not found.");
my $src = $catalogs{$name};
$name eq 'spacetrack'
and $src = $src->[ $self->getv( 'space_track_version' ) ];

my @list;
foreach my $cat (sort keys %$src) {
push @list, defined ($src->{$cat}{number}) ?
"$cat ($src->{$cat}{number}): $src->{$cat}{name}\n" :
"$cat: $src->{$cat}{name}\n";
defined $src->{$cat}{note}
and $list[-1] .= " $src->{$cat}{note}\n";
}
my $resp = HTTP::Response->new (HTTP_OK, undef, undef, join ('', @list));
return $resp unless wantarray;
@list = ();
foreach my $cat (sort {$src->{$a}{name} cmp $src->{$b}{name}}
keys %$src) {
push @list, [$src->{$cat}{name}, $cat];
defined $src->{$cat}{note}
and push @{ $list[-1] }, $src->{$cat}{note};
}
return ($resp, \@list);
}
Expand Down
20 changes: 7 additions & 13 deletions xt/author/celestrak_datasets.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ my %got = parse_string( $rslt->content(), source => 'celestrak' );

my $st = Astro::SpaceTrack->new();

(undef, my $names) = $st->names( 'celestrak' );
my %expect;
foreach (@$names) {
$expect{$_->[1]} = {
name => $_->[0],
ignore => 0,
};
}
my %expect = %{ $st->__catalog( 'celestrak' ) };

=begin comment
Expand Down Expand Up @@ -59,28 +52,29 @@ $expect{'2019-006'} = {
};
# Removed October 23, 2008
$expect{'usa-193-debris'} = {
name => 'USA 193 Debris',
note => 'Not actually provided as a fetchable data set.',
ignore => 1,
};
=end comment
=cut

# Keys relocated to Astro::SpaceTrack April 26 2024.
$expect{'2012-044'} = {
name => 'BREEZE-M R/B Breakup (2012-044C)',
note => 'Fetchable as of November 16 2021, but not on web page',
ignore => 1,
};
# Removed April 26 2024
if ($expect{sts}) {
$expect{sts}{note} = 'Only available when a mission is in progress.';
$expect{sts}{ignore} = 1; # What it says.
}
=end comment
=cut

foreach my $key (sort keys %expect) {
if ($expect{$key}{ignore}) {
my $presence = delete $got{$key} ? 'present' : 'not present';
Expand Down

0 comments on commit 94bb874

Please sign in to comment.