Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Last active December 5, 2022 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gro-Tsen/26b38741fd94c213cb5312d0b1e23b70 to your computer and use it in GitHub Desktop.
Save Gro-Tsen/26b38741fd94c213cb5312d0b1e23b70 to your computer and use it in GitHub Desktop.
## Get data from https://odre.opendatasoft.com/explore/dataset/eco2mix-national-cons-def/information/
## assumed stored in /tmp/eco2mix-national-cons-def.csv
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[5]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/consumption.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/consumption.png"' ; echo 'stats "/tmp/consumption.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de puissance électrique consommée en France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/consumption.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[11]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/nuclear.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/nuclear.png"' ; echo 'stats "/tmp/nuclear.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de production nucléaire en France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/nuclear.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; $v=$F[8]+$F[9]+$F[10]; print "$F[4]\t$v\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/fossilfuels.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/fossilfuels.png"' ; echo 'stats "/tmp/fossilfuels.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de production thermique fossile en France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/fossilfuels.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[12]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/windpower.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/windpower.png"' ; echo 'stats "/tmp/windpower.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de production éolienne en France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/windpower.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[13]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/solarpower.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/solarpower.png"' ; echo 'stats "/tmp/solarpower.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de production solaire en France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/solarpower.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[14]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/hydraulic.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/hydraulic.png"' ; echo 'stats "/tmp/hydraulic.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de production hydroélectrique en France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/hydraulic.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[23]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/germanybelgium.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/germanybelgium.png"' ; echo 'stats "/tmp/germanybelgium.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %s%.2f GW", (st_mean_y<0?"−":"+"), abs(st_mean_y))' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution échanges électriques Allemagne+Belgique ↔ France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance importée P (GW) → France"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [st_min_y:st_max_y] "/tmp/germanybelgium.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[21]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/italy.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/italy.png"' ; echo 'stats "/tmp/italy.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %s%.2f GW", (st_mean_y<0?"−":"+"), abs(st_mean_y))' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution échanges électriques Italie ↔ France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance importée P (GW) → France"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [st_min_y:st_max_y] "/tmp/italy.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[19]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/greatbritain.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/greatbritain.png"' ; echo 'stats "/tmp/greatbritain.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %s%.2f GW", (st_mean_y<0?"−":"+"), abs(st_mean_y))' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution échanges électriques Grande-Bretagne ↔ France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance importée P (GW) → France"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [st_min_y:st_max_y] "/tmp/greatbritain.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[20]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/spain.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/spain.png"' ; echo 'stats "/tmp/spain.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %s%.2f GW", (st_mean_y<0?"−":"+"), abs(st_mean_y))' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution échanges électriques Espagne ↔ France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance importée P (GW) → France"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [st_min_y:st_max_y] "/tmp/spain.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[5]; print "$F[4]\t$F[22]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/switzerland.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/switzerland.png"' ; echo 'stats "/tmp/switzerland.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %s%.2f GW", (st_mean_y<0?"−":"+"), abs(st_mean_y))' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution échanges électriques Suisse ↔ France {/*0.5 (juin 2017 à mai 2022)}"' ; echo 'set ylabel "Puissance importée P (GW) → France"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [st_min_y:st_max_y] "/tmp/switzerland.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[2] =~ m/^[0-9]{4}-(06|07|08)-/; next unless $F[5]; print "$F[4]\t$F[5]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/consumption-summer.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/consumption-summer.png"' ; echo 'stats "/tmp/consumption-summer.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de puissance électrique consommée en France en été {/*0.5 (juin 2017 à mai 2022: juin à août)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/consumption-summer.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
perl -F';' -ne 'next unless $F[2] ge "2017-06-01" && $F[2] lt "2022-06-01"; next unless $F[2] =~ m/^[0-9]{4}-(12|01|02)-/; next unless $F[5]; print "$F[4]\t$F[5]\n"' /tmp/eco2mix-national-cons-def.csv | sort -n -k 1 | sort -r -n -k 2 > /tmp/consumption-winter.dat
(echo 'set terminal pngcairo size 800,600' ; echo 'set output "/tmp/consumption-winter.png"' ; echo 'stats "/tmp/consumption-winter.dat" using ($0+1):($2/1000) name "st"' ; echo 'avgtitle=sprintf("moyenne: %.2f GW", st_mean_y)' ; echo 'devtitle=sprintf("σ = %.2f GW", st_stddev_y)' ; echo 'set title "Distribution de puissance électrique consommée en France en hiver {/*0.5 (juin 2017 à mai 2022: décembre à février)}"' ; echo 'set ylabel "Puissance P (GW)"' ; echo 'set xlabel "Proportion du temps ≥P"' ; echo 'plot [0:1] [0:st_max_y] "/tmp/consumption-winter.dat" using (($0+1)/st_max_x):($2/1000) with lines lc rgb "#ff0000" title "distribution", "" using (0):(st_mean_y):(1):(0) with vec nohead lc rgb "#404040" title avgtitle, "" using (0):(st_mean_y-st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 title devtitle, "" using (0):(st_mean_y+st_stddev_y):(1):(0) with vec nohead lc rgb "#404040" dashtype 2 notitle') | gnuplot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment