-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
correction for altitudes based on takeoff altitude #161
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice addition. hereby some pointer for (minor) improvements. also: could you add an entry in the CHANGES.md file?
@@ -10,7 +10,7 @@ | |||
settings = Settings() | |||
|
|||
|
|||
def run(url, source, download_progress=None, analysis_progress=None, on_success=None, on_failure=None): | |||
def run(url, source, to_elevation, download_progress=None, analysis_progress=None, on_success=None, on_failure=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it helps to explicitly show the optional behavior of to_elevation
:
def run(url, source, to_elevation, download_progress=None, analysis_progress=None, on_success=None, on_failure=None): | |
def run(url, source, to_elevation=None, download_progress=None, analysis_progress=None, on_success=None, on_failure=None): |
args = (url, get_url_source(url), self.set_download_status, self.set_analyse_status, | ||
try: | ||
to_elevation = int(self.to_elevation_input.GetValue()) | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using a bare except clause, this also catches a KeyboardInterrupt
or other signal.
https://docs.python.org/3/library/exceptions.html#exception-hierarchy
i prefer to only catch the instances of Exception
except: | |
except Exception: |
@@ -18,7 +18,7 @@ def determine_performance_dictionary(self): | |||
self.set_performance_entry("t_start", "Start time", "text", "neutral", "[local time]", True, True, True, True) | |||
self.set_performance_entry("t_finish", "Finish time", "text", "neutral", "[local time]", True, False, True, True) | |||
self.set_performance_entry("h_start", "Start height", "number", "high", "[m]", True, True, True, True) | |||
self.set_performance_entry("h_finish", "Finish height", "number", "high", "[m]", True, False, True, False) | |||
self.set_performance_entry("h_finish", "Finish height", "number", "low", "[m]", True, False, True, True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really umambiguous that a lower finish height is always better? i guess it makes sense for the last leg, but for others along the task this really depends? (for instance if you round a turnpoint downwind).
i think the original code was also wrong, so maybe "neutral" would be best here?
now that i think of this, the same goes for the start height...
def init_all(self, trip, gps_altitude): | ||
start_h = trip.fixes[0]['gps_alt'] if gps_altitude else trip.fixes[0]['pressure_alt'] | ||
start_t = trip.refined_start_time | ||
def get_height(self, trip_index): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice improvement
def get_height(self, trip_index): | ||
if (self.gps_altitude): | ||
# return gps altitude corrected for start elevation | ||
return self.trip.fixes[trip_index]['gps_alt'] - self.elevation_correction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it is clearer if the elevation correction is simply added here and that the value can be both negative and positive. if this is changed, the calculation should be changed too. also there might be other places where this is used.
@@ -71,15 +71,23 @@ def __init__(self, current_version, latest_version): | |||
self.url_input = wx.TextCtrl(panel) | |||
my_sizer.Add(self.url_input, 0, wx.ALL | wx.EXPAND, 5) | |||
|
|||
to_elevation_sizer = wx.BoxSizer(wx.HORIZONTAL) | |||
|
|||
text = wx.StaticText(panel, label="Field elevation:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe nice to add a unit:
is this above MSL?
text = wx.StaticText(panel, label="Field elevation:") | |
text = wx.StaticText(panel, label="Field elevation [m]:") |
No description provided.