Пример #1
0
def find_time_without_value(dict_shift_value, list_mms):
    height_needed = []
    for fn in list_mms:
        neighbours = search_neigh_tiles(fn)
        for nfn in neighbours:
            if nfn not in dict_shift_value or np.isnan(dict_shift_value[nfn]):
                height_needed.append(nfn)
    return list(set(height_needed))
Пример #2
0
def insert_values_based_on_neigbours(dict_shift_value, height_needed):
    ndict = dict()
    for fn in height_needed:
        neighbours = search_neigh_tiles(fn, radius=1)
        z = get_distance_without_padding(dict_shift_value, neighbours)
        if len(z) > 0:
            if not np.isnan(np.median(z)):
                ndict[fn] = np.median(z)

    for key in ndict.keys():
        dict_shift_value[key] = ndict[key]
    return dict_shift_value
Пример #3
0
def gen_updates4mms(list_fns, dict_shift_value, r, res_update, shift):

    from lib.neighbour import search_neigh_tiles

    # Tile Size in meter
    size = int(r / res_update)

    # Container of upadte images
    dict_update_img = dict()

    # Container of upadte points
    dict_update_pts = dict()

    # Collect updates by bilinear intepolation
    for fn in tqdm(list_fns):

        # 9 Neighbour tiles
        neigh_list = search_neigh_tiles(fn)
        data_update, z = generate_updates_mms(dict_shift_value, neigh_list, r,
                                              res_update, shift)
        # Save image
        if type(data_update) != type(None):
            update_img = data_update[:, 2].reshape(size, size)
            dict_update_img[fn] = update_img
            dict_update_pts[fn] = data_update

    return dict_update_img, dict_update_pts


# Remove because for runids
#def update_pointcloud(data_mms, data_update, res_update):
#
#    # Create index according to updates resolution
#    d_update = rasterize(data_update, res_update, dim = 2)
#    d_mms_runid = rasterize(data_mms, res_update, dim = 2)
#
#    # Apply change for each cell regarding updates resolution
#    data_updated = []
#    for key, value in d_mms_runid.iteritems():
#        sub_mms = data_mms[value]
#        if key in d_update:
#            update_value = data_update[d_update[key][0],2]
#            sub_mms[:,:3] = sub_mms[:,:3] - [0,0,update_value]
#            data_updated.extend(sub_mms) # Must be minus here
#    return np.array(data_updated)
Пример #4
0
def reject_local_change(dict_shift_value, list_mms, thre = 0.5):
    # Reject local changes over threshold
    tobedeleted = []
    for fn in list_mms:
        neighbours = search_neigh_tiles(fn, radius = 2)
        data = [[nfn, dict_shift_value[nfn] - shift] for nfn in neighbours if nfn in dict_shift_value.keys()]
        
        fns = np.array(column(data, 0))
        z = np.array(column(data, 1))       
        idx = abs(z - np.median(z)) > thre
        
        if (True) in idx:
#            print(list(fns[idx]), list(z[idx]))
#            print(list(z))
            tobedeleted.extend(fns[idx])
    tobedeleted = list(set(tobedeleted))
    
    print(len(tobedeleted))
    
    for fn in tobedeleted:
        dict_shift_value.pop(fn)
    return dict_shift_value,  len(tobedeleted)
Пример #5
0
            x, y = [int(k) for k in key.split('+')]

            z_mms = data_mms[value, 2]
            z_ref = data_ref[d_ref[key], 2][0] + shift

            dz = z_mms - z_ref

            newIndex = list(np.array(value)[dz < 0.5])
            index_list.extend(newIndex)

        data_output = data_mms[sorted(index_list)]
        data_mms = data_output

        _ = calc_difference_mms_ref(data_mms, data_ref, 0.5, r, shift)

        neigh_list = search_neigh_tiles(fn)
        data_update, z = generate_updates_mms(dict_shift_value, neigh_list, r,
                                              res_update, shift)

        d_update = rasterize(data_update, res_update, dim=2)
        d_mms = rasterize(data_mms, res_update, dim=2)

        data_updated = []
        for key, value in d_mms.iteritems():
            sub_mms = data_mms[value]
            update_value = data_update[d_update[key][0], 2]
            data_updated.extend(sub_mms -
                                [0, 0, update_value])  # Must be minus here
        data_updated = np.array(data_updated)

        _ = calc_difference_mms_ref(data_updated, data_ref, 0.5, r, shift)