Pyephem needed to weewx-wd to work

Issue #34 resolved
timo helkiö created an issue

Weewx-wd runs without error after I installed pyephem and added to wd.py "import weewx.almanac". On Raspbian problem was to get libexpat1 installed, which is needed by python-dev. There is new version of it. I installed newer version manually before python-dev. Weewx-wd is development version. With new readme.md file installation is working.

Comments (4)

  1. Gary Roderick

    Hi, Thanks for your feedback, especially on the install instructions. Weewx-wd should tolerate pyephem not being installed (as Weewx does). If pyephem is not installed then some astronomical tags are not produced but they should be left blank or in a default state. Weewx-wd should not throw an error. Did you get an error? If so can you please provide the log snippet so we can track down the issue. Am intrigued by the need to import weewx.almanac into wd.py, as far as I can see wd.py does not use any almanac related functions. Do you have the log snippet with the error that prompted you to include weewx.almanac? Or better still, if your system is running stable now, what error do you get if you stop weewx, comment out the import weewx.almanac statement in wd.py and then restart weewx? Thanks Gary

  2. timo helkiö reporter

    I commented out "import weewx.almanac". It had no effect.

    I commented out in almanac.py line 23 , like this ' #try:

    ' # import ephem

    ' #except ImportError:

    import weeutil.Sun

    and (line 177)

    '#if 'ephem' in sys.modules:
    '#self.hasExtras = True

    '#else:

    and corrected indent errors, which resulted this:

    Dec 26 12:06:04 raspberrypi weewx[7548]: cheetahgenerator: generate failed with exception '<class 'NameMapper.NotFound'>' Dec 26 12:06:04 raspberrypi weewx[7548]: cheetahgenerator: * ignoring template /etc/weewx/skins/Clientraw/clientrawextra.txt.tmpl Dec 26 12:06:04 raspberrypi weewx[7548]: cheetahgenerator: reason: cannot find 'raw' while searching for 'almanac.sunset.raw' Dec 26 12:06:04 raspberrypi weewx[7548]: Traceback (most recent call last): Dec 26 12:06:04 raspberrypi weewx[7548]: File "/usr/share/weewx/weewx/cheetahgenerator.py", line 255, in generate Dec 26 12:06:04 raspberrypi weewx[7548]: print >> _file, text Dec 26 12:06:04 raspberrypi weewx[7548]: File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in str Dec 26 12:06:04 raspberrypi weewx[7548]: rc = getattr(self, mainMethName)() Dec 26 12:06:04 raspberrypi weewx[7548]: File "_etc_weewx_skins_Clientraw_clientrawextra_txt_tmpl.py", line 123, in respond Dec 26 12:06:04 raspberrypi weewx[7548]: *** NotFound: cannot find 'raw' while searching for 'almanac.sunset.raw'

    It should be mentioned in weewx-documents, that with pyephem you can get extra almanac-data.

  3. Gary Roderick

    Issue has to do with the limited functionality of $almanac when pyephem is not installed. $almanac.sunrise and $almanac.sunset (Weewx tags available when pyephem is nt istalled) do not provide dot code formatting as most other Weewx tags (including $almanac.sun.rise if pyepehem is installed). They only provide "HH:MM" formatted string output. Simple solution is to install pyephem as per the Weewx install guide. Better solution is to modify testtags.php.tmpl and clientrawextra.txt.tmp code to process the $alamanc.sunrise/sunset string output and do necessary string/integer conversion and subsequent calculations. These calculations were included in master as of commit 196fa85 and to delopment as of commit 72709ee

  4. Gary Roderick

    Above mentioned commits have fixed the problem. Weewx-WD run on a clean Weewx 2.5.0 system without pyephem and all templates generated correctly without error. Of course, not using pyephem limits some of the astronomical tags generates as well as reducing (slightly) the accuracy of those that are (eg sun rise and set and moon fullness)

  5. Log in to comment