|
|
@ -153,3 +153,70 @@ func Test_SunAz(t *testing.T) {
|
|
|
|
fmt.Println(SunAngle(Date2JDE(time.Date(2022, 5, 30, 11, 55, 0, 0, cst)),
|
|
|
|
fmt.Println(SunAngle(Date2JDE(time.Date(2022, 5, 30, 11, 55, 0, 0, cst)),
|
|
|
|
120, 30, 8.0))
|
|
|
|
120, 30, 8.0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestJQDate(t *testing.T) {
|
|
|
|
|
|
|
|
trimDay := func(d float64) float64 {
|
|
|
|
|
|
|
|
if d-math.Floor(d) < 0.5 {
|
|
|
|
|
|
|
|
return math.Floor(d) - 0.5
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return math.Floor(d) + 0.5
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
c := 0
|
|
|
|
|
|
|
|
for year := 1900; year <= 2600; year++ {
|
|
|
|
|
|
|
|
for pos := 0; pos < 360; pos += 15 {
|
|
|
|
|
|
|
|
n := newGetJQTime(year, pos)
|
|
|
|
|
|
|
|
o := GetJQTime(year, pos)
|
|
|
|
|
|
|
|
if trimDay(n) != trimDay(o) {
|
|
|
|
|
|
|
|
c++
|
|
|
|
|
|
|
|
fmt.Printf("\"%d%03d\":%.0f,", year, pos, trimDay(o)-trimDay(n))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(c)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func newGetJQTime(Year, Angle int) float64 { //节气时间
|
|
|
|
|
|
|
|
var j int = 1
|
|
|
|
|
|
|
|
var Day int
|
|
|
|
|
|
|
|
var tp float64
|
|
|
|
|
|
|
|
if Angle%2 == 0 {
|
|
|
|
|
|
|
|
Day = 18
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Day = 3
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if Angle%10 != 0 {
|
|
|
|
|
|
|
|
tp = float64(Angle+15.0) / 30.0
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
tp = float64(Angle) / 30.0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Month := 3 + tp
|
|
|
|
|
|
|
|
if Month > 12 {
|
|
|
|
|
|
|
|
Month -= 12
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JD1 := JDECalc(int(Year), int(Month), float64(Day))
|
|
|
|
|
|
|
|
if Angle == 0 {
|
|
|
|
|
|
|
|
Angle = 360
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for i := 0; i < j; i++ {
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
|
|
|
JD0 := JD1
|
|
|
|
|
|
|
|
stDegree := newJQLospec(JD0) - float64(Angle)
|
|
|
|
|
|
|
|
stDegreep := (newJQLospec(JD0+0.000005) - newJQLospec(JD0-0.000005)) / 0.00001
|
|
|
|
|
|
|
|
JD1 = JD0 - stDegree/stDegreep
|
|
|
|
|
|
|
|
if math.Abs(JD1-JD0) <= 0.00001 {
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JD1 -= 0.001
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JD1 += 0.001
|
|
|
|
|
|
|
|
return JD1 - 0.0046296296296296
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func newJQLospec(JD float64) float64 {
|
|
|
|
|
|
|
|
t := tools.FloatRound(SunApparentLo(JD), 9)
|
|
|
|
|
|
|
|
if t <= 12 {
|
|
|
|
|
|
|
|
t += 360
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return t
|
|
|
|
|
|
|
|
}
|
|
|
|