Skip to content

Commit

Permalink
Bug correction and limit changed
Browse files Browse the repository at this point in the history
- Corrected bug to write line on "do_later" instead "file_out" if coordinates=0
- Limit to count_trouble changed from 10 to 5 (using key gets less error status)
  • Loading branch information
viniroger committed Dec 20, 2017
1 parent ffe2650 commit 0a3c08f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rec_coord.sh
Expand Up @@ -65,14 +65,14 @@ while read line; do
nlines2=$(cat gmaps2.json | wc -l)
echo "n lines: " $nlines1 "e" $nlines2
# If there have been a lot of tentatives, probably ther some wrong, then separte to do later
if [ "$count_trouble" -ge "10" ]; then
if [ "$count_trouble" -ge "5" ]; then
coordinates=0
break
fi
count_trouble=$((count_trouble+1))
done
# Only find coordinates if there's a valid value to do that
if [ "$count_trouble" -lt "10" ]; then
if [ "$count_trouble" -lt "5" ]; then
# Read JSON files and calculate average coordinate
coordinates=$(python read_json.py gmaps1.json gmaps2.json)
fi
Expand All @@ -92,21 +92,21 @@ while read line; do
nlines=$(cat gmaps.json | wc -l)
echo "n lines: " $nlines
# If there have been a lot of tentatives, probably ther some wrong, then separte to do later
if [ "$count_trouble" -ge "10" ]; then
if [ "$count_trouble" -ge "5" ]; then
coordinates=0
break
fi
count_trouble=$((count_trouble+1))
done
# Only find coordinates if there's a valid value to do that
if [ "$count_trouble" -lt "10" ]; then
if [ "$count_trouble" -lt "5" ]; then
# Read JSON files and convert address in lat / lon - as it does not need two files, inform NA for the second
coordinates=$(python read_json.py gmaps.json NA)
fi
fi
# Print information in the output file (if OK)
test=$(echo "${coordinates}" | awk -F'.' '{print NF}')
if [ "$test" -ne "0" ]; then
if [ "$test" -eq "3" ]; then
echo $date";"$hour_ini";"$hour_fim";\"$info\";"$coordinates >> $file_out
else
echo $line >> $do_later
Expand Down

0 comments on commit 0a3c08f

Please sign in to comment.