Hello, 
I have finally found the problem.
Seemingly the image generator is not case sensitive with the signal names.
The input signal was named 'rain_RG11'.

The unit group system IS case sensitive because in my plugin I linked
weewx.units.obs_group_dict['Rain_RG11'] = 'group_rain'

And so I got a graph but with no units on the y-axis and no conversion.

Regards,
engolling

Am Freitag, 22. November 2019 00:01:00 UTC+1 schrieb engolling:
>
> Hello,
>
> I checked my image generation settings again and I also tried to check the 
> imagegenerator.py file but I did not find any reason why the conversion to 
> "mm" is not applied or at least the native database unit "cm" is not 
> applies.
>
> I would be glad, if someone can give me a hint where this could come from 
> and what is the best way to debug.
>
> Regards,
> engolling
>
> Am Dienstag, 5. November 2019 22:18:59 UTC+1 schrieb engolling:
>>
>> Hello to all,
>>
>> I got another question. The import of additional rain works fine now.
>> So if a add the following tag to my template: 
>> $day.Rain_RG11.sum
>> I get the correct value in my preselected unit. (Database is metric and 
>> my default unit for group_rain is "mm")
>>
>> I'm also generating two graphs with the following code:
>>         [[[dayrain]]]
>>             # Make sure the y-axis increment is at least 0.02 for the 
>> rain plot
>>             yscale = None, None, 0.02
>>             plot_type = bar
>>             [[[[rain]]]]
>>                 aggregate_type = sum
>>                 aggregate_interval = 3600
>>                 label = Niederschlag (Stundenwerte)
>>         [[[dayrain_RG11]]]
>>             # Make sure the y-axis increment is at least 0.02 for the 
>> rain plot
>>             yscale = None, None, 0.02
>>             plot_type = bar
>>             [[[[rain_RG11]]]]
>>                 aggregate_type = sum
>>                 aggregate_interval = 3600
>>                 label = Niederschlag (Stundenwerte)
>>
>> Here I get the following images (do not look at the actual bar values - 
>> they are not representative and result due to testing):
>>
>> My self added rain source generates correct values but it does not 
>> display the unit and the values which are plotted are seeming to be in the 
>> native unit [cm] as it is stored in the database.
>> Does anybody has an idea what could be the matter here? Tags are working 
>> fine, but not the image generation.
>>
>> Thanks in advance for your answers.
>>
>> Regards,
>> engolling
>>
>>
>> Am Dienstag, 28. Mai 2019 00:20:07 UTC+2 schrieb gjr80:
>>>
>>> On Tuesday, 28 May 2019 06:52:22 UTC+10, engolling wrote:
>>>>
>>>> So I started off with the noob variant...
>>>> https://github.com/menachers/WeatherDuino/tree/master/WeeWx_Plugin
>>>>
>>>
>>> That looks like it will work, but be aware that if the record you are 
>>> augmenting is in anything other than US customary units no conversion will 
>>> be applied (this may be fine given your current setup but who knows how it 
>>> may change in the future). Nothing to worry about if you are going to 
>>> rewrite the code anyway.
>>>  
>>>
>>>> I will change it to the sophisticated procedure you proposed. 
>>>> As I got you right
>>>> # express our rainfall value as a ValueTuple
>>>> rainfall_vt = weewx.units.ValueTuple(rainfall, 'mm', 'group_rain')
>>>> I have to generate a tuple with the variable holding the actual value, 
>>>> followed by the unit of the signal as it can be found in the units.py dict 
>>>> and ending with the unit group which it belongs to.
>>>>
>>>
>>> Correct. The ValueTuple is the basis of the WeeWX system for unit 
>>> conversion; it brings together the value, the units used and the unit group 
>>> to which it belongs. When WeeWX needs to convert the value to some other 
>>> units or to the units used in a particular unit system (US, Metric or 
>>> MetricWX) the ValueTuple has the core information used to determine how to 
>>> do the conversion. You might want to look at the class ValueTuple in 
>>> bin/weewx/units.py 
>>> <https://github.com/weewx/weewx/blob/master/bin/weewx/units.py#L454>. 
>>> the other good thing about ValueTuple based conversion is that it will 
>>> handle the case where the data value is None - note how in the simple 
>>> approach I outlined we had to take care of the case where the data value 
>>> may be None. 
>>>
>>> Gary
>>>
>>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/c7e114a4-904d-44f1-a173-e8d8d0932c24%40googlegroups.com.

Reply via email to