Swephr Swiss Ephemeris
Swephr Swiss Ephemeris
July 8, 2019
Type Package
Title High Precision Swiss Ephemeris
Version 0.2.1
Description The Swiss Ephemeris (version 2.08) is a high precision ephemeris based upon the
DE431 ephemerides from NASA's JPL. It covers the time range 13201 BCE to
17191 CE. This package uses the semi-analytic theory by Steve Moshier.
For faster and more accurate calculations, the compressed Swiss Ephemeris
data is available in the 'swephRdata' package. To access this data package,
run 'install.packages(``swephRdata'', repos = ``https://rstub.github.io/drat/'',
type = ``source'')'. The size of the 'swephRdata' package is approximately
115 MB. The user can also use the original JPL DE431 data.
License AGPL | file LICENSE
Imports Rcpp (>= 0.12.18)
LinkingTo Rcpp
RoxygenNote 6.1.1
Suggests testthat, swephRdata, knitr, rmarkdown
Encoding UTF-8
URL https://github.com/rstub/swephR/, https://rstub.github.io/swephR/,
http://www.astro.com/swisseph/
BugReports https://github.com/rstub/swephR/issues/
Additional_repositories https://rstub.github.io/drat
VignetteBuilder knitr
LazyData true
NeedsCompilation yes
Author Ralf Stubner [aut, cre],
Victor Reijs [aut],
Authors and copyright holder of the Swiss Ephemeris [aut, cph] (see
LICENSE for details)
Maintainer Ralf Stubner <[email protected]>
Repository CRAN
Date/Publication 2019-07-08 10:30:02 UTC
1
2 swephR-package
R topics documented:
swephR-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
SE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Section1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Section10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Section13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Section14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Section15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Section16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Section2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Section3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Section4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Section6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Section7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Section8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Section9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Index 20
Description
The Swiss Ephemeris (version 2.08) is a high precision ephemeris based upon the DE431 ephemerides
from NASA’s JPL. It covers the time range 13201 BCE to 17191 CE. This package uses the semi-
analytic theory by Steve Moshier. For faster and more accurate calculations, the compressed Swiss
Ephemeris data is available in the ’swephRdata’ package. To access this data package, run ’in-
stall.packages("swephRdata", repos = "https://rstub.github.io/drat/", type = "source")’. The size of
the ’swephRdata’ package is approximately 115 MB. The user can also use the original JPL DE431
data.
Author(s)
Maintainer: Ralf Stubner <[email protected]>
Authors:
• Victor Reijs
• Authors and copyright holder of the Swiss Ephemeris (see LICENSE for details) [copyright
holder]
See Also
Useful links:
• https://github.com/rstub/swephR/
• http://www.astro.com/swisseph/
• Report bugs at https://github.com/rstub/swephR/issues/
SE 3
Description
• name of variable
• value of the variable
Usage
data(SE)
Format
Description
Usage
swe_set_ephe_path(path)
swe_close()
swe_set_jpl_file(fname)
swe_version()
Arguments
Details
swe_set_ephe_path() This is the first function that should be called before any other function of
the Swiss Ephemeris. Even if you don’t want to set an ephemeris path and use the Moshier
ephemeris, it is nevertheless recommended to call swe_set_ephe_path(NULL), because this
function makes important initializations. If you don’t do that, the Swiss Ephemeris may work,
but the results may be not 100% consistent.
swe_close() At the end of your computations this function releases most resources (open files and
allocated memory) used by Swiss Ephemeris.
swe_set_jpl_file() Set name of JPL ephemeris file.
swe_version() The function provides the version number of the Swiss Ephemeris software.
Value
See Also
Section 1 in http://www.astro.com/swisseph/swephprg.htm
Examples
## Not run: swe_set_ephe_path("c:\\sweph\\ephe")
swe_close()
swe_set_jpl_file("de431.eph")
swe_version()
Description
Usage
swe_get_ayanamsa_name(sid_mode)
swe_get_ayanamsa_ex_ut(jd_ut, iflag)
swe_get_ayanamsa_ex(jd_et, iflag)
Section10 5
Arguments
Details
Value
See Also
Section 10 in http://www.astro.com/swisseph/swephprg.htm
Examples
data(SE)
swe_set_sid_mode(SE$SIDM_FAGAN_BRADLEY,0,0)
swe_get_ayanamsa_name(SE$SIDM_FAGAN_BRADLEY)
swe_get_ayanamsa_ex_ut(2458346.82639,SE$FLG_MOSEPH)
swe_get_ayanamsa_ex(2458346.82639,SE$FLG_MOSEPH)
6 Section13
Section13 Section 13: House cusp, ascendant and Medium Coeli calculations
Description
Calculate house cusp, ascendant, Medium Coeli, etc. calculations
Usage
swe_houses_ex(jd_ut, cuspflag, geolat, geolon, hsys)
swe_house_name(hsys)
Arguments
jd_ut UT Julian day number as double (day)
cuspflag cusp flag as integer (0 [tropical], SE$FLG_SIDEREAL, SE$FLG_RADIANS)
geolat geographic latitude as double (deg)
geolon geographic longitude as double (deg)
hsys house method, one-letter case sensitive as char
armc right ascension of the MC as double (deg)
eps ecliptic obliquity as double (deg)
Details
swe_houses_ex() Calculate houses’ cusps, ascendant, Medium Coeli (MC), etc.
swe_houses_armc() Calculate houses’ information from the right ascension of the Medium Coeli
(MC).
Value
swe_houses_ex returns a list with named entries: return status flag as integer, cusps cusps values
as double and ascmc ascendent, MCs. etc. as double.
swe_houses_armc returns a list with named entries: return status flag as integer, cusps cusps
values as double and ascmc ascendent, MCs, etc. as double.
swe_house_name returns the house name as string
See Also
Section 13 in http://www.astro.com/swisseph/swephprg.htm
Section14 7
Examples
swe_houses_ex(1234567, 0, 53, 0, 'B')
swe_houses_armc(12, 53, 23, 'B')
swe_house_name('G')
Description
Calculate house position of a given body.
Usage
swe_house_pos(armc, geolat, eps, hsys, xpin)
Arguments
armc right ascension of the MC as double (deg)
geolat geographic latitude as double (deg)
eps ecliptic obliquity as double (deg)
hsys house method, one-letter case sensitive as char
xpin longitude and latitude of the given body as numeric vector (deg)
jd_ut UT Julian day number as double (day)
ipl Body/planet as integer (SE$SUN=0, SE$MOON=1, ... SE$PLUTO=9)
starname Star name as string ("" for no star)
ephe_flag Ephemeris flag as integer (SE$FLG_JPLEPH=1, SE$FLG_SWIEPH=2 or SE$FLG_MOSEPH=4)
imeth Gauquelin method as integer (0, 1, 2, 3, 4 or 5)
geopos position as numeric vector (longitude, latitude, height)
atpress Atmospheric pressure as double (hPa)
attemp Atmospheric temperature as double (Celsius)
Details
swe_house_pos() Calculate house position of given body.
Value
swe_house_pos returns a list with named entries: return how far from body’s cusp as double, and
serr error message as string.
swe_gauquelin_sector returns a list with named entries: return status flag as integer, dgsect for
Gauquelin sector as double and serr error message as string
See Also
Section 14 in http://www.astro.com/swisseph/swephprg.htm
Examples
swe_house_pos(12, 53, 23, 'B', c(0,0))
data(SE)
swe_gauquelin_sector(1234567.5,SE$VENUS,"",SE$FLG_MOSEPH,0,c(0,50,10),1013.25,15)
Description
Calculate the sidereal time (in degrees).
Usage
swe_sidtime(jd_ut)
Arguments
jd_ut UT Julian day number as double (day)
Details
swe_sidtime() Determine the sidereal time.
Value
swe_sidtime returns the sidereal time as double (deg)
See Also
Section 15 in http://www.astro.com/swisseph/swephprg.htm
Examples
swe_sidtime(2451545)
Section16 9
Description
Useful functions
Usage
swe_day_of_week(jd)
Arguments
jd Julian day number as numeric vector (day)
Details
swe_day_of_week() Determine day of week from Julian day number.
Value
swe_day_of_week returns the day of week as integer vector (0 Monday .. 6 Sunday)
See Also
Section 16.7 in http://www.astro.com/swisseph/swephprg.htm
Examples
swe_day_of_week(1234.567)
Description
Computing positions of planets, asteroids, lunar nodes and apogees using Swiss Ephemeris.
Usage
swe_calc_ut(jd_ut, ipl, iflag)
Arguments
jd_ut UT Julian day number as double (day)
ipl Body/planet as integer (SE$SUN=0, SE$Moon=1, ... SE$PLUTO=9)
iflag Computation flag as integer, many options possible (section 2.3.1)
jd_et ET Julian day number as double (day)
Details
swe_calc_ut() It compute positions using UT.
swe_calc() It compute positions using ET.
Value
swe_calc_ut returns a list with named entries: return status flag as integer, xx information on
planet position, and serr error message as string.
swe_calc returns a list with named entries: return status flag as integer, xx updated star name as
string and serr error message as string.
See Also
Section 2 in http://www.astro.com/swisseph/swephprg.htm
Examples
data(SE)
swe_calc_ut(2458346.82639, SE$MOON, SE$FLG_MOSEPH)
swe_calc(2458346.82639, SE$MOON, SE$FLG_MOSEPH)
Description
Find a planetary or asteroid name.
Usage
swe_get_planet_name(ipl)
Arguments
ipl Body/planet as integer (SE$SUN=0, SE$Moon=1, ... SE$PLUTO=9)
Details
swe_get_planet_name() Convert object number into object name.
Section4 11
Value
See Also
Section 3 in http://www.astro.com/swisseph/swephprg.htm
Examples
data(SE)
swe_get_planet_name(SE$MOON)
Description
Usage
swe_fixstar2_mag(starname)
Arguments
Details
Value
swe_fixstar2_mag returns a list with named entries: return status flag as integer, starname up-
dated star name as string, mag magnitude of star as double, and serr for error message as string.
swe_fixstar2 returns a list with named entries: return status flag as integer, starname updated
star name as string, xx star phenomena as numeric vector, and serr error message as string.
swe_fixstar2_ut returns a list with named entries: return status flag as integer, starname up-
dated star name as string, xx star information as numeric vector, and serr for error message as
string.
See Also
Section 4 in http://www.astro.com/swisseph/swephprg.htm
Examples
data(SE)
swe_fixstar2_mag("sirius")
swe_set_topo(0,50,10)
swe_fixstar2("sirius",1234567,SE$FLG_TOPOCTR+SE$FLG_MOSEPH+SE$FLG_EQUATORIAL)
swe_fixstar2_ut("sirius",1234567,SE$FLG_TOPOCTR+SE$FLG_MOSEPH+SE$FLG_EQUATORIAL)
Description
Functions for: determining eclipse and occultation calculations, computing the times of rising,
setting and meridian transits for all planets, asteroids, the moon and the fixed stars; computing
phase, phase angle, elongation, apparent diameter, apparent magnitude for the Sun, the Moon, all
planets and asteroids; and determining heliacal phenomenon after a given start date
Usage
swe_sol_eclipse_when_loc(jd_start, ephe_flag, geopos, backward)
Arguments
jd_start Julian day number as double (UT)
ephe_flag Ephemeris flag as integer (SE$FLG_JPLEPH=1, SE$FLG_SWIEPH=2 or SE$FLG_MOSEPH=4)
geopos position as numeric vector (longitude, latitude, height)
backward backwards search as boolean (TRUE)
jd_ut UT Julian day number as double (day)
ifltype eclipse type as integer (SE$ECL_CENTRAL=1, SE$ECL_NONCENTRAL=2, SE$ECL_TOTAL=4,
SE$ECL_ANNULAR=8, SE$ECL_PARTIAL=16 or SE$ECL_ANNULAR_TOTAL=32)
ipl Body/planet as integer (SE$SUN=0, SE$MOON=1, ... SE$PLUTO=9)
starname Star name as string ("" for no star)
rsmi Event flag as integer (e.g.: SE$CALC_RISE=1, SE$CALC_SET=2, SE$CALC_MTRANSIT=4,
SE$CALC_ITRANSIT=8)
atpress Atmospheric pressure as double (hPa)
attemp Atmospheric temperature as double (Celsius)
horhgt Horizon apparent altitude as double (deg)
jd_et ET Julian day number as double (day)
coord_flag Coordinate flag as integer (reference system (SE$ECL2HOR=0 or SE$EQU2HOR=1))
xin Position of body as numeric vector (either ecliptical or equatorial coordinates,
depending on coord_flag)
InAlt object’s apparent/topocentric altitude as double (depending on calc_flag) (deg)
height observer’s height as double (m)
14 Section6
Details
swe_sol_eclipse_when_loc() Find the next solar eclipse for a given geographic position.
swe_lun_eclipse_when_loc() Find the next lunar eclipse for a given geographic position.
swe_rise_trans_true_hor() Compute the times of rising, setting and meridian transits for planets,
asteroids, the moon, and the fixed stars for a local horizon that has an altitude.
swe_pheno_ut() Compute phase, phase angle, elongation, apparent diameter, apparent magnitude
for the Sun, the Moon, all planets and asteroids (UT)
swe_pheno() Compute phase, phase angle, elongation, apparent diameter, apparent magnitude for
the Sun, the Moon, all planets and asteroids (ET).
swe_azalt() Compute the horizontal coordinates (azimuth and altitude) of a planet or a star from
either ecliptical or equatorial coordinates.
swe_azalt_rev() compute either ecliptical or equatorial coordinates from azimuth and true altitude.
If only an apparent altitude is given, the true altitude has to be computed first with e.g. the
function swe_refrac_extended().
swe_refrac_extended() Calculate either the topocentric altitude from the apparent altitude or the
apparent altitude from the topocentric altitude. It allows correct calculation of refraction for
heights above sea > 0, where the ideal horizon and planets that are visible may have a negative
altitude.
Section6 15
swe_heliacal_ut() Compute the Julian day of the next heliacal phenomenon after a given UT start
date. It works between geographic latitudes 60 South and 60 North.
swe_vis_limit_mag() Determine the limiting visual magnitude in dark skies. If the visual magni-
tude mag of an object is known for a given date (e. g. from a call of function swe_pheno_ut(),
and if magnitude is smaller than the value returned by swe_vis_limit_mag(), then it is visible.
swe_heliacal_pheno_ut() Provide data that are relevant for the calculation of heliacal risings and
settings. This function does not provide data of heliacal risings and settings itself, just some
additional data mostly used for test purposes. To calculate heliacal risings and settings, use
the function swe_heliacal_ut().
swe_topo_arcus_visionis() Compute topocentric arcus visionis.
swe_heliacal_angle() Compute heliacal angle.
Value
swe_sol_eclipse_when_loc returns a list with named entries: return status flag as integer, tret
for eclipse timing moments as numeric vector, attr phenomena during eclipse as numeric vector
and serr error message as string
swe_lun_eclipse_when_loc returns a list with named entries: return status flag as integer, tret
for eclipse timing moments, attr phenomena during eclipse and serr error warning as string
swe_lun_eclipse_how returns a list with named entries: return status flag as integer, attr phe-
nomena during eclipse as numeric vector and serr error message as string
swe_lun_eclipse_when returns a list with named entries: return status flag as integer, tret for
eclipse timing moments as numeric vector and serr error warning as string
swe_rise_trans_true_hor returns a list with named entries: return status flag as integer, tret
for azimuth/altitude info as double and serr error message as string
swe_pheno_ut returns a list with named entries: return status fag as integer, attr for phenomenon
information as numeric vector and serr error warning as string
swe_pheno returns a list with named entries: return status fag as integer, attr for phenomenon
information as numeric vector and serr error message as string
swe_azalt returns a list with named entries: xaz for azi/alt info as numeric vector.
swe_azalt_rev returns a list with named entries: xaz for celestial info as numeric vector.
swe_refrac_extended returns a list with named entries: return status flag as integer, dret refrac-
tion results as numeric vector (TopoAlt, AppAlt, refraction)
swe_heliacal_ut returns a list with named entries return status flag as integer, dret heliacal
results as numeric vector, and serr error message as string.
swe_vis_limit_mag returns a list with named entries: return status flag as integer, dret limiting
magnitude as double and serr error message as string
swe_heliacal_pheno_ut returns a list with named entries: return status flag as integer darr for
heliacal details as numeric vector and serr error message as string
swe_topo_arcus_visionis returns a list with named entries: return status flag as integer, darr
heliacal details as numeric vector and serr error message as string
swe_heliacal_angle returns a list with named entries: return status flag as integer, dret heliacal
angle as numeric vector and serr error message as string
16 Section7
See Also
Section 6 in http://www.astro.com/swisseph/swephprg.htm
Examples
data(SE)
swe_sol_eclipse_when_loc(1234567,SE$FLG_MOSEPH,c(0,50,10),FALSE)
swe_lun_eclipse_when_loc(1234567,SE$FLG_MOSEPH,c(0,50,10),FALSE)
swe_lun_eclipse_how(1234580.19960447,SE$FLG_MOSEPH,c(0,50,10))
swe_lun_eclipse_when(1234567,SE$FLG_MOSEPH,SE$ECL_CENTRAL,FALSE)
swe_rise_trans_true_hor(1234567.5,SE$SUN,"",SE$FLG_MOSEPH,0,c(0,50,10),1013.25,15,0)
swe_pheno_ut(1234567,1,SE$FLG_MOSEPH)
swe_pheno(1234567,1,SE$FLG_MOSEPH)
swe_azalt(1234567,SE$EQU2HOR,c(0,50,10),15,1013.25,c(186,22))
swe_azalt_rev(1234567,SE$ECL2HOR,c(0, 50,10),c(123,2))
swe_refrac_extended(2,0,1013.25,15,-0.065,SE$TRUE_TO_APP)
swe_heliacal_ut(1234567,c(0,50,10),c(1013.25,15,50,0.25),c(25,1,1,1,5,0.8),"sirius",
SE$HELIACAL_RISING,SE$HELFLAG_HIGH_PRECISION+SE$FLG_MOSEPH)
swe_vis_limit_mag(1234567.5,c(0,50,10),c(1013.25,15,20,0.25),c(25,1,1,1,5,0.8),'sirius',
SE$HELFLAG_HIGH_PRECISION+SE$FLG_MOSEPH)
swe_heliacal_pheno_ut(1234567.5,c(0,50,10),c(1013.25,15,20,0.25),c(25,1,1,1,5,0.8),'sirius',
SE$HELIACAL_RISING,SE$HELFLAG_HIGH_PRECISION+SE$FLG_MOSEPH)
swe_topo_arcus_visionis(1234567.5,c(0,50,10),c(1013.25,15,20,0.25),c(25,1,1,1,5,0.8),
SE$HELFLAG_HIGH_PRECISION+SE$HELFLAG_OPTICAL_PARAMS,-1,124,2,120,0,-45)
swe_heliacal_angle(1234567.5,c(0,50,10),c(1013.25,15,20,0.25),c(25,1,1,1,5,0.8),
SE$HELFLAG_HIGH_PRECISION+SE$HELFLAG_OPTICAL_PARAMS,-1,124,120,0,-45)
Description
Functions related to calendar and time conversions.
Usage
swe_julday(year, month, day, hour, gregflag)
swe_revjul(jd, gregflag)
Arguments
year Astronomical year as integer
month Month as integer
day Day as integer
hour Hour as double
Section8 17
Details
swe_julday() Convert calendar dates to the astronomical time scale which measures time in Julian
day number.
swe_date_conversion() Convert calendar dates to the astronomical time scale which measures time
in Julian day number and checks if the calendar date is legal.
swe_revjul() Compute year, month, day and hour from a Julian day number.
Value
swe_date_conversion returns a list with named entries: return status flag as integer, jd Julian
day number as double
swe_revjul returns a list with named entries: year year as integer, month month as integer, day
day as integer and hour hour as double.
See Also
Section 7 in http://www.astro.com/swisseph/swephprg.htm
Examples
data(SE)
swe_julday(2000,1,1,12,SE$GREG_CAL)
swe_date_conversion(2000,1,1,12,"g")
swe_revjul(2452500,SE$GREG_CAL)
Description
Functions related to DeltaT and tidal acceleration
Usage
swe_deltat_ex(jd_ut, ephe_flag)
swe_deltat(jd_ut)
swe_set_tid_acc(t_acc)
swe_get_tid_acc()
swe_set_delta_t_userdef(delta_t)
18 Section8
Arguments
jd_ut Julian day number (UT) as numeric vector (day)
ephe_flag ephemeris flag as integer (SE$FLG_JPLEPH=1, SE$FLG_SWIEPH=2 or SE$FLG_MOSEPH=4)
(section 2.3.2)
t_acc Tidal acceleration as double (arcsec/century^2)
delta_t DeltaT (day)
Details
swe_deltat_ex() Determine DeltaT from Julian day number for a specific ephemeris.
swe_deltat() Determine DeltaT from Julian day number for a used ephemeris. This function is
only safe if:
• your software consistently uses the same ephemeris flag
• if software consistently uses the same ephemeris files (with SE$FLG_SWIEPH and SE$FLG_MOSEPH)
• if swe_set_ephe_path() is first called (with SE$FLG_SWIEPH) and swe_set_jpl_file()
(with SE$FLG_JPLEPH)
swe_set_delta_t_userdef() Allows the user to set a fixed DeltaT value that will be returned by
swe_deltat() or swe_deltat_ex().
Value
swe_deltat_ex returns a list with named entries: deltat for DeltaT as double (day) and serr for
error message as string.
swe_deltat returns the DeltaT as double (day)
swe_get_tid_acc returns the tidal acceleration as double (arcsec/century^2)
See Also
Section 8 in http://www.astro.com/swisseph/swephprg.htm
Examples
data(SE)
swe_deltat_ex(1234.567, SE$FLG_MOSEPH)
swe_deltat(1234.567)
swe_set_tid_acc(1.23)
swe_get_tid_acc()
swe_set_delta_t_userdef(0.23)
Section9 19
Description
Function for topocentric planet positions
Usage
swe_set_topo(longitude, lat, height)
Arguments
longitude Geographic longitude as double (deg)
lat Geographic latitude as double (deg)
height Height as double (m)
Details
swe_set_topo() Set the topocentric location of the observer.
See Also
Section 9 in http://www.astro.com/swisseph/swephprg.htm
Examples
swe_set_topo(0,50,10)
Index
20