Jump to: navigation, search
Translate-icon-55px.svg Localization

Warning: If your screen doesn't look like these screen-shots (for example, if you don't have the indicated version as displayed in the "About" tab), your version of Sunrise is not up-to-date.

Sunrise / Sunset / Moonrise / Moonset Predictor Activity

This activity will display a table of the time of day for the rising and setting of the sun and the moon over a period of seven days. It also displays a chart which predicts the hours of astronomical darkness for each of the days.

You may specify a location (longitude, latitude and time zone offset from GMT) and the starting date that you wish to have a table created for. Alternatively, you can get a table calculated for the week beginning with the current day.


The latest version (identified as "Version 2, build 8") can be downloaded from here.

This version has been tested and confirmed to function on OLPC O/S release 8.2.0 (767) and 8.2.1 (802).


Please add comments on the "discussion" page associated with this article.

Where's the source code?
This activity is coded entirely in Python. Therefore, the source for the activity is distributed as part of the .XO file and can (with any tool that understands the compressed format of .XO files, e.g.: WinZip for the PC) be extracted directly from the bundle.

Disclaimer: there will be bugs
This is the second "beta" release. It functions and has most of the intended features but it still may contain cosmetic bugs. And the algorithms generate times that are precise to the minute but only accurate to about five minutes -- which is pretty poor. Please see the bug tracking page for the list of known bugs or to report a bug.


Sunrise was created by a professional programmer and amateur astronomer who likes to vacation in places far removed from his home town and appreciates the opportunity to view the sky from these places. The XO is a wonderful travel accessory for supporting this sort of thing since it is light, compact and frugal of battery power while providing a reasonably large, reasonably high resolution color display.

This Activity is intended to support the star-gazer who has no instrument better than his own eyes. If one uses the rule-of-thumb that the sky is dark enough for astronomy from one hour after sunset to one hour before sunrise, the table this activity generates can be used to plan an observing session. By noting the time of moonrise and moonset, you can additionally plan for lunar observing. The activity also provides a sky darkness chart so you can tell when the night sky will be maximally dark.

The current version of this activity is "Version 2 (build 8) of 2010.09.24.1630 UT", which can be confirmed by using the "About" feature. See the change log page for revision history.

Before you begin

Be sure your XO has been set to the correct time-zone offset and the correct local time! The astronomical algorithms need to compute GMT (UT) and can't do that if "now" isn't the right time. (This is only an issue if you don't plan to always use "specify date". But it's still an untidy way to operate your computer.)

Installation and set-up

For best results, remove any previous version of Sunrise you may have installed. Re-start X (hit Ctrl-Alt-Backspace). Then, simply follow the usual procedure for downloading and installing an Extra Activity.

Once you have installed Sunrise, start it and select the "When" menu tab.

SunriseActivity -- Date

Is the date (YYYY/MM/DD) the correct year, month and day for your location? If not, stop the activity and correct your time and time-zone using the Sugar control panel before proceeding.

If the date is correct, the chart will be the times for a location in Massachusetts, USA as of right now. If you don't happen to be in that location, you will need to enter your longitude and latitude and time-zone offset. Click on "where" to display the controls for doing this. You should be able to get your coordinates from any good map, Google Earth or simply use the published coordinates for any relatively nearby city or town. Another possibility is from a site on the internet such as which provides a map with latitude and longitude information from which you can interpolate your specific coordinates.

Don't be obsessive about the precision for this: the table will not look noticibly different if you are wrong by one or two degrees either way in latitude or longitude. Being off 100 km won't make enough of a difference to show. But be sure you select East or West longitude and North or South latitude! Then click "Ok" so the program knows you really want to change these settings.

Now I'd recommend clicking the "Make Home" button. Sunrise will save this location as your "home" position. From now on, whenever you start the activity the location will default to these coordinates.

How to read the table

The table entries are fairly obvious except for two things: First, if the moon or the sun does not rise or does not set during the indicated day, the appropriate column will have dashes instead of a time. Second, it is possible for the table to show the time for setting of the moon as earlier than the time for rising of the moon. This is not a bug; since the moon moves eastward through the day with respect to the fixed stars, the time between moonrise on one day and moonrise on the next can be more than 24 hours. That causes moonset to sometimes occur earlier in the day than moonrise.

The last column of the table, "Astronomical Darkness", gives a graphical representation of the darkness of the sky. There are 24 colored squares in the graph, one for each hour of the day starting at midnight and going through the hour that begins at 11 PM. Each square can have one of four colors:

  • black represents maximum darkness; neither the sun nor the moon is above your horizon.
  • dark blue represents moonlit night; the moon is above your horizon.
  • light blue represents twilight; the sun is almost above your horizon.
  • cyan represents daylight; the sun is above your horizon

For astronomical purposes, dark blue or black is nice (black being the best) but even light blue might be okay for observing planets if your local weather is very clear.

Operating instructions

The initial display for Sunrise will show the times for your locale and the current date. (This assumes you have done the steps described above in "Installation and set-up".)


Note that there are four menu tabs: "Activity", "Where", "When", and "About". "Activity" is pretty much the same as any other activity's "Activity" tab except that Sunrise does not yet support collaboration so the "Share" control is missing. Let's look at each of the other tabs in order...

The "Where" menu controls

You can change your location with this set of controls.

Sunrise - Location

The first field is the longitude. You may specify longitude as degrees, minutes and seconds (as shown) or as degrees-and-fraction using a floating-point number. The radio buttons let you select east or west longitude -- be sure to select the correct direction!

The next field is the latitude. Again, this can be DMS or D.FFF form. The radio buttons select north or south latitude.

The last field specifies the number of hours and minutes by which the locale's time-zone differs from GMT. Negative values are usually associated with west longitude locations; positive values with east longitude.

The radio buttons "Ok" and "Make Home" both will set the location to the new values. "Make Home" additionally saves these settings as the default location for future sessions.

Here we set the location and time zone offset to Honolulu, Hawaii:

Sunrise - Setting Location

The "When" menu controls

This set of controls lets you specify which seven day period you want the table generated for.

Sunrise - Date

The radio buttons specify generating the table for the seven days beginning with today or the seven days beginning with the specified date. The date field uses a Year / Month / Day format (be sure to specify a four-digit year and two-digit month and day values). Clicking the "Ok" button applies the change.

Here we specify generating a table for the seven days beginning on September 2nd, 2010.

Sunrise - Setting Date

The "About" menu controls

This menu tab merely displays the program's version identification and the URL for this wiki page.

Sunrise - About

Error messages

Sunrise will detect errors if you make a mistake when specifying a location on the "Where" tab or a date on the "When" tab. If you enter something in the longitude or latitude that Sunrise doesn't understand and click the "Ok" or "Make Home" button, Sunrise will display a message in the normally empty line above the table header:

Location input error - Longitude


Location input error - Latitude

Sunrise will restore the longitude and latitude settings to the default (your home location, if specified or 0,0) values. You may try again or simply click "Ok" again to confirm that you want to keep the good settings after all.

If you mess up the timezone offset setting, you get this message in the line above the table:

Location input error - Time Zone Offset

and Sunrise resets the zone offset to the default.

Sunrise will also detect errors with the date setting.

Date input error

In this event, Sunrise will reset the date to the current local day.


  • The program usually takes about ten seconds to generate the table, during which time nothing appears to be happening. Be patient.
  • Accuracy at high latitudes may be worse than at middle and low latitudes. Additionally, computation can take longer at high latitudes.

Revision history

Plese see the change-log page.

Reporting bugs

To report a bug or to see what bugs have been reported and/or fixed, please go to the bug tracking page.

Activity Summary

Icon: Sugar icon::Image:Sunrise.svg
Genre: Activity genre::Math and Science
Activity group: ,|x|Activity group::x}}
Short description: Short description::Sunrise Predictor Activity
Description: Description::This activity will display a chart of the times for rising and setting of the sun and the moon for a specified location on Earth and for a specified seven-day period.
Maintainers: ,|x|Contact person::x}}
Repository URL: Source code::
Available languages: ,|x|Available languages::x}}
Available languages (codes): ,|x|Language code::x}}
Pootle URL:
Related projects: Related projects,|x|Related projects::x}}
Contributors: ,|x|Team member::x}}
URL from which to download the latest .xo bundle Activity bundle::
Last tested version number: Activity version::1
The releases with which this version of the activity has been tested. ,|x|Software release::x}}
Development status: Devel status::4. Beta
Ready for testing (development has progressed to the point where testers should try it out): ,|x|Ready for testing::x}}
smoke tested :
test plan available :
test plan executed :
developer response to testing :