forked from sftcd/tek_transparency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
just-pics.sh
executable file
·44 lines (38 loc) · 1.3 KB
/
just-pics.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# set -x
# (re)generate images for survey paper, with settings more suited for
# PDF/print version
x=${HOME:='/home/stephen'}
x=${TOP:="$HOME/code/tek_transparency"}
x=${OUTDIR="`/bin/pwd`"}
x=${OUTFILE:='country-counts.csv'}
x=${START:=''}
function whenisitagain()
{
date -u +%Y%m%d-%H%M%S
}
NOW=$(whenisitagain)
# and finally some pictures
cdate_list=`$TOP/shortfalls.py -rn -t $OUTDIR/$OUTFILE -d $TOP/country-pops.csv | \
awk -F, '{print $1$7}' | \
sed -e 's/\[//' | \
sed -e 's/]//' | \
sed -e "s/'//g" | \
sed -e 's/ /,/'`
for cdate in $cdate_list
do
country=`echo $cdate | awk -F, '{print $1}'`
enddate=`grep "^$country," $OUTDIR/$OUTFILE | awk -F, '{print $2}' | sort | tail -1`
sdate=`echo $cdate | awk -F, '{print $2}'`
if [[ "$START" != "" ]]
then
echo "Doing $country from $START to $enddate"
$TOP/plot-dailies.py -nt -c $country -1 -i $OUTDIR/$OUTFILE -s $START -o $country-from-$START-to-$enddate.png
elif [[ "$sdate" != "" ]]
then
echo "Doing $country from $sdate to $enddate"
$TOP/plot-dailies.py -nt -c $country -1 -i $OUTDIR/$OUTFILE -s $sdate -o $country-from-$sdate-to-$enddate.png
else
echo "No sign of start date for $country"
fi
done