org.geotools.nature
Class SunRelativePosition

java.lang.Object
  extended byorg.geotools.nature.SunRelativePosition

public class SunRelativePosition
extends java.lang.Object

Calcule la position du soleil relativement ? la position de l'observateur. Cette classe re?oit en entr?s les coordonn?es spatio-temporelles de l'observateur, soit:

 
  • La longitude (en degr?es) de l'observateur;
  • La latitude (en degr?es) de l'observateur;
  • La date et heure en heure universelle (GMT).
La position du soleil calcul?e en sortie comprend les valeurs suivantes:
  • L'azimuth du soleil (en degr?s dans le sens des aiguilles d'une montre depuis le nord);
  • L'?l?vation du soleil (en degr?s par rapport a l'horizon).
Les algorithmes utilis?s dans cette classe sont des adaptations des algorithmes en javascript ?crit par le "National Oceanic and Atmospheric Administration, Surface Radiation Research Branch". L'application original est le Solar Position Calculator.

The approximations used in these programs are very good for years between 1800 and 2100. Results should still be sufficiently accurate for the range from -1000 to 3000. Outside of this range, results will be given, but the potential for error is higher.

Since:
2.1
Version:
$Id: SunRelativePosition.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Remi Eve, Martin Desruisseaux

Field Summary
static double ASTRONOMICAL_TWILIGHT
          Elevation angle of astronomical twilight, in degrees.
static double CIVIL_TWILIGHT
          Elevation angle of civil twilight, in degrees.
static double NAUTICAL_TWILIGHT
          Elevation angle of nautical twilight, in degrees.
 
Constructor Summary
SunRelativePosition()
          Constructs a sun relative position calculator.
SunRelativePosition(double twilight)
          Constructs a sun relative position calculator with the specified value for the sun elevation at twilight.
 
Method Summary
 double getAzimuth()
          Retourne l'azimuth en degr?s.
 java.awt.geom.Point2D getCoordinate()
          Returns the coordinate used for elevation and azimuth computation.
 java.util.Date getDate()
          Returns the date used for elevation and azimuth computation.
 double getElevation()
          Retourne l'?l?vation en degr?s.
 java.util.Date getNoonDate()
          Retourne la date ? laquelle le soleil est au plus haut dans la journ?e.
 long getNoonTime()
          Retourne l'heure ? laquelle le soleil est au plus haut.
 double getTwilight()
          Returns the sun's elevation angle at twilight, in degrees.
static void main(java.lang.String[] args)
          Affiche la position du soleil ? la date et coordonn?es sp?cifi?e.
 void setCoordinate(double longitude, double latitude)
          Set the geographic coordinate where to compute the elevation and azimuth.
 void setCoordinate(java.awt.geom.Point2D point)
          Set the geographic coordinate where to compute the elevation and azimuth.
 void setDate(java.util.Date date)
          Set the date and time when to compute the elevation and azimuth.
 void setTwilight(double twilight)
          Set the sun's elevation angle at twilight, in degrees.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASTRONOMICAL_TWILIGHT

public static final double ASTRONOMICAL_TWILIGHT
Elevation angle of astronomical twilight, in degrees. Astronomical twilight is the time of morning or evening when the sun is 18? below the horizon (solar elevation angle of -18?).

See Also:
Constant Field Values

NAUTICAL_TWILIGHT

public static final double NAUTICAL_TWILIGHT
Elevation angle of nautical twilight, in degrees. Nautical twilight is the time of morning or evening when the sun is 12? below the horizon (solar elevation angle of -12?).

See Also:
Constant Field Values

CIVIL_TWILIGHT

public static final double CIVIL_TWILIGHT
Elevation angle of civil twilight, in degrees. Civil twilight is the time of morning or evening when the sun is 6? below the horizon (solar elevation angle of -6?).

See Also:
Constant Field Values
Constructor Detail

SunRelativePosition

public SunRelativePosition()
Constructs a sun relative position calculator.


SunRelativePosition

public SunRelativePosition(double twilight)
                    throws java.lang.IllegalArgumentException
Constructs a sun relative position calculator with the specified value for the sun elevation at twilight.

Parameters:
twilight - The new sun elevation at twilight, or Double.NaN if no twilight value should be taken in account.
Throws:
java.lang.IllegalArgumentException - if the twilight value is illegal.
Method Detail

setCoordinate

public void setCoordinate(double longitude,
                          double latitude)
Set the geographic coordinate where to compute the elevation and azimuth.

Parameters:
longitude - The longitude in degrees. Positive values are East; negative values are West.
latitude - The latitude in degrees. Positive values are North, negative values are South.

setCoordinate

public void setCoordinate(java.awt.geom.Point2D point)
Set the geographic coordinate where to compute the elevation and azimuth.

Parameters:
point - The geographic coordinates in degrees of longitude and latitude.

getCoordinate

public java.awt.geom.Point2D getCoordinate()
Returns the coordinate used for elevation and azimuth computation. This is the coordinate specified during the last call to a setCoordinate(...) method.


setDate

public void setDate(java.util.Date date)
Set the date and time when to compute the elevation and azimuth.

Parameters:
date - The date and time.

getDate

public java.util.Date getDate()
Returns the date used for elevation and azimuth computation. This is the date specified during the last call to setDate(java.util.Date).


setTwilight

public void setTwilight(double twilight)
                 throws java.lang.IllegalArgumentException
Set the sun's elevation angle at twilight, in degrees. Common values are defined for the astronomical twilight (-18?), nautical twilight (-12?) and civil twilight (-6?). The elevation and azimuth are set to NaN when the sun elevation is below the twilight value (i.e. during night). The default value is CIVIL_TWILIGHT.

Parameters:
twilight - The new sun elevation at twilight, or Double.NaN if no twilight value should be taken in account.
Throws:
java.lang.IllegalArgumentException - if the twilight value is illegal.

getTwilight

public double getTwilight()
Returns the sun's elevation angle at twilight, in degrees. This is the value set during the last call to setTwilight(double).


getAzimuth

public double getAzimuth()
Retourne l'azimuth en degr?s.

Returns:
L'azimuth en degr?s.

getElevation

public double getElevation()
Retourne l'?l?vation en degr?s.

Returns:
L'?l?vation en degr?s.

getNoonTime

public long getNoonTime()
Retourne l'heure ? laquelle le soleil est au plus haut. L'heure est retourn?e en nombre de millisecondes ?coul?es depuis le debut de la journ?e (minuit) en heure UTC.


getNoonDate

public java.util.Date getNoonDate()
Retourne la date ? laquelle le soleil est au plus haut dans la journ?e. Cette m?thode est ?quivalente ? getNoonTime() mais inclue le jour de la date qui avait ?t? sp?cifi?e ? la m?thode #compute.


main

public static void main(java.lang.String[] args)
                 throws java.text.ParseException
Affiche la position du soleil ? la date et coordonn?es sp?cifi?e. Cette application peut ?tre lanc?e avec la syntaxe suivante:
SunRelativePosition [longitude] [latitude] [date]
o? date est un argument optionel sp?cifiant la date et l'heure. Si cet argument est omis, la date et heure actuelles seront utilis?es.

Throws:
java.text.ParseException


Copyright © GeoTools. All Rights Reserved.