Nicolas,

Thanks for the feedback, I will get onto looking at each issue. Some 
initial comments below.

Gary

On Friday, 21 February 2020 18:54:29 UTC+10, Nicolas CUVILLIER wrote:
>
> Gary
>
> I am trying to import my historical data from underground.
> If I understood you wrote the utility
>
> I got some problem, and here is how I was able to work around the three 
> issues I encountered:
> Note that this are my first lines in Python, I'm more a node's guy, then 
> double check my Python proposals...
>
>
> in wee_import.py (v4.00.b12), line 1068, current_rain can be None, and the 
> utility fail, and exit, please can you change the test:
> if current_rain >= last_rain:
> into
> if current_rain is not None and current_rain >= last_rain:
>
> Probably do need to catch current_rain == None, it really should not 
occur but if WU was to respond with an invalid rain value under some 
circumstances wee_import could take this as the value None.
 

> in wee_import, line 795, the test fail, I had to remove this test:
> *WeeWX 4.0.0 or greater is required, found 4.0.0b12. Nothing done, exiting*
>
> Was set to 4.0.0 in anticipation of 4.0 release, will set it to an earlier 
beta.
 

>
> in wuimport.py, line 297, can you replace the test, which is failing 
> sometime with an exit:
> (the expection does not initialise _date, not sure it is what is wanted ?)
> if obs == 'epoch':
> try:
> _date = datetime.date.fromtimestamp(_flat_record['epoch'])
> except ValueError:
> _flat_record['epoch'] = _flat_record['epoch'] // 1000
> by
> if _flat_record['epoch'] > 1000000000000:
> _flat_record['epoch'] = _flat_record['epoch'] // 1000
>
> # do we need to use a try here ?
> # what to put in _date if the function fail ?
> _date = datetime.date.fromtimestamp(_flat_record['epoch'])
>
> I need to look back at the code again but I believe this was handle the 
case where the timestamp received was in milliseconds (a la java) rather 
than seconds since epoch. _date is never used, rather we are looking for 
the exception that would be thrown if the timestamp was in milliseconds. 
Looking back at your weewx user thread it appears I need to trap 
OverflowError as well, odd as I distinctly remember testing that portion of 
the code. At this stage my preference is for the try..except as it seems 
more pythonic to me. Would need to better comment the code though. Like I 
said, need to look at the code.

I am running the import for now, but it will take some time.
> I'll send you more comments if I get other problem.
> thanks
> Nicolas
> NB: Is it possible to directly push change proposals in GitHub ? 
>

Best way to submits changes is via GitHub pull request, though this does 
require you to fork the WeeWX repo and submit the pull request via your 
fork.
 

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/8f563a11-465c-4bbc-99e8-032922efb5c9%40googlegroups.com.

Reply via email to