1# csv-to-resd
2
3This directory contains the CSV2RESD tool, which allows converting CSV files to RESD (**RE**node **S**ensor **D**ata) file format.
4
5## Usage
6
7### Syntax
8`./csv2resd.py [GROUP1] [GROUP2] [GROUP2] ...`
9`GROUP ::= --input <csv-file> [--map <type>:<field(s)>:<target(s)>*:<channel>*] --start-time <start-time> --frequency <frequency> --timestamp <timestamp>`
10
11Syntax allows for multiple specification of group, where `--input` is a delimiter between groups.
12For each `--input`, multiple mappings (`--map`) can be specified. The `*` in `--map` signs, that given property is optional:
13`--map <type>:<field(s)>`, `--map <type>:<field(s)>:<target(s)>`, `--map <type>:<field(s)>:<target(s)>:<channel>` and `--map <type>:<field>::<channel>` are all correct mappings.
14
15For more information, refer to `--help`.
16
17### Example
18
19`./csv2resd.py --input first.csv --map temperature:temp1::0 --map temperature:temp2::1 --start-time 0 --frequency 1 --input second.csv --map temperature:temp::2 --start-time 0 --frequency 1 output.resd`
20
21**first.csv**
22```
23temp1,temp2
2432502,32003
2532638,31603
2632633,31565
2733060,31975
2831617,32368
2932912,31284
3031813,31915
3131999,31961
3231811,32049
3331427,32409
34```
35
36**second.csv**
37```
38temp
3932139
4032253
4132402
4232004
4332037
4432698
4531687
4632658
4732452
4832300
49```
50
51Above example extracts `temp1` and `temp2` columns from `first.csv` and `temp` from `second.csv`, and then maps it to temperature channels `0`, `1` and `2` in RESD respectively.
52