You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
astro/moon/moon.go

210 lines
3.8 KiB
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package moon
import (
"errors"
"b612.me/astro/basic"
)
/*
月亮真黄经
jde世界时UTC
*/
func TrueLo(jde float64) float64 {
return basic.HMoonTrueLo(basic.TD2UT(jde, true))
}
/*
月亮视黄经
jde世界时UTC
*/
func SeeLo(jde float64) float64 {
return basic.HMoonSeeLo(basic.TD2UT(jde, true))
}
/*
月亮视赤经
jde世界时UTC
lon, 经度
lat, 纬度
timezone, 时区
返回站心坐标
*/
func SeeRa(jde, lon, lat, timezone float64) float64 {
return basic.HMoonSeeRa(basic.TD2UT(jde, true), lon, lat, timezone)
}
/*
月亮视赤纬
jde世界时UTC
lon, 经度
lat, 纬度
timezone, 时区
返回站心坐标
*/
func SeeDec(jde, lon, lat, timezone float64) float64 {
return basic.HMoonSeeDec(basic.TD2UT(jde, true), lon, lat, timezone)
}
/*
月亮视赤经赤纬
jde世界时UTC
lon, 经度
lat, 纬度
timezone, 时区
返回站心坐标
*/
func SeeRaDec(jde, lon, lat, timezone float64) (float64, float64) {
return basic.HMoonSeeRaDec(basic.TD2UT(jde, true), lon, lat, timezone)
}
/*
月亮真赤经
jde世界时UTC
*/
func TrueRa(jde float64) float64 {
return basic.HMoonTrueRa(basic.TD2UT(jde, true))
}
/*
月亮真赤纬
jde世界时UTC
*/
func TrueDec(jde float64) float64 {
return basic.HMoonTrueDec(basic.TD2UT(jde, true))
}
/*
月亮时角
jde世界时当地时间
lon经度东正西负
lat纬度北正南负
timezone时区东正西负
*/
func HourAngle(jde, lon, lat, timezone float64) float64 {
return basic.MoonTimeAngle(jde, lon, lat, timezone)
}
/*
月亮方位角
jde世界时当地时间
lon经度东正西负
lat纬度北正南负
timezone时区东正西负
*/
func Azimuth(jde, lon, lat, timezone float64) float64 {
return basic.HMoonAngle(jde, lon, lat, timezone)
}
/*
月亮高度角
jde世界时当地时间
lon经度东正西负
lat纬度北正南负
timezone时区东正西负
*/
func Zenith(jde, lon, lat, timezone float64) float64 {
return basic.HMoonHeight(jde, lon, lat, timezone)
}
/*
月亮中天时间
jde世界时当地0时
lon经度东正西负
lat纬度北正南负
timezone时区东正西负
*/
func CulminationTime(jde, lon, lat, timezone float64) float64 {
return basic.GetMoonTZTime(jde, lon, lat, timezone)
}
/*
月亮升起时间
jde世界时当地0时 JDE
lon经度东正西负
lat纬度北正南负
timezone时区东正西负
aerotrue时进行大气修正
*/
func RiseTime(jde, lon, lat, timezone float64, aero bool) (float64, error) {
var err error = nil
tz := 0.00
if aero {
tz = 1
}
tm := basic.GetMoonRiseTime(jde, lon, lat, timezone, tz)
if tm == -3 {
err = errors.New("非今日")
}
if tm == -2 {
err = errors.New("极夜")
}
if tm == -1 {
err = errors.New("极昼")
}
return tm, err
}
/*
月亮落下时间
jde世界时当地0时 JDE
lon经度东正西负
lat纬度北正南负
timezone时区东正西负
aerotrue时进行大气修正
*/
func DownTime(jde, lon, lat, timezone float64, aero bool) (float64, error) {
var err error = nil
tz := 0.00
if aero {
tz = 1
}
tm := basic.GetMoonDownTime(jde, lon, lat, timezone, tz)
if tm == -3 {
err = errors.New("非今日")
}
if tm == -2 {
err = errors.New("极夜")
}
if tm == -1 {
err = errors.New("极昼")
}
return tm, err
}
/*
月相
jde世界时UTC JDE
*/
func Phase(jde float64) float64 {
return basic.MoonLight(basic.TD2UT(jde, true))
}
/*
朔月
*/
func ShuoYue(year float64) float64 {
return basic.CalcMoonSH(year, 0)
}
/*
望月
*/
func WangYue(year float64) float64 {
return basic.CalcMoonSH(year, 1)
}
/*
上弦月
*/
func ShangXianYue(year float64) float64 {
return basic.CalcMoonXH(year, 0)
}
/*
下弦月
*/
func XiaXianYue(year float64) float64 {
return basic.CalcMoonXH(year, 1)
}