Enum Class StdSolarCalculator

java.lang.Object
java.lang.Enum<StdSolarCalculator>
net.time4j.calendar.astro.StdSolarCalculator
All Implemented Interfaces:
Serializable, Comparable<StdSolarCalculator>, java.lang.constant.Constable, SolarTime.Calculator

public enum StdSolarCalculator extends Enum<StdSolarCalculator> implements SolarTime.Calculator

Enumeration of some standard calculators for solar time.

Since:
3.36/4.31
  • Enum Constant Details

    • SIMPLE

      public static final StdSolarCalculator SIMPLE
      Simple and relatively fast but rather imprecise calculator.

      This calculator was once published in "Almanac for Computers, 1990 by Nautical Almanac Office in United States Naval Observatory (USNO)".

      Ed Williams has used this book as the source for his algorithmic proposal. Mike Reedell has then used the proposal of Williams to realize his popular sunrise/sunset-library written in Java. Leaving aside general precision requirements, this method cannot be recommended for the polar regions. So the scope of this method is constrained to the latitudes in range -65.0 <= latitude <= +65.0 otherwise the results are expected to be unusable.

      However, if users only use this method for actual years and non-polar regions, then the precision of sunrise or sunset events remain within two minutes (and the equation of time within one minute).

    • NOAA

      public static final StdSolarCalculator NOAA
      Follows closely the algorithms published by NOAA (National Oceanic and Atmospheric Administration).

      Introduction

      The website of NOAA also links to the calculation details. This is a calculator with reasonably good precision. But the altitude of the observer is not taken into account.

      Although the precision is theoretically often better than one minute (for non-polar regions, beyond +/-72 degrees latitude rather in range of ten minutes), users should consider the fact that local topology or the actual weather conditions are not taken into account. Therefore truncating the results to minute precision should be considered.

      Example

           PlainDate date = PlainDate.of(2009, 9, 6);
           SolarTime atlanta = SolarTime.ofLocation(33.766667, -84.416667, 0, StdSolarCalculator.NOAA);
           TZID tzid = () -> "America/New_York";
           assertThat(
             date.get(atlanta.sunrise())
               .get()
               .toZonalTimestamp(tzid)
               .with(PlainTime.PRECISION, ClockUnit.MINUTES),
             is(PlainTimestamp.of(2009, 9, 6, 7, 15)));
       
    • CC

      public static final StdSolarCalculator CC
      Follows closely the algorithms published by Dershowitz/Reingold in their book "Calendrical Calculations" (third edition).

      The altitude of the observer is taken into account by an approximated geodetic model.

      Supported features (in degrees)

      • right-ascension
      • declination
      • mean-anomaly
      • nutation
      • obliquity
      • solar-longitude
      • lunar-longitude
    • TIME4J

      public static final StdSolarCalculator TIME4J
      Based mainly on the astronomical calculations published by Jean Meeus in his book "Astronomical Algorithms" (second edition).

      Introduction

      This calculation offers high precision with the general limitation that the local topology or special weather conditions cannot be calculated.

      The altitude of the observer is taken into account using a spheroid (WGS84) and the assumption of a standard atmosphere (for the refraction).

      Supported features (in degrees)

      • right-ascension
      • declination
      • mean-anomaly
      • nutation
      • obliquity
      • solar-longitude
      • lunar-longitude
  • Method Details

    • values

      public static StdSolarCalculator[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static StdSolarCalculator valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • declination

      public double declination(double jde)

      Determines the declination of sun.

      Parameters:
      jde - julian day in ephemeris time
      Returns:
      declination of sun in degrees
      See Also:
      rightAscension(double)
    • rightAscension

      public double rightAscension(double jde)

      Determines the right ascension of sun.

      Parameters:
      jde - julian day in ephemeris time
      Returns:
      right ascension of sun in degrees
      See Also:
      declination(double)
    • getFeature

      public double getFeature(double jde, String nameOfFeature)

      Supported features are at least "declination" and "right-ascension".

      Specified by:
      getFeature in interface SolarTime.Calculator
      Parameters:
      jde - julian day in ephemeris time
      nameOfFeature - describes what kind of value shall be calculated
      Returns:
      result value or Double.NaN if the feature is not supported