iccsa-21-wind

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

properties (1203B)


      1 #!/bin/sh
      2 
      3 db=samples/load-cell.sqlite3
      4 mkdir -p build
      5 
      6 print_errors() {
      7 sqlite3 $db "SELECT timestamp-(LAG(timestamp,1,0) OVER win) AS dt
      8 FROM samples WHERE ABS(x-$x_mean)>=10000 OR ABS(y-$y_mean)>=10000 OR ABS(z-$z_mean)>=10000
      9 WINDOW win AS (ORDER BY timestamp)
     10 " > build/errors
     11 sqlite3 $db "SELECT timestamp
     12 FROM samples WHERE ABS(x-$x_mean)>=10000 OR ABS(y-$y_mean)>=10000 OR ABS(z-$z_mean)>=10000 " > build/errors2
     13 }
     14 
     15 sqlite3 $db "SELECT DATETIME(MIN(timestamp),'unixepoch'),DATETIME(MAX(timestamp),'unixepoch') FROM samples"
     16 sqlite3 $db "SELECT PRINTF('Time span: %d days', (MAX(timestamp)-MIN(timestamp))/(60*60*24)) FROM samples"
     17 sqlite3 $db "SELECT PRINTF('Samples size: %d mb', SUM(pgsize)/1024/1024) FROM dbstat WHERE name='samples'"
     18 sqlite3 $db "SELECT PRINTF('Sample count: %d', COUNT(*)) FROM samples"
     19 x_mean=$(sqlite3 $db "SELECT AVG(x) FROM samples")
     20 y_mean=$(sqlite3 $db "SELECT AVG(y) FROM samples")
     21 z_mean=$(sqlite3 $db "SELECT AVG(z) FROM samples")
     22 echo "X mean = $x_mean"
     23 echo "Y mean = $y_mean"
     24 echo "z mean = $z_mean"
     25 echo -n "Sample count after filtering: "
     26 sqlite3 $db "SELECT COUNT(*) FROM samples WHERE ABS(x-$x_mean)<10000 AND ABS(y-$y_mean)<10000 AND ABS(z-$z_mean)<10000"