Home | | Science | | Solar Computer | | Share This Page |
A recently updated, interactive JavaScript application that computes
sunrise/sunset/day length for any location on Earth.
Solar Computer provides an easy way to compute sunrise and sunset times, and some other useful values, for any date and geographical location.
This version of Solar Computer is the most recent in a series of programs I have written over the years to provide a variety of useful solar computations. This version is written in JavaScript and replaces an older Java page (archived here). I replaced the old version because many people have requested a more flexible data source that can produce a table of values covering a year, rather than just one day. Also, over time there have been many changes in Java that had the side effect of preventing older programs from running properly. This is something that should never happen to a computer language, but it does happen, regularly, ultimately disabling any computer programs that are not rewritten over and over again to keep up with arbitrary changes in the language.
The new version is quite easy to use. Detailed documentation is provided below, but for those who want a quick result, here is how to proceed:
To copy the generated yearly data table, click on the table display, press Ctrl+A (select all), then Ctrl+C (copy). The data table will then be located on the system clipboard, suitable for pasting into a spreadsheet or database file.
Again, complete documentation and technical notes for Solar Computer are located here.
Solar Computer is released under the GPL.
Select a location with this map (powered by OpenStreetMap and Leaflet): Show topographic features
Awaiting network location ...
(your browser may ask your permission
Solar position computation relies on a mathematical model of the sun-earth orbital system. There are several factors that make this computation somewhat complex, among which are the eccentricity of Earth's orbit and Earth's axial tilt that is responsible for the seasons. After the sun's position relative to the Earth has been computed for a given date, one must then acquire a relative position based on a specified geographical location. This set of computations relies on a number of methods including Fourier series and three-dimensional trigonometry. It is important to note that an observer who views a sunrise or sunset normally is looking through Earth's atmosphere, which has optical properties not unlike a lens. This lens effect causes the sun's apparent position to differ from its computed position, and this lens effect must be taken into account in predicting a sunrise or sunset as seen by an observer. Unfortunately, a solar prediction must necessarily assume average atmospheric conditions, and there will be times when the sun's apparent position differs from the prediction. This variation may typically cause an error of several minutes in the time of an observed sunrise or sunset. Also, computation of sunrise and sunset times assumes an observer is looking toward a level horizon that is at the same altitude as the observer, something that is rarely true. The only place in the author's experience where sunrises and sunsets reliably take place near predicted times is while sailing on the open ocean — and even then, abnormal atmospheric conditions sometimes prevent an accurate prediction.Data Categories
The solar computer provides four classes of predictions for different purposes:Data Entry Notes
Name Sun's Distance Below Horizon Definition Sunrise/Sunset 0° 50' In normal conditions of of atmospheric refraction, the sun's upper limb appears to be touching the horizon. Civil Twilight 6° The time after which city streetlights are lit, automobiles begin using headlights, in general, the time after which we begin to use artificial light. Nautical Twilight 12° The best time for a sailor to use a sextant to take a star sight — the horizon is still visible, and many navigational stars are also visible. Earlier, some important navigational stars will not be visible. Later, the horizon becomes too difficult to see through the sextant. Astronomical Twilight 18° After this time, the sky is dark enough for astronomers to make productive use of powerful telescopes. Only the faintest glow is visible near the sun's position.
There are a number of different angular notation conventions in current use, and Solar Computer will easily accommodate most of them. If the user has a geographic location expressed in degrees and decimal degrees (no minutes or seconds), he can type these values into the "Degrees" entry and disregard the "Minutes" and "Seconds" entries. Another popular data format, used widely in GPS receivers, is degrees, minutes and decimal minutes (no seconds). Enter this in much the same way — enter the degree value, then enter the minutes and decimal minutes value into the "Minutes" entry, skipping the "Seconds" entry. Because of this flexible entry arrangement, the user should never have to convert any of the common geographical coordinate notations into a different form while using Solar Computer.High Latitude Notes
For locations near or within the Arctic and Antarctic circles, there are dates when no sunrise or sunset take place (the sun is continually above or below the horizon). Solar Computer will indicate this with special labels — "[Above]" or "[Below]" — instead of times, for dates where the computation could not produce meaningful results.Reusable Entries
Because a user may want to re-use an entered geographical location and option settings, Solar Computer saves these entries between uses. This means a visitor can return to this page and compute sunrise and sunset times for a new date with a previously entered geographic location and option settings.Database Table Export Notes
To export the most portable and useful database table, be sure to use 24 hour time formatting, rather than AM/PM. The database table created by this page uses industry-standard record formatting (comma separated values) and standard date syntax, thus it can be imported directly into many database programs without change. To save the database table, click the table display, press Ctrl+A to select the entire table, then press Ctrl+C to copy the table onto the system clipboard. The copied table can be pasted into a plain text file that, in turn, can be imported into a database program or spreadsheet. This clipboard export procedure is required because JavaScript cannot save files directly, although in every other respect JavaScript turns out to be the most convenient way to provide this data resource.
Home | | Science | | Solar Computer | | Share This Page |