55import numpy
66from pyproj import CRS
77
8+ from .model import SECONDS_TO_GROUND
89from .packets import APRSPacket , DEFAULT_CRS , LocationPacket
910from .structures import DoublyLinkedList
1011
@@ -22,9 +23,13 @@ def __init__(self, name: str, packets: [LocationPacket] = None, crs: CRS = None)
2223 """
2324
2425 self .name = name
25- self .packets = DoublyLinkedList (packets )
26+ self .packets = DoublyLinkedList (None )
2627 self .crs = crs if crs is not None else DEFAULT_CRS
2728
29+ if packets is not None :
30+ for packet in packets :
31+ self .append (packet )
32+
2833 def append (self , packet : LocationPacket ):
2934 if packet not in self .packets :
3035 if packet .crs != self .crs :
@@ -161,17 +166,9 @@ def __init__(self, name: str, packets: [LocationPacket] = None, crs: CRS = None)
161166
162167 @property
163168 def time_to_ground (self ) -> timedelta :
164-
165169 if self .has_burst :
166170 # TODO implement landing location as the intersection of the predicted descent track with a local DEM
167-
168- # dh/dt, with a coefficient determined manually from historical flight data
169- # descent_rate = lambda altitude: -5.8e-08 * altitude ** 2 - 6.001
170-
171- # integration of (1/(dh/dt))dh
172- seconds_to_ground = lambda altitude : 1695.02 * numpy .arctan (9.8311e-5 * altitude )
173-
174- return timedelta (seconds = seconds_to_ground (self .altitudes [- 1 ]))
171+ return timedelta (seconds = SECONDS_TO_GROUND (self .altitudes [- 1 ]))
175172 else :
176173 return timedelta (seconds = - 1 )
177174
0 commit comments