NAME

Astro::Montenbruck::RiseSet — rise, set, transit.

SYNOPSIS

    use Astro::Montenbruck::Ephemeris::Planet qw/:ids/;
    use Astro::Montenbruck::MathUtils qw/frac/;
    use Astro::Montenbruck::RiseSet::Constants qw/:all/;
    use Astro::Montenbruck::RiseSet' qw/:all/;

    # create function for calculating Moon events for Munich, Germany, on March 23, 1989.
    my $func = rst_event(
        planet => $MO,
        date   => [1989, 3, 23],
        phi    => 48.1,
        lambda => -11.6
    );

    # calculate Moon rise. Alternatively, use $EVT_SET for set, $EVT_TRANSIT for
    # transit as the first argument
    $func->(
        $EVT_RISE,
        on_event => sub {
            my $jd = shift; # Standard Julian date
            my $ut = frac(jd - 0.5) * 24; # UTC, 18.95 = 18h57m
        }
    );

    # calculate civil twilight
    twilight(
        date       => [1989, 3, 23],
        phi        => 48.1,
        lambda     => -11.6,
        on_event   => sub {
            my ($evt, $ut) = @_;
            say "$evt: $ut";
        },
        on_noevent => sub {
            my $state = shift;
            say $state;
        }
    );

VERSION

Version 0.01

DESCRIPTION

High level interface for calculating rise, set and transit times of celestial bodies, as well as twilight of different types.

To take into account parallax, refraction and apparent radius of the bodies, we use average corrections to geometric altitudes:

  • sunrise, sunset : -0°50'

  • moonrise, moonset : 0°8'

  • stars and planets : -0°34'

TWILIGHT

The library also calculates the times of the beginning of the morning twilight (dawn) and end of the evening twilight (dusk).

Twilight occurs when Earth's upper atmosphere scatters and reflects sunlight which illuminates the lower atmosphere. Astronomers define the three stages of twilight – civil, nautical, and astronomical – on the basis of the Sun's elevation which is the angle that the geometric center of the Sun makes with the horizon.

  • astronomical

    Sun altitude is -18° In the morning, the sky is completely dark before the onset of astronomical twilight, and in the evening, the sky becomes completely dark at the end of astronomical twilight. Any celestial bodies that can be viewed by the naked eye can be observed in the sky after the end of this phase.

  • nautical

    Sun altitude is -12°. This twilight period is less bright than civil twilight and artificial light is generally required for outdoor activities.

  • civil

    Sun altitude is -6°. Civil twilight is the brightest form of twilight. There is enough natural sunlight during this period that artificial light may not be required to carry out outdoor activities. Only the brightest celestial objects can be observed by the naked eye during this time.

EXPORT

FUNCTIONS

FUNCTIONS

rst_event( %args )

Returns function for calculating time of event. See "EVENT FUNCTION" in Astro::Montenbruck::RiseSet::RST .

Named Arguments

  • planet — celestial body identifier, one of constants defined in Astro::Montenbruck::Ephemeris::Planet.

  • date — array of year (astronomical, zero-based), month [1..12] and day, [1..31].

  • phi — geographical latitude, degrees, positive northward

  • lambda — geographical longitude, degrees, positive westward

twilight( %args )

Function for calculating twilight. See "TWILIGHT EVENT FUNCTION" below.

Named Arguments

  • type — type of twilight, $TWILIGHT_NAUTICAL, $TWILIGHT_ASTRO or $TWILIGHT_CIVIL, see "TYPES OF TWILIGHT" in Astro::Montenbruck::RiseSet::Constants.

  • date — array of year (astronomical, zero-based), month [1..12] and day, [1..31].

  • phi — geographical latitude, degrees, positive northward

  • lambda — geographical longitude, degrees, positive westward

  • on_event — callback called when the event time is determined. The arguments are:

  • on_noevent is called when the event never happens, either because the body never rises, or is circumpolar. The argument is respectively $STATE_NEVER_RISES or $STATE_CIRCUMPOLAR, see "STATES" in Astro::Montenbruck::RiseSet::Constants.

AUTHOR

Sergey Krushinsky, <krushi at cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010-2020 by Sergey Krushinsky

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.