getting coordinates right on fusion
This commit is contained in:
@@ -95,6 +95,22 @@ from scipy.signal import savgol_filter
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
def get_latlon(id):
|
||||||
|
try:
|
||||||
|
w = Workout.objects.get(id=id)
|
||||||
|
except Workout.DoesNotExist:
|
||||||
|
return False
|
||||||
|
|
||||||
|
rowdata = rdata(w.csvfilename)
|
||||||
|
try:
|
||||||
|
latitude = rowdata.df.ix[:,' latitude']
|
||||||
|
longitude = rowdata.df.ix[:,' longitude']
|
||||||
|
except KeyError:
|
||||||
|
latitude = 0*rowdata.df.ix[:,'TimeStamp (sec)']
|
||||||
|
latitude = 0*rowdata.df.ix[:,'TimeStamp (sec)']
|
||||||
|
|
||||||
|
return [latitude,longitude]
|
||||||
|
|
||||||
def get_workouts(ids,userid):
|
def get_workouts(ids,userid):
|
||||||
goodids = []
|
goodids = []
|
||||||
for id in ids:
|
for id in ids:
|
||||||
@@ -1107,6 +1123,13 @@ def datafusion(id1,id2,columns,offset):
|
|||||||
'id'],
|
'id'],
|
||||||
1,errors='ignore')
|
1,errors='ignore')
|
||||||
|
|
||||||
|
# Add coordinates to DataFrame
|
||||||
|
latitude,longitude = get_latlon(id1)
|
||||||
|
|
||||||
|
df1[' latitude'] = latitude
|
||||||
|
df1[' longitude'] = longitude
|
||||||
|
|
||||||
|
|
||||||
df2 = getsmallrowdata_db(['time']+columns,ids=[id2],doclean=False)
|
df2 = getsmallrowdata_db(['time']+columns,ids=[id2],doclean=False)
|
||||||
offsetmillisecs = offset.seconds*1000+offset.microseconds/1000.
|
offsetmillisecs = offset.seconds*1000+offset.microseconds/1000.
|
||||||
offsetmillisecs += offset.days*(3600*24*1000)
|
offsetmillisecs += offset.days*(3600*24*1000)
|
||||||
|
|||||||
@@ -3854,7 +3854,7 @@ def workout_wind_view(request,id=0,message="",successmessage=""):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
hascoordinates = 0
|
hascoordinates = 0
|
||||||
|
|
||||||
if not latitude.std():
|
if hascoordinates and not latitude.std():
|
||||||
hascoordinates = 0
|
hascoordinates = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -6958,6 +6958,7 @@ def workout_fusion_view(request,id1=0,id2=1):
|
|||||||
if posneg == 'neg':
|
if posneg == 'neg':
|
||||||
timeoffset = -timeoffset
|
timeoffset = -timeoffset
|
||||||
|
|
||||||
|
# Create DataFrame
|
||||||
df = dataprep.datafusion(id1,id2,columns,timeoffset)
|
df = dataprep.datafusion(id1,id2,columns,timeoffset)
|
||||||
|
|
||||||
idnew,message = dataprep.new_workout_from_df(r,df,
|
idnew,message = dataprep.new_workout_from_df(r,df,
|
||||||
|
|||||||
Reference in New Issue
Block a user