Astro-satpass
view release on metacpan or search on metacpan
#!/usr/local/bin/perl
# Display the next time the Sun reaches an arbitrary azimuth (passed in
# on the command line and defaulting to 180 degrees) from a
# pre-programmed location (Number 10 Downing Street, Westminster
# England).
use strict;
use warnings;
use Astro::Coord::ECI;
use Astro::Coord::ECI::Sun;
use Astro::Coord::ECI::Utils qw{ deg2rad rad2deg };
our $VERSION = '0.134';
my $time = time;
my $sta = Astro::Coord::ECI->new(
name => 'Number 10 Downing Street',
)->geodetic(
deg2rad( 51.503241 ), # Latitude
deg2rad( -0.127029 ), # Longitude
20 / 1000, # Altitude converted to kilometers
)->universal( $time );
my $azimuth = defined $ARGV[0] ? $ARGV[0] : 180;
my $sun = Astro::Coord::ECI::Sun->new( station => $sta );
my $when = $sun->next_azimuth(
deg2rad( $azimuth ), # The desired azimuth.
);
print 'The ', $sun->get( 'name' ),
" reaches azimuth $azimuth at ",
$sta->get( 'name' ), ' at ',
scalar gmtime $when, " (GMT)\n";
__END__
# ex: set textwidth=72 :
( run in 1.009 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )