diff --git a/create_csv.sh b/create_csv.sh new file mode 100644 index 0000000000000000000000000000000000000000..f34952f7ac0364cf9f9a999688209e06d51f4930 --- /dev/null +++ b/create_csv.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +#First set 2 variable that extract from kml and save as csv + +kml_input_path=$1 +csv_output_path=$2 + +echo"Timestamp,Latitude,Longitude,MinxsealevePressure,MaxIntensity" > $2 + +echo "Converting report.kml -> storm_info.csv..." + +#Second have 5 kml data and get the information we care about with unit + +lat=$(grep "<lat>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/N/g" >lat.txt) +lon=$(grep "<lon>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/W/g" >lon.txt) +inte=$(grep "<intensity>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/$ Knots/g" > inten.txt) +press=$(grep "<minSea.*>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& mb/g" > press.txt) +tim=$(grep "<lat>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 > ts.txt) + +#Third sort data, outupt it aas a csv file +echo "$timestamp,$lat,$lon,$pressure,$intensity" >>$2 + +echo "Done!" +