Documentation ¶
Index ¶
- Constants
- Variables
- func CalcEarthLongitudeNutation(T float64) float64
- func CalcEarthObliquityNutation(dt float64) float64
- func CalcMoonECLongitudePeriodic(D, M, Mp, F, E float64) float64
- func CalcMoonLongitudePerturbation(T, Lp, F float64) float64
- func DmsToDegrees(degrees int, mintues int, seconds float64) float64
- func DmsToRadians(d int, m int, s float64) float64
- func DmsToSeconds(d int, m int, s float64) float64
- func GetDayGanZhi(year, month, day int) string
- func GetEarthB0(t float64) float64
- func GetEarthB1(t float64) float64
- func GetEarthB2(t float64) float64
- func GetEarthB3(t float64) float64
- func GetEarthB4(t float64) float64
- func GetEarthEclipticLongitudeForSun(jd float64) float64
- func GetEarthL0(t float64) float64
- func GetEarthL1(t float64) float64
- func GetEarthL2(t float64) float64
- func GetEarthL3(t float64) float64
- func GetEarthL4(t float64) float64
- func GetEarthL5(t float64) float64
- func GetEarthNutationParameter(T float64) (D, M, Mp, F, Omega float64)
- func GetEarthR0(t float64) float64
- func GetEarthR1(t float64) float64
- func GetEarthR2(t float64) float64
- func GetEarthR3(t float64) float64
- func GetEarthR4(t float64) float64
- func GetEarthR5(t float64) float64
- func GetMoonEclipticLongitudeEC(jd float64) float64
- func GetMoonEclipticParameter(T float64) (Lp, D, M, Mp, F, E float64)
- func GetSolarTermJD(year, order int) float64
- func GetSolarTermName(order int) string
- func GetSunEclipticLatitudeForEarth(jd float64) float64
- func GetSunEclipticLongitudeForEarth(jd float64) float64
- func GetSunRadiusForEarth(jd float64) float64
- func GetYearGanZhi(year int) string
- func GetYearZodiac(year int) string
- func Mod2Pi(r float64) float64
- func ModPi(r float64) float64
- func NewtonIteration(f func(float64) float64, x0 float64) float64
- func SecondsToDegrees(seconds float64) float64
- func SecondsToRadians(seconds float64) float64
- func ToDegrees(rad float64) float64
- func ToRadians(degrees float64) float64
- func Vsop2Fk5LongitudeCorrection(l float64, b float64, jd float64) float64
- type Calendar
- type Day
- type Month
- type MoonEclipticLongitudeCoeff
- type NuationCoefficient
Constants ¶
const ( ChunFen int = iota QingMing GuYu LiXia XiaoMan MangZhong XiaZhi XiaoShu DaShu LiQiu ChuShu BaiLu QiuFen HanLu ShuangJiang LiDong XiaoXue DaXue DongZhi XiaoHan DaHan LiChun YuShui JingZhe )
Variables ¶
var ( // 十二生肖 Animals = []string{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"} // 天干 Gan = []string{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"} // 地支 Zhi = []string{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"} )
var MoonLongitude = [60]MoonEclipticLongitudeCoeff{
{0, 0, 1, 0, 6288744, -20905355},
{2, 0, -1, 0, 1274027, -3699111},
{2, 0, 0, 0, 658314, -2955968},
{0, 0, 2, 0, 213618, -569925},
{0, 1, 0, 0, -185116, 48888},
{0, 0, 0, 2, -114332, -3149},
{2, 0, -2, 0, 58793, 246158},
{2, -1, -1, 0, 57066, -152138},
{2, 0, 1, 0, 53322, -170733},
{2, -1, 0, 0, 45758, -204586},
{0, 1, -1, 0, -40923, -129620},
{1, 0, 0, 0, -34720, 108743},
{0, 1, 1, 0, -30383, 104755},
{2, 0, 0, -2, 15327, 10321},
{0, 0, 1, 2, -12528, 0},
{0, 0, 1, -2, 10980, 79661},
{4, 0, -1, 0, 10675, -34782},
{0, 0, 3, 0, 10034, -23210},
{4, 0, -2, 0, 8548, -21636},
{2, 1, -1, 0, -7888, 24208},
{2, 1, 0, 0, -6766, 30824},
{1, 0, -1, 0, -5163, -8379},
{1, 1, 0, 0, 4987, -16675},
{2, -1, 1, 0, 4036, -12831},
{2, 0, 2, 0, 3994, -10445},
{4, 0, 0, 0, 3861, -11650},
{2, 0, -3, 0, 3665, 14403},
{0, 1, -2, 0, -2689, -7003},
{2, 0, -1, 2, -2602, 0},
{2, -1, -2, 0, 2390, 10056},
{1, 0, 1, 0, -2348, 6322},
{2, -2, 0, 0, 2236, -9884},
{0, 1, 2, 0, -2120, 5751},
{0, 2, 0, 0, -2069, 0},
{2, -2, -1, 0, 2048, -4950},
{2, 0, 1, -2, -1773, 4130},
{2, 0, 0, 2, -1595, 0},
{4, -1, -1, 0, 1215, -3958},
{0, 0, 2, 2, -1110, 0},
{3, 0, -1, 0, -892, 3258},
{2, 1, 1, 0, -810, 2616},
{4, -1, -2, 0, 759, -1897},
{0, 2, -1, 0, -713, -2117},
{2, 2, -1, 0, -700, 2354},
{2, 1, -2, 0, 691, 0},
{2, -1, 0, -2, 596, 0},
{4, 0, 1, 0, 549, -1423},
{0, 0, 4, 0, 537, -1117},
{4, -1, 0, 0, 520, -1571},
{1, 0, -2, 0, -487, -1739},
{2, 1, 0, -2, -399, 0},
{0, 0, 2, -2, -381, -4421},
{1, 1, 1, 0, 351, 0},
{3, 0, -2, 0, -340, 0},
{4, 0, -3, 0, 330, 0},
{2, -1, 2, 0, 327, 0},
{0, 2, 1, 0, -323, 1165},
{1, 1, -1, 0, 299, 0},
{2, 0, 3, 0, 294, 0},
{2, 0, -1, -2, 0, 8752},
}
月球黄经周期项(ΣI)及距离(Σr). 黄经单位:0.000001度,距离单位:0.001千米.
--------------------------------------------------
角度的组合系数 ΣI的各项振幅A Σr的各项振幅A D M M' F (正弦振幅) (余弦振幅)
--------------------------------------------------
var SolarTermNames = []string{
"春分",
"清明",
"谷雨",
"立夏",
"小满",
"芒种",
"夏至",
"小暑",
"大暑",
"立秋",
"处暑",
"白露",
"秋分",
"寒露",
"霜降",
"立冬",
"小雪",
"大雪",
"冬至",
"小寒",
"大寒",
"立春",
"雨水",
"惊蛰",
}
Functions ¶
func CalcEarthLongitudeNutation ¶
计算某时刻的黄经章动干扰量 T 儒略世纪数 返回弧度
func CalcEarthObliquityNutation ¶
计算某时刻的黄赤交角章动干扰量 dt 是儒略世纪数 返回弧度
func CalcMoonECLongitudePeriodic ¶
计算月球地心黄经周期项的和
func CalcMoonLongitudePerturbation ¶
计算金星摄动,木星摄动以及地球扁率摄动对月球地心黄经的影响, T 是儒略世纪数,Lp和F单位是弧度 A1 = 119.75 + 131.849 * T (4.13式) A2 = 53.09 + 479264.290 * T (4.14式) A3 = 313.45 + 481266.484 * T (4.15式)
func DmsToDegrees ¶
DmsToDegrees 把度分秒表示的角度换算成度
func DmsToRadians ¶
DmsToRadians 把度分秒表示的角度换算成弧度(rad)
func DmsToSeconds ¶
DmsToSeconds 把度分秒表示的角度换算成角秒(arcsecond)
func GetEarthB0 ¶
func GetEarthB1 ¶
func GetEarthB2 ¶
func GetEarthB3 ¶
func GetEarthB4 ¶
func GetEarthL0 ¶
func GetEarthL1 ¶
func GetEarthL2 ¶
func GetEarthL3 ¶
func GetEarthL4 ¶
func GetEarthL5 ¶
func GetEarthNutationParameter ¶
T 是 儒略世纪数 返回 弧度
func GetEarthR0 ¶
func GetEarthR1 ¶
func GetEarthR2 ¶
func GetEarthR3 ¶
func GetEarthR4 ¶
func GetEarthR5 ¶
func GetMoonEclipticLongitudeEC ¶
计算月球地心黄经 jd 儒略日 返回 弧度
func GetMoonEclipticParameter ¶
参数 T 儒略世纪数 返回 弧度
func GetSolarTermJD ¶
GetSolarTermJD 使用牛顿迭代法计算24节气的时间 f(x) = Vsop87dEarthUtil.getEarthEclipticLongitudeForSun(x) - angle = 0 year 年 order 节气序号 返回 节气的儒略日力学时间 TD
func NewtonIteration ¶
NewtonIteration 牛顿迭代法求解方程的根
Types ¶
type Calendar ¶
type Calendar struct { Year int // 公历年份 SolarTermJDs *[25]float64 // 相关的 25 节气 北京时间 儒略日 SolarTermTimes *[25]time.Time // 对应 SolarTermJDs 转换为 time.Time 的时间 NewMoonJDs *[15]float64 // 相关的 15 个朔日 北京时间 儒略日 Months []*Month // 月 // contains filtered or unexported fields }
Calendar 保存公历年内计算农历所需的信息
func (*Calendar) SolarDayToLunarDay ¶
SolarDayToLunarDay 指定年份内公历日期转换为农历日
type Day ¶
type Day struct { Year int // 公历年 Day int // 农历日 Month *Month // 农历月 MonthZhi int // 农历日所在的月的地支 SolarTerm int // 0~23 二十四节气 ,-1 非节气 }
Day 保存农历日信息
func (*Day) SolarTermName ¶
SolarTermName 获取当天的二十四节气名 没有则返回空字符串
type Month ¶
type Month struct { Name int // 农历月名 Days int // 本月天数 ShuoJD float64 // 本月朔日时间 北京时间 儒略日 ShuoTime time.Time // 本月朔日时间 北京时间 IsLeap bool // 是否为闰月 }
Month 保存农历月信息