Skip to content
Snippets Groups Projects
Commit 5b52b25e authored by hs7n22's avatar hs7n22
Browse files

Upload New File

parent 2bee920c
No related branches found
No related tags found
No related merge requests found
#!/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!"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment