gjr80 / weewx-highcharts Goto Github PK
View Code? Open in Web Editor NEWA WeeWX extension to generate weekly and yearly observation plots using Highcharts
License: GNU General Public License v3.0
A WeeWX extension to generate weekly and yearly observation plots using Highcharts
License: GNU General Public License v3.0
Hey there, I've been using the highcharts extension for a couple of years now, thanks again for the help early on setting it up.
I'm working on releasing a weewx skin that's a clone of my weather site, and it uses the highcharts extension as an optional dependency. Preparing for that dependancy though I installed the extension fresh on my lab system and saw that the day and month SLE and skin files were gone. Were those removed on purpose or an oversight?
In the version of highchartsSearchX.py
that I have, they are there and I can't recall if that was original to your code or if I added them long ago?
Anyways - wanted to check in to see if they should be added as they do have value.
@gjr80 thanks for all your work on this! I've been wanting to generate highchart graphs from weewx data for a while now but just didn't have the skills to make it happen. Yesterday I installed v0.2.0 and got it working on my test weewx box running the simulator. It works fine and no issues generating the JSON files. However when I installed it on my Raspbery Pi connected to my AcuRite 02064C it generates this list index out of range error. The week.json generates fine but I never get the year.json. Looks like something to do with the windrose calculations. Any thoughts on how to fix this?
Running WeeWX 3.7.1
weewx[21257]: reportengine: Caught unrecoverable exception in generator weewx.cheetahgenerator.CheetahGenerator weewx[21257]: **** list index out of range weewx[21257]: **** Traceback (most recent call last): weewx[21257]: **** File "/usr/share/weewx/weewx/reportengine.py", line 239, in run weewx[21257]: **** obj.start() weewx[21257]: **** File "/usr/share/weewx/weewx/reportengine.py", line 273, in start weewx[21257]: **** self.run() weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 157, in run weewx[21257]: **** ngen = self.generate(gen_dict[section_name], self.gen_ts) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 231, in generate weewx[21257]: **** ngen += self.generate(section[subsection], gen_ts) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 231, in generate weewx[21257]: **** ngen += self.generate(section[subsection], gen_ts) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 319, in generate weewx[21257]: **** default_binding) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 371, in _getSearchList weewx[21257]: **** searchList += obj.get_extension_list(timespan, db_lookup) weewx[21257]: **** File "/usr/share/weewx/user/highchartsSearchX.py", line 1179, in get_extension_list weewx[21257]: **** sle_dict['wr' + _suffix] = self.calcWindRose(timespan, db_lookup, period) weewx[21257]: **** File "/usr/share/weewx/user/highchartsSearchX.py", line 962, in calcWindRose weewx[21257]: **** if (speed_vec_vt[0][i] is None) or (direction_vec_vt[0][i] is None): weewx[21257]: **** IndexError: list index out of range weewx[21257]: **** Generator terminated
Thanks again!
Hello !
It would be great to share either a link to a demo website, or maybe provide some samples of week.json and year.json so we can see a demo ?
currently, as far as I understand, we must first install everything to output some json files before running the provided graphs.html.
This is just a kind suggestion, I'm not sure where to put this else than here. Sorry if it's not suitable!
Best regards,
For an observation that only varies by a small amount over the period displayed on a Highcharts plot (eg 997-999 hPa for barometric pressure ie a 2hPa spread) Highcharts will autoscale the y-axis range. For our 2hPa example this could result in y-axis range of say 996 to 1000 hPa making our very small variation appear large (50% of the y-axis range). This could be solved by specifying a minRange
value for the y-axis, that way autoscaling will only kick in if the minRange
is exceeded. This is already the case with rainfall where minRange
of 5 is specified. The problem with this is that a minRange
of 5 for rainfall would be interpreted as 5mm in a metric system and 5in in an imperial system. Not really workable. If there was a mechanism for the user to specify a minRange
in their units then this would work. The minRange
would probably be best specified in weewx.conf
or skin.conf
and passed throught the respective JSON data files. The other alternative is to have the user edit saratogaplots.js
, not really a viable alternative.
When running wee_reports I get this error:
(This is with latest "official" release, ie 0.3.0):
$ wee_reports
Using configuration file /etc/weewx/weewx.conf
Generating for all time
Traceback (most recent call last):
File "/usr/share/weewx/weewx/reportengine.py", line 196, in run
obj.start()
File "/usr/share/weewx/weewx/reportengine.py", line 281, in start
self.run()
File "/usr/share/weewx/weewx/cheetahgenerator.py", line 149, in run
ngen = self.generate(gen_dict[section_name], self.gen_ts)
File "/usr/share/weewx/weewx/cheetahgenerator.py", line 219, in generate
ngen += self.generate(section[subsection], gen_ts)
File "/usr/share/weewx/weewx/cheetahgenerator.py", line 219, in generate
ngen += self.generate(section[subsection], gen_ts)
File "/usr/share/weewx/weewx/cheetahgenerator.py", line 308, in generate
default_binding)
File "/usr/share/weewx/weewx/cheetahgenerator.py", line 379, in _getSearchList
searchList += obj.get_extension_list(timespan, db_lookup)
File "/usr/share/weewx/user/highchartssearchlist.py", line 1243, in get_extension_list
period)
File "/usr/share/weewx/user/highchartssearchlist.py", line 961, in calc_windrose
max_speed = max(speed_vec_vt.value)
TypeError: '>' not supported between instances of 'NoneType' and 'float'
$
After fixing this on my own I noticed this has already been officially fixed.
Gary, would you agree to release 0.3.1 please ? so we can just download it as latest and not run into this "bug".
Many thanks in advance.
Gabriel.
seems that are some problems on my system
get this here:
Jun 23 09:45:42 localhost weewx[6094]: cheetahgenerator: **** Ignoring template /etc/weewx/skins/Highcharts/json/week.json.tmpl
Jun 23 09:45:42 localhost weewx[6094]: cheetahgenerator: **** Reason: cannot find 'wr86400'
Jun 23 09:45:42 localhost weewx[6094]: **** Traceback (most recent call last):
Jun 23 09:45:42 localhost weewx[6094]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 332, in generate
Jun 23 09:45:42 localhost weewx[6094]: **** fd.write(str(compiled_template))
Jun 23 09:45:42 localhost weewx[6094]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in str
Jun 23 09:45:42 localhost weewx[6094]: **** rc = getattr(self, mainMethName)()
Jun 23 09:45:42 localhost weewx[6094]: **** File "_etc_weewx_skins_Highcharts_json_week_json_tmpl.py", line 346, in respond
Jun 23 09:45:42 localhost weewx[6094]: **** NotFound: cannot find 'wr86400'
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: Generate failed with exception '<class 'NameMapper.NotFound'>'
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: **** Ignoring template /etc/weewx/skins/Highcharts/json/year.json.tmpl
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: **** Reason: cannot find 'wrmonth'
Jun 23 09:45:44 localhost weewx[6094]: **** Traceback (most recent call last):
Jun 23 09:45:44 localhost weewx[6094]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 332, in generate
Jun 23 09:45:44 localhost weewx[6094]: **** fd.write(str(compiled_template))
Jun 23 09:45:44 localhost weewx[6094]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in str
Jun 23 09:45:44 localhost weewx[6094]: **** rc = getattr(self, mainMethName)()
Jun 23 09:45:44 localhost weewx[6094]: **** File "_etc_weewx_skins_Highcharts_json_year_json_tmpl.py", line 338, in respond
Jun 23 09:45:44 localhost weewx[6094]: **** NotFound: cannot find 'wrmonth'
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: Generated 0 files for report Highcharts in 4.23 seconds
Jun 23 09:46:14 localhost weewx[6094]: ftpgenerator: ftp'd 116 files in 30.07 seconds
Function getDaySummaryVectors() is used to calculate a vector of daily aggregate data based on the daily summary tables. The aggregate calculation is based on using different fields in the results of an sql query. These fields are selected based on their order and it appears for some reason the field numbers are no longer correct.
Solution is two part. Firstly rework the sql query to explicitly select fields rather than using *, that way the field order will always be the same/ Secondly, rework the aggregate calculations to ensure the correct fields are being used.
If I retrieve the latest weewx-highcharts (for python3) as follows:
wget https://github.com/gjr80/weewx-highcharts/archive/python3.zip -O /tmp/hfw.zip
Then install with wee_extension as follows:
wee_extension --install=/tmp/hfw.zip
I get the following error:
Traceback (most recent call last):
File "/usr/share/weewx/wee_extension", line 88, in <module>
main()
File "/usr/share/weewx/wee_extension", line 80, in main
ext.install_extension(options.install)
File "/usr/share/weewx/weecfg/extension.py", line 123, in install_extension
self.install_from_dir(extension_dir)
File "/usr/share/weewx/weecfg/extension.py", line 181, in install_from_dir
shutil.copy(source_path, destination_path)
File "/usr/lib/python3.7/shutil.py", line 245, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.7/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/weewx-highcharts-python3/bin/user/highchartsSearchX.py'
To fix I changed in file install.py, line 171 to read as follows:
files=[('bin/user', ['bin/user/highchartssearchlist.py']
Hi Gary,
I have added a jquery datepicker to plots.js to use on a range selector in the weewx highcharts extension. Do you want me to send it to you? It is only 4 lines in plots.js and two lines in the parent page to load the javascript and css.
Thanks Jerry
not 100% researched and not longer testet -just for info... It looks like hfw has some dependencies on weewxwd, I don't reall see a need in them...
cheetahgenerator: Generated 14 files for report StandardReport in 37.90 seconds imagegenerator: Generated 12 images for StandardReport in 5.10 seconds copygenerator: copied 9 files to /var/www/weewx reportengine: Caught unrecoverable exception in generator weewx.cheetahgenerator.CheetahGenerator **** Unknown data binding ''wd_binding'' **** Traceback (most recent call last): **** File "/usr/share/weewx/weewx/reportengine.py", line 239, <snip>
so I installed wee_extension --install=./weewxwd-1.0.3.tar.gz
:
cheetahgenerator: Generated 14 files for report StandardReport in 37.49 seconds imagegenerator: Generated 12 images for StandardReport in 5.13 seconds copygenerator: copied 9 files to /var/www/weewx reportengine: Caught unrecoverable exception in generator weewx.cheetahgenerator.Che etahGenerator **** unsupported operand type(s) for /: 'NoneType' and 'float' **** Traceback (most recent call last): **** File "/usr/share/weewx/weewx/reportengine.py", line 239, in run <snip>
happens on weewx out of the box v3.7.1 and 3.6.2 (dep's) with mysql backend
I wasn't successful to generate json - I ended up with a simple simple php script.
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.