MyNixOS website logo
Description

High Precision Swiss Ephemeris.

The Swiss Ephemeris (version 2.10.03) 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.r-universe.dev", type = "source")'. The size of the 'swephRdata' package is approximately 115 MB. The user can also use the original JPL DE431 data.

R buildstatus Coveragestatus CRANstatus Downloads Dependencies

swephR

The goal of swephR is to provide an R interface to the Swiss Ephemeris. The Swiss Ephemeris is a high precision ephemeris based upon the DE431 ephemeris from NASA’s JPL. It covers the time range 13201 BCE to 17191 CE.

Installation

You can install the released version of swephR from CRAN with:

install.packages("swephR")

Intermediate releases can also be obtained from https://rstub.r-universe.dev/:

install.packages('swephR', repos = c('https://rstub.r-universe.dev', 'https://cloud.r-project.org'))

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.r-universe.dev", type = "source")

The size of the swephRdata package is approximately 115 MB. The user can also use the original JPL DE431 data.

Example

To compute the position of celestial body or star with SE (Swiss Ephemeris), you do the following steps:

library(swephR)
swe_version()
#> [1] "2.10.03"

For a specific date, compute the Julian day number (in below example: J2000.0, 1 January 2000 at 12:00 UT):

year <- 2000
month <- 1
day <- 1
hour <- 12
jdut <- swe_julday(year, month, day, hour, SE$GREG_CAL)
jdut
#> [1] 2451545

Compute (using Moshier ephemeris) the positions (longitude, latitude, distance, longitude speed and latitude speed) of a planet or other celestial bodies (in below example: the Sun):

ipl <- SE$SUN
iflag <- SE$FLG_MOSEPH + SE$FLG_SPEED
result <- swe_calc_ut(jdut, ipl, iflag)
result
#> $return
#> [1] 260
#> 
#> $xx
#> [1]  2.803689e+02  2.323265e-04  9.833276e-01  1.019432e+00 -8.922802e-07
#> [6] -7.339410e-06
#> 
#> $serr
#> [1] ""

or a fixed star (in below example: Sirius):

starname = "sirius"
result <- swe_fixstar2_ut(starname, jdut, iflag)
result
#> $return
#> [1] 260
#> 
#> $starname
#> [1] "Sirius,alCMa"
#> 
#> $xx
#> [1]  1.040853e+02 -3.960507e+01  5.439322e+05  4.643164e-05 -7.119376e-05
#> [6] -4.130539e-03
#> 
#> $serr
#> [1] ""

The current R interface is modeled after the C interface. It is therefore often helpful to consult the general documentation and programmer’s documentation for the Swiss Ephemeris.

Feedback

All feedback (bug reports, security issues, feature requests, …) should be provided as issues.

Metadata

Version

0.3.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows