Astronomical Calculator
An abstract class that all sun time calculating classes extend. This allows the algorithm used to be changed at runtime, easily allowing comparison the results of using different algorithms.
Author
Eliyahu Hershfeld 2004 - 2023
Inheritors
Properties
Returns the name of the algorithm.
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 solar noon (UTC) for the given day at the given location on earth. The the com.kosherjava.zmanim.util.NOAACalculator implementation calculates true solar noon, while the com.kosherjava.zmanim.util.SunTimesCalculator approximates it, calculating the time as halfway between sunrise and sunset.
A method that calculates UTC sunrise as well as any time based on an angle above or below sunrise. This abstract method is implemented by the classes that extend this class.
A method that calculates UTC sunset as well as any time based on an angle above or below sunset. This abstract method is implemented by the classes that extend this class.