def test_cur_grid_shape(self): prj = ChartProject(output_folder=testing.output_data_folder()) prj.add_to_grid_list(testing.input_test_files(".bag")[0]) prj.set_cur_grid(testing.input_test_files(".bag")[0]) prj.open_to_read_cur_grid() self.assertEquals(prj.cur_grid_shape[0], 0) self.assertEquals(prj.cur_grid_shape[1], 0)
def test_make_project_survey_label(self): prj = ChartProject(output_folder=None) prj.add_to_s57_list(testing.input_test_files(".000")[-1]) prj.read_feature_file(testing.input_test_files(".000")[-1]) self.assertTrue(len(prj.survey_label) != 0) self.assertTrue(len(prj.survey_label) == 6) self.assertEqual(prj.survey_label, "tiny__")
def test_cur_grid_has_layers(self): prj = ChartProject(output_folder=testing.output_data_folder()) with self.assertRaises(RuntimeError): prj.cur_grid_has_depth_layer() with self.assertRaises(RuntimeError): prj.cur_grid_has_product_uncertainty_layer() with self.assertRaises(RuntimeError): prj.cur_grid_has_density_layer() with self.assertRaises(RuntimeError): prj.cur_grid_has_tvu_qc_layer() with self.assertRaises(RuntimeError): prj.cur_grid_tvu_qc_layers() with self.assertRaises(RuntimeError): prj.set_cur_grid_tvu_qc_name("fake") prj.add_to_grid_list(testing.input_test_files(".bag")[0]) prj.set_cur_grid(testing.input_test_files(".bag")[0]) prj.open_to_read_cur_grid() self.assertTrue(prj.cur_grid_has_depth_layer()) self.assertTrue(prj.cur_grid_has_product_uncertainty_layer()) self.assertFalse(prj.cur_grid_has_density_layer()) self.assertFalse(prj.cur_grid_has_tvu_qc_layer()) self.assertEqual(len(prj.cur_grid_tvu_qc_layers()), 0) self.assertTrue(prj.has_bag_grid()) self.assertFalse(prj.has_csar_grid())
def test_s57_list_add_real(self): prj = ChartProject(output_folder=testing.output_data_folder()) prj.add_to_s57_list(testing.input_test_files(".000")[0]) self.assertEqual(len(prj.s57_list), 1) prj.add_to_s57_list(testing.input_test_files(".000")[0]) self.assertEqual(len(prj.s57_list), 1) prj.remove_from_s57_list(testing.input_test_files(".000")[0]) self.assertEqual(len(prj.s57_list), 0)
def test_grid_list_add_real(self): prj = BaseProject(projects_folder=testing.output_data_folder()) prj.add_to_grid_list(testing.input_test_files(".bag")[0]) self.assertEqual(len(prj.grid_list), 1) prj.add_to_grid_list(testing.input_test_files(".bag")[0]) self.assertEqual(len(prj.grid_list), 1) prj.remove_from_grid_list(testing.input_test_files(".bag")[0]) self.assertEqual(len(prj.grid_list), 0)
def test_select_layers_in_cur_grid(self): prj = BaseProject(projects_folder=testing.output_data_folder()) prj.add_to_grid_list(testing.input_test_files(".bag")[0]) prj.set_cur_grid(testing.input_test_files(".bag")[0]) prj.open_to_read_cur_grid() self.assertEqual(len(prj.selected_layers_in_cur_grid), 0) prj.selected_layers_in_cur_grid = [layer_types['depth'], ] self.assertEqual(len(prj.selected_layers_in_cur_grid), 1)
def test_grid_read(self): prj = ChartProject(output_folder=testing.output_data_folder()) self.assertTrue(prj.cur_grid is None) self.assertFalse(prj.has_grid()) with self.assertRaises(RuntimeError): _ = prj.cur_grid_basename prj.add_to_grid_list(testing.input_test_files(".bag")[0]) prj.set_cur_grid(testing.input_test_files(".bag")[0]) prj.open_to_read_cur_grid() self.assertTrue(prj.cur_grid is not None) self.assertTrue(prj.has_grid()) self.assertGreater(len(prj.cur_grid_basename), 0)
def test_ss_read(self): prj = BaseProject(projects_folder=testing.output_data_folder()) self.assertTrue(prj.cur_ss is None) self.assertFalse(prj.has_ss()) self.assertEqual(len(prj.cur_ss_basename), 0) prj.read_ss_file(testing.input_test_files(".000")[0]) self.assertTrue(prj.cur_ss is not None) self.assertTrue(prj.has_ss()) self.assertGreater(len(prj.cur_ss_basename), 0)
def test_s57_read(self): prj = ChartProject(output_folder=testing.output_data_folder()) self.assertTrue(prj.cur_s57 is None) self.assertFalse(prj.has_s57()) self.assertEqual(len(prj.cur_s57_basename), 0) prj.read_feature_file(testing.input_test_files(".000")[0]) self.assertTrue(prj.cur_s57 is not None) self.assertTrue(prj.has_s57()) self.assertGreater(len(prj.cur_s57_basename), 0)
def test_truncate_with_grids(self): prj = ChartProject(output_folder=testing.output_data_folder()) prj.add_to_grid_list(testing.input_test_files(".bag")[0]) self.assertTrue(prj.grid_truncate())
from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.chart.project import ChartProject from hyo2.qc.common import testing prj = ChartProject(output_folder=testing.output_data_folder()) input_bag_file = testing.input_test_files('.bag')[0] logger.debug('input: %s' % input_bag_file) prj.add_to_grid_list(input_bag_file) prj.grid_truncate(version=2, decimal_places=0) logger.debug(prj)
def test_grid_list_clear(self): prj = BaseProject(projects_folder=testing.output_data_folder()) prj.add_to_grid_list(testing.input_test_files(".bag")[0]) prj.clear_grid_list() self.assertEqual(len(prj.grid_list), 0)
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: 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])
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( r"C:\Users\gmasetti\Google Drive\QC Tools\data\survey\Find Fliers\v8_filters\v8_filters.000" )
from hyo2.qc.common import default_logging import logging default_logging.load() logger = logging.getLogger() from hyo2.qc.chart.project import ChartProject from hyo2.qc.common import testing prj = ChartProject(output_folder=testing.output_data_folder()) input_s57_file = testing.input_test_files('.000')[0] logger.debug('input: %s' % input_s57_file) prj.add_to_s57_list(input_s57_file) prj.s57_truncate(version=2, decimal_places=0) logger.debug(prj)
def test_s57_list_clear(self): prj = ChartProject(output_folder=testing.output_data_folder()) prj.add_to_s57_list(testing.input_test_files(".000")[0]) prj.clear_s57_list() self.assertEqual(len(prj.s57_list), 0)
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") print("%s" % (prj.grid_list, )) #four_gb = 4294967296
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.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 specs = "2016" prj.clear_survey_label() prj.read_feature_file(feature_path=prj.s57_list[0])
def test_truncate_with_wrong_version(self): prj = ChartProject(output_folder=testing.output_data_folder()) prj.add_to_grid_list(testing.input_test_files(".bag")[0]) self.assertFalse(prj.grid_truncate(version=1))