public abstract class AstronomicalCalculator extends Object implements Cloneable
setting the refraction
.Constructor and Description 

AstronomicalCalculator() 
Modifier and Type  Method and Description 

(package private) double 
adjustZenith(double zenith,
double elevation)
Adjusts the zenith of astronomical sunrise and sunset to account for solar refraction, solar radius and
elevation.

Object 
clone() 
abstract String 
getCalculatorName()
Returns the name of the algorithm.

static AstronomicalCalculator 
getDefault()
getDefault method returns the default sun times calculation engine.

double 
getEarthRadius()
A method that returns the earth radius in KM.

(package private) double 
getElevationAdjustment(double elevation)
Method to return the adjustment to the zenith required to account for the elevation.

(package private) double 
getRefraction()
Method to get the refraction value to be used when calculating sunrise and sunset.

(package private) double 
getSolarRadius()
Method to get the sun's radius.

abstract double 
getUTCSunrise(Calendar calendar,
GeoLocation geoLocation,
double zenith,
boolean adjustForElevation)
A method that calculates UTC sunrise as well as any time based on an angle above or below sunrise.

abstract double 
getUTCSunset(Calendar calendar,
GeoLocation geoLocation,
double zenith,
boolean adjustForElevation)
A method that calculates UTC sunset as well as any time based on an angle above or below sunset.

void 
setEarthRadius(double earthRadius)
A method that allows setting the earth's radius.

void 
setRefraction(double refraction)
A method to allow overriding the default refraction of the calculator.

void 
setSolarRadius(double solarRadius)
Method to set the sun's radius.

public AstronomicalCalculator()
public double getEarthRadius()
public void setEarthRadius(double earthRadius)
earthRadius
 the earthRadius to set in KMpublic static AstronomicalCalculator getDefault()
SunTimesCalculator
.public abstract String getCalculatorName()
public abstract double getUTCSunrise(Calendar calendar, GeoLocation geoLocation, double zenith, boolean adjustForElevation)
calendar
 Used to calculate day of year.geoLocation
 The location information used for astronomical calculating sun times.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
 Should the time be adjusted for elevationDouble.NaN
will be returned.getElevationAdjustment(double)
public abstract double getUTCSunset(Calendar calendar, GeoLocation geoLocation, double zenith, boolean adjustForElevation)
calendar
 Used to calculate day of year.geoLocation
 The location information used for astronomical calculating sun times.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
 Should the time be adjusted for elevationDouble.NaN
will be returned.getElevationAdjustment(double)
double getElevationAdjustment(double elevation)
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 = Math.toDegrees(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);
elevation
 elevation in Meters.double adjustZenith(double zenith, double elevation)
setSolarRadius(double)
method , and atmospheric refraction
accounts for 34 minutes or so (this can be changed via the 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.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.elevation
 elevation in Meters.sun's radius
, refraction
and elevation
adjustment. This will only be adjusted for
sunrise and sunset (if the zenith == 90°)getElevationAdjustment(double)
double getRefraction()
public void setRefraction(double refraction)
refraction
 The refraction in arc minutes.getRefraction()
double getSolarRadius()
public void setSolarRadius(double solarRadius)
solarRadius
 The sun's radius in arc minutes.getSolarRadius()
public Object clone()
clone
in class Object
Object.clone()
Copyright © 2004  2015 Eliyahu Hershfeld. All Rights Reserved. Released under the LGPL 2.1 license