Class AstroUtils
java.lang.Object
gaiasky.util.coord.AstroUtils
Astronomical utilities. Contains functions to convert Julian dates, reference systems, and more.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longMilliseconds of J2000 in the scale ofInstant.static final doubleJulian date of reference epoch J2000 = JD2451544.5 = 2000-01-01T00:00:00Z.static final doubleJulian date of reference epoch J2010 = JD2455197.5 = 2010-01-01T00:00:00Z.static final doubleJulian date of reference epoch J2015.0 = JD2457023.5 = 2015-01-01T00:00:00Z.static final doubleJulian date of reference epoch J2015.5 = JD2457206.125 = 2015-01-01T00:00:00Z.static final doubleJulian days per year. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleabsoluteMagnitudeToPseudoSize(double absMag) Computes the pseudo-size of a star from the absolute magnitude.static doubleabsoluteToApparentMagnitude(double distPc, double absMag) Converts an absolute magnitude to an apparent magnitude at the given distance in parsecs.static doubleapparentToAbsoluteMagnitude(double distPc, double appMag) Converts an apparent magnitude to an absolute magnitude given the distance in parsecs.static long[]getCalendarDay(double julianDate) Gets the Gregorian calendar quantities given the Julian date.static long[]getDayQuantities(double dayFraction) Deprecated.Not used anymore.static doublegetDaysSince(Instant date, double epoch_jd) Returns the elapsed days since the given julian date jd until the given date.static doublegetDaysSinceJ2000(Instant date) Returns the elapsed days since the epoch J2000 until the given date.static doublegetJulianDate(double refEpoch) Get julian date from a double reference epoch, as a Gregorian calendar year plus fraction.static doublegetJulianDate(Instant instant) Gets the Julian date from a givenInstant.static doublegetJulianDateCache(Instant instant) Gets the Julian Date for the givenInstant.static doublegetJulianDateUTC(int year, int month, int day, int hour, int min, int sec, int nanos) Computes the Julian Date (JD) for a given date and time with nanosecond precision, using either the Julian or Gregorian calendar depending on the date.static doublegetJulianDayNumberBook(int year, int month, int day) Deprecated.This does not work well!static doublegetJulianDayNumberGregorian(int year, int month, int day) Determine Julian day number from Gregorian calendar date.static doublegetJulianDayNumberJulianCalendar(int year, int month, int day) Returns the Julian day number of a date in the Julian calendar.static doublegetMsSince(Instant date, double epoch_jd) Returns the elapsed milliseconds since the given julian date jd until the given date.static StringgetSpectralType(float tEff) Get the spectral type from the effective temperature for main sequence stars.static doublegetSunLongitude(Instant date) Returns the Sun's ecliptic longitude in degrees for the given time.static booleanisLeapYearGregorian(int year) Is a given year in the Gregorian calendar a leap year ?static InstantjulianDateToInstant(double jd) static doubleobliquity(double julianDate) Returns the obliquity of the ecliptic (inclination of the Earth's axis of rotation) for a given date, in degreesstatic voidplutoEclipticCoordinates(Instant date, Vector3Q out) Spherical ecliptic coordinates of Pluto at the given date.static doubleT(double julianDate) Time T measured in Julian centuries from the Epoch J2000.0.static doubletau(double julianDate)
-
Field Details
-
JD_TO_Y
public static final double JD_TO_YJulian days per year.- See Also:
-
JD_J2000
public static final double JD_J2000Julian date of reference epoch J2000 = JD2451544.5 = 2000-01-01T00:00:00Z. -
JD_J2010
public static final double JD_J2010Julian date of reference epoch J2010 = JD2455197.5 = 2010-01-01T00:00:00Z. -
JD_J2015
public static final double JD_J2015Julian date of reference epoch J2015.0 = JD2457023.5 = 2015-01-01T00:00:00Z. -
JD_J2015_5
public static final double JD_J2015_5Julian date of reference epoch J2015.5 = JD2457206.125 = 2015-01-01T00:00:00Z. -
J2000_MS
public static final long J2000_MSMilliseconds of J2000 in the scale ofInstant. This is the number of milliseconds elapsed since 1970-01-01T00:00:00Z (UTC) until 2000-01-01T00:00:00Z (UTC).
-
-
Constructor Details
-
AstroUtils
public AstroUtils()
-
-
Method Details
-
getJulianDate
public static double getJulianDate(double refEpoch) Get julian date from a double reference epoch, as a Gregorian calendar year plus fraction.- Parameters:
refEpoch- The reference epoch as a Gregorian calendar year.- Returns:
- The julian date.
-
getSunLongitude
Returns the Sun's ecliptic longitude in degrees for the given time. Caches the last Sun's longitude for future use.- Parameters:
date- The time for which the longitude must be calculated.- Returns:
- The Sun's longitude in [deg].
-
getJulianDateUTC
public static double getJulianDateUTC(int year, int month, int day, int hour, int min, int sec, int nanos) Computes the Julian Date (JD) for a given date and time with nanosecond precision, using either the Julian or Gregorian calendar depending on the date.The calendar transition is determined by comparing the input against a predefined
gregorianSwitchInstant, after which the Gregorian calendar is used. The input quantities are assumed to be in UTC.- Parameters:
year- the year component of the datemonth- the month component of the date (1 = January, ..., 12 = December)day- the day of the month (1-31)hour- the hour of the day (0–23)min- the minute of the hour (0–59)sec- the second of the minute (0–59)nanos- the nanosecond of the second (0–999,999,999)- Returns:
- the Julian Date corresponding to the given date and time
- Throws:
DateTimeException- if the date-time values are invalid
-
getJulianDateCache
-
getJulianDate
-
getDaysSinceJ2000
Returns the elapsed days since the epoch J2000 until the given date. Can be negative.- Parameters:
date- The date.- Returns:
- The elapsed days.
-
getMsSince
Returns the elapsed milliseconds since the given julian date jd until the given date. Can be negative.- Parameters:
date- The date.epoch_jd- The reference epoch in julian days.- Returns:
- The elapsed milliseconds.
-
getDaysSince
Returns the elapsed days since the given julian date jd until the given date. Can be negative.- Parameters:
date- The date.epoch_jd- The reference epoch in julian days.- Returns:
- The elapsed days
-
getCalendarDay
public static long[] getCalendarDay(double julianDate) Gets the Gregorian calendar quantities given the Julian date.- Parameters:
julianDate- The Julian date.- Returns:
- Vector with [year, month, day, hour, min, sec, nanos].
-
getJulianDayNumberBook
Deprecated.This does not work well!Returns the Julian day number. Uses the method shown in "Astronomical Algorithms" by Jean Meeus.- Parameters:
year- The yearmonth- The month in [1:12]day- The day in the month, starting at 1- Returns:
- The Julian date
-
getJulianDayNumberJulianCalendar
public static double getJulianDayNumberJulianCalendar(int year, int month, int day) Returns the Julian day number of a date in the Julian calendar. Uses Wikipedia's algorithm.- Parameters:
year- The yearmonth- The month in [1:12]day- The day in the month, starting at 1- Returns:
- The Julian date
- See Also:
-
isLeapYearGregorian
public static boolean isLeapYearGregorian(int year) Is a given year in the Gregorian calendar a leap year ?- Parameters:
year- The year.- Returns:
- Whether the year in the Gregorian calendar is a leap year.
-
getJulianDayNumberGregorian
public static double getJulianDayNumberGregorian(int year, int month, int day) Determine Julian day number from Gregorian calendar date.- Parameters:
year- The year.month- The month.day- The day.- Returns:
- The julian day number.
-
julianDateToInstant
-
getDayQuantities
Deprecated.Not used anymore.Gets the day quantities from the day fraction- Parameters:
dayFraction- The day fraction.- Returns:
- [hours, minutes, seconds, nanos].
-
obliquity
public static double obliquity(double julianDate) Returns the obliquity of the ecliptic (inclination of the Earth's axis of rotation) for a given date, in degrees- Returns:
- The obliquity in degrees
-
T
public static double T(double julianDate) Time T measured in Julian centuries from the Epoch J2000.0.- Parameters:
julianDate- The julian date.- Returns:
- The time in julian centuries.
-
tau
public static double tau(double julianDate) -
apparentToAbsoluteMagnitude
public static double apparentToAbsoluteMagnitude(double distPc, double appMag) Converts an apparent magnitude to an absolute magnitude given the distance in parsecs.- Parameters:
distPc- The distance to the star in parsecs.appMag- The apparent magnitude.- Returns:
- The absolute magnitude.
-
absoluteToApparentMagnitude
public static double absoluteToApparentMagnitude(double distPc, double absMag) Converts an absolute magnitude to an apparent magnitude at the given distance in parsecs.- Parameters:
distPc- The distance to the star in parsecs.absMag- The absolute magnitude.- Returns:
- The apparent magnitude at the given distance.
-
absoluteMagnitudeToPseudoSize
public static double absoluteMagnitudeToPseudoSize(double absMag) Computes the pseudo-size of a star from the absolute magnitude.- Parameters:
absMag- The absolute magnitude of the star.- Returns:
- The pseudo-size of this star, mainly used for rendering purposes. It has no physical meaning and has no relation to the actual physical size of the star.
-
getSpectralType
-
plutoEclipticCoordinates
-