def create(self): """The create view returns a new boat""" boat = BoatModel() boat.type = self.__get_type() boat.size = input("Size (m): ") self.display_boat(boat) if not self._read_binary("Is this correct?"): self.edit(boat) return boat
def go(bus=None): tuner_position = (49.284768, -123.109248) seabuses = Boat.all_seabuses() print seabuses[bus].name telemetry = [rec.__dict__ for rec in seabuses[bus].telemetry] df = DataFrame.from_records(telemetry) df['dist'] = [haversine(pos, tuner_position) for pos in zip(df.lat, df.lon)] return df, seabuses
def go(bus=None): tuner_position = (49.284768, -123.109248) seabuses = Boat.all_seabuses() print seabuses[bus].name telemetry = [rec.__dict__ for rec in seabuses[bus].telemetry] df = DataFrame.from_records(telemetry) df['dist'] = [ haversine(pos, tuner_position) for pos in zip(df.lat, df.lon) ] return df, seabuses
def loadboats(): telemetry = [] boats = Boat.all() for boat in boats: telemetry += [rec.__dict__ for rec in boat.telemetry] tmp_df = DataFrame.from_records(telemetry) tmp_df.index = tmp_df['received'] tmp_df['dist'] = [haversine(pos, tuner_position) for pos in zip(tmp_df.lat, tmp_df.lon)] return tmp_df
def api_post(): try: boat_name = request.form['boat_name'] btype = int(request.form['btype']) # boat = Boat("assd", 1234) boat = Boat(boat_name, btype) db.session.add(boat) db.session.commit() except Exception as exp: print("[save_police_boat] :: api_post() :: got exp: %s" % exp) print(traceback.print_stack()) return "boat_name: %s is saved" % boat_name
def loadboats(): telemetry = [] boats = Boat.all() for boat in boats: telemetry += [rec.__dict__ for rec in boat.telemetry] tmp_df = DataFrame.from_records(telemetry) tmp_df.index = tmp_df['received'] tmp_df['dist'] = [ haversine(pos, tuner_position) for pos in zip(tmp_df.lat, tmp_df.lon) ] return tmp_df
def go(bus=None): tuner_position = (49.284768, -123.109248) telemetry = [] boats = Boat.all() for boat in boats: telemetry = [rec.__dict__ for rec in boat.telemetry] tmp_df = DataFrame.from_records(telemetry) tmp_df.index = tmp_df['received'] tmp_df['dist'] = [haversine(pos, tuner_position) for pos in zip(tmp_df.lat, tmp_df.lon)] #import pdb #pdb.set_trace() return tmp_df