Hi,

Your problem is nothing to do with the WMR200 driver but rather the 
internal workings of the StdWXCalculate service. Since you have your hands 
in wxservices.py, have a look at the do_calculations() method (circa line 
174), you will see that the data packet provided to StdWXCalculate is 
converted to US units before the calculations are done and then converted 
back to the archive unit system before exiting. This is what is causing 
your problems. WeeWX does not know how to convert a temperature difference 
between F and C and vice versa so your extraTemp1 field is getting a double 
conversion as if it was an absolute (as opposed to differential) F value. 
There is little you can do without further hacking of wxservices.py, you 
could save a copy of extraTemp1 at the start of the method before the 
conversion and then overwrite the incorrect value in the packet as the last 
thing before the method exits but that is getting messy. You are really 
just making yourself more of an orphan.

Unfortunately this also means that the StdCalibrate suggestion I made will 
also not work as StdCalibrate does its stuff before StdWXCalculate so it 
will suffer from the exact same problem. If you were only using the 
differenc in a report I wuld suggest doing the calculation with some 
in-line python in a template but you appear to want to plot the data, that 
means it must be in the archive.

Gary

On Saturday, 11 March 2017 07:41:57 UTC+10, Karl Grant wrote:
>
> I might try that, in the meantime I patch wxservices.py with 
> def calc_extraTemp1(self, data, data_type):
>         if 'inTemp' in data and 'outTemp' in data:
>            try:
>                 data['extraTemp1']= round(data['inTemp'] - data['outTemp'
> ],1)
>            except:
>                 pass
>
>
> I needed to use the try/except as it was crashing if there was 
> incorrect/null data in outTemp. This worked perfectly in 3.5, now I'm back 
> to having problems with F -> C conversion. My db is in MetricWX, 
> It appears that WeeWx is still working with degF, before conversion, 
>
> Data InTemp OutTemp CalcDifff 
> ActDiff InF OutF DiffF DiffFtoC 
> 2017-03-08 23:31:00  22.4        9.1         -4.5              22.40 9.10 
> -4.50 
> 13.3 72.32 48.38 23.94 -4.47777777777778 
> 2017-03-08 23:41:00  22.4        9.1         -4.5              22.40 9.10 
> -4.50 
> 13.3 72.32 48.38 23.94 -4.47777777777778 
> 2017-03-08 23:51:01  22.4        9.1         -4.5              22.40 9.10 
> -4.50 
> 13.3 72.32 48.38 23.94 -4.47777777777778 
> Is it anything to do with changes related to the wrm200 driver?
>
> On Wednesday, 8 March 2017 23:55:04 UTC, gjr80 wrote:
>>
>> Hi,
>>
>> One approach for a simple calculation like this could be to use the 
>> StdCalibrate service to set extraTemp1. In weewx.conf something 
>> like(untested):
>>
>> [StdCalibrate]
>>     [[Corrections]]
>>         extraTemp1 = inTemp - outTemp
>>
>> This will not be overwritten during upgrade and should achieve the same 
>> result. One thing to be aware of when using temperature differences is that 
>> weewx unit conversion will not work on a temperature difference. For 
>> example, if the driver for your station emits F and your database uses US 
>> units, but you try to display extraTemp1 in C it will be wrong. If you only 
>> display F you will be fine.
>>
>> 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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to