本文整理汇总了Golang中github.com/soniakeys/meeus/planetposition.LoadPlanet函数的典型用法代码示例。如果您正苦于以下问题:Golang LoadPlanet函数的具体用法?Golang LoadPlanet怎么用?Golang LoadPlanet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadPlanet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExamplePositions
func ExamplePositions() {
// Example 46.a, p. 334.
earth, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
saturn, err := pp.LoadPlanet(pp.Saturn)
if err != nil {
fmt.Println(err)
return
}
var pos [8]saturnmoons.XY
saturnmoons.Positions(2451439.50074, earth, saturn, &pos)
for i := range pos {
fmt.Printf("%d: %+7.3f %+7.3f\n", i+1, pos[i].X, pos[i].Y)
}
// Output:
// 1: +3.102 -0.204
// 2: +3.823 +0.318
// 3: +4.027 -1.061
// 4: -5.365 -1.148
// 5: -0.972 -3.136
// 6: +14.568 +4.738
// 7: -18.001 -5.328
// 8: -48.760 +4.137
}
开发者ID:soniakeys,项目名称:meeus,代码行数:27,代码来源:pp_test.go
示例2: ExampleRing
func ExampleRing() {
// Example 45.a, p. 320
earth, err := pp.LoadPlanet(pp.Earth, "")
if err != nil {
fmt.Println(err)
return
}
saturn, err := pp.LoadPlanet(pp.Saturn, "")
if err != nil {
fmt.Println(err)
return
}
B, Bʹ, ΔU, P, a, b := saturnring.Ring(2448972.50068, earth, saturn)
fmt.Printf("B = %.3f\n", B*180/math.Pi)
fmt.Printf("Bʹ = %.3f\n", Bʹ*180/math.Pi)
fmt.Printf("ΔU = %.3f\n", ΔU*180/math.Pi)
fmt.Printf("P = %.3f\n", P*180/math.Pi)
fmt.Printf("a = %.2d\n", base.NewFmtAngle(a))
fmt.Printf("b = %.2d\n", base.NewFmtAngle(b))
// Output:
// B = 16.442
// Bʹ = 14.679
// ΔU = 4.198
// P = 6.741
// a = 35″.87
// b = 10″.15
}
开发者ID:pjh59,项目名称:meeus,代码行数:27,代码来源:saturnring_test.go
示例3: ExamplePhysical
func ExamplePhysical() {
// Example 42.a, p. 291
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
m, err := pp.LoadPlanet(pp.Mars)
if err != nil {
fmt.Println(err)
return
}
DE, DS, ω, P, Q, d, q, k := mars.Physical(2448935.500683, e, m)
fmt.Printf("DE = %+.2f\n", DE.Deg())
fmt.Printf("DS = %+.2f\n", DS.Deg())
fmt.Printf("ω = %.2f\n", ω.Deg())
fmt.Printf("P = %.2f\n", P.Deg())
fmt.Printf("Q = %.2f\n", Q.Deg())
fmt.Printf("d = %.2f\n", d.Sec()) // display as arc sec
fmt.Printf("k = %.4f\n", k)
fmt.Printf("q = %.2f\n", q.Sec()) // display as arc sec
// Output:
// DE = +12.44
// DS = -2.76
// ω = 111.55
// P = 347.64
// Q = 279.91
// d = 10.75
// k = 0.9012
// q = 1.06
}
开发者ID:soniakeys,项目名称:meeus,代码行数:31,代码来源:pp_test.go
示例4: ExampleApproxPlanet
func ExampleApproxPlanet() {
// Example 15.a, p. 103.
p := globe.Coord{
Lon: unit.NewAngle(' ', 71, 5, 0),
Lat: unit.NewAngle(' ', 42, 20, 0),
}
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
v, err := pp.LoadPlanet(pp.Venus)
if err != nil {
fmt.Println(err)
return
}
tRise, tTransit, tSet, err := rise.ApproxPlanet(1988, 3, 20, p, e, v)
if err != nil {
fmt.Println(err)
return
}
// Units for "m" values given near top of p. 104 are day fraction.
fmt.Printf("rising: %+.5f %02s\n", tRise/86400, sexa.FmtTime(tRise))
fmt.Printf("transit: %+.5f %02s\n", tTransit/86400, sexa.FmtTime(tTransit))
fmt.Printf("seting: %+.5f %02s\n", tSet/86400, sexa.FmtTime(tSet))
// Output:
// rising: +0.51816 12ʰ26ᵐ09ˢ
// transit: +0.81965 19ʰ40ᵐ17ˢ
// seting: +0.12113 02ʰ54ᵐ26ˢ
}
开发者ID:soniakeys,项目名称:meeus,代码行数:30,代码来源:pp_test.go
示例5: ExamplePhysical
func ExamplePhysical() {
// Example 42.a, p. 291
e, err := pp.LoadPlanet(pp.Earth, "")
if err != nil {
fmt.Println(err)
return
}
m, err := pp.LoadPlanet(pp.Mars, "")
if err != nil {
fmt.Println(err)
return
}
DE, DS, ω, P, Q, d, k, q := mars.Physical(2448935.500683, e, m)
fmt.Printf("DE = %+.2f\n", DE*180/math.Pi)
fmt.Printf("DS = %+.2f\n", DS*180/math.Pi)
fmt.Printf("ω = %.2f\n", ω*180/math.Pi)
fmt.Printf("P = %.2f\n", P*180/math.Pi)
fmt.Printf("Q = %.2f\n", Q*180/math.Pi)
fmt.Printf("d = %.2f\n", d*180/math.Pi*60*60) // display as arc sec
fmt.Printf("k = %.4f\n", k)
fmt.Printf("q = %.2f\n", q*180/math.Pi*60*60) // display as arc sec
// Output:
// DE = +12.44
// DS = -2.76
// ω = 111.55
// P = 347.64
// Q = 279.91
// d = 10.75
// k = 0.9012
// q = 1.06
}
开发者ID:pjh59,项目名称:meeus,代码行数:31,代码来源:mars_test.go
示例6: ExamplePlanet
func ExamplePlanet() {
// Example 15.a, p. 103.
p := globe.Coord{
Lon: unit.NewAngle(' ', 71, 5, 0),
Lat: unit.NewAngle(' ', 42, 20, 0),
}
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
v, err := pp.LoadPlanet(pp.Venus)
if err != nil {
fmt.Println(err)
return
}
tRise, tTransit, tSet, err := rise.Planet(1988, 3, 20, p, e, v)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("rising: %+.5f %02s\n", tRise/86400, sexa.FmtTime(tRise))
fmt.Printf("transit: %+.5f %02s\n", tTransit/86400, sexa.FmtTime(tTransit))
fmt.Printf("seting: %+.5f %02s\n", tSet/86400, sexa.FmtTime(tSet))
// Output:
// rising: +0.51766 12ʰ25ᵐ26ˢ
// transit: +0.81980 19ʰ40ᵐ30ˢ
// seting: +0.12130 02ʰ54ᵐ40ˢ
}
开发者ID:soniakeys,项目名称:meeus,代码行数:29,代码来源:pp_test.go
示例7: ExamplePhysical
func ExamplePhysical() {
// Example 43.a, p. 295
e, err := pp.LoadPlanet(pp.Earth, "")
if err != nil {
fmt.Println(err)
return
}
j, err := pp.LoadPlanet(pp.Jupiter, "")
if err != nil {
fmt.Println(err)
return
}
DS, DE, ω1, ω2, P := jupiter.Physical(2448972.50068, e, j)
fmt.Printf("DS = %+.2f\n", DS*180/math.Pi)
fmt.Printf("DE = %+.2f\n", DE*180/math.Pi)
fmt.Printf("ω1 = %.2f\n", ω1*180/math.Pi)
fmt.Printf("ω2 = %.2f\n", ω2*180/math.Pi)
fmt.Printf("P = %.2f\n", P*180/math.Pi)
// Output:
// DS = -2.20
// DE = -2.48
// ω1 = 268.06
// ω2 = 72.74
// P = 24.80
}
开发者ID:pjh59,项目名称:meeus,代码行数:25,代码来源:jupiter_test.go
示例8: ExampleTimes_computed
func ExampleTimes_computed() {
// Example 15.a, p. 103, but using meeus packages to compute values
// given in the text.
jd := julian.CalendarGregorianToJD(1988, 3, 20)
p := globe.Coord{
Lon: unit.NewAngle(' ', 71, 5, 0),
Lat: unit.NewAngle(' ', 42, 20, 0),
}
// Th0 computed rather than taken from the text.
Th0 := sidereal.Apparent0UT(jd)
// Venus α, δ computed rather than taken from the text.
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
v, err := pp.LoadPlanet(pp.Venus)
if err != nil {
fmt.Println(err)
return
}
α := make([]unit.RA, 3)
δ := make([]unit.Angle, 3)
α[0], δ[0] = elliptic.Position(v, e, jd-1)
α[1], δ[1] = elliptic.Position(v, e, jd)
α[2], δ[2] = elliptic.Position(v, e, jd+1)
for i, j := range []float64{jd - 1, jd, jd + 1} {
_, m, d := julian.JDToCalendar(j)
fmt.Printf("%s %.0f α: %0.2s δ: %0.1s\n",
time.Month(m), d, sexa.FmtRA(α[i]), sexa.FmtAngle(δ[i]))
}
// ΔT computed rather than taken from the text.
ΔT := deltat.Interp10A(jd)
fmt.Printf("ΔT: %.1f\n", ΔT)
h0 := rise.Stdh0Stellar
tRise, tTransit, tSet, err := rise.Times(p, ΔT, h0, Th0, α, δ)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("rising: %+.5f %02s\n", tRise/86400, sexa.FmtTime(tRise))
fmt.Printf("transit: %+.5f %02s\n", tTransit/86400, sexa.FmtTime(tTransit))
fmt.Printf("seting: %+.5f %02s\n", tSet/86400, sexa.FmtTime(tSet))
// Output:
// March 19 α: 2ʰ42ᵐ43.25ˢ δ: 18°02′51.4″
// March 20 α: 2ʰ46ᵐ55.51ˢ δ: 18°26′27.3″
// March 21 α: 2ʰ51ᵐ07.69ˢ δ: 18°49′38.7″
// ΔT: 55.9
// rising: +0.51766 12ʰ25ᵐ26ˢ
// transit: +0.81980 19ʰ40ᵐ30ˢ
// seting: +0.12130 02ʰ54ᵐ40ˢ
}
开发者ID:soniakeys,项目名称:meeus,代码行数:55,代码来源:pp_test.go
示例9: TestEarth2
func TestEarth2(t *testing.T) {
// p. 274
v, err := pp.LoadPlanet(pp.Earth)
if err != nil {
t.Fatal(err)
}
for _, d := range ep {
yf := float64(d.y) + (float64(d.m)-.5)/12
u, r := pa.Perihelion2(pa.Earth, yf, .0004, v)
y, m, df := julian.JDToCalendar(u)
dd, f := math.Modf(df)
if y != d.y || m != d.m || int(dd) != d.d ||
math.Abs(f*24-d.h) > .01 ||
math.Abs(r-d.r) > .000001 {
t.Log(d)
t.Fatal(y, m, int(dd), f*24, r)
}
}
for _, d := range ea {
yf := float64(d.y) + (float64(d.m)-.5)/12
u, r := pa.Aphelion2(pa.Earth, yf, .0004, v)
y, m, df := julian.JDToCalendar(u)
dd, f := math.Modf(df)
if y != d.y || m != d.m || int(dd) != d.d ||
math.Abs(f*24-d.h) > .01 ||
math.Abs(r-d.r) > .000001 {
t.Log(d)
t.Fatal(y, m, int(dd), f*24, r)
}
}
}
开发者ID:thecc4re,项目名称:meeus,代码行数:31,代码来源:pp_test.go
示例10: ExampleElements_Position
func ExampleElements_Position() {
// Example 33.b, p. 232.
earth, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
k := &elliptic.Elements{
TimeP: julian.CalendarGregorianToJD(1990, 10, 28.54502),
Axis: 2.2091404,
Ecc: .8502196,
Inc: 11.94524 * math.Pi / 180,
Node: 334.75006 * math.Pi / 180,
ArgP: 186.23352 * math.Pi / 180,
}
j := julian.CalendarGregorianToJD(1990, 10, 6)
α, δ, ψ := k.Position(j, earth)
fmt.Printf("α = %.1d\n", sexa.NewFmtRA(α))
fmt.Printf("δ = %.0d\n", sexa.NewFmtAngle(δ))
fmt.Printf("ψ = %.2f\n", ψ*180/math.Pi)
// Output:
// α = 10ʰ34ᵐ14ˢ.2
// δ = 19°9′31″
// ψ = 40.51
}
开发者ID:thecc4re,项目名称:meeus,代码行数:25,代码来源:pp_test.go
示例11: ExampleV87Planet_Position
func ExampleV87Planet_Position() {
// 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 = %s\n",
base.DecSymAdd(fmt.Sprintf("%+.5f", l*180/math.Pi), '°'))
fmt.Printf("B = %s\n",
base.DecSymAdd(fmt.Sprintf("%+.5f", b*180/math.Pi), '°'))
fmt.Printf("R = %.6f AU\n", r)
// Meeus results:
// L = +26°.11428
// B = -2°.62070
// R = 0.724603 AU
// Answers below seem close enough.
// Output:
// L = +26°.11412
// B = -2°.62060
// R = 0.724602 AU
}
开发者ID:pjh59,项目名称:meeus,代码行数:25,代码来源:planetposition_test.go
示例12: TestUB
func TestUB(t *testing.T) {
earth, err := pp.LoadPlanet(pp.Earth, "")
if err != nil {
fmt.Println(err)
return
}
saturn, err := pp.LoadPlanet(pp.Saturn, "")
if err != nil {
fmt.Println(err)
return
}
B, _, ΔU, _, _, _ := saturnring.Ring(2448972.50068, earth, saturn)
ubΔU, ubB := saturnring.UB(2448972.50068, earth, saturn)
if ubΔU != ΔU || ubB != B {
t.Fatal()
}
}
开发者ID:pjh59,项目名称:meeus,代码行数:17,代码来源:saturnring_test.go
示例13: ExampleApproxTimes_computed
func ExampleApproxTimes_computed() {
// Example 15.a, p. 103, but using meeus packages to compute values
// given in the text.
jd := julian.CalendarGregorianToJD(1988, 3, 20)
p := globe.Coord{
Lon: unit.NewAngle(' ', 71, 5, 0),
Lat: unit.NewAngle(' ', 42, 20, 0),
}
// Th0 computed rather than taken from the text.
Th0 := sidereal.Apparent0UT(jd)
fmt.Printf("Th0: %.2s\n", sexa.FmtTime(Th0))
// Venus α, δ computed rather than taken from the text.
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
v, err := pp.LoadPlanet(pp.Venus)
if err != nil {
fmt.Println(err)
return
}
α, δ := elliptic.Position(v, e, jd)
fmt.Printf("α: %.2s\n", sexa.FmtRA(α))
fmt.Printf("δ: %.1s\n", sexa.FmtAngle(δ))
h0 := rise.Stdh0Stellar
tRise, tTransit, tSet, err := rise.ApproxTimes(p, h0, Th0, α, δ)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("rising: %+.5f %02s\n", tRise/86400, sexa.FmtTime(tRise))
fmt.Printf("transit: %+.5f %02s\n", tTransit/86400, sexa.FmtTime(tTransit))
fmt.Printf("seting: %+.5f %02s\n", tSet/86400, sexa.FmtTime(tSet))
// Output:
// Th0: 11ʰ50ᵐ58.09ˢ
// α: 2ʰ46ᵐ55.51ˢ
// δ: 18°26′27.3″
// rising: +0.51816 12ʰ26ᵐ09ˢ
// transit: +0.81965 19ʰ40ᵐ17ˢ
// seting: +0.12113 02ʰ54ᵐ26ˢ
}
开发者ID:soniakeys,项目名称:meeus,代码行数:45,代码来源:pp_test.go
示例14: ExamplePosition
func ExamplePosition() {
// Example 33.a, p. 225. VSOP87 result p. 227.
earth, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
venus, err := pp.LoadPlanet(pp.Venus)
if err != nil {
fmt.Println(err)
return
}
α, δ := elliptic.Position(venus, earth, 2448976.5)
fmt.Printf("α = %.3d\n", sexa.NewFmtRA(α))
fmt.Printf("δ = %.2d\n", sexa.NewFmtAngle(δ))
// Output:
// α = 21ʰ4ᵐ41ˢ.454
// δ = -18°53′16″.84
}
开发者ID:thecc4re,项目名称:meeus,代码行数:19,代码来源:pp_test.go
示例15: ExampleE5
func ExampleE5() {
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
j, err := pp.LoadPlanet(pp.Jupiter)
if err != nil {
fmt.Println(err)
return
}
var pos [4]jupitermoons.XY
jupitermoons.E5(2448972.50068, e, j, &pos)
fmt.Printf("X %+.4f %+.4f %+.4f %+.4f\n",
pos[0].X, pos[1].X, pos[2].X, pos[3].X)
fmt.Printf("Y %+.4f %+.4f %+.4f %+.4f\n",
pos[0].Y, pos[1].Y, pos[2].Y, pos[3].Y)
// Output:
// X -3.4503 +7.4418 +1.2010 +7.0720
// Y +0.2093 +0.2500 +0.6480 +1.0956
}
开发者ID:thecc4re,项目名称:meeus,代码行数:21,代码来源:pp_test.go
示例16: TestJS2
func TestJS2(t *testing.T) {
// p. 270
v, err := pp.LoadPlanet(pp.Jupiter)
if err != nil {
t.Fatal(err)
}
j, _ := pa.Aphelion2(pa.Jupiter, 1981.5, 1, v)
y, m, d := julian.JDToCalendar(j)
if y != 1981 || m != 7 || int(d) != 28 {
t.Fatal(y, m, d)
}
v, err = pp.LoadPlanet(pp.Saturn)
if err != nil {
t.Fatal(err)
}
s, _ := pa.Perihelion2(pa.Saturn, 1944.5, 1, v)
y, m, d = julian.JDToCalendar(s)
if y != 1944 || m != 9 || int(d) != 8 {
t.Fatal(y, m, d)
}
}
开发者ID:thecc4re,项目名称:meeus,代码行数:21,代码来源:pp_test.go
示例17: ExampleSunAltitude
func ExampleSunAltitude() {
j := julian.CalendarGregorianToJD(1992, 4, 12)
earth, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
_, _, _, l0, b0 := moon.Physical(j, earth)
h := moon.SunAltitude(-20*math.Pi/180, 9.7*math.Pi/180, l0, b0)
fmt.Printf("%+.3f\n", h*180/math.Pi)
// Output:
// +2.318
}
开发者ID:thecc4re,项目名称:meeus,代码行数:13,代码来源:pp_test.go
示例18: ExampleE
func ExampleE() {
// Example 28.a, p. 184
earth, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
j := julian.CalendarGregorianToJD(1992, 10, 13)
eq := eqtime.E(j, earth)
fmt.Printf("%+.1d", sexa.FmtHourAngle(eq))
// Output:
// +13ᵐ42ˢ.6
}
开发者ID:soniakeys,项目名称:meeus,代码行数:13,代码来源:pp_test.go
示例19: ExampleSunrise
func ExampleSunrise() {
earth, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
j0 := julian.CalendarGregorianToJD(1992, 4, 15)
j := moon.Sunrise(-20*math.Pi/180, 9.7*math.Pi/180, j0, earth)
y, m, d := julian.JDToCalendar(j)
fmt.Printf("%d %s %.4f TD\n", y, time.Month(m), d)
// Output:
// 1992 April 11.8069 TD
}
开发者ID:thecc4re,项目名称:meeus,代码行数:13,代码来源:pp_test.go
示例20: ExampleAstrometric
func ExampleAstrometric() {
// Example 37.a, p. 266
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
fmt.Println(err)
return
}
α, δ := pluto.Astrometric(2448908.5, e)
fmt.Printf("α: %.1d\n", sexa.FmtRA(α))
fmt.Printf("δ: %.0d\n", sexa.FmtAngle(δ))
// Output:
// α: 15ʰ31ᵐ43ˢ.8
// δ: -4°27′29″
}
开发者ID:soniakeys,项目名称:meeus,代码行数:14,代码来源:pp_test.go
注:本文中的github.com/soniakeys/meeus/planetposition.LoadPlanet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论