chickadee » ephem

Ephem

Description

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

Author

Rob Altenburg

Requirements

numbers, srfi-19, foreigners

Installation

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

Procedures

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

Data Types

Rise, Set, Transit
(make-rst #!optional rise set transit) procedure

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 rst) procedure
(rst-set rst) procedure
(rst-transit rst) procedure
Rectangular Coordinates
(make-rect #!optional x y x) procedure
(rect-x rect) procedure
(rect-y rect) procedure
(rect-z rect) procedure
Heliocentric Coordinates
(make-helio #!optional l b r) procedure
(helio-l helio) procedure
(helio-b helio) procedure
(helio-r helio) procedure
Longitude and Latitude
(make-ecl #!optional longitude latitude) procedure
(ecl-lng ecl) procedure
(ecl-lat ecl) procedure
Equatorial Coordinates
(make-equ #!optional ra dec) procedure

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 equ) procedure
(equ-dec equ) procedure
Horizontal Coordinates
(make-hrz #!optional azimuth altitude) procedure
(hrz-az hrz) procedure
(hrz-alt hrz) procedure
Hours, Minutes, Seconds
(make-hms #!optional hours minuts seconds) procedure
(hms-hours hms) procedure
(hms-minutes hms) procedure
(hms-seconds hms) procedure
Nutation
(make-nutation #!optional longitude obliquity ecliptic) procedure
(nutation-longitude nutation) procedure
(nutation-obliquity nutation) procedure
(nutation-ecliptic nutation) procedure
Orbital Elements
Elliptic Orbital Elements
(make-ell #!optional a e i w omega n jd) procedure
(ell-a ell) procedure
(ell-e ell) procedure
(ell-i ell) procedure
(ell-w ell) procedure
(ell-omega ell) procedure
(ell-n ell) procedure
(ell-jd ell) procedure
Hyperbolic Orbital Elements
(make-hyp #!optional q e i w omega jd) procedure
(hyp-q hyp) procedure
(hyp-e hyp) procedure
(hyp-i hyp) procedure
(hyp-w hyp) procedure
(hyp-omega hyp) procedure
(hyp-jd hyp) procedure
Parabolic Orbital Elements
(make-par #!optional q i w omega jd) procedure
(par-q par) procedure
(par-i par) procedure
(par-w par) procedure
(par-omega par) procedure
(par-jd par) procedure

Sidereal Time

(gmst jd) procedure
(gast jd) procedure
(lmst jd longitude) procedure
(last jd longitude) procedure

Utility

(get-version) procedure
(rad->deg rad) procedure
(deg->rad deg) procedure
(hms->deg hms) procedure
(deg->hms deg) procedure
(get-date) procedure
(vsop87->fk5 helio jd) procedure

Rise, Set, Transit

(object-rst jd ecl-observer equ-object) procedure
(object-next-rst jd ecl-observer equ-object) procedure
(object-next-rst-horizon jd ecl-observer equ-object horizon) procedure
(body-rst-horizon jd ecl-observer body-object horizon) procedure
(body-next-rst-horizon jd ecl-observer body-object horizon) procedure
(body-next-rst-horizon-future jd ecl-observer body-object horizon day-limit) procedure

Motion

Elliptic Motion
(solve-kepler e M) procedure
(ell-mean-anomaly n delta-jd) procedure
(ell-true-anomaly e E) procedure
(ell-radius-vector a e E) procedure
(ell-smajor-diam e q) procedure
(ell-sminor-diam e a) procedure
(ell-mean-motion a) procedure
(ell-geo-rect-posn ell jd) procedure
(ell-helio-rect-posn ell jd) procedure
(ell-orbit-len ell) procedure
(ell-orbit-vel jd ell) procedure
(ell-orbit-pvel ell) procedure
(ell-orbit-avel ell) procedure
(ell-body-phase-angle jd ell) procedure
(ell-body-elong jd ell) procedure
(ell-body-solar-dist jd ell) procedure
(ell-body-earth-dist jd ell) procedure
(ell-body-equ-coords jd ell) procedure
(ell-body-rst jd ecl) procedure
(ell-body-rst-horizon jd ecl ell horizon) procedure
(ell-body-next-rst-horizon jd ecl ell horizon) procedure
(ell-body-next-rst-horizon-future jd ecl ell horizon day-limit) procedure
(ell-last-perihelion epoch-jd M n) procedure
Hyperbolic Motion
(solve-hyp-barker Q1 G t) procedure
(hyp-true-anomaly q e t) procedure
(hyp-radius-vector q e t) procedure
(hyp-geo-rect-posn h) procedure
(hyp-helio-rect-posn hyp jd) procedure
(hyp-body-equ-coords jd hyp) procedure
(hyp-body-earth-dist jd hyp) procedure
(hyp-body-solar-dist jd hyp) procedure
(hyp-body-phase-angle jd hyp) procedure
(hyp-body-elong jd hyp) procedure
(hyp-body-rst jd ecl hyp) procedure
(hyp-body-rst-horizon jd ecl hyp horizon) procedure
(hyp-body-next-rst-horizon jd ecl hyp horizon) procedure
(hyp-body-next-rst-horizon-future jd ecl hyp horizon day-limit) procedure
Parabolic Motion
(solve-barker q t) procedure
(par-true-anomaly q t) procedure
(par-radius-vector q t) procedure
(par-geo-rect-posn par jd) procedure
(par-helio-rect-posn par jd) procedure
(par-body-equ-coords jd par) procedure
(par-body-earth-dist jd par) procedure
(par-body-solar-dist jd par) procedure
(par-body-phase-angle jd par) procedure
(par-body-elong jd par) procedure
(par-body-rst jd ecl par) procedure
(par-body-rst-horizon jd ecl par horizon) procedure
(par-body-next-rst-horizon jd ecl par horizon) procedure
(par-body-next-rst-horizon-future jd ecl par horizon day-limit) procedure

Bodies

Sun
(solar-rst-horizon jd ecl horizon) procedure
(solar-rst jd ecl) procedure
(solar-geom-coords jd) procedure
(solar-equ-coords jd) procedure
(solar-ecl-coords jd) procedure
(solar-geo-coords jd) procedure
(solar-sdiam jd) procedure
Earth
(earth-helio-coords jd) procedure
(earth-solar-dist jd) procedure
(earth-rect-helio jd) procedure
(earth-centre-dist height latitude) procedure
Moon
(lunar-phase jd) procedure
(lunar-disk jd) procedure
(lunar-sdiam jd) procedure
(lunar-earth-dist jd) procedure
(lunar-bright-limb jd) procedure
(lunar-long-asc-node jd) procedure
(lunar-long-perigee jd) procedure
(lunar-equ-coords jd precision) procedure
(lunar-rst jd ecl) procedure
(lunar-geo-posn jd precision) procedure
(lunar-equ-coords-prec jd precision) procedure
(lunar-ecl-coords jd precision) procedure

Mercury

(mercury-sdiam jd) procedure
(mercury-rst jd ecl) procedure
(mercury-helio-coords jd) procedure
(mercury-equ-coords jd) procedure
(mercury-earth-dist jd) procedure
(mercury-solar-dist jd) procedure
(mercury-magnitude jd) procedure
(mercury-disk jd) procedure
(mercury-phase jd) procedure
(mercury-rect-helio jd) procedure
Venus
(venus-sdiam jd) procedure
(venus-rst jd ecl) procedure
(venus-helio-coords jd) procedure
(venus-equ-coords jd) procedure
(venus-earth-dist jd) procedure
(venus-solar-dist jd) procedure
(venus-magnitude jd) procedure
(venus-disk jd) procedure
(venus-phase jd) procedure
(venus-rect-helio jd) procedure
Mars
(mars-sdiam jd) procedure
(mars-rst jd ecl) procedure
(mars-helio-coords jd) procedure
(mars-equ-coords jd) procedure
(mars-earth-dist jd) procedure
(mars-solar-dist jd) procedure
(mars-magnitude jd) procedure
(mars-disk jd) procedure
(mars-phase jd) procedure
(mars-rect-helio jd) procedure
Jupiter
(jupiter-equ-sdiam jd) procedure
(jupiter-pol-sdiam jd) procedure
(jupiter-rst jd ecl) procedure
(jupiter-helio-coords jd) procedure
(jupiter-equ-coords jd) procedure
(jupiter-earth-dist jd) procedure
(jupiter-solar-dist jd) procedure
(jupiter-magnitude jd) procedure
(jupiter-disk jd) procedure
(jupiter-phase jd) procedure
(jupiter-rect-helio jd) procedure
Saturn
(saturn-equ-sdiam jd) procedure
(saturn-pol-sdiam jd) procedure
(saturn-rst jd ecl) procedure
(saturn-helio-coords jd) procedure
(saturn-equ-coords jd) procedure
(saturn-earth-dist jd) procedure
(saturn-solar-dist jd) procedure
(saturn-magnitude jd) procedure
(saturn-disk jd) procedure
(saturn-phase jd) procedure
(saturn-rect-helio jd) procedure
Uranus
(uranus-sdiam jd) procedure
(uranus-rst jd ecl) procedure
(uranus-helio-coords jd) procedure
(uranus-equ-coords jd) procedure
(uranus-earth-dist jd) procedure
(uranus-solar-dist jd) procedure
(uranus-magnitude jd) procedure
(uranus-disk jd) procedure
(uranus-phase jd) procedure
(uranus-rect-helio jd) procedure
Neptune
(neptune-sdiam jd) procedure
(neptune-rst jd ecl) procedure
(neptune-helio-coords jd) procedure
(neptune-equ-coords jd) procedure
(neptune-earth-dist jd) procedure
(neptune-solar-dist jd) procedure
(neptune-magnitude jd) procedure
(neptune-disk jd) procedure
(neptune-phase jd) procedure
(neptune-rect-helio jd) procedure
Pluto
(pluto-sdiam jd) procedure
(pluto-rst jd ecl) procedure
(pluto-helio-coords jd) procedure
(pluto-equ-coords jd) procedure
(pluto-earth-dist jd) procedure
(pluto-solar-dist jd) procedure
(pluto-magnitude jd) procedure
(pluto-disk jd) procedure
(pluto-phase jd) procedure
(pluto-rect-helio jd) procedure

Misc

(heliocentric-time-diff jd equ) procedure
(refraction-adj altitude atm-pressure temp) procedure
(equ-aberration equ jd) procedure
(ecl-aberration equ jd) procedure
(dynamical-time-diff jde) procedure
(jde jd) procedure
(angular-separation equ equ) procedure
(rel-posn-angle equ equ) procedure
(constellation) procedure
(apparent-posn equ-mean equ-proper jd) procedure
(nutation jd) procedure
(equ-prec equ-mean jd) procedure
(equ-prec2 equ-mean jd jd) procedure
(ecl-prec ecl jd) procedure
(ell-comet-mag jd ell g k) procedure
(par-comet-mag jd par g k) procedure

Transforms

(hrz-from-equ equ ecl jd) procedure
(hrz-from-equ-sidereal-time equ ecl sidereal) procedure
(equ-from-ecl ecl jd) procedure
(ecl-from-equ equ jd) procedure
(rect-from-helio helio) procedure
(ecl-from-rect rect) procedure
(equ-from-gal gal) procedure
(equ2000-from-gal gal) procedure
(gal-from-equ equ) procedure
(gal-from-equ2000 equ) procedure

Non-Libnova

(range-hours hours) procedure
(range-degrees degrees) procedure
(range-degrees180 degrees) procedure
(is-above-horizon? equ ecl jd) procedure
(dms->deg dms) procedure
(hms->hr hms) procedure

Examples

(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))
(newline)

License

LGPL-3.0

Version History

1.0 Initial Release

Contents »