chickadee » ephem



ephem is a wrapper for libnova a "general purpose, double precision, Celestial Mechanics, Astrometry and Astrodynamics library."


Rob Altenburg


numbers, srfi-19, foreigners


ephem requires libnova v0.16. That version is available from the git repository.


The libnova modules documentation provides essential details. Main differences from that library are:

Data Types

Rise, Set, Transit
make-rst #!optional rise set transitprocedure

Returns a ln_rst_time foreign record type. If rise, set, or transit is not specified an empty structure is allocated and returned.

Rise, set, and transit are Julian dates as returned by srfi-19's (date->julian-day) function.

Note that I didn't expose the setters to mutate existing records of a given type.

rst-rise rstprocedure
rst-set rstprocedure
rst-transit rstprocedure
Rectangular Coordinates
make-rect #!optional x y xprocedure
rect-x rectprocedure
rect-y rectprocedure
rect-z rectprocedure
Heliocentric Coordinates
make-helio #!optional l b rprocedure
helio-l helioprocedure
helio-b helioprocedure
helio-r helioprocedure
Longitude and Latitude
make-ecl #!optional longitude latitudeprocedure
ecl-lng eclprocedure
ecl-lat eclprocedure
Equatorial Coordinates
make-equ #!optional ra decprocedure

Note: Right ascension and declination are both expressed in degrees, right ascensions given in h:m:s must be converted:

(hms->deg 12 30 1)
equ-ra equprocedure
equ-dec equprocedure
Horizontal Coordinates
make-hrz #!optional azimuth altitudeprocedure
hrz-az hrzprocedure
hrz-alt hrzprocedure
Hours, Minutes, Seconds
make-hms #!optional hours minuts secondsprocedure
hms-hours hmsprocedure
hms-minutes hmsprocedure
hms-seconds hmsprocedure
make-nutation #!optional longitude obliquity eclipticprocedure
nutation-longitude nutationprocedure
nutation-obliquity nutationprocedure
nutation-ecliptic nutationprocedure
Orbital Elements
Elliptic Orbital Elements
make-ell #!optional a e i w omega n jdprocedure
ell-a ellprocedure
ell-e ellprocedure
ell-i ellprocedure
ell-w ellprocedure
ell-omega ellprocedure
ell-n ellprocedure
ell-jd ellprocedure
Hyperbolic Orbital Elements
make-hyp #!optional q e i w omega jdprocedure
hyp-q hypprocedure
hyp-e hypprocedure
hyp-i hypprocedure
hyp-w hypprocedure
hyp-omega hypprocedure
hyp-jd hypprocedure
Parabolic Orbital Elements
make-par #!optional q i w omega jdprocedure
par-q parprocedure
par-i parprocedure
par-w parprocedure
par-omega parprocedure
par-jd parprocedure

Sidereal Time

gmst jdprocedure
gast jdprocedure
lmst jd longitudeprocedure
last jd longitudeprocedure


rad->deg radprocedure
deg->rad degprocedure
hms->deg hmsprocedure
deg->hms degprocedure
vsop87->fk5 helio jdprocedure

Rise, Set, Transit

object-rst jd ecl-observer equ-objectprocedure
object-next-rst jd ecl-observer equ-objectprocedure
object-next-rst-horizon jd ecl-observer equ-object horizonprocedure
body-rst-horizon jd ecl-observer body-object horizonprocedure
body-next-rst-horizon jd ecl-observer body-object horizonprocedure
body-next-rst-horizon-future jd ecl-observer body-object horizon day-limitprocedure


Elliptic Motion
solve-kepler e Mprocedure
ell-mean-anomaly n delta-jdprocedure
ell-true-anomaly e Eprocedure
ell-radius-vector a e Eprocedure
ell-smajor-diam e qprocedure
ell-sminor-diam e aprocedure
ell-mean-motion aprocedure
ell-geo-rect-posn ell jdprocedure
ell-helio-rect-posn ell jdprocedure
ell-orbit-len ellprocedure
ell-orbit-vel jd ellprocedure
ell-orbit-pvel ellprocedure
ell-orbit-avel ellprocedure
ell-body-phase-angle jd ellprocedure
ell-body-elong jd ellprocedure
ell-body-solar-dist jd ellprocedure
ell-body-earth-dist jd ellprocedure
ell-body-equ-coords jd ellprocedure
ell-body-rst jd eclprocedure
ell-body-rst-horizon jd ecl ell horizonprocedure
ell-body-next-rst-horizon jd ecl ell horizonprocedure
ell-body-next-rst-horizon-future jd ecl ell horizon day-limitprocedure
ell-last-perihelion epoch-jd M nprocedure
Hyperbolic Motion
solve-hyp-barker Q1 G tprocedure
hyp-true-anomaly q e tprocedure
hyp-radius-vector q e tprocedure
hyp-geo-rect-posn hprocedure
hyp-helio-rect-posn hyp jdprocedure
hyp-body-equ-coords jd hypprocedure
hyp-body-earth-dist jd hypprocedure
hyp-body-solar-dist jd hypprocedure
hyp-body-phase-angle jd hypprocedure
hyp-body-elong jd hypprocedure
hyp-body-rst jd ecl hypprocedure
hyp-body-rst-horizon jd ecl hyp horizonprocedure
hyp-body-next-rst-horizon jd ecl hyp horizonprocedure
hyp-body-next-rst-horizon-future jd ecl hyp horizon day-limitprocedure
Parabolic Motion
solve-barker q tprocedure
par-true-anomaly q tprocedure
par-radius-vector q tprocedure
par-geo-rect-posn par jdprocedure
par-helio-rect-posn par jdprocedure
par-body-equ-coords jd parprocedure
par-body-earth-dist jd parprocedure
par-body-solar-dist jd parprocedure
par-body-phase-angle jd parprocedure
par-body-elong jd parprocedure
par-body-rst jd ecl parprocedure
par-body-rst-horizon jd ecl par horizonprocedure
par-body-next-rst-horizon jd ecl par horizonprocedure
par-body-next-rst-horizon-future jd ecl par horizon day-limitprocedure


solar-rst-horizon jd ecl horizonprocedure
solar-rst jd eclprocedure
solar-geom-coords jdprocedure
solar-equ-coords jdprocedure
solar-ecl-coords jdprocedure
solar-geo-coords jdprocedure
solar-sdiam jdprocedure
earth-helio-coords jdprocedure
earth-solar-dist jdprocedure
earth-rect-helio jdprocedure
earth-centre-dist height latitudeprocedure
lunar-phase jdprocedure
lunar-disk jdprocedure
lunar-sdiam jdprocedure
lunar-earth-dist jdprocedure
lunar-bright-limb jdprocedure
lunar-long-asc-node jdprocedure
lunar-long-perigee jdprocedure
lunar-equ-coords jd precisionprocedure
lunar-rst jd eclprocedure
lunar-geo-posn jd precisionprocedure
lunar-equ-coords-prec jd precisionprocedure
lunar-ecl-coords jd precisionprocedure


mercury-sdiam jdprocedure
mercury-rst jd eclprocedure
mercury-helio-coords jdprocedure
mercury-equ-coords jdprocedure
mercury-earth-dist jdprocedure
mercury-solar-dist jdprocedure
mercury-magnitude jdprocedure
mercury-disk jdprocedure
mercury-phase jdprocedure
mercury-rect-helio jdprocedure
venus-sdiam jdprocedure
venus-rst jd eclprocedure
venus-helio-coords jdprocedure
venus-equ-coords jdprocedure
venus-earth-dist jdprocedure
venus-solar-dist jdprocedure
venus-magnitude jdprocedure
venus-disk jdprocedure
venus-phase jdprocedure
venus-rect-helio jdprocedure
mars-sdiam jdprocedure
mars-rst jd eclprocedure
mars-helio-coords jdprocedure
mars-equ-coords jdprocedure
mars-earth-dist jdprocedure
mars-solar-dist jdprocedure
mars-magnitude jdprocedure
mars-disk jdprocedure
mars-phase jdprocedure
mars-rect-helio jdprocedure
jupiter-equ-sdiam jdprocedure
jupiter-pol-sdiam jdprocedure
jupiter-rst jd eclprocedure
jupiter-helio-coords jdprocedure
jupiter-equ-coords jdprocedure
jupiter-earth-dist jdprocedure
jupiter-solar-dist jdprocedure
jupiter-magnitude jdprocedure
jupiter-disk jdprocedure
jupiter-phase jdprocedure
jupiter-rect-helio jdprocedure
saturn-equ-sdiam jdprocedure
saturn-pol-sdiam jdprocedure
saturn-rst jd eclprocedure
saturn-helio-coords jdprocedure
saturn-equ-coords jdprocedure
saturn-earth-dist jdprocedure
saturn-solar-dist jdprocedure
saturn-magnitude jdprocedure
saturn-disk jdprocedure
saturn-phase jdprocedure
saturn-rect-helio jdprocedure
uranus-sdiam jdprocedure
uranus-rst jd eclprocedure
uranus-helio-coords jdprocedure
uranus-equ-coords jdprocedure
uranus-earth-dist jdprocedure
uranus-solar-dist jdprocedure
uranus-magnitude jdprocedure
uranus-disk jdprocedure
uranus-phase jdprocedure
uranus-rect-helio jdprocedure
neptune-sdiam jdprocedure
neptune-rst jd eclprocedure
neptune-helio-coords jdprocedure
neptune-equ-coords jdprocedure
neptune-earth-dist jdprocedure
neptune-solar-dist jdprocedure
neptune-magnitude jdprocedure
neptune-disk jdprocedure
neptune-phase jdprocedure
neptune-rect-helio jdprocedure
pluto-sdiam jdprocedure
pluto-rst jd eclprocedure
pluto-helio-coords jdprocedure
pluto-equ-coords jdprocedure
pluto-earth-dist jdprocedure
pluto-solar-dist jdprocedure
pluto-magnitude jdprocedure
pluto-disk jdprocedure
pluto-phase jdprocedure
pluto-rect-helio jdprocedure


heliocentric-time-diff jd equprocedure
refraction-adj altitude atm-pressure tempprocedure
equ-aberration equ jdprocedure
ecl-aberration equ jdprocedure
dynamical-time-diff jdeprocedure
jde jdprocedure
angular-separation equ equprocedure
rel-posn-angle equ equprocedure
apparent-posn equ-mean equ-proper jdprocedure
nutation jdprocedure
equ-prec equ-mean jdprocedure
equ-prec2 equ-mean jd jdprocedure
ecl-prec ecl jdprocedure
ell-comet-mag jd ell g kprocedure
par-comet-mag jd par g kprocedure


hrz-from-equ equ ecl jdprocedure
hrz-from-equ-sidereal-time equ ecl siderealprocedure
equ-from-ecl ecl jdprocedure
ecl-from-equ equ jdprocedure
rect-from-helio helioprocedure
ecl-from-rect rectprocedure
equ-from-gal galprocedure
equ2000-from-gal galprocedure
gal-from-equ equprocedure
gal-from-equ2000 equprocedure


range-hours hoursprocedure
range-degrees degreesprocedure
range-degrees180 degreesprocedure
is-above-horizon? equ ecl jdprocedure
dms->deg dmsprocedure
hms->hr hmsprocedure


(use numbers srfi-19 ephem)

; set time using srfi-19
(define dd (exact->inexact (date->julian-day 
                             (make-date 0 0 30 7 13 12 2016 (* 3600 0)  #f))))

; set the longitude and latitude of the observer
(define my-ecl (make-ecl -76.8867 40.2732))

; calculate the Sun's rise, set, and transit using different methods
(define rst (solar-rst dd my-ecl))

; print the Julian date of the rise time
(display (rst-rise rst))



Version History

1.0 Initial Release

Contents »