celestial

package
v0.0.0-...-46d2e35 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: CC0-1.0 Imports: 3 Imported by: 3

README

Package celestial

import "gitlab.com/fospathi/phyz/celestial"

Go package celestial contains utilities for finding the positions of celestial bodies.

Documentation

Index

Constants

View Source
const GregorianMeanYear = 365.2425

GregorianMeanYear is the average number of calendar days in a Gregorian calendar year in the repeating 400 year Gregorian period.

The total number of calendar days in a Gregorian repeating period is (400*365) + (400/4) - (400/100) + (400/400) = 146097. Now divide by the number of calendar years in that period (400) to get 365.2425.

View Source
const GregorianRep = 146097

GregorianRep is the smallest number of calendar days that may be added to any date in the Gregorian calendar such that the day of the week, day, and month of the resulting date will be the same as the original.

GregorianRep is the smallest natural number which can be obtained by multiplying the Gregorian mean year by any natural number, and it is also exactly divisible by 7. See https://play.golang.org/p/A93sPYHxEO9.

View Source
const JulianMeanYear = 365.25

JulianMeanYear is the average number of calendar days in a Julian calendar year in the repeating 28 year Julian period.

The total number of calendar days in a Julian repeating period is (28*365) + (28/4) = 10227. Now divide by the number of calendar years in that period (28) to get 365.25.

View Source
const JulianRep = 10227

JulianRep is the smallest number of calendar days that may be added to any date in the Julian calendar such that the day of the week, day, and month of the resulting date will be the same as the original.

JulianRep is the smallest natural number exactly divisible by seven which can be obtained by multiplying the Julian mean year by any natural number. See https://play.golang.org/p/J6nsOrY_o2W.

Variables

View Source
var J2000 = JD{JDN: JDN(2451545), Fraction: 0}

J2000 is Julian Date 2451545.0, that is Gregorian date 2000 Jan 1 at 12h (noon).

https://en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_dates_and_J2000

Functions

func DaysSinceMarch1st

func DaysSinceMarch1st(m, d int) int

DaysSinceMarch1st returns, for the given month and day, the number of days since the previous March 1st.

func YMD

func YMD(days int, precedesLeap bool) (y int, m int, d int)

YMD returns, for the date which is the argument number of days since calendar day {Y:0, M: 3, D:1}, its year (can be either 0 or 1), month (1..12), and day (1..31).

The argument number of days should not exceed 365 by more than a few days.

The argument bool value shall be true if year 1 is a leap year.

Types

type AstronomicalAngle

type AstronomicalAngle float64

AstronomicalAngle is an angle in degrees.

func (AstronomicalAngle) DMSDegrees

func (aa AstronomicalAngle) DMSDegrees() int

DMSDegrees is the degrees component of the receiver angle when expressed in the Degrees, Minutes, and Seconds format.

func (AstronomicalAngle) HMSHours

func (aa AstronomicalAngle) HMSHours() int

HMSHours is the hours component of the receiver angle when expressed in the Hours, Minutes, and Seconds format.

The returned value is a positive integer in the range 0..24.

type Degree

type Degree float64

Degree is a unit of angle measurement, 360 degrees per turn.

func (Degree) Cos

func (d Degree) Cos() float64

Cos returns the cos of the receiver angle.

func (Degree) Positive

func (d Degree) Positive() Degree

Positive returns the principle trigonometric plane equivalent to the receiver angle in the range 0..360.

func (Degree) Rads

func (d Degree) Rads() Radian

Rads expresses the receiver angle in radians.

func (Degree) Sin

func (d Degree) Sin() float64

Sin returns the sin of the receiver angle.

type EquatorialCoordinates

type EquatorialCoordinates struct {
	// The coordinate which uses the direction of the vernal equinox as its
	// positive axis.
	X float64
	// The coordinate whose positive axis is the vector cross product of the
	// Z-axis with the X-axis, in that order.
	Y float64
	// The coordinate which uses the direction of the celestial north pole as
	// its positive axis.
	Z float64
}

EquatorialCoordinates is a point in a equatorial coordinate system: https://en.wikipedia.org/wiki/Equatorial_coordinate_system.

func (EquatorialCoordinates) Declination

func (ec EquatorialCoordinates) Declination() Degree

Declination is the signed angle, measured in degrees, between the celestial equator's plane and the line segment joining the receiver position to the origin.

The north celestial pole has a declination of +90 degrees.

func (EquatorialCoordinates) RightAscension

func (ec EquatorialCoordinates) RightAscension() Degree

RightAscension (right ascension) is the signed angle, measured in degrees, between the equinox and the orthogonal projection onto the celestial equator of the line segment joining the receiver position to the origin.

type Gregorian

type Gregorian struct {
	/// The day, in the range 1..31.
	D int
	// The month, in the range 1..12.
	M int
	// The year.
	Y GregorianYear
}

A Gregorian is a specific calendar day in the proleptic Gregorian calendar.

func (Gregorian) DayAfter

func (g Gregorian) DayAfter() Gregorian

DayAfter returns the next day after the receiver day.

func (Gregorian) JD

func (g Gregorian) JD() JD

JD returns the Julian Date at noon on the receiver calendar day.

func (Gregorian) JDN

func (g Gregorian) JDN() JDN

JDN returns the Julian Day Number of the solar day which starts at noon on the receiver calendar day.

type GregorianYear

type GregorianYear int

A GregorianYear is a particular year in the Gregorian calendar specified in astronomical year numbering: https://en.wikipedia.org/wiki/Astronomical_year_numbering. In astronomical year numbering there is a year 0 and negative years are allowed.

func (GregorianYear) IsLeap

func (gy GregorianYear) IsLeap() bool

IsLeap shall return true if the receiver year is a leap year in the proleptic Gregorian calendar.

type JD

type JD struct {
	JDN JDN
	// The fraction of a solar day, in the range 0..1, since the preceding noon.
	Fraction float64
}

JD is a Julian Date: https://en.wikipedia.org/wiki/Julian_day.

func NewJD

func NewJD(date float64) JD

NewJD from the given Julian Date.

The integer component of the given Julian Date is the Julian Day Number and the fractional component is the fraction of a solar day, in the range 0..1, since the preceding noon.

func Now

func Now() JD

Now is the current time as a Julian Date.

func (JD) Add

func (jd JD) Add(duration float64) JD

Add the given duration measured in units of Julian days to the receiver date and return the resulting date.

func (JD) Date

func (jd JD) Date() float64

Date returns the sum of the receiver's Julian Day Number and fraction.

func (JD) T

func (jd JD) T() float64

T is the number of Julian centuries from the receiver date to the J2000 epoch.

type JDN

type JDN int

A JDN is a specific Julian Day Number: https://en.wikipedia.org/wiki/Julian_day.

The Julian Day Number 0 corresponds to the calendar day starting at noon on:

  • JulianDay{Y:-4712, M:1, N:1}, that is, Julian 4713 BC January 1st;

  • GregorianDay{Y:-4713, M:11, D:24}, that is, Gregorian 4714 BC November 24th.

func (JDN) Gregorian

func (jdn JDN) Gregorian() Gregorian

Gregorian returns the Gregorian calendar day on which the solar day with the receiver Julian Day Number begins.

func (JDN) Julian

func (jdn JDN) Julian() Julian

Julian returns the Julian calendar day on which the solar day with the receiver Julian Day Number begins.

type Julian

type Julian struct {
	/// The day, in the range 1..31.
	D int
	// The month, in the range 1..12.
	M int
	// The year.
	Y JulianYear
}

A Julian is a specific calendar day in the proleptic Julian calendar.

func (Julian) DayAfter

func (j Julian) DayAfter() Julian

DayAfter returns the next day after the receiver day.

func (Julian) JDN

func (j Julian) JDN() JDN

JDN returns the Julian Day Number of the solar day which starts at noon on the receiver calendar day.

type JulianYear

type JulianYear int

A JulianYear is a particular year in the Julian calendar specified in astronomical year numbering: https://en.wikipedia.org/wiki/Astronomical_year_numbering. In astronomical year numbering there is a year 0 and negative years are allowed.

func (JulianYear) IsLeap

func (jy JulianYear) IsLeap() bool

IsLeap shall return true if the receiver year is a leap year in the proleptic Julian calendar.

type Radian

type Radian float64

Radian is a unit of angle measurement, 2Pi radians per turn.

func (Radian) Degs

func (r Radian) Degs() Degree

Degs expresses the receiver angle in degrees.

func (Radian) ModuloPi

func (r Radian) ModuloPi() Radian

ModuloPi returns the principle trigonometric plane equivalent to the receiver angle in the range -PI..PI.

type SphericalCoordinates

type SphericalCoordinates struct {
	Radius  float64
	Polar   Degree
	Azimuth Degree
}

SphericalCoordinates is a point in a spherical coordinate system: https://en.wikipedia.org/wiki/Spherical_coordinate_system

func (SphericalCoordinates) Equatorial

Equatorial returns the receiver position in equatorial coordinates.

Directories

Path Synopsis
Package hipparcos reproduces a subset of the Hipparcos star catalog.
Package hipparcos reproduces a subset of the Hipparcos star catalog.
horizons
Package horizons interfaces with the JPL Horizons online solar system data and ephemeris computation service (https://ssd.jpl.nasa.gov/horizons/).
Package horizons interfaces with the JPL Horizons online solar system data and ephemeris computation service (https://ssd.jpl.nasa.gov/horizons/).
keplerian
Package keplerian reproduces orbital elements from
Package keplerian reproduces orbital elements from

Jump to

Keyboard shortcuts

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