diff --git a/comp1204_cw1/comp1204_cw1.tar.gz b/comp1204_cw1/comp1204_cw1.tar.gz index dbbc1ea15fd63bdb06ad21771f68e2698b31b41d..e073379aaf71f284efb12fcb71213a13dcec80ad 100644 Binary files a/comp1204_cw1/comp1204_cw1.tar.gz and b/comp1204_cw1/comp1204_cw1.tar.gz differ diff --git a/comp1204_cw1/create_csv.sh b/comp1204_cw1/create_csv.sh new file mode 100644 index 0000000000000000000000000000000000000000..48538d57302f793e2207059500e4adc945dd9564 --- /dev/null +++ b/comp1204_cw1/create_csv.sh @@ -0,0 +1,28 @@ +#!/bin/bash +#First set 2 variable that extract from kml and save as csv + + +kml_input=$1 +csv_output=$2 + +echo "Timestamp,Latitude,Longitude,MinSeaLevelPressure,MaxIntensity" > $2 + +echo "Converting report.kml -> storm_info.csv..." + + +# 2 Collect the 5 required data +# Cut off useless parts then add unit at the end of each line + + +#lat=$(grep "<lat>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& N/g") +#lon=$(grep "<lon>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& W/g") +#tim=$(grep "<dtg>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 ) +#inte=$(grep "<intensity>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& knots/g") +#press=$(grep "<minSea.*>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& mb/g") + +#Third sort data, outupt it as a csv file + +paste -d ',' ts.txt lat.txt lon.txt press.txt inten.txt >>$2 + +echo "Done!" +