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


Michael Waldor schrieb am Mittwoch, 8. März 2023 um 16:45:07 UTC+1:

> 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.
>
> Michael Waldor schrieb am Mittwoch, 8. März 2023 um 15:46:06 UTC+1:
>
>> 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 schrieb am Mittwoch, 8. März 2023 um 14:01:05 UTC+1:
>>
>>> 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!
>>>
>>>
>>> Cameron D schrieb am Mittwoch, 8. März 2023 um 13:50:40 UTC+1:
>>>
>>>> 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.
>>>>
>>>> On Wednesday, 8 March 2023 at 10:42:40 pm UTC+10 Michael Waldor wrote:
>>>>
>>>>>
>>>>> 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                                           
>>>>>           
>>>>> Cameron D schrieb am Mittwoch, 8. März 2023 um 13:33:09 UTC+1:
>>>>>
>>>>>> 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).
>>>>>>
>>>>>> ...
>>>>>>
>>>>>>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/18bc39a6-17c0-4710-bc50-5fd60a0eab46n%40googlegroups.com.

Reply via email to