-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added functions to check correspondance between depth and uncertainty
- Loading branch information
Showing
6 changed files
with
428 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
import logging | ||
|
||
from hyo2.abc2.lib.logging import set_logging | ||
from hyo2.abc2.lib.testing import Testing | ||
from hyo2.abc2.lib.gdal_aux import GdalAux | ||
from hyo2.bag.bag import BAGFile | ||
from hyo2.bag.meta import Meta | ||
from hyo2.qc4.lib.common.writers.s57_writer import S57Writer | ||
from hyo2.qc4.lib.common.writers.kml_writer import KmlWriter | ||
from hyo2.qc4.lib.common.writers.shp_writer import ShpWriter | ||
|
||
set_logging(ns_list=['hyo2.bag']) | ||
logger = logging.getLogger(__name__) | ||
|
||
# file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_01.bag") | ||
file_bag_0 = r"D:\google_drive\_ccom\QC Tools\data\survey\QC Tools 4\BAG_Checks\depth_without_uncertainty\depth_no_unc.bag" | ||
|
||
root_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) | ||
testing = Testing(root_folder=root_folder) | ||
|
||
GdalAux.push_gdal_error_handler() | ||
GdalAux.check_gdal_data(verbose=True) | ||
|
||
if os.path.exists(file_bag_0): | ||
logger.debug("- file_bag_0: %s" % file_bag_0) | ||
|
||
bag_0 = BAGFile(file_bag_0, mode="r") | ||
logger.debug(bag_0) | ||
|
||
meta = Meta(bag_0.metadata()) | ||
|
||
ret = bag_0.depth_has_uncertainty() | ||
logger.debug(ret) | ||
|
||
if not ret: | ||
logger.info("No flags") | ||
exit() | ||
|
||
s57_bn_path = os.path.join(testing.output_data_folder(), "%s.blue_notes.000" % os.path.basename(file_bag_0)) | ||
s57_ss_path = os.path.join(testing.output_data_folder(), "%s.soundings.000" % os.path.basename(file_bag_0)) | ||
|
||
flags_for_blue_notes = list() | ||
for entry in ret: | ||
flags_for_blue_notes.append([entry[0], entry[1], "%.2f" % entry[2]]) | ||
|
||
S57Writer.write_bluenotes(feature_list=flags_for_blue_notes, path=s57_bn_path, list_of_list=False) | ||
S57Writer.write_soundings(feature_list=ret, path=s57_ss_path, list_of_list=False) | ||
KmlWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) | ||
ShpWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
import logging | ||
|
||
from hyo2.abc2.lib.logging import set_logging | ||
from hyo2.abc2.lib.testing import Testing | ||
from hyo2.abc2.lib.gdal_aux import GdalAux | ||
from hyo2.bag.bag import BAGFile | ||
from hyo2.bag.meta import Meta | ||
from hyo2.qc4.lib.common.writers.s57_writer import S57Writer | ||
from hyo2.qc4.lib.common.writers.kml_writer import KmlWriter | ||
from hyo2.qc4.lib.common.writers.shp_writer import ShpWriter | ||
|
||
set_logging(ns_list=['hyo2.bag']) | ||
logger = logging.getLogger(__name__) | ||
|
||
# file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_01.bag") | ||
file_bag_0 = r"D:\google_drive\_ccom\QC Tools\data\survey\QC Tools 4\BAG_Checks\uncertainty_without_depth\unc_no_depth.bag" | ||
|
||
root_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) | ||
testing = Testing(root_folder=root_folder) | ||
|
||
GdalAux.push_gdal_error_handler() | ||
GdalAux.check_gdal_data(verbose=True) | ||
|
||
if os.path.exists(file_bag_0): | ||
logger.debug("- file_bag_0: %s" % file_bag_0) | ||
|
||
bag_0 = BAGFile(file_bag_0, mode="r") | ||
logger.debug(bag_0) | ||
|
||
meta = Meta(bag_0.metadata()) | ||
|
||
ret = bag_0.uncertainty_has_depth() | ||
logger.debug(ret) | ||
|
||
if not ret: | ||
logger.info("No flags") | ||
exit() | ||
|
||
s57_bn_path = os.path.join(testing.output_data_folder(), "%s.blue_notes.000" % os.path.basename(file_bag_0)) | ||
s57_ss_path = os.path.join(testing.output_data_folder(), "%s.soundings.000" % os.path.basename(file_bag_0)) | ||
|
||
flags_for_blue_notes = list() | ||
for entry in ret: | ||
flags_for_blue_notes.append([entry[0], entry[1], "%.2f" % entry[2]]) | ||
|
||
S57Writer.write_bluenotes(feature_list=flags_for_blue_notes, path=s57_bn_path, list_of_list=False) | ||
S57Writer.write_soundings(feature_list=ret, path=s57_ss_path, list_of_list=False) | ||
KmlWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) | ||
ShpWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
import logging | ||
|
||
from hyo2.abc2.lib.logging import set_logging | ||
from hyo2.abc2.lib.testing import Testing | ||
from hyo2.abc2.lib.gdal_aux import GdalAux | ||
from hyo2.bag.bag import BAGFile | ||
from hyo2.bag.meta import Meta | ||
from hyo2.qc4.lib.common.writers.s57_writer import S57Writer | ||
from hyo2.qc4.lib.common.writers.kml_writer import KmlWriter | ||
from hyo2.qc4.lib.common.writers.shp_writer import ShpWriter | ||
|
||
set_logging(ns_list=['hyo2.bag']) | ||
logger = logging.getLogger(__name__) | ||
|
||
# file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_01.bag") | ||
file_bag_0 = r"D:\google_drive\_ccom\QC Tools\data\survey\BAG Checks\H13275_MB_VR_MLLW.bag" | ||
|
||
root_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) | ||
testing = Testing(root_folder=root_folder) | ||
|
||
GdalAux.push_gdal_error_handler() | ||
GdalAux.check_gdal_data(verbose=True) | ||
|
||
if os.path.exists(file_bag_0): | ||
logger.debug("- file_bag_0: %s" % file_bag_0) | ||
|
||
bag_0 = BAGFile(file_bag_0, mode="r") | ||
logger.debug(bag_0) | ||
|
||
meta = Meta(bag_0.metadata()) | ||
|
||
ret = bag_0.vr_depth_has_uncertainty() | ||
logger.debug(ret) | ||
|
||
if not ret: | ||
logger.info("No flags") | ||
exit() | ||
|
||
s57_bn_path = os.path.join(testing.output_data_folder(), "%s.blue_notes.000" % os.path.basename(file_bag_0)) | ||
s57_ss_path = os.path.join(testing.output_data_folder(), "%s.soundings.000" % os.path.basename(file_bag_0)) | ||
|
||
flags_for_blue_notes = list() | ||
for entry in ret: | ||
flags_for_blue_notes.append([entry[0], entry[1], "%.2f" % entry[2]]) | ||
|
||
S57Writer.write_bluenotes(feature_list=flags_for_blue_notes, path=s57_bn_path, list_of_list=False) | ||
S57Writer.write_soundings(feature_list=ret, path=s57_ss_path, list_of_list=False) | ||
KmlWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) | ||
ShpWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
import logging | ||
|
||
from hyo2.abc2.lib.logging import set_logging | ||
from hyo2.abc2.lib.testing import Testing | ||
from hyo2.abc2.lib.gdal_aux import GdalAux | ||
from hyo2.bag.bag import BAGFile | ||
from hyo2.bag.meta import Meta | ||
from hyo2.qc4.lib.common.writers.s57_writer import S57Writer | ||
from hyo2.qc4.lib.common.writers.kml_writer import KmlWriter | ||
from hyo2.qc4.lib.common.writers.shp_writer import ShpWriter | ||
|
||
set_logging(ns_list=['hyo2.bag']) | ||
logger = logging.getLogger(__name__) | ||
|
||
# file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_01.bag") | ||
file_bag_0 = r"D:\google_drive\_ccom\QC Tools\data\survey\BAG Checks\H13275_MB_VR_MLLW.bag" | ||
|
||
root_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) | ||
testing = Testing(root_folder=root_folder) | ||
|
||
GdalAux.push_gdal_error_handler() | ||
GdalAux.check_gdal_data(verbose=True) | ||
|
||
if os.path.exists(file_bag_0): | ||
logger.debug("- file_bag_0: %s" % file_bag_0) | ||
|
||
bag_0 = BAGFile(file_bag_0, mode="r") | ||
logger.debug(bag_0) | ||
|
||
meta = Meta(bag_0.metadata()) | ||
|
||
ret = bag_0.vr_uncertainty_has_depth() | ||
logger.debug(ret) | ||
|
||
if not ret: | ||
logger.info("No flags") | ||
exit() | ||
|
||
s57_bn_path = os.path.join(testing.output_data_folder(), "%s.blue_notes.000" % os.path.basename(file_bag_0)) | ||
s57_ss_path = os.path.join(testing.output_data_folder(), "%s.soundings.000" % os.path.basename(file_bag_0)) | ||
|
||
flags_for_blue_notes = list() | ||
for entry in ret: | ||
flags_for_blue_notes.append([entry[0], entry[1], "%.2f" % entry[2]]) | ||
|
||
S57Writer.write_bluenotes(feature_list=flags_for_blue_notes, path=s57_bn_path, list_of_list=False) | ||
S57Writer.write_soundings(feature_list=ret, path=s57_ss_path, list_of_list=False) | ||
KmlWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) | ||
ShpWriter().write_bluenotes(feature_list=ret, path=s57_ss_path[:-4], list_of_list=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
""" | ||
|
||
name = 'BAG' | ||
__version__ = '1.2.6' | ||
__version__ = '1.2.7' | ||
__author__ = '[email protected]' | ||
__license__ = 'LGPLv3 license' | ||
__copyright__ = 'Copyright (c) 2024, University of New Hampshire, Center for Coastal and Ocean Mapping' |
Oops, something went wrong.