views:

168

answers:

2

Is it possible to calculate Dawn, Dusk, and sunset times using PyEphem? I've used PyEphem to produce day and night time, but I didn't find anything on sunset/dusk/dawn

+3  A: 

You could try to set the horizon parameter below the horizon according to the different definitions of dusk/dawn.

biocs
+5  A: 

For dawn amd dusk, see pyephem documentation regarding twilight
In a nutshell, dawn and dusk express the time when the center of the Sun is at a particular angle below the horizon; the angle used for this calculation varies for the definition of the "civilian", navigation (nautical) and astronomical twilights which use 6, 12 and 18 degrees respectively.

In opposition the sunrise corresponds to the time when the edge of the Sun appears (or disappears, for sunset) just above/below the horizon (0 degree). Hence everybody, civilians, sailors and astronomy enthusiasts alike get the same rise/set times. (see Naval Observatory risings and settings in pyephem documentation).

To summarize, once one has properly parametrized an pyephem.Observer (setting its lat, long, date, time, pressure (? for altitude?), etc.), the various twilight times (dawn, dusk) and the sunrise and sunset times are obtained from the
Observer.previous_rising() and Observer.next_setting() methods,
  whereby   the first argument is ephem.Sun() and
  the use_center= argument needs to be set to True for twilight calculations, and
  the horizon is either 0 (or 0:34 if you account for refraction of the atmosphere) or -6, -12 or -18.

mjv