Package org.geotools.nature
Class SunRelativePosition
- Object
-
- SunRelativePosition
-
public class SunRelativePosition extends 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:
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
- La longitude (en degrées) de l'observateur;
- La latitude (en degrées) de l'observateur;
- La date et heure en heure universelle (GMT).
- 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).

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
- Author:
- Remi Eve, Martin Desruisseaux (IRD)
-
-
Field Summary
Fields Modifier and Type Field Description static doubleASTRONOMICAL_TWILIGHTElevation angle of astronomical twilight, in degrees.static doubleCIVIL_TWILIGHTElevation angle of civil twilight, in degrees.static doubleNAUTICAL_TWILIGHTElevation angle of nautical twilight, in degrees.
-
Constructor Summary
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetAzimuth()Retourne l'azimuth en degrés.Point2DgetCoordinate()DategetDate()doublegetElevation()Retourne l'élévation en degrés.DategetNoonDate()Retourne la date à laquelle le soleil est au plus haut dans la journée.longgetNoonTime()Retourne l'heure à laquelle le soleil est au plus haut.doublegetTwilight()Returns the sun's elevation angle at twilight, in degrees.static voidmain(String... args)Affiche la position du soleil à la date et coordonnées spécifiée.voidsetCoordinate(double longitude, double latitude)voidsetCoordinate(Point2D point)voidsetDate(Date date)voidsetTwilight(double twilight)Set the sun's elevation angle at twilight, in degrees.
-
-
-
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 IllegalArgumentExceptionConstructs a sun relative position calculator with the specified value for the sun elevation at twilight.- Parameters:
twilight- The new sun elevation at twilight, orDouble.NaNif no twilight value should be taken in account.- Throws:
IllegalArgumentException- if the twilight value is illegal.
-
-
Method Detail
-
setCoordinate
public void setCoordinate(double longitude, double latitude)- 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(Point2D point)
- Parameters:
point- The geographic coordinates in degrees of longitude and latitude.
-
getCoordinate
public Point2D getCoordinate()
Returns the coordinate used for elevation and azimuth computation. This is the coordinate specified during the last call to asetCoordinate(...)method.
-
setDate
public void setDate(Date date)
- Parameters:
date- The date and time.
-
getDate
public Date getDate()
Returns the date used for elevation and azimuth computation. This is the date specified during the last call tosetDate(java.util.Date).
-
setTwilight
public void setTwilight(double twilight) throws IllegalArgumentExceptionSet 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 isCIVIL_TWILIGHT.- Parameters:
twilight- The new sun elevation at twilight, orDouble.NaNif no twilight value should be taken in account.- Throws:
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 tosetTwilight(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 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éthodecompute().
-
main
public static void main(String... args) throws 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:
ParseException
-
-