Skip to content

Astronomical space coordinate and time conversion. Calculate Julian day, local sidereal time and ecliptic obliquity with great precision.

License

Notifications You must be signed in to change notification settings

DJBen/SpaceTime

Repository files navigation

Header

SpaceTime

Language License: GPL v3 Carthage compatible Build Status

Overview

Demo

You can find a demo project under SpaceTimeDemo directory. It showcases several useful scenarios.

Screenshot

Installation

Carthage

github "DJBen/SpaceTime" ~> 0.4.0

Usage

Equatorial to horizontal coordinate:

// Supply observer location and timestamp
let locTime = ObserverLocationTime(location: location, timestamp: JulianDay.now)
let vegaCoord = EquatorialCoordinate(rightAscension: radians(hours: 18, minutes: 36, seconds: 56.33635), declination: radians(degrees: 38, minutes: 47, seconds: 1.2802), distance: 1)
// Azimuth and altitude of Vega
let vegaAziAlt = HorizontalCoordinate.init(equatorialCoordinate: vegaCoord, observerInfo: locTime)

Ecliptic coordinate of Pollux at standard equinox of J2000.0.

let ra = DegreeAngle(116.328942)
let dec = DegreeAngle(28.026183)
let eclipticCoord = EclipticCoordinate(longitude: ra, latitude: dec, distance: 1, julianDay: .J2000)
eclipticCoord.longitude.wrappedValue // 113.21563
eclipticCoord.latitude.wrappedValue // 6.68417

Greenwich Mean Sidereal Time:

SiderealTime.init(julianDay: JulianDay.now)

Local Apparent Sidereal Time:

// Get location from GPS or hard code
let locTime = ObserverLocationTime(location: location, timestamp: JulianDay.now)
let localSidTime = SiderealTime.init(observerLocationTime: locTime)

More use cases can be found in the source and test cases.

About

Astronomical space coordinate and time conversion. Calculate Julian day, local sidereal time and ecliptic obliquity with great precision.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published