astro.c

degrad x

[ returns double ]
convert degrees into radians

raddeg x

[ returns double ]
convert radians into degrees

hrdeg x

[ returns double ]
convert hours into degrees

deghr x

[ returns double ]
convert degrees into hours

hrrad x

[ returns double ]
convert hours into radians

radhr x

[ returns double ]
convert radians into hours

$SIDRATE = .9972695677

[ Constant : double ]
ratio of from synodic (solar) to sidereal (stellar) rate

$SPD = (24.0*3600.0)

[ Constant : double ]
seconds per day

$MERCURY = 0

[ Constant : int ]
Mercury index for calling plans

$VENUS = 1

[ Constant : int ]
Venus index for calling plans

$MARS = 2

[ Constant : int ]
Mars index for calling plans

$JUPITER = 3

[ Constant : int ]
Jupiter index for calling plans

$SATURN = 4

[ Constant : int ]
Saturn index for calling plans

$URANUS = 5

[ Constant : int ]
Uranus index for calling plans

$NEPTUNE = 6

[ Constant : int ]
Neptune index for calling plans

$PLUTO = 7

[ Constant : int ]
Pluto index for calling plans

$SUN = 8

[ Constant : int ]
Sun index for symmetry

$MOON = 9

[ Constant : int ]
Moon index for symmetry

$MJD0 = 2415020.0

[ Constant : double ]
starting point for MJD calculations

$J2000 = (2451545.0-(2415020.0))

[ Constant : double ]
epoch 2000 in MJD

aa_hadec lat alt az

[ returns void ]
given geographical latitude (north+, radians), lat, altitude (up+, radians), alt, and azimuth (angle round to the east from north+, radians), return hour angle (radians), ha, and declination (radians), dec.
[returns list of hour angle and declination]

hadec_aa lat ha dec

[ returns void ]
given geographical (north+, radians), lat, hour angle (radians), ha, and declination (radians), dec, return altitude (up+, radians), alt, and azimuth (angle round to the east from north+, radians),
[returns list of altitude and azimuth]

ab_ecl mjd lsn lam bet

[ returns void ]
apply aberration correction to ecliptical coordinates lam and bet (in radians) for a given time mjd and handily supplied longitude of sun, lsn (in radians).
[returns list of ecliptic longitude and latitude]

ab_eq mjd lsn ra

[ returns void ]
apply aberration correction to equatoreal coordinates ra and dec (in radians) for a given time mjd and handily supplied longitude of sun, lsn (in radians).
[returns list of right ascension and declination]

anomaly ma s

[ returns void ]
given the mean anomaly, ma, and the eccentricity, s, of elliptical motion, find the true anomaly, *nu, and the eccentric anomaly, *ea. all angles in radians.
[returns list of true anomaly and eccentric anomaly]

comet mjd ep inc ap qp om

[ returns void ]
given a modified Julian date, mjd, and a set of heliocentric parabolic orbital elements referred to the epoch of date (mjd):
ep: epoch of perihelion,
inc: inclination,
ap: argument of perihelion (equals the longitude of perihelion minus the longitude of ascending node)
qp: perihelion distance,
om: longitude of ascending node;
find:
lpd: heliocentric longitude,
psi: heliocentric latitude,
rp: distance from the sun to the planet,
rho: distance from the Earth to the planet,
lam: geocentric ecliptic longitude,
bet: geocentric ecliptic latitude,
none are corrected for light time, ie, they are the true values for the given instant.
all angles are in radians, all distances in AU. mutual perturbation corrections with other solar system objects are not applied. corrections for nutation and abberation must be made by the caller. The RA and DEC calculated from the fully-corrected ecliptic coordinates are then the apparent geocentric coordinates. Further corrections can be made, if required, for atmospheric refraction and geocentric parallax.
[returns a list of lpd, psi, rp, rho, lam, and bet]

deltat mjd

[ returns double ]
calculate DeltaT = ET - UT in seconds. Describes the irregularities of the Earth rotation rate in the ET time scale.

eq_ecl mjd ra dec

[ returns void ]
given the modified Julian date, mjd, and an equatorial ra and dec, each in radians, find the corresponding geocentric ecliptic latitude, *lat, and longititude, *lng, also each in radians. correction for the effect on the angle of the obliquity due to nutation is not included.
[returns list of lat and lng]

ecl_eq mjd lat lng

[ returns void ]
given the modified Julian date, mjd, and a geocentric ecliptic latitude, *lat, and longititude, *lng, each in radians, find the corresponding equitorial ra and dec, also each in radians. correction for the effect on the angle of the obliquity due to nutation is not included.
[returns list of ra and dec]

eq_gal mjd ra dec

[ returns void ]
given ra and dec, each in radians, for the given epoch, find the corresponding galactic latitude, *lat, and longititude, *lng, also each in radians.
[returns list of lat and lng]

gal_eq mjd lat lng

[ returns void ]
given galactic latitude, lat, and longititude, lng, each in radians, find the corresponding equatorial ra and dec, also each in radians, at the given epoch.
[returns list of ra and dec]

cal_mjd mn dy yr

[ returns void ]
given a date in months, mn, days, dy, years, yr, return the modified Julian date (number of days elapsed since 1900 jan 0.5), *mjd.
[returns a list of mjd]

mjd_cal mjd

[ returns void ]
given the modified Julian date (number of days elapsed since 1900 jan 0.5,), mjd, return the calendar date in months, *mn, days, *dy, and years, *yr.
[returns a list of mn, dy, and yr]

mjd_dow mjd

[ returns int ]
given an mjd, set *dow to 0..6 according to which day of the week it falls on (0=sunday). return 0 if ok else -1 if can't figure it out. [returns a list of status and dow]

mjd_dpm mjd

[ returns void ]
given a mjd, return the the number of days in the month.

mjd_year mjd

[ returns void ]
given a mjd, return the year as a double.

year_mjd y

[ returns void ]
given a decimal year, return mjd

rnd_second t

[ returns void ]
round a time in days, *t, to the nearest second, IN PLACE.

mjd_day jd

[ returns double ]
given an mjd, truncate it to the beginning of the whole day

mjd_hr jd

[ returns double ]
given an mjd, return the number of hours past midnight of the whole day

range v r

[ returns void ]
insure 0 <= *v < r.

moon mjd

[ returns void ]
given the mjd, find the geocentric ecliptic longitude, lam, and latitude, bet, and geocentric distance, rho in a.u. for the moon. also return the sun's mean anomaly, *msp, and the moon's mean anomaly, *mdp.
[returns a list of lam, bet, rho, msp, and mdp]

moon_colong mjd lt lg

[ returns void ]
given a Julian date and a lunar location, find selenographic colongitude of rising sun, lunar latitude of subsolar point, illuminated fraction, and alt of sun at the given location. Any pointer may be 0 if not interested. From Bruning and Talcott, October 1995 _Astronomy_, page 76. N.B. lunar coordinates use +E, but selenograhic colongs are +W.
[returns a list of colongitude, latitude, fraction and altitude]

nutation mjd

[ returns void ]
given the modified JD, mjd, find the nutation in obliquity, *deps, and the nutation in longitude, *dpsi, each in radians.
[returns a list of deps and dpsi]

nut_eq mjd

[ returns void ]
given the modified JD, mjd, correct, IN PLACE, the right ascension *ra and declination *dec (both in radians) for nutation.
[returns a list of ra and dec]

obliquity mjd

[ returns void ]
given the modified Julian date, mjd, find the mean obliquity of the ecliptic, *eps, in radians.
[returns a list of eps]

ta_par tha tdec phi ht

[ returns void ]
given true ha and dec, tha and tdec, the geographical latitude, phi, the height above sea-level (as a fraction of the earths radius, 6378.16km), ht, and the geocentric distance rho in Earth radii(!), find the apparent ha and dec, aha and adec allowing for parallax. all angles in radians. ehp is the angle subtended at the body by the earth's equator.
[returns a list of aha and adec]

plans mjd p

[ returns void ]
given a modified Julian date, mjd, and a planet, p, find:
lpd0: heliocentric longitude,
psi0: heliocentric latitude,
rp0: distance from the sun to the planet,
rho0: distance from the Earth to the planet,
none corrected for light time, ie, they are the true values for the given instant.
lam: geocentric ecliptic longitude,
bet: geocentric ecliptic latitude,
each corrected for light time, ie, they are the apparent values as seen from the center of the Earth for the given instant.
dia: angular diameter in arcsec at 1 AU,
mag: visual magnitude when 1 AU from sun and earth at 0 phase angle.
all angles are in radians, all distances in AU.
corrections for nutation and abberation must be made by the caller. The RA and DEC calculated from the fully-corrected ecliptic coordinates are then the apparent geocentric coordinates. Further corrections can be made, if required, for atmospheric refraction and geocentric parallax.
[returns a list of lpd0, psi0, rp0, rho0, lam, bet, dia, and mag]

precess mjd1 mjd2

[ returns void ]
corrects ra and dec, both in radians, for precession from epoch 1 to epoch 2. the epochs are given by their modified JDs, mjd1 and mjd2, respectively. N.B. ra and dec are modifed IN PLACE.
[returns a list of ra and dec]

reduce_elements mjd0 mjd inc0 ap0 om0

[ returns void ]
convert those orbital elements that change from epoch mjd0 to epoch mjd.

refract pr tr ta

[ returns void ]
correct the true altitude, ta, for refraction to the apparent altitude, aa, each in radians, given the local atmospheric pressure, pr, in mbars, and the temperature, tr, in degrees C.

unrefract pr tr aa

[ returns void ]
correct the apparent altitude, aa, for refraction to the true altitude, ta, each in radians, given the local atmospheric pressure, pr, in mbars, and the temperature, tr, in degrees C.

riset ra dec lat dis

[ returns void ]
given the true geocentric ra and dec of an object, the observer's latitude, lat, and a horizon displacement correction, dis, all in radians, find the local sidereal times and azimuths of rising and setting, lstr/s and azr/s, also all in radians, respectively. dis is the vertical displacement from the true position of the horizon. it is positive if the apparent position is higher than the true position. said another way, it is positive if the shift causes the object to spend longer above the horizon. for example, atmospheric refraction is typically assumed to produce a vertical shift of 34 arc minutes at the horizon; dis would then take on the value +9.89e-3 (radians). On the other hand, if your horizon has hills such that your apparent horizon is, say, 1 degree above sea level, you would allow for this by setting dis to -1.75e-2 (radians). This version contributed by Konrad Bernloehr, Nov. 1996 status: 0=normal; 1=never rises; -1=circumpolar. In case of non-zero status, all other returned variables are undefined.

sphcart l b r

[ returns void ]
transformation from spherical to cartesian coordinates

cartsph x y z

[ returns void ]
transformation from cartesian to spherical coordinates

sunpos mjd

[ returns void ]
given the modified JD, mjd, return the true geocentric ecliptic longitude of the sun for the mean equinox of the date, *lsn, in radians, the sun-earth distance, *rsn, in AU, and the latitude *bsn, in radians (since this is always <= 1.2 arcseconds, in can be neglected by calling with bsn = NULL). if the APPARENT ecliptic longitude is required, correct the longitude for nutation to the true equinox of date and for aberration (light travel time, approximately -9.27e7/186000/(3600*24*365)*2*pi = -9.93e-5 radians).

utc_gst mjd utc

[ returns void ]
given a modified julian date, mjd, and a universally coordinated time, utc, return greenwich mean siderial time, *gst. N.B. mjd must be at the beginning of the day.

gst_utc mjd gst

[ returns void ]
given a modified julian date, mjd, and a greenwich mean siderial time, gst, return universally coordinated time, *utc. N.B. mjd must be at the beginning of the day.