((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/ephem" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "Ephem" (toc) (section 3 "Description" (p (tt "ephem") " is a wrapper for " (link "http://libnova.sourceforge.net" "libnova") " a \"general purpose, double precision, Celestial Mechanics, Astrometry and Astrodynamics library.\"")) (section 3 "Author" (p (link "https://github.com/RobAltenburg" "Rob Altenburg"))) (section 3 "Requirements" (p (int-link "/egg/numbers" "numbers") ", " (int-link "/egg/srfi-19" "srfi-19") ", " (int-link "/egg/foreigners" "foreigners"))) (section 3 "Installation" (p (tt "ephem") " requires " (link "http://libnova.sourceforge.net" "libnova") " v0.16. That version is available from the " (link "https://sourceforge.net/p/libnova/libnova/ci/master/tree/" "git repository") ".")) (section 3 "Procedures" (p "The libnova " (link "http://libnova.sourceforge.net/modules.html" "modules") " documentation provides essential details.  Main differences from that library are:") (ul (li (tt "ephem") " function names are separated with dashes instead of underscores and the \"ln\" or \"ln_get\" prefix is omitted.") (li (tt "ephem") " functions are not passed structures to hold results--when necessary they allocate and return a new object of the required foreign type.") (li (int-link "/egg/srfi-19" "srfi-19") " date functions are used instead of equivalent libnova functions.")) (section 4 "Data Types" (section 5 "Rise, Set, Transit" (def (sig (procedure "(make-rst #!optional rise set transit)" (id make-rst))) (p "Returns a ln_rst_time foreign record type.  If rise, set, or transit is not specified an empty structure is allocated and returned.") (p "Rise, set, and transit are Julian dates as returned by " (tt "srfi-19") "'s (date->julian-day) function.") (p "Note that I didn't expose the setters to mutate existing records of a given type.")) (def (sig (procedure "(rst-rise rst)" (id rst-rise)))) (def (sig (procedure "(rst-set rst)" (id rst-set)))) (def (sig (procedure "(rst-transit rst)" (id rst-transit))))) (section 5 "Rectangular Coordinates " (def (sig (procedure "(make-rect #!optional x y x)" (id make-rect)) (procedure "(rect-x rect)" (id rect-x)) (procedure "(rect-y rect)" (id rect-y)) (procedure "(rect-z rect)" (id rect-z))))) (section 5 "Heliocentric Coordinates" (def (sig (procedure "(make-helio #!optional l b r)" (id make-helio)) (procedure "(helio-l helio)" (id helio-l)) (procedure "(helio-b helio)" (id helio-b)) (procedure "(helio-r helio)" (id helio-r))))) (section 5 "Longitude and Latitude" (def (sig (procedure "(make-ecl #!optional longitude latitude)" (id make-ecl)) (procedure "(ecl-lng ecl)" (id ecl-lng)) (procedure "(ecl-lat ecl)" (id ecl-lat))))) (section 5 "Equatorial Coordinates" (def (sig (procedure "(make-equ #!optional ra dec)" (id make-equ))) (p "Note:  Right ascension and declination are both expressed in degrees, right ascensions given in h:m:s must be converted:") (highlight scheme "(hms->deg 12 30 1)")) (def (sig (procedure "(equ-ra equ)" (id equ-ra)) (procedure "(equ-dec equ)" (id equ-dec))))) (section 5 "Horizontal Coordinates" (def (sig (procedure "(make-hrz #!optional azimuth altitude)" (id make-hrz)) (procedure "(hrz-az hrz)" (id hrz-az)) (procedure "(hrz-alt hrz)" (id hrz-alt))))) (section 5 "Hours, Minutes, Seconds" (def (sig (procedure "(make-hms #!optional hours minuts seconds)" (id make-hms)) (procedure "(hms-hours hms)" (id hms-hours)) (procedure "(hms-minutes hms)" (id hms-minutes)) (procedure "(hms-seconds hms)" (id hms-seconds))))) (section 5 "Nutation" (def (sig (procedure "(make-nutation #!optional longitude obliquity ecliptic)" (id make-nutation)) (procedure "(nutation-longitude nutation)" (id nutation-longitude)) (procedure "(nutation-obliquity nutation)" (id nutation-obliquity)) (procedure "(nutation-ecliptic nutation)" (id nutation-ecliptic))))) (section 5 "Orbital Elements" (section 6 "Elliptic Orbital Elements" (def (sig (procedure "(make-ell #!optional a e i w omega n jd)" (id make-ell)) (procedure "(ell-a ell)" (id ell-a)) (procedure "(ell-e ell)" (id ell-e)) (procedure "(ell-i ell)" (id ell-i)) (procedure "(ell-w ell)" (id ell-w)) (procedure "(ell-omega ell)" (id ell-omega)) (procedure "(ell-n ell)" (id ell-n)) (procedure "(ell-jd ell)" (id ell-jd))))) (section 6 "Hyperbolic Orbital Elements" (def (sig (procedure "(make-hyp #!optional q e i w omega jd)" (id make-hyp)) (procedure "(hyp-q hyp)" (id hyp-q)) (procedure "(hyp-e hyp)" (id hyp-e)) (procedure "(hyp-i hyp)" (id hyp-i)) (procedure "(hyp-w hyp)" (id hyp-w)) (procedure "(hyp-omega hyp)" (id hyp-omega)) (procedure "(hyp-jd hyp)" (id hyp-jd))))) (section 6 "Parabolic Orbital Elements" (def (sig (procedure "(make-par #!optional q i w omega jd)" (id make-par)) (procedure "(par-q par)" (id par-q)) (procedure "(par-i par)" (id par-i)) (procedure "(par-w par)" (id par-w)) (procedure "(par-omega par)" (id par-omega)) (procedure "(par-jd par)" (id par-jd))))))) (section 4 "Sidereal Time" (def (sig (procedure "(gmst jd)" (id gmst)) (procedure "(gast jd)" (id gast)) (procedure "(lmst jd longitude)" (id lmst)) (procedure "(last jd longitude)" (id last))))) (section 4 "Utility" (def (sig (procedure "(get-version)" (id get-version)) (procedure "(rad->deg rad)" (id rad->deg)) (procedure "(deg->rad deg)" (id deg->rad)) (procedure "(hms->deg hms)" (id hms->deg)) (procedure "(deg->hms deg)" (id deg->hms)) (procedure "(get-date)" (id get-date)) (procedure "(vsop87->fk5 helio jd)" (id vsop87->fk5))))) (section 4 "Rise, Set, Transit" (def (sig (procedure "(object-rst jd ecl-observer equ-object)" (id object-rst)) (procedure "(object-next-rst jd ecl-observer equ-object)" (id object-next-rst)) (procedure "(object-next-rst-horizon jd ecl-observer equ-object horizon)" (id object-next-rst-horizon)) (procedure "(body-rst-horizon jd ecl-observer body-object horizon)" (id body-rst-horizon)) (procedure "(body-next-rst-horizon jd ecl-observer body-object horizon)" (id body-next-rst-horizon)) (procedure "(body-next-rst-horizon-future jd ecl-observer body-object horizon day-limit)" (id body-next-rst-horizon-future))))) (section 4 "Motion" (section 5 "Elliptic Motion" (def (sig (procedure "(solve-kepler e M)" (id solve-kepler)) (procedure "(ell-mean-anomaly n delta-jd)" (id ell-mean-anomaly)) (procedure "(ell-true-anomaly e E)" (id ell-true-anomaly)) (procedure "(ell-radius-vector a e E)" (id ell-radius-vector)) (procedure "(ell-smajor-diam e q)" (id ell-smajor-diam)) (procedure "(ell-sminor-diam e a)" (id ell-sminor-diam)) (procedure "(ell-mean-motion a)" (id ell-mean-motion)) (procedure "(ell-geo-rect-posn ell jd)" (id ell-geo-rect-posn)) (procedure "(ell-helio-rect-posn ell jd)" (id ell-helio-rect-posn)) (procedure "(ell-orbit-len ell)" (id ell-orbit-len)) (procedure "(ell-orbit-vel jd ell)" (id ell-orbit-vel)) (procedure "(ell-orbit-pvel ell)" (id ell-orbit-pvel)) (procedure "(ell-orbit-avel ell)" (id ell-orbit-avel)) (procedure "(ell-body-phase-angle jd ell)" (id ell-body-phase-angle)) (procedure "(ell-body-elong jd ell)" (id ell-body-elong)) (procedure "(ell-body-solar-dist jd ell)" (id ell-body-solar-dist)) (procedure "(ell-body-earth-dist jd ell)" (id ell-body-earth-dist)) (procedure "(ell-body-equ-coords jd ell)" (id ell-body-equ-coords)) (procedure "(ell-body-rst jd ecl)" (id ell-body-rst)) (procedure "(ell-body-rst-horizon jd ecl ell horizon)" (id ell-body-rst-horizon)) (procedure "(ell-body-next-rst-horizon jd ecl ell horizon)" (id ell-body-next-rst-horizon)) (procedure "(ell-body-next-rst-horizon-future jd ecl ell horizon day-limit)" (id ell-body-next-rst-horizon-future)) (procedure "(ell-last-perihelion epoch-jd M n)" (id ell-last-perihelion))))) (section 5 "Hyperbolic Motion" (def (sig (procedure "(solve-hyp-barker Q1 G t)" (id solve-hyp-barker)) (procedure "(hyp-true-anomaly q e t)" (id hyp-true-anomaly)) (procedure "(hyp-radius-vector q e t)" (id hyp-radius-vector)) (procedure "(hyp-geo-rect-posn h)" (id hyp-geo-rect-posn)) (procedure "(hyp-helio-rect-posn hyp jd)" (id hyp-helio-rect-posn)) (procedure "(hyp-body-equ-coords jd hyp)" (id hyp-body-equ-coords)) (procedure "(hyp-body-earth-dist jd hyp)" (id hyp-body-earth-dist)) (procedure "(hyp-body-solar-dist jd hyp)" (id hyp-body-solar-dist)) (procedure "(hyp-body-phase-angle jd hyp)" (id hyp-body-phase-angle)) (procedure "(hyp-body-elong jd hyp)" (id hyp-body-elong)) (procedure "(hyp-body-rst jd ecl hyp)" (id hyp-body-rst)) (procedure "(hyp-body-rst-horizon jd ecl hyp horizon)" (id hyp-body-rst-horizon)) (procedure "(hyp-body-next-rst-horizon jd ecl hyp horizon)" (id hyp-body-next-rst-horizon)) (procedure "(hyp-body-next-rst-horizon-future jd ecl hyp horizon day-limit)" (id hyp-body-next-rst-horizon-future))))) (section 5 "Parabolic Motion" (def (sig (procedure "(solve-barker q t)" (id solve-barker)) (procedure "(par-true-anomaly q t)" (id par-true-anomaly)) (procedure "(par-radius-vector q t)" (id par-radius-vector)) (procedure "(par-geo-rect-posn par jd)" (id par-geo-rect-posn)) (procedure "(par-helio-rect-posn par jd)" (id par-helio-rect-posn)) (procedure "(par-body-equ-coords jd par)" (id par-body-equ-coords)) (procedure "(par-body-earth-dist jd par)" (id par-body-earth-dist)) (procedure "(par-body-solar-dist jd par)" (id par-body-solar-dist)) (procedure "(par-body-phase-angle jd par)" (id par-body-phase-angle)) (procedure "(par-body-elong jd par)" (id par-body-elong)) (procedure "(par-body-rst jd ecl par)" (id par-body-rst)) (procedure "(par-body-rst-horizon jd ecl par horizon)" (id par-body-rst-horizon)) (procedure "(par-body-next-rst-horizon jd ecl par horizon)" (id par-body-next-rst-horizon)) (procedure "(par-body-next-rst-horizon-future jd ecl par horizon day-limit)" (id par-body-next-rst-horizon-future)))))) (section 4 "Bodies " (section 5 "Sun" (def (sig (procedure "(solar-rst-horizon jd ecl horizon)" (id solar-rst-horizon)) (procedure "(solar-rst jd ecl)" (id solar-rst)) (procedure "(solar-geom-coords jd)" (id solar-geom-coords)) (procedure "(solar-equ-coords jd)" (id solar-equ-coords)) (procedure "(solar-ecl-coords jd)" (id solar-ecl-coords)) (procedure "(solar-geo-coords jd)" (id solar-geo-coords)) (procedure "(solar-sdiam jd)" (id solar-sdiam))))) (section 5 "Earth" (def (sig (procedure "(earth-helio-coords jd)" (id earth-helio-coords)) (procedure "(earth-solar-dist jd)" (id earth-solar-dist)) (procedure "(earth-rect-helio jd)" (id earth-rect-helio)) (procedure "(earth-centre-dist height latitude)" (id earth-centre-dist))))) (section 5 "Moon" (def (sig (procedure "(lunar-phase jd)" (id lunar-phase)) (procedure "(lunar-disk jd)" (id lunar-disk)) (procedure "(lunar-sdiam jd)" (id lunar-sdiam)) (procedure "(lunar-earth-dist jd)" (id lunar-earth-dist)) (procedure "(lunar-bright-limb jd)" (id lunar-bright-limb)) (procedure "(lunar-long-asc-node jd)" (id lunar-long-asc-node)) (procedure "(lunar-long-perigee jd)" (id lunar-long-perigee)) (procedure "(lunar-equ-coords jd precision)" (id lunar-equ-coords)) (procedure "(lunar-rst jd ecl)" (id lunar-rst)) (procedure "(lunar-geo-posn jd precision)" (id lunar-geo-posn)) (procedure "(lunar-equ-coords-prec jd precision)" (id lunar-equ-coords-prec)) (procedure "(lunar-ecl-coords jd precision)" (id lunar-ecl-coords)))))) (section 4 "Mercury" (def (sig (procedure "(mercury-sdiam jd)" (id mercury-sdiam)) (procedure "(mercury-rst jd ecl)" (id mercury-rst)) (procedure "(mercury-helio-coords jd)" (id mercury-helio-coords)) (procedure "(mercury-equ-coords jd)" (id mercury-equ-coords)) (procedure "(mercury-earth-dist jd)" (id mercury-earth-dist)) (procedure "(mercury-solar-dist jd)" (id mercury-solar-dist)) (procedure "(mercury-magnitude jd)" (id mercury-magnitude)) (procedure "(mercury-disk jd)" (id mercury-disk)) (procedure "(mercury-phase jd)" (id mercury-phase)) (procedure "(mercury-rect-helio jd)" (id mercury-rect-helio)))) (section 5 "Venus" (def (sig (procedure "(venus-sdiam jd)" (id venus-sdiam)) (procedure "(venus-rst jd ecl)" (id venus-rst)) (procedure "(venus-helio-coords jd)" (id venus-helio-coords)) (procedure "(venus-equ-coords jd)" (id venus-equ-coords)) (procedure "(venus-earth-dist jd)" (id venus-earth-dist)) (procedure "(venus-solar-dist jd)" (id venus-solar-dist)) (procedure "(venus-magnitude jd)" (id venus-magnitude)) (procedure "(venus-disk jd)" (id venus-disk)) (procedure "(venus-phase jd)" (id venus-phase)) (procedure "(venus-rect-helio jd)" (id venus-rect-helio))))) (section 5 "Mars" (def (sig (procedure "(mars-sdiam jd)" (id mars-sdiam)) (procedure "(mars-rst jd ecl)" (id mars-rst)) (procedure "(mars-helio-coords jd)" (id mars-helio-coords)) (procedure "(mars-equ-coords jd)" (id mars-equ-coords)) (procedure "(mars-earth-dist jd)" (id mars-earth-dist)) (procedure "(mars-solar-dist jd)" (id mars-solar-dist)) (procedure "(mars-magnitude jd)" (id mars-magnitude)) (procedure "(mars-disk jd)" (id mars-disk)) (procedure "(mars-phase jd)" (id mars-phase)) (procedure "(mars-rect-helio jd)" (id mars-rect-helio))))) (section 5 "Jupiter" (def (sig (procedure "(jupiter-equ-sdiam jd)" (id jupiter-equ-sdiam)) (procedure "(jupiter-pol-sdiam jd)" (id jupiter-pol-sdiam)) (procedure "(jupiter-rst jd ecl)" (id jupiter-rst)) (procedure "(jupiter-helio-coords jd)" (id jupiter-helio-coords)) (procedure "(jupiter-equ-coords jd)" (id jupiter-equ-coords)) (procedure "(jupiter-earth-dist jd)" (id jupiter-earth-dist)) (procedure "(jupiter-solar-dist jd)" (id jupiter-solar-dist)) (procedure "(jupiter-magnitude jd)" (id jupiter-magnitude)) (procedure "(jupiter-disk jd)" (id jupiter-disk)) (procedure "(jupiter-phase jd)" (id jupiter-phase)) (procedure "(jupiter-rect-helio jd)" (id jupiter-rect-helio))))) (section 5 "Saturn" (def (sig (procedure "(saturn-equ-sdiam jd)" (id saturn-equ-sdiam)) (procedure "(saturn-pol-sdiam jd)" (id saturn-pol-sdiam)) (procedure "(saturn-rst jd ecl)" (id saturn-rst)) (procedure "(saturn-helio-coords jd)" (id saturn-helio-coords)) (procedure "(saturn-equ-coords jd)" (id saturn-equ-coords)) (procedure "(saturn-earth-dist jd)" (id saturn-earth-dist)) (procedure "(saturn-solar-dist jd)" (id saturn-solar-dist)) (procedure "(saturn-magnitude jd)" (id saturn-magnitude)) (procedure "(saturn-disk jd)" (id saturn-disk)) (procedure "(saturn-phase jd)" (id saturn-phase)) (procedure "(saturn-rect-helio jd)" (id saturn-rect-helio))))) (section 5 "Uranus" (def (sig (procedure "(uranus-sdiam jd)" (id uranus-sdiam)) (procedure "(uranus-rst jd ecl)" (id uranus-rst)) (procedure "(uranus-helio-coords jd)" (id uranus-helio-coords)) (procedure "(uranus-equ-coords jd)" (id uranus-equ-coords)) (procedure "(uranus-earth-dist jd)" (id uranus-earth-dist)) (procedure "(uranus-solar-dist jd)" (id uranus-solar-dist)) (procedure "(uranus-magnitude jd)" (id uranus-magnitude)) (procedure "(uranus-disk jd)" (id uranus-disk)) (procedure "(uranus-phase jd)" (id uranus-phase)) (procedure "(uranus-rect-helio jd)" (id uranus-rect-helio))))) (section 5 "Neptune" (def (sig (procedure "(neptune-sdiam jd)" (id neptune-sdiam)) (procedure "(neptune-rst jd ecl)" (id neptune-rst)) (procedure "(neptune-helio-coords jd)" (id neptune-helio-coords)) (procedure "(neptune-equ-coords jd)" (id neptune-equ-coords)) (procedure "(neptune-earth-dist jd)" (id neptune-earth-dist)) (procedure "(neptune-solar-dist jd)" (id neptune-solar-dist)) (procedure "(neptune-magnitude jd)" (id neptune-magnitude)) (procedure "(neptune-disk jd)" (id neptune-disk)) (procedure "(neptune-phase jd)" (id neptune-phase)) (procedure "(neptune-rect-helio jd)" (id neptune-rect-helio))))) (section 5 "Pluto" (def (sig (procedure "(pluto-sdiam jd)" (id pluto-sdiam)) (procedure "(pluto-rst jd ecl)" (id pluto-rst)) (procedure "(pluto-helio-coords jd)" (id pluto-helio-coords)) (procedure "(pluto-equ-coords jd)" (id pluto-equ-coords)) (procedure "(pluto-earth-dist jd)" (id pluto-earth-dist)) (procedure "(pluto-solar-dist jd)" (id pluto-solar-dist)) (procedure "(pluto-magnitude jd)" (id pluto-magnitude)) (procedure "(pluto-disk jd)" (id pluto-disk)) (procedure "(pluto-phase jd)" (id pluto-phase)) (procedure "(pluto-rect-helio jd)" (id pluto-rect-helio)))))) (section 4 "Misc" (def (sig (procedure "(heliocentric-time-diff jd equ)" (id heliocentric-time-diff)) (procedure "(refraction-adj altitude atm-pressure temp)" (id refraction-adj)) (procedure "(equ-aberration equ jd)" (id equ-aberration)) (procedure "(ecl-aberration equ jd)" (id ecl-aberration)) (procedure "(dynamical-time-diff jde)" (id dynamical-time-diff)) (procedure "(jde jd)" (id jde)) (procedure "(angular-separation equ equ)" (id angular-separation)) (procedure "(rel-posn-angle equ equ)" (id rel-posn-angle)) (procedure "(constellation)" (id constellation)) (procedure "(apparent-posn equ-mean equ-proper jd)" (id apparent-posn)) (procedure "(nutation jd)" (id nutation)) (procedure "(equ-prec equ-mean jd)" (id equ-prec)) (procedure "(equ-prec2 equ-mean jd jd)" (id equ-prec2)) (procedure "(ecl-prec ecl jd)" (id ecl-prec)) (procedure "(ell-comet-mag jd ell g k)" (id ell-comet-mag)) (procedure "(par-comet-mag jd par g k)" (id par-comet-mag))))) (section 4 "Transforms" (def (sig (procedure "(hrz-from-equ equ ecl jd)" (id hrz-from-equ)) (procedure "(hrz-from-equ-sidereal-time equ ecl sidereal)" (id hrz-from-equ-sidereal-time)) (procedure "(equ-from-ecl ecl jd)" (id equ-from-ecl)) (procedure "(ecl-from-equ equ jd)" (id ecl-from-equ)) (procedure "(rect-from-helio helio)" (id rect-from-helio)) (procedure "(ecl-from-rect rect)" (id ecl-from-rect)) (procedure "(equ-from-gal gal)" (id equ-from-gal)) (procedure "(equ2000-from-gal gal)" (id equ2000-from-gal)) (procedure "(gal-from-equ equ)" (id gal-from-equ)) (procedure "(gal-from-equ2000 equ)" (id gal-from-equ2000))))) (section 4 "Non-Libnova" (def (sig (procedure "(range-hours hours)" (id range-hours)) (procedure "(range-degrees degrees)" (id range-degrees)) (procedure "(range-degrees180 degrees)" (id range-degrees180)) (procedure "(is-above-horizon? equ ecl jd)" (id is-above-horizon?)) (procedure "(dms->deg dms)" (id dms->deg)) (procedure "(hms->hr hms)" (id hms->hr)))))) (section 3 "Examples" (highlight scheme "(use numbers srfi-19 ephem)\n\n; set time using srfi-19\n(define dd (exact->inexact (date->julian-day \n                             (make-date 0 0 30 7 13 12 2016 (* 3600 0)  #f))))\n\n; set the longitude and latitude of the observer\n(define my-ecl (make-ecl -76.8867 40.2732))\n\n; calculate the Sun's rise, set, and transit using different methods\n(define rst (solar-rst dd my-ecl))\n\n; print the Julian date of the rise time\n(display (rst-rise rst))\n(newline)\n")) (section 3 "License" (p "LGPL-3.0")) (section 3 "Version History" (dl (dt "1.0 Initial Release")))))