As you have confirmed python will quite happily parse a numeric date-time 
given a suitable format string. In this case the problem is within 
wee_import itself; wee_import assumes that a numeric date-time field is a 
unix epoch timestamp and uses the raw date-time data as is (WeeWX records 
date-time data as unix epoch timestamps). Ultimately when WeeWX tries to 
interpret this raw data as a unix epoch timestamp the result is a nonsense 
date-time well into the future.

This will need a change to wee_import, let me think about how to best do 
this.

Gary
On Saturday, 11 March 2023 at 20:37:13 UTC+10 William wrote:

> Hi,
>
> I'm trying to import historical data into my new weewx installation. 
> Following the documentation and the sample import config, I can't seem to 
> get the date and time to parse correctly. I'm using weewx version 4.10.2 
> and wee_import version 0.7, as both were pulled down through the apt 
> package repository today.
>
> In my archive data, my date and time are stored in a RecDate field and 
> uses the format YYYYmmddHHMM. Example: 201105060957 would be more 
> appropriately readable as 2011-05-06 09:57.
>
> In the import configuration file I have raw_datetime_format = %Y%m%d%H%M, 
> and in the FieldMap stanza, dateTime = RecDate, unix_epoch.
>
> When I do a dry run on a single record, it shows a wild date (year 8342!) 
> with the message: 
>
> Unique records processed: 1; Last timestamp: 8342-10-07 16:55:57 EDT 
> (201105060957)
>
> When I run it on a different data set it sees 202303110321 as timestamp: 
> 8380-09-24 00:25:21 EDT
>
> Am I missing something in the config? I'm fairly certain the Python 
> strptime format is correct, and have tested it in a Python script:  
> dateTime = datetime.strptime('201105060957', '%Y%m%d%H%M') 
>
> returns 
>
> datetime.datetime(2011, 5, 6, 9, 57)
> Any feedback would be greatly appreciated. Thank you! 
>

-- 
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/7e7a0d79-f4f8-45a3-9a2d-207694742112n%40googlegroups.com.

Reply via email to