- 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
+1 -1
View File
@@ -26,7 +26,7 @@ func show() {
fmt.Println("当前太阳星座:", WhichCst(ra, dec, jde))
fmt.Println("当前黄赤交角:", EclipticObliquity(jde-8.0/24.0, true))
fmt.Println("当前日出:", JDE2Date(GetSunRiseTime(jde, 115, 32, 8, 1, 10)))
fmt.Println("当前日落:", JDE2Date(GetSunDownTime(jde, 115, 32, 8, 1, 10)))
fmt.Println("当前日落:", JDE2Date(GetSunSetTime(jde, 115, 32, 8, 1, 10)))
fmt.Println("当前晨影 -6", JDE2Date(GetAsaTime(jde, 115, 32, 8, -6)))
fmt.Println("当前晨影 -12", JDE2Date(GetAsaTime(jde, 115, 32, 8, -12)))
fmt.Println("当前昏影 -6", JDE2Date(GetBanTime(jde, 115, 32, 8, -6)))
+1 -1
View File
@@ -551,7 +551,7 @@ func GetSunRiseTime(JD, Lon, Lat, TZ, ZS, HEI float64) float64 {
}
return JD1 - ntz/24 + TZ/24
}
func GetSunDownTime(JD, Lon, Lat, TZ, ZS, HEI float64) float64 {
func GetSunSetTime(JD, Lon, Lat, TZ, ZS, HEI float64) float64 {
var An float64
JD = math.Floor(JD) + 1.5
ntz := math.Round(Lon / 15)
+2 -2
View File
@@ -10,7 +10,7 @@ import (
func Test_Jq(t *testing.T) {
data := GetJieqiLoops(2019, 24)
for i := 1; i < 25; i++ {
for i := 1; i < len(data); i++ {
fmt.Println(JDE2Date(data[i]))
}
//fmt.Println(JDE2Date(GetWHTime(2019, 10)))
@@ -144,7 +144,7 @@ func Test_SunRiseRound(t *testing.T) {
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))
fmt.Println(i, GetSunSetTime(jde, 115, float64(i), 8, 0, 0))
}
}