planetposition

package
v3.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2018 License: MIT Imports: 12 Imported by: 5

Documentation

Overview

Planetposition: Chapter 32, Positions of the Planets.

Incomplete:

1. The package does not implement algorithms that use appendix III, but instead implements a full VSOP87 solution. I do not have a copy of the supplimentary disk with appendix III in machine readable form and as the appendix is rather large, retyping it by hand is problematic. The full VSOP87 data set on the other hand is freely downloadable from the internet, so I implement here code that can use that data directly.

2. The formula for accuracy of results is not implemented. It is not needed for full VSOP87 solutions.

3. Polynomial expressions are not implemented. Again, implementation would involve typing rather large tables of numbers with associated risk of typographical errors.

Index

Examples

Constants

View Source
const (
	Mercury = iota
	Venus
	Earth
	Mars
	Jupiter
	Saturn
	Uranus
	Neptune
)

Mercury-Neptune planet constants suitable for first argument to LoadPlanet.

Variables

This section is empty.

Functions

func ToFK5

func ToFK5(L, B unit.Angle, jde float64) (L5, B5 unit.Angle)

ToFK5 converts ecliptic longitude and latitude from dynamical frame to FK5.

Example
// In example 33.a, p. 226
jd := 2448976.5
λ := unit.AngleFromDeg(313.07689) // (the value from mid-page)
β := unit.AngleFromDeg(-2.08489)
λ5, β5 := pp.ToFK5(λ, β, jd)
// recovering Δs,
Δλ := sexa.FmtAngle(λ5 - λ)
Δβ := sexa.FmtAngle(β5 - β)
fmt.Printf("λ = %3.5j\n", sexa.FmtAngle(λ))
fmt.Printf("β = %3.5j\n", sexa.FmtAngle(β))
fmt.Printf("Δλ = %+.5d = %+.5j\n", Δλ, Δλ)
fmt.Printf("Δβ = %+.5d = %+.5j\n", Δβ, Δβ)
fmt.Printf("FK5 λ = %3.5j\n", sexa.FmtAngle(λ5))
fmt.Printf("FK5 β = %3.5j\n", sexa.FmtAngle(β5))
Output:

λ =  313°.07689
β =   -2°.08489
Δλ = -0″.09027 = -°.00003
Δβ = +0″.05535 = +°.00002
FK5 λ =  313°.07686
FK5 β =   -2°.08487

Types

type V87Planet

type V87Planet struct {
	// contains filtered or unexported fields
}

V87Planet holds VSOP87 coefficients for computing planetary positions in spherical coorditates.

func LoadPlanet

func LoadPlanet(ibody int) (*V87Planet, error)

LoadPlanet constructs a V87Planet object from a VSOP87 file.

Argument ibody should be one of the planet constants.

The directory containing the VSOP87 must be indicated by environment variable VSOP87.

func LoadPlanetPath

func LoadPlanetPath(ibody int, path string) (*V87Planet, error)

LoadPlanetPath constructs a V87Planet object from a VSOP87 file.

Argument ibody should be one of the planet constants; path should be a directory containing the VSOP87 files.

func (*V87Planet) Position

func (vt *V87Planet) Position(jde float64) (L, B unit.Angle, R float64)

Position returns ecliptic position of planets at equinox and ecliptic of date.

Argument jde is the date for which positions are desired.

Results are positions consistent with those from Meeus's Apendix III, that is, at equinox and ecliptic of date.

L is heliocentric longitude.
B is heliocentric latitude.
R is heliocentric range in AU.
Example
// Example 32.a, p. 219
jd := julian.CalendarGregorianToJD(1992, 12, 20)
p, err := pp.LoadPlanet(pp.Venus)
if err != nil {
	fmt.Println(err)
	return
}
l, b, r := p.Position(jd)
fmt.Printf("L = %+.5j\n", sexa.FmtAngle(l))
fmt.Printf("B = %+.5j\n", sexa.FmtAngle(b))
fmt.Printf("R = %.6f AU\n", r)
Output:

L = +26°.11412
B = -2°.62060
R = 0.724602 AU

func (*V87Planet) Position2000

func (vt *V87Planet) Position2000(jde float64) (L, B unit.Angle, R float64)

Position2000 returns ecliptic position of planets by full VSOP87 theory.

Argument jde is the date for which positions are desired.

Results are for the dynamical equinox and ecliptic J2000.

L is heliocentric longitude.
B is heliocentric latitude.
R is heliocentric range in AU.
Example
package main

import (
	"fmt"

	pp "github.com/soniakeys/meeus/v3/planetposition"
)

func main() {
	// Mars 1899 spherical data from vsop87.chk.
	jd := 2415020.0
	p, err := pp.LoadPlanet(pp.Mars)
	if err != nil {
		fmt.Println(err)
		return
	}
	l, b, r := p.Position2000(jd)
	fmt.Printf("L = %.10f rad\n", l)
	fmt.Printf("B = %.10f rad\n", b)
	fmt.Printf("R = %.10f AU\n", r)
}
Output:

L = 5.0185792656 rad
B = -0.0274073500 rad
R = 1.4218777718 AU

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL