KosherJava Zmanim Homepage

net.sourceforge.zmanim.util
Class SunTimesCalculator

java.lang.Object
  extended by net.sourceforge.zmanim.util.AstronomicalCalculator
      extended by net.sourceforge.zmanim.util.SunTimesCalculator
All Implemented Interfaces:
Cloneable

public class SunTimesCalculator
extends AstronomicalCalculator

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.

Version:
1.1
Author:
© Eliyahu Hershfeld 2004 - 2011, © Kevin Boone 2000

Field Summary
static double ZENITH
          Default value for Sun's zenith and true rise/set
 
Constructor Summary
SunTimesCalculator()
           
 
Method Summary
 String getCalculatorName()
           
 double getUTCSunrise(AstronomicalCalendar astronomicalCalendar, double zenith, boolean adjustForElevation)
          A method that calculates UTC sunrise as well as any time based on an angle above or below sunrise.
 double getUTCSunset(AstronomicalCalendar astronomicalCalendar, double zenith, boolean adjustForElevation)
          A method that calculates UTC sunset as well as any time based on an angle above or below sunset.
 
Methods inherited from class net.sourceforge.zmanim.util.AstronomicalCalculator
adjustZenith, clone, getDefault, getElevationAdjustment, getRefraction, getSolarRadius, setRefraction, setSolarRadius
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZENITH

public static final double ZENITH
Default value for Sun's zenith and true rise/set

See Also:
Constant Field Values
Constructor Detail

SunTimesCalculator

public SunTimesCalculator()
Method Detail

getCalculatorName

public String getCalculatorName()
Specified by:
getCalculatorName in class AstronomicalCalculator
Returns:
the descriptive name of the algorithm.

getUTCSunrise

public double getUTCSunrise(AstronomicalCalendar astronomicalCalendar,
                            double zenith,
                            boolean adjustForElevation)
Description copied from class: AstronomicalCalculator
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.

Specified by:
getUTCSunrise in class AstronomicalCalculator
Parameters:
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.
Returns:
The UTC time of sunrise in 24 hour format. 5:45:00 AM will return 5.75.0. If an error was encountered in the calculation (expected behavior for some locations such as near the poles, Double.NaN will be returned.
See Also:
AstronomicalCalculator.getUTCSunrise(AstronomicalCalendar, double, boolean)

getUTCSunset

public double getUTCSunset(AstronomicalCalendar astronomicalCalendar,
                           double zenith,
                           boolean adjustForElevation)
Description copied from class: AstronomicalCalculator
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.

Specified by:
getUTCSunset in class AstronomicalCalculator
Parameters:
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.
Returns:
The UTC time of sunset in 24 hour format. 5:45:00 AM will return 5.75.0. If an error was encountered in the calculation (expected behavior for some locations such as near the poles, Double.NaN will be returned.
See Also:
AstronomicalCalculator.getUTCSunset(AstronomicalCalendar, double, boolean)

KosherJava Zmanim Homepage

Copyright © 2004 - 2011 Eliyahu Hershfeld. All Rights Reserved. Released under the GPL 2 license