-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class BaseElevationAPI: | ||
def get_elevation(self, *, longitude, latitude): | ||
raise NotImplementedError | ||
|
||
def get_ground_point(self, position): | ||
latitude, longitude, _ = position.position_llh | ||
return ( | ||
longitude, | ||
latitude, | ||
self.get_elevation(longitude=longitude, latitude=latitude), | ||
) | ||
|
||
def get_groundtrack(self, positions): | ||
return [self.get_ground_point(position) for position in positions] | ||
|
||
|
||
class ZeroElevation(BaseElevationAPI): | ||
def get_elevation(self, *, longitude, latitude): | ||
return 0.0 | ||
|
||
|
||
def compute_groundtrack(predictor, times, elevation_api=ZeroElevation()): | ||
positions = [predictor.get_position(time) for time in times] | ||
return elevation_api.get_groundtrack(positions) |