# Wind is a reformatted version of these queries:
# select sum(n) as n, sum(nne) as nne, sum(ne) as ne, sum(ene) as ene, sum(e) as e, sum (ese) as ese, sum(se) as se, sum(sse) as sse, sum(s) as s, sum(ssw) as ssw, sum(sw) as sw, sum(wsw) as wsw, sum(w) as w, sum(wnw) as wnw, sum(nw) as nw, sum(nnw) as nnw from (select date(dt), sum(n) as n, sum(nne) as nne, sum(ne) as ne, sum(ene) as ene, sum(e) as e, sum (ese) as ese, sum(se) as se, sum(sse) as sse, sum(s) as s, sum(ssw) as ssw, sum(sw) as sw, sum(wsw) as wsw, sum(w) as w, sum(wnw) as wnw, sum(nw) as nw, sum(nnw) as nnw from hourly_wind_dir_bins where extract(hour from dt) between 13 and 17 and date(dt) in ('2009-06-08', '2009-06-15', '2009-06-16', '2009-06-18', '2009-06-19', '2009-06-22', '2009-06-23', '2009-06-25', '2009-06-26', '2009-06-30', '2009-07-01', '2009-07-06', '2009-07-07', '2009-07-09', '2009-07-10', '2009-07-13') group by date(dt) order by date(dt)) as foo;
# and
#select sum(n) as n, sum(nne) as nne, sum(ne) as ne, sum(ene) as ene, sum(e) as e, sum (ese) as ese, sum(se) as se, sum(sse) as sse, sum(s) as s, sum(ssw) as ssw, sum(sw) as sw, sum(wsw) as wsw, sum(w) as w, sum(wnw) as wnw, sum(nw) as nw, sum(nnw) as nnw from (select date(dt), sum(n) as n, sum(nne) as nne, sum(ne) as ne, sum(ene) as ene, sum(e) as e, sum (ese) as ese, sum(se) as se, sum(sse) as sse, sum(s) as s, sum(ssw) as ssw, sum(sw) as sw, sum(wsw) as wsw, sum(w) as w, sum(wnw) as wnw, sum(nw) as nw, sum(nnw) as nnw from hourly_wind_dir_bins where extract(hour from dt) between 04 and 08 and date(dt) in ('2009-05-13', '2009-05-14', '2009-05-15', '2009-05-18', '2009-05-21', '2009-05-22', '2009-05-26', '2009-05-27', '2009-05-29', '2009-06-02', '2009-06-05', '2009-06-08', '2009-06-15', '2009-06-16', '2009-06-18', '2009-06-19', '2009-06-22', '2009-06-23', '2009-06-25', '2009-06-26', '2009-06-30', '2009-07-01', '2009-07-06', '2009-07-07', '2009-07-09', '2009-07-10', '2009-07-13') group by date(dt) order by date(dt)) as foo;
# (actually just columns 2 and 3. Columns 4 and 5 are from get_wind_data.sql)
set auto x
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.9
set xtic rotate by -45
set ylabel 'Count x Average wind speed'
set xlabel 'Wind direction'
set title 'Wind direction and speed while riding to and from work, 2009'
set output 'wind_histogram.svg'
set terminal svg size 646,480 enhanced font "Helvetica,10"
# plot 'wind2' using 2:xtic(1) ti col lc rgb "green" fs solid, '' using 3 ti col lc rgb "red" fs solid
plot 'wind2' using 4:xtic(1) ti col lc rgb "green" fs solid, '' using 5 ti col lc rgb "red" fs solid
set output 'wind_histogram.png'
set terminal png truecolor enhanced small size 640,480
# plot 'wind2' using 2:xtic(1) ti col lc rgb "green" fs solid, '' using 3 ti col lc rgb "red" fs solid
plot 'wind2' using 4:xtic(1) ti col lc rgb "green" fs solid, '' using 5 ti col lc rgb "red" fs solid