Importing from CSV

76 views
Skip to first unread message

Andrea Di Saverio

unread,
Jul 15, 2022, 7:55:55 PM7/15/22
to weewx-user
Hello everybody.

I'm reading the doc about the importing process from csv file https://www.weewx.com/docs/utilities.htm#[CSV] and I'm confused about the configuration of the `dateTime` field: in the example csv provided by the doc, the date and time is `23 May 2018 13:00`. Let me quote:
```
date_and_time,temp,humid,wind,dir,rainfall,rad,river
23 May 2018 13:00,17.4,56,3.0,45,0.0,956,340
23 May 2018 13:05,17.6,56,1.0,22.5,0.4,746,341
```

But in the import-config-file the unit system specified is `unix_epoch`. Let me quote:
```
[[FieldMap]]
  dateTime = date_and_time, unix_epoch
```

So this is confusing to me, since date and time in the csv are not in unix epoch format.
What is going on?

Thanks

p q

unread,
Jul 15, 2022, 8:28:00 PM7/15/22
to weewx...@googlegroups.com
Read the doc down a bit under the heading 

raw_datetime_format


And see if that helps.

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/5d11ebca-abc9-497b-a076-79776dc16a75n%40googlegroups.com.


--
Peter Quinn
(415)794-2264

gjr80

unread,
Jul 15, 2022, 11:28:10 PM7/15/22
to weewx-user
The dateTime entry in a wee_import field map is a special case.  Whereas for other field map entries the mapped field is imported (and converted if necessary) from the specified units, the dateTime source field actually undergoes separate processing to derive the timestamp that is ultimately used as the dateTime entry. I appreciate the explanation of the field map in the Utilities Guide is somewhat misleading. Consequently, I have added a clarifying note to the CSV [[FieldMap]] stanza in the Utilities Guide. Since there are other changes to the Utilities Guide that are only applicable to the next WeeWX release, the note I added will appear when the next WeeWX release is published.

Gary

Andrea Di Saverio

unread,
Jul 16, 2022, 6:51:47 AM7/16/22
to weewx-user
So, if I am correct, I always have to specify `unix_epoch` as unit system for datetime field in the map, and then I have to correctly set my date format in the `raw_datetime_format` according to https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior

Thanks,
Andrea
Reply all
Reply to author
Forward
0 new messages