feat: 引入可切换星历模型并扩展天象观测链路

- 新增半解析、旧模型、自定义与多源堆叠星历实例,提供 Context、Instance、SPK 读取及状态与视位置计算
- 统一太阳、月球和行星实例接口,扩展黄经穿越、留、相位、最近角距、偕日可见、任意高度升落、轨道节点及凌日等天象查询
- 完善日月食、月掩与凌日的月缘剖面、有限盘面接触、站心修正、局地可见性、全球路径和地图输出
- 新增 SVG、GeoJSON、KML 天象输出及凌日、月掩和月缘地形相关缓存与几何求解
- 新增恒星星表导入与查询,支持 CSV、Hipparcos、BSC5、Stellarium 等格式及名称、交叉标识、锥面检索和星等过滤
- 补充 IAU 2006、地球定向、折射消光、大气观测、轨道传播及半解析行星/月球数据支持
- 将默认未来民用时标切换为 TimeScaleLeapHour,更新 2027–2400 农历速查表、中文日期解析和时区边界处理
- 增加事件基线、跨模型回归、几何边界、月缘地形和输出契约测试,完善中英文手册、示例资源、NOTICE 与忽略规则
This commit is contained in:
2026-10-15 23:54:15 +08:00
parent 16c62a97d5
commit 044f2f4381
674 changed files with 62983 additions and 8396 deletions
+47
View File
@@ -0,0 +1,47 @@
package formula
import "math"
// ExtinctionComponents V 波段天顶消光系数分量,单位星等/大气质量 / V-band zenith extinction components in magnitudes per airmass.
type ExtinctionComponents struct {
Rayleigh float64 // 分子散射 / molecular scattering
Aerosol float64 // 气溶胶 / aerosol
Ozone float64 // 臭氧 / ozone
Water float64 // 水汽 / water vapour
Total float64 // 四项之和 / sum of the four terms
}
// ExtinctionSchaefer 按 Schaefer 经验模型由气象条件合成 V 波段天顶消光系数 / V-band zenith extinction from weather by Schaefer's empirical model.
//
// heightM 为测站海拔(米),temperatureC 为气温(°C),relativeHumidity 为相对湿度(百分比,
// 须在 (0, 100) 内),latitude 为测站纬度(度),sunRA 为太阳赤经(度,用于季节项)。
// Total 可直接作为 basic.HeliacalOptions.ExtinctionCoefficient;输入越界时各分量为 NaN。
// heightM is site elevation in metres, temperatureC is air temperature,
// relativeHumidity is a percentage in (0, 100), latitude is the site latitude,
// and sunRA is the Sun's right ascension in degrees for the seasonal terms.
// Total can be used as basic.HeliacalOptions.ExtinctionCoefficient. Out-of-range
// inputs yield NaN components.
func ExtinctionSchaefer(heightM, temperatureC, relativeHumidity, latitude, sunRA float64) ExtinctionComponents {
if !isFinitePhotometry(heightM) || !isFinitePhotometry(temperatureC) || !isFinitePhotometry(relativeHumidity) ||
!isFinitePhotometry(latitude) || !isFinitePhotometry(sunRA) ||
relativeHumidity <= 0 || relativeHumidity >= 100 || latitude < -90 || latitude > 90 {
n := math.NaN()
return ExtinctionComponents{n, n, n, n, n}
}
lat := latitude * math.Pi / 180
ra := sunRA * math.Pi / 180
hemisphere := 1.0
if latitude < 0 {
hemisphere = -1
}
// 标高:分子与水汽 8200 m,气溶胶 1500 m;臭氧层在高空,不随测站海拔变化。
components := ExtinctionComponents{
Rayleigh: 0.1066 * math.Exp(-heightM/8200),
Aerosol: 0.1 * math.Exp(-heightM/1500) * math.Pow(1-0.32/math.Log(relativeHumidity/100), 1.33) *
(1 + 0.33*hemisphere*math.Sin(ra)),
Ozone: 0.031 * (3 + 0.4*(lat*math.Cos(ra)-math.Cos(3*lat))) / 3,
Water: 0.031 * 0.94 * (relativeHumidity / 100) * math.Exp(temperatureC/15) * math.Exp(-heightM/8200),
}
components.Total = components.Rayleigh + components.Aerosol + components.Ozone + components.Water
return components
}