output_folder = "U:\\Working\\QCTools\\scripts" if not os.path.exists(output_folder): logger.error("output folder does not exist: %s" % output_folder) exit(-1) if not os.path.isdir(output_folder): logger.error("output folder is actually not a folder: %s" % output_folder) exit(-1) logger.debug("output folder: %s" % output_folder) # create the project prj = SurveyProject(output_folder=output_folder) # set output settings prj.output_shp = out_shp prj.output_kml = out_kml # add all the BAG files to the project for bag_path in bag_todo_list: prj.add_to_grid_list(bag_path) # add all FFF files to the project for fff in fff_todo_list: prj.add_to_s57_list(fff) # create 3 empty lists: one for the BAGs successfully processed, one for the ones with fliers, and another for crashes
from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.abc.app.qt_progress import QtProgress from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a CSAR file csar_files = testing.input_test_files(".csar") print("- CSAR files: %d" % len(csar_files)) # # # add a BAG file # bag_files = testing.input_test_files(".bag") # print("- BAG files: %d" % len(bag_files)) prj.add_to_grid_list(csar_files[0]) # prj.add_to_grid_list(bag_files[0]) # prj.add_to_grid_list("V:/CARIS_VR/H12880/Surfaces/H12880_2806_2016DN149_Ranges_CUBE.csar") # prj.add_to_grid_list("V:/CARIS_VR/H12880/Surfaces/H12880_10_1_0_Ranges_CUBE_Final.csar") # prj.add_to_grid_list("V:/CARIS_VR/H12880/Surfaces/Test0_H12280_2806_200kHz_DN149_CalderRice.csar") # prj.add_to_grid_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\data\\_issues\\H13034_Holiday_Finder_Issue_4_23_2018\\H13034_MB_2m_MLLW_Final.csar")
from hyo2.qc.common import default_logging import sys import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from PySide2 import QtWidgets from hyo2.abc.app.qt_progress import QtProgress app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # submission folders sub_folders = [ r"C:\code\hyo2\processing\hyo2_qc\data\download\2021\ALL_OK\CARIS-GSF\OPR-A123-RA-20", ] logger.debug("testing > submission folders: %d" % len(sub_folders)) # add folders for i, sf in enumerate(sub_folders): logger.debug("- %d: %s" % (i, sf)) try: if prj.is_valid_project_folder(path=sf): prj.add_to_submission_list(sf)
import sys import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from PySide import QtGui from hyo2.qc.qctools.qt_progress import QtProgress app = QtGui.QApplication([]) wid = QtGui.QWidget() prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a S57 file # s57_files = testing.input_test_files(".000") # print("- S57 files: %d" % len(s57_files)) # prj.add_to_s57_list(s57_files[0]) # prj.add_to_s57_list(s57_files[1]) # prj.add_to_s57_list(s57_files[2]) # prj.add_to_s57_list(s57_files[3]) prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\CMECS Crosswalk Automation\\Input\\H12895_FFF.000") print("%s" % (prj.s57_list,)) logger.debug(prj) for s57_file in prj.s57_list: prj.clear_survey_label() prj.read_feature_file(feature_path=s57_file)
from hyo2.qc.common import default_logging import sys import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from PySide import QtGui from hyo2.qc.qctools.qt_progress import QtProgress app = QtGui.QApplication([]) wid = QtGui.QWidget() prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a S57 file # s57_files = testing.input_test_files(".000") # print("- S57 files: %d" % len(s57_files)) # prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\testing\\survey\\valsou_check\\test1\\H12976_FFF_clip.000") # prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\data\\survey\\VALSOU Check\\H12881\\H12881_Final_Feature_File.000") prj.add_to_s57_list( "C:\\Users\\gmasetti\\Google Drive\\QC Tools\\data\\_issues\\VALSOU_Check_8_27_2018\\H13022_FFF.000" ) logger.debug(prj) # add a grid file # csar_files = testing.input_test_files(".csar") # print("- CSAR files: %d" % len(csar_files)) # bag_files = testing.input_test_files(".bag")
from PySide import QtGui from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.qctools.qt_progress import QtProgress from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing app = QtGui.QApplication([]) wid = QtGui.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a S57 file s57_files = testing.input_test_files(".000") print("- S57 files: %d" % len(s57_files)) # prj.add_to_s57_list(s57_files[3]) prj.add_to_s57_list( "C:/Users/gmasetti/Google Drive/QC Tools/test data\H12679/testing_feature_scan_v5/feature_testfile_10212016.000" ) print("%s" % (prj.s57_list, )) logger.debug(prj) prj.prf_check(version=1, specs_version='2018')
from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from PySide2 import QtWidgets from hyo2.abc.app.qt_progress import QtProgress app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a S57 file s57_files = testing.input_test_files(".000") # print("- S57 files: %d" % len(s57_files)) prj.add_to_s57_list(s57_files[0]) # prj.add_to_s57_list(s57_files[1]) # prj.add_to_s57_list(s57_files[2]) # prj.add_to_s57_list(s57_files[3]) # prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\support\\CMECS\\BottomSample_QCTools_Input-Output\\Input\\H12895_FFF.000") # prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\support\\CMECS\\BottomSample_QCTools_Input-Output\\Input2\\H12850_Final_Feature_File_Office.000") # prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\support\\CMECS\\BottomSample_QCTools_Input-Output\\Input3\\H12679_FFF.000") print("%s" % (prj.s57_list,)) logger.debug(prj) do_exif = True
from hyo2.qc.common import default_logging import logging from hyo2.abc.app.qt_progress import QtProgress from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing default_logging.load() logger = logging.getLogger(__name__) app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a CSAR file # csar_files = testing.input_test_files(".csar") # print("- CSAR files: %d" % len(csar_files)) # add a BAG file bag_files = testing.input_test_files(".bag") print("- BAG files: %d" % len(bag_files)) kluster_file = r"C:\code\kluster\kluster\test_data\srgrid_mean_auto_depth_20211127_201258" prj.add_to_grid_list(kluster_file) # prj.add_to_grid_list(csar_files[0]) # prj.add_to_grid_list(csar_files[1]) # prj.add_to_grid_list(bag_files[0])
from hyo2.qc.common import default_logging import sys import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from PySide import QtGui from hyo2.qc.qctools.qt_progress import QtProgress app = QtGui.QApplication([]) wid = QtGui.QWidget() prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a S57 file # s57_files = testing.input_test_files(".000") # print("- S57 files: %d" % len(s57_files)) # prj.add_to_s57_list(s57_files[0]) # prj.add_to_s57_list(s57_files[1]) # prj.add_to_s57_list(s57_files[2]) # prj.add_to_s57_list(s57_files[3]) prj.add_to_s57_list( "C:\\Users\\gmasetti\\Google Drive\\QC Tools\\support\\CMECS\\BottomSample_QCTools_Input-Output\\Input\\H12895_FFF.000" ) # prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\support\\CMECS\\BottomSample_QCTools_Input-Output\\Input2\\H12850_Final_Feature_File_Office.000") # prj.add_to_s57_list("C:\\Users\\gmasetti\\Google Drive\\QC Tools\\support\\CMECS\\BottomSample_QCTools_Input-Output\\Input3\\H12679_FFF.000") print("%s" % (prj.s57_list, )) logger.debug(prj)
# options use_internal_test_files = False use_internal_csar = True height_value = None check_laplacian = False check_curv = False check_adjacent = False check_slivers = False check_isolated = False check_edges = False check_margins = True filter_designated = False filter_fff = False prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) if use_internal_test_files: # add a grid file grid_idx = 0 if use_internal_csar: grid_files = testing.input_test_files(".csar") logger.debug("- test CSAR files: %d" % len(grid_files)) else: grid_files = testing.input_test_files(".bag") logger.debug("- test BAG files: %d" % len(grid_files)) logger.debug("- adding test grid file #%d" % grid_idx) prj.add_to_grid_list(path=grid_files[grid_idx]) else: prj.add_to_grid_list( r"C:\code\hyo2\processing\hyo2_qc\data\download\H13384_50cm_MLLW_testing_subset.csar"
"hyo2.qc", ]) app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() # options use_internal_test_files = False use_noaa_nbs_profile: bool = True check_structure: bool = True check_metadata: bool = True check_elevation: bool = True check_uncertainty: bool = True check_tracking_list: bool = True prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) if use_internal_test_files: # add a grid file grid_idx = 0 grid_files = testing.input_test_files(".bag") logger.debug("- test BAG files: %d" % len(grid_files)) logger.debug("- adding test grid file #%d" % grid_idx) prj.add_to_grid_list(path=grid_files[grid_idx]) else: prj.add_to_grid_list( r"C:\code\hyo2\processing\hyo2_qc\data\input\tiny_vr.bag") logger.debug(prj) prj.bag_checks_v1(use_nooa_nbs_profile=use_noaa_nbs_profile,
from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.qctools.qt_progress import QtProgress from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing app = QtGui.QApplication([]) wid = QtGui.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a CSAR file csar_files = testing.input_test_files(".csar") print("- CSAR files: %d" % len(csar_files)) # # add a BAG file # bag_files = testing.input_test_files(".bag") # print("- BAG files: %d" % len(bag_files)) prj.add_to_grid_list(csar_files[0]) # prj.add_to_grid_list(csar_files[1]) # prj.add_to_grid_list(bag_files[0]) print("%s" % (prj.grid_list,)) four_gb = 4294967296
from hyo2.qc.common import default_logging import sys import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from PySide import QtGui from hyo2.qc.qctools.qt_progress import QtProgress app = QtGui.QApplication([]) wid = QtGui.QWidget() prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # submission folders sub_folders = testing.input_submission_folders() logger.debug("testing > submission folders: %d" % len(sub_folders)) # # add folders # for i, sf in enumerate(sub_folders): # # logger.debug("- %d: %s" % (i, sf)) # # try: # if prj.is_valid_project_folder(path=sf): # prj.add_to_submission_list(sf) # # except Exception as e:
from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.qctools.qt_progress import QtProgress from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing app = QtGui.QApplication([]) wid = QtGui.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # # add a CSAR file # csar_files = testing.input_test_files(".csar") # print("- CSAR files: %d" % len(csar_files)) # # # add a BAG file # bag_files = testing.input_test_files(".bag") # print("- BAG files: %d" % len(bag_files)) # prj.add_to_grid_list(csar_files[0]) # prj.add_to_grid_list(bag_files[0]) # prj.add_to_grid_list("V:/CARIS_VR/H12880/Surfaces/H12880_2806_2016DN149_Ranges_CUBE.csar") # prj.add_to_grid_list("V:/CARIS_VR/H12880/Surfaces/H12880_10_1_0_Ranges_CUBE_Final.csar") # prj.add_to_grid_list("V:/CARIS_VR/H12880/Surfaces/Test0_H12280_2806_200kHz_DN149_CalderRice.csar") prj.add_to_grid_list(
height_value = 0.5 check_laplacian = True check_curv = True check_adjacent = True check_slivers = True check_isolated = True check_edges = True filter_designated = True filter_fff = True app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) csar_files = testing.input_test_files(".csar") logger.debug("test CSAR files: %d" % len(csar_files)) bag_files = testing.input_test_files(".bag") logger.debug("test BAG files: %d" % len(bag_files)) # prj.add_to_grid_list(csar_files[0]) # prj.add_to_grid_list(bag_files[0]) prj.add_to_grid_list( r"C:\Users\gmasetti\Google Drive\QC Tools\data\survey\Find Fliers\v8_filters\test_finalized.csar" ) prj.add_to_grid_list( r"C:\Users\gmasetti\Google Drive\QC Tools\data\survey\Find Fliers\v8_filters\test_finalized.bag" ) prj.add_to_s57_list(
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
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')
class SurveyWidget(AbstractWidget): def __init__(self, main_win): AbstractWidget.__init__(self, main_win=main_win) self.prj = SurveyProject(progress=QtProgress(parent=self)) self.prj.set_callback(QtGridCallback(progress=self.prj.progress)) # init default settings settings = QtCore.QSettings() # - import import_folder = settings.value("survey_import_folder") if (import_folder is None) or (not os.path.exists(import_folder)): settings.setValue("survey_import_folder", self.prj.output_folder) # - output folder export_folder = settings.value("survey_export_folder") if (export_folder is None) or (not os.path.exists(export_folder)): settings.setValue("survey_export_folder", self.prj.output_folder) else: # folder exists self.prj.output_folder = export_folder # - shp export_shp = settings.value("survey_export_shp") if export_shp is None: settings.setValue("survey_export_shp", self.prj.output_shp) else: # exists self.prj.output_shp = (export_shp == "true") # - kml export_kml = settings.value("survey_export_kml") if export_kml is None: settings.setValue("survey_export_kml", self.prj.output_kml) else: # exists self.prj.output_kml = (export_kml == "true") # - subfolders export_subfolders = settings.value("survey_export_subfolders") if export_subfolders is None: settings.setValue("survey_export_subfolders", self.prj.output_subfolders) else: # exists self.prj.output_subfolders = (export_subfolders == "true") # - project folder export_project_folder = settings.value("survey_export_project_folder") if export_project_folder is None: settings.setValue("survey_export_project_folder", self.prj.output_project_folder) else: # exists self.prj.output_project_folder = (export_project_folder == "true") # make tabs self.tabs = QtWidgets.QTabWidget() self.setCentralWidget(self.tabs) self.tabs.setContentsMargins(0, 0, 0, 0) self.tabs.setIconSize(QtCore.QSize(36, 36)) self.tabs.setTabPosition(QtWidgets.QTabWidget.South) # - inputs self.tab_inputs = InputsTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_inputs = self.tabs.insertTab(0, self.tab_inputs, QtGui.QIcon(os.path.join(self.media, 'inputs.png')), "") self.tabs.setTabToolTip(self.idx_inputs, "Data inputs") # - flier finder self.tab_fliers = FliersTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_fliers = self.tabs.insertTab(1, self.tab_fliers, QtGui.QIcon(os.path.join(self.media, 'fliers.png')), "") self.tabs.setTabToolTip(self.idx_fliers, "Detect fliers") self.tabs.setTabEnabled(self.idx_fliers, False) # - anomaly detector self.test_anomaly = False self.tab_anomaly = AnomalyTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_anomaly = self.tabs.insertTab(2, self.tab_anomaly, QtGui.QIcon(os.path.join(self.media, 'anomaly.png')), "") self.tabs.setTabToolTip(self.idx_anomaly, "Anomaly detector") self.tabs.setTabEnabled(self.idx_anomaly, False) self.tab_anomaly.setHidden(True) # - holiday finder self.tab_holes = HolesTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_holes = self.tabs.insertTab(3, self.tab_holes, QtGui.QIcon(os.path.join(self.media, 'holes.png')), "") self.tabs.setTabToolTip(self.idx_holes, "Detect holidays") self.tabs.setTabEnabled(self.idx_holes, False) # - grid qa self.tab_gridqa = GridQATab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_gridqa = self.tabs.insertTab(4, self.tab_gridqa, QtGui.QIcon(os.path.join(self.media, 'gridqa.png')), "") self.tabs.setTabToolTip(self.idx_gridqa, "Grid QA") self.tabs.setTabEnabled(self.idx_gridqa, False) # - designated self.tab_designated = DesignatedTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_designated = self.tabs.insertTab(5, self.tab_designated, QtGui.QIcon(os.path.join(self.media, 'designated.png')), "") self.tabs.setTabToolTip(self.idx_designated, "Scan designated (BAG only)") self.tabs.setTabEnabled(self.idx_designated, False) # - scan features self.tab_scan = ScanTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_scan = self.tabs.insertTab(6, self.tab_scan, QtGui.QIcon(os.path.join(self.media, 'scan_features.png')), "") self.tabs.setTabToolTip(self.idx_scan, "Scan features") self.tabs.setTabEnabled(self.idx_scan, False) # - VALSOU checks self.tab_valsou = ValsouTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_valsou = self.tabs.insertTab(7, self.tab_valsou, QtGui.QIcon(os.path.join(self.media, 'valsou.png')), "") self.tabs.setTabToolTip(self.idx_valsou, "VALSOU check") self.tabs.setTabEnabled(self.idx_valsou, False) # - SBDARE checks self.tab_sbdare = SbdareTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_sbdare = self.tabs.insertTab(8, self.tab_sbdare, QtGui.QIcon(os.path.join(self.media, 'sbdare.png')), "") self.tabs.setTabToolTip(self.idx_sbdare, "SBDARE export") self.tabs.setTabEnabled(self.idx_sbdare, False) # - Submission tests self.tab_submission = SubmissionTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_submission = self.tabs.insertTab(9, self.tab_submission, QtGui.QIcon(os.path.join(self.media, 'submission.png')), "") self.tabs.setTabToolTip(self.idx_submission, "Submission checks") self.tabs.setTabEnabled(self.idx_submission, True) # noinspection PyUnresolvedReferences self.tabs.currentChanged.connect(self.change_tabs) # flags self.has_grid = False self.has_s57 = False def keyPressEvent(self, event): key = event.key() # noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences if key in [QtCore.Qt.Key_A, ]: if self.test_anomaly: self.test_anomaly = False self.tabs.setTabEnabled(self.idx_anomaly, False) else: self.test_anomaly = True if self.has_grid: self.tabs.setTabEnabled(self.idx_anomaly, True) logger.debug("anomaly detector: %s" % self.test_anomaly) return super(SurveyWidget, self).keyPressEvent(event) def do(self): """DEBUGGING""" pass def grids_loaded(self): self.tabs.setTabEnabled(self.idx_fliers, True) if self.test_anomaly: self.tabs.setTabEnabled(self.idx_anomaly, True) self.tabs.setTabEnabled(self.idx_holes, True) self.tabs.setTabEnabled(self.idx_gridqa, True) if self.prj.has_bag_grid() and self.has_s57: self.tabs.setTabEnabled(self.idx_designated, True) else: self.tabs.setTabEnabled(self.idx_designated, False) if self.has_s57: self.tabs.setTabEnabled(self.idx_valsou, True) self.tab_fliers.grids_changed() self.has_grid = True def grids_unloaded(self): self.tabs.setTabEnabled(self.idx_fliers, False) self.tabs.setTabEnabled(self.idx_anomaly, False) self.tabs.setTabEnabled(self.idx_holes, False) self.tabs.setTabEnabled(self.idx_gridqa, False) self.tabs.setTabEnabled(self.idx_designated, False) self.tabs.setTabEnabled(self.idx_valsou, False) self.tab_fliers.grids_changed() self.has_grid = False def s57_loaded(self): self.tabs.setTabEnabled(self.idx_scan, True) self.tabs.setTabEnabled(self.idx_sbdare, True) if self.prj.has_bag_grid(): self.tabs.setTabEnabled(self.idx_designated, True) else: self.tabs.setTabEnabled(self.idx_designated, False) if self.has_grid: self.tabs.setTabEnabled(self.idx_valsou, True) self.has_s57 = True def s57_unloaded(self): self.tabs.setTabEnabled(self.idx_scan, False) self.tabs.setTabEnabled(self.idx_sbdare, False) self.tabs.setTabEnabled(self.idx_valsou, False) self.has_s57 = False
check_slivers = True check_isolated = True check_edges = True filter_designated = False filter_fff = True export_proxies = True export_heights = True export_curvatures = True app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) csar_files = testing.input_test_files(".csar") logger.debug("test CSAR files: %d" % len(csar_files)) # bag_files = testing.input_test_files(".bag") # logger.debug("test BAG files: %d" % len(bag_files)) prj.add_to_grid_list(csar_files[0]) # prj.add_to_grid_list(bag_files[1]) # prj.add_to_grid_list(r"C:\Users\gmasetti\Google Drive\QC Tools\data\survey\Find Fliers\FFv7_filters\ # test_finalized.csar") # prj.add_to_grid_list(r"C:\Users\gmasetti\Google Drive\QC Tools\data\survey\Find Fliers\FFv7_filters\ # test_finalized.bag") # prj.add_to_grid_list(r"C:\Users\gmasetti\Google Drive\QC Tools\test_data_vr_do.not.use\ # Test0_H12280_2806_200kHz_DN149_CalderRice.bag") # prj.add_to_grid_list(r"C:\Users\gmasetti\Google Drive\QC Tools\test_data_vr_do.not.use\
output_folder = "U:\\Working\\QCTools\\scripts" if not os.path.exists(output_folder): logger.error("output folder does not exist: %s" % output_folder) exit(-1) if not os.path.isdir(output_folder): logger.error("output folder is actually not a folder: %s" % output_folder) exit(-1) logger.debug("output folder: %s" % output_folder) # create the project prj = SurveyProject(output_folder=output_folder) # add all the BAG files to the project for bag_path in bag_todo_list: prj.add_to_grid_list(bag_path) # create 3 empty lists: one for the BAGs successfully processed, one for the ones without Uncertainty lauyer, # and another for crashes bag_done_list = list() bag_without_uncertainty_list = list() bag_crash_list = list() # actually processing the BAG files
from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.abc.app.qt_progress import QtProgress from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from hyo2.qc.survey.scan.checks import Checks app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() # create the project prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a S57 file s57_files = testing.input_test_files(".000") logger.debug("- S57 files: %d" % len(s57_files)) prj.add_to_s57_list(s57_files[3]) # prj.add_to_s57_list("C:/Users/gmasetti/Google Drive/QC Tools/data/survey/feature_scan/H12971_FFF_Field_2018.000") # prj.add_to_s57_list("C:/Users/gmasetti/Google Drive/QC Tools/test data/2018_HSSD_Test/H12971_FFF_Office_2018Test.000") logger.debug("%s" % (prj.s57_list, )) logger.debug(prj) prj.feature_scan(specs_version='2021', use_mhw=True, mhw_value=4.0, survey_area=Checks.survey_areas["Pacific Coast"])
def __init__(self, main_win): AbstractWidget.__init__(self, main_win=main_win) self.prj = SurveyProject(progress=QtProgress(parent=self)) self.prj.set_callback(QtGridCallback(progress=self.prj.progress)) # init default settings settings = QtCore.QSettings() # - import import_folder = settings.value("survey_import_folder") if (import_folder is None) or (not os.path.exists(import_folder)): settings.setValue("survey_import_folder", self.prj.output_folder) # - output folder export_folder = settings.value("survey_export_folder") if (export_folder is None) or (not os.path.exists(export_folder)): settings.setValue("survey_export_folder", self.prj.output_folder) else: # folder exists self.prj.output_folder = export_folder # - shp export_shp = settings.value("survey_export_shp") if export_shp is None: settings.setValue("survey_export_shp", self.prj.output_shp) else: # exists self.prj.output_shp = (export_shp == "true") # - kml export_kml = settings.value("survey_export_kml") if export_kml is None: settings.setValue("survey_export_kml", self.prj.output_kml) else: # exists self.prj.output_kml = (export_kml == "true") # - subfolders export_subfolders = settings.value("survey_export_subfolders") if export_subfolders is None: settings.setValue("survey_export_subfolders", self.prj.output_subfolders) else: # exists self.prj.output_subfolders = (export_subfolders == "true") # - project folder export_project_folder = settings.value("survey_export_project_folder") if export_project_folder is None: settings.setValue("survey_export_project_folder", self.prj.output_project_folder) else: # exists self.prj.output_project_folder = (export_project_folder == "true") # make tabs self.tabs = QtWidgets.QTabWidget() self.setCentralWidget(self.tabs) self.tabs.setContentsMargins(0, 0, 0, 0) self.tabs.setIconSize(QtCore.QSize(36, 36)) self.tabs.setTabPosition(QtWidgets.QTabWidget.South) # - inputs self.tab_inputs = InputsTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_inputs = self.tabs.insertTab( 0, self.tab_inputs, QtGui.QIcon(os.path.join(self.media, 'inputs.png')), "") self.tabs.setTabToolTip(self.idx_inputs, "Data inputs") # - flier finder self.tab_fliers = FliersTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_fliers = self.tabs.insertTab( 1, self.tab_fliers, QtGui.QIcon(os.path.join(self.media, 'fliers.png')), "") self.tabs.setTabToolTip(self.idx_fliers, "Detect fliers") self.tabs.setTabEnabled(self.idx_fliers, False) # - holiday finder self.tab_holes = HolesTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_holes = self.tabs.insertTab( 3, self.tab_holes, QtGui.QIcon(os.path.join(self.media, 'holes.png')), "") self.tabs.setTabToolTip(self.idx_holes, "Detect holidays") self.tabs.setTabEnabled(self.idx_holes, False) # - grid qa self.tab_gridqa = GridQATab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_gridqa = self.tabs.insertTab( 4, self.tab_gridqa, QtGui.QIcon(os.path.join(self.media, 'gridqa.png')), "") self.tabs.setTabToolTip(self.idx_gridqa, "Grid QA") self.tabs.setTabEnabled(self.idx_gridqa, False) # - bag checks self.tab_bag_checks = BAGChecksTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_bag_checks = self.tabs.insertTab( 5, self.tab_bag_checks, QtGui.QIcon(os.path.join(self.media, 'bag_checks.png')), "") self.tabs.setTabToolTip(self.idx_bag_checks, "BAG Checks") self.tabs.setTabEnabled(self.idx_bag_checks, False) # - designated self.tab_designated = DesignatedTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_designated = self.tabs.insertTab( 6, self.tab_designated, QtGui.QIcon(os.path.join(self.media, 'designated.png')), "") self.tabs.setTabToolTip(self.idx_designated, "Scan designated (BAG only)") self.tabs.setTabEnabled(self.idx_designated, False) # - scan features self.tab_scan = ScanTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_scan = self.tabs.insertTab( 7, self.tab_scan, QtGui.QIcon(os.path.join(self.media, 'scan_features.png')), "") self.tabs.setTabToolTip(self.idx_scan, "Scan features") self.tabs.setTabEnabled(self.idx_scan, False) # - VALSOU checks self.tab_valsou = ValsouTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_valsou = self.tabs.insertTab( 8, self.tab_valsou, QtGui.QIcon(os.path.join(self.media, 'valsou.png')), "") self.tabs.setTabToolTip(self.idx_valsou, "VALSOU check") self.tabs.setTabEnabled(self.idx_valsou, False) # - SBDARE checks self.tab_sbdare = SbdareTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_sbdare = self.tabs.insertTab( 9, self.tab_sbdare, QtGui.QIcon(os.path.join(self.media, 'sbdare.png')), "") self.tabs.setTabToolTip(self.idx_sbdare, "SBDARE export") self.tabs.setTabEnabled(self.idx_sbdare, False) # - Submission tests self.tab_submission = SubmissionTab(parent_win=self, prj=self.prj) # noinspection PyArgumentList self.idx_submission = self.tabs.insertTab( 10, self.tab_submission, QtGui.QIcon(os.path.join(self.media, 'submission.png')), "") self.tabs.setTabToolTip(self.idx_submission, "Submission checks") self.tabs.setTabEnabled(self.idx_submission, True) # noinspection PyUnresolvedReferences self.tabs.currentChanged.connect(self.change_tabs) # flags self.has_grid = False self.has_s57 = False
from hyo2.abc.app.qt_progress import QtProgress logger = logging.getLogger(__name__) set_logging(ns_list=["hyo2.qc", ]) app = QtWidgets.QApplication([]) wid = QtWidgets.QWidget() # options use_internal_test_files = False use_internal_csar = True with_laser = True specs_version = "2021" is_target_detection = False prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid)) # add a S57 file if use_internal_test_files: s57_idx = 0 s57_files = testing.input_test_files(".000") logger.debug("- test S57 files: %d" % len(s57_files)) logger.debug("- adding test S57 file #%d" % s57_idx) prj.add_to_s57_list(s57_path=s57_files[s57_idx]) # add a grid file grid_idx = 0 if use_internal_csar: grid_files = testing.input_test_files(".csar") logger.debug("- test CSAR files: %d" % len(grid_files)) else:
import sys import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.survey.project import SurveyProject from hyo2.qc.common import testing from PySide import QtGui from hyo2.qc.qctools.qt_progress import QtProgress from hyo2.qc.common.grid_callback.qt_grid_callback import QtGridCallback app = QtGui.QApplication([]) wid = QtGui.QWidget() 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
from hyo2.qc.common import default_logging import logging from hyo2.qc.survey.project import SurveyProject default_logging.load() logger = logging.getLogger() prj = SurveyProject() logger.debug(prj) prj.open_output_folder()