Class AstronomicalCalendar
java.lang.Object
com.kosherjava.zmanim.AstronomicalCalendar
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
ZmanimCalendar
A Java calendar that calculates astronomical times such as
sunrise, sunset and twilight times. This class contains a LocalDate and can therefore use the standard
Calendar functionality to change dates etc. The calculation engine used to calculate the astronomical times can be
changed to a different implementation by implementing the abstract AstronomicalCalculator and setting it with
the setAstronomicalCalculator(AstronomicalCalculator). A number of different calculation engine
implementations are included in the util package.
Note: There are times when the algorithms can't calculate proper values for sunrise, sunset and twilight. This
is usually caused by trying to calculate times for areas either very far North or South, where sunrise / sunset never
happen on that date. This is common when calculating twilight with a deep dip below the horizon for locations as far
south of the North Pole as London, in the northern hemisphere. The sun never reaches this dip at certain times of the
year. When the calculations encounter this condition a null will be returned when a
Instant is expected and Long.MIN_VALUE when a long is expected. The
reason that Exceptions are not thrown in these cases is because the lack of a rise/set or twilight is
not an exception, but an expected condition in many parts of the world.
Here is a simple example of how to use the API to calculate sunrise. First create the Calendar for the location you would like to calculate sunrise or sunset times for:
String locationName = "Lakewood, NJ";
double latitude = 40.0828; // Lakewood, NJ
double longitude = -74.2094; // Lakewood, NJ
double elevation = 20; // optional elevation correction in Meters
// the String parameter in getZoneId() has to be a valid ZoneId listed in ZoneId.getAvailableZoneIds()
ZoneId zoneId = ZoneId.of("America/New_York");
GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, zoneId);
AstronomicalCalendar ac = new AstronomicalCalendar(location);
To get the time of sunrise, first set the date you want (if not set, the date will default to today):
LocalDate localDate = LocalDate.of(1969, Month.FEBRUARY, 8); ac.setLocalDate(localDate); Instant sunrise = ac.getSunrise();
- Author:
- © Eliyahu Hershfeld 2004 - 2026
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumAn enum to indicate what type of solar event is being calculated. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleSun's zenith at astronomical twilight (108°).private AstronomicalCalculatorthe internalAstronomicalCalculatorused for calculating solar based times.static final doubleSun's zenith at civil twilight (96°).private GeoLocationtheGeoLocationused for calculations.static final double90° below the vertical.static final longconstant for milliseconds in an hour (3,600,000)private LocalDateTheLocalDateencapsulated by this class to track the current date used by the classstatic final longconstant for milliseconds in a minute (60,000)static final doubleSun's zenith at nautical twilight (102°). -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor will set a defaultGeoLocation(), a defaultAstronomicalCalculatorand default the LocalDate to the current date.AstronomicalCalendar(GeoLocation geoLocation) A constructor that takes in geolocation information as a parameter. -
Method Summary
Modifier and TypeMethodDescriptionclone()A method that creates a deep copy of the object.booleanprivate LocalDateAdjusts theLocalDateto deal with edge cases where the location crosses the antimeridian.A method that returns the currently set AstronomicalCalculator.A method that returns the beginning of astronomical twilight using a zenith of108°.A method that returns the beginning of civil twilight (dawn) using a zenith of96°.A method that returns the beginning of nautical twilight using a zenith of102°.A method that returns the end of astronomical twilight using a zenith of108°.A method that returns the end of civil twilight using a zenith of96°.A method that returns the end of nautical twilight using a zenith of102°.A method that returns the currently setGeoLocationwhich contains location information used for the astronomical calculations.protected InstantgetInstantFromTime(double time, AstronomicalCalendar.SolarEvent solarEvent) A method that returns anInstantfrom the time passed in as a parameter.returns theLocalDateobject encapsulated in this class.getLocalMeanTime(LocalTime localTime) A method that returns local mean time (LMT) time converted to regular clock time for the local wall-clock time passed to this method.protected ZonedDateTimeUsed by Molad based zmanim to determine if zmanim occur during the current day.protected ZonedDateTimeUsed by Molad based zmanim to determine if zmanim occur during the current day.A method that returns the sunrise withoutelevation adjustment.A method that returns the sunset withoutelevation adjustment.A method that returns solar midnight at the end of the current day (that may actually be after midnight of the day it is being calculated for).Deprecated.getSunriseOffsetByDegrees(double offsetZenith) A utility method that returns the time of an offset by degrees below or above the horizon ofsunrise.doublegetSunriseSolarDipFromOffset(double minutes) Deprecated.This method is slow and inefficient and should NEVER be used in a loop.The getSunriseWithElevation method returns aInstantrepresenting theelevation adjustedsunrise time.Deprecated.UsegetSunsetWithElevation()instead.getSunsetOffsetByDegrees(double offsetZenith) A utility method that returns the time of an offset by degrees below or above the horizon ofsunset.doublegetSunsetSolarDipFromOffset(double minutes) Deprecated.This method is slow and inefficient and should NEVER be used in a loop.The getSunsetWithElevation method returns anInstantrepresenting theelevation adjustedsunset time.A method that returns sundial or solar noon.getSunTransit(Instant startOfDay, Instant endOfDay) A method that returns sundial or solar noon.longA method that returns a sea-level based temporal (solar) hour.longgetTemporalHour(Instant startOfDay, Instant endOfDay) A utility method that will allow the calculation of a temporal (solar) hour based on the sunrise and sunset passed as parameters to this method.static InstantgetTimeOffset(Instant time, double offset) A utility method that returns a date offset by the offset time passed in as a parameter.static InstantgetTimeOffset(Instant time, long offsetMillis) A utility method that returns anInstantoffset by the offset time passed in.doublegetUTCSeaLevelSunrise(double zenith) A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using daylight savings time.doublegetUTCSeaLevelSunset(double zenith) A method that returns the sunset in UTC time without correction for elevation, time zone offset from GMT and without using daylight savings time.doublegetUTCSunrise(double zenith) A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using daylight savings time.doublegetUTCSunset(double zenith) A method that returns the sunset in UTC time without correction for time zone offset from GMT and without using daylight savings time.inthashCode()voidsetAstronomicalCalculator(AstronomicalCalculator astronomicalCalculator) A method to set theAstronomicalCalculatorused for astronomical calculations.voidsetGeoLocation(GeoLocation geoLocation) Sets theGeoLocationObjectto be used for astronomical calculations.voidsetLocalDate(LocalDate localDate) Sets theLocalDateobject for us in this class.toJSON()Returns a JSON formatted representation of the class using the default output of thetoJSONmethod.toString()Returns an XML formatted representation of the class using the default output of thetoXMLmethod.
-
Field Details
-
GEOMETRIC_ZENITH
90° below the vertical. Used as a basis for most calculations since the location of the sun is 90° below the horizon at sunrise and sunset. Note : it is important to note that for sunrise and sunset theadjusted zenithis required to account for the radius of the sun and refraction. The adjusted zenith should not be used for calculations above or below 90° since they are usually calculated as an offset to 90°.- See Also:
-
CIVIL_ZENITH
-
NAUTICAL_ZENITH
-
ASTRONOMICAL_ZENITH
Sun's zenith at astronomical twilight (108°).- See Also:
-
MINUTE_MILLIS
-
HOUR_MILLIS
-
localDate
-
geoLocation
theGeoLocationused for calculations. -
astronomicalCalculator
the internalAstronomicalCalculatorused for calculating solar based times.
-
-
Constructor Details
-
AstronomicalCalendar
public AstronomicalCalendar()Default constructor will set a defaultGeoLocation(), a defaultAstronomicalCalculatorand default the LocalDate to the current date. -
AstronomicalCalendar
A constructor that takes in geolocation information as a parameter. The defaultAstronomicalCalculatorused for solar calculations is the more accurateNOAACalculator.- Parameters:
geoLocation- The location information used for calculating astronomical sun times.- See Also:
-
-
Method Details
-
getSunriseWithElevation
The getSunriseWithElevation method returns aInstantrepresenting theelevation adjustedsunrise time. The zenith used for the calculation usesgeometric zenithof 90° plusAstronomicalCalculator.getElevationAdjustment(double). This is adjusted by theAstronomicalCalculatorto add approximately 50/60 of a degree to account for 34 archminutes of refraction and 16 archminutes for the sun's radius for a total of90.83333°. See documentation for the specific implementation of theAstronomicalCalculatorthat you are using.- Returns:
- the
Instantrepresenting the exact sunrise time. If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page. - See Also:
-
getSunrise
Deprecated.UsegetSunriseWithElevation()instead. This method already accounts for the observer's elevation, but the name does not clearly indicate this behavior. The replacement method has a clearer and more descriptive name.- Returns:
- the
Instantrepresenting the exact sunrise time. If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page. - See Also:
-
getSeaLevelSunrise
A method that returns the sunrise withoutelevation adjustment. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns sunrise calculated at sea level. This forms the base for dawn calculations that are calculated as a dip below the horizon before sunrise.- Returns:
- the
Instantrepresenting the exact sea-level sunrise time. If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page. - See Also:
-
getBeginCivilTwilight
A method that returns the beginning of civil twilight (dawn) using a zenith of96°.- Returns:
- The
Instantof the beginning of civil twilight using a zenith of 96°. If the calculation can't be computed,nullwill be returned. See detailed explanation on top of the page. - See Also:
-
getBeginNauticalTwilight
A method that returns the beginning of nautical twilight using a zenith of102°.- Returns:
- The
Instantof the beginning of nautical twilight using a zenith of 102°. If the calculation can't be computednullwill be returned. See detailed explanation on top of the page. - See Also:
-
getBeginAstronomicalTwilight
A method that returns the beginning of astronomical twilight using a zenith of108°.- Returns:
- The
Instantof the beginning of astronomical twilight using a zenith of 108°. If the calculation can't be computed,nullwill be returned. See detailed explanation on top of the page. - See Also:
-
getSunsetWithElevation
The getSunsetWithElevation method returns anInstantrepresenting theelevation adjustedsunset time. The zenith used for the calculation usesgeometric zenithof 90° plusAstronomicalCalculator.getElevationAdjustment(double). This is adjusted by theAstronomicalCalculatorto add approximately 50/60 of a degree to account for 34 archminutes of refraction and 16 archminutes for the sun's radius for a total of90.83333°. See documentation for the specific implementation of theAstronomicalCalculatorthat you are using. Note: In certain cases the calculates sunset will occur before sunrise. This will typically happen when a timezone other than the local timezone is used (calculating Los Angeles sunset using a GMT timezone for example). In this case the sunset date will be incremented to the following date.- Returns:
- the
Instantrepresenting the exact sunset time. If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page. - See Also:
-
getSunset
Deprecated.UsegetSunsetWithElevation()instead. This method already accounts for the observer's elevation, but its name does not clearly reflect that behavior. The replacement method provides a more accurate and descriptive name.- Returns:
- the
Instantrepresenting the exact sunset time. If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page. - See Also:
-
getSeaLevelSunset
A method that returns the sunset withoutelevation adjustment. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns sunset calculated at sea level. This forms the base for dusk calculations that are calculated as a dip below the horizon after sunset.- Returns:
- the
Instantrepresenting the exact sea-level sunset time. If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page. - See Also:
-
getEndCivilTwilight
A method that returns the end of civil twilight using a zenith of96°.- Returns:
- The
Instantof the end of civil twilight using a zenith of96°. If the calculation can't be computed,nullwill be returned. See detailed explanation on top of the page. - See Also:
-
getEndNauticalTwilight
-
getEndAstronomicalTwilight
-
getTimeOffset
A utility method that returns a date offset by the offset time passed in as a parameter. This method casts the offset as alongand callsgetTimeOffset(Instant, long).- Parameters:
time- the start timeoffset- the offset in milliseconds to add to the time- Returns:
- the
Instantwith the offset added to it
-
getTimeOffset
A utility method that returns anInstantoffset by the offset time passed in. Please note that the level of light during twilight is not affected by elevation, so if this is being used to calculate an offset before sunrise or after sunset with the intent of getting a rough "level of light" calculation, the sunrise or sunset time passed to this method should be sea level sunrise and sunset.- Parameters:
time- the start timeoffsetMillis- the offset in milliseconds to add to the time.- Returns:
- the
Instantwith the offset in milliseconds added to it
-
getSunriseOffsetByDegrees
A utility method that returns the time of an offset by degrees below or above the horizon ofsunrise. Note that the degree offset is from the vertical, so for a calculation of 14° before sunrise, an offset of 14 +GEOMETRIC_ZENITH= 104 would have to be passed as a parameter.- Parameters:
offsetZenith- the degrees beforegetSunriseWithElevation()to use in the calculation. For time after sunrise use negative numbers. Note that the degree offset is from the vertical, so for a calculation of 14° before sunrise, an offset of 14 +GEOMETRIC_ZENITH= 104 would have to be passed as a parameter.- Returns:
- The
Instantof the offset after (or before)getSunriseWithElevation(). If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page.
-
getSunsetOffsetByDegrees
A utility method that returns the time of an offset by degrees below or above the horizon ofsunset. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an offset of 14 +GEOMETRIC_ZENITH= 104 would have to be passed as a parameter.- Parameters:
offsetZenith- the degrees aftergetSunsetWithElevation()to use in the calculation. For time before sunset use negative numbers. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an offset of 14 +GEOMETRIC_ZENITH= 104 would have to be passed as a parameter.- Returns:
- The
Instantof the offset after (or before)getSunsetWithElevation(). If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set, anullwill be returned. See detailed explanation on top of the page.
-
getUTCSunrise
A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using daylight savings time.- Parameters:
zenith- the degrees below the horizon. For time after sunrise use negative numbers.- Returns:
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set,
Double.NaNwill be returned. See detailed explanation on top of the page.
-
getUTCSeaLevelSunrise
A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using daylight savings time. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns UTC sunrise calculated at sea level. This forms the base for dawn calculations that are calculated as a dip below the horizon before sunrise.- Parameters:
zenith- the degrees below the horizon. For time after sunrise use negative numbers.- Returns:
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set,
Double.NaNwill be returned. See detailed explanation on top of the page. - See Also:
-
getUTCSunset
A method that returns the sunset in UTC time without correction for time zone offset from GMT and without using daylight savings time.- Parameters:
zenith- the degrees below the horizon. For time after sunset use negative numbers.- Returns:
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set,
Double.NaNwill be returned. See detailed explanation on top of the page. - See Also:
-
getUTCSeaLevelSunset
A method that returns the sunset in UTC time without correction for elevation, time zone offset from GMT and without using daylight savings time. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not affected by elevation. This method returns UTC sunset calculated at sea level. This forms the base for dusk calculations that are calculated as a dip below the horizon after sunset.- Parameters:
zenith- the degrees below the horizon. For time before sunset use negative numbers.- Returns:
- The time in the format: 18.75 for 18:45:00 UTC/GMT. If the calculation can't be computed such as in the
Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
not set,
Double.NaNwill be returned. See detailed explanation on top of the page. - See Also:
-
getTemporalHour
A method that returns a sea-level based temporal (solar) hour. The day fromsea-level sunrisetosea-level sunsetis split into 12 equal parts with each one being a temporal hour.- Returns:
- the
longmillisecond length of a temporal hour. If the calculation can't be computed,Long.MIN_VALUEwill be returned. See detailed explanation on top of the page. - See Also:
-
getTemporalHour
A utility method that will allow the calculation of a temporal (solar) hour based on the sunrise and sunset passed as parameters to this method. An example of the use of this method would be the calculation of a elevation adjusted temporal hour by passing insunriseandsunsetas parameters.- Parameters:
startOfDay- The start of the day.endOfDay- The end of the day.- Returns:
- the
longmillisecond length of the temporal hour. If the calculation can't be computed aLong.MIN_VALUEwill be returned. See detailed explanation on top of the page. - See Also:
-
getSunTransit
A method that returns sundial or solar noon. It occurs when the Sun is transiting the celestial meridian. The calculations used by this class depend on theAstronomicalCalculatorused. If this calendar instance issetto use theNOAACalculator(the default) it will calculate astronomical noon. If the calendar instance is to use theSunTimesCalculator, that does not have code to calculate astronomical noon, the sun transit is calculated as halfway between sea level sunrise and sea level sunset, which can be slightly off the real transit time due to changes in declination (the lengthening or shortening day). See The Definition of Chatzos for details on the proper definition of solar noon / midday.- Returns:
- the
Instantrepresenting Sun's transit. If the calculation can't be computed such as when using theUSNO calculatorthat does not support getting solar noon for the Arctic Circle (where there is at least one day a year where the sun does not rise, and one where it does not set), anullwill be returned. See detailed explanation on top of the page. - See Also:
-
getSolarMidnight
A method that returns solar midnight at the end of the current day (that may actually be after midnight of the day it is being calculated for). It occurs when the Sun is transiting the lower celestial meridian, or when the sun is at it's nadir. The calculations used by this class depend on theAstronomicalCalculatorused. If this calendar instance issetto use theNOAACalculator(the default) it will calculate astronomical midnight. If the calendar instance is to use theUSNO Calculator, that does not have code to calculate astronomical noon, midnight is calculated as 12 hours after halfway between sea level sunrise and sea level sunset of that day. This can be slightly off the real transit time due to changes in declination (the lengthening or shortening day). See The Definition of Chatzos for details on the proper definition of solar noon / midday.- Returns:
- the
Instantrepresenting Sun's lower transit at the end of the current day. If the calculation can't be computed such as when using theUSNO calculatorthat does not support getting solar noon or midnight for the Arctic Circle (where there is at least one day a year where the sun does not rise, and one where it does not set), anullwill be returned. This is not relevant when using theNOAA Calculatorthat is never expected to returnnull. See the detailed explanation on top of the page. - See Also:
-
getSunTransit
A method that returns sundial or solar noon. It occurs when the Sun is transiting the celestial meridian. In this class it is calculated as halfway between the sunrise and sunset passed to this method. This time can be slightly off the real transit time due to changes in declination (the lengthening or shortening day).- Parameters:
startOfDay- the start of day for calculating the sun's transit. This can be sea level sunrise, visual sunrise (or any arbitrary start of day) passed to this method.endOfDay- the end of day for calculating the sun's transit. This can be sea level sunset, visual sunset (or any arbitrary end of day) passed to this method.- Returns:
- the
Instantrepresenting Sun's transit. If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does not set,nullwill be returned. See detailed explanation on top of the page.
-
getInstantFromTime
A method that returns anInstantfrom the time passed in as a parameter.- Parameters:
time- The time to be set as the time for theInstant. The time expected is in the format: 18.75 for 6:45:00 PM.time is sunrise and false if it is sunsetsolarEvent- the type ofAstronomicalCalendar.SolarEvent- Returns:
- The Instant object representation of the time double
-
getSunriseSolarDipFromOffset
Deprecated.This method is slow and inefficient and should NEVER be used in a loop. This method should be replaced by calls toAstronomicalCalculator.getSolarElevation(Calendar, GeoLocation). That method will efficiently return the the solar elevation (the sun's position in degrees below (or above) the horizon) at the given time even in the arctic when there is no sunrise.Returns the sun's elevation (number of degrees) below the horizon before sunrise that matches the offset minutes on passed in as a parameter. For example passing in 72 minutes for a calendar set to the equinox in Jerusalem returns a value close to 16.1°.- Parameters:
minutes- minutes before sunrise- Returns:
- the degrees below the horizon before sunrise that match the offset in minutes passed it as a parameter. If
the calculation can't be computed (no sunrise occurs on this day) a
Double.NaNwill be returned. - See Also:
-
getSunsetSolarDipFromOffset
Deprecated.This method is slow and inefficient and should NEVER be used in a loop. This method should be replaced by calls toAstronomicalCalculator.getSolarElevation(ZonedDateTime, GeoLocation). That method will efficiently return the the solar elevation (the sun's position in degrees below (or above) the horizon) at the given time even in the arctic when there is no sunrise.Returns the sun's elevation (number of degrees) below the horizon after sunset that matches the offset minutes passed in as a parameter. For example passing in 72 minutes for a calendar set to the equinox in Jerusalem returns a value close to 16.1°.- Parameters:
minutes- minutes after sunset- Returns:
- the degrees below the horizon after sunset that match the offset in minutes passed it as a parameter. If
the calculation can't be computed (no sunset occurs on this day) a
Double.NaNwill be returned. - See Also:
-
getLocalMeanTime
A method that returns local mean time (LMT) time converted to regular clock time for the local wall-clock time passed to this method. This time is adjusted from standard time to account for the local latitude. The 360° of the globe divided by 24 calculates to 15° per hour with 4 minutes per degree, so at a longitude of 0 , 15, 30 etc... noon is at exactly 12:00pm. Lakewood, N.J., with a longitude of -74.222, is 0.7906 away from the closest multiple of 15 at -75°. This is multiplied by 4 clock minutes (per degree) to yield 3 minutes and 7 seconds for a noon time of 11:56:53am. This method is not tied to the theoretical 15° time zones, but will adjust to the actual time zone and Daylight saving time to return LMT.- Parameters:
localTime- the local wall-clock time (such as 12:00 for noon and 00:00 for midnight) to calculate as LMT.- Returns:
- the
Instantrepresenting the local mean time (LMT) for the time passed in. In Lakewood, NJ, passing noon will return 11:56:50am. - See Also:
-
getAdjustedLocalDate
Adjusts theLocalDateto deal with edge cases where the location crosses the antimeridian.- Returns:
- the adjusted Calendar
- See Also:
-
getMidnightLastNight
Used by Molad based zmanim to determine if zmanim occur during the current day. This is also used as the anchor for current timezone-offset calculations.- Returns:
- midnight at the start of the current local date in the configured timezone
-
getMidnightTonight
Used by Molad based zmanim to determine if zmanim occur during the current day.- Returns:
- following midnight
-
toString
-
toJSON
-
equals
-
hashCode
-
getGeoLocation
A method that returns the currently setGeoLocationwhich contains location information used for the astronomical calculations.- Returns:
- Returns the geoLocation.
-
setGeoLocation
Sets theGeoLocationObjectto be used for astronomical calculations.- Parameters:
geoLocation- The geoLocation to set.- TODO:
- Possibly adjust for horizon elevation. It may be smart to just have the calculator check the GeoLocation though it doesn't really belong there.
-
getAstronomicalCalculator
A method that returns the currently set AstronomicalCalculator.- Returns:
- Returns the astronomicalCalculator.
- See Also:
-
setAstronomicalCalculator
A method to set theAstronomicalCalculatorused for astronomical calculations. The Zmanim package ships with a number of different implementations of theabstractAstronomicalCalculatorbased on different algorithms, including the defaultNOAACalculatorbased on NOAA's implementation of Jean Meeus's algorithms as well asSunTimesCalculatorbased on the US Naval Observatory's algorithm. This allows easy runtime switching and comparison of different algorithms.- Parameters:
astronomicalCalculator- The astronomicalCalculator to set.
-
getLocalDate
returns theLocalDateobject encapsulated in this class.- Returns:
- Returns the
LocalDate.
-
setLocalDate
Sets theLocalDateobject for us in this class.- Parameters:
localDate- TheLocalDateto set.
-
clone
A method that creates a deep copy of the object. Note: If theTimeZonein the clonedGeoLocationwill be changed from the original, it is critical thatgetLocalDate().
-
getSunriseWithElevation()instead.