util

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ShadowLengthToFloatMap = map[ShadowLength]float64{
	SINGLE: 1.0,
	DOUBLE: 2.0,
}

Functions

func AltitudeOfCelestialBody

func AltitudeOfCelestialBody(φ float64, δ float64, H float64) float64

AltitudeOfCelestialBody returns the altitude of the celestial body, given `φ` (the observer latitude), `δ` (the declination) and `H` (the local hour angle).

func ApparentObliquityOfTheEcliptic

func ApparentObliquityOfTheEcliptic(t float64, ε0 float64) float64

ApparentObliquityOfTheEcliptic returns the mean obliquity of the ecliptic, corrected for calculating the apparent position of the sun, in degrees, given `t` (julian century) and `ε0` (mean obliquity of the ecliptic).

func ApparentSolarLongitude

func ApparentSolarLongitude(t float64, L0 float64) float64

ApparentSolarLongitude returns apparent longitude of the Sun, referred to as the true equinox of the date, given `t`, the julian century, and `L0`, the mean longitude.

func ApproximateTransit

func ApproximateTransit(L float64, Θ0 float64, α2 float64) float64

ApproximateTransit returns the approximate transite given L (the longitude), Θ0 (the sidereal time), and α2 (the right ascension).

func AscendingLunarNodeLongitude

func AscendingLunarNodeLongitude(t float64) float64

AscendingLunarNodeLongitude returns the ascending lunar node longitude, given `t`, the julian century,

func ClosestAngle

func ClosestAngle(angle float64) float64

func CorrectedHourAngle

func CorrectedHourAngle(m0 float64, h0 float64, coordinates *Coordinates, afterTransit bool, Θ0 float64, α2 float64, α1 float64, α3 float64, δ2 float64, δ1 float64, δ3 float64) float64

CorrectedHourAngle returns the corrected hour angle given m0 (the approximate transit), h0 (the angle), coordinates (the coordinates), afterTransit(whether it's after transit), Θ0 (the sidereal time), α2 (the right ascension), α1 (the previous right ascension), α3 (the next right ascension), δ2 (the declination), δ1 (the previous declination), and δ3 (the next declination).

func CorrectedTransit

func CorrectedTransit(m0 float64, L float64, Θ0 float64, α2 float64, α1 float64, α3 float64) float64

CorrectedTransit returns the time at which the sun is at its highest point in the sky (in universal time) given m0 (approximate transit), L (the longitude), Θ0 (the sidereal time), α2 (the right ascension), α1 (the previous right ascension) and α3 (the next right ascension).

func Degrees

func Degrees(radians float64) float64

Degrees converts `radians` to the corresponding degree value.

func GetJulianCentury

func GetJulianCentury(julianDay float64) float64

GetJulianCentury returns the Julian century from epoch, given `julianDay`.

func GetJulianDay

func GetJulianDay(year int, month int, day int, hours float64) float64

GetJulianDay returns the Julian day for a given Gregorian date.

func Interpolate

func Interpolate(y2 float64, y1 float64, y3 float64, n float64) float64

Interpolate returns the interpolated value given y2 (the value), y1 (the previous value), y3 (the next value) and n (the factor).

func InterpolateAngles

func InterpolateAngles(y2 float64, y1 float64, y3 float64, n float64) float64

InterpolateAngles returns the interpolation of three angles, accounting for angle unwinding, given y2 (the value), y1 (previousValue), y3 (nextValue), and n (factor).

func MeanLunarLongitude

func MeanLunarLongitude(t float64) float64

MeanLunarLongitude returns the geometric mean longitude of the moon in degrees, given `t`, the julian century.

func MeanObliquityOfTheEcliptic

func MeanObliquityOfTheEcliptic(t float64) float64

MeanObliquityOfTheEcliptic returns the mean obliquity of the ecliptic in degrees, given `t`, the julian century.

func MeanSiderealTime

func MeanSiderealTime(t float64) float64

MeanSiderealTime returns mean sidereal time, aka the hour angle of the vernal equinox, in degrees, given `t`, the julian century.

func MeanSolarAnomaly

func MeanSolarAnomaly(t float64) float64

MeanSolarAnomaly returns the sun's equation of the center in degrees, given `t`, the julian century, and `m`, the mean anomaly.

func MeanSolarLongitude

func MeanSolarLongitude(t float64) float64

MeanSolarLongitude returns the geometric mean longitude of the sun in degrees, given `t`, the julian century.

func NormalizeWithBound

func NormalizeWithBound(value float64, max float64) float64

func NutationInLongitude

func NutationInLongitude(L0 float64, Lp float64, Ω float64) float64

NutationInLongitude returns the nutation in longitude, given `L0`, the the solar longitude, `Lp`, the lunar longitude and `Ω`, the ascending node.

func NutationInObliquity

func NutationInObliquity(L0 float64, Lp float64, Ω float64) float64

NutationInObliquity returns the nutation in obliquity, given `L0`, the the solar longitude, `Lp`, the lunar longitude and `Ω`, the ascending node.

func Radians

func Radians(degrees float64) float64

Radians converts `degrees` to the corresponding radian value.

func SolarEquationOfTheCenter

func SolarEquationOfTheCenter(t float64, m float64) float64

SolarEquationOfTheCenter returns the sun's equation of the center in degrees, given `t`, the julian century, and `m`, the mean anomaly.

func UnwindAngle

func UnwindAngle(value float64) float64

Types

type Coordinates

type Coordinates struct {
	Latitude  float64
	Longitude float64
}

func NewCoordinates

func NewCoordinates(latitude float64, longitude float64) (*Coordinates, error)

type ShadowLength

type ShadowLength int64
const (
	SINGLE ShadowLength = iota

	DOUBLE
)

type SolarCoordinates

type SolarCoordinates struct {
	// The declination of the sun, the angle between the rays of the Sun and the plane of the Earth's equator, in degrees.
	Declination float64
	// Right ascension of the Sun, the angular distance on the celestial equator from the vernal equinox to the hour circle, in degrees.
	RightAscension float64
	// Apparent sidereal time, the hour angle of the vernal equinox, in degrees.
	ApparentSiderealTime float64
}

func NewSolarCoordinates

func NewSolarCoordinates(julian_day float64) *SolarCoordinates

type SolarTime

type SolarTime struct {
	Transit float64
	Sunrise float64
	Sunset  float64

	Observer           *Coordinates
	Solar              *SolarCoordinates
	PrevSolar          *SolarCoordinates
	NextSolar          *SolarCoordinates
	ApproximateTransit float64
}

func NewSolarTime

func NewSolarTime(d *data.DateComponents, c *Coordinates) *SolarTime

func (*SolarTime) Afternoon

func (s *SolarTime) Afternoon(sl ShadowLength) float64

func (*SolarTime) HourAngle

func (s *SolarTime) HourAngle(angle float64, afterTransit bool) float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL