- fix: Correct sun.TrueBo calculation, now using basic.HSunTrueBo for correct solar latitude

- fix: Rename GetSunDownTime to GetSunSetTime in basic/sun.go and update related calls/outputs
- fix: Update test cases to use new method and error constant names

- improve: Rename all DownTime/Down functions to SetTime/Set for consistency
- improve: Standardize ERR_XXX_NEVER_DOWN error constants to ERR_XXX_NEVER_SET, with ERR_XXX_NEVER_DOWN kept as compatibility alias
- improve: More standard naming for interfaces and errors to improve maintainability and readability
This commit is contained in:
2025-09-08 10:37:46 +08:00
parent b0920d327c
commit 4302981518
22 changed files with 168 additions and 82 deletions
+6 -4
View File
@@ -10,7 +10,9 @@ import (
var (
ERR_URANUS_NEVER_RISE = errors.New("ERROR:极夜,天王星今日永远在地平线下!")
ERR_URANUS_NEVER_DOWN = errors.New("ERROR:极昼,天王星今日永远在地平线上!")
ERR_URANUS_NEVER_SET = errors.New("ERROR:极昼,天王星今日永远在地平线上!")
// ERR_URANUS_NEVER_DOWN deprecated -- use ERR_URANUS_NEVER_SET instead
ERR_URANUS_NEVER_DOWN = ERR_URANUS_NEVER_SET
)
// ApparentLo 视黄经
@@ -122,7 +124,7 @@ func RiseTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, e
err = ERR_URANUS_NEVER_RISE
}
if riseJde == -1 {
err = ERR_URANUS_NEVER_DOWN
err = ERR_URANUS_NEVER_SET
}
return basic.JDE2DateByZone(riseJde, date.Location(), true), err
}
@@ -150,7 +152,7 @@ func DownTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, e
err = ERR_URANUS_NEVER_RISE
}
if riseJde == -1 {
err = ERR_URANUS_NEVER_DOWN
err = ERR_URANUS_NEVER_SET
}
return basic.JDE2DateByZone(riseJde, date.Location(), true), err
}
@@ -205,7 +207,7 @@ func LastRetrogradeToPrograde(date time.Time) time.Time {
}
// NextRetrogradeToPrograde 上次留(逆转瞬)
//// 返回上次逆转瞬留的时间
// // 返回上次逆转瞬留的时间
func NextRetrogradeToPrograde(date time.Time) time.Time {
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
return basic.JDE2DateByZone(basic.NextUranusRetrogradeToPrograde(jde), date.Location(), false)