|
|
@ -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 世界时转力学时CC,false 力学时转世界时VV
|
|
|
|
func TD2UT(JDE float64, UT2TD bool) float64 { // true 世界时转力学时CC,false 力学时转世界时VV
|
|
|
|
|
|
|
|
|
|
|
|
Deltat := DeltaT(JDE, true)
|
|
|
|
Deltat := DeltaT(JDE, true)
|
|
|
|