Increasing image size within Seasons skin

116 views
Skip to first unread message

Michael Waldor

unread,
Mar 8, 2023, 5:52:17 AM3/8/23
to weewx-user
I'm trying to adapt the Seasons skin so that all plots include forecast data from DWD (being available as a separate SQlite database within weewx). I'm using the Seasons skin withn current weewx 4.10.2 (I have augmented Seasons already to display some additional DWD forecast informations).

The from my perspective most complicated aspect is working flawlessly - mixing data from different databases within the same image.

But I'm stuck with changing the image size:

First, I'd like to extend the displayed timeline from 27h (default for one day) to 30h. That should be straightforward by modifing time_length to 108000. This change has an effect, but I get 48h instead. I've tried many other values, but the displayed time period is either 27h or 48h (and more). Howto get only 3 additional hours?

Next I wanted to increase the image size form the default 500px to 600px. Again trivial by adding image_width within some image in skin.conf. Works fine, the created image has the requested width of 600. But it is shrunk to 500px probadely by seasons.css. I tried to modify seasons.css within history_widget (from 500px to 600px). Modifing the css seems to have no effect on the rendering (tried to reload the web page after changing css at server location).

My third problem in reaching my goal (to draw forecast values) is howto restrict the forecast data onto the future? Currently the forecast database contains some old values from the past, and those values should be ignored and not pltted.

I myselve have tried for some hours, but I've to admit that I've no knowledge on webdesign - these are my first steps.

Regards, Michael

Cameron D

unread,
Mar 8, 2023, 7:33:09 AM3/8/23
to weewx-user
1. edit the width in skin.conf
2. edit the value in seasons.css for #history_widget  (where it says to match the skin.conf value)
3. copy the css file into place (I forgot that!)
4. ctrl-refresh to get full reload.

On Wednesday, 8 March 2023 at 8:52:17 pm UTC+10 Michael Waldor wrote:
...
Next I wanted to increase the image size form the default 500px to 600px. Again trivial by adding image_width within some image in skin.conf. Works fine, the created image has the requested width of 600. But it is shrunk to 500px probadely by seasons.css. I tried to modify seasons.css within history_widget (from 500px to 600px). Modifing the css seems to have no effect on the rendering (tried to reload the web page after changing css at server location).
...

Michael Waldor

unread,
Mar 8, 2023, 7:42:40 AM3/8/23
to weewx-user

Thanks for your quich reply. Changing the image size works fine in skin.conf, but modifing seasons.css (for testing purpose at /var/www/html/weewx being served by nginx) had no effect. Mayby cached within firefox dspite reload?

This is my current (testing) status within skin.conf - image sizes currently intentionally commented:

        [[[daytempdew]]]                                                        
#             image_width = 600                                                
#            image_height = 180                                                
            [[[[outTemp]]]]                                                    
                data_type = outTemp      
                data_binding = wx_binding
            [[[[dewpoint]]]]              
                data_type = dewpoint      
                data_binding = wx_binding
            [[[[forecast_outTemp]]]]    
                data_type = outTemp      
                label = ' '                                                    
                data_binding = dwd_binding
                color = blue                                                  
            [[[[forecast_dewpoint]]]]    
                data_type = dewpoint                          
                label = ' '                                        
                data_binding = dwd_binding        
                color = red                                                    
daytempdew.png

Cameron D

unread,
Mar 8, 2023, 7:50:40 AM3/8/23
to weewx-user
I do the image size change at the top level, so that all images are the same size.  I am not sure what happens if only one image is larger.

I tested with Firefox (windows x64) and Apache server.

Use F12 and inspect where the size directive is coming from, if you feel brave.

Michael Waldor

unread,
Mar 8, 2023, 8:01:05 AM3/8/23
to weewx-user
Thanks for that hint - currently I'm still experimenting with this new functionality.

In the meantime I could resolve my problem with seasons.css - it was a problem with caching within firefox. Even after deletion of /var/www/htmp/weew/seasons.css firefox did render it after reload/refresh. But when new images have been generated the missing seasons.css become obvious, and a new seasons.css will be used. Thus one problem solved!

Michael Waldor

unread,
Mar 8, 2023, 9:46:06 AM3/8/23
to weewx-user
Another experiment with the (new) DWD SQlite database - sadly failing:

From weewx customization guide I've learned that one might use (simple SQL) expressions to calculate new data within image generation. I gave it a try to calculate the windChill from the available SQL data like
        [[[daytempfeel]]]
            [[[[windchill]]]]
            [[[[heatindex]]]]
            [[[[forecast_windchill]]]]
                data_type = windchillMetric(outTemp, windSpeed)
                data_binding = dwd_binding
label = ' '
color = red
That stopped the image generator from further processing. Is this somehow possible?

Michael Waldor

unread,
Mar 8, 2023, 10:45:07 AM3/8/23
to weewx-user
I've done more experiments w.r.t. time_enght - if I increase its value by 1s from the default 27h I get an imagecoverring 48h (instead of 27h plus 1s). Thus the value 97200 is kind of magic to deliver the expected 27h, but it's not possible to increase the value even a little bit. See my appended picture with time_length = 97201.
daytempdew.png

Michael Waldor

unread,
Mar 11, 2023, 11:29:34 AM3/11/23
to weewx-user
I've digged a little bit within source code of weewx - especially bin/weewx/imagegenerator.py

My goal is to shift the timeline by an offset so that I can render data from the "future" (from the DWD forecast). And to my surprise it's really simple to introduce the new option time_offset by adding only one line of code into imagegenerator.py
...
        # Calculate a suitable min, max time for the requested time.

        plotgen_ts = plotgen_ts + int(plot_options.get('time_offset', 0))

        minstamp, maxstamp, timeinc = weeplot.utilities.scaletime(
            plotgen_ts - int(plot_options.get('time_length', 86400)), plotgen_ts)
        x_domain = weeutil.weeutil.TimeSpan(minstamp, maxstamp)
...
Within skin.conf I've added this "new" option time_offset = 259200 (3 days), and I get the intended shift of the timeline by 3 days (see appended image).

The only disadvantage is that the timestamp printed below the image is shifted, too. But I think that is by design (same for wee_report with timestamp option).

My suggestion: Please include my small change within the next release of weewx.

Regards, Michael
weektempdew.png

Michael Waldor

unread,
Mar 12, 2023, 1:37:42 AM3/12/23
to weewx-user
Adding a second change will correct the bottom_label if I'm using my new time_offest - simply subtract the offset in line 175 from plotgin_ts:
        # Get a suitable bottom label:
        bottom_label_format = plot_options.get('bottom_label_format', '%m/%d/%y %H:%M')
        bottom_label = time.strftime(bottom_label_format, time.localtime(
            plotgen_ts - int(plot_options.get('time_offset', 0))))
        plot.setBottomLabel(bottom_label)

Not a very elegant approach (to have this calculation at 2 places within the code), but it works fine.

Regards, Michael
Reply all
Reply to author
Forward
0 new messages