当前位置: 首页>>代码示例>>Golang>>正文


Golang julian.JDToCalendar函数代码示例

本文整理汇总了Golang中github.com/soniakeys/meeus/julian.JDToCalendar函数的典型用法代码示例。如果您正苦于以下问题:Golang JDToCalendar函数的具体用法?Golang JDToCalendar怎么用?Golang JDToCalendar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了JDToCalendar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: 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

示例2: TestJS

func TestJS(t *testing.T) {
	// p. 270
	j := pa.Aphelion(pa.Jupiter, 1981.5)
	y, m, d := julian.JDToCalendar(j)
	if y != 1981 || m != 7 || int(d) != 19 {
		t.Fatal(y, m, d)
	}
	s := pa.Perihelion(pa.Saturn, 1944.5)
	y, m, d = julian.JDToCalendar(s)
	if y != 1944 || m != 7 || int(d) != 30 {
		t.Fatal(y, m, d)
	}
}
开发者ID:pjh59,项目名称:meeus,代码行数:13,代码来源:perihelion_test.go

示例3: TestEarth

func TestEarth(t *testing.T) {
	// p. 273
	j := pa.Perihelion(pa.EMBary, 1990)
	y, m, d := julian.JDToCalendar(j)
	if y != 1990 || m != 1 || int(d) != 3 {
		t.Fatal(y, m, d)
	}
	j = pa.Perihelion(pa.Earth, 1990)
	y, m, df := julian.JDToCalendar(j)
	d, f := math.Modf(df)
	if y != 1990 || m != 1 || int(d) != 4 || int(f*24+.5) != 16 {
		t.Fatal(y, m, df)
	}
}
开发者ID:pjh59,项目名称:meeus,代码行数:14,代码来源:perihelion_test.go

示例4: ExampleJDToCalendar

func ExampleJDToCalendar() {
	// Example 7.c, p. 64.
	y, m, d := julian.JDToCalendar(2436116.31)
	fmt.Printf("%d %s %.2f\n", y, time.Month(m), d)
	// Output:
	// 1957 October 4.81
}
开发者ID:thecc4re,项目名称:meeus,代码行数:7,代码来源:julian_test.go

示例5: ExampleTime

func ExampleTime() {
	// Example 19.a, p. 121.
	r1 := unit.AngleFromDeg(113.56833)
	d1 := unit.AngleFromDeg(31.89756)
	r2 := unit.AngleFromDeg(116.25042)
	d2 := unit.AngleFromDeg(28.03681)
	r3 := make([]unit.Angle, 5)
	for i, ri := range []float64{
		118.98067, 119.59396, 120.20413, 120.81108, 121.41475} {
		r3[i] = unit.AngleFromDeg(ri)
	}
	d3 := make([]unit.Angle, 5)
	for i, di := range []float64{
		21.68417, 21.58983, 21.49394, 21.39653, 21.29761} {
		d3[i] = unit.AngleFromDeg(di)
	}
	// use JD as time to handle month boundary
	jd, err := line.Time(r1, d1, r2, d2, r3, d3,
		julian.CalendarGregorianToJD(1994, 9, 29),
		julian.CalendarGregorianToJD(1994, 10, 3))
	if err != nil {
		fmt.Println(err)
		return
	}
	y, m, d := julian.JDToCalendar(jd)
	dInt, dFrac := math.Modf(d)
	fmt.Printf("%d %s %.4f\n", y, time.Month(m), d)
	fmt.Printf("%d %s %d, at %h TD(UT)\n", y, time.Month(m), int(dInt),
		sexa.FmtTime(unit.TimeFromDay(dFrac)))
	// Output:
	// 1994 October 1.2233
	// 1994 October 1, at 5ʰ TD(UT)
}
开发者ID:soniakeys,项目名称:meeus,代码行数:33,代码来源:line_test.go

示例6: ExampleTime

func ExampleTime() {
	// Example 19.a, p. 121.

	// convert degree data to radians
	r1 := 113.56833 * math.Pi / 180
	d1 := 31.89756 * math.Pi / 180
	r2 := 116.25042 * math.Pi / 180
	d2 := 28.03681 * math.Pi / 180
	r3 := make([]float64, 5)
	for i, ri := range []float64{
		118.98067, 119.59396, 120.20413, 120.81108, 121.41475} {
		r3[i] = ri * math.Pi / 180
	}
	d3 := make([]float64, 5)
	for i, di := range []float64{
		21.68417, 21.58983, 21.49394, 21.39653, 21.29761} {
		d3[i] = di * math.Pi / 180
	}
	// use JD as time to handle month boundary
	jd, err := line.Time(r1, d1, r2, d2, r3, d3,
		julian.CalendarGregorianToJD(1994, 9, 29),
		julian.CalendarGregorianToJD(1994, 10, 3))
	if err != nil {
		fmt.Println(err)
		return
	}
	y, m, d := julian.JDToCalendar(jd)
	dInt, dFrac := math.Modf(d)
	fmt.Printf("%d %s %.4f\n", y, time.Month(m), d)
	fmt.Printf("%d %s %d, at %h TD(UT)\n", y, time.Month(m), int(dInt),
		sexa.NewFmtTime(dFrac*24*3600))
	// Output:
	// 1994 October 1.2233
	// 1994 October 1, at 5ʰ TD(UT)
}
开发者ID:thecc4re,项目名称:meeus,代码行数:35,代码来源:line_test.go

示例7: ExampleCycle

func ExampleCycle() {
	j := solardisk.Cycle(1699)
	fmt.Printf("%.4f\n", j)
	y, m, d := julian.JDToCalendar(j)
	fmt.Printf("%d %s %.2f\n", y, time.Month(m), d)
	// Output:
	// 2444480.7230
	// 1980 August 29.22
}
开发者ID:thecc4re,项目名称:meeus,代码行数:9,代码来源:solardisk_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: ExamplePerihelion

func ExamplePerihelion() {
	// Example 38.a, p. 270
	j := pa.Perihelion(pa.Venus, 1978.79)
	fmt.Printf("%.3f\n", j)
	y, m, df := julian.JDToCalendar(j)
	d, f := math.Modf(df)
	fmt.Printf("%d %s %d at %dʰ\n", y, time.Month(m), int(d), int(f*24+.5))
	// Output:
	// 2443873.704
	// 1978 December 31 at 5ʰ
}
开发者ID:pjh59,项目名称:meeus,代码行数:11,代码来源:perihelion_test.go

示例10: ExampleMarsStation2

func ExampleMarsStation2() {
	// Example 36.d, p. 254
	j := planetary.MarsStation2(1997.3)
	fmt.Printf("%.3f\n", j)
	y, m, df := julian.JDToCalendar(j)
	d, f := math.Modf(df)
	fmt.Printf("%d %s %d, at %dʰ\n", y, time.Month(m), int(d), int(f*24+.5))
	// Output:
	// 2450566.255
	// 1997 April 27, at 18ʰ
}
开发者ID:thecc4re,项目名称:meeus,代码行数:11,代码来源:planetary_test.go

示例11: ExampleAphelion

func ExampleAphelion() {
	// Example 38.b, p. 270
	j := pa.Aphelion(pa.Mars, 2032.5)
	fmt.Printf("%.3f\n", j)
	y, m, df := julian.JDToCalendar(j)
	d, f := math.Modf(df)
	fmt.Printf("%d %s %d at %dʰ\n", y, time.Month(m), int(d), int(f*24+.5))
	// Output:
	// 2463530.456
	// 2032 October 24 at 23ʰ
}
开发者ID:pjh59,项目名称:meeus,代码行数:11,代码来源:perihelion_test.go

示例12: ExampleMercuryInfConj

func ExampleMercuryInfConj() {
	// Example 36.a, p. 252
	j := planetary.MercuryInfConj(1993.75)
	fmt.Printf("%.3f\n", j)
	y, m, df := julian.JDToCalendar(j)
	d, f := math.Modf(df)
	fmt.Printf("%d %s %d, at %dʰ\n", y, time.Month(m), int(d), int(f*24+.5))
	// Output:
	// 2449297.645
	// 1993 November 6, at 3ʰ
}
开发者ID:thecc4re,项目名称:meeus,代码行数:11,代码来源:planetary_test.go

示例13: ExampleSaturnConj

func ExampleSaturnConj() {
	// Example 36.b, p. 252
	j := planetary.SaturnConj(2125.5)
	fmt.Printf("%.3f\n", j)
	y, m, df := julian.JDToCalendar(j)
	d, f := math.Modf(df)
	fmt.Printf("%d %s %d, at %dʰ\n", y, time.Month(m), int(d), int(f*24+.5))
	// Output:
	// 2497437.904
	// 2125 August 26, at 10ʰ
}
开发者ID:thecc4re,项目名称:meeus,代码行数:11,代码来源:planetary_test.go

示例14: ExampleEllipticDescending

func ExampleEllipticDescending() {
	// Example 39.a, p. 276
	t, r := node.EllipticDescending(17.9400782, .96727426,
		111.84644*math.Pi/180,
		julian.CalendarGregorianToJD(1986, 2, 9.45891))
	y, m, d := julian.JDToCalendar(t)
	fmt.Printf("%d %s %.2f\n", y, time.Month(m), d)
	fmt.Printf("%.4f AU\n", r)
	// Output:
	// 1986 March 10.37
	// 0.8493 AU
}
开发者ID:pjh59,项目名称:meeus,代码行数:12,代码来源:node_test.go

示例15: ExampleParabolicDescending

func ExampleParabolicDescending() {
	// Example 29.b, p. 277
	t, r := node.ParabolicDescending(1.324502,
		154.9103*math.Pi/180,
		julian.CalendarGregorianToJD(1989, 8, 20.291))
	y, m, d := julian.JDToCalendar(t)
	fmt.Printf("%d %s %.3f\n", y, time.Month(m), d)
	fmt.Printf("%.4f AU\n", r)
	// Output:
	// 1989 September 17.636
	// 1.3901 AU
}
开发者ID:pjh59,项目名称:meeus,代码行数:12,代码来源:node_test.go


注:本文中的github.com/soniakeys/meeus/julian.JDToCalendar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。