Skip to content
Snippets Groups Projects
Unverified Commit ddcca3ce authored by gsn9's avatar gsn9 Committed by GitHub
Browse files

Merge pull request #621 from gsn9/loggingForSpatial

converted spatial module to use logging
parents 43c29389 5b48e70c
No related branches found
No related tags found
No related merge requests found
import time
import warnings
import logging
import json
from subprocess import CalledProcessError
......@@ -42,6 +42,9 @@ INSERT INTO overlay(intersections, geom) SELECT row.intersections, row.geom FROM
FROM iid GROUP BY iid.geom) AS row WHERE array_length(intersections, 1) > 1;
"""
# set up the logger file
log = logging.getLogger(__name__)
def place_points_in_overlaps(size_threshold=0.0007,
distribute_points_kwargs={},
cam_type='csm',
......@@ -164,7 +167,7 @@ def place_points_in_overlap(overlap,
geom = overlap.geom
valid = compgeom.distribute_points_in_geom(geom, **distribute_points_kwargs, **kwargs)
if not valid.any():
warnings.warn('Failed to distribute points in overlap')
log.warning('Failed to distribute points in overlap')
return []
print(f'Have {len(valid)} potential points to place.')
......@@ -211,7 +214,7 @@ def place_points_in_overlap(overlap,
# Extract ORB features in a sub-image around the desired point
image_roi = roi.Roi(node.geodata, sample, line, size_x=size, size_y=size)
if image_roi.variance == 0:
warnings.warn(f'Failed to find interesting features in image {node.image_name}.')
log.warning(f'Failed to find interesting features in image {node.image_name}.')
continue
image = image_roi.clip()
......@@ -222,7 +225,7 @@ def place_points_in_overlap(overlap,
break
if interesting is None:
warnings.warn('Unable to find an interesting point, falling back to the a priori pointing')
log.warning('Unable to find an interesting point, falling back to the a priori pointing')
newsample = sample
newline = line
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment