gjr80 / weewx-polarwindplot Goto Github PK
View Code? Open in Web Editor NEWA weewx extension to generate a polar wind plots
License: GNU General Public License v3.0
A weewx extension to generate a polar wind plots
License: GNU General Public License v3.0
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1526 in 4b4baa8
Think I confused Gary with a poor comment .... the use of string none and None is inconsistent and he has implemented different versions of none/None
Poor comments on my part!
Effects marker and line colours that can take both a default, a colour or a description string (ie speed)
In some instances colors do not work or throw errors
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1527 in fc8738b
In some places you seem to impose an 80 column limit on lines, in others you go a bit over
Is that how your editor is configured or do you see this as a RULE ?
80 columns used to be in most coding standards but that rule died a death when monitors got bigger!
I can't find any releases to download...
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1359 in fc8738b
Maybe use the final resultant vector as a guide ?
Maybe accumulate number of markers in each quadrant and use quadrant with lowest number
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 314 in fc8738b
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1290 in cfba380
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 693 in 00234f4
I tried this on bullseye with python 3.9.2 and WeeWx 4.5.1 and got the following error:
Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: Unable to instantiate generator 'user.polarWindPlot.PolarWindPlotGenerator' Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** invalid syntax (polarWindPlot.py, line 261) Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** Traceback (most recent call last): Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/reportengine.py", line 179, in run Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** obj = weeutil.weeutil.get_object(generator)( Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** File "/home/weewx/bin/weeutil/weeutil.py", line 1119, in get_o bject Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** mod = __import__(module) Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** File "/home/weewx/bin/user/polarWindPlot.py", line 261 Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** except IOError, e: Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** ^ Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** SyntaxError: invalid syntax Jan 10 11:16:57 raspberrypi weewx[5736] ERROR weewx.reportengine: **** Generator ignored
I commented out that line and adjusted the indentation to get another error:
Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: Unable to instantiate generator 'user.polarWindPlot.PolarWindPlotGenerator' Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** cannot import name 'to_unicode' from 'weeutil.weeutil' (/home/weewx/bin/weeutil/weeutil.py) Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** Traceback (most recent call last): Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/reportengine.py", line 179, in run Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** obj = weeutil.weeutil.get_object(generator)( Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** File "/home/weewx/bin/weeutil/weeutil.py", line 1119, in get_object Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** mod = __import__(module) Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** File "/home/weewx/bin/user/polarWindPlot.py", line 61, in <module> Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** from weeutil.weeutil import accumulateLeaves, option_as_list, TimeSpan, tobool, to_unicode Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** ImportError: cannot import name 'to_unicode' from 'weeutil.weeutil' (/home/weewx/bin/weeutil/weeutil.py) Jan 10 13:27:04 raspberrypi weewx[6193] ERROR weewx.reportengine: **** Generator ignored
At that point I gave up!
Trail and spiral with line_style =
both correctly plot NO lines
According to syslog Neils polarWind plots take about twice as long to generate than his fork of stackwindrose.
Is this related to font or image size? the conf file is different ?
Gary said in email : I noticed on the scatter plot that the plot started with a line from the origin to the first point. That was giving me some odd looking lines on my test data and it made me wonder should that first point be joined to the origin or not? I changed the plot so that it is not(which is what is on GitHub now), now that I think again I am not sure. In any case it is a fairly trivial change to put it back as it was.
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1005 in ef3fd4a
I think this references a non existent dictionary item windrose_plot_petal_width
I think we use petal_width
ASIDE : should this actually be petal_number
or number_of_petals
?
Currently all lines are drawn with width=1 (which would remain the default)
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1402 in fc8738b
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 172 in 4b4baa8
Here for example we use period rather than time_length
@gjr80 I need to be able to set a lot of the dictionary items to different values, preferably all in the same skin.conf.
Cant get this line to work ?
Suspect it's due to a lack of data as error disappeared on next archive period. Simulator that had been silent for > 24 hours. Following log refers:
Jan 20 08:07:53 bullseye33 weewx[510] INFO __main__: Starting up weewx version 4.5.1
Jan 20 08:07:53 bullseye33 weewx[510] INFO weewx.engine: Clock error is -5.93 seconds (positive is fast)
Jan 20 08:07:53 bullseye33 weewx[510] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
Jan 20 08:07:53 bullseye33 weewx[510] INFO weewx.manager: Starting backfill of daily summaries
Jan 20 08:07:53 bullseye33 weewx[510] INFO weewx.manager: Daily summaries up to date
Jan 20 08:07:53 bullseye33 weewx[510] INFO weewx.engine: Starting main packet loop.
Jan 20 08:08:15 bullseye33 weewx[510] INFO weewx.manager: Added record 2022-01-20 08:08:00 AEST (1642630080) to database 'weewx.sdb'
Jan 20 08:08:15 bullseye33 weewx[510] INFO weewx.manager: Added record 2022-01-20 08:08:00 AEST (1642630080) to daily summary in 'weewx.sdb'
Jan 20 08:08:16 bullseye33 weewx[510] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 0.52 seconds
Jan 20 08:08:18 bullseye33 weewx[510] INFO weewx.imagegenerator: Generated 60 images for report SeasonsReport in 1.91 seconds
Jan 20 08:08:18 bullseye33 weewx[510] INFO weewx.reportengine: Copied 5 files to /home/weewx/public_html
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'user.polarwindplot.PolarWindPlotGenerator'
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** float division by zero
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** Traceback (most recent call last):
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** obj.start()
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** self.run()
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** File "/home/weewx/bin/user/polarwindplot.py", line 169, in run
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** self.genPlots(self.gen_ts)
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** File "/home/weewx/bin/user/polarwindplot.py", line 288, in genPlots
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** image = plot_obj.render(title)
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** File "/home/weewx/bin/user/polarwindplot.py", line 1983, in render
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** self.render_plot()
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** File "/home/weewx/bin/user/polarwindplot.py", line 2070, in render_plot
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** scale = plot_radius / self.max_vector_radius
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** ZeroDivisionError: float division by zero
Jan 20 08:08:18 bullseye33 weewx[510] ERROR weewx.reportengine: **** Generator terminated
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1504 in cfba380
Gary, I had these wrapped in a loop for 2 or 3 pseudo "layers", as a large amount of the code is replicated. You seem to of stripped them out a repeated the near identical code blocks?
Good progress anyway!
image_width = 382
image_height = 361
image_background_circle_color = 0xF5F5F5
image_background_box_color = 0xF5C696
image_background_range_ring_color = 0xC3D9DD
image_background_image = none
font_path = /usr/share/fonts/truetype/freefont/FreeSansBold.ttf
plot_font_size = 10
plot_font_color = 0x000000
plot_border = 5
legend_bar_width = 10
legend_font_size = 10
legend_font_color = 0x000000
label_font_size = 12
label_font_color = 0x000000
My attempt at a minimal skin.conf for testing shows that the above items (possibly) should have defaults
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 797 in 42a870c
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 902 in cfba380
marker_type =
should plot no markers but draws circles.
Fix this once the colour setup from dictionary have been completed in #21
This is an optional final vector from origin to last point, in defined colour
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 410 in f26ea78
Spiral and Trail look alright
Suspect solution will be in line 562 ish...
Something like -
def render_legend(self):
"""Render a polar plot legend."""
if self.legend = False
return
weewx-polarwindplot/bin/user/polarWindPlot.py
Line 1588 in cfba380
Draw markers is a common code block between spiral, scatter and trail.
It should be moved to a function
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.