Class SunMoonCalculator

java.lang.Object
eu.hansolo.tilesfx.tools.SunMoonCalculator

public class SunMoonCalculator extends Object
  • Field Details

    • RAD_TO_DEG

      public static final double RAD_TO_DEG
      See Also:
    • DEG_TO_RAD

      public static final double DEG_TO_RAD
      See Also:
    • RAD_TO_HOUR

      public static final double RAD_TO_HOUR
      See Also:
    • RAD_TO_DAY

      public static final double RAD_TO_DAY
      See Also:
    • AU

      public static final double AU
      See Also:
    • EARTH_RADIUS

      public static final double EARTH_RADIUS
      See Also:
    • TWO_PI

      public static final double TWO_PI
      See Also:
    • TWO_PI_INVERSE

      public static final double TWO_PI_INVERSE
      See Also:
    • FOUR_PI

      public static final double FOUR_PI
      See Also:
    • PI_OVER_TWO

      public static final double PI_OVER_TWO
      See Also:
    • SIDEREAL_DAY_LENGTH

      public static final double SIDEREAL_DAY_LENGTH
      See Also:
    • JULIAN_DAYS_PER_CENTURY

      public static final double JULIAN_DAYS_PER_CENTURY
      See Also:
    • SECONDS_PER_DAY

      public static final double SECONDS_PER_DAY
      See Also:
    • J2000

      public static final double J2000
      See Also:
    • sunAz

      public double sunAz
      Values for azimuth, elevation, rise, set, and transit for the Sun. Angles in radians, rise ... as Julian days in UT. Distance in AU.
    • sunEl

      public double sunEl
      Values for azimuth, elevation, rise, set, and transit for the Sun. Angles in radians, rise ... as Julian days in UT. Distance in AU.
    • sunrise

      public double sunrise
      Values for azimuth, elevation, rise, set, and transit for the Sun. Angles in radians, rise ... as Julian days in UT. Distance in AU.
    • sunset

      public double sunset
      Values for azimuth, elevation, rise, set, and transit for the Sun. Angles in radians, rise ... as Julian days in UT. Distance in AU.
    • sunTransit

      public double sunTransit
      Values for azimuth, elevation, rise, set, and transit for the Sun. Angles in radians, rise ... as Julian days in UT. Distance in AU.
    • sunTransitElev

      public double sunTransitElev
      Values for azimuth, elevation, rise, set, and transit for the Sun. Angles in radians, rise ... as Julian days in UT. Distance in AU.
    • sunDist

      public double sunDist
      Values for azimuth, elevation, rise, set, and transit for the Sun. Angles in radians, rise ... as Julian days in UT. Distance in AU.
    • moonAz

      public double moonAz
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
    • moonEl

      public double moonEl
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
    • moonRise

      public double moonRise
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
    • moonSet

      public double moonSet
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
    • moonTransit

      public double moonTransit
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
    • moonAge

      public double moonAge
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
    • moonTransitElev

      public double moonTransitElev
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
    • moonDist

      public double moonDist
      Values for azimuth, elevation, rise, set, and transit for the Moon. Angles in radians, rise ... as Julian days in UT. Moon age is the number of days since last new Moon, in days, from 0 to 29.5. Distance in AU.
  • Constructor Details

    • SunMoonCalculator

      public SunMoonCalculator(int YEAR, int MONTH, int DAY, double LAT_DEG, double LNG_DEG) throws Exception
      Main constructor for Sun/Moon calculations. Observer angles in degrees.
      Parameters:
      YEAR - The year.
      MONTH - The month.
      DAY - The day.
      LAT_DEG - Latitude for the observer.
      LNG_DEG - Longitude for the observer.
      Throws:
      Exception - If the date does not exists.
    • SunMoonCalculator

      public SunMoonCalculator(int year, int month, int day, int h, int m, int s, double latDeg, double lngDeg) throws Exception
      Main constructor for Sun/Moon calculations. Time should be given in Universal Time (UT), observer angles in degrees.
      Parameters:
      year - The year.
      month - The month.
      day - The day.
      h - The hour.
      m - Minute.
      s - Second.
      latDeg - Latitude for the observer.
      lngDeg - Longitude for the observer.
      Throws:
      Exception - If the date does not exists.
  • Method Details

    • getDate

      public static int[] getDate(double JULIAN_DAY) throws Exception
      Transforms a Julian day (rise/set/transit fields) to a common date.
      Parameters:
      JULIAN_DAY - The Julian day.
      Returns:
      A set of integers: year, month, day, hour, minute, second.
      Throws:
      Exception - If the input date does not exists.
    • getZonedDateTime

      public static ZonedDateTime getZonedDateTime(double JULIAN_DAY, ZoneOffset ZONE_OFFSET) throws Exception
      Throws:
      Exception
    • getDateAsString

      public static String getDateAsString(double JULIAN_DAY) throws Exception
      Throws:
      Exception
    • getDateAsString

      public static String getDateAsString(double JULIAN_DAY, int TIMEZONE_OFFSET) throws Exception
      Returns a date as a string.
      Parameters:
      JULIAN_DAY - The Juliand day.
      Returns:
      The String.
      Throws:
      Exception - If the date does not exists.
    • normalizeRadians

      public static double normalizeRadians(double r)
      Reduce an angle in radians to the range (0 - 2 Pi).
      Parameters:
      r - Value in radians.
      Returns:
      The reduced radian value.
    • setTwilight

      public void setTwilight(SunMoonCalculator.TWILIGHT T)
      Sets the rise/set times to return. Default is for the local horizon.
      Parameters:
      T - The Twilight.
    • setDate

      public void setDate(LocalDate DATE) throws Exception
      Throws:
      Exception
    • setDate

      public void setDate(LocalDateTime DATE_TIME) throws Exception
      Throws:
      Exception
    • setDate

      public void setDate(int year, int month, int day) throws Exception
      Throws:
      Exception
    • setDate

      public void setDate(int year, int month, int day, int h, int m, int s) throws Exception
      Throws:
      Exception
    • calcSunAndMoon

      public void calcSunAndMoon()
      Calculates everything for the Sun and the Moon.
    • getMoonDiskOrientationAngles

      public double[] getMoonDiskOrientationAngles()
    • calcEphemeris

      public void calcEphemeris(ZoneId ZONE_ID)
    • getSunrise

      public ZonedDateTime getSunrise()
    • getSunset

      public ZonedDateTime getSunset()
    • getSunriseGoldenHour

      public ZonedDateTime getSunriseGoldenHour()
    • getSunsetGoldenHour

      public ZonedDateTime getSunsetGoldenHour()
    • getSunriseCivil

      public ZonedDateTime getSunriseCivil()
    • getSunsetCivil

      public ZonedDateTime getSunsetCivil()
    • getSunriseBlueHour

      public ZonedDateTime getSunriseBlueHour()
    • getSunsetBlueHour

      public ZonedDateTime getSunsetBlueHour()