Astro::Montenbruck::RiseSet::Sunset — rise and set.
use Astro::Montenbruck::MathUtils qw/frac/; use Astro::Montenbruck::RiseSet::Constants qw/:events :altitudes/; use Astro::Montenbruck::RiseSet::Sunset qw/:riseset/; riseset( date => [1989, 3, 23], phi => 48.1, lambda => -11.6, get_position => sub { my $jd = shift; # return equatorial coordinates of the celestial body for the Julian Day. }, sin_h0 => sin( deg2rad($H0_PLANET) ), on_event => sub { my ($evt, $ut) = @_; say "$evt: $ut"; }, on_noevent => sub { my $state = shift; say $state; } );
Version 0.01
Low level routines for calculating rise and set times of celestial bodies. Unlike Astro::Montenbruck::RiseSet::RST module, they are based on algorithms from the Montenbruck & Phleger book. They are especially usefull for calculating different types of twilight. Meeus's method is unsuitable for calculating astronomical twilight.
time of rise and set events.
get_position — function, which given Standard Julian Day, returns equatorial coordinates of the celestial body, in radians.
date — array of year (astronomical, zero-based), month [1..12] and day, [1..31].
phi — geographic latitude, degrees, positive northward
lambda —geographic longitude, degrees, positive westward
sin_h0 — sine of the standard altitude, i.e. the geometric altitude of the center of the body at the time of apparent rising or setting.
on_event callback is called when the event time is determined. The arguments are:
on_event
event type, one of $EVT_RISE or $EVT_SET
$EVT_RISE
$EVT_SET
Univerrsal time of the event
on_event => sub { my ($evt, $ut) = @_; ... }
on_noevent is called when the event does not happen at the given date, either because the body never rises, or is circumpolar. The argument is respectively $STATE_NEVER_RISES or $STATE_CIRCUMPOLAR.
on_noevent
$STATE_NEVER_RISES
$STATE_CIRCUMPOLAR
on_noevent => sub { my $state = shift; ... }
Sergey Krushinsky, <krushi at cpan.org>
<krushi at cpan.org>
Copyright (C) 2010-2019 by Sergey Krushinsky
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Astro::Montenbruck, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Astro::Montenbruck
CPAN shell
perl -MCPAN -e shell install Astro::Montenbruck
For more information on module installation, please visit the detailed CPAN module installation guide.