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.

193 lines (192 loc) 7.9 kB
/*****************************************************************************************************************/ /*****************************************************************************************************************/ import { type EquatorialCoordinate, type GeographicCoordinate, type HorizontalCoordinate } from './common'; /*****************************************************************************************************************/ export interface Parameters { Ar: number; H1: number; } /*****************************************************************************************************************/ export interface Transit { /** * * * The local sidereal time of rise. * * */ LSTr: number; /** * * * The local sidereal time of set. * * */ LSTs: number; /** * * * The azimuthal angle (in degrees) of the object at rise. * * */ R: number; /** * * * The azimuthal angle (in degrees) of the object at set. * * */ S: number; } /*****************************************************************************************************************/ export interface TransitInstance { /** * * * The date and time of rise or set. * * */ datetime: Date; /** * * * The local sidereal time of rise or set. * * */ LST: number; /** * * * The Greenwhich sidereal time of rise or set. * */ GST: number; /** * * * The local azimuthal angle (in degrees) of the object at rise or set. * */ az: number; } /*****************************************************************************************************************/ export declare const isTransitInstance: (value: unknown) => value is TransitInstance; /*****************************************************************************************************************/ /** * * isBodyCircumpolar() * * An object is considered circumpolar if it is always above the observer's horizon * and never sets. This is true when the object's declination is greater than 90 * degrees minus the observer's latitude. * * @param observer - The geographic coordinate of the observer. * @param target - The equatorial coordinate of the observed object. * @param horizon - The observer's horizon (in degrees). * @returns a boolean indicating whether the target is circumpolar. */ export declare const isBodyCircumpolar: (observer: GeographicCoordinate, target: EquatorialCoordinate, horizon?: number) => boolean; /*****************************************************************************************************************/ /** * * isBodyVisible() * * An object is visible if it is ever above the observer's horizon. This is true when * the object's declination is greater than the observer's latitude minus 90 degrees. * * @param observer - The geographic coordinate of the observer. * @param target - The equatorial coordinate of the observed object. * @param horizon - The observer's horizon (in degrees). * @returns a boolean indicating whether the target is ever visible for the observer. */ export declare const isBodyVisible: (observer: GeographicCoordinate, target: EquatorialCoordinate, horizon?: number) => boolean; /*****************************************************************************************************************/ /** * * isBodyAboveHorizon() * * An object is above the horizon if it is above the observer's horizon at the time of observation. * * @param datetime - The date and time of the observation. * @param observer - The geographic coordinate of the observer. * @param target - The equatorial or horizontal coordinate of the observed object. * @param horizon - The observer's horizon (in degrees). * @returns a boolean indicating whether the target is above the horizon for the observer's location and for the time of observation. * */ export declare const isBodyAboveHorizon: (datetime: Date, observer: GeographicCoordinate, target: EquatorialCoordinate | HorizontalCoordinate, horizon?: number) => boolean; /*****************************************************************************************************************/ /** * * doesBodyRiseOrSet() * * An object rises or sets if it is above the observer's horizon at the time of observation. * * @param observer - The geographic coordinate of the observer. * @param target - The equatorial or horizontal coordinate of the observed object. * @returns false if the object never rises or sets for the observer, otherwise returns the Ar and H1 transit parameters. * */ export declare const doesBodyRiseOrSet: (observer: GeographicCoordinate, target: EquatorialCoordinate) => false | Parameters; /*****************************************************************************************************************/ /** * * getBodyTransit() * * Determines the local sidereal time and azimuthal angle of rise and set for an object. * * @param observer - The geographic coordinate of the observer. * @param target - The equatorial or horizontal coordinate of the observed object. * @returns the transit for the body, or undefined if the body never rises or sets for the observer. * */ export declare const getBodyTransit: (observer: GeographicCoordinate, target: EquatorialCoordinate) => Transit | undefined; /*****************************************************************************************************************/ /** * * getBodyNextRise() * * Determines the next rise time for an object, if at all. * * @param date - The date to start searching for the next rise. * @param observer - The geographic coordinate of the observer. * @param target - The equatorial coordinate of the observed object. * @param horizon - The observer's horizon (in degrees). * @returns The next rise time or False if the object never rises, or True if the object is always above the horizon (circumpolar) for the observer. */ export declare const getBodyNextRise: (datetime: Date, observer: GeographicCoordinate, target: EquatorialCoordinate, horizon?: number) => TransitInstance | false; /*****************************************************************************************************************/ /** * * getBodyNextSet() * * Determines the next set time for an object, if at all. * * @param date - The date to start searching for the next set. * @param observer - The geographic coordinate of the observer. * @param target - The equatorial coordinate of the observed object. * @param horizon - The observer's horizon (in degrees). * @returns The next set time or False if the object never sets, or True if the object is always above the horizon (circumpolar) for the observer. */ export declare const getBodyNextSet: (datetime: Date, observer: GeographicCoordinate, target: EquatorialCoordinate, horizon?: number) => TransitInstance | boolean; /*****************************************************************************************************************/ /** * * isBodyVisibleForNight() * * Determines whether an object is visible at some point during the night. * * @param date - The date to start searching for the next set. * @param observer - The geographic coordinate of the observer. * @param target - The equatorial coordinate of the observed object. * @param horizon - The observer's horizon (in degrees). * @returns a boolean indicating whether the object is visible at some point during the night. * */ export declare const isBodyVisibleForNight: (datetime: Date, observer: GeographicCoordinate, target: EquatorialCoordinate, horizon?: number) => boolean; /*****************************************************************************************************************/