|
|
|
package basic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"b612.me/astro/tools"
|
|
|
|
"fmt"
|
|
|
|
"math"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Test_Jq(t *testing.T) {
|
|
|
|
data := GetJieqiLoops(2019, 24)
|
|
|
|
for i := 1; i < 25; i++ {
|
|
|
|
fmt.Println(JDE2Date(data[i]))
|
|
|
|
}
|
|
|
|
//fmt.Println(JDE2Date(GetWHTime(2019, 10)))
|
|
|
|
//fmt.Println(JDE2Date(GetJQTime(2020, 0)))
|
|
|
|
//date := TD2UT(GetJQTime(2020, 0), true)
|
|
|
|
//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++ {
|
|
|
|
//GetNowJDE()
|
|
|
|
GetSunRiseTime(jde, 115, 32, 8, 0, 10)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func Benchmark_SunLo(b *testing.B) {
|
|
|
|
jde := GetNowJDE()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
//GetNowJDE()
|
|
|
|
HSunApparentLo(jde)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_Cal(t *testing.T) {
|
|
|
|
fmt.Println(JDE2Date(GetSolar(2020, 1, 1, false, 8.0/24.0)))
|
|
|
|
fmt.Println(JDE2Date(GetSolar(2020, 4, 1, false, 8.0/24.0)))
|
|
|
|
fmt.Println(JDE2Date(GetSolar(2020, 4, 1, true, 8.0/24.0)))
|
|
|
|
fmt.Println(JDE2Date(GetSolar(2033, 11, 3, false, 8.0/24.0)))
|
|
|
|
fmt.Println(JDE2Date(GetSolar(2033, 11, 3, true, 8.0/24.0)))
|
|
|
|
fmt.Println(JDE2Date(GetSolar(2034, 1, 1, false, 8.0/24.0)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_SunRise(t *testing.T) {
|
|
|
|
a := time.Now().UnixNano()
|
|
|
|
//b := GetSunRiseTime(GetNowJDE(), 120, 32, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+1, 145, 32, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+2, 135, 50, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+3, 125, 32, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+4, 75, 32, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+5, 85, 32, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+6, 95, 32, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+7, 105, 32, 8, 0)
|
|
|
|
//b = GetSunRiseTime(GetNowJDE()+8, 115, 32, 8, 0)
|
|
|
|
b := GetSunRiseTime(GetNowJDE()+9, 125, 32, 8, 0, 10)
|
|
|
|
fmt.Println(time.Now().UnixNano() - a)
|
|
|
|
fmt.Println(SunHeight(b, 115, 32, 8))
|
|
|
|
fmt.Println(JDE2Date((b)))
|
|
|
|
fmt.Println(time.Now().UnixNano() - a)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_SunTwilightMo(t *testing.T) {
|
|
|
|
cst := time.FixedZone("cst", 8*3600)
|
|
|
|
jde := Date2JDE(time.Date(2023, 10, 3, 15, 59, 0, 0, cst))
|
|
|
|
fmt.Println(GetAsaTime(jde, 113.58880556, 87.66833333, 8, -6))
|
|
|
|
|
|
|
|
for i := 10.0; i < 90.0; i += 0.3 {
|
|
|
|
fmt.Println(i, GetAsaTime(jde, 125.45506654, float64(i), 8, -6))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_SunTwilightEv(t *testing.T) {
|
|
|
|
cst := time.FixedZone("cst", 8*3600)
|
|
|
|
jde := Date2JDE(time.Date(2023, 10, 3, 15, 59, 0, 0, cst))
|
|
|
|
for i := 10.0; i < 90.0; i += 0.3 {
|
|
|
|
fmt.Println(i, GetBanTime(jde, 115, float64(i), 8, -18))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_SunRiseRound(t *testing.T) {
|
|
|
|
jde := GetNowJDE()
|
|
|
|
for i := 10.0; i < 90.0; i += 0.3 {
|
|
|
|
fmt.Println(i, GetSunRiseTime(jde, 115, float64(i), 8, 0, 0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func Test_SunDown(t *testing.T) {
|
|
|
|
jde := GetNowJDE()
|
|
|
|
for i := 10.0; i < 90.0; i += 0.3 {
|
|
|
|
fmt.Println(i, GetSunDownTime(jde, 115, float64(i), 8, 0, 0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_SunAz(t *testing.T) {
|
|
|
|
cst := time.FixedZone("cst", 8*3600)
|
|
|
|
fmt.Println(SunAngle(Date2JDE(time.Date(2022, 5, 30, 11, 55, 0, 0, cst)),
|
|
|
|
120, 30, 8.0))
|
|
|
|
}
|