Struct calendrical_calculations::astronomy::Astronomical

source ·
pub struct Astronomical;
Expand description

The Astronomical struct provides functions which support astronomical calculations used by many observational calendars.

Implementations§

source§

impl Astronomical

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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.

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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.

source

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

source

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

source

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

source

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

source

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

source

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

Trait Implementations§

source§

impl Debug for Astronomical

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.