CSV file and header

84 views
Skip to first unread message

Jacques-Olivier Farcy

unread,
Oct 5, 2017, 10:24:00 AM10/5/17
to weewx-user

Hello,

I installed CSV extension, so i have file that contains data.

Each line is like :

1507192360,0.5,None,48.6268182648,30.191,638.542015783,4.73,0.001,0.01,49.7564151306,0,0,0,0,0,0,0,0,6,44,50.3,52.4888662166,49.4815030574,53.0,67.2,
0,0.0,None,0.22,0.2,98.0,50.3,0,0,None,118.0,None,0,0.0,0,0,0,0,0.0,1507182960,1507224120,0,0,1,257.0,3.0,257.0,3.0,2.0,50.3,24.91,24.12

I understand that 1507192360 is the timestamp.
But even if i had set up the CSV extension to put headers in the weevx.conf file, i don't have it in the CSV.

So do you know where I can find out for each number which data this corresponds to ?

Jacques-Olivier

Andrew Milner

unread,
Oct 5, 2017, 10:52:43 AM10/5/17
to weewx-user
Did you delete the csv and stop/start weewx after changing weewx.conf to produce headers?

if not - then try:
a) stop weewx
b) set weewx.conf to produce header
c) delete existing csv file
d) start weewx

Jacques-Olivier Farcy

unread,
Oct 5, 2017, 2:04:28 PM10/5/17
to weewx...@googlegroups.com
Well i've done that several times.

I also changed the code to have file named data-year-month.csv and it works.

But no headers in the file.

And i don't find any command to get this information.



--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/KxNNsAhm274/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

mwall

unread,
Oct 5, 2017, 10:17:01 PM10/5/17
to weewx-user
On Thursday, October 5, 2017 at 2:04:28 PM UTC-4, Jacques-Olivier Farcy wrote:
Well i've done that several times.

I also changed the code to have file named data-year-month.csv and it works.

But no headers in the file.

there was a bug in the logic for emitting a header.

please use weewx-csv v0.7

v0.7 also includes the 'append_datestamp' option (enabled by default) that puts YYYY-mm in the filename.

Jacques-Olivier Farcy

unread,
Oct 9, 2017, 5:24:24 AM10/9/17
to weewx...@googlegroups.com
Hello Mario,

I have an error after testing this new version :
(I uninstalled the 0.4, and installed 0.7)
...
Oct  9 11:18:56 raspberrypi weewx[1650]: engine: Loading service user.csv.CSV
Oct  9 11:18:56 raspberrypi weewx[1650]: engine: Caught unrecoverable exception in engine:
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****  global name 'syslog' is not defined
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****  Traceback (most recent call last):
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****    File "/usr/share/weewx/weewx/engine.py", line 865, in main
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****      engine = engine_class(config_dict)
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****    File "/usr/share/weewx/weewx/engine.py", line 77, in __init__
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****      self.loadServices(config_dict)
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****    File "/usr/share/weewx/weewx/engine.py", line 141, in loadServices
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****      self.service_obj.append(weeutil.weeutil._get_object(svc)(self, config_dict))
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****    File "/usr/share/weewx/user/csv.py", line 29, in __init__
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****      loginf("service version is %s" % VERSION)
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****    File "/usr/share/weewx/user/csv.py", line 21, in loginf
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****      logmsg(syslog.LOG_INFO, msg)
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****  NameError: global name 'syslog' is not defined
Oct  9 11:18:56 raspberrypi weewx[1650]:     ****  Exiting.

--

Glenn McKechnie

unread,
Oct 9, 2017, 6:24:29 AM10/9/17
to weewx...@googlegroups.com
Hi,

Open /usr/share/weewx/user/csv.py with a text editor and add the
following - import syslog - after the - import time - line.
Save the file and restart weewx --- /etc/init.d/weewx restart

An snippet follows with that addition made (ie:- the last line.)

# $Id: csv.py 1748 2017-10-06 01:45:25Z mwall $
# Copyright 2015 Matthew Wall

import os
import os.path
import time
import syslog
Cheers
Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie


On 9 October 2017 at 20:24, Jacques-Olivier Farcy
>> weewx-user+...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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.

Jacques-Olivier Farcy

unread,
Oct 9, 2017, 6:37:48 AM10/9/17
to weewx...@googlegroups.com
Youhou it works great THANK you Glenn
I work with scientific researchers here, they need those datas.


2017-10-09 12:24 GMT+02:00 Glenn McKechnie <glenn.m...@gmail.com>:
Hi,

Open /usr/share/weewx/user/csv.py with a text editor and add the
following -  import syslog - after the - import time - line.
Save the file and restart weewx --- /etc/init.d/weewx restart

An snippet follows with that addition made (ie:-  the last line.)

# $Id: csv.py 1748 2017-10-06 01:45:25Z mwall $
# Copyright 2015 Matthew Wall

import os
import os.path
import time
import syslog
Cheers
 Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie


On 9 October 2017 at 20:24, Jacques-Olivier Farcy

>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/KxNNsAhm274/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.

mwall

unread,
Oct 9, 2017, 7:19:09 AM10/9/17
to weewx-user
sorry about that missing import.

fixed in weewx-csv version 0.8

Jacques-Olivier Farcy

unread,
Oct 9, 2017, 7:41:01 AM10/9/17
to weewx...@googlegroups.com
One other thing ... Will it be easy to add an option to be able to transform timestamp (the first field of each lines) into human readable date and time ?

2017-10-09 13:19 GMT+02:00 mwall <mw...@users.sourceforge.net>:
sorry about that missing import.

fixed in weewx-csv version 0.8

mwall

unread,
Oct 9, 2017, 7:57:52 AM10/9/17
to weewx-user
On Monday, October 9, 2017 at 7:41:01 AM UTC-4, Jacques-Olivier Farcy wrote:
One other thing ... Will it be easy to add an option to be able to transform timestamp (the first field of each lines) into human readable date and time ?

i thought that unix epoch *is* human readable ;)

please try weewx-csv v0.9

use the option 'timestamp_format', for example:

[CSV]
    ...
    timestamp_format = %Y-%m-%d %H:%M:%S

all times are utc.  changing to a different timezone is left as an exercise for the reader.

m

Jacques-Olivier Farcy

unread,
Oct 9, 2017, 8:12:47 AM10/9/17
to weewx...@googlegroups.com
Thanks i will test this tomorrow.

Reply all
Reply to author
Forward
0 new messages