Snapshot. Adding testing of generation from templates

This commit is contained in:
Tom Keffer
2011-02-13 15:55:33 +00:00
parent 84ea0b10fa
commit 647bcbe67e
8 changed files with 68 additions and 37 deletions

View File

@@ -1,20 +1,29 @@
CHANGE HISTORY
--------------------------------
1.10.0 01/17/11
1.10.0 02/12/11
Added a weewx "favorite icon" favicon.ico that displays in your browser toolbar.
Added a mobile formatted HTML page, courtesy of user Vince Skahan (thanks,
Vince!!).
Added executable module "runreports.py", which will just run report generation.
Added executable module "runreports.py" for running report generation only.
Y-axis plot labels (such as "°F") can now be overridden in the plot configuration
section of skin.conf by using option "y_label".
Added package "user", which can contain any user extensions. This package
will not get overridden in the upgrade process.
Added package "user", which can contain any user extensions. This package will
not get overridden in the upgrade process.
Added special tag "exists" to test whether an observation type exists. Example
$year.foo.exists will return False if there is no type "foo" in the statistical
database.
Added special tag "has_data" to test whether an observation type exists and has
a non-zero number of data points over the aggregation period. For example,
$year.soilMoist1.has_data will return True if soilMoist1 both exists in the
stats database and contains data (meaning, you have the hardware).
Now makes all of the LOOP and archive data available to services. This includes
new keys:

View File

@@ -42,10 +42,9 @@ def gen_all(config_path, gen_ts = None):
socket.setdefaulttimeout(10)
t = weewx.reportengine.StdReportEngine(config_path, gen_ts)
t.setDaemon(True)
t.start()
t.join()
# Although the report engine inherits from Thread, we can just run it in the main thread:
t.run()
if len(sys.argv) < 2 :
print "Usage: reports.py path-to-configuration-file [timestamp-to-be-generated]"

View File

@@ -399,7 +399,6 @@ class GeneralPlot(object):
# No valid data. Pick an arbitrary scaling
self.yscale=(0.0, 1.0, 0.2)
else:
print ymin, ymax, self.yscale
self.yscale = weeplot.utilities.scale(ymin, ymax, self.yscale)
def _calcXLabelFormat(self):

View File

@@ -806,8 +806,24 @@ class StatsTypeHelper(object):
return weewx.units.ValueHelper.convertOnInit(self.converter, result, self.context, self.formatter)
def __getattr__(self, aggregateType):
"""Attribute is an aggregation type, such as 'sum', 'max', etc."""
if self.stats_type in ('heatdeg', 'cooldeg'):
"""Return statistical summary using a given aggregateType.
aggregateType: The type of aggregation over which the summary is to be done.
This is normally something like 'sum', 'min', 'mintime', 'count', etc.
However, there are two special aggregation types that can be used to
determine the existence of data:
'exists': Return True if the observation type exists in the database.
'has_data': Return True if the type exists and there is a non-zero
number of entries over the aggregation period.
returns: For special types 'exists' and 'has_data', returns a Boolean
value. Otherwise, a ValueHelper containing the aggregation data."""
if aggregateType == 'exists':
return self.stats_type in self.db.statsTypes
elif aggregateType == 'has_data':
return self.stats_type in self.db.statsTypes and self.db.getAggregate(self.timespan, self.stats_type, 'count')[0] != 0
elif self.stats_type in ('heatdeg', 'cooldeg'):
# Heating and cooling degree days use a different entry point into Stats:
result = self.db.getHeatCool(self.timespan, self.stats_type, aggregateType, self.option_dict['heatbase'], self.option_dict['coolbase'])
else:

View File

@@ -79,25 +79,25 @@
<td class="stats_label">Inside Temperature</td>
<td class="stats_data">$current.inTemp</td>
</tr>
#if $day.extraTemp1.count.raw
#if $day.extraTemp1.has_data
<tr>
<td class="stats_label">Pond Temperature</td>
<td class="stats_data">$current.extraTemp1</td>
</tr>
#end if
#if $day.UV.count.raw
#if $day.UV.has_data
<tr>
<td class="stats_label">UV</td>
<td class="stats_data">$current.UV</td>
</tr>
#end if
#if $day.ET.sum.raw > 0.0
#if $day.ET.has_data and $day.ET.sum.raw > 0.0
<tr>
<td class="stats_label">ET</td>
<td class="stats_data">$current.ET</td>
</tr>
#end if
#if $day.radiation.count.raw
#if $day.radiation.has_data
<tr>
<td class="stats_label">Solar Radiation</td>
<td class="stats_data">$current.radiation</td>
@@ -219,7 +219,7 @@
$day.inTemp.min at $day.inTemp.mintime
</td>
</tr>
#if $day.extraTemp1.count.raw
#if $day.extraTemp1.has_data
<tr>
<td class="stats_label">
High Pond Temperature<br/>
@@ -231,7 +231,7 @@
</td>
</tr>
#end if
#if $day.UV.count.raw
#if $day.UV.has_data
<tr>
<td class="stats_label">
High UV<br/>
@@ -243,7 +243,7 @@
</td>
</tr>
#end if
#if $day.ET.sum.raw >0.0
#if $day.ET.has_data and $day.ET.sum.raw >0.0
<tr>
<td class="stats_label">
High ET<br/>
@@ -255,7 +255,7 @@
</td>
</tr>
#end if
#if $day.radiation.count.raw
#if $day.radiation.has_data
<tr>
<td class="stats_label">
High Radiation<br/>
@@ -334,7 +334,9 @@
<img src="dayinside.png" alt="Inside" />
<img src="daywindvec.png" alt="Wind Vector" />
<img src="dayrx.png" alt="day rx percent"/>
#if $day.extraTemp1.has_data
<img src="daypond.png" alt="Pond Temperatures" />
#end if
</div> <!-- End id "plots" -->
</div> <!-- End id "content" -->

View File

@@ -155,7 +155,7 @@
$month.inTemp.min at $month.inTemp.mintime
</td>
</tr>
#if $month.extraTemp1.count.raw
#if $month.extraTemp1.has_data
<tr>
<td class="stats_label">
High Pond Temperature<br/>
@@ -167,7 +167,7 @@
</td>
</tr>
#end if
#if $month.UV.count.raw
#if $month.UV.has_data
<tr>
<td class="stats_label">
High UV<br/>
@@ -179,7 +179,7 @@
</td>
</tr>
#end if
#if $month.ET.sum.raw >0.0
#if $month.ET.has_data and $month.ET.sum.raw >0.0
<tr>
<td class="stats_label">
High ET<br/>
@@ -191,7 +191,7 @@
</td>
</tr>
#end if
#if $month.radiation.count.raw
#if $month.radiation.has_data
<tr>
<td class="stats_label">
High Radiation<br/>
@@ -334,7 +334,7 @@
$year.inTemp.min at $year.inTemp.mintime
</td>
</tr>
#if $year.extraTemp1.count.raw
#if $year.extraTemp1.has_data
<tr>
<td class="stats_label">
High Pond Temperature<br/>
@@ -346,7 +346,7 @@
</td>
</tr>
#end if
#if $year.UV.count.raw
#if $year.UV.has_data
<tr>
<td class="stats_label">
High UV<br/>
@@ -358,7 +358,7 @@
</td>
</tr>
#end if
#if $year.ET.sum.raw >0.0
#if $year.ET.has_data and $year.ET.sum.raw >0.0
<tr>
<td class="stats_label">
High ET<br/>
@@ -370,7 +370,7 @@
</td>
</tr>
#end if
#if $year.radiation.count.raw
#if $year.radiation.has_data
<tr>
<td class="stats_label">
High Radiation<br/>
@@ -403,7 +403,9 @@
<img src="monthinside.png" alt="Inside" />
<img src="monthwindvec.png" alt="Wind Vector" />
<img src="monthrx.png" alt="month rx percent"/>
#if $month.extraTemp1.has_data
<img src="monthpond.png" alt="Pond Temperatures" />
#end if
</div>
</div> <!-- End id "content" -->

View File

@@ -155,7 +155,7 @@
$week.inTemp.min at $week.inTemp.mintime
</td>
</tr>
#if $week.extraTemp1.count.raw
#if $week.extraTemp1.has_data
<tr>
<td class="stats_label">
High Pond Temperature<br/>
@@ -167,7 +167,7 @@
</td>
</tr>
#end if
#if $week.UV.count.raw
#if $week.UV.has_data
<tr>
<td class="stats_label">
High UV<br/>
@@ -179,7 +179,7 @@
</td>
</tr>
#end if
#if $week.ET.sum.raw >0.0
#if $week.ET.has_data and $week.ET.sum.raw >0.0
<tr>
<td class="stats_label">
High ET<br/>
@@ -191,7 +191,7 @@
</td>
</tr>
#end if
#if $week.radiation.count.raw
#if $week.radiation.has_data
<tr>
<td class="stats_label">
High Radiation<br/>
@@ -344,7 +344,7 @@
$month.extraTemp1.min at $month.extraTemp1.mintime
</td>
</tr>
#if $month.UV.count.raw
#if $month.UV.has_data
<tr>
<td class="stats_label">
High UV<br/>
@@ -356,7 +356,7 @@
</td>
</tr>
#end if
#if $month.ET.sum.raw >0.0
#if $month.ET.has_data and $month.ET.sum.raw >0.0
<tr>
<td class="stats_label">
High ET<br/>
@@ -368,7 +368,7 @@
</td>
</tr>
#end if
#if $month.radiation.count.raw
#if $month.radiation.has_data
<tr>
<td class="stats_label">
High Radiation<br/>
@@ -401,7 +401,9 @@
<img src="weekinside.png" alt="Inside" />
<img src="weekwindvec.png" alt="Wind Vector" />
<img src="weekrx.png" alt="week rx percent"/>
#if $week.extraTemp1.has_data
<img src="weekpond.png" alt="Pond Temperatures" />
#end if
</div>
</div> <!-- End id "content" -->

View File

@@ -155,7 +155,7 @@
$year.inTemp.min at $year.inTemp.mintime
</td>
</tr>
#if $year.extraTemp1.count.raw
#if $year.extraTemp1.has_data
<tr>
<td class="stats_label">
High Pond Temperature<br/>
@@ -167,7 +167,7 @@
</td>
</tr>
#end if
#if $year.UV.count.raw
#if $year.UV.has_data
<tr>
<td class="stats_label">
High UV<br/>
@@ -179,7 +179,7 @@
</td>
</tr>
#end if
#if $year.ET.sum.raw >0.0
#if $year.ET.has_data and $year.ET.sum.raw >0.0
<tr>
<td class="stats_label">
High ET<br/>
@@ -191,7 +191,7 @@
</td>
</tr>
#end if
#if $year.radiation.count.raw
#if $year.radiation.has_data
<tr>
<td class="stats_label">
High Radiation<br/>
@@ -252,7 +252,9 @@
<img src="yearinside.png" alt="Inside" />
<img src="yearwindvec.png" alt="Wind Vector" />
<img src="yearrx.png" alt="year rx percent"/>
#if $year.extraTemp1.has_data
<img src="yearpond.png" alt="Pond Temperatures" />
#end if
</div>
</div> <!-- End id "content" -->