diff --git a/bin/weewx/almanac.py b/bin/weewx/almanac.py index 8a690b8f..607c9ead 100644 --- a/bin/weewx/almanac.py +++ b/bin/weewx/almanac.py @@ -202,7 +202,7 @@ class Almanac(object): # This is how you call a function on an instance when all you have is its name: djd = ephem.__dict__[attr](self.time_djd) #@UndefinedVariable return weewx.units.ValueHelper((djd, "dublin_jd", "group_time"), - context="year", formatter=self.formatter) + context="ephem_year", formatter=self.formatter) else: raise AttributeError, "Unknown attribute "+attr @@ -267,7 +267,7 @@ class BodyWrapper(object): # being examined. So, create a temporary body and then throw it away temp_body = self.body_factory() time_djd = getattr(self.observer, attr)(temp_body) - return weewx.units.ValueHelper((time_djd, "dublin_jd", "group_time"), context="day", formatter=self.formatter) + return weewx.units.ValueHelper((time_djd, "dublin_jd", "group_time"), context="ephem_day", formatter=self.formatter) elif attr in fn_map: # These attribute names have to be mapped to a different function name. Like the # attributes above, they also have the side effect of changing the state of the body. @@ -278,7 +278,7 @@ class BodyWrapper(object): fn = fn_map[attr] # Call the function, with a second argument giving the start-of-day time_djd = getattr(self.observer, fn)(temp_body, self.sod_djd) - return weewx.units.ValueHelper((time_djd, "dublin_jd", "group_time"), context="day", formatter=self.formatter) + return weewx.units.ValueHelper((time_djd, "dublin_jd", "group_time"), context="ephem_day", formatter=self.formatter) else: # Just return the result unchanged. return getattr(self.body, attr) diff --git a/bin/weewx/units.py b/bin/weewx/units.py index a53795a5..0b2b5d96 100644 --- a/bin/weewx/units.py +++ b/bin/weewx/units.py @@ -239,12 +239,14 @@ default_unit_label_dict = { "centibar" : " cb", # Default strftime formatting to be used in the absence of a skin # configuration file: -default_time_format_dict = {"day" : "%H:%M", - "week" : "%H:%M on %A", - "month" : "%d-%b-%Y %H:%M", - "year" : "%d-%b-%Y %H:%M", - "rainyear" : "%d-%b-%Y %H:%M", - "current" : "%d-%b-%Y %H:%M"} +default_time_format_dict = {"day" : "%H:%M", + "week" : "%H:%M on %A", + "month" : "%d-%b-%Y %H:%M", + "year" : "%d-%b-%Y %H:%M", + "rainyear" : "%d-%b-%Y %H:%M", + "current" : "%d-%b-%Y %H:%M", + "ephem_day" : "%H:%M", + "ephem_year" : "%d-%b-%Y %H:%M"} #=============================================================================== @@ -301,6 +303,9 @@ class Formatter(object): self.unit_format_dict = unit_format_dict self.unit_label_dict = unit_label_dict self.time_format_dict = time_format_dict + # Add new keys for backwards compatibility on old skin dictionaries: + self.time_format_dict.setdefault('ephem_day', "%H:%M") + self.time_format_dict.setdefault('ephem_year', "%d-%b-%Y %H:%M") @staticmethod def fromSkinDict(skin_dict): diff --git a/docs/customizing.htm b/docs/customizing.htm index 16c606c1..f8f04add 100644 --- a/docs/customizing.htm +++ b/docs/customizing.htm @@ -791,7 +791,8 @@ December: Min, max temperatures: N/A N/A
Azimuth, altitude of mars: $almanac.mars.az $almanac.mars.alt
Next new, full moon: $almanac.next_new_moon $almanac.next_full_moon
Next summer, winter solstice: $almanac.next_summer_solstice $almanac.next_winter_solstice
-
 
+

The included almanac includes information for the Sun, Moon, Venus, Mars, + and Jupiter.

Writing a custom generator

To do more sophisticated customization it may be necessary to extend an existing generator, or write your own.

@@ -1050,6 +1051,13 @@ month = %d-%b-%Y %H:%M

would specify that week data should use a format such as "15:20 on Sunday", while month data should look like "06-Oct-2009 15:20"

+

It also allows the formatting to be set for almanac times:

+
ephem_day  = %H:%M
+ephem_year = %d-%b-%Y %H:%M
+

The first of these, ephem_day, is used for + almanac times within the day, such as sunrise or sunset. The second, + ephem_year, is used for almanac times within the + year, such as the next equinox or full moon.

[[DegreeDays]]

heating_base
cooling_base

diff --git a/skins/Standard/index.html.tmpl b/skins/Standard/index.html.tmpl index 31294d84..b8722b4b 100644 --- a/skins/Standard/index.html.tmpl +++ b/skins/Standard/index.html.tmpl @@ -348,15 +348,13 @@ #end if #if $almanac.hasExtras - #set $sun_az = "%.1f°" % $almanac.sun.az - #set $sun_alt= "%.1f°" % $almanac.sun.alt Azimuth: - $sun_az + $("%.1f°" % $almanac.sun.az) Altitude: - $sun_alt + $("%.1f°" % $almanac.sun.alt) Equinox: @@ -374,7 +372,7 @@ Moon Phase: - $almanac.moon_phase ($almanac.moon_fullness% full) + $almanac.moon_phase
($almanac.moon_fullness% full) #if $almanac.hasExtras @@ -389,15 +387,13 @@ Set: $almanac.moon.set - #set $moon_az = "%.1f°" % $almanac.moon.az - #set $moon_alt= "%.1f°" % $almanac.moon.alt Azimuth: - $moon_az + $("%.1f°" % $almanac.moon.az) Altitude: - $moon_alt + $("%.1f°" % $almanac.moon.alt) Full moon: diff --git a/skins/Standard/skin.conf b/skins/Standard/skin.conf index dacb3970..d6754dcb 100644 --- a/skins/Standard/skin.conf +++ b/skins/Standard/skin.conf @@ -136,12 +136,14 @@ # This section sets the string format to be used # each time scale. # - day = %H:%M - week = %H:%M on %A - month = %d-%b-%Y %H:%M - year = %d-%b-%Y %H:%M - rainyear = %d-%b-%Y %H:%M - current = %d-%b-%Y %H:%M + day = %H:%M + week = %H:%M on %A + month = %d-%b-%Y %H:%M + year = %d-%b-%Y %H:%M + rainyear = %d-%b-%Y %H:%M + current = %d-%b-%Y %H:%M + ephem_day = %H:%M + ephem_year = %d-%b-%Y %H:%M [[DegreeDays]] # diff --git a/skins/Standard/weewx.css b/skins/Standard/weewx.css index 28ee8568..f3c9eef4 100644 --- a/skins/Standard/weewx.css +++ b/skins/Standard/weewx.css @@ -102,6 +102,189 @@ body { text-align: center; } +#content .header { + font-size: 14pt; + font-weight: bolder; + color: #3d6c87; + margin-bottom: 10px; +} + + +#content .caption { + font-weight: bold; + color: #3d6c87; +} + +#content .label { + text-align: right; + font-style: italic; +} + +#content .data { + text-align: left; +} + +#about, #almanac { + margin-bottom: 30px; +} + +#almanac { + width:80%; + margin-left: auto; + margin-right: auto; +} + +.celestial_group { +} + +.celestial_body { + width: 48%; + vertical-align: top; +} + +#plots { + width: 90%; + display: block; + margin-left: auto; + margin-right: auto; +} + +#plots img { + margin: 3px; + border: thin solid #3d6c87; + padding: 3px; +} + +#radar_img { + width: 90%; + display: block; + margin-left: auto; + margin-right: auto; +} + +#radar_img img { + width: 90%; + padding: 3px; + margin: 3px; +} + +/* + * Navigation bar (week, month, etc.) at the bottom + */ +#navbar { + margin: 0 1% 1% 1%; + padding: 5px; + text-align: center; + clear: both; + border-top: 1px solid #dcdcdc; + border-right: 1px solid #a9a9a9; + border-bottom: 1px solid #808080; + border-left: 1px solid #a9a9a9; + background-color: #fafaff; +} + +/*************** Global Styles ***************/ + +h2, h3, h4, h5, h6 { + color: #3d6c87; +} + +body { + margin: 0; + padding: 0; + border: 0; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10pt; + background-color: #f2f2f7; + background-image: url('backgrounds/band.gif'); + background-repeat: repeat; + background-attachment: scroll; +} + +#container { + margin: 0; + padding: 0; + border: 0; +} + +/* + * This is the big header at the top of the page + */ +#masthead { + margin: 1% 1% 0 1%; + padding: 5px; + text-align: center; + border-top: 1px solid #dcdcdc; + border-right: 1px solid #a9a9a9; + border-bottom: 1px solid #808080; + border-left: 1px solid #a9a9a9; + background-color: #fafaff; +} + +#masthead h1 { + color: #3d6c87; +} +#masthead h3 { + color: #5f8ea9; +} + +/* + * This holds the statistics (daily high/low, etc.) on the left: + */ +#stats_group { + width: 30%; + min-height: 500px; + margin: 1%; + padding: 5px; + float: left; + border-top: 1px solid #dcdcdc; + border-right: 1px solid #a9a9a9; + border-bottom: 1px solid #808080; + border-left: 1px solid #a9a9a9; + background-color: #fafaff; +} + +.stats table { + border: thin solid #000000; + width: 100%; +} +.stats td { + border: thin solid #000000; + padding: 2px; +} + +.stats_header { + background-color: #000000; + color: #a8b8c8; + font-size: 14pt; + font-weight: bolder; +} + +.stats_label { + color: green; +} + +.stats_data { + color: red; +} + +/* + * This holds the "About", "Almanac", and plots on the right + */ +#content { + width: 62%; + min-height: 500px; + margin: 1%; + padding: 5px; + float: right; + border-top: 1px solid #dcdcdc; + border-right: 1px solid #a9a9a9; + border-bottom: 1px solid #808080; + border-left: 1px solid #a9a9a9; + background-color: #fafaff; + text-align: center; +} + #content .header { text-align: center; font-size: 14pt; @@ -122,35 +305,38 @@ body { #content td { width: 50%; - padding: 0; - margin: 0; } #content .label { text-align: right; font-style: italic; + padding-right: 2px; } #content .data { text-align: left; + padding-left: 2px; } #about, #almanac { margin-bottom: 30px; } -.celestial_group { +#almanac { +# border: thin solid #3d6c87; + width:60%; margin-left: auto; margin-right: auto; } +.celestial_group { +} .celestial_body { width: 48%; -# border: thin solid #3d6c87; - border-top: 1px solid #3d6c87; - border-left:1px solid #3d6c87; - border-bottom: 2px solid #3d6c87; - border-right: 2px solid #3d6c87; +# border-top: 1px solid #3d6c87; +# border-left:1px solid #3d6c87; +# border-bottom: 2px solid #3d6c87; +# border-right: 2px solid #3d6c87; display:inline-block; vertical-align: top; } @@ -201,4 +387,3 @@ body { h2, h3, h4, h5, h6 { color: #3d6c87; } -