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. More...
Public Member Functions | |
object | Clone () |
Creates a new object that is a copy of the current instance. | |
abstract double | GetUtcSunrise (IAstronomicalCalendar astronomicalCalendar, double zenith, bool adjustForElevation) |
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. | |
abstract double | GetUtcSunset (IAstronomicalCalendar astronomicalCalendar, double zenith, bool adjustForElevation) |
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. | |
Static Public Member Functions | |
static AstronomicalCalculator | GetDefault () |
Protected Member Functions | |
AstronomicalCalculator () | |
Initializes a new instance of the AstronomicalCalculator class. | |
Properties | |
abstract string | CalculatorName [get] |
A descriptive name of the algorithm. |
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</author>
Zmanim.Calculator.AstronomicalCalculator.AstronomicalCalculator | ( | ) | [protected] |
Initializes a new instance of the AstronomicalCalculator class.
object Zmanim.Calculator.AstronomicalCalculator.Clone | ( | ) |
Creates a new object that is a copy of the current instance.
summary> getDefault method returns the default sun times calculation engine. /summary> returns> AstronomicalCalculator the default class for calculating sunrise and sunset. In the current implementation the default calculator returned is the SunTimesCalculator.
static AstronomicalCalculator Zmanim.Calculator.AstronomicalCalculator.GetDefault | ( | ) | [static] |
summary> 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 above or below it such as 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°; adjusted for refraction and solar radius.
The algorithm used is:
elevationAdjustment = MathExtensions.ToDegree(Math.acos(earthRadiusInMeters / (earthRadiusInMeters + elevationMeters)));
The source of this algorthitm is Calendrical Calculations by Edward M. Reingold and Nachum Dershowitz. An alternate algorithm that produces an almost identical (but not accurate) result found in Ma'aglay Tzedek by Moishe Kosower and other sources is:
elevationAdjustment = 0.0347 * Math.sqrt(elevationMeters);
/summary> param name = "elevation"> elevation in Meters.
returns> the adjusted zenith
abstract double Zmanim.Calculator.AstronomicalCalculator.GetUtcSunrise | ( | IAstronomicalCalendar | astronomicalCalendar, | |
double | zenith, | |||
bool | adjustForElevation | |||
) | [pure virtual] |
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.
astronomicalCalendar | Used to calculate day of year. | |
zenith | the azimuth below the vertical zenith of 90 degrees. for sunrise typically the zenith used for the calculation uses geometric zenith of 90°; and adjusts this slightly to account for solar refraction and the sun's radius. Another example would be AstronomicalCalendar.GetBeginNauticalTwilight that passes AstronomicalCalendar.NAUTICAL_ZENITH to this method. | |
adjustForElevation | if set to true [adjust for elevation]. |
Implements Zmanim.Calculator.IAstronomicalCalculator.
Implemented in Zmanim.Calculator.JSuntimeCalculator, Zmanim.Calculator.NOAACalculator, Zmanim.Calculator.SunTimesCalculator, and Zmanim.Calculator.ZmanimCalculator.
abstract double Zmanim.Calculator.AstronomicalCalculator.GetUtcSunset | ( | IAstronomicalCalendar | astronomicalCalendar, | |
double | zenith, | |||
bool | adjustForElevation | |||
) | [pure virtual] |
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.
astronomicalCalendar | Used to calculate day of year. | |
zenith | the azimuth below the vertical zenith of 90°;. For sunset typically the zenith used for the calculation uses geometric zenith of 90°; and adjusts this slightly to account for solar refraction and the sun's radius. Another example would be AstronomicalCalendar.GetEndNauticalTwilight that passes AstronomicalCalendar.NAUTICAL_ZENITH to this method. | |
adjustForElevation | if set to true [adjust for elevation]. |
Implements Zmanim.Calculator.IAstronomicalCalculator.
Implemented in Zmanim.Calculator.JSuntimeCalculator, Zmanim.Calculator.NOAACalculator, Zmanim.Calculator.SunTimesCalculator, and Zmanim.Calculator.ZmanimCalculator.
abstract string Zmanim.Calculator.AstronomicalCalculator.CalculatorName [get] |
A descriptive name of the algorithm.
Implements Zmanim.Calculator.IAstronomicalCalculator.
Reimplemented in Zmanim.Calculator.JSuntimeCalculator, Zmanim.Calculator.NOAACalculator, Zmanim.Calculator.SunTimesCalculator, and Zmanim.Calculator.ZmanimCalculator.