diff --git a/MANIFEST b/MANIFEST index bacc9d16..3da8209c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -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 diff --git a/bin/weeplot/utilities.py b/bin/weeplot/utilities.py index d592c0dd..7cdf9d75 100644 --- a/bin/weeplot/utilities.py +++ b/bin/weeplot/utilities.py @@ -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 diff --git a/bin/weewx/VantagePro.py b/bin/weewx/VantagePro.py index d88ad394..d38ce067 100644 --- a/bin/weewx/VantagePro.py +++ b/bin/weewx/VantagePro.py @@ -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)) diff --git a/bin/weewx/__init__.py b/bin/weewx/__init__.py index ecc4b0ca..aedd3cf3 100644 --- a/bin/weewx/__init__.py +++ b/bin/weewx/__init__.py @@ -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.' diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 35cc8220..77d9b6b9 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -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. diff --git a/docs/customizing.htm b/docs/customizing.htm index b92e8956..24c89236 100644 --- a/docs/customizing.htm +++ b/docs/customizing.htm @@ -1602,7 +1602,28 @@ outTemp = Outside Temperature

Daytime temperature with running average

-

Progressive vector plots

+

+ One more example. This one shows daily high and low temperatures for a year:

+

+ [[year_images]]
+
+  ...
+  [[[yearhilow]]]
+    [[[[hi]]]]
+      data_type = outTemp
+      aggregate_type = max
+      label = High
+    [[[[low]]]]
+      date_type = outTemp
+      aggregate_type = min
+      label = Low Temperature

+

+ This results in the plot yearhilow.png:

+ +

+ Daily highs and lows +

+

Progressive vector plots

Weewx can produce progressive vector plots as well as the more conventional x-y plots. To produce these, use plot type 'vector'. You need a vector type to produce this kind of plot. There are two: 'windvec', diff --git a/docs/upgrading.htm b/docs/upgrading.htm index c53b51be..f0df1d01 100644 --- a/docs/upgrading.htm +++ b/docs/upgrading.htm @@ -23,21 +23,25 @@

What follows are directions for upgrading from specific versions.

V1.14 or earlier

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, -skin.conf.

-

If you have written a custom report generator it should also be backwards -compatible.

-

However, the main configuration file, weewx.conf, -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.

-

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:

+ +

All skins should be completely backwards compatible, so you +should not have to change your templates or skin configuration file, +skin.conf.

+

If you have written a custom report generator it should also be backwards +compatible.

V1.13 or earlier

Version 1.14 introduces some new webpages that have been expressly formatted for the smartphone by using jQuery.

diff --git a/docs/yearhilow.png b/docs/yearhilow.png new file mode 100644 index 00000000..0776a87a Binary files /dev/null and b/docs/yearhilow.png differ diff --git a/setup.py b/setup.py index 8654af6c..e25b053e 100755 --- a/setup.py +++ b/setup.py @@ -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) diff --git a/skins/Standard/index.html.tmpl b/skins/Standard/index.html.tmpl index ae7b7cbb..b9aa3343 100644 --- a/skins/Standard/index.html.tmpl +++ b/skins/Standard/index.html.tmpl @@ -277,7 +277,7 @@ #if $Extras.has_key('radar_img')
Radar -
Click image for expanded radar loop
+

Click image for expanded radar loop

#end if diff --git a/skins/Standard/skin.conf b/skins/Standard/skin.conf index 19f6759a..6bb69243 100644 --- a/skins/Standard/skin.conf +++ b/skins/Standard/skin.conf @@ -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]]]] diff --git a/skins/Standard/weewx.css b/skins/Standard/weewx.css index b988b6d4..2d7fbed6 100644 --- a/skins/Standard/weewx.css +++ b/skins/Standard/weewx.css @@ -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; } - diff --git a/skins/Standard/year.html.tmpl b/skins/Standard/year.html.tmpl index f072125d..f47bf85c 100644 --- a/skins/Standard/year.html.tmpl +++ b/skins/Standard/year.html.tmpl @@ -246,6 +246,7 @@
temperatures heatchill + Yearly high/low rain wind barometer diff --git a/weewx.conf b/weewx.conf index 9d0251ba..fbd14b32 100644 --- a/weewx.conf +++ b/weewx.conf @@ -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 ############################################################################################