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

Upload New File

parent 50cd61a1
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_output_path=$1
csv_output_path=$2
echo"Timestamp,Latitude,Longitude,MinsealevePressure,MaxIntensity" > $2
echo "Create_csv.sh report.kml storm_info.csv"
echo "Converting report.kml -> storm_info.csv..."
#Second have 5 kml data and get the information we care about with unit
#Here we grep latitude grep longitude grep intensity grep pressure grep timestamp
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