[weewx-user] Re: Keeping custom software calcs over update

2017-05-25 Thread Karl Grant
Just to follow up. I changed the group of extraTemp1  to group_degree_day 
in units.py. that is a workaround for the time being. I'd forgotten I'd 
done that before and explains why it appeared broken on update.


-- 
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.


[weewx-user] Re: Keeping custom software calcs over update

2017-03-12 Thread gjr80
Actually, I think I may have told you a fib. Whilst it is true that 
StdWXCalculate will first apply a conversion to US units and then later a 
conversion back to the original unit system, such a 'double conversion' has 
no net effect on a temperature difference (converting a difference of say 
10C to F will give a value that is wrong (in this case 50F) but when this 
wrong value is converted back to C you get the original C value (again in 
this case 10C)). The 'double conversion' is not the source of the error but 
rather the final conversion is. You are using METRICWX units in your 
database so StdWXCalculate receives packets with temperature values in C. 
StdWXCalculate 
converts these to F (the first conversion to US units) and then does its 
calculations. So your calc_extraTemp1() method calculates extraTemp1 in F. 
When StdWXCalculate is finished calculating it converts the packet from US 
units 
back to METRICWX so your extraTemp1 is converted to C, but because extraTemp1 
is a temperature difference the resulting C value is incorrect. This is 
what you are seeing now, whilst there have been a number of changes to 
StdWXCalculate 
since 3.5.0 was released (March 2016) I don't believe any of these change 
would account for why your approach no longer works.

One good thing though, the realisation that the 'double conversion' has no 
net effect means that the StdCalibrate approach should work. I ran up a 
machine and loaded weeWX 3.5.0 with a METRICWX database and the StdCalibrate 
approach gave an extraTemp1 with the correct value and units. As long as 
you don't want to display extraTemp1 in F it should do what you want.

Gary

On Sunday, 12 March 2017 06:36:44 UTC+10, Karl Grant wrote:
>
> Thanks for your detailed reply. It was working in 3.5, though I didn't 
> document any other changes. 
> Now that I'm typing I remember sonething about using degree days as a unit 
> as that converts okay.
> Iif I get time I might look at creating a temperature difference group 

-- 
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.


[weewx-user] Re: Keeping custom software calcs over update

2017-03-11 Thread Karl Grant
Thanks for your detailed reply. It was working in 3.5, though I didn't document 
any other changes. 
Now that I'm typing I remember sonething about using degree days as a unit as 
that converts okay.
Iif I get time I might look at creating a temperature difference group 

-- 
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.


[weewx-user] Re: Keeping custom software calcs over update

2017-03-10 Thread gjr80
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.49.1 -4.5  22.40 9.10 
> -4.50 
> 13.3 72.32 48.38 23.94 -4.48 
> 2017-03-08 23:41:00  22.49.1 -4.5  22.40 9.10 
> -4.50 
> 13.3 72.32 48.38 23.94 -4.48 
> 2017-03-08 23:51:01  22.49.1 -4.5  22.40 9.10 
> -4.50 
> 13.3 72.32 48.38 23.94 -4.48 
> 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.


[weewx-user] Re: Keeping custom software calcs over update

2017-03-10 Thread Karl Grant
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.49.1 -4.5  22.40 9.10 
-4.50 
13.3 72.32 48.38 23.94 -4.48 
2017-03-08 23:41:00  22.49.1 -4.5  22.40 9.10 
-4.50 
13.3 72.32 48.38 23.94 -4.48 
2017-03-08 23:51:01  22.49.1 -4.5  22.40 9.10 
-4.50 
13.3 72.32 48.38 23.94 -4.48 
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.