iccsa-21-wind

Wind Simulation Using High-Frequency Velocity Component Measurements
git clone https://git.igankevich.com/iccsa-21-wind.git
Log | Files | Refs

serial-import (691B)


      1 #!/bin/sh
      2 
      3 db=hold-peak.sqlite3
      4 tmp=$(mktemp)
      5 sqlite3 $db << 'EOF'
      6 CREATE TABLE IF NOT EXISTS load_cell_samples (
      7 timestamp INTEGER, t FLOAT,
      8 x INTEGER, y INTEGER, z INTEGER,
      9 sign_x INTEGER, sign_y INTEGER, sign_z INTEGER);
     10 EOF
     11 while read line
     12 do
     13     date=$(echo "$line" | sed -rne 's/([0-9]{2}):([0-9]{2}):([0-9]{2}).*/2021-04-17 \1:\2:\3/p')
     14     # we swap X and Y here, since the anemometere was rotated 90 degrees CW
     15     rest=$(echo "$line" | sed -rne 's/.*t ([^ ]+) x ([^ ]+) y ([^ ]+) z ([^ ]+) sx ([^ ]+) sy ([^ ]+) sz ([^ ]+).*/\1|\3|\2|\4|\5|\6|\7/p')
     16     date=$(date --date="$date" "+%s")
     17     echo "$date|$rest"
     18 done < $1 > $tmp
     19 sqlite3 $db ".import $tmp load_cell_samples"
     20 rm $tmp