Files
astro/eclipse/observation_helpers.go
T

42 lines
1.2 KiB
Go
Raw Permalink Normal View History

2026-05-01 22:38:44 +08:00
package eclipse
import (
"time"
"b612.me/astro/basic"
"b612.me/astro/tools"
)
func moonSunLoDiff(date time.Time) float64 {
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
2026-05-01 22:38:44 +08:00
sunLo := basic.HSunApparentLo(jde)
moonLo := basic.HMoonApparentLo(jde)
return tools.Limit360(moonLo - sunLo)
}
func solarAltitude(date time.Time, lon, lat float64) float64 {
localJD := basic.Date2JD(date)
2026-05-01 22:38:44 +08:00
_, loc := date.Zone()
return basic.SunHeight(localJD, lon, lat, float64(loc)/3600.0)
2026-05-01 22:38:44 +08:00
}
func solarCulminationTime(date time.Time, lon float64) time.Time {
localJD := basic.Date2JD(date.Add(time.Duration(-1*date.Hour())*time.Hour)) + 0.5
2026-05-01 22:38:44 +08:00
_, loc := date.Zone()
timezone := float64(loc) / 3600.0
calcJD := basic.CulminationTime(localJD, lon, timezone) - timezone/24.0
return basic.JD2DateByZone(calcJD, date.Location(), false)
2026-05-01 22:38:44 +08:00
}
func lunarAzimuth(date time.Time, lon, lat float64) float64 {
localJD := basic.Date2JD(date)
2026-05-01 22:38:44 +08:00
_, loc := date.Zone()
return basic.HMoonAzimuth(localJD, lon, lat, float64(loc)/3600.0)
2026-05-01 22:38:44 +08:00
}
func lunarAltitude(date time.Time, lon, lat float64) float64 {
localJD := basic.Date2JD(date)
2026-05-01 22:38:44 +08:00
_, loc := date.Zone()
return basic.HMoonHeight(localJD, lon, lat, float64(loc)/3600.0)
2026-05-01 22:38:44 +08:00
}