Ah, well spotted. This will be a python2/python3 issue. In python 2 / is 
integer division if both operands are integers. But in python3 / is 
floating point division irrespective of the operands. So the vantage driver 
would have worked correctly for WeeWX v3.x as well as for v4.x under 
python2. WeeWX v4.x under python3 will exhibit the incorrect behaviour. 
Guess a change is in order.

Gary

On Tuesday, 30 June 2020 22:47:25 UTC+10, Jacques Terrettaz wrote:
>
> HI,
>
> I checked with my Davis station and I am observing exactly the same kind 
> of differences. I think the problem is coming from the vantage weewx driver 
> :
>
> Here are my data concerning sunrise :
>
>    - the console displays 05:46 for sunrise. This is correct
>    - the raw loop data for sunrise, as received by Weewx , is 546 
>    - weewx vantage driver is converting the raw loop data into seconds 
>    using this function 
>    'sunrise'         : lambda p, k: 3600 * (p[k] / 100) + 60 * (p[k] % 100
>    ),
>     giving :  3600 * (546/100) + 60 * 46 =* 22416*.   This is wrong, it 
>    should be 3600 * (*500*/100) + 60 * 46 = *20760*
>
> Should the right formulas be :
> 'sunrise'         : lambda p, k: 3600 * (p[k] // 100) + 60 * (p[k] % 100),
> 'sunset'          : lambda p, k: 3600 * (p[k] // 100) + 60 * (p[k] % 100),
>
>
> ?
>
>
> Le mardi 30 juin 2020 13:03:37 UTC+2, Constantine Samaklis a écrit :
>>
>> I did what you suggested (settings where fine to begin with) but still 
>> getting 20min discrepancies which are not explained by the loss of accuracy 
>> on the lon/lat.
>>
>> Wondering what to try next.
>>
>> On Tuesday, June 30, 2020 at 6:44:53 AM UTC-4, gjr80 wrote:
>>>
>>> No problems, it's just that sunrise/sunset can come from up to three 
>>> different sources and you need to to know which source is the problem in 
>>> order to troubleshoot.
>>>
>>> You are right that the sunrise/sunset in loop packets comes from the 
>>> console.  So in this case pyephem does not come into play nor does the 
>>> lat/long settings in weewx.conf. You need to check/set the lat/long 
>>> settings in your console, either via the console buttons or through use of 
>>> the wee_device <http://weewx.com/docs/hardware.htm#vantage_notes> 
>>> utility (note the if using wee_device you need to stop WeeWX first). From 
>>> memory the console (via buttons or wee_device) accepts decimal degrees with 
>>> a max resolution of 0.1 degree. Not sure a 0.1 degree resolution should 
>>> result in an inaccuracy of 20+ minutes though. 
>>>
>>> Gary
>>>
>>> On Tuesday, 30 June 2020 20:19:21 UTC+10, Constantine Samaklis wrote:
>>>>
>>>> My bad, I should have been more thorough with details. I was under the 
>>>> impression that the sunrise/sunset times were provided directly by the 
>>>> Davis console and not calculated.
>>>>
>>>> The values I am getting are coming from the LOOP when running weewxd
>>>>
>>>> LOOP:   2020-06-30 06:07:56 EDT (1593511676) altimeter: 
>>>> 29.887106231687923, barometer: 29.88, cloudbase: 1238.2237428350452, 
>>>> consBatteryVoltage: 3.75, dateTime: 1593511676, dayET: 0.0, dayRain: 0.0, 
>>>> dewpoint: 64.5434155315258, extraAlarm1: 0, extraAlarm2: 0, extraAlarm3: 
>>>> 0, 
>>>> extraAlarm4: 0, extraAlarm5: 0, extraAlarm6: 0, extraAlarm7: 0, 
>>>> extraAlarm8: 0, forecastIcon: 6, forecastRule: 45, heatindex: 69.6, 
>>>> inDewpoint: 45.1326136300073, inHumidity: 53.0, insideAlarm: 0, inTemp: 
>>>> 62.5, leafWet4: 0.0, monthET: 0.0, monthRain: 1.89, outHumidity: 84.0, 
>>>> outsideAlarm1: 0, outsideAlarm2: 0, outTemp: 69.6, pressure: 
>>>> 29.788405301826174, rain: 0.0, rainAlarm: 0, rainRate: 0.0, 
>>>> soilLeafAlarm1: 
>>>> 0, soilLeafAlarm2: 0, soilLeafAlarm3: 0, soilLeafAlarm4: 0, stormRain: 
>>>> 0.0, 
>>>> sunrise: 1593510480.0, sunset: 1593564480.0, txBatteryStatus: 0, 
>>>> usUnits: 1, windchill: 69.6, windDir: None, windGust: 0.0, windGustDir: 
>>>> None, windSpeed: 0.0, windSpeed10: 1.0, yearET: 0.0, yearRain: 14.08
>>>>
>>>> I do have the following version of ephem: python3-ephem                 
>>>>        3.7.6.0-7+b1 
>>>>
>>>> Weewx is running on Python 3.7 
>>>>
>>>>     # Latitude and longitude in decimal degrees
>>>>     latitude = 40.624573
>>>>     longitude = -74.012931
>>>>
>>>> On Monday, June 29, 2020 at 10:23:36 PM UTC-4, gjr80 wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I think we need to sort the apples from the oranges and bananas. 
>>>>> Exactly what are you showing us? Is that the sunrise/sunset times as 
>>>>> displayed on the console or as displayed in loop packet/archive record or 
>>>>> as returned by a tag in a report? What latitude/longitude do you have set 
>>>>> in your console and in weewx.conf? Do you have pyephem installed for 
>>>>> the version of python that WeeWX is being run under?
>>>>>
>>>>> Sorry for the questions, but it's a bit like the 'pressures'; there 
>>>>> are a number of moving parts to this and unless you know exactly what is 
>>>>> being looked at it is hard to give a meaningful answer.
>>>>>
>>>>> Gary
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, 30 June 2020 11:16:33 UTC+10, Constantine Samaklis wrote:
>>>>>>
>>>>>> Wondering if anyone is having the same issue. In the last 3-4 days my 
>>>>>> Vantage pro is showing the wrong sunrise and sunset times. I am in NY 
>>>>>> and 
>>>>>> the console is set to EST daylight savings and the current time value is 
>>>>>> displayed correctly. 
>>>>>>
>>>>>> For sunset I get: 1593478080, which is 8:48PM EST and for sunrise I 
>>>>>> get: 1593424080 which is 5:48am EST.
>>>>>>
>>>>>> These timings are off by 20+ minutes. Not sure if this is something 
>>>>>> that anyone else is experiencing. 
>>>>>>
>>>>>

-- 
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/e2916cc7-d8cb-4877-86a0-40d7bb251beco%40googlegroups.com.

Reply via email to