feat: 完善时标与天象几何计算并扩展输出接口
- 新增时标、ΔT 模型、质心时间与 UT1 支持 - 改进日月食、月掩、行星事件及路径边界计算 - 完善恒星三维自行与动态距离传播 - 扩展 SVG、GeoJSON、KML 输出与底层距离换算工具 - 整理中英文手册、示例资源及回归测试
This commit is contained in:
+4
-4
@@ -14,8 +14,8 @@ func Semidiameter(date time.Time) float64 {
|
||||
|
||||
// SemidiameterN 木星视半径(截断版),单位角秒 / truncated apparent Jupiter semidiameter in arcseconds.
|
||||
func SemidiameterN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterSemidiameterN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterSemidiameterN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// Diameter 木星视直径,单位角秒 / apparent Jupiter diameter in arcseconds.
|
||||
@@ -25,6 +25,6 @@ func Diameter(date time.Time) float64 {
|
||||
|
||||
// DiameterN 木星视直径(截断版),单位角秒 / truncated apparent Jupiter diameter in arcseconds.
|
||||
func DiameterN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterDiameterN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterDiameterN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
+62
-67
@@ -15,7 +15,7 @@ var (
|
||||
ERR_JUPITER_NEVER_DOWN = ERR_JUPITER_NEVER_SET
|
||||
)
|
||||
|
||||
func riseSetResult(date time.Time, jde float64, err error) (time.Time, error) {
|
||||
func riseSetResult(date time.Time, jd float64, err error) (time.Time, error) {
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.Is(err, basic.ErrNeverRise):
|
||||
@@ -26,7 +26,8 @@ func riseSetResult(date time.Time, jde float64, err error) (time.Time, error) {
|
||||
return time.Time{}, err
|
||||
}
|
||||
}
|
||||
return basic.JDE2DateByZone(jde, date.Location(), true), nil
|
||||
_, offset := date.Zone()
|
||||
return basic.JD2DateByZone(jd-float64(offset)/86400, date.Location(), false), nil
|
||||
}
|
||||
|
||||
// ApparentLo 视黄经 / apparent ecliptic longitude.
|
||||
@@ -34,8 +35,8 @@ func riseSetResult(date time.Time, jde float64, err error) (time.Time, error) {
|
||||
// 返回木星在 date 对应绝对时刻的瞬时视黄经,单位度。
|
||||
// Returns the apparent ecliptic longitude of Jupiter at the instant represented by date, in degrees.
|
||||
func ApparentLo(date time.Time) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentLo(basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentLo(basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// ApparentBo 视黄纬 / apparent ecliptic latitude.
|
||||
@@ -43,8 +44,8 @@ func ApparentLo(date time.Time) float64 {
|
||||
// 返回木星在 date 对应绝对时刻的瞬时视黄纬,单位度。
|
||||
// Returns the apparent ecliptic latitude of Jupiter at the instant represented by date, in degrees.
|
||||
func ApparentBo(date time.Time) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentBo(basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentBo(basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// ApparentRa 视赤经 / apparent right ascension.
|
||||
@@ -52,8 +53,8 @@ func ApparentBo(date time.Time) float64 {
|
||||
// 返回木星在 date 对应绝对时刻的瞬时视赤经,单位度。
|
||||
// Returns the apparent right ascension of Jupiter at the instant represented by date, in degrees.
|
||||
func ApparentRa(date time.Time) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentRa(basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentRa(basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// ApparentDec 视赤纬 / apparent declination.
|
||||
@@ -61,8 +62,8 @@ func ApparentRa(date time.Time) float64 {
|
||||
// 返回木星在 date 对应绝对时刻的瞬时视赤纬,单位度。
|
||||
// Returns the apparent declination of Jupiter at the instant represented by date, in degrees.
|
||||
func ApparentDec(date time.Time) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentDec(basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentDec(basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// ApparentRaDec 视赤经、视赤纬 / apparent right ascension and declination.
|
||||
@@ -70,8 +71,8 @@ func ApparentDec(date time.Time) float64 {
|
||||
// 返回木星在 date 对应绝对时刻的瞬时视赤经与视赤纬,单位度。
|
||||
// Returns the apparent right ascension and declination of Jupiter at the instant represented by date, in degrees.
|
||||
func ApparentRaDec(date time.Time) (float64, float64) {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentRaDec(basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentRaDec(basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// ApparentMagnitude 视星等 / apparent magnitude.
|
||||
@@ -79,8 +80,8 @@ func ApparentRaDec(date time.Time) (float64, float64) {
|
||||
// 返回木星在 date 对应绝对时刻的视星等。
|
||||
// Returns the apparent visual magnitude of Jupiter at the instant represented by date.
|
||||
func ApparentMagnitude(date time.Time) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterMag(basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterMag(basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// EarthDistance 地心距离 / Earth distance.
|
||||
@@ -88,8 +89,8 @@ func ApparentMagnitude(date time.Time) float64 {
|
||||
// 返回木星在 date 对应绝对时刻到地球的距离,单位 AU。
|
||||
// Returns the distance from Jupiter to Earth at the instant represented by date, in astronomical units.
|
||||
func EarthDistance(date time.Time) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.EarthJupiterAway(basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.EarthJupiterAway(basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// SunDistance 日心距离 / Sun distance.
|
||||
@@ -97,8 +98,8 @@ func EarthDistance(date time.Time) float64 {
|
||||
// 返回木星在 date 对应绝对时刻到太阳的距离,单位 AU。
|
||||
// Returns the distance from Jupiter to the Sun at the instant represented by date, in astronomical units.
|
||||
func SunDistance(date time.Time) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return planet.WherePlanet(4, 2, basic.TD2UT(jde, true))
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return planet.WherePlanet(4, 2, basic.UTC2TT(jd))
|
||||
}
|
||||
|
||||
// Altitude 高度角 / altitude.
|
||||
@@ -106,10 +107,10 @@ func SunDistance(date time.Time) float64 {
|
||||
// date 表示观测时刻,会读取其时区参与地方时计算;lon 为观测者经度,东正西负;lat 为观测者纬度,北正南负。返回值单位度。
|
||||
// date is the observing instant and its zone offset participates in local-time calculations. lon is east-positive longitude, lat is north-positive latitude, and the result is in degrees.
|
||||
func Altitude(date time.Time, lon, lat float64) float64 {
|
||||
jde := basic.Date2JDE(date)
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
return basic.JupiterHeight(jde, lon, lat, timezone)
|
||||
return basic.JupiterHeight(localJD, lon, lat, timezone)
|
||||
}
|
||||
|
||||
// Zenith 天顶距 / zenith distance.
|
||||
@@ -125,10 +126,10 @@ func Zenith(date time.Time, lon, lat float64) float64 {
|
||||
// date 表示观测时刻,会读取其时区参与地方时计算;lon 为观测者经度,东正西负;lat 为观测者纬度,北正南负。返回值按正北为 0°、向东增加。
|
||||
// date is the observing instant and its zone offset participates in local-time calculations. lon is east-positive longitude, lat is north-positive latitude, and azimuth is measured from north toward east.
|
||||
func Azimuth(date time.Time, lon, lat float64) float64 {
|
||||
jde := basic.Date2JDE(date)
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
return basic.JupiterAzimuth(jde, lon, lat, timezone)
|
||||
return basic.JupiterAzimuth(localJD, lon, lat, timezone)
|
||||
}
|
||||
|
||||
// HourAngle 时角 / hour angle.
|
||||
@@ -136,10 +137,10 @@ func Azimuth(date time.Time, lon, lat float64) float64 {
|
||||
// date 表示观测时刻,会读取其时区参与地方时计算;lon 为观测者经度,东正西负。返回值单位度。
|
||||
// date is the observing instant and its zone offset participates in local-time calculations. lon is east-positive longitude and the returned hour angle is in degrees.
|
||||
func HourAngle(date time.Time, lon float64) float64 {
|
||||
jde := basic.Date2JDE(date)
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
return basic.JupiterHourAngle(jde, lon, timezone)
|
||||
return basic.JupiterHourAngle(localJD, lon, timezone)
|
||||
}
|
||||
|
||||
// CulminationTime 中天时刻 / culmination time.
|
||||
@@ -147,33 +148,29 @@ func HourAngle(date time.Time, lon float64) float64 {
|
||||
// date 取其所在时区的当地日期,返回值保持相同时区;lon 为观测者经度,东正西负。
|
||||
// date is interpreted on its local civil day and the result keeps the same time zone. lon is east-positive longitude.
|
||||
func CulminationTime(date time.Time, lon float64) time.Time {
|
||||
if date.Hour() > 12 {
|
||||
date = date.Add(time.Hour * -12)
|
||||
}
|
||||
jde := basic.Date2JDE(date)
|
||||
date = time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location())
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
calcJde := basic.JupiterCulminationTime(jde, lon, timezone) - timezone/24.00
|
||||
return basic.JDE2DateByZone(calcJde, date.Location(), false)
|
||||
calcJD := basic.JupiterCulminationTime(localJD, lon, timezone) - timezone/24.00
|
||||
return basic.JD2DateByZone(calcJD, date.Location(), false)
|
||||
}
|
||||
|
||||
// RiseTime 升起时间 / rise time.
|
||||
//
|
||||
// date 取其所在时区的当地日期,返回值保持相同时区;lon 为东正西负经度,lat 为北正南负纬度;height 为观测点海拔高度(米);aero 为 true 时加入标准大气折射。
|
||||
// date 取其所在时区的当地日期,返回值保持相同时区;lon 为东正西负经度,lat 为北正南负纬度;height 为观测点椭球高(大地高,米);aero 为 true 时加入标准大气折射。
|
||||
// date is interpreted on its local civil day and the result keeps the same time zone. lon is east-positive longitude, lat is north-positive latitude, height is observer elevation in meters, and aero enables standard atmospheric refraction.
|
||||
func RiseTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, error) {
|
||||
var aeroFloat float64
|
||||
if aero {
|
||||
aeroFloat = 1
|
||||
}
|
||||
if date.Hour() > 12 {
|
||||
date = date.Add(time.Hour * -12)
|
||||
}
|
||||
jde := basic.Date2JDE(date)
|
||||
date = time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location())
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
riseJde, err := basic.JupiterRiseTime(jde, lon, lat, timezone, aeroFloat, height)
|
||||
return riseSetResult(date, riseJde, err)
|
||||
riseJD, err := basic.JupiterRiseTime(localJD, lon, lat, timezone, aeroFloat, height)
|
||||
return riseSetResult(date, riseJD, err)
|
||||
}
|
||||
|
||||
// DownTime 落下时间别名 / deprecated set-time alias.
|
||||
@@ -195,14 +192,12 @@ func SetTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, er
|
||||
if aero {
|
||||
aeroFloat = 1
|
||||
}
|
||||
if date.Hour() > 12 {
|
||||
date = date.Add(time.Hour * -12)
|
||||
}
|
||||
jde := basic.Date2JDE(date)
|
||||
date = time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location())
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
riseJde, err := basic.JupiterSetTime(jde, lon, lat, timezone, aeroFloat, height)
|
||||
return riseSetResult(date, riseJde, err)
|
||||
riseJD, err := basic.JupiterSetTime(localJD, lon, lat, timezone, aeroFloat, height)
|
||||
return riseSetResult(date, riseJD, err)
|
||||
}
|
||||
|
||||
// LastConjunction 上一次合日 / previous conjunction with the Sun.
|
||||
@@ -210,8 +205,8 @@ func SetTime(date time.Time, lon, lat, height float64, aero bool) (time.Time, er
|
||||
// 返回 date 当前或之前最近一次与太阳的合日时刻,结果保持 date 的时区。
|
||||
// Returns the nearest conjunction with the Sun at or before date, keeping date's time zone.
|
||||
func LastConjunction(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.LastJupiterConjunction(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.LastJupiterConjunction(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// NextConjunction 下一次合日 / next conjunction with the Sun.
|
||||
@@ -219,8 +214,8 @@ func LastConjunction(date time.Time) time.Time {
|
||||
// 返回 date 当前或之后最近一次与太阳的合日时刻,结果保持 date 的时区。
|
||||
// Returns the nearest conjunction with the Sun at or after date, keeping date's time zone.
|
||||
func NextConjunction(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.NextJupiterConjunction(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.NextJupiterConjunction(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// LastOpposition 上一次冲日 / previous opposition.
|
||||
@@ -228,8 +223,8 @@ func NextConjunction(date time.Time) time.Time {
|
||||
// 返回 date 当前或之前最近一次冲日时刻,结果保持 date 的时区。
|
||||
// Returns the nearest opposition at or before date, keeping date's time zone.
|
||||
func LastOpposition(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.LastJupiterOpposition(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.LastJupiterOpposition(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// NextOpposition 下一次冲日 / next opposition.
|
||||
@@ -237,8 +232,8 @@ func LastOpposition(date time.Time) time.Time {
|
||||
// 返回 date 当前或之后最近一次冲日时刻,结果保持 date 的时区。
|
||||
// Returns the nearest opposition at or after date, keeping date's time zone.
|
||||
func NextOpposition(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.NextJupiterOpposition(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.NextJupiterOpposition(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// LastProgradeToRetrograde 上一次顺行转逆行留 / previous station from prograde to retrograde.
|
||||
@@ -246,8 +241,8 @@ func NextOpposition(date time.Time) time.Time {
|
||||
// 返回 date 当前或之前最近一次由顺行转为逆行的留时刻,结果保持 date 的时区。
|
||||
// Returns the nearest station at or before date where motion changes from prograde to retrograde, keeping date's time zone.
|
||||
func LastProgradeToRetrograde(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.LastJupiterProgradeToRetrograde(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.LastJupiterProgradeToRetrograde(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// NextProgradeToRetrograde 下一次顺行转逆行留 / next station from prograde to retrograde.
|
||||
@@ -255,8 +250,8 @@ func LastProgradeToRetrograde(date time.Time) time.Time {
|
||||
// 返回 date 当前或之后最近一次由顺行转为逆行的留时刻,结果保持 date 的时区。
|
||||
// Returns the nearest station at or after date where motion changes from prograde to retrograde, keeping date's time zone.
|
||||
func NextProgradeToRetrograde(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.NextJupiterProgradeToRetrograde(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.NextJupiterProgradeToRetrograde(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// LastRetrogradeToPrograde 上一次逆行转顺行留 / previous station from retrograde to prograde.
|
||||
@@ -264,8 +259,8 @@ func NextProgradeToRetrograde(date time.Time) time.Time {
|
||||
// 返回 date 当前或之前最近一次由逆行转为顺行的留时刻,结果保持 date 的时区。
|
||||
// Returns the nearest station at or before date where motion changes from retrograde to prograde, keeping date's time zone.
|
||||
func LastRetrogradeToPrograde(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.LastJupiterRetrogradeToPrograde(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.LastJupiterRetrogradeToPrograde(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// NextRetrogradeToPrograde 下一次逆行转顺行留 / next station from retrograde to prograde.
|
||||
@@ -273,8 +268,8 @@ func LastRetrogradeToPrograde(date time.Time) time.Time {
|
||||
// 返回 date 当前或之后最近一次由逆行转为顺行的留时刻,结果保持 date 的时区。
|
||||
// Returns the nearest station at or after date where motion changes from retrograde to prograde, keeping date's time zone.
|
||||
func NextRetrogradeToPrograde(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.NextJupiterRetrogradeToPrograde(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.NextJupiterRetrogradeToPrograde(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// LastEasternQuadrature 上一次东方照 / previous eastern quadrature.
|
||||
@@ -282,8 +277,8 @@ func NextRetrogradeToPrograde(date time.Time) time.Time {
|
||||
// 返回 date 当前或之前最近一次东方照时刻,结果保持 date 的时区。
|
||||
// Returns the nearest eastern quadrature at or before date, keeping date's time zone.
|
||||
func LastEasternQuadrature(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.LastJupiterEasternQuadrature(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.LastJupiterEasternQuadrature(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// NextEasternQuadrature 下一次东方照 / next eastern quadrature.
|
||||
@@ -291,8 +286,8 @@ func LastEasternQuadrature(date time.Time) time.Time {
|
||||
// 返回 date 当前或之后最近一次东方照时刻,结果保持 date 的时区。
|
||||
// Returns the nearest eastern quadrature at or after date, keeping date's time zone.
|
||||
func NextEasternQuadrature(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.NextJupiterEasternQuadrature(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.NextJupiterEasternQuadrature(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// LastWesternQuadrature 上一次西方照 / previous western quadrature.
|
||||
@@ -300,8 +295,8 @@ func NextEasternQuadrature(date time.Time) time.Time {
|
||||
// 返回 date 当前或之前最近一次西方照时刻,结果保持 date 的时区。
|
||||
// Returns the nearest western quadrature at or before date, keeping date's time zone.
|
||||
func LastWesternQuadrature(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.LastJupiterWesternQuadrature(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.LastJupiterWesternQuadrature(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
// NextWesternQuadrature 下一次西方照 / next western quadrature.
|
||||
@@ -309,6 +304,6 @@ func LastWesternQuadrature(date time.Time) time.Time {
|
||||
// 返回 date 当前或之后最近一次西方照时刻,结果保持 date 的时区。
|
||||
// Returns the nearest western quadrature at or after date, keeping date's time zone.
|
||||
func NextWesternQuadrature(date time.Time) time.Time {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
return basic.JDE2DateByZone(basic.NextJupiterWesternQuadrature(jde), date.Location(), false)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
return basic.JD2DateByZone(basic.NextJupiterWesternQuadrature(jde), date.Location(), false)
|
||||
}
|
||||
|
||||
+4
-4
@@ -14,8 +14,8 @@ func AscendingNode(date time.Time) float64 {
|
||||
|
||||
// AscendingNodeN 木星升交点黄经(截断版) / truncated ascending node longitude of Jupiter.
|
||||
func AscendingNodeN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterAscendingNodeN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterAscendingNodeN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// DescendingNode 木星降交点黄经 / descending node longitude of Jupiter.
|
||||
@@ -25,6 +25,6 @@ func DescendingNode(date time.Time) float64 {
|
||||
|
||||
// DescendingNodeN 木星降交点黄经(截断版) / truncated descending node longitude of Jupiter.
|
||||
func DescendingNodeN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterDescendingNodeN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterDescendingNodeN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,5 +48,5 @@ func BrightLimbPositionAngleN(date time.Time, n int) float64 {
|
||||
}
|
||||
|
||||
func phaseJD(date time.Time) float64 {
|
||||
return basic.TD2UT(calendar.Date2JDE(date.UTC()), true)
|
||||
return basic.UTC2TT(calendar.Date2JD(date.UTC()))
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ type GalileanPhenomenaInfo struct {
|
||||
// date 表示观测绝对时刻(UTC),内部换算为该时刻对应的 TT/TDB 历元求值。
|
||||
// date is the observing instant in UTC; it is converted to the corresponding TT/TDB epoch for evaluation.
|
||||
func SatellitePhenomena(date time.Time) GalileanPhenomenaInfo {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
phenomena := basic.JupiterGalileanSatellitePhenomena(jde)
|
||||
return GalileanPhenomenaInfo{
|
||||
Io: galileanPhenomenonFromBasic(phenomena[0]),
|
||||
|
||||
@@ -59,7 +59,7 @@ type GalileanPhenomenonContactEvent struct {
|
||||
func LastGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonContactEvent {
|
||||
return galileanPhenomenonContactEventFromBasic(
|
||||
basic.LastJupiterGalileanPhenomenonContactEvent(
|
||||
basic.Date2JDE(date.UTC()),
|
||||
basic.Date2JD(date.UTC()),
|
||||
satellite,
|
||||
basic.JupiterGalileanPhenomenonType(phenomenonType),
|
||||
),
|
||||
@@ -71,7 +71,7 @@ func LastGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomeno
|
||||
func NextGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonContactEvent {
|
||||
return galileanPhenomenonContactEventFromBasic(
|
||||
basic.NextJupiterGalileanPhenomenonContactEvent(
|
||||
basic.Date2JDE(date.UTC()),
|
||||
basic.Date2JD(date.UTC()),
|
||||
satellite,
|
||||
basic.JupiterGalileanPhenomenonType(phenomenonType),
|
||||
),
|
||||
@@ -83,7 +83,7 @@ func NextGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomeno
|
||||
func ClosestGalileanPhenomenonContactEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonContactEvent {
|
||||
return galileanPhenomenonContactEventFromBasic(
|
||||
basic.ClosestJupiterGalileanPhenomenonContactEvent(
|
||||
basic.Date2JDE(date.UTC()),
|
||||
basic.Date2JD(date.UTC()),
|
||||
satellite,
|
||||
basic.JupiterGalileanPhenomenonType(phenomenonType),
|
||||
),
|
||||
@@ -95,7 +95,7 @@ func galileanPhenomenonContactEventFromBasic(event basic.JupiterGalileanPhenomen
|
||||
if !event.Valid {
|
||||
return GalileanPhenomenonContactEvent{}
|
||||
}
|
||||
greatest := basic.JDE2DateByZone(event.Greatest, loc, false)
|
||||
greatest := basic.JD2DateByZone(event.Greatest, loc, false)
|
||||
return GalileanPhenomenonContactEvent{
|
||||
Valid: true,
|
||||
Satellite: event.Satellite,
|
||||
@@ -111,9 +111,9 @@ func galileanPhenomenonContactFromBasic(contact basic.JupiterGalileanPhenomenonC
|
||||
if !contact.Valid {
|
||||
return GalileanPhenomenonContact{}
|
||||
}
|
||||
start := basic.JDE2DateByZone(contact.Start, loc, false)
|
||||
modelCrossing := basic.JDE2DateByZone(contact.ModelCrossing, loc, false)
|
||||
end := basic.JDE2DateByZone(contact.End, loc, false)
|
||||
start := basic.JD2DateByZone(contact.Start, loc, false)
|
||||
modelCrossing := basic.JD2DateByZone(contact.ModelCrossing, loc, false)
|
||||
end := basic.JD2DateByZone(contact.End, loc, false)
|
||||
return GalileanPhenomenonContact{
|
||||
Valid: true,
|
||||
Phase: GalileanPhenomenonContactPhase(contact.Phase),
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestGalileanPhenomenonContactEventWrappersMatchBasic(t *testing.T) {
|
||||
|
||||
got := ClosestGalileanPhenomenonContactEvent(queryMid, record.Satellite, phenomenonType)
|
||||
want := basic.ClosestJupiterGalileanPhenomenonContactEvent(
|
||||
basic.Date2JDE(queryMid.UTC()),
|
||||
basic.Date2JD(queryMid.UTC()),
|
||||
record.Satellite,
|
||||
basic.JupiterGalileanPhenomenonType(phenomenonType),
|
||||
)
|
||||
@@ -43,7 +43,7 @@ func assertGalileanContactWrapperMatchesBasic(
|
||||
if got.Greatest.Location() != loc {
|
||||
t.Fatalf("%s greatest timezone mismatch", name)
|
||||
}
|
||||
wantGreatest := basic.JDE2DateByZone(want.Greatest, loc, false)
|
||||
wantGreatest := basic.JD2DateByZone(want.Greatest, loc, false)
|
||||
if !got.Greatest.Equal(wantGreatest) {
|
||||
t.Fatalf("%s greatest mismatch: got %s want %s", name, got.Greatest.Format(time.RFC3339Nano), wantGreatest.Format(time.RFC3339Nano))
|
||||
}
|
||||
@@ -69,9 +69,9 @@ func assertGalileanContactMatchesBasic(
|
||||
if !got.Valid {
|
||||
return
|
||||
}
|
||||
wantStart := basic.JDE2DateByZone(want.Start, loc, false)
|
||||
wantModel := basic.JDE2DateByZone(want.ModelCrossing, loc, false)
|
||||
wantEnd := basic.JDE2DateByZone(want.End, loc, false)
|
||||
wantStart := basic.JD2DateByZone(want.Start, loc, false)
|
||||
wantModel := basic.JD2DateByZone(want.ModelCrossing, loc, false)
|
||||
wantEnd := basic.JD2DateByZone(want.End, loc, false)
|
||||
if got.Start.Location() != loc || got.ModelCrossing.Location() != loc || got.End.Location() != loc {
|
||||
t.Fatalf("%s timezone mismatch", name)
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ type GalileanPhenomenonEvent struct {
|
||||
func LastGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonEvent {
|
||||
return galileanPhenomenonEventFromBasic(
|
||||
basic.LastJupiterGalileanPhenomenonEvent(
|
||||
basic.Date2JDE(date.UTC()),
|
||||
basic.Date2JD(date.UTC()),
|
||||
satellite,
|
||||
basic.JupiterGalileanPhenomenonType(phenomenonType),
|
||||
),
|
||||
@@ -75,7 +75,7 @@ func LastGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType G
|
||||
func NextGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonEvent {
|
||||
return galileanPhenomenonEventFromBasic(
|
||||
basic.NextJupiterGalileanPhenomenonEvent(
|
||||
basic.Date2JDE(date.UTC()),
|
||||
basic.Date2JD(date.UTC()),
|
||||
satellite,
|
||||
basic.JupiterGalileanPhenomenonType(phenomenonType),
|
||||
),
|
||||
@@ -87,7 +87,7 @@ func NextGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType G
|
||||
func ClosestGalileanPhenomenonEvent(date time.Time, satellite int, phenomenonType GalileanPhenomenonType) GalileanPhenomenonEvent {
|
||||
return galileanPhenomenonEventFromBasic(
|
||||
basic.ClosestJupiterGalileanPhenomenonEvent(
|
||||
basic.Date2JDE(date.UTC()),
|
||||
basic.Date2JD(date.UTC()),
|
||||
satellite,
|
||||
basic.JupiterGalileanPhenomenonType(phenomenonType),
|
||||
),
|
||||
@@ -99,9 +99,9 @@ func galileanPhenomenonEventFromBasic(event basic.JupiterGalileanPhenomenonEvent
|
||||
if !event.Valid {
|
||||
return GalileanPhenomenonEvent{}
|
||||
}
|
||||
start := basic.JDE2DateByZone(event.Start, loc, false)
|
||||
greatest := basic.JDE2DateByZone(event.Greatest, loc, false)
|
||||
end := basic.JDE2DateByZone(event.End, loc, false)
|
||||
start := basic.JD2DateByZone(event.Start, loc, false)
|
||||
greatest := basic.JD2DateByZone(event.Greatest, loc, false)
|
||||
end := basic.JD2DateByZone(event.End, loc, false)
|
||||
return GalileanPhenomenonEvent{
|
||||
Valid: true,
|
||||
Satellite: event.Satellite,
|
||||
|
||||
@@ -35,21 +35,21 @@ func TestGalileanPhenomenonEventWrappersMatchBasic(t *testing.T) {
|
||||
t,
|
||||
record.Label+" next",
|
||||
NextGalileanPhenomenonEvent(queryBefore, record.Satellite, phenomenonType),
|
||||
basic.NextJupiterGalileanPhenomenonEvent(basic.Date2JDE(queryBefore.UTC()), record.Satellite, basic.JupiterGalileanPhenomenonType(phenomenonType)),
|
||||
basic.NextJupiterGalileanPhenomenonEvent(basic.Date2JD(queryBefore.UTC()), record.Satellite, basic.JupiterGalileanPhenomenonType(phenomenonType)),
|
||||
loc,
|
||||
)
|
||||
assertGalileanWrapperMatchesBasic(
|
||||
t,
|
||||
record.Label+" last",
|
||||
LastGalileanPhenomenonEvent(queryAfter, record.Satellite, phenomenonType),
|
||||
basic.LastJupiterGalileanPhenomenonEvent(basic.Date2JDE(queryAfter.UTC()), record.Satellite, basic.JupiterGalileanPhenomenonType(phenomenonType)),
|
||||
basic.LastJupiterGalileanPhenomenonEvent(basic.Date2JD(queryAfter.UTC()), record.Satellite, basic.JupiterGalileanPhenomenonType(phenomenonType)),
|
||||
loc,
|
||||
)
|
||||
assertGalileanWrapperMatchesBasic(
|
||||
t,
|
||||
record.Label+" closest",
|
||||
ClosestGalileanPhenomenonEvent(queryMid, record.Satellite, phenomenonType),
|
||||
basic.ClosestJupiterGalileanPhenomenonEvent(basic.Date2JDE(queryMid.UTC()), record.Satellite, basic.JupiterGalileanPhenomenonType(phenomenonType)),
|
||||
basic.ClosestJupiterGalileanPhenomenonEvent(basic.Date2JD(queryMid.UTC()), record.Satellite, basic.JupiterGalileanPhenomenonType(phenomenonType)),
|
||||
loc,
|
||||
)
|
||||
}
|
||||
@@ -72,9 +72,9 @@ func assertGalileanWrapperMatchesBasic(
|
||||
if got.Start.Location() != loc || got.Greatest.Location() != loc || got.End.Location() != loc {
|
||||
t.Fatalf("%s timezone mismatch", name)
|
||||
}
|
||||
wantStart := basic.JDE2DateByZone(want.Start, loc, false)
|
||||
wantGreatest := basic.JDE2DateByZone(want.Greatest, loc, false)
|
||||
wantEnd := basic.JDE2DateByZone(want.End, loc, false)
|
||||
wantStart := basic.JD2DateByZone(want.Start, loc, false)
|
||||
wantGreatest := basic.JD2DateByZone(want.Greatest, loc, false)
|
||||
wantEnd := basic.JD2DateByZone(want.End, loc, false)
|
||||
if !got.Start.Equal(wantStart) || !got.Greatest.Equal(wantGreatest) || !got.End.Equal(wantEnd) {
|
||||
t.Fatalf(
|
||||
"%s time mismatch: got [%s %s %s] want [%s %s %s]",
|
||||
|
||||
@@ -116,7 +116,7 @@ func TestGalileanPhenomenaUseTTFrame(t *testing.T) {
|
||||
time.Date(2026, 4, 2, 20, 0, 0, 0, time.UTC),
|
||||
}
|
||||
for _, date := range dates {
|
||||
want := basic.JupiterGalileanSatellitePhenomena(basic.TD2UT(basic.Date2JDE(date.UTC()), true))
|
||||
want := basic.JupiterGalileanSatellitePhenomena(basic.UTC2TT(basic.Date2JD(date.UTC())))
|
||||
got := SatellitePhenomena(date)
|
||||
phenomena := []GalileanSatellitePhenomenon{got.Io, got.Europa, got.Ganymede, got.Callisto}
|
||||
for i, phenomenon := range phenomena {
|
||||
|
||||
+7
-7
@@ -47,11 +47,11 @@ func Physical(date time.Time) PhysicalInfo {
|
||||
|
||||
// PhysicalN 木星物理观测参数(截断版) / truncated physical observing parameters of Jupiter.
|
||||
func PhysicalN(date time.Time, n int) PhysicalInfo {
|
||||
jde := basic.Date2JDE(date.UTC())
|
||||
jd := basic.TD2UT(jde, true)
|
||||
info := basic.JupiterPhysicalN(jd, n)
|
||||
meridians := basic.JupiterCentralMeridiansN(jd, n)
|
||||
ds, de := basic.JupiterDSDEN(jd, n)
|
||||
jd := basic.Date2JD(date.UTC())
|
||||
jde := basic.UTC2TT(jd)
|
||||
info := basic.JupiterPhysicalN(jde, n)
|
||||
meridians := basic.JupiterCentralMeridiansN(jde, n)
|
||||
ds, de := basic.JupiterDSDEN(jde, n)
|
||||
return PhysicalInfo{
|
||||
SubEarthLongitude: info.SubEarthLongitude,
|
||||
SubEarthLatitude: info.SubEarthLatitude,
|
||||
@@ -73,8 +73,8 @@ func CentralMeridians(date time.Time) CentralMeridianInfo {
|
||||
|
||||
// CentralMeridiansN 木星 System I/II/III 中央经线(截断版) / truncated Jupiter System I/II/III central meridians.
|
||||
func CentralMeridiansN(date time.Time, n int) CentralMeridianInfo {
|
||||
jde := basic.Date2JDE(date.UTC())
|
||||
info := basic.JupiterCentralMeridiansN(basic.TD2UT(jde, true), n)
|
||||
jd := basic.Date2JD(date.UTC())
|
||||
info := basic.JupiterCentralMeridiansN(basic.UTC2TT(jd), n)
|
||||
return CentralMeridianInfo{
|
||||
SystemI: info.SystemI,
|
||||
SystemII: info.SystemII,
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
|
||||
func TestPhysicalWrapperMatchesBasic(t *testing.T) {
|
||||
date := time.Date(2026, 4, 28, 9, 30, 45, 0, time.UTC)
|
||||
jde := basic.Date2JDE(date.UTC())
|
||||
jde := basic.Date2JD(date.UTC())
|
||||
|
||||
got := Physical(date)
|
||||
gotN := PhysicalN(date, -1)
|
||||
want := basic.JupiterPhysicalN(basic.TD2UT(jde, true), -1)
|
||||
wantMeridians := basic.JupiterCentralMeridiansN(basic.TD2UT(jde, true), -1)
|
||||
want := basic.JupiterPhysicalN(basic.UTC2TT(jde), -1)
|
||||
wantMeridians := basic.JupiterCentralMeridiansN(basic.UTC2TT(jde), -1)
|
||||
gotMeridians := CentralMeridians(date)
|
||||
gotMeridiansN := CentralMeridiansN(date, -1)
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestPhysicalWrapperMatchesBasic(t *testing.T) {
|
||||
assertSamePhysicalFloat(t, "SubSolarLongitude", got.SubSolarLongitude, want.SubSolarLongitude)
|
||||
assertSamePhysicalFloat(t, "SubSolarLatitude", got.SubSolarLatitude, want.SubSolarLatitude)
|
||||
assertSamePhysicalFloat(t, "NorthPolePositionAngle", got.NorthPolePositionAngle, want.NorthPolePositionAngle)
|
||||
wantDS, wantDE := basic.JupiterDSDEN(basic.TD2UT(jde, true), -1)
|
||||
wantDS, wantDE := basic.JupiterDSDEN(basic.UTC2TT(jde), -1)
|
||||
assertSamePhysicalFloat(t, "DS", got.DS, wantDS)
|
||||
assertSamePhysicalFloat(t, "DE", got.DE, wantDE)
|
||||
assertSamePhysicalFloat(t, "CentralMeridianSystemI", got.CentralMeridianSystemI, wantMeridians.SystemI)
|
||||
|
||||
@@ -46,7 +46,7 @@ type GalileanSatellitesInfo struct {
|
||||
// date 表示观测绝对时刻(UTC),内部换算为该时刻对应的 TT/TDB 历元做 L1 星历求值。
|
||||
// date is the observing instant in UTC; it is converted to the corresponding TT/TDB epoch for the L1 ephemeris evaluation.
|
||||
func Satellites(date time.Time) GalileanSatellitesInfo {
|
||||
jde := basic.TD2UT(basic.Date2JDE(date.UTC()), true)
|
||||
jde := basic.UTC2TT(basic.Date2JD(date.UTC()))
|
||||
observations := basic.JupiterGalileanSatelliteObservations(jde)
|
||||
return GalileanSatellitesInfo{
|
||||
Io: galileanSatellitePositionFromBasic(observations[0]),
|
||||
|
||||
@@ -106,7 +106,7 @@ func TestGalileanSatellitesUseTTFrame(t *testing.T) {
|
||||
time.Date(2026, 4, 2, 18, 0, 0, 0, time.UTC),
|
||||
}
|
||||
for _, date := range dates {
|
||||
want := basic.JupiterGalileanSatelliteObservations(basic.TD2UT(basic.Date2JDE(date.UTC()), true))
|
||||
want := basic.JupiterGalileanSatelliteObservations(basic.UTC2TT(basic.Date2JD(date.UTC())))
|
||||
got := Satellites(date)
|
||||
positions := []GalileanSatellitePosition{got.Io, got.Europa, got.Ganymede, got.Callisto}
|
||||
for i, position := range positions {
|
||||
|
||||
+34
-40
@@ -12,58 +12,58 @@ import (
|
||||
|
||||
// ApparentLoN 视黄经(截断版) / truncated apparent ecliptic longitude.
|
||||
func ApparentLoN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentLoN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentLoN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// ApparentBoN 视黄纬(截断版) / truncated apparent ecliptic latitude.
|
||||
func ApparentBoN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentBoN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentBoN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// ApparentRaN 视赤经(截断版) / truncated apparent right ascension.
|
||||
func ApparentRaN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentRaN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentRaN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// ApparentDecN 视赤纬(截断版) / truncated apparent declination.
|
||||
func ApparentDecN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentDecN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentDecN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// ApparentRaDecN 视赤经赤纬(截断版) / truncated apparent right ascension and declination.
|
||||
func ApparentRaDecN(date time.Time, n int) (float64, float64) {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterApparentRaDecN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterApparentRaDecN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// ApparentMagnitudeN 视星等(截断版) / truncated apparent magnitude.
|
||||
func ApparentMagnitudeN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.JupiterMagN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.JupiterMagN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// EarthDistanceN 地球距离(截断版) / truncated Earth distance.
|
||||
func EarthDistanceN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return basic.EarthJupiterAwayN(basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return basic.EarthJupiterAwayN(basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// SunDistanceN 太阳距离(截断版) / truncated Sun distance.
|
||||
func SunDistanceN(date time.Time, n int) float64 {
|
||||
jde := calendar.Date2JDE(date.UTC())
|
||||
return planet.WherePlanetN(4, 2, basic.TD2UT(jde, true), n)
|
||||
jd := calendar.Date2JD(date.UTC())
|
||||
return planet.WherePlanetN(4, 2, basic.UTC2TT(jd), n)
|
||||
}
|
||||
|
||||
// AltitudeN 高度角(截断版) / truncated altitude angle.
|
||||
func AltitudeN(date time.Time, lon, lat float64, n int) float64 {
|
||||
jde := basic.Date2JDE(date)
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
return basic.JupiterHeightN(jde, lon, lat, timezone, n)
|
||||
return basic.JupiterHeightN(localJD, lon, lat, timezone, n)
|
||||
}
|
||||
|
||||
// ZenithN 天顶距(截断版) / truncated zenith distance.
|
||||
@@ -73,30 +73,28 @@ func ZenithN(date time.Time, lon, lat float64, n int) float64 {
|
||||
|
||||
// AzimuthN 方位角(截断版) / truncated azimuth angle.
|
||||
func AzimuthN(date time.Time, lon, lat float64, n int) float64 {
|
||||
jde := basic.Date2JDE(date)
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
return basic.JupiterAzimuthN(jde, lon, lat, timezone, n)
|
||||
return basic.JupiterAzimuthN(localJD, lon, lat, timezone, n)
|
||||
}
|
||||
|
||||
// HourAngleN 时角(截断版) / truncated hour angle.
|
||||
func HourAngleN(date time.Time, lon float64, n int) float64 {
|
||||
jde := basic.Date2JDE(date)
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
return basic.JupiterHourAngleN(jde, lon, timezone, n)
|
||||
return basic.JupiterHourAngleN(localJD, lon, timezone, n)
|
||||
}
|
||||
|
||||
// CulminationTimeN 中天时间(截断版) / truncated culmination time.
|
||||
func CulminationTimeN(date time.Time, lon float64, n int) time.Time {
|
||||
if date.Hour() > 12 {
|
||||
date = date.Add(time.Hour * -12)
|
||||
}
|
||||
jde := basic.Date2JDE(date)
|
||||
date = time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location())
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
calcJde := basic.JupiterCulminationTimeN(jde, lon, timezone, n) - timezone/24.0
|
||||
return basic.JDE2DateByZone(calcJde, date.Location(), false)
|
||||
calcJD := basic.JupiterCulminationTimeN(localJD, lon, timezone, n) - timezone/24.0
|
||||
return basic.JD2DateByZone(calcJD, date.Location(), false)
|
||||
}
|
||||
|
||||
// RiseTimeN 升起时间(截断版) / truncated rise time.
|
||||
@@ -105,14 +103,12 @@ func RiseTimeN(date time.Time, lon, lat, height float64, aero bool, n int) (time
|
||||
if aero {
|
||||
aeroFloat = 1
|
||||
}
|
||||
if date.Hour() > 12 {
|
||||
date = date.Add(time.Hour * -12)
|
||||
}
|
||||
jde := basic.Date2JDE(date)
|
||||
date = time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location())
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
riseJde, err := basic.JupiterRiseTimeN(jde, lon, lat, timezone, aeroFloat, height, n)
|
||||
return riseSetResult(date, riseJde, err)
|
||||
riseJD, err := basic.JupiterRiseTimeN(localJD, lon, lat, timezone, aeroFloat, height, n)
|
||||
return riseSetResult(date, riseJD, err)
|
||||
}
|
||||
|
||||
// DownTimeN 落下时间别名(截断版) / truncated down-time alias.
|
||||
@@ -126,12 +122,10 @@ func SetTimeN(date time.Time, lon, lat, height float64, aero bool, n int) (time.
|
||||
if aero {
|
||||
aeroFloat = 1
|
||||
}
|
||||
if date.Hour() > 12 {
|
||||
date = date.Add(time.Hour * -12)
|
||||
}
|
||||
jde := basic.Date2JDE(date)
|
||||
date = time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location())
|
||||
localJD := basic.Date2JD(date)
|
||||
_, loc := date.Zone()
|
||||
timezone := float64(loc) / 3600.0
|
||||
riseJde, err := basic.JupiterSetTimeN(jde, lon, lat, timezone, aeroFloat, height, n)
|
||||
return riseSetResult(date, riseJde, err)
|
||||
riseJD, err := basic.JupiterSetTimeN(localJD, lon, lat, timezone, aeroFloat, height, n)
|
||||
return riseSetResult(date, riseJD, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user