Skip to content

Conversation

@zweefan
Copy link

@zweefan zweefan commented Aug 28, 2020

No description provided.

Copy link
Owner

@GliderGeek GliderGeek left a 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?



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):
Copy link
Owner

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:

Suggested change
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:
Copy link
Owner

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

Suggested change
except:
except Exception:

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)
Copy link
Owner

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):
Copy link
Owner

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
Copy link
Owner

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.


to_elevation_sizer = wx.BoxSizer(wx.HORIZONTAL)

text = wx.StaticText(panel, label="Field elevation:")
Copy link
Owner

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?

Suggested change
text = wx.StaticText(panel, label="Field elevation:")
text = wx.StaticText(panel, label="Field elevation [m]:")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants