pub struct Astronomical;Expand description
The Astronomical struct provides functions which support astronomical calculations used by many observational calendars.
Implementations§
Source§impl Astronomical
 
impl Astronomical
Sourcepub fn ephemeris_correction(moment: Moment) -> f64
 
pub fn ephemeris_correction(moment: Moment) -> f64
Function for the ephemeris correction, which corrects the somewhat-unpredictable discrepancy between dynamical time and universal time
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus (1991) with data from NASA. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3884-L3952
Sourcepub fn dynamical_from_universal(universal: Moment) -> Moment
 
pub fn dynamical_from_universal(universal: Moment) -> Moment
Include the ephemeris correction to universal time, yielding dynamical time
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3850-L3853
Sourcepub fn universal_from_dynamical(dynamical: Moment) -> Moment
 
pub fn universal_from_dynamical(dynamical: Moment) -> Moment
Remove the ephemeris correction from dynamical time, yielding universal time
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3845-L3848
Sourcepub fn julian_centuries(moment: Moment) -> f64
 
pub fn julian_centuries(moment: Moment) -> f64
The number of uniform length centuries (36525 days measured in dynamical time) before or after noon on January 1, 2000
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3551-L3555
Sourcepub fn equation_of_time(moment: Moment) -> f64
 
pub fn equation_of_time(moment: Moment) -> f64
The equation of time, which approximates the difference between apparent solar time and mean time; for example, the difference between when the sun is highest in the sky (solar noon) and noon as measured by a clock adjusted to the local longitude. This varies throughout the year and the difference is given by the equation of time.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, p. 185. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3954-L3983
Sourcepub fn dusk(date: f64, location: Location, alpha: f64) -> Option<Moment>
 
pub fn dusk(date: f64, location: Location, alpha: f64) -> Option<Moment>
The standard time of dusk at a given location on a given date, or None if there is no
dusk on that date.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3670-L3679
Sourcepub fn obliquity(moment: Moment) -> f64
 
pub fn obliquity(moment: Moment) -> f64
Calculates the obliquity of the ecliptic at a given moment, meaning the angle of the Earth’s axial tilt with respect to the plane of its orbit around the sun (currently ~23.4 deg)
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3557-L3565
Sourcepub fn declination(moment: Moment, beta: f64, lambda: f64) -> f64
 
pub fn declination(moment: Moment, beta: f64, lambda: f64) -> f64
Calculates the declination at a given Moment of UTC time of an object at ecliptic latitude beta and ecliptic longitude lambda; all angles are in degrees.
the declination is the angular distance north or south of an object in the sky with respect to the plane
of the Earth’s equator; analogous to latitude.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3567-L3576
Sourcepub fn right_ascension(moment: Moment, beta: f64, lambda: f64) -> f64
 
pub fn right_ascension(moment: Moment, beta: f64, lambda: f64) -> f64
Calculates the right ascension at a given Moment of UTC time of an object at ecliptic latitude beta and ecliptic longitude lambda; all angles are in degrees.
the right ascension is the angular distance east or west of an object in the sky with respect to the plane
of the vernal equinox, which is the celestial coordinate point at which the ecliptic intersects the celestial
equator marking spring in the northern hemisphere; analogous to longitude.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3578-L3588
Sourcepub fn local_from_apparent(moment: Moment, location: Location) -> Moment
 
pub fn local_from_apparent(moment: Moment, location: Location) -> Moment
Local time from apparent solar time at a given location
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3521-L3524
Sourcepub fn approx_moment_of_depression(
    moment: Moment,
    location: Location,
    alpha: f64,
    early: bool,
) -> Option<Moment>
 
pub fn approx_moment_of_depression( moment: Moment, location: Location, alpha: f64, early: bool, ) -> Option<Moment>
Approx moment in local time near moment at which the depression angle of the sun is alpha (negative if
the sun is above the horizon) at the given location; since the same angle of depression of the sun
can exist twice in a day, early is set to true to specify the morning moment, and false for the
evening. Returns None if the specified angle is not reached.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3607-L3631
Sourcepub fn moment_of_depression(
    approx: Moment,
    location: Location,
    alpha: f64,
    early: bool,
) -> Option<Moment>
 
pub fn moment_of_depression( approx: Moment, location: Location, alpha: f64, early: bool, ) -> Option<Moment>
Moment in local time near approx at which the depression angle of the sun is alpha (negative if
the sun is above the horizon) at the given location; since the same angle of depression of the sun
can exist twice in a day, early is set to true to specify the morning moment, and false for the
evening. Returns None if the specified angle is not reached.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3633-L3647
Sourcepub fn refraction(location: Location) -> f64
 
pub fn refraction(location: Location) -> f64
The angle of refraction caused by Earth’s atmosphere at a given location.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3681-L3690
Sourcepub fn nth_new_moon(n: i32) -> Moment
 
pub fn nth_new_moon(n: i32) -> Moment
The moment (in universal time) of the nth new moon after (or before if n is negative) the new moon of January 11, 1 CE, which is the first new moon after R.D. 0.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, corrected 2nd edn., 2005. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4288-L4377
Sourcepub fn sidereal_from_moment(moment: Moment) -> f64
 
pub fn sidereal_from_moment(moment: Moment) -> f64
Sidereal time, as the hour angle between the meridian and the vernal equinox, from a given moment.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Meeus, 2nd edition (1988), p. 88. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3860-L3870
Sourcepub fn lunar_latitude(julian_centuries: f64) -> f64
 
pub fn lunar_latitude(julian_centuries: f64) -> f64
Ecliptic (aka celestial) latitude of the moon (in degrees)
This is not a geocentric or geodetic latitude, it does not take into account the rotation of the Earth and is instead measured from the ecliptic.
julian_centuries is the result of calling Self::julian_centuries(moment).
Based on functions from Calendrical Calculations by Reingold & Dershowitz,
originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, pp. 338-342.
Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4466
Sourcepub fn lunar_longitude(julian_centuries: f64) -> f64
 
pub fn lunar_longitude(julian_centuries: f64) -> f64
Ecliptic (aka celestial) longitude of the moon (in degrees)
This is not a geocentric or geodetic longitude, it does not take into account the rotation of the Earth and is instead measured from the ecliptic and the vernal equinox.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, pp. 338-342. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4215-L4278
Sourcefn mean_lunar_longitude(c: f64) -> f64
 
fn mean_lunar_longitude(c: f64) -> f64
Mean longitude of the moon (in degrees) at a given Moment in Julian centuries.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, pp. 336-340. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4148-L4158
Sourcepub fn phasis_on_or_after(
    date: RataDie,
    location: Location,
    lunar_phase: Option<f64>,
) -> RataDie
 
pub fn phasis_on_or_after( date: RataDie, location: Location, lunar_phase: Option<f64>, ) -> RataDie
Closest fixed date on or after date on the eve of which crescent moon first became visible at location.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L6883-L6896
Sourcepub fn phasis_on_or_before(
    date: RataDie,
    location: Location,
    lunar_phase: Option<f64>,
) -> RataDie
 
pub fn phasis_on_or_before( date: RataDie, location: Location, lunar_phase: Option<f64>, ) -> RataDie
Closest fixed date on or before date when crescent moon first became visible at location.
Lunar phase is the result of calling `lunar_phase(moment, julian_centuries) in an earlier function.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L6868-L6881
Sourcepub fn calculate_new_moon_at_or_before(date: RataDie) -> f64
 
pub fn calculate_new_moon_at_or_before(date: RataDie) -> f64
Calculate the day that the new moon occurred on or before the given date.
Sourcepub fn month_length(date: RataDie, location: Location) -> u8
 
pub fn month_length(date: RataDie, location: Location) -> u8
Length of the lunar month containing date in days, based on observability at location.
Calculates the month length for the Islamic Observational Calendar
Can return 31 days due to the imprecise nature of trying to approximate an observational calendar. (See page 294 of the Calendrical Calculations book)
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L7068-L7074
Sourcefn lunar_elongation(c: f64) -> f64
 
fn lunar_elongation(c: f64) -> f64
Lunar elongation (the moon’s angular distance east of the Sun) at a given Moment in Julian centuries
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, p. 338. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4160-L4170
Sourcepub fn lunar_altitude(moment: Moment, location: Location) -> f64
 
pub fn lunar_altitude(moment: Moment, location: Location) -> f64
Altitude of the moon (in degrees) at a given moment
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4537
Sourcepub fn lunar_distance(moment: Moment) -> f64
 
pub fn lunar_distance(moment: Moment) -> f64
Distance to the moon in meters at the given moment.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, pp. 338-342. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4568-L4617
Sourcepub fn lunar_parallax(lunar_altitude_val: f64, moment: Moment) -> f64
 
pub fn lunar_parallax(lunar_altitude_val: f64, moment: Moment) -> f64
The parallax of the moon, meaning the difference in angle of the direction of the moon
as measured from a given location and from the center of the Earth, in degrees.
Note: the location is encoded as the lunar_altitude_val which is the result of lunar_altitude(moment,location).
Based on functions from Calendrical Calculations by Reingold & Dershowitz,
originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998.
Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4619-L4628
Sourcefn topocentric_lunar_altitude(moment: Moment, location: Location) -> f64
 
fn topocentric_lunar_altitude(moment: Moment, location: Location) -> f64
Topocentric altitude of the moon.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4630-L4636
Sourcefn observed_lunar_altitude(moment: Moment, location: Location) -> f64
 
fn observed_lunar_altitude(moment: Moment, location: Location) -> f64
Observed altitude of upper limb of moon at moment at location. /// Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4646-L4653
Sourcefn solar_anomaly(c: f64) -> f64
 
fn solar_anomaly(c: f64) -> f64
Average anomaly of the sun (in degrees) at a given Moment in Julian centuries. See: https://en.wikipedia.org/wiki/Mean_anomaly
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, p. 338. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4172-L4182
Sourcefn lunar_anomaly(c: f64) -> f64
 
fn lunar_anomaly(c: f64) -> f64
Average anomaly of the moon (in degrees) at a given Moment in Julian centuries See: https://en.wikipedia.org/wiki/Mean_anomaly
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, p. 338. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4184-L4194
Sourcefn moon_node(c: f64) -> f64
 
fn moon_node(c: f64) -> f64
The moon’s argument of latitude, in degrees, at the moment given by c in Julian centuries.
The argument of latitude is used to define the position of a body moving in a Kepler orbit.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from Astronomical Algorithms by Jean Meeus, 2nd edn., 1998, p. 338. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4196-L4206
Sourcefn moonset(date: Moment, location: Location) -> Option<Moment>
 
fn moonset(date: Moment, location: Location) -> Option<Moment>
Standard time of moonset on the date of the given moment and at the given location.
Returns None if there is no such moonset.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4655-L4681
Sourcepub fn sunset(date: Moment, location: Location) -> Option<Moment>
 
pub fn sunset(date: Moment, location: Location) -> Option<Moment>
Standard time of sunset on the date of the given moment and at the given location.
Returns None if there is no such sunset.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3700-L3706
Sourcepub fn moonlag(date: Moment, location: Location) -> Option<f64>
 
pub fn moonlag(date: Moment, location: Location) -> Option<f64>
Time between sunset and moonset on the date of the given moment at the given location.
Returns None if there is no such sunset.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L6770-L6778
Sourcefn nutation(julian_centuries: f64) -> f64
 
fn nutation(julian_centuries: f64) -> f64
Longitudinal nutation (periodic variation in the inclination of the Earth’s axis) at a given Moment.
Argument comes from the result of calling Self::julian_centuries(moment) in an earlier function.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4037-L4047
Sourcepub fn lunar_phase(moment: Moment, julian_centuries: f64) -> f64
 
pub fn lunar_phase(moment: Moment, julian_centuries: f64) -> f64
The phase of the moon at a given Moment, defined as the difference in longitudes of the sun and the moon.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4397-L4414
Sourcepub fn lunar_phase_at_or_before(phase: f64, moment: Moment) -> Moment
 
pub fn lunar_phase_at_or_before(phase: f64, moment: Moment) -> Moment
Moment in universal time of the last time at or before the given moment when the lunar phase
was equal to the phase given.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4416-L4427
Sourcepub fn solar_longitude(julian_centuries: f64) -> f64
 
pub fn solar_longitude(julian_centuries: f64) -> f64
The longitude of the Sun at a given Moment in degrees.
Moment is not directly used but is enconded from the argument julian_centuries which is the result of calling Self::julian_centuries(moment) in an earlier function.
Based on functions from Calendrical Calculations by Reingold & Dershowitz, originally from “Planetary Programs and Tables from -4000 to +2800” by Bretagnon & Simon, 1986. Reference code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3985-L4035
Sourcefn simple_best_view(date: RataDie, location: Location) -> Moment
 
fn simple_best_view(date: RataDie, location: Location) -> Moment
The best viewing time (UT) in the evening for viewing the young moon from location on date. This is defined as
the time when the sun is 4.5 degrees below the horizon, or date + 1 if there is no such time.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L7337-L7346
Sourcefn arc_of_light(moment: Moment) -> f64
 
fn arc_of_light(moment: Moment) -> f64
Angular separation of the sun and moon at moment, for the purposes of determining the likely
visibility of the crescent moon.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L7284-L7290
Sourcepub fn shaukat_criterion(date: Moment, location: Location) -> bool
 
pub fn shaukat_criterion(date: Moment, location: Location) -> bool
Criterion for likely visibility of the crescent moon on the eve of date at location,
not intended for high altitudes or polar regions, as defined by S.K. Shaukat.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Reference lisp code: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L7306-L7317
Sourcepub fn visible_crescent(date: Moment, location: Location) -> bool
 
pub fn visible_crescent(date: Moment, location: Location) -> bool
Criterion for possible visibility of crescent moon on the eve of date at location;
currently, this calls shaukat_criterion, but this can be replaced with another implementation.
Sourcepub fn estimate_prior_solar_longitude(angle: f64, moment: Moment) -> Moment
 
pub fn estimate_prior_solar_longitude(angle: f64, moment: Moment) -> Moment
Given an angle and a Moment moment, approximate the Moment at or before moment
at which solar longitude exceeded the given angle.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4132-L4146
Sourcefn aberration(c: f64) -> f64
 
fn aberration(c: f64) -> f64
Aberration at the time given in Julian centuries. See: https://sceweb.sce.uhcl.edu/helm/WEB-Positional%20Astronomy/Tutorial/Aberration/Aberration.html
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4049-L4057
Sourcepub fn new_moon_before(moment: Moment) -> Moment
 
pub fn new_moon_before(moment: Moment) -> Moment
Find the time of the new moon preceding a given Moment (the last new moon before the moment)
Based on functions from Calendrical Calculations by Reingold & Dershowitz.
Most of the math performed in the equivalent book/lisp function is done in Self::num_of_new_moon_at_or_after.
Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4379-L4386
Sourcepub fn new_moon_at_or_after(moment: Moment) -> Moment
 
pub fn new_moon_at_or_after(moment: Moment) -> Moment
Find the time of the new moon following a given Moment (the first new moon before the moment)
Based on functions from Calendrical Calculations by Reingold & Dershowitz.
Most of the math performed in the equivalent book/lisp function is done in Self::num_of_new_moon_at_or_after.
Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4388-L4395
Sourcepub fn num_of_new_moon_at_or_after(moment: Moment) -> i32
 
pub fn num_of_new_moon_at_or_after(moment: Moment) -> i32
Function to find the number of the new moon at or after a given moment;
helper function for new_moon_before and new_moon_at_or_after.
Based on functions from Calendrical Calculations by Reingold & Dershowitz.
This function incorporates code from the book/lisp equivalent functions
of Self::new_moon_before and Self::new_moon_at_or_after.
Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4379-L4395
Sourcepub fn sine_offset(moment: Moment, location: Location, alpha: f64) -> f64
 
pub fn sine_offset(moment: Moment, location: Location, alpha: f64) -> f64
Sine of angle between the position of the sun at the given moment in local time and the moment
at which the angle of depression of the sun from the given location is equal to alpha.
Based on functions from Calendrical Calculations by Reingold & Dershowitz. Lisp code reference: https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3590-L3605