i forgot to mention what might be the easiest option (assuming that you do 
not mind the XWindows-circa-1990s look) - just use the image that xtide 
emits.

once again, write a TideGenerator, but all you do is invoke xtide with args 
to emit an image.  then include that image in your templates.

put something like this in user/tidegen.py:

import syslog
import subprocess
import weewx.reportengine

# emit image as PNG
cmd = "/usr/bin/tide -l LOCATION -f p -o OUTPUTFILE.png"

class TideGenerator(weewx.reportengine.ReportGenerator):
    def run(self):
        try:
            # run xtide, capture the stdout and stderr
            p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIP, 
stderr=subprocess.PIPE)
            rc = p.returncode
            if rc is not None:
                syslog.syslog(syslog.LOG_ERR, "tide failed with return code 
%s" % rc)
            else:
                for line in p.stderr:
                    syslog.syslog(syslog.LOG_ERR, "xtide: %s" % line)
        except OSError, e:
            syslog.syslog(syslog.LOG_ERR, "xtide failed: %s" % e)

and you use it like this:

[Generators]
    generator_list = ..., user.TideGenerator

in your skin.conf, then include the image in your .tmpl file(s)

m

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to