|
|
@ -2,243 +2,251 @@ package sun
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"math"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"b612.me/astro/basic"
|
|
|
|
"b612.me/astro/basic"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
|
|
|
ERR_SUN_NEVER_RISE = errors.New("ERROR:极夜,太阳在今日永远在地平线下!")
|
|
|
|
|
|
|
|
ERR_SUN_NEVER_DOWN = errors.New("ERROR:极昼,太阳在今日永远在地平线上!")
|
|
|
|
|
|
|
|
ERR_TWILIGHT_NOT_EXISTS = errors.New("ERROR:今日晨昏朦影不存在!")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
黄赤交角
|
|
|
|
太阳
|
|
|
|
jde,世界时UTC
|
|
|
|
视星等 −26.74
|
|
|
|
nutation,为true时计算交角章动
|
|
|
|
绝对星等 4.839
|
|
|
|
|
|
|
|
光谱类型 G2V
|
|
|
|
|
|
|
|
金属量 Z = 0.0122
|
|
|
|
|
|
|
|
角直径 31.6′ – 32.7′
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
func EclipticObliquity(jde float64, nutation bool) float64 {
|
|
|
|
|
|
|
|
|
|
|
|
// RiseTime 太阳升起时间
|
|
|
|
|
|
|
|
// date,取日期,时区忽略
|
|
|
|
|
|
|
|
// lon,经度,东正西负
|
|
|
|
|
|
|
|
// lat,纬度,北正南负
|
|
|
|
|
|
|
|
// timezone,时区,东正西负
|
|
|
|
|
|
|
|
// aero,true时进行大气修正
|
|
|
|
|
|
|
|
func RiseTime(date time.Time, lon, lat, timezone float64, aero bool) (time.Time, error) {
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
var aeroFloat float64
|
|
|
|
|
|
|
|
if aero {
|
|
|
|
|
|
|
|
aeroFloat = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
|
|
|
|
riseJde := basic.GetSunRiseTime(jde, lon, lat, timezone, aeroFloat)
|
|
|
|
|
|
|
|
if riseJde == -2 {
|
|
|
|
|
|
|
|
err = ERR_SUN_NEVER_RISE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if riseJde == -1 {
|
|
|
|
|
|
|
|
err = ERR_SUN_NEVER_DOWN
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return basic.JDE2Date(riseJde), err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SunDownTime 太阳落下时间
|
|
|
|
|
|
|
|
// date,取日期,时区忽略
|
|
|
|
|
|
|
|
// lon,经度,东正西负
|
|
|
|
|
|
|
|
// lat,纬度,北正南负
|
|
|
|
|
|
|
|
// timezone,时区,东正西负
|
|
|
|
|
|
|
|
// aero,true时进行大气修正
|
|
|
|
|
|
|
|
func DownTime(date time.Time, lon, lat, timezone float64, aero bool) (time.Time, error) {
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
var aeroFloat float64
|
|
|
|
|
|
|
|
if aero {
|
|
|
|
|
|
|
|
aeroFloat = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
|
|
|
|
downJde := basic.GetSunDownTime(jde, lon, lat, timezone, aeroFloat)
|
|
|
|
|
|
|
|
if downJde == -2 {
|
|
|
|
|
|
|
|
err = ERR_SUN_NEVER_RISE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if downJde == -1 {
|
|
|
|
|
|
|
|
err = ERR_SUN_NEVER_DOWN
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return basic.JDE2Date(downJde), err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MorningTwilight 晨朦影
|
|
|
|
|
|
|
|
// date,取日期,时区忽略
|
|
|
|
|
|
|
|
// lon,经度,东正西负
|
|
|
|
|
|
|
|
// lat,纬度,北正南负
|
|
|
|
|
|
|
|
// timezone,时区,东正西负
|
|
|
|
|
|
|
|
// angle,朦影角度:可选-6 -12 -18(民用、航海、天文)
|
|
|
|
|
|
|
|
func MorningTwilight(date time.Time, lon, lat, timezone, angle float64) (time.Time, error) {
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
|
|
|
|
calcJde := basic.GetAsaTime(jde, lon, lat, timezone, angle)
|
|
|
|
|
|
|
|
if calcJde == -2 {
|
|
|
|
|
|
|
|
err = ERR_TWILIGHT_NOT_EXISTS
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if calcJde == -1 {
|
|
|
|
|
|
|
|
err = ERR_TWILIGHT_NOT_EXISTS
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return basic.JDE2Date(calcJde), err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EveningTwilight 昏朦影
|
|
|
|
|
|
|
|
// date,取日期,时区忽略
|
|
|
|
|
|
|
|
// lon,经度,东正西负
|
|
|
|
|
|
|
|
// lat,纬度,北正南负
|
|
|
|
|
|
|
|
// timezone,时区,东正西负
|
|
|
|
|
|
|
|
// angle,朦影角度:可选-6 -12 -18(民用、航海、天文)
|
|
|
|
|
|
|
|
func EveningTwilight(date time.Time, lon, lat, timezone, angle float64) (time.Time, error) {
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
|
|
|
|
//不需要进行力学时转换,会在GetBanTime中转换
|
|
|
|
|
|
|
|
calcJde := basic.GetBanTime(jde, lon, lat, timezone, angle)
|
|
|
|
|
|
|
|
if calcJde == -2 {
|
|
|
|
|
|
|
|
err = ERR_TWILIGHT_NOT_EXISTS
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if calcJde == -1 {
|
|
|
|
|
|
|
|
err = ERR_TWILIGHT_NOT_EXISTS
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return basic.JDE2Date(calcJde), err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EclipticObliquity 黄赤交角
|
|
|
|
|
|
|
|
// 返回date对应UTC世界时的黄赤交角,nutation为true时,计算交角章动
|
|
|
|
|
|
|
|
func EclipticObliquity(date time.Time, nutation bool) float64 {
|
|
|
|
|
|
|
|
//转换为UTC时间
|
|
|
|
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
|
|
|
|
//进行力学时转换
|
|
|
|
jde = basic.TD2UT(jde, true)
|
|
|
|
jde = basic.TD2UT(jde, true)
|
|
|
|
|
|
|
|
//黄赤交角计算
|
|
|
|
return basic.EclipticObliquity(jde, nutation)
|
|
|
|
return basic.EclipticObliquity(jde, nutation)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// EclipticNutation 黄经章动
|
|
|
|
黄经章动
|
|
|
|
// 返回date对应UTC世界时的黄经章动
|
|
|
|
jde,世界时UTC
|
|
|
|
func EclipticNutation(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func EclipticNutation(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
|
|
|
|
//进行力学时转换与章动计算
|
|
|
|
return basic.HJZD(basic.TD2UT(jde, true))
|
|
|
|
return basic.HJZD(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// AxialtiltNutation 交角章动
|
|
|
|
交角章动
|
|
|
|
// 返回date对应UTC世界时的交角章动
|
|
|
|
jde,世界时UTC
|
|
|
|
func AxialtiltNutation(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func AxialtiltNutation(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
|
|
|
|
//进行力学时转换与章动计算
|
|
|
|
return basic.JJZD(basic.TD2UT(jde, true))
|
|
|
|
return basic.JJZD(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// GeometricLo 太阳几何黄经
|
|
|
|
太阳几何黄经
|
|
|
|
// 返回date对应UTC世界时的太阳几何黄经
|
|
|
|
jde,世界时UTC
|
|
|
|
func GeometricLo(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func GeometricLo(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
return basic.SunLo(basic.TD2UT(jde, true))
|
|
|
|
return basic.SunLo(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// TrueLo 太阳真黄经
|
|
|
|
太阳真黄经
|
|
|
|
// 返回date对应UTC世界时的太阳真黄经
|
|
|
|
jde,世界时UTC
|
|
|
|
func TrueLo(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func TrueLo(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
return basic.HSunTrueLo(basic.TD2UT(jde, true))
|
|
|
|
return basic.HSunTrueLo(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// TrueBo 太阳真黄纬
|
|
|
|
太阳视黄经
|
|
|
|
// 返回date对应UTC世界时的太阳真黄纬
|
|
|
|
jde,世界时UTC
|
|
|
|
func TrueBo(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func SeeLo(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
|
|
|
|
return basic.HSunTrueLo(basic.TD2UT(jde, true))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SeeLo 太阳视黄经
|
|
|
|
|
|
|
|
// 返回date对应UTC世界时的太阳视黄经
|
|
|
|
|
|
|
|
func SeeLo(date time.Time) float64 {
|
|
|
|
|
|
|
|
//转换为UTC时间
|
|
|
|
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
return basic.HSunSeeLo(basic.TD2UT(jde, true))
|
|
|
|
return basic.HSunSeeLo(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// SeeRa 太阳地心视赤经
|
|
|
|
太阳视赤经
|
|
|
|
// 返回date对应UTC世界时的太阳视赤经(使用黄道坐标转换,且默认忽略黄纬)
|
|
|
|
jde,世界时UTC
|
|
|
|
func SeeRa(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func SeeRa(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
return basic.HSunSeeRa(basic.TD2UT(jde, true))
|
|
|
|
return basic.HSunSeeRa(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// SeeDec 太阳地心视赤纬
|
|
|
|
太阳视赤纬
|
|
|
|
// 返回date对应UTC世界时的太阳视赤纬(使用黄道坐标转换,且默认忽略黄纬)
|
|
|
|
jde,世界时UTC
|
|
|
|
func SeeDec(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func SeeDec(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
return basic.HSunSeeDec(basic.TD2UT(jde, true))
|
|
|
|
return basic.HSunSeeDec(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// SeeRaDec 太阳地心视赤经和赤纬
|
|
|
|
太阳视赤经赤纬
|
|
|
|
// 返回date对应UTC世界时的太阳视赤纬(使用黄道坐标转换,且默认忽略黄纬)
|
|
|
|
jde,世界时UTC
|
|
|
|
func SeeRaDec(date time.Time) (float64, float64) {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func SeeRaDec(jde float64) (float64, float64) {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
return basic.HSunSeeRaDec(basic.TD2UT(jde, true))
|
|
|
|
return basic.HSunSeeRaDec(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// MidFunc 太阳中间方程
|
|
|
|
太阳真赤经
|
|
|
|
func MidFunc(date time.Time) float64 {
|
|
|
|
jde,世界时UTC
|
|
|
|
//转换为UTC时间
|
|
|
|
*/
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
func TrueRa(jde float64) float64 {
|
|
|
|
|
|
|
|
return basic.HSunTrueRa(basic.TD2UT(jde, true))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
太阳真赤纬
|
|
|
|
|
|
|
|
jde,世界时UTC
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func TrueDec(jde float64) float64 {
|
|
|
|
|
|
|
|
return basic.HSunTrueDec(basic.TD2UT(jde, true))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
太阳中间方程
|
|
|
|
|
|
|
|
jde,世界时UTC
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func MidFunc(jde float64) float64 {
|
|
|
|
|
|
|
|
return basic.SunMidFun(basic.TD2UT(jde, true))
|
|
|
|
return basic.SunMidFun(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// EquationTime 均时差
|
|
|
|
均时差
|
|
|
|
// 返回date对应UTC世界时的均时差
|
|
|
|
jde,世界时UTC
|
|
|
|
func EquationTime(date time.Time) float64 {
|
|
|
|
*/
|
|
|
|
//转换为UTC时间
|
|
|
|
func EquationTime(jde float64) float64 {
|
|
|
|
jde := basic.Date2JDE(date.UTC())
|
|
|
|
return basic.SunTime(basic.TD2UT(jde, true))
|
|
|
|
return basic.SunTime(basic.TD2UT(jde, true))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// HourAngle 太阳时角
|
|
|
|
太阳时角
|
|
|
|
// 返回给定经纬度、对应timezone时区date时刻的太阳时角(注意,date本身的时区将默认舍去)
|
|
|
|
jde,世界时当地时间
|
|
|
|
func HourAngle(date time.Time, lon, lat, timezone float64) float64 {
|
|
|
|
lon,经度,东正西负
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
lat,纬度,北正南负
|
|
|
|
|
|
|
|
timezone,时区,东正西负
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func HourAngle(jde, lon, lat, timezone float64) float64 {
|
|
|
|
|
|
|
|
return basic.SunTimeAngle(jde, lon, lat, timezone)
|
|
|
|
return basic.SunTimeAngle(jde, lon, lat, timezone)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// Azimuth 太阳方位角
|
|
|
|
太阳方位角
|
|
|
|
// 返回给定经纬度、对应timezone时区date时刻的太阳方位角(正北为0,向东增加)
|
|
|
|
jde,世界时当地时间
|
|
|
|
//(注意,date本身的时区将默认舍去)
|
|
|
|
lon,经度,东正西负
|
|
|
|
func Azimuth(date time.Time, lon, lat, timezone float64) float64 {
|
|
|
|
lat,纬度,北正南负
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
timezone,时区,东正西负
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func Azimuth(jde, lon, lat, timezone float64) float64 {
|
|
|
|
|
|
|
|
return basic.SunAngle(jde, lon, lat, timezone)
|
|
|
|
return basic.SunAngle(jde, lon, lat, timezone)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// Zenith 太阳高度角
|
|
|
|
太阳高度角
|
|
|
|
// 返回给定经纬度、对应timezone时区date时刻的太阳高度角
|
|
|
|
jde,世界时当地时间
|
|
|
|
//(注意,date本身的时区将默认舍去)
|
|
|
|
lon,经度,东正西负
|
|
|
|
func Zenith(date time.Time, lon, lat, timezone float64) float64 {
|
|
|
|
lat,纬度,北正南负
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
timezone,时区,东正西负
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func Zenith(jde, lon, lat, timezone float64) float64 {
|
|
|
|
|
|
|
|
return basic.SunHeight(jde, lon, lat, timezone)
|
|
|
|
return basic.SunHeight(jde, lon, lat, timezone)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// CulminationTime 太阳中天时间
|
|
|
|
太阳中天时间
|
|
|
|
// 返回给定经纬度、对应timezone时区date时刻的太阳中天日期
|
|
|
|
jde,世界时当地0时
|
|
|
|
//(注意,date本身的时区将默认舍去,返回的时间时区应当为传入的timezone)
|
|
|
|
lon,经度,东正西负
|
|
|
|
func CulminationTime(date time.Time, lon, timezone float64) time.Time {
|
|
|
|
timezone,时区,东正西负
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
*/
|
|
|
|
if jde-math.Floor(jde) > 0.5 {
|
|
|
|
func CulminationTime(jde, lon, timezone float64) float64 {
|
|
|
|
jde++
|
|
|
|
return basic.GetSunTZTime(jde, lon, timezone)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
太阳升起时间
|
|
|
|
|
|
|
|
jde,世界时当地0时 JDE
|
|
|
|
|
|
|
|
lon,经度,东正西负
|
|
|
|
|
|
|
|
lat,纬度,北正南负
|
|
|
|
|
|
|
|
timezone,时区,东正西负
|
|
|
|
|
|
|
|
aero,true时进行大气修正
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func RiseTime(jde, lon, lat, timezone float64, aero bool) (float64, error) {
|
|
|
|
|
|
|
|
var err error = nil
|
|
|
|
|
|
|
|
tz := 0.00
|
|
|
|
|
|
|
|
if aero {
|
|
|
|
|
|
|
|
tz = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tm := basic.GetSunRiseTime(jde, lon, lat, timezone, tz)
|
|
|
|
|
|
|
|
if tm == -2 {
|
|
|
|
|
|
|
|
err = errors.New("极夜")
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if tm == -1 {
|
|
|
|
calcJde := basic.GetSunTZTime(jde, lon, timezone)
|
|
|
|
err = errors.New("极昼")
|
|
|
|
return basic.JDE2Date(calcJde)
|
|
|
|
}
|
|
|
|
|
|
|
|
return tm, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
太阳落下时间
|
|
|
|
|
|
|
|
jde,世界时当地0时 JDE
|
|
|
|
|
|
|
|
lon,经度,东正西负
|
|
|
|
|
|
|
|
lat,纬度,北正南负
|
|
|
|
|
|
|
|
timezone,时区,东正西负
|
|
|
|
|
|
|
|
aero,true时进行大气修正
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func DownTime(jde, lon, lat, timezone float64, aero bool) (float64, error) {
|
|
|
|
|
|
|
|
var err error = nil
|
|
|
|
|
|
|
|
tz := 0.00
|
|
|
|
|
|
|
|
if aero {
|
|
|
|
|
|
|
|
tz = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tm := basic.GetSunDownTime(jde, lon, lat, timezone, tz)
|
|
|
|
|
|
|
|
if tm == -2 {
|
|
|
|
|
|
|
|
err = errors.New("极夜")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if tm == -1 {
|
|
|
|
|
|
|
|
err = errors.New("极昼")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return tm, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
晨朦影
|
|
|
|
|
|
|
|
jde,世界时当地0时 JDE
|
|
|
|
|
|
|
|
lon,经度,东正西负
|
|
|
|
|
|
|
|
lat,纬度,北正南负
|
|
|
|
|
|
|
|
timezone,时区,东正西负
|
|
|
|
|
|
|
|
angle,朦影角度:可选-6 -12 -18
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func MorningTwilightTime(jde, lon, lat, timezone, angle float64) (float64, error) {
|
|
|
|
|
|
|
|
var err error = nil
|
|
|
|
|
|
|
|
tm := basic.GetAsaTime(jde, lon, lat, timezone, angle)
|
|
|
|
|
|
|
|
if tm == -2 {
|
|
|
|
|
|
|
|
err = errors.New("不存在")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if tm == -1 {
|
|
|
|
|
|
|
|
err = errors.New("不存在")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return tm, err
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// EarthDistance 日地距离
|
|
|
|
昏朦影
|
|
|
|
// 返回date对应UTC世界时日地距离
|
|
|
|
jde,世界时当地0时 JDE
|
|
|
|
func EarthDistance(date time.Time) float64 {
|
|
|
|
lon,经度,东正西负
|
|
|
|
jde := basic.Date2JDE(date)
|
|
|
|
lat,纬度,北正南负
|
|
|
|
jde = basic.TD2UT(jde, true)
|
|
|
|
timezone,时区,东正西负
|
|
|
|
return basic.EarthAway(jde)
|
|
|
|
angle,朦影角度:可选-6 -12 -18
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func EveningTwilightTime(jde, lon, lat, timezone, angle float64) (float64, error) {
|
|
|
|
|
|
|
|
var err error = nil
|
|
|
|
|
|
|
|
tm := basic.GetBanTime(jde, lon, lat, timezone, angle)
|
|
|
|
|
|
|
|
if tm == -2 {
|
|
|
|
|
|
|
|
err = errors.New("不存在")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if tm == -1 {
|
|
|
|
|
|
|
|
err = errors.New("不存在")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return tm, err
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|