def add_track(kml, track_name, lat, lon, colour, alt_param=None, alt_mode=None, visible=True): ''' alt_mode such as simplekml.constants.AltitudeMode.clamptoground ''' track_config = {'name': track_name, 'visibility': 1 if visible else 0, } if alt_param: track_config['altitudemode'] = alt_mode track_config['extrude'] = 1 track_coords = [] ##scope_lon = np.ma.flatnotmasked_edges(lon.array) ##scope_lat = np.ma.flatnotmasked_edges(lat.array) ##begin = max(scope_lon[0], scope_lat[0])+1 ##end = min(scope_lon[1], scope_lat[1])-1 for i in xrange(0, len(lon.array)): _lon = value_at_index(lon.array, i) _lat = value_at_index(lat.array, i) if alt_param: _alt = value_at_index(alt_param.array, i) coords = (_lon, _lat, _alt) else: coords = (_lon, _lat) if not all(coords) or any(np.isnan(coords)): continue track_coords.append(coords) track_config['coords'] = track_coords line = kml.newlinestring(**track_config) line.style.linestyle.color = colour line.style.polystyle.color = '66%s' % colour[2:] # set opacity of area fill to 40% return
def add_track(kml, track_name, lat, lon, colour, alt_param=None, alt_mode=None, visible=True): ''' alt_mode such as simplekml.constants.AltitudeMode.clamptoground ''' track_config = {'visibility': 1 if visible else 0} if alt_param: track_config['altitudemode'] = alt_mode track_config['extrude'] = 1 tracks = [] track_coords = [] count = 0 ##scope_lon = np.ma.flatnotmasked_edges(lon.array) ##scope_lat = np.ma.flatnotmasked_edges(lat.array) ##begin = max(scope_lon[0], scope_lat[0])+1 ##end = min(scope_lon[1], scope_lat[1])-1 for i in xrange(0, len(lon.array)): _lon = value_at_index(lon.array, i) _lat = value_at_index(lat.array, i) if alt_param: _alt = value_at_index(alt_param.array, i) coords = (_lon, _lat, _alt) else: coords = (_lon, _lat) if not all(coords) or any(np.isnan(coords)): continue track_coords.append(coords) count += 1 # Split up tracks because Google Earth cannot extrude long LineStrings. if count >= 4000: tracks.append(track_coords) track_coords = [] count = 0 if track_coords: tracks.append(track_coords) for index, track_coords in enumerate(tracks, start=1): track_config = track_config.copy() track_config['name'] = '%s (%d)' % (track_name, index) track_config['coords'] = track_coords line = kml.newlinestring(**track_config) line.style.linestyle.color = colour line.style.polystyle.color = '66%s' % colour[ 2:] # set opacity of area fill to 40% return
def derive(self, pitch_capt=P('Pitch (Capt)'), pitch_fo=P('Pitch (FO)'), roll_capt=P('Roll (Capt)'), roll_fo=P('Roll (FO)'), cc_capt=P('Control Column Force (Capt)'), cc_fo=P('Control Column Force (FO)'), ap1_eng=M('AP (1) Engaged'), ap2_eng=M('AP (2) Engaged'), key_vhf_capt=M('Key VHF (1)'), key_vhf_fo=M('Key VHF (2)'), landings=S('Landing'), touchdowns=KTI('Touchdown')): phase = landings.get_last() if landings else None index = touchdowns.get_last() if touchdowns else None if index is not None: ap_at_index = lambda ap: library.value_at_index(ap.array, index) ap1 = ap_at_index(ap1_eng) if ap1_eng else None ap2 = ap_at_index(ap2_eng) if ap2_eng else None else: ap1 = ap2 = None args = (pitch_capt, pitch_fo, roll_capt, roll_fo, cc_capt, cc_fo, phase, ap1, ap2, key_vhf_capt, key_vhf_fo) self.set_flight_attr(self._determine_pilot(*args))
def add_track(kml, track_name, lat, lon, colour, alt_param=None, alt_mode=None, visible=True): ''' alt_mode such as simplekml.constants.AltitudeMode.clamptoground ''' track_config = {'visibility': 1 if visible else 0} if alt_param: track_config['altitudemode'] = alt_mode track_config['extrude'] = 1 tracks = [] track_coords = [] count = 0 ##scope_lon = np.ma.flatnotmasked_edges(lon.array) ##scope_lat = np.ma.flatnotmasked_edges(lat.array) ##begin = max(scope_lon[0], scope_lat[0])+1 ##end = min(scope_lon[1], scope_lat[1])-1 for i in range(0, len(lon.array)): _lon = value_at_index(lon.array, i) _lat = value_at_index(lat.array, i) if alt_param: _alt = value_at_index(alt_param.array, i) coords = (_lon, _lat, _alt) else: coords = (_lon, _lat) if not all(coords) or any(np.isnan(coords)): continue track_coords.append(coords) count += 1 # Split up tracks because Google Earth cannot extrude long LineStrings. if count >= 4000: tracks.append(track_coords) track_coords = [] count = 0 if track_coords: tracks.append(track_coords) for index, track_coords in enumerate(tracks, start=1): track_config = track_config.copy() track_config['name'] = '%s (%d)' % (track_name, index) track_config['coords'] = track_coords line = kml.newlinestring(**track_config) line.style.linestyle.color = colour line.style.polystyle.color = '66%s' % colour[2:] # set opacity of area fill to 40% return
def derive(self, gear=M('Gear Down'), alt_aal=P('Altitude AAL'), touchdowns=KTI('Touchdown')): for touchdown in touchdowns: rough_index = index_at_value(gear.array.data, 0.5, slice(touchdown.index, 0, -1)) # index_at_value tries to be precise, but in this case we really # just want the index at the new flap setting. if rough_index: last_index = np.round(rough_index) alt_last = value_at_index(alt_aal.array, last_index) self.create_kpv(last_index, alt_last)