Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. SunCalc
  2. =======
  3. [![Build Status](https://travis-ci.org/mourner/suncalc.svg?branch=master)](https://travis-ci.org/mourner/suncalc)
  4. SunCalc is a tiny BSD-licensed JavaScript library for calculating sun position,
  5. sunlight phases (times for sunrise, sunset, dusk, etc.),
  6. moon position and lunar phase for the given location and time,
  7. created by [Vladimir Agafonkin](http://agafonkin.com/en) ([@mourner](https://github.com/mourner))
  8. as a part of the [SunCalc.net project](http://suncalc.net).
  9. Most calculations are based on the formulas given in the excellent Astronomy Answers articles
  10. about [position of the sun](http://aa.quae.nl/en/reken/zonpositie.html)
  11. and [the planets](http://aa.quae.nl/en/reken/hemelpositie.html).
  12. You can read about different twilight phases calculated by SunCalc
  13. in the [Twilight article on Wikipedia](http://en.wikipedia.org/wiki/Twilight).
  14. ## Usage example
  15. ```javascript
  16. // get today's sunlight times for London
  17. var times = SunCalc.getTimes(new Date(), 51.5, -0.1);
  18. // format sunrise time from the Date object
  19. var sunriseStr = times.sunrise.getHours() + ':' + times.sunrise.getMinutes();
  20. // get position of the sun (azimuth and altitude) at today's sunrise
  21. var sunrisePos = SunCalc.getPosition(times.sunrise, 51.5, -0.1);
  22. // get sunrise azimuth in degrees
  23. var sunriseAzimuth = sunrisePos.azimuth * 180 / Math.PI;
  24. ```
  25. SunCalc is also available as an NPM package:
  26. ```bash
  27. $ npm install suncalc
  28. ```
  29. ```js
  30. var SunCalc = require('suncalc');
  31. ```
  32. ## Reference
  33. ### Sunlight times
  34. ```javascript
  35. SunCalc.getTimes(/*Date*/ date, /*Number*/ latitude, /*Number*/ longitude)
  36. ```
  37. Returns an object with the following properties (each is a `Date` object):
  38. | Property | Description |
  39. | --------------- | ------------------------------------------------------------------------ |
  40. | `sunrise` | sunrise (top edge of the sun appears on the horizon) |
  41. | `sunriseEnd` | sunrise ends (bottom edge of the sun touches the horizon) |
  42. | `goldenHourEnd` | morning golden hour (soft light, best time for photography) ends |
  43. | `solarNoon` | solar noon (sun is in the highest position) |
  44. | `goldenHour` | evening golden hour starts |
  45. | `sunsetStart` | sunset starts (bottom edge of the sun touches the horizon) |
  46. | `sunset` | sunset (sun disappears below the horizon, evening civil twilight starts) |
  47. | `dusk` | dusk (evening nautical twilight starts) |
  48. | `nauticalDusk` | nautical dusk (evening astronomical twilight starts) |
  49. | `night` | night starts (dark enough for astronomical observations) |
  50. | `nadir` | nadir (darkest moment of the night, sun is in the lowest position) |
  51. | `nightEnd` | night ends (morning astronomical twilight starts) |
  52. | `nauticalDawn` | nautical dawn (morning nautical twilight starts) |
  53. | `dawn` | dawn (morning nautical twilight ends, morning civil twilight starts) |
  54. ```javascript
  55. SunCalc.addTime(/*Number*/ angleInDegrees, /*String*/ morningName, /*String*/ eveningName)
  56. ```
  57. Adds a custom time when the sun reaches the given angle to results returned by `SunCalc.getTimes`.
  58. `SunCalc.times` property contains all currently defined times.
  59. ### Sun position
  60. ```javascript
  61. SunCalc.getPosition(/*Date*/ timeAndDate, /*Number*/ latitude, /*Number*/ longitude)
  62. ```
  63. Returns an object with the following properties:
  64. * `altitude`: sun altitude above the horizon in radians,
  65. e.g. `0` at the horizon and `PI/2` at the zenith (straight over your head)
  66. * `azimuth`: sun azimuth in radians (direction along the horizon, measured from south to west),
  67. e.g. `0` is south and `Math.PI * 3/4` is northwest
  68. ### Moon position
  69. ```javascript
  70. SunCalc.getMoonPosition(/*Date*/ timeAndDate, /*Number*/ latitude, /*Number*/ longitude)
  71. ```
  72. Returns an object with the following properties:
  73. * `altitude`: moon altitude above the horizon in radians
  74. * `azimuth`: moon azimuth in radians
  75. * `distance`: distance to moon in kilometers
  76. * `parallacticAngle`: parallactic angle of the moon in radians
  77. ### Moon illumination
  78. ```javascript
  79. SunCalc.getMoonIllumination(/*Date*/ timeAndDate)
  80. ```
  81. Returns an object with the following properties:
  82. * `fraction`: illuminated fraction of the moon; varies from `0.0` (new moon) to `1.0` (full moon)
  83. * `phase`: moon phase; varies from `0.0` to `1.0`, described below
  84. * `angle`: midpoint angle in radians of the illuminated limb of the moon reckoned eastward from the north point of the disk;
  85. the moon is waxing if the angle is negative, and waning if positive
  86. Moon phase value should be interpreted like this:
  87. | Phase | Name |
  88. | -----:| --------------- |
  89. | 0 | New Moon |
  90. | | Waxing Crescent |
  91. | 0.25 | First Quarter |
  92. | | Waxing Gibbous |
  93. | 0.5 | Full Moon |
  94. | | Waning Gibbous |
  95. | 0.75 | Last Quarter |
  96. | | Waning Crescent |
  97. By subtracting the `parallacticAngle` from the `angle` one can get the zenith angle of the moons bright limb (anticlockwise).
  98. The zenith angle can be used do draw the moon shape from the observers perspective (e.g. moon lying on its back).
  99. ### Moon rise and set times
  100. ```js
  101. SunCalc.getMoonTimes(/*Date*/ date, /*Number*/ latitude, /*Number*/ longitude[, inUTC])
  102. ```
  103. Returns an object with the following properties:
  104. * `rise`: moonrise time as `Date`
  105. * `set`: moonset time as `Date`
  106. * `alwaysUp`: `true` if the moon never rises/sets and is always _above_ the horizon during the day
  107. * `alwaysDown`: `true` if the moon is always _below_ the horizon
  108. By default, it will search for moon rise and set during local user's day (frou 0 to 24 hours).
  109. If `inUTC` is set to true, it will instead search the specified date from 0 to 24 UTC hours.
  110. ## Changelog
  111. #### 1.8.0 — Dec 22, 2016
  112. - Improved precision of moonrise/moonset calculations.
  113. - Added `parallacticAngle` calculation to `getMoonPosition`.
  114. - Default to today's date in `getMoonIllumination`.
  115. - Fixed incompatibility when using Browserify/Webpack together with a global AMD loader.
  116. #### 1.7.0 — Nov 11, 2015
  117. - Added `inUTC` argument to `getMoonTimes`.
  118. #### 1.6.0 — Oct 27, 2014
  119. - Added `SunCalc.getMoonTimes` for calculating moon rise and set times.
  120. #### 1.5.1 — May 16, 2014
  121. - Exposed `SunCalc.times` property with defined daylight times.
  122. - Slightly improved `SunCalc.getTimes` performance.
  123. #### 1.4.0 — Apr 10, 2014
  124. - Added `phase` to `SunCalc.getMoonIllumination` results (moon phase).
  125. - Switched from mocha to tape for tests.
  126. #### 1.3.0 — Feb 21, 2014
  127. - Added `SunCalc.getMoonIllumination` (in place of `getMoonFraction`) that returns an object with `fraction` and `angle`
  128. (angle of illuminated limb of the moon).
  129. #### 1.2.0 — Mar 07, 2013
  130. - Added `SunCalc.getMoonFraction` function that returns illuminated fraction of the moon.
  131. #### 1.1.0 — Mar 06, 2013
  132. - Added `SunCalc.getMoonPosition` function.
  133. - Added nadir (darkest time of the day, middle of the night).
  134. - Added tests.
  135. #### 1.0.0 — Dec 07, 2011
  136. - Published to NPM.
  137. - Added `SunCalc.addTime` function.
  138. #### 0.0.0 — Aug 25, 2011
  139. - First commit.