Пример #1
0
 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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
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