A couple of years ago, I developed growing-degree-day graphs to display
codling moth development using *weeWX*.
o
http://lacusveris.com/cydia/index.shtml
I've been lurking on the
weewx...@googlegroups.com mailing list
since then. Now, I'm finally ready to upgrade to *weeWX 4*, but I
have some embroidery on the *python 2* code that I need to migrate to
*python 3*. The magnitude of this task causes me to rethink my
two-year-old approach.
I cloned weeWX's *ImageGenerator* to access its own database, do its
own growing-degree-day calculations, and generate its own Python
Imaging Lib (PIL) images. This was not easy, but it was good enough
... then.
Today, I'm bedeviled by notions that perhaps a more general approach
would be nearly as easy (or hard) to achieve and might find utility
for other *weeWX* applications. I guess you'd say I've fallen in love
with *cheetah* and have taken to looking at all problems as templating
applications. (Full disclosure: I seem to recall that, in a previous
life, I was a SPERRY (Univac/UNiSYS) *SKEL* programmer.)
... so I ask this somewhat rhetorical question:
Has there been any discussion about templating image generation
through *cheetah*?
I don't recall seeing any such discussion although I've seen some talk
about others' frustrations with the limitations of *ImageGenerator*
that mirror my own. Apparently the limitation of not being able to
draw y-axis horizons has been lifted in *weeWX 4*, but limitations
such as not being able to apply a second y-axis have not. To be sure,
these limitations do not wreck the whole notion of *weeWX* or prevent
users' workarounds like mine. On the other hand, they are examples
only and surely don't exhaust the kinds of drawings that
*ImageGenerator* in particular and PIL in general are NOT suited to.
In my mind templating is for text only, so I'm mystified by what I'm
asking. I can't feature what an imaging template would look like.
On the other hand, I'm attracted to the notion of providing the
growing-degree-day calculations through *get_extension_list* for use
by *cheetah* in templates for ... generating images.
o Perhaps images could be conjured in real-time using something like
Google Chart's Visualization JavaScript APIs. Embedding the
JavaScript (and data) in *cheetah* templates should be
straightforward. This relies on (an indeterminate amount of) client
horsepower being available to conjure the images. Also, the host
site will wish to serve the (huge burden of) JavaScript on every
access to avoid the appearance of cross-site scripting if possible.
And it makes any such application dependent on a big, fickle outside
software-development organization, which will be forever totally
oblivious of the needs of the *weeWX* community among others.
o Perhaps images could be conjured ahead of time as they are now using
a *python* script, but the script itself would be a *cheetah*
template. This would allow specially calculated data to be
embedded. Images could then be uploaded and served to all comers
without further modification until the next generation cycle with
great savings of client-side and server-side resources.
I'm not talking here about a generalized image-scripting language,
but a *python* module that imports some handy special-purpose
classes to make *weeWX* image generation fairly terse. Of course,
images are deceptively simple things that hide excruciatingly
detailed specs. Templating images will not be easy. It will not
replace *ImageGenerator*, nor will it ever be for the
faint-of-heart.
I think generating a *python* image-generation script from *cheetah*
has the advantage, though, of abstracting image generation from the
database structure, reporting cycles, and *weeWX* implementation
details. It would promote *weeWX* extensibility. Also, it opens
the possibility of using plotting packages other than PIL. My
inclination is to use *matplotlib* instead. Would those who have
used both recommend something else?
> If you can looke into the Seedes of Time,
> And say, which Graine will grow, and which will not,
> Speake then to me, who neyther begge, nor feare
> Your fauors, nor your hate.
I'd like my development not to conflict with previous or future
*weeWX* development. Are there things that have been tried and
abandoned that would impact image templating? Are there things in
the works that would conflict with using *matplotlib*? Are there
better options for image templating?