Sun Times Calculator
Implementation of sunrise and sunset methods to calculate astronomical times. This calculator uses the Java algorithm written by [Kevin
Boone](htts://web.archive.org/web/20090531215353/http://www.kevinboone.com/suntimes.html) that is based on the US Naval Observatory'sAstronomical Almanac and used with his permission. Added to Kevin's code is adjustment of the zenith to account for elevation. This algorithm returns the same time every year and does not account for leap years. It is not as accurate as the Jean Meeus based NOAACalculator that is the default calculator use by the KosherJava zmanim library.
Author
Eliyahu Hershfeld 2004 - 2023
Kevin Boone 2000
Properties
The commonly used average earth radius in KM. At this time, this only affects elevation adjustment and not the sunrise and sunset calculations. The value currently defaults to 6356.9 KM.
The commonly used average solar refraction. Calendrical Calculations lists a more accurate global average of 34.478885263888294
The commonly used average solar radius in minutes of a degree.
Functions
Adjusts the zenith of astronomical sunrise and sunset to account for solar refraction, solar radius and elevation. The value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth were without an atmosphere, true sunset and sunrise would correspond to a 90 zenith. Because the Sun is not a point, and because the atmosphere refracts light, this 90 zenith does not, in fact, correspond to true sunset or sunrise, instead the center of the Sun's disk must lie just below the horizon for the upper edge to be obscured. This means that a zenith of just above 90 must be used. The Sun subtends an angle of 16 minutes of arc (this can be changed via the .setSolarRadius method , and atmospheric refraction accounts for 34 minutes or so (this can be changed via the .setRefraction method), giving a total of 50 arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333 for true sunrise/sunset. Since a person at an elevation can see blow the horizon of a person at sea level, this will also adjust the zenith to account for elevation if available. Note that this will only adjust the value if the zenith is exactly 90 degrees. For values below and above this no correction is done. As an example, astronomical twilight is when the sun is 18 below the horizon or com.kosherjava.zmanim.AstronomicalCalendar.ASTRONOMICAL_ZENITH. This is traditionally calculated with none of the above mentioned adjustments. The same goes for various tzais and alos times such as the com.kosherjava.zmanim.ZmanimCalendarZENITH_16_POINT_1 dip used in com.kosherjava.zmanim.ComplexZmanimCalendar.getAlos16Point1Degrees.
Method to return the adjustment to the zenith required to account for the elevation. Since a person at a higher elevation can see farther below the horizon, the calculation for sunrise / sunset is calculated below the horizon used at sea level. This is only used for sunrise and sunset and not times before or after it such as com.kosherjava.zmanim.AstronomicalCalendar.getBeginNauticalTwilight since those calculations are based on the level of available light at the given dip below the horizon, something that is not affected by elevation, the adjustment should only made if the zenith == 90 .adjustZenith for refraction and solar radius. The algorithm used is
Return the Universal Coordinated Time (UTC) of solar noon for the given day at the given location on earth. This implementation returns solar noon as the time halfway between sunrise and sunset. Other calculators may return true solar noon. See The Definition of Chatzos for details on solar noon calculations.