SunTimesCalculator class

Implementation of sunrise and sunset methods to calculate astronomical times. This calculator uses the Java algorithm written by Kevin Boone that is based on the US Naval Observatory'sAlmanac for Computer algorithm ( Amazon, Barnes & Noble) and is used with his permission. Added to Kevin's code is adjustment of the zenith to account for elevation.

@author © Eliyahu Hershfeld 2004 - 2018 @author © Kevin Boone 2000

Inheritance

Constructors

SunTimesCalculator()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

adjustZenith(double zenith, double elevation) double
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 centre 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 {@link #setSolarRadius(double)} method , and atmospheric refraction accounts for 34 minutes or so (this can be changed via the {@link #setRefraction(double)} 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. [...]
inherited
getCalculatorName() String
@see net.sourceforge.zmanim.util.AstronomicalCalculator#getCalculatorName()
override
getEarthRadius() double
A method that returns the earth radius in KM. The value currently defaults to 6356.9 KM if not set. [...]
inherited
getElevationAdjustment(double elevation) double
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 {@link net.sourceforge.zmanim.AstronomicalCalendar#getBeginNauticalTwilight() nautical twilight} 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° {@link #adjustZenith adjusted} for refraction and solar radius. The algorithm used is [...]
inherited
getRefraction() double
Method to get the refraction value to be used when calculating sunrise and sunset. The default value is 34 arc minutes. The Errata and Notes for Calendrical Calculations: The Millennium Edition by Edward M. Reingold and Nachum Dershowitz lists the actual average refraction value as 34.478885263888294 or approximately 34' 29". The refraction value as well as the solarRadius and elevation adjustment are added to the zenith used to calculate sunrise and sunset. [...]
inherited
getSolarRadius() double
Method to get the sun's radius. The default value is 16 arc minutes. The sun's radius as it appears from earth is almost universally given as 16 arc minutes but in fact it differs by the time of the year. At the perihelion it has an apparent radius of 16.293, while at the aphelion it has an apparent radius of 15.755. There is little affect for most location, but at high and low latitudes the difference becomes more apparent. My Calculations for the difference at the location of the Royal Observatory, Greenwich show only a 4.494 second difference between the perihelion and aphelion radii, but moving into the arctic circle the difference becomes more noticeable. Tests for Tromso, Norway (latitude 69.672312, longitude 19.049787) show that on May 17, the rise of the midnight sun, a 2 minute 23 second difference is observed between the perihelion and aphelion radii using the USNO algorithm, but only 1 minute and 6 seconds difference using the NOAA algorithm. Areas farther north show an even greater difference. Note that these test are not real valid test cases because they show the extreme difference on days that are not the perihelion or aphelion, but are shown for illustrative purposes only. [...]
inherited
getUTCSunrise(DateTime dateTime, GeoLocation geoLocation, double zenith, bool adjustForElevation) double
@see net.sourceforge.zmanim.util.AstronomicalCalculator#getUTCSunrise(Calendar, GeoLocation, double, boolean)
override
getUTCSunset(DateTime calendar, GeoLocation geoLocation, double zenith, bool adjustForElevation) double
@see net.sourceforge.zmanim.util.AstronomicalCalculator#getUTCSunset(Calendar, GeoLocation, double, boolean)
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
setEarthRadius(double earthRadius) → void
A method that allows setting the earth's radius. [...]
inherited
setRefraction(double refraction) → void
A method to allow overriding the default refraction of the calculator. @todo At some point in the future, an AtmosphericModel or Refraction object that models the atmosphere of different locations might be used for increased accuracy. [...]
inherited
setSolarRadius(double solarRadius) → void
Method to set the sun's radius. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Constants

DEG_PER_HOUR → const double
The number of degrees of longitude that corresponds to one hour time difference.
360.0 / 24.0