Skip to content

Commit

Permalink
fix prediction specification
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jul 10, 2021
1 parent 419a9f1 commit 9ffd04d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packetraven/gui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def __init__(
},
'ssh_tunnel': {'ssh_hostname': None, 'ssh_username': None, 'ssh_password': None},
'prediction': {
'prediction_start_time': None,
'prediction_start_location': None,
'prediction_ascent_rate': None,
'prediction_burst_altitude': None,
'prediction_sea_level_descent_rate': None,
Expand Down
13 changes: 8 additions & 5 deletions packetraven/predicts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod
from datetime import datetime, timedelta
from enum import Enum
from typing import Any, Optional, Tuple, Union
from typing import Any, Generator, Optional, Tuple, Union

from dateutil.parser import parse as parse_date
import numpy
Expand All @@ -13,9 +13,7 @@
from packetraven.packets.tracks import LocationPacketTrack, PredictedTrajectory
from packetraven.utilities import get_logger

DEFAULT_ASCENT_RATE = 5.5
DEFAULT_BURST_ALTITUDE = 28000
DEFAULT_SEA_LEVEL_DESCENT_RATE = 9
DEFAULT_FLOAT_ALTITUDE_UNCERTAINTY = 500
UTC_TIMEZONE = pytz.utc

LOGGER = get_logger('predicts')
Expand Down Expand Up @@ -375,7 +373,7 @@ def get_predictions(
burst_altitude: float = None,
sea_level_descent_rate: float = None,
float_altitude: float = None,
float_altitude_uncertainty: float = 500,
float_altitude_uncertainty: float = None,
float_duration: timedelta = None,
api_url: str = None,
) -> [PredictedTrajectory]:
Expand All @@ -395,6 +393,8 @@ def get_predictions(
"""

if start_location is not None:
if isinstance(start_location, Generator):
start_location = list(start_location)
if len(start_location) == 2:
start_location = (*start_location, 0)

Expand All @@ -404,6 +404,9 @@ def get_predictions(
if float_duration is not None and float_altitude is None:
float_altitude = burst_altitude

if float_altitude_uncertainty is None:
float_altitude_uncertainty = DEFAULT_FLOAT_ALTITUDE_UNCERTAINTY

if api_url is None:
api_url = PredictionAPIURL.cusf

Expand Down

0 comments on commit 9ffd04d

Please sign in to comment.