UNPKG

@observerly/astrometry

Version:

observerly's lightweight, zero-dependency, type safe astrometry library written in Typescript for calculating the position of celestial objects in the sky.

265 lines (264 loc) 7.28 kB
/*****************************************************************************************************************/ /*****************************************************************************************************************/ import type { EquatorialCoordinate, GeographicCoordinate, HorizontalCoordinate, Interval } from './common'; /*****************************************************************************************************************/ /** * The different types of lunar and solar eclipses. * * @readonly * @enum {string} * */ export declare enum EclipseType { /** * * @member {string} Penumbral * * A lunar eclipse in which only the Earth's penumbra falls on the Moon. * */ Penumbral = "penumbral", /** * * @member {string} Partial * * A partial lunar/solar eclipse. * */ Partial = "partial", /** * * @member {string} Annular * * A solar eclipse in which the entire Moon is visible against the Sun, * but the Sun appears as a ring around the Moon. * * N.B. Never used for a lunar eclipse. * */ Annular = "annular", /** * * @member {string} Total * * A total lunar/solar eclipse. * */ Total = "total", /** * * @member {string} AnnularTotal * * * N.B. Never used for a lunar eclipse. * */ AnnularTotal = "annular-total" } /*****************************************************************************************************************/ /** * * A representation of a lunar or solar eclipse. * */ export type Eclipse = { /** * * @member {enum} EclipseType * * The type of the eclipse, e.g., "total", "annular", "partial", or "penumbral". * */ type: EclipseType; /** * * * @member {Interval} interval * * When the eclipse begins and ends for a particular observer. * */ interval?: Interval; /** * * @member {Date} maximum * * When the maximum of the eclipse occurs. * */ maximum: Date; /** * * @member {number} magnitude * * The magnitude of the eclipse (the fraction of the Sun's diameter obscured by the Moon, or vice versa). * */ magnitude?: number; /** * * * There exists a line of central eclipse on the Earth's surface, and for * observers on this line, the center of the Moon's shadow will pass directly * over the center of the Sun. This is known as a central eclipse. * */ isCentral: boolean; } & HorizontalCoordinate; /*****************************************************************************************************************/ /** * * getLunarEclipse() * * @param datetime - The date and time to calculate the lunar eclipse for. * @param observer - The geographic coordinates of the observer. * @returns - The lunar eclipse at the given date and time for the observer. */ export declare const getLunarEclipse: (datetime: Date, observer: GeographicCoordinate) => false | ({ /** * * @member {enum} EclipseType * * The type of the eclipse, e.g., "total", "annular", "partial", or "penumbral". * */ type: EclipseType; /** * * * @member {Interval} interval * * When the eclipse begins and ends for a particular observer. * */ interval?: Interval | undefined; /** * * @member {Date} maximum * * When the maximum of the eclipse occurs. * */ maximum: Date; /** * * @member {number} magnitude * * The magnitude of the eclipse (the fraction of the Sun's diameter obscured by the Moon, or vice versa). * */ magnitude?: number | undefined; /** * * * There exists a line of central eclipse on the Earth's surface, and for * observers on this line, the center of the Moon's shadow will pass directly * over the center of the Sun. This is known as a central eclipse. * */ isCentral: boolean; } & HorizontalCoordinate & EquatorialCoordinate & { k: number; JD: number; F: number; Ω: number; γ: number; u: number; ρ: number; σ: number; }); /*****************************************************************************************************************/ /** * * getSolarEclipse() * * @param datetime - The date and time to calculate the solar eclipse for. * @param observer - The geographic coordinates of the observer. * @returns The solar eclipse at the given date and time for the observer. */ export declare const getSolarEclipse: (datetime: Date, observer: GeographicCoordinate) => false | ({ /** * * @member {enum} EclipseType * * The type of the eclipse, e.g., "total", "annular", "partial", or "penumbral". * */ type: EclipseType; /** * * * @member {Interval} interval * * When the eclipse begins and ends for a particular observer. * */ interval?: Interval | undefined; /** * * @member {Date} maximum * * When the maximum of the eclipse occurs. * */ maximum: Date; /** * * @member {number} magnitude * * The magnitude of the eclipse (the fraction of the Sun's diameter obscured by the Moon, or vice versa). * */ magnitude?: number | undefined; /** * * * There exists a line of central eclipse on the Earth's surface, and for * observers on this line, the center of the Moon's shadow will pass directly * over the center of the Sun. This is known as a central eclipse. * */ isCentral: boolean; } & HorizontalCoordinate & EquatorialCoordinate & { k: number; JD: number; F: number; Ω: number; γ: number; u: number; }); /*****************************************************************************************************************/ /** * * isLunarEclipse() * * @param datetime - The date and time to calculate the lunar eclipse for. * @param observer - The geographic coordinates of the observer. * @returns The lunar eclipse at the given date and time for the observer or false if no eclipse occurs. * */ export declare const isLunarEclipse: (datetime: Date, observer: GeographicCoordinate) => (Eclipse & EquatorialCoordinate & { k: number; F: number; Ω: number; γ: number; u: number; }) | false; /*****************************************************************************************************************/ /** * * isSolarEclipse() * * @param datetime - The date and time to calculate the solar eclipse for. * @param observer - The geographic coordinates of the observer. * @returns The solar eclipse at the given date and time for the observer or false if no eclipse occurs. * */ export declare const isSolarEclipse: (datetime: Date, observer: GeographicCoordinate) => (Eclipse & EquatorialCoordinate & { k: number; F: number; Ω: number; γ: number; u: number; }) | false; /*****************************************************************************************************************/