Files
astro/basic/occultation_rise_set_junction_test.go
T
b612 2bf8478639 feat: 完善日月食与月掩几何链路并扩展历法接口
- 新增日月食中心带、偏食带、阴影足迹、等时线、食分线及升落边界计算,支持极区与混合食拓扑
- 新增日食单时刻阴影求解器、站心状态查询、批量采样和 ΔT 覆盖接口
- 重构恒星与行星月掩路径,补充有限盘面接触、站心修正、掩带宽度、极区投影及升落边界
- 扩展 SVG 与 GeoJSON 输出,支持详细面板、全球/极区/地球投影、边界闭合、时间标记和拓扑签名
- 扩展日月食候选搜索、局地搜索、沙罗序列预计算与范围外推,补充系列锚点和成员一致性校验
- 补齐古历纪年、儒略历独有闰日、多公历候选、历法改革跨日及精确日期运算接口
- 优化 ΔT、章动、恒星时、月球地平线、事件根搜索和本地星历缓存,降低重复计算开销并提升边界稳定
2026-09-17 12:27:40 +08:00

66 lines
2.3 KiB
Go

package basic
import (
"testing"
"time"
)
func TestPlanetOccultationContactPhaseJunctionsClose(t *testing.T) {
for _, sample := range []struct {
year, month, day int
planet OccultationPlanet
}{
{2027, 4, 15, OccultationJupiter},
{2027, 1, 8, OccultationMercury},
// 2025-01-05 月掩海王星在环极折点处残差与零相切,符号扫描漏根会让
// 「终掩在月升/月落」分支断开,这里固定该回归。
// The 2025-01-05 Neptune occultation tangents the zero residual at its
// polar fold; a sign-only scan drops that root and breaks the end phase
// branches apart, so pin the regression here.
{2025, 1, 5, OccultationNeptune},
} {
t.Run(string(sample.planet), func(t *testing.T) {
day := time.Date(sample.year, time.Month(sample.month), sample.day, 0, 0, 0, 0, time.UTC)
paths, err := FindPlanetOccultationPaths(day.Add(-12*time.Hour), day.Add(36*time.Hour), sample.planet,
OccultationPathOptions{Step: 20 * time.Minute, TargetSpacingKM: 900, DisableFootprints: true, RiseSetStep: time.Minute})
if err != nil || len(paths) != 1 {
t.Fatalf("paths=%d err=%v", len(paths), err)
}
for _, curves := range [][]OccultationRiseSetCurve{paths[0].RiseSetCurves, paths[0].TotalRiseSetCurves} {
for ci, curve := range curves {
if curve.Phase == RiseSetPhaseGreatest {
continue
}
for si, segment := range curve.Segments {
if len(segment) < 2 {
continue
}
for _, endpoint := range []OccultationPathPoint{segment[0], segment[len(segment)-1]} {
shared := false
for oi, other := range curves {
if other.Phase == RiseSetPhaseGreatest {
continue
}
for os, points := range other.Segments {
if ci == oi && si == os || len(points) < 2 {
continue
}
for _, point := range []OccultationPathPoint{points[0], points[len(points)-1]} {
dt := point.Time.Sub(endpoint.Time)
if dt >= -time.Second && dt <= time.Second && occultationPathDistanceKM(endpoint, point) < 0.01 {
shared = true
}
}
}
}
if !shared {
t.Errorf("unclosed %s/%s endpoint lon=%.9f lat=%.9f at=%s", curve.Phase, curve.Direction, endpoint.Longitude, endpoint.Latitude, endpoint.Time)
}
}
}
}
}
})
}
}