for k in range(len(InstanceNumber)):
Data = Data_All_Instance[k]
Temp_Speed = []
Temp_RD = []
outlier = []
for i in range(len(Data) - 1):
A = (Data[i, 0], Data[i, 1])
B = (Data[i+1, 0], Data[i+1, 1])
Temp_RD.append(geodesic(A, B).meters)
Delta_Time[k].append((Data[i + 1, 2] - Data[i, 2]) * 24. * 3600 + 1) # Add one second to prevent zero time
S = Temp_RD[i] / Delta_Time[k][i]
if S > SpeedLimit[Label[k]] or S < 0:
outlier.append(i)
Temp_Speed.append(S)
y = math.sin(math.radians(Data[i+1, 1]) - math.radians(Data[i, 1])) * math.radians(math.cos(Data[i+1, 0]))
x = math.radians(math.cos(Data[i, 0])) * math.radians(math.sin(Data[i+1, 0])) - \
math.radians(math.sin(Data[i, 0])) * math.radians(math.cos(Data[i+1, 0])) \
* math.radians(math.cos(Data[i+1, 1]) - math.radians(Data[i, 1]))
# 从-pi到pi的弧度转换为[0, 360]度
b = (math.atan2(y, x) * 180. / math.pi + 360) % 360
Bearing[k].append(b)
运行显示:ValueError: Latitude must be in the [-90; 90] range.