Skip to content
Snippets Groups Projects
Commit a2956cfb authored by root's avatar root
Browse files

Cleaning old scripts

parent e68f4fba
Branches
No related tags found
No related merge requests found
File deleted
File deleted
File deleted
......@@ -3,25 +3,28 @@
kml_input=$1
csv_output=$2
echo "Timestamp,Latitude,Longitude,MinSeaLevelPressure,MaxIntensity" > $2
echo "Converting report.kml -> storm_info.csv..."
#Second have 5 kml data and get the information we care about with unit
# 2 Collect the 5 required data
# Cut off useless parts then add unit at the end of each line
count=$(grep -E -c "<lat>" $1)
grep "<lat>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& N/g" >lat.txt
grep "<lon>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& W/g" > lon.txt
grep "<dtg>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 > ts.txt
grep "<intensity>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& knots/g" > inten.txt
grep "<minSea.*>" $1 | cut -d ">" -f 2 | cut -d "<" -f 1 | sed "s/$/& mb/g" > press.txt
#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!"
......
#!/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