示例#1
0
def update_new_docks(docks_list, new_docks, mmsi):
    '''

    :param docks_list: a list of already process docks
    :param new_docks: a list of new, to be process docks
    :return:
    porst: the updated docks list
    '''
    if not docks_list:
        docks_list = []
    for new_dock_prm in new_docks:
        new_dock = dck.dock(new_dock_prm[1], new_dock_prm[2], new_dock_prm[3], mmsi)
        exists = False
        if docks_list:
            for _dock in docks_list:
                if _dock.is_equals(new_dock):
                    exists = True
                    if mmsi not in _dock.Mmsis:
                        _dock.Mmsis.append( mmsi )
                    break
        if not exists:
            docks_list.append(new_dock)
    return docks_list
示例#2
0
ships = []
for mmsi in mmsis:
    temp = ship.ship(df[df['MMSI'] == mmsi], verbose=False)
    ships.append(temp)

cl = cfg.CLASSES
el = cfg.ELUMINATE
docks = []
str2 = "["
for shp in ships:
    if cl[shp.clas] not in el and shp.is_consistant \
            and shp.is_well_measured and shp.size >= cfg.SHIP_MINIMAL_SIZE:                   # filtered: 2149 consistant points were found, not filtered: 3360  points were found :  well measurend: 1612  points were found
        #  docks, minimal_doc_time_idxs_list, stops_indexs = shp.get_docking_locations()
        ships_docking_history = shp.get_docking_locations()[0]
        for new_dock_prm in ships_docking_history:
            new_dock = dck.dock(new_dock_prm[1], new_dock_prm[2], new_dock_prm[3], shp.mmsi)
            exists = False
            if docks:
                for _dock in docks:
                    if _dock.is_equals(new_dock):
                        exists = True
                        # add_ship=True
                        # for ship1 in _dock.ships:
                        #     if ship1.mmsi == shp.mmsi:
                        #         add_ship = False
                        #         break
                        # if add_ship: _dock.ships.append(shp)

                        break
            if not exists:
                new_dock.ships.append(shp)