044f2f4381
- 新增半解析、旧模型、自定义与多源堆叠星历实例,提供 Context、Instance、SPK 读取及状态与视位置计算 - 统一太阳、月球和行星实例接口,扩展黄经穿越、留、相位、最近角距、偕日可见、任意高度升落、轨道节点及凌日等天象查询 - 完善日月食、月掩与凌日的月缘剖面、有限盘面接触、站心修正、局地可见性、全球路径和地图输出 - 新增 SVG、GeoJSON、KML 天象输出及凌日、月掩和月缘地形相关缓存与几何求解 - 新增恒星星表导入与查询,支持 CSV、Hipparcos、BSC5、Stellarium 等格式及名称、交叉标识、锥面检索和星等过滤 - 补充 IAU 2006、地球定向、折射消光、大气观测、轨道传播及半解析行星/月球数据支持 - 将默认未来民用时标切换为 TimeScaleLeapHour,更新 2027–2400 农历速查表、中文日期解析和时区边界处理 - 增加事件基线、跨模型回归、几何边界、月缘地形和输出契约测试,完善中英文手册、示例资源、NOTICE 与忽略规则
103 lines
4.9 KiB
Go
103 lines
4.9 KiB
Go
package jupiter
|
|
|
|
import (
|
|
"b612.me/astro/basic"
|
|
"b612.me/astro/internal/ephem"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
type contextAPI interface {
|
|
Altitude(date time.Time, lon, lat float64) float64
|
|
AltitudeN(date time.Time, lon, lat float64, n int) float64
|
|
ApparentBo(date time.Time) float64
|
|
ApparentBoN(date time.Time, n int) float64
|
|
ApparentDec(date time.Time) float64
|
|
ApparentDecN(date time.Time, n int) float64
|
|
ApparentLo(date time.Time) float64
|
|
ApparentLoN(date time.Time, n int) float64
|
|
ApparentMagnitude(date time.Time) float64
|
|
ApparentMagnitudeN(date time.Time, n int) float64
|
|
ApparentRa(date time.Time) float64
|
|
ApparentRaDec(date time.Time) (float64, float64)
|
|
ApparentRaDecN(date time.Time, n int) (float64, float64)
|
|
ApparentRaN(date time.Time, n int) float64
|
|
AscendingNode(date time.Time) float64
|
|
AscendingNodeN(date time.Time, n int) float64
|
|
Azimuth(date time.Time, lon, lat float64) float64
|
|
AzimuthN(date time.Time, lon, lat float64, n int) float64
|
|
BrightLimbPositionAngle(date time.Time) float64
|
|
BrightLimbPositionAngleN(date time.Time, n int) float64
|
|
CentralMeridians(date time.Time) CentralMeridianInfo
|
|
CentralMeridiansN(date time.Time, n int) CentralMeridianInfo
|
|
ClosestGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonContactEvent
|
|
ClosestGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonEvent
|
|
CulminationTime(date time.Time, lon float64) time.Time
|
|
CulminationTimeN(date time.Time, lon float64, n int) time.Time
|
|
DescendingNode(date time.Time) float64
|
|
DescendingNodeN(date time.Time, n int) float64
|
|
Diameter(date time.Time) float64
|
|
DiameterN(date time.Time, n int) float64
|
|
DownTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, error)
|
|
DownTimeN(date time.Time, lon, lat, height float64, aero bool, n int) (time.Time, error)
|
|
EarthDistance(date time.Time) float64
|
|
EarthDistanceN(date time.Time, n int) float64
|
|
HourAngle(date time.Time, lon float64) float64
|
|
HourAngleN(date time.Time, lon float64, n int) float64
|
|
IlluminatedFraction(date time.Time) float64
|
|
IlluminatedFractionN(date time.Time, n int) float64
|
|
LastConjunction(date time.Time) time.Time
|
|
LastEasternQuadrature(date time.Time) time.Time
|
|
LastGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonContactEvent
|
|
LastGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonEvent
|
|
LastOpposition(date time.Time) time.Time
|
|
LastProgradeToRetrograde(date time.Time) time.Time
|
|
LastRetrogradeToPrograde(date time.Time) time.Time
|
|
LastWesternQuadrature(date time.Time) time.Time
|
|
NextConjunction(date time.Time) time.Time
|
|
NextEasternQuadrature(date time.Time) time.Time
|
|
NextGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonContactEvent
|
|
NextGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonEvent
|
|
NextOpposition(date time.Time) time.Time
|
|
NextProgradeToRetrograde(date time.Time) time.Time
|
|
NextRetrogradeToPrograde(date time.Time) time.Time
|
|
NextWesternQuadrature(date time.Time) time.Time
|
|
ParallacticAngle(date time.Time, lon, lat float64) float64
|
|
ParallacticAngleN(date time.Time, lon, lat float64, n int) float64
|
|
Phase(date time.Time) float64
|
|
PhaseAngle(date time.Time) float64
|
|
PhaseAngleN(date time.Time, n int) float64
|
|
PhaseN(date time.Time, n int) float64
|
|
Physical(date time.Time) PhysicalInfo
|
|
PhysicalN(date time.Time, n int) PhysicalInfo
|
|
RiseTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, error)
|
|
RiseTimeN(date time.Time, lon, lat, height float64, aero bool, n int) (time.Time, error)
|
|
SatellitePhenomena(date time.Time) GalileanPhenomenaInfo
|
|
Satellites(date time.Time) GalileanSatellitesInfo
|
|
Semidiameter(date time.Time) float64
|
|
SemidiameterN(date time.Time, n int) float64
|
|
SetTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, error)
|
|
SetTimeN(date time.Time, lon, lat, height float64, aero bool, n int) (time.Time, error)
|
|
SunDistance(date time.Time) float64
|
|
SunDistanceN(date time.Time, n int) float64
|
|
Zenith(date time.Time, lon, lat float64) float64
|
|
ZenithN(date time.Time, lon, lat float64, n int) float64
|
|
}
|
|
|
|
var _ contextAPI = (*Jupiter)(nil)
|
|
|
|
func TestContextModuleIsolation(t *testing.T) {
|
|
previous := basic.GetEphemerisModel()
|
|
t.Cleanup(func() { basic.SetEphemerisModel(previous) })
|
|
date := time.Date(2024, 10, 6, 12, 0, 0, 0, time.UTC)
|
|
for _, model := range []ephem.Model{ephem.Legacy, ephem.Semianalytic} {
|
|
basic.SetEphemerisModel(basic.EphemerisModel(model))
|
|
want := ApparentLo(date)
|
|
module := NewWithInstance(ephem.NewModelInstance(model))
|
|
basic.SetEphemerisModel(basic.EphemerisModel(1 - int(model)))
|
|
if got := module.ApparentLo(date); got != want {
|
|
t.Fatalf("model %d: longitude %.12f, want %.12f", model, got, want)
|
|
}
|
|
}
|
|
}
|