Version 2.0.0 release

This commit is contained in:
Tom Keffer
2012-11-04 17:12:55 +00:00
parent d338559cd1
commit 41ccb72cda
14 changed files with 111 additions and 40 deletions

View File

@@ -57,6 +57,7 @@ docs/upgrading.htm
docs/usersguide.htm
docs/weekgustoverlay.png
docs/weewx_docs.css
docs/yearhilow.png
skins/Ftp/skin.conf
skins/Standard/favicon.ico
skins/Standard/index.html.tmpl

View File

@@ -42,6 +42,12 @@ def scale(fmn, fmx, prescale = (None, None, None), nsteps = 10):
(-2.0, 14.0, 2.0)
>>> print scale(-12.1, -5.3)
(-13.0, -5.0, 1.0)
>>> print scale(10.0, 10.0)
(10.0, 10.1, 0.01)
>>> print "(%.4f, %.4f, %.5f)" % scale(10.0, 10.001)
(10.0000, 10.0010, 0.00010)
>>> print scale(10.0, 10.0+1e-8)
(10.0, 10.1, 0.01)
>>> print scale(0.0, 0.05, (None, None, .1), 10)
(0.0, 1.0, 0.1)
>>> print scale(0.0, 0.21, (None, None, .02))
@@ -62,7 +68,7 @@ def scale(fmn, fmx, prescale = (None, None, None), nsteps = 10):
if fmx < fmn :
raise weeplot.ViolatedPrecondition, "scale() called with max value less than min value"
if fmx == fmn :
if _rel_approx_equal(fmn, fmx) :
if fmn == 0.0 :
fmx = 1.0
else :
@@ -217,7 +223,8 @@ class ScaledDraw(object):
lri = imagebox[1]
lls = scaledbox[0]
urs = scaledbox[1]
if urs[1] == lls[1]:
pass
self.xscale = float(lri[0] - uli[0]) / float(urs[0] - lls[0])
self.yscale = -float(lri[1] - uli[1]) / float(urs[1] - lls[1])
self.xoffset = int(lri[0] - urs[0] * self.xscale + 0.5)
@@ -411,6 +418,27 @@ def get_font_handle(fontpath, *args):
return font
def _rel_approx_equal(x, y, rel=1e-7):
"""Relative test for equality.
Example
>>> _rel_approx_equal(1.23456, 1.23457)
False
>>> _rel_approx_equal(1.2345678, 1.2345679)
True
>>> _rel_approx_equal(0.0, 0.0)
True
>>> _rel_approx_equal(0.0, 0.1)
False
>>> _rel_approx_equal(0.0, 1e-9)
False
>>> _rel_approx_equal(1.0, 1.0+1e-9)
True
>>> _rel_approx_equal(1e8, 1e8+1e-3)
True
"""
return abs(x-y) <= rel*max(abs(x), abs(y))
if __name__ == "__main__":
import doctest

View File

@@ -367,6 +367,7 @@ class Vantage(weewx.abstractstation.AbstractStation):
self.max_tries = int(vp_dict.get('max_tries' , 4))
self.save_monthRain = None
self.max_dst_jump = 7200
# Get an appropriate port, depending on the connection type:
self.port = Vantage._port_factory(vp_dict)
@@ -512,7 +513,8 @@ class Vantage(weewx.abstractstation.AbstractStation):
_record = self.translateArchivePacket(_packet)
# Check to see if the time stamps are declining, which would
# signal that we are done.
if _record['dateTime'] is None or _record['dateTime'] <= _last_good_ts :
if _record['dateTime'] is None or _record['dateTime'] <= _last_good_ts - self.max_dst_jump:
print "Stop.", weeutil.weeutil.timestamp_to_string(_record['dateTime']), weeutil.weeutil.timestamp_to_string(_last_good_ts)
# The time stamp is declining. We're done.
syslog.syslog(syslog.LOG_DEBUG, "VantagePro: DMPAFT complete: page timestamp %s less than final timestamp %s"\
% (weeutil.weeutil.timestamp_to_string(_record['dateTime']),
@@ -1050,17 +1052,17 @@ def _archive_datetime(packet) :
datestamp = packet['date_stamp']
timestamp = packet['time_stamp']
# Unforunately, there is no way of determining whether the time in the
# archive packet is DST or not. Assume it is the same as local time.
local_tt = time.localtime()
# Decode the Davis time, constructing a time-tuple from it:
# Construct a time tuple from Davis time. Unfortunately, as timestamps come
# off the Vantage logger, there is no way of telling whether or not DST is
# in effect. So, have the operating system guess by using a '-1' in the last
# position of the time tuple. It's the best we can do...
time_tuple = ((0xfe00 & datestamp) >> 9, # year
(0x01e0 & datestamp) >> 5, # month
(0x001f & datestamp), # day
timestamp // 100, # hour
timestamp % 100, # minute
0, # second
0, 0, local_tt.tm_isdst)
0, 0, -1) # have OS guess DST
# Convert to epoch time:
try:
ts = int(time.mktime(time_tuple))

View File

@@ -12,7 +12,7 @@
"""
import time
__version__="2.0.0b18"
__version__="2.0.0"
# Holds the program launch time in unix epoch seconds:
# Useful for calculating 'uptime.'

View File

@@ -4,7 +4,7 @@ CHANGE HISTORY
For complete documentation, see http://www.weewx.com/docs
2.0.0 XX/YY/12
2.0.0 11/04/12
A big release with lots of changes. The two most important are the support of
additional weather hardware, and the support of the MySQL database.
@@ -37,7 +37,8 @@ along the way. See the Customizing Guide.
You can now use "mmHg" as a unit of pressure.
Added new almanac information such as first and last quarter moons.
Added new almanac information, such as first and last quarter moons, and civil
twilight.
Changed the engine architecture so it is more event driven. It now uses
callbacks, making it easier to add new event types.

View File

@@ -1602,7 +1602,28 @@ outTemp = Outside Temperature</pre>
<p class="center">
<img alt="Daytime temperature with running average" height="180" src="daytemp_with_avg.png" width="300" />
</p>
<h3>Progressive vector plots</h3>
<p>
One more example. This one shows daily high and low temperatures for a year:</p>
<p class="tty">
[[year_images]]<br />
<br />
&nbsp; ...<br />
&nbsp; [[[yearhilow]]]<br />
&nbsp;&nbsp;&nbsp; [[[[hi]]]]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data_type = outTemp<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aggregate_type = max<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label = High<br />
&nbsp;&nbsp;&nbsp; [[[[low]]]]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; date_type = outTemp<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aggregate_type = min<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label = Low Temperature</p>
<p>
This results in the plot <span class="code">yearhilow.png</span>:</p>
<p class="center">
<img alt="Daily highs and lows" src="yearhilow.png" />
</p>
<h3>Progressive vector plots</h3>
<p><span class="code">Weewx</span> can produce progressive vector plots as well
as the more conventional x-y plots. To produce these, use plot type &#39;<span class="code">vector</span>&#39;.
You need a vector type to produce this kind of plot. There are two: &#39;<span class="code">windvec</span>&#39;,

View File

@@ -23,21 +23,25 @@
<p>What follows are directions for upgrading from specific versions.</p>
<h2>V1.14 or earlier</h2>
<p>Version 2.0 introduces many new features, including a revamped internal
engine. Fortunately, all skins are completely backwards compatible, so you
should not have to change your templates or skin configuration file,
<span class="code">skin.conf</span>. </p>
<p>If you have written a custom report generator it should also be backwards
compatible.</p>
<p>However, the main configuration file, <span class="code">weewx.conf</span>,
has changed in a way that is not backwards compatible. The setup utility will
install a new, fresh version which you will have to edit by hand. </p>
<p>If you have written a custom service, it will have to be updated to use the
new engine. The overall architecture is very similar, the only change is that
engine. There are two changes that are not backwards compatible:</p>
<ul>
<li>The configuration file, <span class="code">weewx.conf</span>. When
upgrading from V1.X, the setup utility will
install a new, fresh copy of <span class="code">weewx.conf</span>, which you will
then have to edit by hand. Thereafter, V2.X upgrades should be automatic.</li>
<li>Custom services. If you have written a custom service, it will have to be updated to use the
new engine. The overall architecture is very similar, except that
functions must be <em>bound</em> to events, rather than get called implicitly.
See the sections <a href="customizing.htm#Customizing_a_Service">Customizing a
Service</a> and <a href="customizing.htm#Adding_a_Service">Adding a Service</a>
in the <a href="customizing.htm">Customizing Guide</a> for details on how to do
this.</p>
this.</li>
</ul>
<p>All skins should be completely backwards compatible, so you
should not have to change your templates or skin configuration file,
<span class="code">skin.conf</span>. </p>
<p>If you have written a custom report generator it should also be backwards
compatible.</p>
<h2>V1.13 or earlier</h2>
<p>Version 1.14 introduces some new webpages that have been expressly formatted for
the smartphone by using <a href="http://jquery.com/">jQuery</a>.</p>

BIN
docs/yearhilow.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -234,15 +234,6 @@ class My_install_data(install_data):
# Add the version:
new_config['version'] = VERSION
# The following section is to fix changes from the alpha and beta
# versions of V2.0:
new_config['Databases']['archive_sqlite']['driver'] = 'weedb.sqlite'
new_config['Databases']['stats_sqlite']['driver'] = 'weedb.sqlite'
new_config['Databases']['archive_mysql']['driver'] = 'weedb.mysql'
new_config['Databases']['stats_mysql']['driver'] = 'weedb.mysql'
new_config['Vantage'].pop('record_generation', None)
new_config['WMR-USB'].pop('record_generation', None)
# Get a temporary file:
tmpfile = tempfile.NamedTemporaryFile("w", 1)

View File

@@ -277,7 +277,7 @@
#if $Extras.has_key('radar_img')
<div id="radar_img">
<a href="$Extras.radar_url"><img src="$Extras.radar_img" alt="Radar" /></a>
<div align="bottom">Click image for expanded radar loop</div>
<p>Click image for expanded radar loop</p>
</div>
#end if

View File

@@ -186,7 +186,7 @@
radiation = Radiation
rain = Rain
rainRate = Rain Rate
rxCheckPercent = Signal Quality
rxCheckPercent = ISS Signal Quality
windDir = Wind Direction
windGust = Gust Speed
windGustDir = Gust Direction
@@ -556,6 +556,17 @@
[[[[outTemp]]]]
[[[[dewpoint]]]]
# Daily high/lows:
[[[yearhilow]]]
[[[[hi]]]]
data_type = outTemp
aggregate_type = max
label = High
[[[[low]]]]
data_type = outTemp
aggregate_type = min
label = Low Temperature
[[[yearwind]]]
[[[[windSpeed]]]]
[[[[windGust]]]]

View File

@@ -157,22 +157,34 @@ body {
}
#plots img {
margin: 3px;
border: thin solid #3d6c87;
margin: 3px;
padding: 3px;
}
#radar_img {
width: 90%;
width: 100%;
display: block;
margin-left: auto;
margin-right: auto;
margin: 3px;
padding: 3px;
}
#radar_img img {
margin-left: auto;
margin-right: auto;
width: 90%;
padding: 3px;
margin: 3px;
padding: 3px;
}
#radar_img p {
width: 90%;
font-style: italic;
font-size: smaller;
text-align: center;
margin-top: 0;
}
/*
@@ -195,4 +207,3 @@ body {
h2, h3, h4, h5, h6 {
color: #3d6c87;
}

View File

@@ -246,6 +246,7 @@
<div id="plots">
<img src="yeartempdew.png" alt="temperatures" />
<img src="yeartempchill.png" alt="heatchill" />
<img src="yearhilow.png" alt="Yearly high/low" />
<img src="yearrain.png" alt="rain" />
<img src="yearwind.png" alt="wind" />
<img src="yearbarometer.png" alt="barometer"/>

View File

@@ -23,7 +23,7 @@
#
# Set to 1 for extra debug info, otherwise comment it out or set to zero.
debug = 1
debug = 0
# Root directory of the weewx data file hierarchy for this station.
WEEWX_ROOT = /home/weewx
@@ -32,7 +32,7 @@ WEEWX_ROOT = /home/weewx
socket_timeout = 20
# Current version
version = 2.0.0b18
version = 2.0.0
############################################################################################