suncalc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: GPL-3.0, BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const J0 = 0.0009

calculations for sun times

View Source
const J1970 = 2440588
View Source
const J2000 = 2451545

Variables

This section is empty.

Functions

func GetTimes

func GetTimes(date time.Time, lat float64, lng float64) map[DayTimeName]DayTime

calculates sun times for a given date and latitude/longitude

func IsNight

func IsNight(sunrisePos SunPosition) bool

Types

type DayTime

type DayTime struct {
	MorningName DayTimeName
	Time        time.Time
}

type DayTimeName

type DayTimeName string
const (
	Sunrise DayTimeName = "sunrise" // sunrise (top edge of the sun appears on the horizon)
	Sunset  DayTimeName = "sunset"  // sunset (sun disappears below the horizon, evening civil twilight starts)

	SunriseEnd  DayTimeName = "sunriseEnd"  // sunrise ends (bottom edge of the sun touches the horizon)
	SunsetStart DayTimeName = "sunsetStart" // sunset starts (bottom edge of the sun touches the horizon)

	Dawn DayTimeName = "dawn" // dawn (morning nautical twilight ends, morning civil twilight starts)
	Dusk DayTimeName = "dusk" // dusk (evening nautical twilight starts)

	NauticalDawn DayTimeName = "nauticalDawn" // nautical dawn (morning nautical twilight starts)
	NauticalDusk DayTimeName = "nauticalDusk" // nautical dusk (evening astronomical twilight starts)

	NightEnd DayTimeName = "nightEnd" // night ends (morning astronomical twilight starts)
	Night    DayTimeName = "night"    // night starts (dark enough for astronomical observations)

	GoldenHourEnd DayTimeName = "goldenHourEnd" // morning golden hour (soft light, best DayTime for photography) ends
	GoldenHour    DayTimeName = "goldenHour"    // evening golden hour starts

	SolarNoon DayTimeName = "solarNoon" // solar noon (sun is in the highest position)
	Nadir     DayTimeName = "nadir"     // nadir (darkest moment of the night, sun is in the lowest position)
)

type MoonIllumination

type MoonIllumination struct {
	// contains filtered or unexported fields
}

func GetMoonIllumination

func GetMoonIllumination(date time.Time) MoonIllumination

calculations for illumination parameters of the moon, based on http://idlastro.gsfc.nasa.gov/ftp/pro/astro/mphase.pro formulas and Chapter 48 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.

type MoonPosition

type MoonPosition struct {
	Azimuth          float64
	Altitude         float64
	Distance         float64
	ParallacticAngle float64
}

func GetMoonPosition

func GetMoonPosition(date time.Time, lat float64, lng float64) MoonPosition

type MoonTimes

type MoonTimes struct {
	Rise       time.Time
	Set        time.Time
	AlwaysUp   bool
	AlwaysDown bool
}

func GetMoonTimes

func GetMoonTimes(date time.Time, lat float64, lng float64, inUTC bool) MoonTimes

calculations for moon rise/set times are based on http://www.stargazing.net/kepler/moonrise.html article

type SunPosition

type SunPosition struct {
	Azimuth  float64
	Altitude float64
}

func GetSunPosition

func GetSunPosition(date time.Time, lat float64, lng float64) SunPosition

calculates sun position for a given date and latitude/longitude

Jump to

Keyboard shortcuts

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