better-suncalc
Version:
A tiny TypeScript library for calculating sun/moon positions and phases.
78 lines • 2.7 kB
TypeScript
/**
* Represents the moon's position and related parameters at a specific time and location.
*/
export type MoonPositionData = {
/** Azimuth angle in radians (clockwise from true north) */
azimuth: number;
/** Altitude angle in radians above horizon (includes atmospheric refraction correction) */
altitude: number;
/** Distance to moon in kilometers */
distance: number;
/** Parallactic angle - angle between moon position and local zenith,
* useful for lunar observations and photography (radians)
*/
parallacticAngle: number;
};
/**
* Describes the moon's illumination phase and visibility.
*/
export type MoonIlluminationData = {
/** Illuminated fraction (0 = new moon, 1 = full moon) */
fraction: number;
/** Moon phase (0-1):
* - 0 = New Moon
* - 0.25 = First Quarter
* - 0.5 = Full Moon
* - 0.75 = Last Quarter
*/
phase: number;
/** Angle of the illuminated terminator (radians, eastward from north) */
angle: number;
};
/**
* Moon rise/set times and visibility status.
*/
export type MoonTimesData = {
/** Moonrise time (if occurs on date) */
rise?: Date;
/** Moonset time (if occurs on date) */
set?: Date;
/** True if moon never sets (polar day) */
alwaysUp?: boolean;
/** True if moon never rises (polar day) */
alwaysDown?: boolean;
};
/**
* Calculates moon coordinates for a given number of days since J2000.
* @param d - Days since J2000 epoch.
* @returns Object containing moon's right ascension, declination, and distance.
*/
export declare function moonCoords(d: number): {
ra: number;
dec: number;
dist: number;
};
/**
* Calculates moon position for provided date and location.
* @param date - Date/time of observation.
* @param lat - Observer's latitude in degrees.
* @param lng - Observer's longitude in degrees.
* @returns Object containing moon position data.
*/
export declare function getMoonPosition(date: Date, lat: number, lng: number): MoonPositionData;
/**
* Calculates moon illumination parameters.
* @param date - Date/time of observation.
* @returns Object containing illumination data.
*/
export declare function getMoonIllumination(date: Date): MoonIlluminationData;
/**
* Calculates moon rise and set times for given date and location.
* @param date - Date of observation.
* @param lat - Observer's latitude in degrees.
* @param lng - Observer's longitude in degrees.
* @param inUTC - Whether to use UTC time.
* @returns Object containing moon times data.
*/
export declare function getMoonTimes(date: Date, lat: number, lng: number, inUTC: boolean): MoonTimesData;
//# sourceMappingURL=mooncalc.d.ts.map