1 | throw new Error("Description for built in functions. Must not be included!");
|
---|
2 | /**
|
---|
3 | * @fileOverview
|
---|
4 | * Documentation of Sun class built into dimctrl.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * @class
|
---|
9 | *
|
---|
10 | * @author <a href="mailto:thomas.bretz@epfl.ch">Thomas Bretz</a>
|
---|
11 | */
|
---|
12 | var Sun = { };
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Calculate sun rise, set and transit times.
|
---|
16 | *
|
---|
17 | * Calculates the sun's rise and set time, above and below horizon,
|
---|
18 | * and the time of culmination (transit time) for the given time.
|
---|
19 | * As a second argument the angle abov or below horizon of interest
|
---|
20 | * can be provided. The calculation is done using libnova's
|
---|
21 | * ln_get_solar_rst_horizon and is always performed for the FACT
|
---|
22 | * site at La Palma.
|
---|
23 | *
|
---|
24 | * @param {Number,String} [angle=null]
|
---|
25 | * Angle above (positive) or below (negative) horizon. The
|
---|
26 | * angle can be given as Number in degree or as string referring to
|
---|
27 | * "horizon" (0deg), "civil" (-6deg), "nautical" (-12deg),
|
---|
28 | * "fact" (-15deg), "astronomical" (-18deg). Strings can be abbreviated
|
---|
29 | * down to "h", "c", "n", "f" and "a". If the argument is omitted or
|
---|
30 | * null, a value referring to the appearance or the disappearance of
|
---|
31 | * the Sun's disk at horizon is chosen (~-0.8deg).
|
---|
32 | *
|
---|
33 | * @param {Date} [time=new Date()]
|
---|
34 | * Date for which the times should be calculated. Note that the date
|
---|
35 | * is converted to UTC and the times are calculated such that the
|
---|
36 | * Date (yy/mm/dd) is identical for all returned values.
|
---|
37 | *
|
---|
38 | * @type {Object}
|
---|
39 | *
|
---|
40 | * @returns
|
---|
41 | * An object with the following properties is returned: time {Date}
|
---|
42 | * the provided time; rise, transit, set {Date} times of rise, set and
|
---|
43 | * transit; horizon {Number} the angle used for the calculation;
|
---|
44 | * isUp {Boolean} whether the sun is above or below the given horizon
|
---|
45 | * at th given time. If the sun does not rise or set, the properties
|
---|
46 | * rise, transit and set will be undefined, isUp will refer to
|
---|
47 | * the fact whether the sun is the whole day above or below the
|
---|
48 | * horizon (0deg).
|
---|
49 | *
|
---|
50 | * @example
|
---|
51 | * var date = new Date("2012-10-25 16:30 GMT"); // Date in UTC
|
---|
52 | * console.out(JSON.stringify(Sun.horizon());
|
---|
53 | * console.out(JSON.stringify(Sun.horizon("astro"));
|
---|
54 | * console.out(JSON.stringify(Sun.horizon(-12, date); // nautical
|
---|
55 | */
|
---|
56 | Sun.horizon = function() { /* [native code] */ }
|
---|