Namespace Sun
Namespace for functions returning astrometry information about the Sun.
Defined in: Sun.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
Sun.horizon(angle, time)
Calculate sun rise, set and transit times.
|
Method Detail
<static>
Sun.horizon(angle, time)
Calculate sun rise, set and transit times.
Calculates the sun's rise and set time, above and below horizon,
and the time of culmination (transit time) for the given time.
As a second argument the angle abov or below horizon of interest
can be provided. The calculation is done using libnova's
ln_get_solar_rst_horizon and is always performed for the FACT
site at La Palma.
var date = new Date("2012-10-25 16:30 GMT"); // Date in UTC console.out(JSON.stringify(Sun.horizon()); console.out(JSON.stringify(Sun.horizon("astro")); console.out(JSON.stringify(Sun.horizon(-12, date); // nautical
- Parameters:
- {Number|String} angle Optional, Default: null
- Angle above (positive) or below (negative) horizon. The angle can be given as Number in degree or as string referring to "horizon" (0deg), "civil" (-6deg), "nautical" (-12deg), "fact" (-15deg), "astronomical" (-18deg). Strings can be abbreviated down to "h", "c", "n", "f" and "a". If the argument is omitted or null, a value referring to the appearance or the disappearance of the Sun's disk at horizon is chosen (~-0.8deg).
- {Date} time Optional, Default: new Date()
- Date for which the times should be calculated. Note that the date is converted to UTC and the times are calculated such that the Date (yy/mm/dd) is identical for all returned values.
- Returns:
- An object with the following properties is returned: time {Date} the provided time; rise, transit, set {Date} times of rise, set and transit; horizon {Number} the angle used for the calculation; isUp {Boolean} whether the sun is above or below the given horizon at th given time. If the sun does not rise or set, the properties rise, transit and set will be undefined, isUp will refer to the fact whether the sun is the whole day above or below the horizon (0deg).