import ephembelgium = ephem.Observer()belgium.date = '2015/12/11'belgium.lat = '51:0.4'belgium.lon = '3:6.6'belgium.elevation = 28sun = ephem.Sun()print "Times using ephem (UTC):"print "sunrise: ", belgium.next_rising(sun)print "transit: ", belgium.next_transit(sun)print "sunset: ", belgium.next_setting(sun)# ---------import osimport timefrom weewx.almanac import Almanacos.environ['TZ'] = 'Europe/Brussels'tt = (2015,12,11,0,0,0,0,0,-1)ts = time.mktime(tt)almanac = Almanac(ts, 51, 3.1)print "Times using Almanac (local time):"print "sunrise:", almanac.sun.riseprint "transit:", almanac.sun.transitprint "sunset: ", almanac.sun.set
Times using ephem (UTC):sunrise: 2015/12/11 07:39:44transit: 2015/12/11 11:40:39sunset: 2015/12/11 15:41:23Times using Almanac (local time):sunrise: 08:39transit: 12:40sunset: 16:41
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Times using ephem (UTC):sunrise: 2015/12/11 07:39:44transit: 2015/12/11 11:40:39sunset: 2015/12/11 15:41:23Times using Almanac (local time):sunrise: 08:39transit: 12:40sunset: 16:41
Times using my code (local time):Start of twiglight: 07:59sunrise: 07:58sunset: 07:58End of twiglight: 17:21
| Machine 1 (ReadyNAS) | |||||
Sunrise: 08:20:01 AM Sunset: 04:01:55 PM
|
Can you post the coordinates used on both servers?
If you installed 3.3.0 or 3.3.1 wee_debug should be in /usr/share/weewx or /home/weewx/bin depending on your weewx install type. If for some reason it is not there you can pull it down direct from the weewx GitHub site. Getting individual files from GitHub is not too intuitive though, an alternative is to search the forums for wee_debug; I included the file in a post in late November.
Gary
Bram,If you installed 3.3.0 or 3.3.1 wee_debug should be in /usr/share/weewx or /home/weewx/bin depending on your weewx install type. If for some reason it is not there you can pull it down direct from the weewx GitHub site. Getting individual files from GitHub is not too intuitive though, an alternative is to search the forums for wee_debug; I included the file in a post in late November.
#### this is based on rhodesmill.org/pyephem/rise-set.htmlimport ephematlanta = ephem.Observer()atlanta.pressure = 0atlanta.horizon = '-0:34'atlanta.lat, atlanta.lon = '33.8', '-84.4'atlanta.date = '2009/09/06 17:00' # noon ESTprint ""print "sun previous_rising 2009/9/6 11:14:57"print " ", atlanta.previous_rising(ephem.Sun())print ""print "sun next_setting 2009/9/6 23:56:10"print " ", atlanta.next_setting(ephem.Sun())print ""print "--- use civil twilight ---"print ""atlanta.horizon = '-6' # civil twilight = -6 deg# nautical = -12# astronomical = -18print "sun previous_rising 2009/9/6 10:49:40"print " ", atlanta.previous_rising(ephem.Sun(), use_center=True)print ""print "sun next_rising 2009/9/7 00:21:23"print " ", atlanta.next_setting(ephem.Sun(), use_center=True)
- I noticed that in my personal code (written for version 2.6.x) I used the syntax almanac.sunrise and almanac.sunset. When I print those right after your example code I get the wrong result as it is on my webpage. (I now already corrected my personal code).
Hmmm, correct, wondered what was going on though when it appeared in my 3.3.1 upgraded system. Having a closer look at file timestamps and ownership it appears my wee_debug was a remnant of earlier development/testing (probably a good case in hand for keeping development off of production). No matter, am sure it will make it into 3.3.2, in the meantime just get it from github or my 24 Nov post.
import weeutil.Sunprint "Times using weeutil.Sun"sunrise_utc, sunset_utc = weeutil.Sun.sunRiseSet(2015,12,11, 3.1, 51)sunrise_h = int(sunrise_utc)sunrise_m = (sunrise_utc - sunrise_h) * 60sunset_h = int(sunset_utc)sunset_m = (sunset_utc - sunset_h) * 60print "sunrise (UTC): %02d:%.1f" % (sunrise_h, sunrise_m)print "sunset (UTC): %02d:%.1f" % (sunset_h, sunset_m)
Times using weeutil.Sunsunrise (UTC): 07:40.2sunset (UTC): 15:41.2
import osimport timefrom weewx.almanac import Almanac
os.environ['TZ'] = 'America/Paramaribo'
tt = (2015,12,11,0,0,0,0,0,-1)ts = time.mktime(tt)
almanac = Almanac(ts, 5.8, -55.2)
print "Times using Almanac (local time):"print "sunrise:", almanac.sun.riseprint "transit:", almanac.sun.transitprint "sunset: ", almanac.sun.set
Times using Almanac (local time):
sunrise: 06:39transit: 12:33sunset: 18:28
print "sunrise:", almanac.sun.riseprint "Start twilight: ", almanac(horizon=-6).sun.riseprint "sunrise a 2nd time:", almanac.sun.rise