height_value = prj.retrieve_min_depth_tvu(bag_path) prj.clear_survey_label() prj.open_grid(path=bag_path) prj.find_fliers_v8(height=height_value, check_laplacian=check_laplacian, check_curv=check_curv, check_adjacent=check_adjacent, check_slivers=check_slivers, check_isolated=check_isolated, check_edges=check_edges, filter_designated=filter_designated, filter_fff=filter_fff) prj.close_cur_grid() prj.open_grid(path=bag_path) prj.find_fliers_v8_apply_filters() saved = prj.save_fliers() if saved: bag_with_fliers_list.append(bag_path) nr_fliers_per_bag_dict[bag_path] = prj.number_of_fliers() tvu_height_per_bag_dict[bag_path] = height_value bag_done_list.append(bag_path) logger.debug(">>>>>> #%03d (%s): OK" % (i, bag_path)) except Exception as e:
def run_find_fliers(self, args): if not os.path.exists(args.output_folder): raise RuntimeError('Unable to locate output folder: %s' % args.output_folder) out_folder = args.output_folder logger.debug('output folder: %s' % out_folder) # create the project prj = SurveyProject(output_folder=out_folder) if not os.path.exists(args.input_dtm): raise RuntimeError('Unable to locate input DTM: %s' % args.input_dtm) dtm_file = args.input_dtm logger.debug('input DTM: %s' % dtm_file) prj.add_to_grid_list(dtm_file) if args.s57_path is not None: if not os.path.exists(args.s57_path): raise RuntimeError('Unable to locate input S57: %s' % args.s57_path) s57_file = args.s57_path logger.debug('input S57: %s' % s57_file) prj.add_to_s57_list(s57_file) if args.enforce_height is not None: if args.enforce_height <= 0.0: raise RuntimeError('Invalid height: %s' % args.enforce_height) height_value = args.enforce_height # logger.debug('height: %s' % height_value) check_laplacian = args.check_laplacian check_curv = args.check_curv check_adjacent = args.check_adjacent check_slivers = args.check_slivers check_isolated = args.check_isolated check_edges = args.check_edges filter_designated = args.filter_designated filter_fff = args.filter_fff self._check_web_page( token='FFv8_%d%d%d%d%d%d_%d%d' % (check_laplacian, check_curv, check_adjacent, check_slivers, check_isolated, check_edges, filter_designated, filter_fff)) # actual execution for i, grid_path in enumerate(prj.grid_list): logger.debug(">>> #%d (%s)" % (i, grid_path)) prj.clear_survey_label() prj.set_cur_grid(path=grid_path) prj.open_to_read_cur_grid(chunk_size=4294967296) prj.find_fliers_v8(height=height_value, check_laplacian=check_laplacian, check_curv=check_curv, check_adjacent=check_adjacent, check_slivers=check_slivers, check_isolated=check_isolated, check_edges=check_edges, filter_fff=filter_fff, filter_designated=filter_designated) prj.close_cur_grid() prj.set_cur_grid(path=grid_path) prj.open_to_read_cur_grid(chunk_size=4294967296) prj.find_fliers_v8_apply_filters() saved = prj.save_fliers() if saved: logger.debug('Fliers saved')