-
Notifications
You must be signed in to change notification settings - Fork 0
/
starfixdata_sea_5.py
35 lines (27 loc) · 1.12 KB
/
starfixdata_sea_5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
''' Simple sample representing a trip at sea with dead reckoning calculation
© August Linnman, 2024, email: [email protected]
MIT License (see LICENSE file)
'''
from datetime import datetime
from time import time
from starfix import takeout_course, LatLon, calculate_time_hours, get_representation
def main ():
''' Main body of script '''
starttime = time ()
# We are sailing from point s1 to point s2, in the Baltic Sea.
# We have a good estimate of an initial position. (A previous fix)
s1 = LatLon (58.23,17.91)
s1_time = datetime.fromisoformat ("2024-06-20 06:14:38+00:00")
# We reach s2 by applying about 175 degrees with a speed of 20 knots.
c_course = 175
speed = 20
s2_time = datetime.fromisoformat ("2024-06-20 07:13:38+00:00")
s1_s2_time = calculate_time_hours (s1_time, s2_time)
s2 = takeout_course (s1, c_course, speed, s1_s2_time)
# Print coord of destination
print (get_representation(s2,1))
endtime = time ()
taken_ms = round((endtime-starttime)*1000,2)
print ("Time taken = " +str(taken_ms)+" ms")
if __name__ == '__main__':
main()