update rapid lunar calc

This commit is contained in:
2024-01-15 17:05:18 +08:00
parent c2c79c3615
commit 460e042aa9
8 changed files with 448 additions and 807 deletions
+51 -1
View File
@@ -1,13 +1,15 @@
package basic
import (
"b612.me/astro/tools"
"fmt"
"math"
"testing"
"time"
)
func Test_Jq(t *testing.T) {
data := GetOneYearJQ(2019)
data := GetJieqiLoops(2019, 24)
for i := 1; i < 25; i++ {
fmt.Println(JDE2Date(data[i]))
}
@@ -17,11 +19,59 @@ func Test_Jq(t *testing.T) {
//fmt.Println(HSunApparentLo(date))
}
func TestZD(t *testing.T) {
jde := 2452982.9872345612
zd := HJZD(jde)
fmt.Println(zd)
if zd != -0.003746747950462434 {
t.Fatal("not equal")
}
zd = JJZD(jde)
fmt.Println(zd)
if zd != 0.001513453926274198 {
t.Fatal("not equal")
}
}
func Test_SunLo(t *testing.T) {
fmt.Printf("%.14f\n", HSunTrueLo(2458840.0134162))
fmt.Printf("%.14f", HSunApparentLo(2458840.0134162))
}
func Test_SunDiff(t *testing.T) {
n := JDECalc(2000, 1, 1)
var maxRa, maxDec, maxLo float64
for i := float64(0); i < 365.2422*30; i++ {
tLo := HSunApparentLo(n + i)
tRa, tDec := HSunApparentRaDec(n + i)
fRa, fDec := SunApparentRaDec(n + i)
fLo := SunApparentLo(n + i)
tmp := tools.Limit360(math.Abs(tRa - fRa))
if tmp > 300 {
tmp = 360 - tmp
}
if tmp > maxRa {
maxRa = tmp
}
tmp = tools.Limit360(math.Abs(tDec - fDec))
if tmp > 300 {
tmp = 360 - tmp
}
if tmp > maxDec {
maxDec = tmp
}
tmp = tools.Limit360(math.Abs(tLo - fLo))
if tmp > 300 {
tmp = 360 - tmp
}
if tmp > maxLo {
maxLo = tmp
}
}
fmt.Printf("%.15f %.15f %.15f\n", maxRa*3600, maxDec*3600, maxLo*3600)
}
func Benchmark_SunRise(b *testing.B) {
jde := GetNowJDE()
for i := 0; i < b.N; i++ {