예제 #1
0
def run_qc_tools_v3(grid_path, flier_finder, holiday_finder, holiday_finder_mode, grid_qa,
                    survey_name, output_shp=False, output_kml=False):
    from hyo2.qc.survey.project import SurveyProject
    from hyo2.qc import __version__
    print("\n-->> running QC Tools (v.%s)" % __version__)

    grid_folder, grid_name = os.path.split(grid_path)
    prj = SurveyProject(output_folder=grid_folder)

    # disable output formats except .000
    prj.output_svp = False
    prj.output_shp = False
    prj.output_kml = False

    prj.add_to_grid_list(grid_path)

    if survey_name is None:
        prj.clear_survey_label()
    else:
        prj.survey_label = survey_name

    if flier_finder:
        print('running flier finder on: %s' % grid_path)
        prj.set_cur_grid(path=grid_path)
        prj.open_to_read_cur_grid()

        prj.find_fliers_v8(height=None)
        saved = prj.save_fliers()
        if saved:
            print('- found fliers: %d' % prj.number_of_fliers())
        else:
            print('- no fliers found')

    if holiday_finder:
        print('running holiday finder on: %s' % grid_path)

        prj.find_holes_v4(path=grid_path, mode=holiday_finder_mode)
        prj.output_shp = output_shp
        prj.output_kml = output_kml
        saved = prj.save_holes()
        if saved:
            print('- found holidays: certain %d, possible %d'
                  % (prj.number_of_certain_holes(), prj.number_of_possible_holes()))
        else:
            print('- no holidays')

    if grid_qa:
        print('running grid qa on: %s' % grid_path)
        prj.set_cur_grid(path=grid_path)
        prj.open_to_read_cur_grid()

        tvu_qc_layers = prj.cur_grid_tvu_qc_layers()
        if len(tvu_qc_layers) > 0:
            prj.set_cur_grid_tvu_qc_name(tvu_qc_layers[0])
        ret = prj.grid_qa_v5()
        print("- passed? %r" % ret)

    if grid_qa:
        prj.open_gridqa_output_folder()
        return
    if holiday_finder:
        prj.open_holes_output_folder()
        return
    if flier_finder:
        prj.open_fliers_output_folder()
        return
예제 #2
0
prj = SurveyProject(output_folder=testing.output_data_folder(),
                    progress=QtProgress(parent=wid))
prj.set_callback(QtGridCallback(progress=prj.progress))

# add BAG files
bag_files = testing.input_test_files(".bag")
# logger.info("S57 files: %d" % len(bag_files))
# prj.add_to_grid_list(bag_files[0])
prj.add_to_grid_list(
    "C:\\Users\\gmasetti\\Google Drive\\QC Tools\\test data\\H12976\\H12976_MB_1m_MLLW_1of2.bag"
)
prj.add_to_s57_list(
    "C:\\Users\\gmasetti\\Google Drive\\QC Tools\\test data\\H12976\\H12976_FFF_Test.000"
)

four_gb = 4294967296
one_mb = 1048576
specs = "2016"

prj.clear_survey_label()
prj.read_feature_file(feature_path=prj.s57_list[0])
prj.open_grid(path=prj.grid_list[0], chunk_size=four_gb)
prj.designated_scan_v2(survey_scale=20000, neighborhood=True, specs=specs)
saved = prj.save_designated()
if saved:
    prj.open_designated_output_folder()

logger.debug(prj)

# sys.exit(app.exec_())
예제 #3
0
    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')