UNPKG

sweph

Version:

The definitive Swiss Ephemeris bindings for Node.js

2,164 lines (2,075 loc) 154 kB
/** * ## Sweph * Definitive Swiss Ephemeris bindings for Node.js * * [Official programmer's documentation for the Swiss Ephemeris](https://www.astro.com/swisseph/swephprg.htm) * [Official guide for the Swiss Ephemeris](https://www.astro.com/ftp/swisseph/doc/swisseph.htm) * [Sweph on GitHub](https://github.com/timotejroiko/sweph) * [Sweph on NPM](http://npmjs.com/package/sweph) * * ### Usage * ``` * const { utc_to_jd, calc, houses_ex2, constants, set_ephe_path } = require("sweph"); * // or import { utc_to_jd, calc, houses_ex2, constants, set_ephe_path } from "sweph"; * * set_ephe_path("./ephemeris"); // folder containing your ephemeris files; * * const date = utc_to_jd(2020, 1, 25, 15, 35, 0, constants.SE_GREG_CAL); // 25 Jan 2020, 15:35:00, gregorian calendar * if(date.flag !== constants.OK) { throw new Error(date.error); } * * const [ jd_et, jd_ut ] = date.data; // et for planets, ut for houses * const flags = constants.SEFLG_SWIEPH | constants.SEFLG_SPEED; // use the ephemeris files and enable speeds * const planets = calc(jd_et, constants.SE_SUN, flags); * if(planets.flag !== flags) { console.log(planets.error); } // if the flags are not the same then something went wrong * * const houses = houses_ex2(jd_ut, 0, 37, 54, "P"); // placidus houses on latitude 37 longitude 54 * if(houses.flag !== constants.OK) { console.log(houses.error) } // if flag is not equal to OK then something went wrong * * console.log(planets.data, houses.data) * ``` */ declare module "sweph" { export * as default from "sweph" /* ┌──────────────────────────────────────────────────┬────────────┬──────────────────────────────────────────────────┐ │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ Interfaces │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ └──────────────────────────────────────────────────┴────────────┴──────────────────────────────────────────────────┘ */ export interface Flag { /** * ### Description * Status flag returned by the function * Use it to check if the function succeeded, failed, or to check output type * ``` * ``` */ flag: number; } export interface Error { /** * ### Description * Error message * An error message will be available here when the flag indicates failure * ``` * ``` */ error: string; } export interface Name { /** * ### Description * Star name * The full star name as it appears in the sefstars.txt file * ``` * ``` */ name: string; } export interface GetCurrentFileData { /** * ### Description * Path to ephemeris file * ``` * ``` */ path: string; /** * ### Description * Ephemeris start date for this file * ``` * ``` */ start: number; /** * ### Description * Ephemeris end date for this file * ``` * ``` */ end: number; /** * ### Description * JPL ephemeris version used to generate the file * ``` * ``` */ denum: number; } export interface GetOrbitalElements extends Flag, Error { /** * ### Description * Array of orbital/kepler elements * ``` * ``` */ data: OrbitalElementsData; } export interface Calc extends Error, Flag { /** * ### Description * Array of values returned by the calculation * By default the values are in ecliptic coordinates (longitude, latitude, distance) * If `SEFLG_SPEED` or `SEFLG_SPEED3` are used, the daily speeds for each value are also retured, otherwise they are 0 * If `SEFLG_EQUATORIAL` is used, the values are in equatorial coordinates instead (right ascension, declination, distance) * If `SELFG_XYZ` is used, the values are in cartesian coordinates instead (X, Y, Z) * If target object ID is `SE_ECL_NUT`, then the values will contain obliquity and nutation data instead * ``` * ``` */ data: CalcData; } export interface DateConversion extends Flag { /** * ### Description * Julian day value * ``` * ``` */ data: number; } export interface DeltaT extends Error { /** * ### Description * Delta T value * ``` * ``` */ data: number; } export interface FixStar extends Flag, Name, Error { /** * ### Description * Array of values returned by the calculation * By default the values are in ecliptic coordinates (longitude, latitude, distance) * If `SEFLG_SPEED` or `SEFLG_SPEED3` are used, the daily speeds for each value are also retured, otherwise they are 0 * If `SEFLG_EQUATORIAL` is used, the values are in equatorial coordinates instead (right ascension, declination, distance) * If `SELFG_XYZ` is used, the values are in cartesian coordinates instead (X, Y, Z) * ``` * ``` */ data: CalcData2; } export interface FixStarMag extends Flag, Name, Error { /** * ### Description * Magnitude value * ``` * ``` */ data: number; } export interface GauquelinSector extends Flag, Error { /** * ### Description * Gauquelin Sector * ``` * ``` */ data: number; } export interface Ayanamsa extends Flag, Error { /** * ### Description * Ayanamsa Value * ``` * ``` */ data: number; } export interface HeliacalPheno extends Flag, Error { /** * ### Description * Array of values used by heliacal calculations * ``` * ``` */ data: HeliacalPhenoData; } export interface Heliacal extends Flag, Error { /** * ### Description * Event times of the heliacal phenomenon * ``` * ``` */ data: HeliacalData; } export interface HousePosition extends Error { /** * ### Description * House position including fraction * From 1.0 to 12.999999 for normal houses and 1.0 to 36.9999999 for gauquelin sectors * ``` * ``` */ data: number } export interface Houses<T> extends Flag { /** * ### Description * Calculated positions for the houses and other points * ``` * ``` */ data: HouseData<T> } export interface HousesEx<T> extends Flag, Error { /** * ### Description * Calculated positions for the houses and other points * Also includes momentary motion speeds * ``` * ``` */ data: HouseExData<T> } export interface HouseData<T> { /** * ### Description * Longitude positions for the houses * 36 houses for gauquelin sectors, 12 houses for all other systems * ``` * ``` */ houses: T extends 36 ? GauquelinHousesList : HousesList, /** * ### Description * Longitude positions for other points of interest in the great circles * ``` * ``` */ points: PointsList } export interface HouseExData<T> extends HouseData<T> { /** * ### Description * Momentary motion speeds of the houses * ``` * ``` */ housesSpeed: T extends 36 ? GauquelinHousesSpeeds : HousesSpeeds, /** * ### Description * Momentary motion speeds of other points of interest * ``` * ``` */ pointsSpeed: PointsSpeeds } export interface DateObject { /** * ### Description * Full year * ``` * ``` */ year: number; /** * ### Description * Month (1-12) * ``` * ``` */ month: number; /** * ### Description * Day (1-31) * ``` * ``` */ day: number; /** * ### Description * Hour including fraction (0-23.99999) * ``` * ``` */ hour: number; } export interface DateObject2 extends DateObject { /** * ### Description * Hour (0-23) * ``` * ``` */ hour: number; /** * ### Description * Minute (0-59) * ``` * ``` */ minute: number; /** * ### Description * Second including fraction (0-59.99999) * ``` * ``` */ second: number; } export interface LocalApparentTime extends Flag, Error { /** * ### Description * Local apparent time in julian day in universal time * ``` * ``` */ data: number } export interface LocalMeanTime extends Flag, Error { /** * ### Description * Local mean time in julian day in universal time * ``` * ``` */ data: number } export interface OrbitMaxMinTrueDistance extends Flag, Error { /** * ### Description * Orbital maximum and minimum possible distances * ``` * ``` */ data: { /** * Maximum possible distance */ max: number, /** * Minimum possible distance */ min: number, /** * Current true distance */ true: number } } export interface LunEclipseHow extends Flag, Error { /** * ### Description * Array of data about the lunar eclipse * ``` * ``` */ data: LunEclipseAttributes } export interface LunEclipseWhenLoc extends Flag, Error { /** * ### Description * Array of eclipse timings * ``` * ``` */ data: EclipseTimes2, /** * ### Description * Array of additional data about the lunar eclipse * ``` * ``` */ attributes: LunEclipseAttributes } export interface LunEclipseWhen extends Flag, Error { /** * ### Description * Array of eclipse timings * ``` * ``` */ data: EclipseTimes } export interface EclipseWhenGlob extends Flag, Error { /** * ### Description * Array of eclipse timings * ``` * ``` */ data: EclipseTimes3 } export interface LunOccultWhenLoc extends Flag, Error { /** * ### Description * Array of eclipse timings * ``` * ``` */ data: EclipseTimes4, /** * ### Description * Array of additional data about the lunar eclipse * ``` * ``` */ attributes: EclipseAttributes } export interface LunOccultWhere extends Flag, Error { /** * ### Description * Array of eclipse coordinates * ``` * ``` */ data: EclipseCoords, /** * ### Description * Array of additional data about the eclipse * ``` * ``` */ attributes: LunEclipseAttributes2 } export interface NodAps extends Flag, Error { /** * ### Description * Object containing ascending node, descending node, aphelion and perihelion values * Depending on the specific object and the method flag used, the values can be either "mean" or "osculating" * ``` * ``` */ data: { /** * ### Description * Array of ascending node values returned by the calculation * By default the values are in ecliptic coordinates (longitude, latitude, distance) * If `SEFLG_SPEED` or `SEFLG_SPEED3` are used, the daily speeds for each value are also retured, otherwise they are 0 * If `SEFLG_EQUATORIAL` is used, the values are in equatorial coordinates instead (right ascension, declination, distance) * If `SELFG_XYZ` is used, the values are in cartesian coordinates instead (X, Y, Z) * ``` * ``` */ ascending: CalcData2; /** * ### Description * Array of descending node values returned by the calculation * By default the values are in ecliptic coordinates (longitude, latitude, distance) * If `SEFLG_SPEED` or `SEFLG_SPEED3` are used, the daily speeds for each value are also retured, otherwise they are 0 * If `SEFLG_EQUATORIAL` is used, the values are in equatorial coordinates instead (right ascension, declination, distance) * If `SELFG_XYZ` is used, the values are in cartesian coordinates instead (X, Y, Z) * ``` * ``` */ descending: CalcData2; /** * ### Description * Array of perihelion node values returned by the calculation * By default the values are in ecliptic coordinates (longitude, latitude, distance) * If `SEFLG_SPEED` or `SEFLG_SPEED3` are used, the daily speeds for each value are also retured, otherwise they are 0 * If `SEFLG_EQUATORIAL` is used, the values are in equatorial coordinates instead (right ascension, declination, distance) * If `SELFG_XYZ` is used, the values are in cartesian coordinates instead (X, Y, Z) * ``` * ``` */ perihelion: CalcData2; /** * ### Description * Array of aphelion values returned by the calculation * By default the values are in ecliptic coordinates (longitude, latitude, distance) * If `SEFLG_SPEED` or `SEFLG_SPEED3` are used, the daily speeds for each value are also retured, otherwise they are 0 * If `SEFLG_EQUATORIAL` is used, the values are in equatorial coordinates instead (right ascension, declination, distance) * If `SELFG_XYZ` is used, the values are in cartesian coordinates instead (X, Y, Z) * if `SE_NODBIT_FOPOINT` is used, the values are the object's second focus instead * ``` * ``` */ aphelion: CalcData2; }; } export interface Pheno extends Flag, Error { /** * ### Description * Array containing data for planetary phenomena * ``` * ``` */ data: PhenoData; } export interface RefracExtended { /** * ### Description * Converted altitude value * ``` * ``` */ data: number; /** * ### Description * Array containing additional output from altitude conversion * ``` * ``` */ extended: RefracExtendedData; } export interface RiseTrans extends Flag, Error { /** * ### Description * Time of transit in julian days in universal time * ``` * ``` */ data: number; } export interface SolEclipseHow extends Flag, Error { /** * ### Description * Array of data about the solar eclipse * ``` * ``` */ data: EclipseAttributes2; } export interface SolEclipseWhenLoc extends Flag, Error { /** * ### Description * Array of eclipse timings * ``` * ``` */ data: EclipseTimes4; /** * ### Description * Array of additional data about the solar eclipse * ``` * ``` */ attributes: EclipseAttributes2; } export interface SolEclipseWhere extends Flag, Error { /** * ### Description * Array of eclipse coordinates * ``` * ``` */ data: EclipseCoords; /** * ### Description * Array of additional data about the solar eclipse * ``` * ``` */ attributes: EclipseAttributes2; } export interface SplitDeg { /** * ### Description * Degrees value * ``` * ``` */ degree: number; /** * ### Description * Minutes value * ``` * ``` */ minute: number; /** * ### Description * Seconds value * ``` * ``` */ second: number; /** * ### Description * Seconds fraction value * ``` * ``` */ fraction: number; /** * ### Description * Zodiac sign or nakshatra number * ``` * ``` */ sign: number; } export interface TimeEqu extends Flag, Error { /** * ### Description * Value of the equation of time (difference between LMT and LAT) * ``` * ``` */ data: number; } export interface UtcToJd extends Flag, Error { /** * ### Description * Array containing julian day in both ephemeris and universal time * ``` * ``` */ data: JdEtUt; } export interface VisLimitMag extends Flag, Error { /** * ### Description * Array containing the altitude, azimuth and magnitude data of the object along with the altitude and azimuth of the sun and the moon * ``` * ``` */ data: VisLimitMagData; } export interface Cross extends Error { /** * ### Description * Date when the next crossing happens in julian days * The julian day value is in universal time when using the `_ut` variant of the function, otherwise its in ephemeris/terrestrial time * ``` * ``` */ date: number; } export interface NodeCross extends Cross { /** * ### Description * Ecliptic longitude where the crossing happens * ``` * ``` */ longitude: number; /** * ### Description * Ecliptic latitude margin of precision for the crossing date * ``` * ``` */ latitude: number; } /* ┌──────────────────────────────────────────────────┬───────────┬──────────────────────────────────────────────────┐ │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ Types │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ └──────────────────────────────────────────────────┴───────────┴──────────────────────────────────────────────────┘ */ export type OrbitalElementsData = [ /** * Semimajor axis */ a: number, /** * Eccentricity */ e: number, /** * Inclination */ i: number, /** * Longitude of ascending node */ Ω: number, /** * Argument of periapsis */ ω: number, /** * Longitude of periapsis */ ϖ: number, /** * Mean anomaly at epoch */ M0: number, /** * True anomaly at epoch */ v0: number, /** * Eccentric anomaly at epoch */ E0: number, /** * Mean longitude at epoch */ L0: number, /** * Sidereal orbital period in tropical years */ sidereal_period: number, /** * Mean daily motion */ daily_motion: number, /** * Tropical period in years */ tropical_period: number, /** * Synodic period in days * Negative, if inner planet (Venus, Mercury, Aten asteroids) or Moon */ synodic_period: number, /** * Time of perihelion passage */ perihelion_passage: number, /** * Perihelion distance */ perihelion_distance: number, /** * Aphelion distance */ aphelion_distance: number ] export type CalcData = [ /** * (`λ`) Ecliptic longitude * (`α`) Equatorial right ascension if `SEFLG_EQUATORIAL` * (`x`) Cartesian X if `SEFLG_XYZ` * (`ε`) True obliquity of the ecliptic if object ID is `SE_ECL_NUT` */ lon: number, /** * (`β`) Ecliptic latitude * (`δ`) Equatorial declination if `SEFLG_EQUATORIAL` * (`y`) Cartesian Y if `SEFLG_XYZ` * (`ε`) Mean obliquity of the ecliptic if object ID is `SE_ECL_NUT` */ lat: number, /** * (`au`) Distance in AU * (`z`) Cartesian Z if `SEFLG_XYZ` * (`Δψ`) Nutation in longitude if oject ID is `SE_ECL_NUT` */ dist: number, /** * (`λs`) Ecliptic longitude daily speed * (`αs`) Equatorial right ascension daily speed if `SEFLG_EQUATORIAL` * (`xs`) Cartesian daily speed if `SEFLG_XYZ` * (`Δε`) Nutation in obliquity if oject ID is `SE_ECL_NUT` */ lonSpd: number, /** * (`βs`) Ecliptic latitude daily speed * (`δs`) Equatorial declination daily speed if `SEFLG_EQUATORIAL` * (`ys`) Cartesian Y daily speed if `SEFLG_XYZ` */ latSpd: number, /** * (`aus`) Distance daily speed in AU * (`zs`) Cartesian Z daily speed if `SEFLG_XYZ` */ distSpd: number ] export type CalcData2 = [ /** * (`λ`) Ecliptic longitude * (`α`) Equatorial right ascension if `SEFLG_EQUATORIAL` * (`x`) Cartesian X if `SEFLG_XYZ` */ lon: number, /** * (`β`) Ecliptic latitude * (`δ`) Equatorial declination if `SEFLG_EQUATORIAL` * (`y`) Cartesian Y if `SEFLG_XYZ` */ lat: number, /** * (`au`) Distance in AU * (`z`) Cartesian Z if `SEFLG_XYZ` */ dist: number, /** * (`λs`) Ecliptic longitude daily speed * (`αs`) Equatorial right ascension daily speed if `SEFLG_EQUATORIAL` * (`xs`) Cartesian daily speed if `SEFLG_XYZ` */ lonSpd: number, /** * (`βs`) Ecliptic latitude daily speed * (`δs`) Equatorial declination daily speed if `SEFLG_EQUATORIAL` * (`ys`) Cartesian Y daily speed if `SEFLG_XYZ` */ latSpd: number, /** * (`aus`) Distance daily speed in AU * (`zs`) Cartesian Z daily speed if `SEFLG_XYZ` */ distSpd: number ] export type HeliacalPhenoData = [ /** * Topocentric altitude of object in degrees (unrefracted) */ AltO: number, /** * Apparent altitude of object in degrees (refracted) */ AppAltO: number, /** * Geocentric altitude of object in degrees */ GeoAltO: number, /** * Azimuth of object in degrees */ AziO: number, /** * Topocentric altitude of Sun in degrees */ AltS: number, /** * Azimuth of Sun in degrees */ AziS:number, /** * Actual topocentric arcus visionis in degrees */ TAVact: number, /** * Actual (geocentric) arcus visionis in degrees */ ARCVact: number, /** * Actual difference between object's and sun's azimuth in degrees */ DAZact: number, /** * Actual longitude difference between object and sun in degrees */ ARCLact: number, /** * Extinction coefficient */ kact: number, /** * Smallest topocentric arcus visionis in degrees */ minTAV: number, /** * First time object is visible:number, according to VR in JD */ TfistVR: number, /** * optimum time the object is visible:number, according to VR in JD */ TbVR: number, /** * last time object is visible:number, according to VR in JD */ TlastVR: number, /** * best time the object is visible:number, according to Yallop in JD */ TbYallop: number, /** * crescent width of Moon in degrees */ WMoon: number, /** * q-test value of Yallop */ qYal: number, /** * q-test criterion of Yallop */ qCrit: number, /** * parallax of object in degrees */ ParO: number, /** * magnitude of object */ Magn: number, /** * rise/set time of object in JD */ RiseO: number, /** * rise/set time of Sun in JD */ RiseS: number, /** * rise/set time of object minus rise/set time of Sun in JD */ Lag: number, /** * visibility duration in JD */ TvisVR: number, /** * crescent length of Moon in degrees */ LMoon: number, /** * CVAact in degrees */ CVAact: number, /** * Illum in percentage */ Illum: number, /** * CVAact in degrees */ CVAact: number, /** * MSk */ MSk: number ] export type HeliacalData = [ /** * Start visibility in JD */ vis_start: number, /** * Optimum visibility in JD (zero if hel_flag >= SE_HELFLAG_AV) */ vis_opt: number, /** * End of visibility in JD (zero if hel_flag >= SE_HELFLAG_AV) */ vis_end: number ] export type AzaltRev = [ /** * (λ) Ecliptic longitude if SE_HOR2ECL * (α) Equatorial right ascension if SE_HOR2EQU */ lon: number, /** * (β) Ecliptic latitude if SE_HOR2ECL * (δ) Equatorial declination if SE_HOR2EQU */ lat: number ] export type Azalt = [ /** * Azimuth */ az: number, /** * True altitude */ alt: number, /** * Apparent altitude (with refraction) */ ap: number ] export type CoTransSp = [ ...cotrans: CoTrans, /** * Daily speed for lon */ lonSpd: number, /** * Daily speed for lat */ latSpd: number, /** * Daily speed for dist (unchanged) */ distSpd: number ] export type CoTrans = [ /** * (λ) Ecliptic longitude or (α) Equatorial right ascension */ lon: number, /** * (β) Ecliptic latitude or (δ) Equatorial declination */ lat: number, /** * Distance in AU (unchanged) */ dist: number, ] export type HouseSystems = "B" | "Y" | "X" | "H" | "C" | "F" | "A" | "E" | "D" | "N" | "G" | "I" | "i" | "K" | "U" | "M" | "P" | "T" | "O" | "L" | "Q" | "R" | "S" | "V" | "W"; export type HousesList = [ /** * 1st House */ house_1: number, /** * 2nd House */ house_2: number, /** * 3rd House */ house_3: number, /** * 4th House */ house_4: number, /** * 5th House */ house_5: number, /** * 6th House */ house_6: number, /** * 7th House */ house_7: number, /** * 8th House */ house_8: number, /** * 9th House */ house_9: number, /** * 10th House */ house_10: number, /** * 11th House */ house_11: number, /** * 12th House */ house_12: number, ] export type PointsList = [ /** * Longitude of the Ascendant */ asc: number, /** * Longitude of the Midheaven */ mc: number, /** * Right Ascension of the Midheaven */ armc: number, /** * Longitude of the Vertex */ vertex: number, /** * Longitude of the Equatorial Ascendant */ equasc: number, /** * Longitude of Walter Koch's Co-Ascendant */ coasc1: number, /** * Longitude of Michael Munkasey's Co-Ascendant */ coasc2: number, /** * Longitude of Michael Munkasey's Polar Ascendant */ polasc: number ] export type HousesSpeeds = [ /** * Momentary speed for the 1st House */ house_1_speed: number, /** * Momentary speed for the 2nd House */ house_2_speed: number, /** * Momentary speed for the 3rd House */ house_3_speed: number, /** * Momentary speed for the 4th House */ house_4_speed: number, /** * Momentary speed for the 5th House */ house_5_speed: number, /** * Momentary speed for the 6th House */ house_6_speed: number, /** * Momentary speed for the 7th House */ house_7_speed: number, /** * Momentary speed for the 8th House */ house_8_speed: number, /** * Momentary speed for the 9th House */ house_9_speed: number, /** * Momentary speed for the 10th House */ house_10_speed: number, /** * Momentary speed for the 11th House */ house_11_speed: number, /** * Momentary speed for the 12th House */ house_12_speed: number, ] export type PointsSpeeds = [ /** * Momentary speed of the Ascendant */ asc_speed: number, /** * Momentary speed of the Midheaven */ mc_speed: number, /** * Momentary speed in Right Ascension of the Midheaven */ armc_speed: number, /** * Momentary speed of the Vertex */ vertex_speed: number, /** * Momentary speed of the Equatorial Ascendant */ equasc_speed: number, /** * Momentary speed of Walter Koch's Co-Ascendant */ coasc1_speed: number, /** * Momentary speed of Michael Munkasey's Co-Ascendant */ coasc2_speed: number, /** * Momentary speed of Michael Munkasey's Polar Ascendant */ polasc_speed: number ] export type GauquelinHousesList = [ ...houses: HousesList, /** * 13th House */ house_13: number, /** * 14th House */ house_14: number, /** * 15th House */ house_15: number, /** * 16th House */ house_16: number, /** * 17th House */ house_17: number, /** * 18th House */ house_18: number, /** * 19th House */ house_19: number, /** * 20th House */ house_20: number, /** * 21th House */ house_21: number, /** * 22th House */ house_22: number, /** * 23th House */ house_23: number, /** * 24th House */ house_24: number, /** * 25th House */ house_25: number, /** * 26th House */ house_26: number, /** * 27th House */ house_27: number, /** * 28th House */ house_28: number, /** * 29th House */ house_29: number, /** * 30th House */ house_30: number, /** * 31th House */ house_31: number, /** * 32th House */ house_32: number, /** * 33th House */ house_33: number, /** * 34th House */ house_34: number, /** * 35th House */ house_35: number, /** * 36th House */ house_36: number, ] export type GauquelinHousesSpeeds = [ ...houses: HousesSpeeds, /** * Momentary speed for the 13th House */ house_13_speed: number, /** * Momentary speed for the 14th House */ house_14_speed: number, /** * Momentary speed for the 15th House */ house_15_speed: number, /** * Momentary speed for the 16th House */ house_16_speed: number, /** * Momentary speed for the 17th House */ house_17_speed: number, /** * Momentary speed for the 18th House */ house_18_speed: number, /** * Momentary speed for the 19th House */ house_19_speed: number, /** * Momentary speed for the 20th House */ house_20_speed: number, /** * Momentary speed for the 21th House */ house_21_speed: number, /** * Momentary speed for the 22th House */ house_22_speed: number, /** * Momentary speed for the 23th House */ house_23_speed: number, /** * Momentary speed for the 24th House */ house_24_speed: number, /** * Momentary speed for the 25th House */ house_25_speed: number, /** * Momentary speed for the 26th House */ house_26_speed: number, /** * Momentary speed for the 27th House */ house_27_speed: number, /** * Momentary speed for the 28th House */ house_28_speed: number, /** * Momentary speed for the 29th House */ house_29_speed: number, /** * Momentary speed for the 30th House */ house_30_speed: number, /** * Momentary speed for the 31th House */ house_31_speed: number, /** * Momentary speed for the 32th House */ house_32_speed: number, /** * Momentary speed for the 33th House */ house_33_speed: number, /** * Momentary speed for the 34th House */ house_34_speed: number, /** * Momentary speed for the 35th House */ house_35_speed: number, /** * Momentary speed for the 36th House */ house_36_speed: number, ] export type EclipseTimes = [ /** * time of maximum eclipse in jd */ eclipse_max: number, /** * Unused */ _: number, /** * time of partial phase start */ partial_start: number, /** * time of partial phase end */ partial_end: number, /** * time of totality start */ total_start: number, /** * time of totality end */ total_end: number, /** * time of penumbral phase start */ penumbral_start: number, /** * time of penumbral phase end */ penumbral_end: number ] export type EclipseTimes2 = [ ...times: EclipseTimes, /** * Time of moonrise, if it occurs during the eclipse */ rise: number, /** * Time of moonset, if it occurs during the eclipse */ set: number, ] export type EclipseTimes3 = [ /** * time of maximum eclipse in jd */ eclipse_max: number, /** * time when eclipse takes place at local apparent noon */ local_noon: number, /** * time of eclipse start */ eclipse_start: number, /** * time of eclipse end */ eclipse_end: number, /** * time of totality start */ total_start: number, /** * time of totality end */ total_end: number, /** * time of center line start */ center_start: number, /** * time of center line end */ center_end: number, /** * time when annular-total eclipse becomes total */ annular_total: number, /** * time when annular-total eclipse becomes annular again */ total_annular: number ] export type EclipseTimes4 = [ /** * Time of maximum eclipse */ max_eclipse: number, /** * Time of first contact */ first_contact: number, /** * Time of second contact */ second_contact: number, /** * Time of third contact */ third_contact: number, /** * Time of fourth contact */ fourth_contact: number, /** * Time of sunrise between first and forth contact */ sunrise: number, /** * Time of sunset between first and forth contact */ sunset: number ] export type EclipseCoords = [ /** * Geographic longitude of central line */ central_long: number, /** * Geographic latitude of central line */ central_lat: number, /** * Geographic longitude of northern limit of umbra */ north_umbra_long: number, /** * Geographic latitude of northern limit of umbra */ north_umbra_lat: number, /** * Geographic longitude of southern limit of umbra */ south_umbra_long: number, /** * Geographic latitude of southern limit of umbra */ south_umbra_lat: number, /** * Geographic longitude of northern limit of penumbra */ north_penumbra_long: number, /** * Geographic latitude of northern limit of penumbra */ north_penumbra_lat: number, /** * Geographic longitude of southern limit of penumbra */ south_penumbra_long: number, /** * Geographic latitude of southern limit of penumbra */ south_penumbra_lat: number ] export type EclipseAttributes = [ /** * Fraction of solar diameter covered by moon (magnitude) */ solar_diameter: number, /** * Ratio of lunar diameter to solar one */ lunar_diameter: number, /** * Fraction of solar disc covered by moon (obscuration) */ solar_disc: number, /** * Diameter of core shadow in km */ core_shadow: number, /** * Azimuth of sun at tjd */ sun_azimuth: number, /** * True altitude of sun above horizon at tjd */ true_altitude: number, /** * Apparent altitude of sun above horizon at tjd */ mean_altitude: number, /** * Elongation of moon in degrees */ elongation: number ] export type EclipseAttributes2 = [ ...attr: EclipseAttributes, /** * Eclipse magnitude (same as solar_diameter or lunar_diameter depending on the eclipse type) */ mag: number, /** * Saros series number (if available, otherwise -99999999) */ saros: number, /** * Saros series member number (if available, otherwise -99999999) */ saros_member: number ] export type LunEclipseAttributes = [ /** * Umbral magnitude at jd */ umbral: number, /** * Penumbral magnitude */ penumbral: number, /** * Unused */ _: number, /** * Unused */ _: number, /** * Azimuth of the moon at jd */ azimuth: number, /** * True altitude of the moon above horizon at jd */ true_altitude: number, /** * Apparent altitude of the moon above horizon at jd */ apparent_altitude: number, /** * Distance of the moon from opposition in degrees */ distance: number, /** * Eclipse magnitude (same as umbral magnitude) */ mag: number, /** * Saros series number (if available, otherwise -99999999) */ saros: number, /** * Saros series member number (if available, otherwise -99999999) */ saros_member: number ] export type LunEclipseAttributes2 = [ /** * Fraction of object's diameter covered by moon (magnitude) */ object_diameter: number, /** * Ratio of lunar diameter to object's diameter */ lunar_diameter: number, /** * Fraction of object's disc covered by moon (obscuration) */ object_disc: number, /** * Diameter of core shadow in km */ core_shadow: number, /** * Azimuth of object at tjd */ object_azimuth: number, /** * True altitude of object above horizon at tjd */ true_altitude: number, /** * Apparent altitude of object above horizon at tjd */ apparent_altitude: number, /** * Angular distance of moon from object in degrees */ angular_distance: number, ] export type PhenoData = [ /** * Phase angle (Earth-planet-sun) */ phase_angle: number, /** * Phase (illumined fraction of disc) */ phase: number, /** * Elongation of planet */ elongation: number, /** * Apparent diameter of disc */ diameter: number, /** * Apparent magnitude */ magnitude: number ] export type RefracExtendedData = [ /** * True altitude if possible, otherwise input value */ true_altitude: number, /** * Apparent altitude if possible, otherwise input value */ apparent_altitude: number, /** * Refraction value */ refraction: number, /** * Dip of the horizon */ dip: number ] export type JdEtUt = [ /** * Julian day in ephemeris/terrestrial time */ et: number, /** * Julian day in universal time */ ut: number ] export type VisLimitMagData = [ /** * Limiting visual magnitude (object is visible if this value is bigger than the object's magnitude value) */ visual_mag: number, /** * Altitude of the object */ obj_altitude: number, /** * Azimuth of the object */ obj_azimuth: number, /** * Altitude of the sun */ sun_altitude: number, /** * Azimuth of the sun */ sun_azimuth: number, /** * Altitude of the moon */ moon_altitude: number, /** * Azimuth of the moon */ moon_azimuth: number, /** * The object's magnitude */ magnitude: number ] /* ┌──────────────────────────────────────────────────┬───────────┬──────────────────────────────────────────────────┐ │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ Functions │┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼│ └──────────────────────────────────────────────────┴───────────┴──────────────────────────────────────────────────┘ */ /** * ### Description * Transform horizontal coordinates into ecliptic or equatorial coordinates based on the observer's location * ### Params * ``` * • tjd_ut: number // Julian day in universal time * • calc_flag: number // Calculation flag, SE_HOR2ECL or SE_HOR2EQU * • geopos: Array<number> // Geographic coordinates [longitude, latitude, elevation] * • xin: Array<number> // Horizontal coordinates [azimuth, true altitude] * ``` * ### Returns * ``` * Array<number> [ * lon, // (λ) Ecliptic longitude if SE_HOR2ECL, (α) Equatorial right ascension if SE_HOR2EQU * lat // (β) Ecliptic latitude if SE_HOR2ECL, (δ) Equatorial declination if SE_HOR2EQU * ] * ``` * ### Example * ``` * const result = azalt_rev(2314234, constants.SE_HOR2ECL, [34, 40, 0], [75, 67]); * console.log(`Longitude: ${result[0]}`); * ``` * &nbsp; */ export function azalt_rev(tjd_ut: number, calc_flag: number, geopos: [longitude: number, latitude: number, elevation: number], xin: [azimuth: number, true_altitude: number]): AzaltRev; /** * ### Description * Transform ecliptic or equatorial coordinates into horizontal coordinates based on the observer's location * ### Params * ``` * • tjd_ut: number // Julian day in universal time * • calc_flag: number // Calculation flag, SE_ECL2HOR or SE_EQU2HOR * • geopos: Array<number> // Geographic coordinates [longitude, latitude, elevation] * • atpress: number // Atmospheric pressure in mbar/hpa * • attemp: number // Atmospheric temperature in celcius * • xin: Array<number> // Ecliptic or equatorial coordinates [lon/ra, lat/dec, distance] * ``` * ### Returns * ``` * Array<number> [ * az, // Azimuth * alt, // True altitude * ap // Apparent altitude (with refraction) * ] * ``` * ### Example * ``` * const result = azalt(2314234, constants.SE_ECL2HOR, [34, 40, 0], 0, 0, [75, 67, 0]); * console.log(`Azimuth: ${result[0]}`); * ``` * &nbsp; */ export function azalt(tjd_ut: number, calc_flag: number, geopos: [longitude: number, latitude: number, elevation: number], atpress: number, attemp: number, xin: [lon_or_ra: number, lat_or_dec: number, distance: number]): Azalt; /** * ### Description * Compute planetocentric positions of planets as observed from a different planet, for example Jupiter-centric ephemerides * ### Params * ``` * • tjd_et: number // Julian day in terrestrial/ephemeris time * • ipl: number // Target object ID * • iplctr: number // Center object ID * • iflag: number // Calculation flags * ``` * ### Returns * ``` * Object { * flag: number, // Computed flags or ERR * error: string, // Error message if ERR or if incompatible flags * data: Array<number> [ * lon, // Longitude, right ascension, cartesian X, or true obliquity depending on the flags * lat, // Latitude, declination, cartesian Y, or mean obliquity depending on the flags * dist, // Distance in AU, cartesian Z or nutation in longitude depending on the flags * lonSpd, // Daily speed for lon or nutation in obliquity depending on the flags * latSpd, // Daily speed for lat * distSpd, // Daily speed for dist * ] * } * ``` * ### Example * ``` * const flags = constants.SEFLG_SWIEPH | constants.SEFLG_SPEED; * const result = calc_pctr(2314234, constants.SE_EARTH, constants.SE_MARS, flags); * if(result.flag === constants.ERR) throw new Error(result.error); * if(result.flag !== flags) console.log(result.error); * console.log(`Longitude: ${result.data[0]}`); * ``` * &nbsp; */ export function calc_pctr(tjd_et: number, ipl: number, iplctr: number, iflag: number): Calc; /** * ### Description * Compute positions of planets, asteroids, lunar nodes and apogees from universal time * ### Params * ``` * • tjd_ut: number // Julian day in universal time * • ipl: number // Target object ID * • iflag: number // Calculation flags * ``` * ### Returns * ``` * Object { * flag: number, // Computed flags or ERR * error: string, // Error message if ERR or if incompatible flags * data: Array<number> [ * lon, // Longitude, right ascension, cartesian X, or true obliquity depending on the flags * lat, // Latitude, declination, cartesian Y, or mean obliquity depending on the flags * dist, // Distance in AU, cartesian Z or nutation in longitude depending on the flags * lonSpd, // Daily speed for lon or nutation in obliquity depending on the flags * latSpd, // Daily speed for lat * distSpd, // Daily speed for dist * ] * } * ``` * ### Example * ``` * const flags = constants.SEFLG_SWIEPH | constants.SEFLG_SPEED; * const result = calc_ut(2314234, constants.SE_MOON, flags); * if(result.flag !== constants.OK) { throw new Error(result.error); } * if(result.flag !== flags) { console.log(result.error); } * console.log(`Longitude: ${result.data[0]}`); * ``` * &nbsp; */ export function calc_ut(tjd_ut: number, ipl: number, iflag: number): Calc; /** * ### Description * Compute positions of planets, asteroids, lunar nodes and apogees from ephemeris time * ### Params * ``` * • tjd_et: number // Julian day in terrestrial/ephemeris time * • ipl: number // Target object ID * • iflag: number // Calculation flags * ``` * ### Returns * ``` * Object { * flag: number, // Computed flags or ERR * error: string, // Error message if ERR or if incompatible flags * data: Array<number> [ * lon, // Longitude, right ascension, cartesian X, or true obliquity depending on the flags * lat, // Latitude, declination, cartesian Y, or mean obliquity depending on the flags * dist, // Distance in AU, cartesian Z or nutation in longitude depending on the flags * lonSpd, // Daily speed for lon or nutation in obliquity depending on the flags * latSpd, // Daily speed for lat * distSpd, // Daily speed for dist * ] * } * ``` * ### Example * ``` * const flags = constants.SEFLG_SWIEPH | constants.SEFLG_SPEED; * const result = calc(2314234, constants.SE_VENUS, flags); * if(result.flag === constants.ERR) { throw new Error(result.error); } * if(result.flag !== flags) { console.log(result.error); } * console.log(`Longitude: ${result.data[0]}`); * ``` * &nbsp; */ export function calc(tjd_et: number, ipl: number, iflag: number): Calc; /** * ### Description * Reset swisseph internals and cleanup file handles * Not usually required as Node cleans after itself * ### Example * ``` * close(); * ``` * &nbsp; */ export function close(): void; /** * ### Description * Transform between ecliptic and equatorial coordinate systems including motion speeds * From equatorial to ecliptic, obliquity must be positive * From ecliptic to equatorial, obliquity must be negative * Distances are not affected and can be 0 * ### Params * ``` * • xpo: Array<number> // Input coordinates in ecliptic or equatorial coordinates [lon, lat, dist, lonSpd, latSpd, distSpd] * • eps: number // Positive or negative obliquity of the ecliptic * ``` * ### Returns * ``` * Array<number> [ * lon, // (λ) Ecliptic longitude or (α) Equatorial right ascension * lat // (β) Ecliptic latitude or (δ) Equatorial declination * dist, // Distance in AU (unchanged) * lonSpd, // Daily speed for lon * latSpd, // Daily speed for lat * distSpd, // Daily speed for dist (unchanged) * ] * ``` * ### Example * ``` * const obliquity = calc(2314234, constants.SE_ECL_NUT, constants.SEFLG_SWIEPH).data[0]; * const result = cotrans_sp([345, 10, 0, 1.5, 0.01, 0], -obliquity); * console.log(`Right Ascension: ${result[0]}`); * ``` * &nbsp; */ export function cotrans_sp(xpo: [lon: number, lat: number, dist: number, lonSpd: number, latSpd: number, distSpd: number], eps: number): CoTransSp; /** * ### Description * Transform between ecliptic and equatorial coordinate systems * From equatorial to ecliptic, obliquity must be positive * From ecliptic to equatorial, obliquity must be negative * Distance is not affected and can be 0 * ### Params * ``` * • xpo: Array<number> // Input coordinates in ecliptic or equatorial coordinates [lon, lat, dist] * • eps: number // Positive or negative obliquity of the ecliptic * ``` * ### Returns * ``` * Array<number> [ * lon, // Longitude or right ascension * lat, // Latitude or declination * dist, // Distance in AU (unchanged) * ] * ``` * ### Example * ``` * const obliquity = calc(2314234, constants.SE_ECL_NUT, constants.SEFLG_SWIEPH).data[0]; * const result = cotrans([345, 10, 0], -obliquity); * console.log(`Right Ascension: ${result[0]}`); * ``` * &nbsp; */ export function cotrans(xpo: [lon: number, lat: number, dist: number], eps: number): CoTrans; /** * ### Description * Convert centiseconds to degrees string * ### Params * ``` * • csec: number // Centiseconds value * ``` * ### Returns * ``` * string * ``` * ### Example * ``` * const deg = cs2degstr(2345464); // " 6°30'54" * ``` * &nbsp; */ export function cs2degstr(csec: number): string; /** * ### Description * Convert centiseconds to longitude or latitude string with user defined sign character * ### Params * ``` * • csec: number // Centiseconds value * • pchar: string // Sign character for positive values * • mchar: string // Sign character for negative values * ``` * ### Returns * ``` * string * ``` * ### Example * ``` * const lon = cs2lonlatstr(2345464, "+", "-"); // "6+30'55" * ``` * &nbsp; */ export function cs2lonlatstr(csec: number, pchar: string, mchar: string): string; /** * ### Description * Convert centiseconds to time string * ### Params * ``` * • csec: number // Centiseconds value * • sep: string // Separator character * • suppresszero: boolean // Omit seconds if they are zero * ``` * ### Returns * ``` * string * ``` * ### Example * ``` * const time = cs2timestr(2345464, ":", true); // "6:30:55" * ``` * &nbsp; */ export function cs2timestr(csec: number, sep: string, suppresszero: boolean): string; /** * ### Description * Normalize centiseconds to 360 degrees range * ### Params * ``` * • csec: number // Centiseconds value * ``` * ### Returns * ``` * number * ``` * ### Example * ``` * const cs = csnorm(234546424235); // 8022955 * ``` * &nbsp; */ export function csnorm(csec: number): number; /** * ### Description * Round centiseconds to nearest second * ### Params * ``` * • csec: number // Centiseconds value * ``` * ### Returns * ``` * number * ``` * ### Example * ``` * const cs = csroundsec(14235235); // 14235200 * ``` * &nbsp; */ export function csroundsec(csec: number): number; /** * ### Description * Round double precision value to long integer * ### Params * ``` * • double: number // Double value * ``` * ### Returns * ``` * number * ``` * ### Example * ``` * const long = d2l(546546.7868); // 546547 * ``` * &nbsp; */ export function d2l(dou