uk.me.jstott.sun
Class Sun

java.lang.Object
  extended by uk.me.jstott.sun.Sun

public class Sun
extends java.lang.Object

Provides methods to calculate sunrise, sunset and civil, nautical and astronomical twilight times for a given latitude and longitude. Based on functions available at http://www.srrb.noaa.gov/highlights/sunrise/sunrise.html For more information on using this class, look at http://www.jstott.me.uk/jsuntimes/

Version:
1.0
Author:
Jonathan Stott

Constructor Summary
Sun()
           
 
Method Summary
static Time eveningAstronomicalTwilightTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of evening astronomical twilight for the given day at the given latitude and longitude on Earth.
static Time eveningAstronomicalTwilightTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of evening astronomical twilight for the given day at the given latitude and longitude on Earth.
static Time eveningCivilTwilightTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of evening civil twilight for the given day at the given latitude and longitude on Earth.
static Time eveningCivilTwilightTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of evening civil twilight for the given day at the given latitude and longitude on Earth.
static Time eveningNauticalTwilightTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of evening nautical twilight for the given day at the given latitude and longitude on Earth.
static Time eveningNauticalTwilightTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of evening nautical twilight for the given day at the given latitude and longitude on Earth.
static Time morningAstronomicalTwilightTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of morning astronomical twilight for the given day at the given latitude and longitude on Earth.
static Time morningAstronomicalTwilightTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of morning astronomical twilight for the given day at the given latitude and longitude on Earth.
static Time morningCivilTwilightTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of morning civil twilight for the given day at the given latitude and longitude on Earth.
static Time morningCivilTwilightTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of morning civil twilight for the given day at the given latitude and longitude on Earth.
static Time morningNauticalTwilightTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of morning nautical twilight for the given day at the nautical latitude and longitude on Earth.
static Time morningNauticalTwilightTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of morning nautical twilight for the given day at the nautical latitude and longitude on Earth.
static Time sunriseTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of sunrise for the given day at the given latitude and longitude on Earth.
static Time sunriseTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of sunrise for the given day at the given latitude and longitude on Earth
static Time sunsetTime(java.util.Calendar cal, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of sunset for the given day at the given latitude and longitude on Earth.
static Time sunsetTime(double julian, LatitudeLongitude ll, java.util.TimeZone timeZone, boolean dst)
          Calculate the UTC of sunset for the given day at the given latitude and longitude on Earth.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sun

public Sun()
Method Detail

sunriseTime

public static Time sunriseTime(java.util.Calendar cal,
                               LatitudeLongitude ll,
                               java.util.TimeZone timeZone,
                               boolean dst)
Calculate the UTC of sunrise for the given day at the given latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

sunriseTime

public static Time sunriseTime(double julian,
                               LatitudeLongitude ll,
                               java.util.TimeZone timeZone,
                               boolean dst)
Calculate the UTC of sunrise for the given day at the given latitude and longitude on Earth

Parameters:
julian - Julian day
ll - latitude and longitude of observer in degrees
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST)
dst - true if daylight savings time (summer time) should be taken into account
Returns:
time in minutes from zero Z

morningCivilTwilightTime

public static Time morningCivilTwilightTime(java.util.Calendar cal,
                                            LatitudeLongitude ll,
                                            java.util.TimeZone timeZone,
                                            boolean dst)
Calculate the UTC of morning civil twilight for the given day at the given latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

morningCivilTwilightTime

public static Time morningCivilTwilightTime(double julian,
                                            LatitudeLongitude ll,
                                            java.util.TimeZone timeZone,
                                            boolean dst)
Calculate the UTC of morning civil twilight for the given day at the given latitude and longitude on Earth.

Parameters:
julian - Julian day.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

morningNauticalTwilightTime

public static Time morningNauticalTwilightTime(java.util.Calendar cal,
                                               LatitudeLongitude ll,
                                               java.util.TimeZone timeZone,
                                               boolean dst)
Calculate the UTC of morning nautical twilight for the given day at the nautical latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

morningNauticalTwilightTime

public static Time morningNauticalTwilightTime(double julian,
                                               LatitudeLongitude ll,
                                               java.util.TimeZone timeZone,
                                               boolean dst)
Calculate the UTC of morning nautical twilight for the given day at the nautical latitude and longitude on Earth.

Parameters:
julian - Julian day.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

morningAstronomicalTwilightTime

public static Time morningAstronomicalTwilightTime(java.util.Calendar cal,
                                                   LatitudeLongitude ll,
                                                   java.util.TimeZone timeZone,
                                                   boolean dst)
Calculate the UTC of morning astronomical twilight for the given day at the given latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

morningAstronomicalTwilightTime

public static Time morningAstronomicalTwilightTime(double julian,
                                                   LatitudeLongitude ll,
                                                   java.util.TimeZone timeZone,
                                                   boolean dst)
Calculate the UTC of morning astronomical twilight for the given day at the given latitude and longitude on Earth.

Parameters:
julian - Julian day.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

sunsetTime

public static Time sunsetTime(java.util.Calendar cal,
                              LatitudeLongitude ll,
                              java.util.TimeZone timeZone,
                              boolean dst)
Calculate the UTC of sunset for the given day at the given latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.
Since:
1.0

sunsetTime

public static Time sunsetTime(double julian,
                              LatitudeLongitude ll,
                              java.util.TimeZone timeZone,
                              boolean dst)
Calculate the UTC of sunset for the given day at the given latitude and longitude on Earth.

Parameters:
julian - Julian day.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

eveningCivilTwilightTime

public static Time eveningCivilTwilightTime(java.util.Calendar cal,
                                            LatitudeLongitude ll,
                                            java.util.TimeZone timeZone,
                                            boolean dst)
Calculate the UTC of evening civil twilight for the given day at the given latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use.
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.
Since:
1.0

eveningCivilTwilightTime

public static Time eveningCivilTwilightTime(double julian,
                                            LatitudeLongitude ll,
                                            java.util.TimeZone timeZone,
                                            boolean dst)
Calculate the UTC of evening civil twilight for the given day at the given latitude and longitude on Earth.

Parameters:
julian - Julian day.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use.
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

eveningNauticalTwilightTime

public static Time eveningNauticalTwilightTime(java.util.Calendar cal,
                                               LatitudeLongitude ll,
                                               java.util.TimeZone timeZone,
                                               boolean dst)
Calculate the UTC of evening nautical twilight for the given day at the given latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.
Since:
1.0

eveningNauticalTwilightTime

public static Time eveningNauticalTwilightTime(double julian,
                                               LatitudeLongitude ll,
                                               java.util.TimeZone timeZone,
                                               boolean dst)
Calculate the UTC of evening nautical twilight for the given day at the given latitude and longitude on Earth.

Parameters:
julian - Julian day.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.

eveningAstronomicalTwilightTime

public static Time eveningAstronomicalTwilightTime(java.util.Calendar cal,
                                                   LatitudeLongitude ll,
                                                   java.util.TimeZone timeZone,
                                                   boolean dst)
Calculate the UTC of evening astronomical twilight for the given day at the given latitude and longitude on Earth.

Parameters:
cal - a Calendar specifying the date.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.
Since:
1.0

eveningAstronomicalTwilightTime

public static Time eveningAstronomicalTwilightTime(double julian,
                                                   LatitudeLongitude ll,
                                                   java.util.TimeZone timeZone,
                                                   boolean dst)
Calculate the UTC of evening astronomical twilight for the given day at the given latitude and longitude on Earth.

Parameters:
julian - Julian day.
ll - latitude and longitude of observer in degrees.
timeZone - the timeZone to use (e.g. Sun.GMT or Sun.PST).
dst - true if daylight savings time (summer time) should be taken into account.
Returns:
time in minutes from zero Z.