Astro-Coords
view release on metacpan or search on metacpan
lib/Astro/Coords/Planet.pm view on Meta::CPAN
=cut
sub array {
my $self = shift;
return ($self->planet, undef, undef,
undef, undef, undef, undef, undef, undef, undef, undef);
}
=item B<type>
Returns the generic type associated with the coordinate system.
For this class the answer is always "RADEC".
This is used to aid construction of summary tables when using
mixed coordinates.
It could be done using isa relationships.
=cut
sub type {
return "PLANET";
}
=item B<stringify>
Stringify overload. Simple returns the name of the planet
in capitals.
=cut
sub stringify {
my $self = shift;
return uc($self->planet());
}
=item B<summary>
Return a one line summary of the coordinates.
In the future will accept arguments to control output.
$summary = $c->summary();
=cut
sub summary {
my $self = shift;
my $name = $self->name;
$name = '' unless defined $name;
return sprintf("%-16s %-12s %-13s PLANET",$name,'','');
}
=item B<diam>
Returns the apparent angular planet diameter from the most recent calculation
of the apparent RA/Dec.
$diam = $c->diam();
Returns the answer as a C<Astro::Coords::Angle> object. Note that this
number is not updated automatically. (so don't change the time and expect
to get the correct answer without first asking for a ra/dec calculation).
=cut
sub diam {
my $self = shift;
if (@_) {
my $d = shift;
$self->{diam} = new Astro::Coords::Angle( $d, units => 'rad' );
}
return $self->{diam};
}
=item B<apparent>
Return the apparent RA and Dec as two C<Astro::Coords::Angle> objects for the current
coordinates and time.
($ra_app, $dec_app) = $self->apparent();
=cut
sub apparent {
my $self = shift;
my ($ra_app, $dec_app) = $self->_cache_read( "RA_APP", "DEC_APP" );
# Need to calculate it
if (!defined $ra_app || !defined $dec_app) {
my $tel = $self->telescope;
my $long = (defined $tel ? $tel->long : 0.0 );
my $lat = (defined $tel ? $tel->lat : 0.0 );
($ra_app, $dec_app, my $diam) = Astro::PAL::palRdplan($self->_mjd_tt, $PLANET{$self->planet},
$long, $lat );
# Store the diameter
$self->diam( $diam );
# Convert to angle objects
$ra_app = new Astro::Coords::Angle::Hour($ra_app, units => 'rad', range => '2PI');
$dec_app = new Astro::Coords::Angle($dec_app, units => 'rad');
# store in cache
$self->_cache_write( "RA_APP" => $ra_app, "DEC_APP" => $dec_app );
}
return ($ra_app, $dec_app);
}
=item B<rv>
Radial velocity of the planet relative to the Earth geocentre.
=cut
sub rv {
croak "Not yet implemented planetary radial velocities";
}
( run in 0.452 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )