Beispiel #1
0
import logging
from matplotlib import pyplot as plt

logger = logging.getLogger()
logger.setLevel(logging.NOTSET)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)  # change to WARNING to reduce verbosity, DEBUG for high verbosity
ch_formatter = logging.Formatter('%(levelname)-9s %(name)s.%(funcName)s:%(lineno)d > %(message)s')
ch.setFormatter(ch_formatter)
logger.addHandler(ch)

from hyo.bag import BAGFile
from hyo.bag import BAGError
from hyo.bag.helper import Helper
from hyo.bag.tracklist import TrackList2Csv

bag_file = os.path.join(Helper.samples_folder(), "bdb_01.bag")
bag = BAGFile(bag_file)
tl = bag.tracking_list()
tl2csv = TrackList2Csv(tl)

bag_file = os.path.join(Helper.samples_folder(), "bdb_02.bag")
bag = BAGFile(bag_file)
tl = bag.tracking_list()
tl_fields = bag.tracking_list_fields()
tl_types = bag.tracking_list_types()
print(tl_fields)
print(tl_types)
print(tl)
tl2csv = TrackList2Csv(track_list=tl, header=tl_fields)
import subprocess
import os

from hyo.bag.helper import Helper
from hyo.bag import tools


tools_folder = os.path.abspath(os.path.dirname(tools.__file__))
tool_path = os.path.join(tools_folder, 'bag_elevation.py')
print("tool: %s" % tool_path)

# help
print("\n\n# -h")
subprocess.call("python %s -h" % tool_path)

# verbose + test file
file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_00.bag")
print("\n\n# -v %s" % file_bag_0)
subprocess.call("python %s -v -o test_elv.tiff %s" % (tool_path, file_bag_0))
subprocess.call("python %s -v -o test_elv.ascii -f ascii %s" % (tool_path, file_bag_0))

# verbose + fake file
file_bag_0 = os.path.join(Helper.samples_folder(), "not_present_00.bag")
print("\n\n# -v %s" % file_bag_0)
subprocess.call("python %s -v %s" % (tool_path, file_bag_0))

# test file
file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_00.bag")
print("\n\n# %s" % file_bag_0)
subprocess.call("python %s %s" % (tool_path, file_bag_0))
Beispiel #3
0
logger = logging.getLogger()
logger.setLevel(logging.NOTSET)
ch = logging.StreamHandler()
ch.setLevel(
    logging.DEBUG
)  # change to WARNING to reduce verbosity, DEBUG for high verbosity
ch_formatter = logging.Formatter(
    '%(levelname)-9s %(name)s.%(funcName)s:%(lineno)d > %(message)s')
ch.setFormatter(ch_formatter)
logger.addHandler(ch)

from hyo.bag import BAGFile
from hyo.bag import BAGError
from hyo.bag.helper import Helper

file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_01.bag")
if os.path.exists(file_bag_0):
    print("- file_bag_0: %s" % file_bag_0)

bag_0 = BAGFile(file_bag_0)
print(bag_0)

print(type(bag_0.elevation(mask_nan=True)),
      bag_0.elevation(mask_nan=True).shape,
      bag_0.elevation(mask_nan=True).dtype)
# ax =plt.contourf(bag_0.elevation(mask_nan=True))
# plt.colorbar(ax)
# plt.show()

bag_meta = bag_0.populate_metadata()
print(bag_meta)
logger = logging.getLogger()
logger.setLevel(logging.NOTSET)
ch = logging.StreamHandler()
ch.setLevel(
    logging.DEBUG
)  # change to WARNING to reduce verbosity, DEBUG for high verbosity
ch_formatter = logging.Formatter(
    '%(levelname)-9s %(name)s.%(funcName)s:%(lineno)d > %(message)s')
ch.setFormatter(ch_formatter)
logger.addHandler(ch)

from hyo.bag import BAGFile
from hyo.bag import BAGError
from hyo.bag.helper import Helper
from hyo.bag.tracklist import TrackList2Csv

bag_file = os.path.join(Helper.samples_folder(), "bdb_01.bag")
bag = BAGFile(bag_file)
tl = bag.tracking_list()
tl2csv = TrackList2Csv(tl)

bag_file = os.path.join(Helper.samples_folder(), "bdb_02.bag")
bag = BAGFile(bag_file)
tl = bag.tracking_list()
tl_fields = bag.tracking_list_fields()
tl_types = bag.tracking_list_types()
print(tl_fields)
print(tl_types)
print(tl)
tl2csv = TrackList2Csv(track_list=tl, header=tl_fields)
Beispiel #5
0
import subprocess
import os

from hyo.bag.helper import Helper
from hyo.bag import tools


tools_folder = os.path.abspath(os.path.dirname(tools.__file__))
tool_path = os.path.join(tools_folder, 'bag_uncertainty.py')
print("tool: %s" % tool_path)

# help
print("\n\n# -h")
subprocess.call("python %s -h" % tool_path)

# verbose + test file
file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_00.bag")
print("\n\n# -v %s" % file_bag_0)
subprocess.call("python %s -v -o test_unc.tiff %s" % (tool_path, file_bag_0))
subprocess.call("python %s -v -o test_unc.ascii -f ascii %s" % (tool_path, file_bag_0))

# verbose + fake file
file_bag_0 = os.path.join(Helper.samples_folder(), "not_present_00.bag")
print("\n\n# -v %s" % file_bag_0)
subprocess.call("python %s -v %s" % (tool_path, file_bag_0))

# test file
file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_00.bag")
print("\n\n# %s" % file_bag_0)
subprocess.call("python %s %s" % (tool_path, file_bag_0))
Beispiel #6
0
import logging

logger = logging.getLogger()
logger.setLevel(logging.NOTSET)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)  # change to WARNING to reduce verbosity, DEBUG for high verbosity
ch_formatter = logging.Formatter('%(levelname)-9s %(name)s.%(funcName)s:%(lineno)d > %(message)s')
ch.setFormatter(ch_formatter)
logger.addHandler(ch)


from hyo.bag.helper import BAGError, Helper

try:
    raise BAGError("test")
except BAGError as e:
    print(e)

data_folder = Helper.samples_folder()
if os.path.exists(data_folder):
    print("data folder: %s" % data_folder)

iso_folder = Helper.iso19139_folder()
if os.path.exists(iso_folder):
    print("iso folder: %s" % iso_folder)

iso_folder = Helper.iso19757_3_folder()
if os.path.exists(iso_folder):
    print("iso folder: %s" % iso_folder)

Beispiel #7
0
ch.setLevel(
    logging.DEBUG
)  # change to WARNING to reduce verbosity, DEBUG for high verbosity
ch_formatter = logging.Formatter(
    '%(levelname)-9s %(name)s.%(funcName)s:%(lineno)d > %(message)s')
ch.setFormatter(ch_formatter)
logger.addHandler(ch)

# Example that use bag.base to:
# - test for being a BAG file
# - open and read some metadata info from a BAG file

from hyo.bag.base import is_bag, File
from hyo.bag.helper import Helper

file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_00.bag")
if os.path.exists(file_bag_0):
    logger.info("- file_bag_0: %s is BAG? %r" %
                (file_bag_0, is_bag(file_bag_0)))

file_bag_1 = os.path.join(Helper.samples_folder(), "bdb_01.bag")
if os.path.exists(file_bag_1):
    logger.info("- file_bag_1: %s is BAG? %r" %
                (file_bag_1, is_bag(file_bag_1)))

file_fake_0 = os.path.join(Helper.samples_folder(), "fake_00.bag")
if os.path.exists(file_fake_0):
    logger.info("- file_fake_0: %s is BAG? %r" %
                (file_fake_0, is_bag(file_fake_0)))

bag_0 = File(file_bag_0)
import os
import logging

logger = logging.getLogger()
logger.setLevel(logging.NOTSET)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)  # change to WARNING to reduce verbosity, DEBUG for high verbosity
ch_formatter = logging.Formatter('%(levelname)-9s %(name)s.%(funcName)s:%(lineno)d > %(message)s')
ch.setFormatter(ch_formatter)
logger.addHandler(ch)

from hyo.bag import BAGFile
from hyo.bag import BAGError
from hyo.bag.helper import Helper

file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_01.bag")
# file_bag_0 = "D:\\test_data\\radar_bag\\Sample_Beaufort_2\\Sample_Beaufort_2.bag"
if os.path.exists(file_bag_0):
    print("- file_bag_0: %s" % file_bag_0)

bag_0 = BAGFile(file_bag_0)
print(bag_0)

output_xml = "fixed_metadata.xml"
if not os.path.exists(output_xml):
    raise RuntimeError("unable to find metadata file: %s" % output_xml)
bag_0.substitute_metadata(output_xml)
os.remove(output_xml)
 def test_bag_samples_folder(self):
     assert os.path.exists(Helper.samples_folder())
 def setUp(self):
     self.file_bag_0 = os.path.join(Helper.samples_folder(), "bdb_01.bag")
     self.file_bag_1 = os.path.join(Helper.samples_folder(), "bdb_02.bag")
     self.file_fake_0 = os.path.join(Helper.samples_folder(), "fake_00.bag")