wee_import DateTime convert to timestamp

191 views
Skip to first unread message

Phil Owers

unread,
Jul 25, 2018, 11:56:52 AM7/25/18
to weewx-user
Hi All
I seem to be going round in circles.
Im trying to wee_import Vantage Pro files to weewx but cant get passed the datetime   Attached is a copy of  the problem
As you can see is the problem 2 fields (Date and Time) to get in to 1 timestamp.

sudo ./bin/wee_import --import-config=/home/weewx/util/import/import.conf --dry-run

Starting wee_import...

A CSV import from source file '/home/vancsv/jan18.csv' has been requested.

Using database binding 'wx_binding', which is bound to database 'weewx.sdb'

Destination table 'archive' unit system is '0x01' (US).

Missing derived observations will be calculated.

This is a dry run, imported data will not be saved to archive.

**** Invalid 'Date' field. Cannot convert '01/01/2018' to timestamp.

**** Nothing done, exiting.

 

Date,Time,Temp Out,Hi Temp,Low Temp,Out Hum,Dew Pt,Wind Speed,Wind Dir,Wind Run,Hi Speed,Wind Dir,Wind Chill,Heat Index,THW Index,THSW Index,Bar  ,Rain,Rain Rate,Solar Rad,Solar Energy,Hi Solar Rad,Uv Index,UV Dose,Hi UV,Heat D-D,Cool D-D,In Temp,In Humd,In Dew,In Heat,In EMC,In AirnDensity,ET ,Wind Stamp,Wind Tx,ISS Recept,Arc Int.

01/01/2018,00:30,6.3,6.7,6.3,88,4.5,8,W,4,24,SSW,3.7,6.3,3.7,2,991,0,0,0,0,0,0,0,0,0.25,0,9.8,70,4.6,9.6,13.35,0.0756,0,683,2,100,30

01/01/2018,01:00,6.3,6.4,6.3,87,4.3,7,W,3.5,23,SSW,4.1,6.3,4.1,2.2,992,0,0,0,0,0,0,0,0,0.25,0,9.7,70,4.5,9.4,13.35,0.0757,0.03,685,2,100,30

01/01/2018,01:30,6,6.3,6,87,4,8,SSW,4,24,SW,3.3,5.9,3.3,1.6,993,0,0,0,0,0,0,0,0,0.257,0,9.4,70,4.2,9.2,13.35,0.0758,0,684,2,100,30

 

 

Import.conf file

dateTime    = Date, unix_epoch

dateTime    = Date, %d/%m/%Y

dateTime    = Date, %d/%m/%Y %H:%M

 

Have tried the above 3 with the same results

 

Any ideas will greatly received.

 

Thank Phil


Andrew Milner

unread,
Jul 25, 2018, 9:58:15 PM7/25/18
to weewx-user
I suspect the , between date and time will present a problem - as a datetime field is expected rather than two separate fields - so can you replace the , with a space and then the format would then be 

raw_datetime_format = %m/%d/%Y %H:%M

Phil Owers

unread,
Jul 26, 2018, 5:33:33 AM7/26/18
to weewx-user
Thanks for the quick reply.
Changed the import -conf to 

dateTime = Date, %m/%d/%Y %H:%M

The reply was
Invalid 'Date' field. Cannot convert '01/01/2018' to timestamp.
Have I mis-read your suggestion.
THanks

 

Phil Owers

unread,
Jul 26, 2018, 5:51:41 AM7/26/18
to weewx-user
 Also took the comma out between date and time in the data as perhaps on reflection is what you meant

Date,Time,Temp Out,Hi Temp,Low Temp,Out Hum,Dew Pt,Wind Speed,Wind Dir,Wind Run,Hi Speed,Wind Dir,Wind Chill,Heat Index,THW Index,THSW Index,Bar  ,Rain,Rain Rate,Solar Rad,Solar Energy,Hi Solar Rad,Uv Index,UV Dose,Hi UV,Heat D-D,Cool D-D,In Temp,In Humd,In Dew,In Heat,In EMC,In AirnDensity,ET ,Wind Stamp,Wind Tx,ISS Recept,Arc Int.


01/01/2018 00:00,6.3,6.7,6.3,88,4.5,8,W,4,24,SSW,3.7,6.3,3.7,2,991,0,0,0,0,0,0,0,0,0.25,0,9.8,70,4.6,9.6,13.35,0.0756,0,683,2,100,30


The reply is now

Invalid 'Date' field. Cannot convert '01/01/2018 00:00' to timestamp

 

Andrew Milner

unread,
Jul 26, 2018, 5:52:13 AM7/26/18
to weewx-user
Yes, you did misunderstand a little
1.  amend the csv file so that date and time is in a single field let's call it time
2.  map time to dateTime in the config file
3. specify in the config file the format of the field called time - which would be the format I gave, and set the raw_datetime_format which is near the beginning of the config file to the required format string

Andrew Milner

unread,
Jul 26, 2018, 5:55:22 AM7/26/18
to weewx-user
Make sure the header row matches the data rows when you remove the comma from the data rows!!!!!

Phil Owers

unread,
Jul 26, 2018, 9:01:16 AM7/26/18
to weewx-user
Thanks Andrew for your help and patience
Feel a bit silly now as I had totally forgot about the raw_datetime_format = %m/%d/%Y %H:%M in the import-config file
It now works
Phil

Reply all
Reply to author
Forward
0 new messages