|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectSunRelativePosition
public class SunRelativePosition
Computes Sun apparent position relative to an observer on Earth. This class expects spatio-temporal coordinate input as below:
The calculated Sun position contains:
|
![]() |
Reference
This class is an adaptation of the
Solar Position Calculator
written in JavaScript by the National Oceanic and Atmospheric Administration (NOAA),
Surface Radiation Research Branch.
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.
| analytics/geotk-nature (download) | View source code for this class |
| 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()
Computes and returns the azimuth. |
Point2D |
getCoordinate()
Returns the coordinate used for elevation and azimuth computation. |
Date |
getDate()
Returns the date used for elevation and azimuth computation. |
double |
getElevation()
Computes and returns the elevation. |
Date |
getNoonDate()
Returns the date and time at which the Sun is at its highest during a day. |
long |
getNoonTime()
Returns the time at which the Sun is at its highest during a day. |
double |
getTwilight()
Returns the sun's elevation angle at twilight, in degrees. |
static void |
main(String[] args)
Prints the Sun position at the given coordinates and date. |
void |
setCoordinate(double longitude,
double latitude)
Sets the geographic coordinate where to compute the elevation and azimuth. |
void |
setCoordinate(Point2D point)
Sets the geographic coordinate where to compute the elevation and azimuth. |
void |
setDate(Date date)
Sets the date and time when to compute the elevation and azimuth. |
void |
setTwilight(double twilight)
Sets the sun's elevation angle at twilight, in degrees. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double ASTRONOMICAL_TWILIGHT
public static final double NAUTICAL_TWILIGHT
public static final double CIVIL_TWILIGHT
| Constructor Detail |
|---|
public SunRelativePosition()
public SunRelativePosition(double twilight)
throws IllegalArgumentException
twilight - The new sun elevation at twilight, or Double.NaN
if no twilight value should be taken in account.
IllegalArgumentException - if the twilight value is illegal.| Method Detail |
|---|
public void setCoordinate(double longitude,
double latitude)
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.public void setCoordinate(Point2D point)
point - The geographic coordinates in degrees of longitude and latitude.public Point2D getCoordinate()
setCoordinate(...) method.
public void setDate(Date date)
date - The date and time (GMT).public Date getDate()
setDate(Date).
public void setTwilight(double twilight)
throws IllegalArgumentException
CIVIL_TWILIGHT.
twilight - The new sun elevation at twilight, or Double.NaN
if no twilight value should be taken in account.
IllegalArgumentException - if the twilight value is illegal.public double getTwilight()
setTwilight(double).
public double getAzimuth()
public double getElevation()
public long getNoonTime()
public Date getNoonDate()
getNoonTime() except that the day is included
in the returned date.
public static void main(String[] args)
throws ParseException
where date is an optional argument specifying the date and time in thejava org.geotoolkit.nature.SunRelativePosition [longitude] [latitude] [date]
"yyyy-MM-dd HH:mm:ss" format, UTC time zone. If this argument is omitted,
then the current time is used.
args - The command line argument.
ParseException - If the date or an ordinate is not properly formatted.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||