The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Astro::Montenbruck::Lunation - Lunar quarters.

SYNOPSIS

  use Astro::Montenbruck::Lunation qw/:all/;

  # find instant of New Moon closest to 2019 Aug, 12
  $jd = search_event([2019, 8, 12], $NEW_MOON);
  # returns 2458696.63397517

  # find, which lunar phase corresponds to Moon longitude of 9.926
  # and Sun longitude of 316.527
  $phase = lunar_phase(moon => 9.926, sun => 316.527); 
  # returns 'Waxing Crescent'

DESCRIPTION

Searches lunar quarters. Algorithms are based on "Astronomy with your PC" by Peter Duffett-Smith, Second Edition, Cambridge University Press}, 1990.

EXPORT

CONSTANTS

PHASES

  • $NEW_MOON

  • $WAXING_CRESCENT

  • $FIRST_QUARTER

  • $WAXING_GIBBOUS

  • $FULL_MOON

  • $WANING_GIBBOUS

  • $LAST_QUARTER

  • $WANING_CRESCENT

SUBROUTINES

search_event(date => $arr, quarter => $scalar)

Calculate instant of apparent lunar phase closest to the given date.

Named Arguments

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

  • quarter — which quarter, one of: $NEW_MOON, $FIRST_QUARTER, $FULL_MOON or $LAST_QUARTER.

Returns

In scalar context returns Standard Julian day of the event, dynamic time.

In list context:

  • Standard Julian day of the event, dynamic time.

  • Argument of latitude, arc-degrees. This value is required for detecting elipses.

lunar_month($jd)

Find lunar quarters around the given date

Arguments

  • jd — Standard Julian date

Returns

Array of 5 hashes, each hash representing a successive lunar quarter. Their order is always the same:

  1. New Moon

  2. First Quarter

  3. Full Moon

  4. Last Quarter

4.

The next New Moon

Each hash contains 3 elements:

  • type

    One of the constants representing the main Quarter: $NEW_MOON, $FIRST_QUARTER, $FULL_MOON, $LAST_QUARTER.

  • jd

    Standard Julian Date of the event,

  • current

    True if the the given date lies within the quarter.

Example

    lunar_month(2459614.5) gives: 

    (
        {
            type => 'New Moon',
            jd => 2459611.74248269, # time when the quarter starts
            current => 1 # since 2459611.74248269 < 2459614.5 < 2459619.07819525, our date belongs to New Moon phase.
        },
        {
            type => 'First Quarter',
            current => 0,
            jd => 2459619.07819525
        },
        {
            type => 'Full Moon',
            current => 0,
            jd => 2459627.20811964
        },
        {
            current => 0,
            jd => 2459634.44073709'
            type => 'Last Quarter'
        },
        {
            current => 0,
            type => 'New Moon',
            jd => 2459641.23491532
        }
    );

lunar_phase(sun => $decimal, moon => $decimal)

Given Sun and Moon longitudes, detects a lunar phase.

Named Arguments

  • sun — longitude of the Sun, in arc-degrees

  • moon — longitude of the Moon, in arc-degrees =back

Returns

In scalar context the phase name, one of the PHASES.

In list context:

  • name of the phase.

  • Moon age in arc-degrees

  • Moon age in days

AUTHOR

Sergey Krushinsky, <krushi at cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2022 by Sergey Krushinsky

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

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 310:

You forgot a '=back' before '=head3'

Around line 334:

'=item' outside of any '=over'

Around line 405:

You forgot a '=back' before '=head3'