-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstarfixdata_sea_2.py
71 lines (54 loc) · 2.48 KB
/
starfixdata_sea_2.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
''' Simple sample representing a trip at sea with supporting celestial navigation
© August Linnman, 2024, email: [email protected]
MIT License (see LICENSE file)
'''
from datetime import datetime
from time import time
from starfix import Sight, SightTrip, get_representation,\
LatLon, LatLonGeodetic, IntersectError
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 = LatLonGeodetic (58.23,17.91)
#This is the starting time
s1 = datetime.fromisoformat ("2024-06-20 06:14:38+00:00")
# Point s2 is located roughly 20 nautical miles out in the sea.
# We take a sight here and get this.
s2 = Sight ( object_name = "Sun",
set_time = "2024-06-20 07:13:38+00:00",
gha_time_0 = "284:35.1",
gha_time_1 = "299:35.0",
decl_time_0 = "23:26.2",
measured_alt = "38:34:21.6",
estimated_position = s1_latlon
)
# We reach s2 by applying about 175 degrees with a speed of 20 knots.
c_course = 175
speed = 20
st = SightTrip (sight_start = s1,\
sight_end = s2,\
estimated_starting_point = s1_latlon,\
course_degrees = c_course,\
speed_knots = speed)
try:
intersections, _, _ = st.get_intersections ()
except IntersectError as ve:
print ("Cannot perform a sight reduction. Bad sight data.\n" + str(ve))
print ("Check the circles! " + st.get_map_developers_string(geodetic=True))
exit ()
endtime = time ()
taken_ms = round((endtime-starttime)*1000,2)
print ("MD = " + st.get_map_developers_string (geodetic=True))
# Diagnostics for map rendering etc.
assert isinstance (intersections, LatLon)
#print (get_representation (intersections,3))
#print (get_google_map_string (intersections, 3))
print ("Starting point = " + str(get_representation(s1_latlon,1)))
print ("End point = " + str(get_representation(intersections,1)))
#print ("Distance = " +\
# str(round(km_to_nm(distance_between_points(s1_latlon, intersections)),2)) + " nm")
print ("Time taken = " +str(taken_ms)+" ms")
if __name__ == '__main__':
main()