044f2f4381
- 新增半解析、旧模型、自定义与多源堆叠星历实例,提供 Context、Instance、SPK 读取及状态与视位置计算 - 统一太阳、月球和行星实例接口,扩展黄经穿越、留、相位、最近角距、偕日可见、任意高度升落、轨道节点及凌日等天象查询 - 完善日月食、月掩与凌日的月缘剖面、有限盘面接触、站心修正、局地可见性、全球路径和地图输出 - 新增 SVG、GeoJSON、KML 天象输出及凌日、月掩和月缘地形相关缓存与几何求解 - 新增恒星星表导入与查询,支持 CSV、Hipparcos、BSC5、Stellarium 等格式及名称、交叉标识、锥面检索和星等过滤 - 补充 IAU 2006、地球定向、折射消光、大气观测、轨道传播及半解析行星/月球数据支持 - 将默认未来民用时标切换为 TimeScaleLeapHour,更新 2027–2400 农历速查表、中文日期解析和时区边界处理 - 增加事件基线、跨模型回归、几何边界、月缘地形和输出契约测试,完善中英文手册、示例资源、NOTICE 与忽略规则
74 lines
2.8 KiB
Go
74 lines
2.8 KiB
Go
package moon
|
|
|
|
import (
|
|
"time"
|
|
|
|
"b612.me/astro/basic"
|
|
"b612.me/astro/internal/ephem"
|
|
)
|
|
|
|
// Moon 指定星历实例的计算模块 / computation module bound to an ephemeris instance.
|
|
type Moon struct {
|
|
inst *ephem.Instance
|
|
// lunarLimb 是月掩搜索的默认月缘剖面,nil 为圆月面。
|
|
lunarLimb basic.LunarLimb
|
|
}
|
|
|
|
// NewWithInstance 创建指定星历实例的模块,nil 使用全局模型 / create a module; nil uses the global model.
|
|
func NewWithInstance(inst *ephem.Instance) *Moon { return &Moon{inst: inst} }
|
|
|
|
// WithLunarLimb 返回使用指定月缘剖面的副本,选项中未设置月缘时采用它 / copy with a default lunar limb for occultations.
|
|
func (module *Moon) WithLunarLimb(limb basic.LunarLimb) *Moon {
|
|
copied := *module
|
|
copied.lunarLimb = limb
|
|
return &copied
|
|
}
|
|
|
|
// occultationOptions 在选项未设置月缘时补上模块默认值。
|
|
func (module *Moon) occultationOptions(options OccultationSearchOptions) OccultationSearchOptions {
|
|
if options.LunarLimb == nil {
|
|
options.LunarLimb = module.lunarLimb
|
|
}
|
|
return options
|
|
}
|
|
|
|
var defaultModule Moon
|
|
|
|
// EarthDistance 地月距离 / Earth-Moon distance.
|
|
func (module *Moon) EarthDistance(date time.Time) float64 {
|
|
jde := basic.UTC2TT(basic.Date2JD(date))
|
|
model := ephem.Active()
|
|
if module.inst != nil {
|
|
model = module.inst.Model()
|
|
}
|
|
if model == ephem.Legacy {
|
|
return basic.MoonAway(jde)
|
|
}
|
|
return basic.HMoonAwayWithInstance(jde, module.inst)
|
|
}
|
|
|
|
// PlanetOccultationInfoInUT1 返回固定地点行星月掩的 UT1 时刻副本 / copy in UT1 of a local planetary result.
|
|
func (module *Moon) PlanetOccultationInfoInUT1(info basic.PlanetOccultationInfo) basic.PlanetOccultationInfo {
|
|
return PlanetOccultationInfoInUT1(info)
|
|
}
|
|
|
|
// PlanetOccultationPathInUT1 返回行星月掩全球掩带的 UT1 时刻副本 / copy in UT1 of a planetary path.
|
|
func (module *Moon) PlanetOccultationPathInUT1(path basic.PlanetOccultationPath) basic.PlanetOccultationPath {
|
|
return PlanetOccultationPathInUT1(path)
|
|
}
|
|
|
|
// StarCoordinateFromStarData 将星表记录转换为恒星月掩搜索接受的 J2000 输入;不会加载星表 / convert a catalog record to a J2000 occultation input.
|
|
func (module *Moon) StarCoordinateFromStarData(star StarData) (StarCoordinate, error) {
|
|
return StarCoordinateFromStarData(star)
|
|
}
|
|
|
|
// StarOccultationInfoInUT1 返回固定地点恒星月掩的 UT1 时刻副本 / copy in UT1 of a local stellar result.
|
|
func (module *Moon) StarOccultationInfoInUT1(info basic.StarOccultationInfo) basic.StarOccultationInfo {
|
|
return StarOccultationInfoInUT1(info)
|
|
}
|
|
|
|
// StarOccultationPathInUT1 返回恒星月掩全球路径的 UT1 时刻副本 / copy in UT1 of a stellar path.
|
|
func (module *Moon) StarOccultationPathInUT1(path basic.StarOccultationPath) basic.StarOccultationPath {
|
|
return StarOccultationPathInUT1(path)
|
|
}
|