run.sh (721B)
1 #!/bin/bash 2 3 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 cd "$DIR" 5 6 FILE="$1" 7 LOCALCODE="$2" 8 LAT="$3" 9 LON="$4" 10 NOISE="$5" 11 12 if [ ! -f airports.dat ] 13 then 14 echo "Downloading OpenFlights database" 15 wget "https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports-extended.dat" -O airports.dat 16 fi 17 18 ./compute.py "$FILE" "$LOCALCODE" > trips 19 paste -d, trips \ 20 <(cut -d, -f2,3 trips | tr ',' ' ' | sed "s/^/$LAT $LON /" | GeodSolve -i| cut -d ' ' -f3 ) | 21 sort -t',' -k4,4nr > trips_with_dist 22 ./addnoise.py "$NOISE" < trips_with_dist | sort -t',' -k2,2n | 23 cat <(echo 'mode,distance in meters') - > trips_anonymized.csv 24 python3 co2.py < trips_with_dist > trips_with_footprint 25