Astro-satpass
view release on metacpan or search on metacpan
from Heliocentric coordinates.
* Add methods ecliptic_cartesian(), heliocentric_ecliptic(), and
heliocentric_ecliptic_cartesian().
* Consolidate code for conversion between Cartesian and spherical
coordinates.
In Astro::Coord::ECI::Set:
* Have the aggregate() method _not_ aggregate TLEs that have a blank
ID and model 'null'. This piece of ad-hocery was necessary to
prevent aggregation of "fake" TLEs representing different fixed
points in space (e.g. as created by the satpass or satpass2
'geodetic' command).
0.049 2012-03-12 T. R. Wyant
In the Astro::Coord::ECI precess_dynamical() method, set the time of
the station attribute (if any) before precessing it.
In Astro::Coord::ECI::TLE, throw an exception if the Sun never rises.
inc/My/Module/Recommend.pm view on Meta::CPAN
__any( 'Date::Manip' => <<'EOD'
This module is not required, but the alternative to installing it
is to specify times to the 'satpass' script in ISO 8601 format.
See 'SPECIFYING TIMES' in the 'satpass' documentation for the
details.
EOD
. ( $] < 5.010 ? <<'EOD' : '' ) ),
Unfortunately, the current Date::Manip requires Perl 5.10. Since
you are running an earlier Perl, you can try installing Date-Manip
5.54, which is the most recent version that does _not_ require
Perl 5.10.
EOD
__any( 'Geo::Coder::OSM' => <<'EOD' ),
This module is required for the 'satpass' script's 'geocode'
command, but is otherwise unused by this package. If you do not
intend to use this functionality, this module is not needed.
EOD
__any( 'Geo::WebService::Elevation::USGS' => <<'EOD' ),
This module is required for the 'satpass' script's 'height'
command, but is otherwise unused by this package. If you do not
inc/My/Module/Satpass.pm view on Meta::CPAN
use Cwd;
use File::Spec;
use Test;
# We may need IO::String for the test. If we do, make sure it
# is available. If it is not, skip everything.
my $gblskip = $] >= 5.008 && $Config{useperlio} ? '' :
not_available ('IO::String');
# We also need Date::Manip.
$gblskip ||= not_available ('Date::Manip');
# We also need the actual script.
my $script = File::Spec->catfile (qw{bin satpass});
$gblskip ||= -e $script ? '' : 'Can not find satpass script.';
# Initialize.
my $data = ''; # Test data;
inc/My/Module/Satpass.pm view on Meta::CPAN
# Set up the command arguments and 'do' the satpass script. All
# further work is done by tester() when the script calls it.
local @ARGV = ('-filter', -initialization_file => File::Spec->devnull ());
$skip = '';
do $script;
print $@ if $@;
return;
}
# not_available(module ...) is a utility to determine whether the
# given modules are available. If so, it loads them. If not, it
# returns a message for the first module that can not be loaded.
sub not_available {
foreach my $module (@_) {
eval "require $module; 1"
or return "Module $module can not be loaded.";
}
return '';
}
# not_reachable($url ...) is a utilty to determine whether the given
# URLs are reachable. If so, it returns false. If not, it returns
# a suitable message. Makes use of LWP::UserAgent, so may return
# the results of not_available ('LWP::UserAgent').
sub not_reachable {
my @args = @_;
my $ok = not_available ('LWP::UserAgent');
return $ok if $ok;
my $ua = LWP::UserAgent->new ()
or return "Cannot instantiate LWP::UserAgent.\n$@";
foreach my $url (@args) {
my $resp = $ua->get ($url);
return $resp->status_line unless $resp->is_success;
}
return '';
}
inc/My/Module/Satpass.pm view on Meta::CPAN
# to determine the actual results of the test.
s/-result\b\s*//m and do {
# Perl::Critic does not like string evals, but it's the only
# way to execute arbitrary code out of the data.
$output = eval $_; ## no critic (ProhibitStringyEval)
die $@ if $@; next
};
# -skip evals the rest of the line, placing the output into the
# $skip variable. This will _not_ override any global
# considerations that force the whole shebang to be skipped.
s/-skip\b\s*//m and do {
# Perl::Critic does not like string evals, but it's the only
# way to execute arbitrary code out of the data.
$skip = eval $_; ## no critic (ProhibitStringyEval)
die $@ if $@; next
};
# -test actually performs the test. The rest of the line is an
lib/Astro/Coord/ECI.pm view on Meta::CPAN
print "Debug geodetic - ellipsoid ", Data::Dumper::Dumper( $elps );
};
# Calculate geodetic coordinates.
my ($phiprime, $lambda, $rho) = $self->geocentric;
my $r = $rho * cos ($phiprime);
my $b = $elps->{semimajor} * (1- $elps->{flattening});
my $a = $elps->{semimajor};
my $z = $rho * sin ($phiprime);
# The $b is _not_ a magic variable, since we are not inside
# any of the specialized blocks that make $b magic. Perl::Critic
# is simply confused.
$b = - $b ## no critic (RequireLocalizedPunctuationVars)
if $z < 0; # Per Borkowski, for southern hemisphere.
# The following algorithm is due to Kazimierz Borkowski's
# paper "Accurate Algorithms to Transform Geocentric to Geodetic
# Coordinates", from
# http://www.astro.uni.torun.pl/~kb/Papers/geod/Geod-BG.htm
lib/Astro/Coord/ECI/TLE.pm view on Meta::CPAN
functionality should be considered alpha code. That is to say, I may
need to change the way it behaves, especially in the matter of what is
an exception and what is not.
=cut
# What follows (down to, but not including, the 'end sgp4unit.for'
# comment) is the Fortran code from sgp4unit.for, translated into
# Perl by the custom for2pl script, with conversion specification
# sgp4unit.spec. No hand-edits have been applied. The preferred
# way to modify this code is to enhance for2pl (which is _not_
# included in the CPAN kit) or to modify sgp4unit.for (ditto),
# since that way further modifications can be easily incorporated
# into this module.
#
# Comments in the included file are those from the original
# Fortran unless preceded by '>>>>trw'. The latter are comments
# introduced by the conversion program to remove unwanted Fortran.
#
# IMPLEMENTATION NOTES:
#
xt/author/satpass_geocode.t view on Meta::CPAN
my $rslt = $ua->get ( $src );
$rslt->is_success()
or plan skip_all => "$src not reachable";
}
My::Module::Satpass::satpass( *DATA );
1;
__END__
## -skip not_available ('Geo::Coder::OSM') || not_reachable ('http://rpc.geocoder.us/')
set country us
set autoheight 0
geocode '1600 Pennsylvania Ave NW, Washington DC'
-data <<eod
set location '1600 Pennsylvania Ave NW, Washington DC'
set latitude 38.897700
set longitude -77.036553
eod
-test geocode U.S. location via OSM
# BELOW HERE NOT TESTED BECAUSE GEOCODER.CA REQUIRES REGISTRATION FOR
# THEIR FREE PORT.
-end
-skip not_available ('XML::Parser') || not_reachable ('http://rpc.geocoder.ca/')
set country ca
set autoheight 0
geocode '80 Wellington Street, Ottawa ON'
-data <<eod
set location '80 Wellington Street, Ottawa ON'
set latitude 45.423388
set longitude -75.697786
eod
-test geocode Canadian location via http://rpc.geocoder.ca/
( run in 0.541 second using v1.01-cache-2.11-cpan-0a987023a57 )