Compare commits

..

9 Commits

@ -7,6 +7,8 @@ import (
"time" "time"
) )
var defDeltaTFn = DefaultDeltaT
/* /*
@name: @name:
@dec: 1582 @dec: 1582
@ -91,7 +93,36 @@ func dt_cal(y float64) float64 { //传入年, 返回世界时UT与原子时
res := d[i+1] + d[i+2]*t1 + d[i+3]*t2 + d[i+4]*t3 res := d[i+1] + d[i+2]*t1 + d[i+3]*t2 + d[i+4]*t3
return (res) return (res)
} }
func DeltaT(Date float64, IsJDE bool) (Result float64) { //传入年或儒略日,传出为秒
func DeltaT(date float64, isJDE bool) float64 {
return defDeltaTFn(date, isJDE)
}
func SetDeltaTFn(fn func(float64, bool) float64) {
if fn != nil {
defDeltaTFn = fn
}
}
func GetDeltaTFn() func(float64, bool) float64 {
return defDeltaTFn
}
func OldDefaultDeltaT(Date float64, IsJDE bool) (Result float64) { //传入年或儒略日,传出为秒
var Year float64
if IsJDE {
dates := JDE2Date(Date)
Year = float64(dates.Year()) + float64(dates.YearDay())/365.0
} else {
Year = Date
}
if Year < 2100 && Year >= 2010 {
return dt_cal(Year)
}
return DefaultDeltaT(Date, IsJDE)
}
func DefaultDeltaT(Date float64, IsJDE bool) (Result float64) { //传入年或儒略日,传出为秒
var Year float64 var Year float64
if IsJDE { if IsJDE {
dates := JDE2Date(Date) dates := JDE2Date(Date)
@ -120,6 +151,7 @@ func DeltaT(Date float64, IsJDE bool) (Result float64) { //传入年或儒略日
} }
return return
} }
func TD2UT(JDE float64, UT2TD bool) float64 { // true 世界时转力学时CCfalse 力学时转世界时VV func TD2UT(JDE float64, UT2TD bool) float64 { // true 世界时转力学时CCfalse 力学时转世界时VV
Deltat := DeltaT(JDE, true) Deltat := DeltaT(JDE, true)
@ -165,10 +197,14 @@ func JDE2Date(JD float64) time.Time {
Days = math.Floor(Days) Days = math.Floor(Days)
tz, _ := time.LoadLocation("Local") tz, _ := time.LoadLocation("Local")
dates := time.Date(int(Years), time.Month(int(Months)), int(Days), 0, 0, 0, 0, tz) dates := time.Date(int(Years), time.Month(int(Months)), int(Days), 0, 0, 0, 0, tz)
dates = time.Unix(dates.Unix()+int64(tms), int64((tms-math.Floor(tms))*1000000000)) return time.Unix(dates.Unix()+int64(tms), int64((tms-math.Floor(tms))*1000000000))
return dates
} }
// JDE2DateByZone JDE儒略日转日期
// JD: 儒略日
// tz: 目标时区
// byZone: (true: 传入的儒略日视为目标时区当地时间的儒略日false: 传入的儒略日视为UTC时间的儒略日)
// 回参:转换后的日期,时区始终为目标时区
func JDE2DateByZone(JD float64, tz *time.Location, byZone bool) time.Time { func JDE2DateByZone(JD float64, tz *time.Location, byZone bool) time.Time {
JD = JD + 0.5 JD = JD + 0.5
Z := float64(int(JD)) Z := float64(int(JD))
@ -199,12 +235,12 @@ func JDE2DateByZone(JD float64, tz *time.Location, byZone bool) time.Time {
} }
tms := (Days - math.Floor(Days)) * 24 * 3600 tms := (Days - math.Floor(Days)) * 24 * 3600
Days = math.Floor(Days) Days = math.Floor(Days)
var transTz = tz
if !byZone { if !byZone {
dates := time.Date(int(Years), time.Month(int(Months)), int(Days), 0, 0, 0, 0, time.UTC) transTz = time.UTC
return time.Unix(dates.Unix()+int64(tms), int64((tms-math.Floor(tms))*1000000000)).In(tz)
} }
dates := time.Date(int(Years), time.Month(int(Months)), int(Days), 0, 0, 0, 0, tz) return time.Date(int(Years), time.Month(int(Months)), int(Days), 0, 0, 0, 0, transTz).
return time.Unix(dates.Unix()+int64(tms), int64((tms-math.Floor(tms))*1000000000)) Add(time.Duration(int64(1000000000 * tms))).In(tz)
} }
func GetLunar(year, month, day int, tz float64) (lmonth, lday int, leap bool, result string) { func GetLunar(year, month, day int, tz float64) (lmonth, lday int, leap bool, result string) {
@ -233,33 +269,33 @@ func GetLunar(year, month, day int, tz float64) (lmonth, lday int, leap bool, re
} else { } else {
year-- year--
} }
jieqi := GetOneYearJQ(year) //一年的节气 jieqi := GetJieqiLoops(year, 25) //一年的节气
moon := GetOneYearMoon(float64(year)) //一年朔月日 moon := GetMoonLoops(float64(year), 17) //一年朔月日
winter1 := jieqi[1] //第一年冬至日 winter1 := jieqi[0] - 8.0/24 + tz //第一年冬至日
winter2 := jieqi[25] //第二年冬至日 winter2 := jieqi[24] - 8.0/24 + tz //第二年冬至日
for k, v := range moon { for idx, v := range moon {
if tz != 8.0/24 { if tz != 8.0/24 {
v = v - 8.0/24 + tz v = v - 8.0/24 + tz
} }
if v-math.Floor(v) > 0.5 { if v-math.Floor(v) > 0.5 {
moon[k] = math.Floor(v) + 0.5 moon[idx] = math.Floor(v) + 0.5
} else { } else {
moon[k] = math.Floor(v) - 0.5 moon[idx] = math.Floor(v) - 0.5
} }
} //置闰月为0点 } //置闰月为0点
for k, v := range jieqi { for idx, v := range jieqi {
if tz != 8.0/24 { if tz != 8.0/24 {
v = v - 8.0/24 + tz v = v - 8.0/24 + tz
} }
if v-math.Floor(v) > 0.5 { if v-math.Floor(v) > 0.5 {
jieqi[k] = math.Floor(v) + 0.5 jieqi[idx] = math.Floor(v) + 0.5
} else { } else {
jieqi[k] = math.Floor(v) - 0.5 jieqi[idx] = math.Floor(v) - 0.5
} }
} //置节气为0点 } //置节气为0点
mooncount := 0 //年内朔望月计数 mooncount := 0 //年内朔望月计数
var min, max int = 20, 0 //最大最小计数 var min, max int = 20, 0 //最大最小计数
for i := 1; i < 16; i++ { for i := 0; i < 15; i++ {
if moon[i] >= winter1 && moon[i] < winter2 { if moon[i] >= winter1 && moon[i] < winter2 {
if i <= min { if i <= min {
min = i min = i
@ -272,7 +308,7 @@ func GetLunar(year, month, day int, tz float64) (lmonth, lday int, leap bool, re
} }
leapmonth := 20 leapmonth := 20
if mooncount == 13 { //存在闰月 if mooncount == 13 { //存在闰月
j, i := 3, 1 var j, i = 2, 0
for i = min; i <= max; i++ { for i = min; i <= max; i++ {
if !(moon[i] <= jieqi[j] && moon[i+1] > jieqi[j]) { if !(moon[i] <= jieqi[j] && moon[i+1] > jieqi[j]) {
break break
@ -332,33 +368,33 @@ func GetSolar(year, month, day int, leap bool, tz float64) float64 {
if month < 11 { if month < 11 {
year-- year--
} }
jieqi := GetOneYearJQ(year) //一年的节气 jieqi := GetJieqiLoops(year, 25) //一年的节气
moon := GetOneYearMoon(float64(year)) //一年朔月日 moon := GetMoonLoops(float64(year), 17) //一年朔月日
winter1 := jieqi[1] //第一年冬至日 winter1 := jieqi[0] - 8.0/24 + tz //第一年冬至日
winter2 := jieqi[25] //第二年冬至日 winter2 := jieqi[24] - 8.0/24 + tz //第二年冬至日
for k, v := range moon { for idx, v := range moon {
if tz != 8.0/24 { if tz != 8.0/24 {
v = v - 8.0/24 + tz v = v - 8.0/24 + tz
} }
if v-math.Floor(v) > 0.5 { if v-math.Floor(v) > 0.5 {
moon[k] = math.Floor(v) + 0.5 moon[idx] = math.Floor(v) + 0.5
} else { } else {
moon[k] = math.Floor(v) - 0.5 moon[idx] = math.Floor(v) - 0.5
} }
} //置闰月为0点 } //置闰月为0点
for k, v := range jieqi { for idx, v := range jieqi {
if tz != 8.0/24 { if tz != 8.0/24 {
v = v - 8.0/24 + tz v = v - 8.0/24 + tz
} }
if v-math.Floor(v) > 0.5 { if v-math.Floor(v) > 0.5 {
jieqi[k] = math.Floor(v) + 0.5 jieqi[idx] = math.Floor(v) + 0.5
} else { } else {
jieqi[k] = math.Floor(v) - 0.5 jieqi[idx] = math.Floor(v) - 0.5
} }
} //置节气为0点 } //置节气为0点
mooncount := 0 //年内朔望月计数 mooncount := 0 //年内朔望月计数
var min, max int = 20, 0 //最大最小计数 var min, max int = 20, 0 //最大最小计数
for i := 1; i < 16; i++ { for i := 0; i < 15; i++ {
if moon[i] >= winter1 && moon[i] < winter2 { if moon[i] >= winter1 && moon[i] < winter2 {
if i <= min { if i <= min {
min = i min = i
@ -371,7 +407,7 @@ func GetSolar(year, month, day int, leap bool, tz float64) float64 {
} }
leapmonth := 20 leapmonth := 20
if mooncount == 13 { //存在闰月 if mooncount == 13 { //存在闰月
j, i := 3, 1 var j, i = 2, 0
for i = min; i <= max; i++ { for i = min; i <= max; i++ {
if !(moon[i] <= jieqi[j] && moon[i+1] > jieqi[j]) { if !(moon[i] <= jieqi[j] && moon[i+1] > jieqi[j]) {
break break

@ -0,0 +1,126 @@
package basic
import (
"encoding/json"
"fmt"
"math"
"os"
)
func generateMagicNumber() {
//0月份 00000 日期 0000闰月 0000000000000 农历信息
var tz = 8.0000 / 24.000
yearMap := make(map[int][][]int) // {1 month,1 leap,2 29/30}
spYear := make(map[int][]int)
var upper []uint16
var lower []uint16
//var info uint32 = 0
for year := 1899; year <= 2401; year++ {
fmt.Println(year)
jieqi := GetJieqiLoops(year, 25) //一年的节气
moon := GetMoonLoops(float64(year), 17) //一年朔月日
winter1 := jieqi[0] - 8.0/24 + tz //第一年冬至日
winter2 := jieqi[24] - 8.0/24 + tz //第二年冬至日
for idx, v := range moon {
if tz != 8.0/24 {
v = v - 8.0/24 + tz
}
if v-math.Floor(v) > 0.5 {
moon[idx] = math.Floor(v) + 0.5
} else {
moon[idx] = math.Floor(v) - 0.5
}
} //置闰月为0点
for idx, v := range jieqi {
if tz != 8.0/24 {
v = v - 8.0/24 + tz
}
if v-math.Floor(v) > 0.5 {
jieqi[idx] = math.Floor(v) + 0.5
} else {
jieqi[idx] = math.Floor(v) - 0.5
}
} //置节气为0点
mooncount := 0 //年内朔望月计数
var min, max int = 20, 0 //最大最小计数
for i := 0; i < 15; i++ {
if moon[i] >= winter1 && moon[i] < winter2 {
if i <= min {
min = i
}
if i >= max {
max = i
}
mooncount++
}
}
leapmonth := 20
if mooncount == 13 { //存在闰月
var j, i = 2, 0
for i = min; i <= max; i++ {
if !(moon[i] <= jieqi[j] && moon[i+1] > jieqi[j]) {
break
}
j += 2
}
leapmonth = i - min + 1
}
month := 11
for idx := min; idx <= max; idx++ {
leap := 0
if idx != leapmonth {
month++
if month > 12 {
month -= 12
}
} else {
leap = 1
}
if leap == 0 && month == 1 {
cp := JDE2Date(moon[idx])
spYear[year+1] = append(spYear[year+1], []int{int(cp.Month()), cp.Day()}...)
}
if idx < 6 && month > 10 {
yearMap[year] = append(yearMap[year], []int{month, leap, int(moon[idx+1] - moon[idx])})
} else {
yearMap[year+1] = append(yearMap[year+1], []int{month, leap, int(moon[idx+1] - moon[idx])})
}
}
}
for year := 1900; year <= 2400; year++ {
fmt.Println(year)
up, low := magicNumberSpilt(magicNumber(yearMap[year], spYear[year]))
upper = append(upper, up)
lower = append(lower, uint16(low))
}
res := make(map[string]interface{})
res["up"] = upper
res["low"] = lower
d, _ := json.Marshal(res)
os.WriteFile("test.json", d, 0644)
}
func magicNumber(y1 [][]int, y2 []int) int32 {
var res int32
res = int32(y2[1]) << 18
if y2[0] == 2 {
res = res | 0x800000
}
for idx, v := range y1 {
if v[2] == 30 {
res = res | (1 << (13 - idx))
}
if v[1] == 1 {
res = (res & 0xFC3FFF) | int32((v[0])<<14)
}
}
return res
}
func magicNumberSpilt(magic int32) (uint16, uint8) {
var upper uint16
var lower uint8
lower = uint8(magic)
upper = uint16(magic >> 8)
return upper, lower
}

@ -1055,7 +1055,13 @@ func MoonTrueRa(JD float64) float64 {
return LoToRa(JD, MoonApparentLo(JD), MoonTrueBo(JD)) return LoToRa(JD, MoonApparentLo(JD), MoonTrueBo(JD))
} }
/** func MoonTrueRaDec(JD float64) (float64, float64) {
return LoBoToRaDec(JD, MoonApparentLo(JD), MoonTrueBo(JD))
}
/*
*
* *
*/ */
@ -1702,7 +1708,8 @@ func HMoonTrueRa(JD float64) float64 {
return LoToRa(JD, HMoonApparentLo(JD), HMoonTrueBo(JD)) return LoToRa(JD, HMoonApparentLo(JD), HMoonTrueBo(JD))
} }
/** /*
*
* *
*/ */

@ -1,6 +1,7 @@
package basic package basic
import ( import (
"b612.me/astro/tools"
"fmt" "fmt"
"math" "math"
"testing" "testing"
@ -21,7 +22,49 @@ func Test_MoonDown(t *testing.T) {
fmt.Println(i, GetMoonDownTime(jde, 115, float64(i), 8, 1, 0)) fmt.Println(i, GetMoonDownTime(jde, 115, float64(i), 8, 1, 0))
} }
} }
func Test_MoonDiff(t *testing.T) {
n := JDECalc(2000, 1, 1)
var maxRa, maxDec, maxLo, maxBo float64
for i := float64(0); i < 365.2422*3; i++ {
tLo := HMoonApparentLo(n + i)
tBo := HMoonTrueBo(n + i)
tRa, tDec := HMoonTrueRaDec(n + i)
fRa, fDec := MoonTrueRaDec(n + i)
fLo := MoonApparentLo(n + i)
fBo := MoonTrueBo(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
}
tmp = tools.Limit360(math.Abs(tBo - fBo))
if tmp > 300 {
tmp = 360 - tmp
}
if tmp > maxBo {
maxBo = tmp
}
}
fmt.Printf("%.15f %.15f %.15f %.15f\n", maxRa*3600, maxDec*3600, maxLo*3600, maxBo*3600)
}
func Test_MoonRise(t *testing.T) { func Test_MoonRise(t *testing.T) {
//2.459984692085961e+06 113.58880556 87.36833333 8 0 0 //2.459984692085961e+06 113.58880556 87.36833333 8 0 0
//2.459984692085961e+06 113.58880556 87.36833333 8 0 0 //2.459984692085961e+06 113.58880556 87.36833333 8 0 0

File diff suppressed because one or more lines are too long

@ -20,6 +20,27 @@ func Test_ParseStar(t *testing.T) {
} }
} }
func TestGetStarByChniese(t *testing.T) {
err := LoadStarData()
if err != nil {
t.Fatal(err)
}
sirius, err := StarDataByChinese("天狼星")
if err != nil {
t.Fatal(err)
}
if sirius.HIP != 32349 || sirius.HR != 2491 {
t.Fatal("cannot found star")
}
fmt.Printf("%+v\n", sirius)
sirius, err = StarDataByChinese("天狼")
if err != nil {
t.Fatal(err)
}
if sirius.HIP != 32349 || sirius.HR != 2491 {
t.Fatal("cannot found star")
}
}
func TestGetRaDecByDate(t *testing.T) { func TestGetRaDecByDate(t *testing.T) {
err := LoadStarData() err := LoadStarData()
@ -30,6 +51,7 @@ func TestGetRaDecByDate(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
fmt.Printf("%+v\n", sirius)
fmt.Println(Format(sirius.Ra/15, 1), Format(sirius.Dec, 0)) fmt.Println(Format(sirius.Ra/15, 1), Format(sirius.Dec, 0))
now := GetNowJDE() now := GetNowJDE()
ra, dec := sirius.RaDecByJde(now) ra, dec := sirius.RaDecByJde(now)

@ -27,767 +27,43 @@ func Sita(JD float64) float64 {
/* /*
* @name * @name
*/ */
func HJZD(JD float64) float64 { // '黄经章动 func HJZD(jd float64) float64 { // '黄经章动
t := (jd - 2451545) / 36525.000
// Dim p As Double, T As Double, Lmoon As Double d := 297.8502042 + 445267.1115168*t - 0.0016300*t*t + t*t*t/545868 - t*t*t*t/113065000
T := (JD - 2451545) / 36525.000 m := SunM(jd)
D := 297.8502042 + 445267.1115168*T - 0.0016300*T*T + T*T*T/545868 - T*T*T*T/113065000 n := MoonM(jd)
M := SunM(JD) f := MoonLonX(jd)
N := MoonM(JD) o := 125.04452 - 1934.136261*t + 0.0020708*t*t + t*t*t/450000
F := MoonLonX(JD) tp := [][]float64{{0, 0, 0, 0, 1, -171996, -174.2 * t}, {-2, 0, 0, 2, 2, -13187, -1.6 * t}, {0, 0, 0, 2, 2, -2274, -0.2 * t}, {0, 0, 0, 0, 2, 2062, 0.2 * t}, {0, 1, 0, 0, 0, 1426, -3.4 * t}, {0, 0, 1, 0, 0, 712, 0.1 * t}, {-2, 1, 0, 2, 2, -517, 1.2 * t}, {0, 0, 0, 2, 1, -386, -0.4 * t}, {0, 0, 1, 2, 2, -301, 0}, {-2, -1, 0, 2, 2, 217, -0.5 * t}, {-2, 0, 1, 0, 0, -158, 0}, {-2, 0, 0, 2, 1, 129, 0.1 * t}, {0, 0, -1, 2, 2, 123, 0}, {2, 0, 0, 0, 0, 63, 0}, {0, 0, 1, 0, 1, 63, 0.1 * t}, {2, 0, -1, 2, 2, -59, 0}, {0, 0, -1, 0, 1, -58, -0.1 * t}, {0, 0, 1, 2, 1, -51, 0}, {-2, 0, 2, 0, 0, 48, 0}, {0, 0, -2, 2, 1, 46, 0}, {2, 0, 0, 2, 2, -38, 0}, {0, 0, 2, 2, 2, -31, 0}, {0, 0, 2, 0, 0, 29, 0}, {-2, 0, 1, 2, 2, 29, 0}, {0, 0, 0, 2, 0, 26, 0}, {-2, 0, 0, 2, 0, -22, 0}, {0, 0, -1, 2, 1, 21, 0}, {0, 2, 0, 0, 0, 17, -0.1 * t}, {2, 0, -1, 0, 1, 16, 0}, {-2, 2, 0, 2, 2, -16, 0.1 * t}, {0, 1, 0, 0, 1, -15, 0}, {-2, 0, 1, 0, 1, -13, 0}, {0, -1, 0, 0, 1, -12, 0}, {0, 0, 2, -2, 0, 11, 0}, {2, 0, -1, 2, 1, -10, 0}, {2, 0, 1, 2, 2, -8, 0}, {0, 1, 0, 2, 2, 7, 0}, {-2, 1, 1, 0, 0, -7, 0}, {0, -1, 0, 2, 2, -7, 0}, {2, 0, 0, 2, 1, -7, 0}, {2, 0, 1, 0, 0, 6, 0}, {-2, 0, 2, 2, 2, 6, 0}, {-2, 0, 1, 2, 1, 6, 0}, {2, 0, -2, 0, 1, -6, 0}, {2, 0, 0, 0, 1, -6, 0}, {0, -1, 1, 0, 0, 5, 0}, {-2, -1, 0, 2, 1, -5, 0}, {-2, 0, 0, 0, 1, -5, 0}, {0, 0, 2, 2, 1, -5, 0}, {-2, 0, 2, 0, 1, 4, 0}, {-2, 1, 0, 2, 1, 4, 0}, {0, 0, 1, -2, 0, 4, 0}, {-1, 0, 1, 0, 0, -4, 0}, {-2, 1, 0, 0, 0, -4, 0}, {1, 0, 0, 0, 0, -4, 0}, {0, 0, 1, 2, 0, 3, 0}, {0, 0, -2, 2, 2, -3, 0}, {-1, -1, 1, 0, 0, -3, 0}, {0, 1, 1, 0, 0, -3, 0}, {0, -1, 1, 2, 2, -3, 0}, {2, -1, -1, 2, 2, -3, 0}, {0, 0, 3, 2, 2, -3, 0}, {2, -1, 0, 2, 2, -3, 0}}
O := 125.04452 - 1934.136261*T + 0.0020708*T*T + T*T*T/450000 var s float64
//die(T." ".D." ".M." ".N." ".F." ".O); for i := 0; i < len(tp); i++ {
tp := make(map[int]map[int]float64) s += (tp[i][5] + tp[i][6]) * Sin(d*tp[i][0]+m*tp[i][1]+n*tp[i][2]+f*tp[i][3]+o*tp[i][4])
for i := 1; i < 64; i++ { }
tp[i] = make(map[int]float64) //P=-17.20*Sin(o)-1.32*Sin(2*280.4665 + 36000.7698*t)-0.23*Sin(2*218.3165 + 481267.8813*t )+0.21*Sin(2*o);
}
tp[1][1] = 0
tp[1][2] = 0
tp[1][3] = 0
tp[1][4] = 0
tp[1][5] = 1
tp[1][6] = -171996
tp[1][7] = -174.2 * T
tp[2][1] = -2
tp[2][2] = 0
tp[2][3] = 0
tp[2][4] = 2
tp[2][5] = 2
tp[2][6] = -13187
tp[2][7] = -1.6 * T
tp[3][1] = 0
tp[3][2] = 0
tp[3][3] = 0
tp[3][4] = 2
tp[3][5] = 2
tp[3][6] = -2274
tp[3][7] = -0.2 * T
tp[4][1] = 0
tp[4][2] = 0
tp[4][3] = 0
tp[4][4] = 0
tp[4][5] = 2
tp[4][6] = 2062
tp[4][7] = 0.2 * T
tp[5][1] = 0
tp[5][2] = 1
tp[5][3] = 0
tp[5][4] = 0
tp[5][5] = 0
tp[5][6] = 1426
tp[5][7] = -3.4 * T
tp[6][1] = 0
tp[6][2] = 0
tp[6][3] = 1
tp[6][4] = 0
tp[6][5] = 0
tp[6][6] = 712
tp[6][7] = 0.1 * T
tp[7][1] = -2
tp[7][2] = 1
tp[7][3] = 0
tp[7][4] = 2
tp[7][5] = 2
tp[7][6] = -517
tp[7][7] = 1.2 * T
tp[8][1] = 0
tp[8][2] = 0
tp[8][3] = 0
tp[8][4] = 2
tp[8][5] = 1
tp[8][6] = -386
tp[8][7] = -0.4 * T
tp[9][1] = 0
tp[9][2] = 0
tp[9][3] = 1
tp[9][4] = 2
tp[9][5] = 2
tp[9][6] = -301
tp[9][7] = 0
tp[10][1] = -2
tp[10][2] = -1
tp[10][3] = 0
tp[10][4] = 2
tp[10][5] = 2
tp[10][6] = 217
tp[10][7] = -0.5 * T
tp[11][1] = -2
tp[11][2] = 0
tp[11][3] = 1
tp[11][4] = 0
tp[11][5] = 0
tp[11][6] = -158
tp[11][7] = 0
tp[12][1] = -2
tp[12][2] = 0
tp[12][3] = 0
tp[12][4] = 2
tp[12][5] = 1
tp[12][6] = 129
tp[12][7] = 0.1 * T
tp[13][1] = 0
tp[13][2] = 0
tp[13][3] = -1
tp[13][4] = 2
tp[13][5] = 2
tp[13][6] = 123
tp[13][7] = 0
tp[14][1] = 2
tp[14][2] = 0
tp[14][3] = 0
tp[14][4] = 0
tp[14][5] = 0
tp[14][6] = 63
tp[14][7] = 0
tp[15][1] = 0
tp[15][2] = 0
tp[15][3] = 1
tp[15][4] = 0
tp[15][5] = 1
tp[15][6] = 63
tp[15][7] = 0.1 * T
tp[16][1] = 2
tp[16][2] = 0
tp[16][3] = -1
tp[16][4] = 2
tp[16][5] = 2
tp[16][6] = -59
tp[16][7] = 0
tp[17][1] = 0
tp[17][2] = 0
tp[17][3] = -1
tp[17][4] = 0
tp[17][5] = 1
tp[17][6] = -58
tp[17][7] = -0.1 * T
tp[18][1] = 0
tp[18][2] = 0
tp[18][3] = 1
tp[18][4] = 2
tp[18][5] = 1
tp[18][6] = -51
tp[18][7] = 0
tp[19][1] = -2
tp[19][2] = 0
tp[19][3] = 2
tp[19][4] = 0
tp[19][5] = 0
tp[19][6] = 48
tp[19][7] = 0
tp[20][1] = 0
tp[20][2] = 0
tp[20][3] = -2
tp[20][4] = 2
tp[20][5] = 1
tp[20][6] = 46
tp[20][7] = 0
tp[21][1] = 2
tp[21][2] = 0
tp[21][3] = 0
tp[21][4] = 2
tp[21][5] = 2
tp[21][6] = -38
tp[21][7] = 0
tp[22][1] = 0
tp[22][2] = 0
tp[22][3] = 2
tp[22][4] = 2
tp[22][5] = 2
tp[22][6] = -31
tp[22][7] = 0
tp[23][1] = 0
tp[23][2] = 0
tp[23][3] = 2
tp[23][4] = 0
tp[23][5] = 0
tp[23][6] = 29
tp[23][7] = 0
tp[24][1] = -2
tp[24][2] = 0
tp[24][3] = 1
tp[24][4] = 2
tp[24][5] = 2
tp[24][6] = 29
tp[24][7] = 0
tp[25][1] = 0
tp[25][2] = 0
tp[25][3] = 0
tp[25][4] = 2
tp[25][5] = 0
tp[25][6] = 26
tp[25][7] = 0
tp[26][1] = -2
tp[26][2] = 0
tp[26][3] = 0
tp[26][4] = 2
tp[26][5] = 0
tp[26][6] = -22
tp[26][7] = 0
tp[27][1] = 0
tp[27][2] = 0
tp[27][3] = -1
tp[27][4] = 2
tp[27][5] = 1
tp[27][6] = 21
tp[27][7] = 0
tp[28][1] = 0
tp[28][2] = 2
tp[28][3] = 0
tp[28][4] = 0
tp[28][5] = 0
tp[28][6] = 17
tp[28][7] = -0.1 * T
tp[29][1] = 2
tp[29][2] = 0
tp[29][3] = -1
tp[29][4] = 0
tp[29][5] = 1
tp[29][6] = 16
tp[29][7] = 0
tp[30][1] = -2
tp[30][2] = 2
tp[30][3] = 0
tp[30][4] = 2
tp[30][5] = 2
tp[30][6] = -16
tp[30][7] = 0.1 * T
tp[31][1] = 0
tp[31][2] = 1
tp[31][3] = 0
tp[31][4] = 0
tp[31][5] = 1
tp[31][6] = -15
tp[31][7] = 0
tp[32][1] = -2
tp[32][2] = 0
tp[32][3] = 1
tp[32][4] = 0
tp[32][5] = 1
tp[32][6] = -13
tp[32][7] = 0
tp[33][1] = 0
tp[33][2] = -1
tp[33][3] = 0
tp[33][4] = 0
tp[33][5] = 1
tp[33][6] = -12
tp[33][7] = 0
tp[34][1] = 0
tp[34][2] = 0
tp[34][3] = 2
tp[34][4] = -2
tp[34][5] = 0
tp[34][6] = 11
tp[34][7] = 0
tp[35][1] = 2
tp[35][2] = 0
tp[35][3] = -1
tp[35][4] = 2
tp[35][5] = 1
tp[35][6] = -10
tp[35][7] = 0
tp[36][1] = 2
tp[36][2] = 0
tp[36][3] = 1
tp[36][4] = 2
tp[36][5] = 2
tp[36][6] = -8
tp[36][7] = 0
tp[37][1] = 0
tp[37][2] = 1
tp[37][3] = 0
tp[37][4] = 2
tp[37][5] = 2
tp[37][6] = 7
tp[37][7] = 0
tp[38][1] = -2
tp[38][2] = 1
tp[38][3] = 1
tp[38][4] = 0
tp[38][5] = 0
tp[38][6] = -7
tp[38][7] = 0
tp[39][1] = 0
tp[39][2] = -1
tp[39][3] = 0
tp[39][4] = 2
tp[39][5] = 2
tp[39][6] = -7
tp[39][7] = 0
tp[40][1] = 2
tp[40][2] = 0
tp[40][3] = 0
tp[40][4] = 2
tp[40][5] = 1
tp[40][6] = -7
tp[40][7] = 0
tp[41][1] = 2
tp[41][2] = 0
tp[41][3] = 1
tp[41][4] = 0
tp[41][5] = 0
tp[41][6] = 6
tp[41][7] = 0
tp[42][1] = -2
tp[42][2] = 0
tp[42][3] = 2
tp[42][4] = 2
tp[42][5] = 2
tp[42][6] = 6
tp[42][7] = 0
tp[43][1] = -2
tp[43][2] = 0
tp[43][3] = 1
tp[43][4] = 2
tp[43][5] = 1
tp[43][6] = 6
tp[43][7] = 0
tp[44][1] = 2
tp[44][2] = 0
tp[44][3] = -2
tp[44][4] = 0
tp[44][5] = 1
tp[44][6] = -6
tp[44][7] = 0
tp[45][1] = 2
tp[45][2] = 0
tp[45][3] = 0
tp[45][4] = 0
tp[45][5] = 1
tp[45][6] = -6
tp[45][7] = 0
tp[46][1] = 0
tp[46][2] = -1
tp[46][3] = 1
tp[46][4] = 0
tp[46][5] = 0
tp[46][6] = 5
tp[46][7] = 0
tp[47][1] = -2
tp[47][2] = -1
tp[47][3] = 0
tp[47][4] = 2
tp[47][5] = 1
tp[47][6] = -5
tp[47][7] = 0
tp[48][1] = -2
tp[48][2] = 0
tp[48][3] = 0
tp[48][4] = 0
tp[48][5] = 1
tp[48][6] = -5
tp[48][7] = 0
tp[49][1] = 0
tp[49][2] = 0
tp[49][3] = 2
tp[49][4] = 2
tp[49][5] = 1
tp[49][6] = -5
tp[49][7] = 0
tp[50][1] = -2
tp[50][2] = 0
tp[50][3] = 2
tp[50][4] = 0
tp[50][5] = 1
tp[50][6] = 4
tp[50][7] = 0
tp[51][1] = -2
tp[51][2] = 1
tp[51][3] = 0
tp[51][4] = 2
tp[51][5] = 1
tp[51][6] = 4
tp[51][7] = 0
tp[52][1] = 0
tp[52][2] = 0
tp[52][3] = 1
tp[52][4] = -2
tp[52][5] = 0
tp[52][6] = 4
tp[52][7] = 0
tp[53][1] = -1
tp[53][2] = 0
tp[53][3] = 1
tp[53][4] = 0
tp[53][5] = 0
tp[53][6] = -4
tp[53][7] = 0
tp[54][1] = -2
tp[54][2] = 1
tp[54][3] = 0
tp[54][4] = 0
tp[54][5] = 0
tp[54][6] = -4
tp[54][7] = 0
tp[55][1] = 1
tp[55][2] = 0
tp[55][3] = 0
tp[55][4] = 0
tp[55][5] = 0
tp[55][6] = -4
tp[55][7] = 0
tp[56][1] = 0
tp[56][2] = 0
tp[56][3] = 1
tp[56][4] = 2
tp[56][5] = 0
tp[56][6] = 3
tp[56][7] = 0
tp[57][1] = 0
tp[57][2] = 0
tp[57][3] = -2
tp[57][4] = 2
tp[57][5] = 2
tp[57][6] = -3
tp[57][7] = 0
tp[58][1] = -1
tp[58][2] = -1
tp[58][3] = 1
tp[58][4] = 0
tp[58][5] = 0
tp[58][6] = -3
tp[58][7] = 0
tp[59][1] = 0
tp[59][2] = 1
tp[59][3] = 1
tp[59][4] = 0
tp[59][5] = 0
tp[59][6] = -3
tp[59][7] = 0
tp[60][1] = 0
tp[60][2] = -1
tp[60][3] = 1
tp[60][4] = 2
tp[60][5] = 2
tp[60][6] = -3
tp[60][7] = 0
tp[61][1] = 2
tp[61][2] = -1
tp[61][3] = -1
tp[61][4] = 2
tp[61][5] = 2
tp[61][6] = -3
tp[61][7] = 0
tp[62][1] = 0
tp[62][2] = 0
tp[62][3] = 3
tp[62][4] = 2
tp[62][5] = 2
tp[62][6] = -3
tp[62][7] = 0
tp[63][1] = 2
tp[63][2] = -1
tp[63][3] = 0
tp[63][4] = 2
tp[63][5] = 2
tp[63][6] = -3
tp[63][7] = 0
var S float64
for i := 1; i < 64; i++ {
S += (tp[i][6] + tp[i][7]) * Sin(D*tp[i][1]+M*tp[i][2]+N*tp[i][3]+F*tp[i][4]+O*tp[i][5])
}
//P=-17.20*Sin(O)-1.32*Sin(2*280.4665 + 36000.7698*T)-0.23*Sin(2*218.3165 + 481267.8813*T )+0.21*Sin(2*O);
//return P/3600; //return P/3600;
return (S / 10000) / 3600 return (s / 10000) / 3600
} }
/* /*
* *
*/ */
func JJZD(JD float64) float64 { //交角章动 func JJZD(jd float64) float64 { //交角章动
t := (jd - 2451545) / 36525
T := (JD - 2451545) / 36525 //d = 297.85036 +455267.111480*t - 0.0019142*t*t+ t*t*t/189474;
//D = 297.85036 +455267.111480*T - 0.0019142*T*T+ T*T*T/189474; //m = 357.52772 + 35999.050340*t - 0.0001603*t*t- t*t*t/300000;
//M = 357.52772 + 35999.050340*T - 0.0001603*T*T- T*T*T/300000; //n= 134.96298 + 477198.867398*t + 0.0086972*t*t + t*t*t/56250;
//N= 134.96298 + 477198.867398*T + 0.0086972*T*T + T*T*T/56250; //f = 93.27191 + 483202.017538*t - 0.0036825*t*t + t*t*t/327270;
//F = 93.27191 + 483202.017538*T - 0.0036825*T*T + T*T*T/327270; d := 297.8502042 + 445267.1115168*t - 0.0016300*t*t + t*t*t/545868 - t*t*t*t/113065000
D := 297.8502042 + 445267.1115168*T - 0.0016300*T*T + T*T*T/545868 - T*T*T*T/113065000 m := SunM(jd)
M := SunM(JD) n := MoonM(jd)
N := MoonM(JD) f := MoonLonX(jd)
F := MoonLonX(JD) o := 125.04452 - 1934.136261*t + 0.0020708*t*t + t*t*t/450000
O := 125.04452 - 1934.136261*T + 0.0020708*T*T + T*T*T/450000 tp := [][]float64{{0, 0, 0, 0, 1, 92025, 8.9 * t}, {-2, 0, 0, 2, 2, 5736, -3.1 * t}, {0, 0, 0, 2, 2, 977, -0.5 * t}, {0, 0, 0, 0, 2, -895, 0.5 * t}, {0, 1, 0, 0, 0, 54, -0.1 * t}, {0, 0, 1, 0, 0, -7, 0}, {-2, 1, 0, 2, 2, 224, -0.6 * t}, {0, 0, 0, 2, 1, 200, 0}, {0, 0, 1, 2, 2, 129, -0.1 * t}, {-2, -1, 0, 2, 2, -95, 0.3 * t}, {-2, 0, 0, 2, 1, -70, 0}, {0, 0, -1, 2, 2, -53, 0}, {2, 0, 0, 0, 0, 63, 0}, {0, 0, 1, 0, 1, -33, 0}, {2, 0, -1, 2, 2, 26, 0}, {0, 0, -1, 0, 1, 32, 0}, {0, 0, 1, 2, 1, 27, 0}, {0, 0, -2, 2, 1, -24, 0}, {2, 0, 0, 2, 2, 16, 0}, {0, 0, 2, 2, 2, 13, 0}, {-2, 0, 1, 2, 2, -12, 0}, {0, 0, -1, 2, 1, -10, 0}, {2, 0, -1, 0, 1, -8, 0}, {-2, 2, 0, 2, 2, 7, 0}, {0, 1, 0, 0, 1, 9, 0}, {-2, 0, 1, 0, 1, 7, 0}, {0, -1, 0, 0, 1, 6, 0}, {2, 0, -1, 2, 1, 5, 0}, {2, 0, 1, 2, 2, 3, 0}, {0, 1, 0, 2, 2, -3, 0}, {0, -1, 0, 2, 2, 3, 0}, {2, 0, 0, 2, 1, 3, 0}, {-2, 0, 2, 2, 2, -3, 0}, {-2, 0, 1, 2, 1, -3, 0}, {2, 0, -2, 0, 1, 3, 0}, {2, 0, 0, 0, 1, 3, 0}, {-2, -1, 0, 2, 1, 3, 0}, {-2, 0, 0, 0, 1, 3, 0}, {0, 0, 2, 2, 1, 3, 0}}
tp := make(map[int]map[int]float64) var s float64 = 0
for i := 1; i < 64; i++ { for i := 0; i < len(tp); i++ {
tp[i] = make(map[int]float64) s += (tp[i][5] + tp[i][6]) * Cos(d*tp[i][0]+m*tp[i][1]+n*tp[i][2]+f*tp[i][3]+o*tp[i][4])
} }
tp[1][1] = 0 return s / 10000 / 3600
tp[1][2] = 0
tp[1][3] = 0
tp[1][4] = 0
tp[1][5] = 1
tp[1][6] = 92025
tp[1][7] = 8.9 * T
tp[2][1] = -2
tp[2][2] = 0
tp[2][3] = 0
tp[2][4] = 2
tp[2][5] = 2
tp[2][6] = 5736
tp[2][7] = -3.1 * T
tp[3][1] = 0
tp[3][2] = 0
tp[3][3] = 0
tp[3][4] = 2
tp[3][5] = 2
tp[3][6] = 977
tp[3][7] = -0.5 * T
tp[4][1] = 0
tp[4][2] = 0
tp[4][3] = 0
tp[4][4] = 0
tp[4][5] = 2
tp[4][6] = -895
tp[4][7] = 0.5 * T
tp[5][1] = 0
tp[5][2] = 1
tp[5][3] = 0
tp[5][4] = 0
tp[5][5] = 0
tp[5][6] = 54
tp[5][7] = -0.1 * T
tp[6][1] = 0
tp[6][2] = 0
tp[6][3] = 1
tp[6][4] = 0
tp[6][5] = 0
tp[6][6] = -7
tp[6][7] = 0
tp[7][1] = -2
tp[7][2] = 1
tp[7][3] = 0
tp[7][4] = 2
tp[7][5] = 2
tp[7][6] = 224
tp[7][7] = -0.6 * T
tp[8][1] = 0
tp[8][2] = 0
tp[8][3] = 0
tp[8][4] = 2
tp[8][5] = 1
tp[8][6] = 200
tp[8][7] = 0
tp[9][1] = 0
tp[9][2] = 0
tp[9][3] = 1
tp[9][4] = 2
tp[9][5] = 2
tp[9][6] = 129
tp[9][7] = -0.1 * T
tp[10][1] = -2
tp[10][2] = -1
tp[10][3] = 0
tp[10][4] = 2
tp[10][5] = 2
tp[10][6] = -95
tp[10][7] = 0.3 * T
tp[11][1] = -2
tp[11][2] = 0
tp[11][3] = 0
tp[11][4] = 2
tp[11][5] = 1
tp[11][6] = -70
tp[11][7] = 0
tp[12][1] = 0
tp[12][2] = 0
tp[12][3] = -1
tp[12][4] = 2
tp[12][5] = 2
tp[12][6] = -53
tp[12][7] = 0
tp[13][1] = 2
tp[13][2] = 0
tp[13][3] = 0
tp[13][4] = 0
tp[13][5] = 0
tp[13][6] = 63
tp[13][7] = 0
tp[14][1] = 0
tp[14][2] = 0
tp[14][3] = 1
tp[14][4] = 0
tp[14][5] = 1
tp[14][6] = -33
tp[14][7] = 0
tp[15][1] = 2
tp[15][2] = 0
tp[15][3] = -1
tp[15][4] = 2
tp[15][5] = 2
tp[15][6] = 26
tp[15][7] = 0
tp[16][1] = 0
tp[16][2] = 0
tp[16][3] = -1
tp[16][4] = 0
tp[16][5] = 1
tp[16][6] = 32
tp[16][7] = 0
tp[17][1] = 0
tp[17][2] = 0
tp[17][3] = 1
tp[17][4] = 2
tp[17][5] = 1
tp[17][6] = 27
tp[17][7] = 0
tp[18][1] = 0
tp[18][2] = 0
tp[18][3] = -2
tp[18][4] = 2
tp[18][5] = 1
tp[18][6] = -24
tp[18][7] = 0
tp[19][1] = 2
tp[19][2] = 0
tp[19][3] = 0
tp[19][4] = 2
tp[19][5] = 2
tp[19][6] = 16
tp[19][7] = 0
tp[20][1] = 0
tp[20][2] = 0
tp[20][3] = 2
tp[20][4] = 2
tp[20][5] = 2
tp[20][6] = 13
tp[20][7] = 0
tp[21][1] = -2
tp[21][2] = 0
tp[21][3] = 1
tp[21][4] = 2
tp[21][5] = 2
tp[21][6] = -12
tp[21][7] = 0
tp[22][1] = 0
tp[22][2] = 0
tp[22][3] = -1
tp[22][4] = 2
tp[22][5] = 1
tp[22][6] = -10
tp[22][7] = 0
tp[23][1] = 2
tp[23][2] = 0
tp[23][3] = -1
tp[23][4] = 0
tp[23][5] = 1
tp[23][6] = -8
tp[23][7] = 0
tp[24][1] = -2
tp[24][2] = 2
tp[24][3] = 0
tp[24][4] = 2
tp[24][5] = 2
tp[24][6] = 7
tp[24][7] = 0
tp[25][1] = 0
tp[25][2] = 1
tp[25][3] = 0
tp[25][4] = 0
tp[25][5] = 1
tp[25][6] = 9
tp[25][7] = 0
tp[26][1] = -2
tp[26][2] = 0
tp[26][3] = 1
tp[26][4] = 0
tp[26][5] = 1
tp[26][6] = 7
tp[26][7] = 0
tp[27][1] = 0
tp[27][2] = -1
tp[27][3] = 0
tp[27][4] = 0
tp[27][5] = 1
tp[27][6] = 6
tp[27][7] = 0
tp[28][1] = 2
tp[28][2] = 0
tp[28][3] = -1
tp[28][4] = 2
tp[28][5] = 1
tp[28][6] = 5
tp[28][7] = 0
tp[29][1] = 2
tp[29][2] = 0
tp[29][3] = 1
tp[29][4] = 2
tp[29][5] = 2
tp[29][6] = 3
tp[29][7] = 0
tp[30][1] = 0
tp[30][2] = 1
tp[30][3] = 0
tp[30][4] = 2
tp[30][5] = 2
tp[30][6] = -3
tp[30][7] = 0
tp[31][1] = 0
tp[31][2] = -1
tp[31][3] = 0
tp[31][4] = 2
tp[31][5] = 2
tp[31][6] = 3
tp[31][7] = 0
tp[32][1] = 2
tp[32][2] = 0
tp[32][3] = 0
tp[32][4] = 2
tp[32][5] = 1
tp[32][6] = 3
tp[32][7] = 0
tp[33][1] = -2
tp[33][2] = 0
tp[33][3] = 2
tp[33][4] = 2
tp[33][5] = 2
tp[33][6] = -3
tp[33][7] = 0
tp[34][1] = -2
tp[34][2] = 0
tp[34][3] = 1
tp[34][4] = 2
tp[34][5] = 1
tp[34][6] = -3
tp[34][7] = 0
tp[35][1] = 2
tp[35][2] = 0
tp[35][3] = -2
tp[35][4] = 0
tp[35][5] = 1
tp[35][6] = 3
tp[35][7] = 0
tp[36][1] = 2
tp[36][2] = 0
tp[36][3] = 0
tp[36][4] = 0
tp[36][5] = 1
tp[36][6] = 3
tp[36][7] = 0
tp[37][1] = -2
tp[37][2] = -1
tp[37][3] = 0
tp[37][4] = 2
tp[37][5] = 1
tp[37][6] = 3
tp[37][7] = 0
tp[38][1] = -2
tp[38][2] = 0
tp[38][3] = 0
tp[38][4] = 0
tp[38][5] = 1
tp[38][6] = 3
tp[38][7] = 0
tp[39][1] = 0
tp[39][2] = 0
tp[39][3] = 2
tp[39][4] = 2
tp[39][5] = 1
tp[39][6] = 3
tp[39][7] = 0
var S float64 = 0
for i := 1; i < 40; i++ {
S += (tp[i][6] + tp[i][7]) * Cos(D*tp[i][1]+M*tp[i][2]+N*tp[i][3]+F*tp[i][4]+O*tp[i][5])
}
return S / 10000 / 3600
} }
/* /*
@ -825,7 +101,6 @@ func SunMidFun(JD float64) float64 { //'太阳中间方程
return SunMidFun return SunMidFun
} }
func SunTrueLo(JD float64) float64 { // '太阳真黄经 func SunTrueLo(JD float64) float64 { // '太阳真黄经
SunTrueLo := SunLo(JD) + SunMidFun(JD) SunTrueLo := SunLo(JD) + SunMidFun(JD)
return SunTrueLo return SunTrueLo
} }
@ -841,6 +116,10 @@ func SunApparentRa(JD float64) float64 { // '太阳视赤经
return LoToRa(JD, SunApparentLo(JD), 0) return LoToRa(JD, SunApparentLo(JD), 0)
} }
func SunApparentRaDec(JD float64) (float64, float64) {
return LoBoToRaDec(JD, SunApparentLo(JD), 0)
}
func SunTrueRa(JD float64) float64 { //'太阳真赤经 func SunTrueRa(JD float64) float64 { //'太阳真赤经
sitas := Sita(JD) sitas := Sita(JD)
@ -965,54 +244,47 @@ func RDJL(jd float64) float64 { //ri di ju li
return (1.000001018 * (1 - e*e) / (1 + e*Cos(f+m))) return (1.000001018 * (1 - e*e) / (1 + e*Cos(f+m)))
} }
func GetOneYearMoon(year float64) map[int]float64 { func GetMoonLoops(year float64, loop int) []float64 {
var start float64 var start float64
var tmp1, tmp float64 var newMoon, tmp float64
moon := make(map[int]float64) moon := make([]float64, loop)
if year < 6000 { if year < 6000 {
start = year + 11.00/12.00 + 5.00/30.00/12.00 start = year + 11.00/12.00 + 5.00/30.00/12.00
} else { } else {
start = year + 9.00/12.00 + 5.00/30.00/12.00 start = year + 9.00/12.00 + 5.00/30.00/12.00
} }
i := 1 i := 1
for j := 1; j < 17; j++ { for j := 0; j < loop; j++ {
if year > 3000 { if year > 3000 {
tmp1 = TD2UT(CalcMoonSH(start+float64(i-1)/12.5, 0)+8.0/24.0, false) newMoon = TD2UT(CalcMoonSH(start+float64(i-1)/12.5, 0)+8.0/24.0, false)
} else { } else {
tmp1 = TD2UT(CalcMoonS(start+float64(i-1)/12.5, 0)+8.0/24.0, false) newMoon = TD2UT(CalcMoonS(start+float64(i-1)/12.5, 0)+8.0/24.0, false)
} }
if i != 1 { if i != 1 {
if tmp1 == tmp { if newMoon == tmp {
j-- j--
i++ i++
continue continue
} }
} }
moon[j] = tmp1 moon[j] = newMoon
tmp = moon[j] tmp = moon[j]
i++ i++
// echo DateCalc(moon[i])."<br />"; // echo DateCalc(moon[i])."<br />";
} }
return moon return moon
} }
func GetOneYearJQ(year int) []float64 {
func GetJieqiLoops(year, loop int) []float64 {
start := 270 start := 270
var years int jq := make([]float64, loop)
jq := make([]float64, 26) for i := 1; i <= loop; i++ {
for i := 1; i < 26; i++ {
angle := start + 15*(i-1) angle := start + 15*(i-1)
if angle > 360 { if angle > 360 {
angle -= 360 angle -= 360
} }
if i > 1 { jq[i-1] = GetJQTime(year+int(math.Ceil(float64(i-1)/24.000)), angle) + 8.0/24.0
years = year + 1
} else {
years = year
}
jq[i] = GetJQTime(years, angle) + 8.0/24.0
// echo DateCalc(jq[i])."<br />";
} }
jq[0] = jq[1]
return jq return jq
} }

@ -1,13 +1,15 @@
package basic package basic
import ( import (
"b612.me/astro/tools"
"fmt" "fmt"
"math"
"testing" "testing"
"time" "time"
) )
func Test_Jq(t *testing.T) { func Test_Jq(t *testing.T) {
data := GetOneYearJQ(2019) data := GetJieqiLoops(2019, 24)
for i := 1; i < 25; i++ { for i := 1; i < 25; i++ {
fmt.Println(JDE2Date(data[i])) fmt.Println(JDE2Date(data[i]))
} }
@ -17,11 +19,59 @@ func Test_Jq(t *testing.T) {
//fmt.Println(HSunApparentLo(date)) //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) { func Test_SunLo(t *testing.T) {
fmt.Printf("%.14f\n", HSunTrueLo(2458840.0134162)) fmt.Printf("%.14f\n", HSunTrueLo(2458840.0134162))
fmt.Printf("%.14f", HSunApparentLo(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) { func Benchmark_SunRise(b *testing.B) {
jde := GetNowJDE() jde := GetNowJDE()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
@ -103,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
}

@ -39,7 +39,7 @@ const (
// 按现行农历GB/T 33661-2017算法计算推荐使用年限为[1929-3000]年 // 按现行农历GB/T 33661-2017算法计算推荐使用年限为[1929-3000]年
// 古代由于定朔定气误差此处计算会与古时不符 // 古代由于定朔定气误差此处计算会与古时不符
func Lunar(year, month, day int, timezone float64) (int, int, bool, string) { func Lunar(year, month, day int, timezone float64) (int, int, bool, string) {
return basic.GetLunar(year, month, day, timezone) return basic.GetLunar(year, month, day, timezone/24.0)
} }
// Solar 农历转公历 // Solar 农历转公历
@ -98,3 +98,141 @@ func WuHou(year, term int) time.Time {
zone := time.FixedZone("CST", 8*3600) zone := time.FixedZone("CST", 8*3600)
return basic.JDE2DateByZone(calcJde, zone, false) return basic.JDE2DateByZone(calcJde, zone, false)
} }
// RapidLunarToSolar 农历转公历(快速查表法)
// 传入 农历年份,月,日,是否闰月
// 传出 公历时间
// 农历年份用公历年份代替,但是岁首需要使用农历岁首
// 例计算己亥猪年腊月三十日对应的公历即2020年1月24日
// 由于农历还未到鼠年故应当传入Solar(2019,12,30,false)
// 按现行农历GB/T 33661-2017算法计算推荐使用年限为[1929-3000]年
// 对于东八区[1900-2400]年的查询,会使用查表法加快计算速度
// 古代由于定朔定气误差此处计算会与古时不符
func RapidLunarToSolar(year, month, day int, leap bool) time.Time {
if year < 1900 || year > 2400 {
jde := basic.GetSolar(year, month, day, leap, 8.0/24.0)
zone := time.FixedZone("CST", 8*3600)
return basic.JDE2DateByZone(jde, zone, true)
}
return rapidSolar(year, month, day, leap)
}
// RapidSolarToLunar 公历转农历(快速查表法)
// 传入 公历年月日
// 返回 农历月,日,是否闰月以及文字描述
// 忽略时区,日期一律按北京时间计算
// 按现行农历GB/T 33661-2017算法计算推荐使用年限为[1929-3000]年
// 古代由于定朔定气误差此处计算会与古时不符
// 对于东八区[1900-2400]年的查询,会使用查表法加快计算速度
func RapidSolarToLunar(date time.Time) (int, int, bool, string) {
if date.Year() < 1900 || date.Year() > 2400 {
return basic.GetLunar(date.Year(), int(date.Month()), date.Day(), 8.0/24.0)
}
return rapidLunar(date.Year(), int(date.Month()), date.Day())
}
func rapidLunar(year, month, day int) (int, int, bool, string) {
var upper = []uint16{32274, 52242, 41001, 30036, 49204, 36918, 25882, 46101, 34854, 22674, 43026, 31145, 51241, 38964, 26997, 47149, 36885, 23717, 44069, 34258, 53266, 41001, 29036, 49178, 37915, 24875, 46090, 34853, 23698, 43026, 31129, 50229, 38970, 26971, 47126, 36874, 24804, 44068, 32242, 52274, 41013, 28086, 48173, 37909, 25898, 46089, 34852, 22706, 43050, 30189, 50203, 38957, 27989, 47123, 35881, 24788, 45076, 32298, 51258, 40986, 29099, 48170, 37906, 25897, 46121, 34836, 21754, 42038, 31190, 50197, 38949, 27986, 48146, 35881, 23860, 44084, 32309, 51245, 39981, 29093, 49189, 37906, 25897, 46121, 35500, 53274, 42011, 30123, 50218, 38949, 27986, 48146, 36889, 23770, 43066, 32282, 52246, 39978, 29028, 49188, 37938, 24885, 45109, 33846, 22678, 42005, 30186, 51209, 39972, 26994, 47146, 35885, 23853, 43051, 32341, 52242, 41001, 29076, 49172, 37930, 25885, 45082, 33835, 22675, 43026, 30121, 50217, 38964, 27002, 46133, 35862, 23770, 44069, 32466, 52242, 41001, 29108, 48180, 36917, 24950, 45101, 33813, 22674, 43026, 31209, 50217, 38954, 26989, 47131, 34859, 23765, 44068, 34322, 52242, 40985, 29082, 48186, 36890, 24874, 45098, 34852, 21746, 42034, 30197, 50229, 37942, 26966, 47125, 35881, 23828, 44052, 32298, 52266, 39981, 28077, 48171, 37909, 24873, 45097, 34836, 22762, 42010, 30172, 50202, 38955, 26963, 47122, 35881, 24852, 43060, 31290, 51253, 39990, 28058, 48149, 37906, 25897, 45097, 33844, 21686, 42037, 30198, 50221, 39957, 29010, 48146, 36905, 24884, 45098, 32365, 52251, 41003, 30101, 49188, 38930, 26905, 47125, 34842, 22747, 43034, 31210, 50218, 39956, 28018, 48170, 35893, 23866, 44086, 34518, 52245, 41001, 30100, 50196, 37930, 25973, 46124, 34861, 22677, 43029, 31209, 51241, 39956, 28010, 48154, 36892, 23853, 44058, 34507, 53266, 41001, 30100, 49204, 37946, 25946, 45110, 34838, 23754, 43018, 31208, 51240, 39988, 27061, 47149, 35893, 24854, 44053, 34442, 53265, 42024, 29098, 49194, 37933, 25965, 45099, 34837, 23753, 44049, 31192, 51220, 39962, 28059, 47126, 35882, 24852, 45074, 31785, 21652, 41012, 29114, 48181, 37910, 25962, 46121, 34834, 22761, 43049, 31220, 50220, 38957, 28053, 48139, 36901, 25874, 46098, 35433, 53273, 42010, 30125, 50202, 38922, 26917, 47140, 36882, 23769, 43065, 31226, 51254, 39958, 29002, 49162, 37924, 24882, 45106, 34421, 53293, 41005, 30165, 50197, 39945, 26980, 47140, 35882, 23797, 43053, 31277, 51243, 40981, 29001, 49161, 37908, 25898, 45082, 34523, 53270, 42026, 30098, 50194, 38953, 27988, 46132, 34874, 23770, 44054, 31210, 51237, 40978, 29097, 48169, 36916, 24950, 45101, 31797, 21605, 42021, 31186, 50194, 38953, 26988, 47130, 34859, 22765, 44042, 32293, 51236, 40978, 29081, 48185, 35898, 24859, 45078, 34826, 21669, 42020, 30130, 50226, 37941, 25974, 46125, 35861, 22762, 44041, 32228, 52260, 39978, 28077, 48157, 36909, 24853, 45075, 33833, 22676, 43028, 31146, 50234, 39962, 26987, 47146, 36882, 24809, 44073, 34260, 52276, 41014, 29082, 49173, 37926, 26898, 46098, 35497, 54313, 43060, 30197, 50221, 38957, 28005, 47141, 36882, 24809, 45097, 32300, 52250, 40987, 29101, 48170, 37925, 26898, 47122, 34841, 22746, 42042, 31195, 50198, 38954, 28004, 48164, 35890, 23861, 44085, 32310, 51245, 40981, 29098, 50185, 37924, 25970, 46122, 34861, 21614, 42029, 31189, 51218, 38953, 27988, 48148, 36906, 23837, 44058, 32299, 52266, 40978, 29097, 49193, 38932, 24954, 45110, 33846, 22682, 42021, 31186, 51218, 39977, 26996, 47156, 35893, 23862, 43053, 32405, 52261, 42002, 29097, 49193, 37932, 25901, 45083, 33835, 22677, 43044, 31122, 51218, 39961, 27994}
var lower = []uint8{218, 184, 92, 154, 152, 84, 170, 168, 180, 186, 184, 54, 52, 148, 82, 84, 168, 180, 108, 110, 108, 44, 150, 148, 80, 106, 216, 92, 94, 92, 44, 40, 148, 82, 180, 216, 220, 184, 90, 84, 40, 148, 84, 168, 182, 116, 180, 86, 84, 42, 40, 84, 106, 104, 108, 174, 172, 84, 84, 168, 84, 212, 216, 92, 92, 152, 76, 84, 170, 168, 180, 186, 180, 52, 154, 148, 74, 80, 168, 180, 108, 108, 46, 44, 150, 148, 80, 104, 216, 92, 94, 92, 44, 148, 148, 202, 176, 216, 218, 184, 88, 42, 40, 148, 170, 168, 182, 116, 180, 86, 84, 40, 84, 84, 106, 232, 108, 174, 172, 76, 42, 168, 84, 106, 216, 92, 56, 152, 76, 76, 168, 212, 180, 186, 180, 52, 150, 148, 72, 168, 104, 180, 182, 108, 46, 44, 148, 74, 72, 104, 108, 220, 94, 92, 44, 148, 148, 200, 216, 184, 184, 92, 88, 42, 40, 148, 170, 168, 180, 186, 180, 86, 84, 40, 84, 84, 104, 116, 108, 172, 78, 76, 166, 168, 84, 106, 216, 92, 156, 88, 76, 72, 168, 212, 180, 184, 58, 52, 84, 74, 72, 164, 104, 116, 182, 108, 44, 150, 148, 74, 72, 88, 108, 220, 92, 46, 44, 148, 74, 168, 212, 180, 184, 92, 88, 40, 148, 84, 170, 168, 180, 186, 180, 52, 42, 168, 84, 170, 104, 116, 108, 172, 46, 44, 164, 84, 212, 106, 216, 92, 92, 88, 44, 164, 164, 212, 218, 184, 186, 180, 84, 42, 72, 164, 180, 108, 182, 108, 172, 86, 84, 40, 84, 84, 108, 110, 92, 174, 172, 84, 42, 168, 212, 218, 184, 92, 172, 168, 84, 84, 168, 212, 180, 184, 86, 52, 150, 164, 84, 170, 104, 116, 182, 108, 46, 44, 164, 82, 212, 216, 108, 220, 92, 44, 40, 148, 164, 212, 218, 184, 184, 90, 84, 42, 40, 164, 180, 108, 116, 182, 172, 84, 42, 40, 84, 84, 108, 110, 92, 172, 86, 84, 42, 168, 212, 218, 184, 92, 154, 152, 84, 170, 168, 180, 116, 184, 54, 52, 148, 74, 80, 168, 180, 108, 174, 108, 44, 150, 148, 80, 106, 216, 108, 220, 92, 44, 40, 148, 82, 180, 216, 92, 184, 90, 84, 40, 148, 148, 168, 182, 116, 182, 172, 84, 42, 40, 84, 170, 104, 108, 174, 172, 84, 84, 168, 84, 212, 216, 92, 92, 154, 152, 84, 170, 168, 180, 186, 180, 54, 52, 148, 74, 80, 168, 180, 108, 108, 46, 44, 150, 148, 80, 104, 216, 92, 94, 92, 44, 148, 148, 74, 176, 216, 218, 184, 88, 42, 40, 148, 84, 168, 182, 116, 180, 86, 84, 40, 148, 84, 106, 232, 108, 174, 172, 76, 42, 168, 84, 212, 216, 92, 92, 152, 76, 72, 168, 212, 180, 186, 180, 52, 150, 148, 72, 168, 104, 180, 108, 108, 46, 44, 148, 74, 72, 104, 108, 220, 94, 92, 44, 148}
if year < 1900 || year > 2400 {
return 0, 0, false, "超过日期限制"
}
useGoto := false
recalc:
idx := year - 1900
magic := int32(upper[idx])<<8 + int32(lower[idx])
springMonth := (magic&0x800000)>>23 + 1
springDay := (magic & 0x7FFFFF) >> 18
if springMonth == int32(month) && springDay == int32(day) {
return 1, 1, false, "正月初一"
}
if !useGoto && (springMonth > int32(month) || (springMonth == int32(month) && springDay > int32(day))) {
year--
useGoto = true
goto recalc
}
calcYear := year
if useGoto {
calcYear++
}
target := time.Date(calcYear, time.Month(month), day, 0, 0, 0, 0, time.Local)
spring := time.Date(year, time.Month(int(springMonth)), int(springDay), 0, 0, 0, 0, time.Local)
diffDay := int(target.Sub(spring).Hours() / 24)
lunarMonth := 1
totalDay := 0
isLeap := false
leapMonth := int(uint8(magic>>14) & 0xF)
strmonth := []string{"十", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊"}
strday := []string{"初", "十", "廿", "三"}
for i := 0; i < 13; i++ {
var dayofLunar = 29
if uint8(magic&0x3FFE>>(13-i))&1 == 1 {
dayofLunar++
}
if totalDay+dayofLunar > diffDay {
var result string
if isLeap {
result += "闰"
}
if lunarMonth == 1 {
result += "正月"
} else {
result += strmonth[lunarMonth] + "月"
}
lday := diffDay - totalDay + 1
if lday == 20 {
result += "二十"
} else if lday == 10 {
result += "初十"
} else {
result += strday[lday/10] + strmonth[lday%10]
}
return lunarMonth, lday, isLeap, result
}
totalDay += dayofLunar
lunarMonth++
if lunarMonth-leapMonth == 1 && !isLeap {
isLeap = true
lunarMonth--
} else {
isLeap = false
}
}
return 0, 0, false, "无法获取农历信息"
}
func rapidSolar(year, month, day int, isLeap bool) time.Time {
var upper = []uint16{32274, 52242, 41001, 30036, 49204, 36918, 25882, 46101, 34854, 22674, 43026, 31145, 51241, 38964, 26997, 47149, 36885, 23717, 44069, 34258, 53266, 41001, 29036, 49178, 37915, 24875, 46090, 34853, 23698, 43026, 31129, 50229, 38970, 26971, 47126, 36874, 24804, 44068, 32242, 52274, 41013, 28086, 48173, 37909, 25898, 46089, 34852, 22706, 43050, 30189, 50203, 38957, 27989, 47123, 35881, 24788, 45076, 32298, 51258, 40986, 29099, 48170, 37906, 25897, 46121, 34836, 21754, 42038, 31190, 50197, 38949, 27986, 48146, 35881, 23860, 44084, 32309, 51245, 39981, 29093, 49189, 37906, 25897, 46121, 35500, 53274, 42011, 30123, 50218, 38949, 27986, 48146, 36889, 23770, 43066, 32282, 52246, 39978, 29028, 49188, 37938, 24885, 45109, 33846, 22678, 42005, 30186, 51209, 39972, 26994, 47146, 35885, 23853, 43051, 32341, 52242, 41001, 29076, 49172, 37930, 25885, 45082, 33835, 22675, 43026, 30121, 50217, 38964, 27002, 46133, 35862, 23770, 44069, 32466, 52242, 41001, 29108, 48180, 36917, 24950, 45101, 33813, 22674, 43026, 31209, 50217, 38954, 26989, 47131, 34859, 23765, 44068, 34322, 52242, 40985, 29082, 48186, 36890, 24874, 45098, 34852, 21746, 42034, 30197, 50229, 37942, 26966, 47125, 35881, 23828, 44052, 32298, 52266, 39981, 28077, 48171, 37909, 24873, 45097, 34836, 22762, 42010, 30172, 50202, 38955, 26963, 47122, 35881, 24852, 43060, 31290, 51253, 39990, 28058, 48149, 37906, 25897, 45097, 33844, 21686, 42037, 30198, 50221, 39957, 29010, 48146, 36905, 24884, 45098, 32365, 52251, 41003, 30101, 49188, 38930, 26905, 47125, 34842, 22747, 43034, 31210, 50218, 39956, 28018, 48170, 35893, 23866, 44086, 34518, 52245, 41001, 30100, 50196, 37930, 25973, 46124, 34861, 22677, 43029, 31209, 51241, 39956, 28010, 48154, 36892, 23853, 44058, 34507, 53266, 41001, 30100, 49204, 37946, 25946, 45110, 34838, 23754, 43018, 31208, 51240, 39988, 27061, 47149, 35893, 24854, 44053, 34442, 53265, 42024, 29098, 49194, 37933, 25965, 45099, 34837, 23753, 44049, 31192, 51220, 39962, 28059, 47126, 35882, 24852, 45074, 31785, 21652, 41012, 29114, 48181, 37910, 25962, 46121, 34834, 22761, 43049, 31220, 50220, 38957, 28053, 48139, 36901, 25874, 46098, 35433, 53273, 42010, 30125, 50202, 38922, 26917, 47140, 36882, 23769, 43065, 31226, 51254, 39958, 29002, 49162, 37924, 24882, 45106, 34421, 53293, 41005, 30165, 50197, 39945, 26980, 47140, 35882, 23797, 43053, 31277, 51243, 40981, 29001, 49161, 37908, 25898, 45082, 34523, 53270, 42026, 30098, 50194, 38953, 27988, 46132, 34874, 23770, 44054, 31210, 51237, 40978, 29097, 48169, 36916, 24950, 45101, 31797, 21605, 42021, 31186, 50194, 38953, 26988, 47130, 34859, 22765, 44042, 32293, 51236, 40978, 29081, 48185, 35898, 24859, 45078, 34826, 21669, 42020, 30130, 50226, 37941, 25974, 46125, 35861, 22762, 44041, 32228, 52260, 39978, 28077, 48157, 36909, 24853, 45075, 33833, 22676, 43028, 31146, 50234, 39962, 26987, 47146, 36882, 24809, 44073, 34260, 52276, 41014, 29082, 49173, 37926, 26898, 46098, 35497, 54313, 43060, 30197, 50221, 38957, 28005, 47141, 36882, 24809, 45097, 32300, 52250, 40987, 29101, 48170, 37925, 26898, 47122, 34841, 22746, 42042, 31195, 50198, 38954, 28004, 48164, 35890, 23861, 44085, 32310, 51245, 40981, 29098, 50185, 37924, 25970, 46122, 34861, 21614, 42029, 31189, 51218, 38953, 27988, 48148, 36906, 23837, 44058, 32299, 52266, 40978, 29097, 49193, 38932, 24954, 45110, 33846, 22682, 42021, 31186, 51218, 39977, 26996, 47156, 35893, 23862, 43053, 32405, 52261, 42002, 29097, 49193, 37932, 25901, 45083, 33835, 22677, 43044, 31122, 51218, 39961, 27994}
var lower = []uint8{218, 184, 92, 154, 152, 84, 170, 168, 180, 186, 184, 54, 52, 148, 82, 84, 168, 180, 108, 110, 108, 44, 150, 148, 80, 106, 216, 92, 94, 92, 44, 40, 148, 82, 180, 216, 220, 184, 90, 84, 40, 148, 84, 168, 182, 116, 180, 86, 84, 42, 40, 84, 106, 104, 108, 174, 172, 84, 84, 168, 84, 212, 216, 92, 92, 152, 76, 84, 170, 168, 180, 186, 180, 52, 154, 148, 74, 80, 168, 180, 108, 108, 46, 44, 150, 148, 80, 104, 216, 92, 94, 92, 44, 148, 148, 202, 176, 216, 218, 184, 88, 42, 40, 148, 170, 168, 182, 116, 180, 86, 84, 40, 84, 84, 106, 232, 108, 174, 172, 76, 42, 168, 84, 106, 216, 92, 56, 152, 76, 76, 168, 212, 180, 186, 180, 52, 150, 148, 72, 168, 104, 180, 182, 108, 46, 44, 148, 74, 72, 104, 108, 220, 94, 92, 44, 148, 148, 200, 216, 184, 184, 92, 88, 42, 40, 148, 170, 168, 180, 186, 180, 86, 84, 40, 84, 84, 104, 116, 108, 172, 78, 76, 166, 168, 84, 106, 216, 92, 156, 88, 76, 72, 168, 212, 180, 184, 58, 52, 84, 74, 72, 164, 104, 116, 182, 108, 44, 150, 148, 74, 72, 88, 108, 220, 92, 46, 44, 148, 74, 168, 212, 180, 184, 92, 88, 40, 148, 84, 170, 168, 180, 186, 180, 52, 42, 168, 84, 170, 104, 116, 108, 172, 46, 44, 164, 84, 212, 106, 216, 92, 92, 88, 44, 164, 164, 212, 218, 184, 186, 180, 84, 42, 72, 164, 180, 108, 182, 108, 172, 86, 84, 40, 84, 84, 108, 110, 92, 174, 172, 84, 42, 168, 212, 218, 184, 92, 172, 168, 84, 84, 168, 212, 180, 184, 86, 52, 150, 164, 84, 170, 104, 116, 182, 108, 46, 44, 164, 82, 212, 216, 108, 220, 92, 44, 40, 148, 164, 212, 218, 184, 184, 90, 84, 42, 40, 164, 180, 108, 116, 182, 172, 84, 42, 40, 84, 84, 108, 110, 92, 172, 86, 84, 42, 168, 212, 218, 184, 92, 154, 152, 84, 170, 168, 180, 116, 184, 54, 52, 148, 74, 80, 168, 180, 108, 174, 108, 44, 150, 148, 80, 106, 216, 108, 220, 92, 44, 40, 148, 82, 180, 216, 92, 184, 90, 84, 40, 148, 148, 168, 182, 116, 182, 172, 84, 42, 40, 84, 170, 104, 108, 174, 172, 84, 84, 168, 84, 212, 216, 92, 92, 154, 152, 84, 170, 168, 180, 186, 180, 54, 52, 148, 74, 80, 168, 180, 108, 108, 46, 44, 150, 148, 80, 104, 216, 92, 94, 92, 44, 148, 148, 74, 176, 216, 218, 184, 88, 42, 40, 148, 84, 168, 182, 116, 180, 86, 84, 40, 148, 84, 106, 232, 108, 174, 172, 76, 42, 168, 84, 212, 216, 92, 92, 152, 76, 72, 168, 212, 180, 186, 180, 52, 150, 148, 72, 168, 104, 180, 108, 108, 46, 44, 148, 74, 72, 104, 108, 220, 94, 92, 44, 148}
if year < 1900 || year > 2400 {
return time.Time{}
}
idx := year - 1900
magic := int32(upper[idx])<<8 + int32(lower[idx])
springMonth := (magic&0x800000)>>23 + 1
springDay := (magic & 0x7FFFFF) >> 18
spring := time.Date(year, time.Month(int(springMonth)), int(springDay), 0, 0, 0, 0, time.Local)
lunarMonth := 1
totalDay := 0
leap := false
leapMonth := int(uint8(magic>>14) & 0xF)
for i := 0; i < 13; i++ {
if lunarMonth == month && isLeap == leap {
target := spring.AddDate(0, 0, totalDay+day-1)
return target
}
var dayofLunar = 29
if uint8(magic&0x3FFE>>(13-i))&1 == 1 {
dayofLunar++
}
totalDay += dayofLunar
lunarMonth++
if lunarMonth-leapMonth == 1 && !leap {
leap = true
lunarMonth--
} else {
leap = false
}
}
return time.Time{}
}

@ -3,9 +3,10 @@ package calendar
import ( import (
"fmt" "fmt"
"testing" "testing"
"time"
) )
type LunarSolar struct { type lunarSolar struct {
Lyear int Lyear int
Lmonth int Lmonth int
Lday int Lday int
@ -16,7 +17,7 @@ type LunarSolar struct {
} }
func Test_ChineseCalendar(t *testing.T) { func Test_ChineseCalendar(t *testing.T) {
var testData = []LunarSolar{ var testData = []lunarSolar{
{Lyear: 2034, Lmonth: 1, Lday: 1, Leap: false, Year: 2034, Month: 2, Day: 19}, {Lyear: 2034, Lmonth: 1, Lday: 1, Leap: false, Year: 2034, Month: 2, Day: 19},
{Lyear: 2033, Lmonth: 12, Lday: 30, Leap: false, Year: 2034, Month: 2, Day: 18}, {Lyear: 2033, Lmonth: 12, Lday: 30, Leap: false, Year: 2034, Month: 2, Day: 18},
{Lyear: 2033, Lmonth: 11, Lday: 27, Leap: true, Year: 2034, Month: 1, Day: 17}, {Lyear: 2033, Lmonth: 11, Lday: 27, Leap: true, Year: 2034, Month: 1, Day: 17},
@ -37,7 +38,7 @@ func Test_ChineseCalendar(t *testing.T) {
} }
for _, v := range testData { for _, v := range testData {
var lyear int = v.Year var lyear int = v.Year
lmonth, lday, leap, desp := Lunar(v.Year, v.Month, v.Day) lmonth, lday, leap, desp := SolarToLunar(time.Date(v.Year, time.Month(v.Month), v.Day, 0, 0, 0, 0, time.Local))
if lmonth > v.Month { if lmonth > v.Month {
lyear-- lyear--
} }
@ -46,7 +47,7 @@ func Test_ChineseCalendar(t *testing.T) {
t.Fatal(v, lyear, lmonth, lday, leap, desp) t.Fatal(v, lyear, lmonth, lday, leap, desp)
} }
date := Solar(v.Lyear, v.Lmonth, v.Lday, v.Leap) date := LunarToSolar(v.Lyear, v.Lmonth, v.Lday, v.Leap)
if date.Year() != v.Year || int(date.Month()) != v.Month || date.Day() != v.Day { if date.Year() != v.Year || int(date.Month()) != v.Month || date.Day() != v.Day {
t.Fatal(v, date) t.Fatal(v, date)
} }

@ -7,8 +7,20 @@ import (
) )
func TestMercury(t *testing.T) { func TestMercury(t *testing.T) {
date := time.Now().Add(time.Hour * -24) tz := time.FixedZone("CST", 8*3600)
fmt.Println(CulminationTime(date, 115)) date := time.Date(2022, 01, 20, 00, 00, 00, 00, tz)
fmt.Println(RiseTime(date, 115, 23, 0, false)) if NextConjunction(date).Unix() != 1642933683 {
fmt.Println(DownTime(date, 115, 23, 0, false)) t.Fatal(NextConjunction(date).Unix())
}
if CulminationTime(date, 115).Unix() != 1642654651 {
t.Fatal(CulminationTime(date, 115).Unix())
}
date, err := (RiseTime(date, 115, 40, 0, false))
if err != nil {
t.Fatal(err)
}
if date.Unix() != 1642636481 {
t.Fatal(date.Unix())
}
fmt.Println(DownTime(date, 115, 40, 0, false))
} }

@ -91,6 +91,7 @@ func ApparentRaDec(date time.Time, lon, lat float64) (float64, float64) {
} }
// HourAngle 月亮时角 // HourAngle 月亮时角
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
@ -101,6 +102,7 @@ func HourAngle(date time.Time, lon, lat float64) float64 {
} }
// Azimuth 月亮方位角 // Azimuth 月亮方位角
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
@ -111,6 +113,7 @@ func Azimuth(date time.Time, lon, lat float64) float64 {
} }
// Zenith 月亮高度角 // Zenith 月亮高度角
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
@ -121,16 +124,21 @@ func Zenith(date time.Time, lon, lat float64) float64 {
} }
// CulminationTime 月亮中天时间 // CulminationTime 月亮中天时间
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
func CulminationTime(date time.Time, lon, lat float64) time.Time { func CulminationTime(date time.Time, lon, lat float64) time.Time {
if date.Hour() > 12 {
date = date.Add(time.Hour * -12)
}
jde := basic.Date2JDE(date) jde := basic.Date2JDE(date)
_, loc := date.Zone() _, loc := date.Zone()
return basic.JDE2DateByZone(basic.MoonCulminationTime(jde, lon, lat, float64(loc)/3600.0), date.Location(), true) return basic.JDE2DateByZone(basic.MoonCulminationTime(jde, lon, lat, float64(loc)/3600.0), date.Location(), true)
} }
// RiseTime 月亮升起时间 // RiseTime 月亮升起时间
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
@ -162,6 +170,7 @@ func RiseTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, e
} }
// DownTime 月亮降下时间 // DownTime 月亮降下时间
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
@ -200,11 +209,14 @@ func Phase(date time.Time) float64 {
} }
// ShuoYue 朔月 // ShuoYue 朔月
// 返回Date对应UTC世界时的月相大小
func ShuoYue(year float64) time.Time { func ShuoYue(year float64) time.Time {
jde := basic.TD2UT(basic.CalcMoonSH(year, 0), false) jde := basic.TD2UT(basic.CalcMoonSH(year, 0), false)
return basic.JDE2DateByZone(jde, time.UTC, false) return basic.JDE2DateByZone(jde, time.UTC, false)
} }
// NextShuoYue 下次朔月时间
// 返回date之后的下一个朔月时间UTC时间
func NextShuoYue(date time.Time) time.Time { func NextShuoYue(date time.Time) time.Time {
return nextMoonPhase(date, 0) return nextMoonPhase(date, 0)
} }

@ -13,38 +13,38 @@ func Test_MoonPhaseDate(t *testing.T) {
//指定日期后的下一个朔月 //指定日期后的下一个朔月
moonPhase01 := NextShuoYue(date) moonPhase01 := NextShuoYue(date)
fmt.Println("下一朔月", moonPhase01) fmt.Println("下一朔月", moonPhase01)
if moonPhase01.Unix() != 1643694349 { if moonPhase01.Unix() != 1643694356 {
t.Fatal(moonPhase01) t.Fatal(moonPhase01.Unix())
} }
//指定日期后的上一个朔月 //指定日期后的上一个朔月
moonPhase01 = LastShuoYue(date) moonPhase01 = LastShuoYue(date)
fmt.Println("上一朔月", moonPhase01) fmt.Println("上一朔月", moonPhase01)
if moonPhase01.Unix() != 1641148399 { if moonPhase01.Unix() != 1641148406 {
t.Fatal(moonPhase01) t.Fatal(moonPhase01.Unix())
} }
//离指定日期最近的朔月 //离指定日期最近的朔月
moonPhase01 = ClosestShuoYue(date) moonPhase01 = ClosestShuoYue(date)
fmt.Println("最近朔月", moonPhase01) fmt.Println("最近朔月", moonPhase01)
if moonPhase01.Unix() != 1643694349 { if moonPhase01.Unix() != 1643694356 {
t.Fatal(moonPhase01) t.Fatal(moonPhase01.Unix())
} }
//离指定日期最近的望月时间 //离指定日期最近的望月时间
moonPhase01 = ClosestWangYue(date) moonPhase01 = ClosestWangYue(date)
fmt.Println("最近望月", moonPhase01) fmt.Println("最近望月", moonPhase01)
if moonPhase01.Unix() != 1642463294 { if moonPhase01.Unix() != 1642463301 {
t.Fatal(moonPhase01) t.Fatal(moonPhase01.Unix())
} }
//离指定日期最近的上弦月时间 //离指定日期最近的上弦月时间
moonPhase01 = ClosestShangXianYue(date) moonPhase01 = ClosestShangXianYue(date)
fmt.Println("最近上弦月", moonPhase01) fmt.Println("最近上弦月", moonPhase01)
if moonPhase01.Unix() != 1641751864 { if moonPhase01.Unix() != 1641751871 {
t.Fatal(moonPhase01) t.Fatal(moonPhase01.Unix())
} }
//离指定日期最近的下弦月时间 //离指定日期最近的下弦月时间
moonPhase01 = ClosestXiaXianYue(date) moonPhase01 = ClosestXiaXianYue(date)
fmt.Println("最近下弦月", moonPhase01) fmt.Println("最近下弦月", moonPhase01)
if moonPhase01.Unix() != 1643118043 { if moonPhase01.Unix() != 1643118050 {
t.Fatal(moonPhase01) t.Fatal(moonPhase01.Unix())
} }
//------------------- //-------------------
for i := 0; i < 26; i++ { for i := 0; i < 26; i++ {
@ -52,10 +52,3 @@ func Test_MoonPhaseDate(t *testing.T) {
fmt.Println("上一朔月", moonPhase01) fmt.Println("上一朔月", moonPhase01)
} }
} }
func TestMoon(t *testing.T) {
now := time.Now()
fmt.Println(RiseTime(now, 115, 40, 0, true))
fmt.Println(CulminationTime(now, 115, 40))
fmt.Println(DownTime(now, 115, 40, 0, true))
}

@ -7,8 +7,20 @@ import (
) )
func TestNeptune(t *testing.T) { func TestNeptune(t *testing.T) {
date := time.Now().Add(time.Hour * -24) tz := time.FixedZone("CST", 8*3600)
fmt.Println(CulminationTime(date, 115)) date := time.Date(2022, 01, 20, 00, 00, 00, 00, tz)
fmt.Println(RiseTime(date, 115, 23, 0, false)) if NextConjunction(date).Unix() != 1647171796 {
fmt.Println(DownTime(date, 115, 23, 0, false)) t.Fatal(NextConjunction(date).Unix())
}
if CulminationTime(date, 115).Unix() != 1642665021 {
t.Fatal(CulminationTime(date, 115).Unix())
}
date, err := (RiseTime(date, 115, 40, 0, false))
if err != nil {
t.Fatal(err)
}
if date.Unix() != 1642644398 {
t.Fatal(date.Unix())
}
fmt.Println(DownTime(date, 115, 40, 0, false))
} }

@ -31,6 +31,7 @@ func ApparentSiderealTime(date time.Time) float64 {
} }
// RiseTime 星星升起时间 // RiseTime 星星升起时间
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// raDate瞬时赤经 // raDate瞬时赤经
// decDate瞬时赤纬 // decDate瞬时赤纬
@ -56,7 +57,8 @@ func RiseTime(date time.Time, ra, dec, lon, lat, height float64, aero bool) (tim
return basic.JDE2DateByZone(riseJde, date.Location(), true), err return basic.JDE2DateByZone(riseJde, date.Location(), true), err
} }
// DownTime 星星升起时间 // DownTime 星星降落时间
//
// date, 世界时(忽略此处时区) // date, 世界时(忽略此处时区)
// raDate瞬时赤经 // raDate瞬时赤经
// decDate瞬时赤纬 // decDate瞬时赤纬
@ -106,7 +108,7 @@ func Zenith(date time.Time, ra, dec, lon, lat float64) float64 {
jde := basic.Date2JDE(date) jde := basic.Date2JDE(date)
_, loc := date.Zone() _, loc := date.Zone()
timezone := float64(loc) / 3600.0 timezone := float64(loc) / 3600.0
return basic.StarAzimuth(jde, ra, dec, lon, lat, timezone) return basic.StarHeight(jde, ra, dec, lon, lat, timezone)
} }
// CulminationTime 恒星中天时间 // CulminationTime 恒星中天时间
@ -128,6 +130,24 @@ func InitStarDatabase() error {
} }
// 通过恒星HR编号获取恒星参数 // 通过恒星HR编号获取恒星参数
func GetStarDataByHR(hr int) (basic.StarData, error) { func StarDataByHR(hr int) (basic.StarData, error) {
return basic.StarDataByHR(hr) return basic.StarDataByHR(hr)
} }
// 通过中文名获取恒星参数
func StarDataByName(name string) (basic.StarData, error) {
return basic.StarDataByChinese(name)
}
// 从亮到暗返回视星等小于3.00的恒星数据
func TopBrightStars() ([]basic.StarData, error) {
var brightStars = make([]basic.StarData, 0, 170)
for _, star := range []int{2491, 2326, 5340, 5459, 7001, 1708, 1713, 2943, 472, 2061, 5267, 7557, 1457, 6134, 5056, 2990, 8728, 4853, 7924, 4730, 5460, 3982, 2618, 6527, 4763, 1790, 1791, 3685, 1903, 4731, 8425, 4905, 3207, 4301, 1017, 2693, 6879, 3307, 5191, 6553, 2088, 6217, 2421, 7790, 3485, 2294, 2891, 3748, 617, 7121, 424, 188, 1948, 337, 15, 2004, 5288, 6556, 5563, 8636, 936, 4534, 4819, 7796, 3634, 5793, 1852, 168, 6705, 3165, 3699, 603, 21, 5054, 6241, 5469, 5132, 5440, 5953, 4295, 99, 8308, 6580, 8775, 6378, 4554, 8162, 2827, 7949, 264, 8781, 3734, 911, 5231, 4357, 6175, 1865, 4662, 4621, 7194, 5685, 4057, 2095, 5984, 1956, 553, 4786, 5854, 5235, 403, 5571, 4216, 4798, 1577, 6508, 6859, 2773, 5506, 7525, 6056, 6132, 5531, 5028, 4199, 1899, 6603, 6148, 5776, 6536, 1666, 4656, 98, 6913, 3185, 6212, 6165, 4932, 39, 1829, 1203, 6461, 5897, 8502, 591, 8322, 1165, 7528, 2286, 2890, 7264, 6084, 5944, 5671, 1220, 2845, 4915, 8232, 2553, 915, 8650, 1231, 4757, 6510, 8414, 2473, 3873, 6746, 7235, 1605} {
info, err := basic.StarDataByHR(star)
if err != nil {
return nil, err
}
brightStars = append(brightStars, info)
}
return brightStars, nil
}

@ -12,7 +12,7 @@ func TestStar(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
sirius, err := GetStarDataByHR(2491) sirius, err := StarDataByHR(2491)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

@ -2,7 +2,6 @@ package sun
import ( import (
"errors" "errors"
"math"
"time" "time"
"b612.me/astro/basic" "b612.me/astro/basic"
@ -38,9 +37,11 @@ func RiseTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, e
if date.Hour() > 12 { if date.Hour() > 12 {
date = date.Add(time.Hour * -12) date = date.Add(time.Hour * -12)
} }
//忽略时区的字面量时间
jde := basic.Date2JDE(date) jde := basic.Date2JDE(date)
_, loc := date.Zone() _, loc := date.Zone()
timezone := float64(loc) / 3600.0 timezone := float64(loc) / 3600.0
//risedate 时区修正后的时间,转换应当包括时区
riseJde := basic.GetSunRiseTime(jde, lon, lat, timezone, aeroFloat, height) riseJde := basic.GetSunRiseTime(jde, lon, lat, timezone, aeroFloat, height)
if riseJde == -2 { if riseJde == -2 {
err = ERR_SUN_NEVER_RISE err = ERR_SUN_NEVER_RISE
@ -80,7 +81,7 @@ func DownTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, e
} }
// MorningTwilight 晨朦影 // MorningTwilight 晨朦影
// date当地时区日期 // date当地时区日期,返回的时间时区与此参数中的时区一致
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
// angle朦影角度可选-6 -12 -18(民用、航海、天文) // angle朦影角度可选-6 -12 -18(民用、航海、天文)
@ -99,11 +100,11 @@ func MorningTwilight(date time.Time, lon, lat, angle float64) (time.Time, error)
if calcJde == -1 { if calcJde == -1 {
err = ERR_TWILIGHT_NOT_EXISTS err = ERR_TWILIGHT_NOT_EXISTS
} }
return basic.JDE2Date(calcJde), err return basic.JDE2DateByZone(calcJde, date.Location(), true), err
} }
// EveningTwilight 昏朦影 // EveningTwilight 昏朦影
// date当地时区日期 // date当地时区日期,返回的时间时区与此参数中的时区一致
// lon经度东正西负 // lon经度东正西负
// lat纬度北正南负 // lat纬度北正南负
// angle朦影角度可选-6 -12 -18(民用、航海、天文) // angle朦影角度可选-6 -12 -18(民用、航海、天文)
@ -123,7 +124,7 @@ func EveningTwilight(date time.Time, lon, lat, angle float64) (time.Time, error)
if calcJde == -1 { if calcJde == -1 {
err = ERR_TWILIGHT_NOT_EXISTS err = ERR_TWILIGHT_NOT_EXISTS
} }
return basic.JDE2Date(calcJde), err return basic.JDE2DateByZone(calcJde, date.Location(), true), err
} }
// EclipticObliquity 黄赤交角 // EclipticObliquity 黄赤交角
@ -256,10 +257,7 @@ func Zenith(date time.Time, lon, lat float64) float64 {
// CulminationTime 太阳中天时间 // CulminationTime 太阳中天时间
// 返回给定经纬度、对应date时区date时刻的太阳中天日期 // 返回给定经纬度、对应date时区date时刻的太阳中天日期
func CulminationTime(date time.Time, lon float64) time.Time { func CulminationTime(date time.Time, lon float64) time.Time {
jde := basic.Date2JDE(date) jde := basic.Date2JDE(date.Add(time.Duration(-1*date.Hour())*time.Hour)) + 0.5
if jde-math.Floor(jde) > 0.5 {
jde++
}
_, loc := date.Zone() _, loc := date.Zone()
timezone := float64(loc) / 3600.0 timezone := float64(loc) / 3600.0
calcJde := basic.GetSunTZTime(jde, lon, timezone) - timezone/24.00 calcJde := basic.GetSunTZTime(jde, lon, timezone) - timezone/24.00

@ -7,8 +7,23 @@ import (
) )
func TestSun(t *testing.T) { func TestSun(t *testing.T) {
now := time.Now() ja, err := time.LoadLocation("Asia/Tokyo")
fmt.Println(RiseTime(now, 115, 40, 0, true)) if err != nil {
t.Fatal(err)
}
now, err := time.ParseInLocation("2006-01-02 15:04:05", "2020-01-01 00:00:00", ja)
if err != nil {
t.Fatal(err)
}
d, err := RiseTime(now, 115, 40, 0, true)
if err != nil {
t.Fatal(err)
}
if d.Format("2006-01-02 15:04:05") != "2020-01-01 08:41:45" {
t.Fatal(d.Format("2006-01-02 15:04:05"))
}
fmt.Println(CulminationTime(now, 115)) fmt.Println(CulminationTime(now, 115))
fmt.Println(DownTime(now, 115, 40, 0, true)) fmt.Println(DownTime(now, 115, 40, 0, true))
fmt.Println(MorningTwilight(now, 115, 40, -6))
fmt.Println(EveningTwilight(now, 115, 40, -6))
} }

Loading…
Cancel
Save