Commit 309a9ab9 authored by Gavin's avatar Gavin Committed by acpaquette
Browse files

fixed logging calls to use correct levels

parent 2e222fed
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ from autocnet.cg import cg
from shapely.ops import cascaded_union, polygonize

# set up the logger file
log = loggin.getLogger(__name__)
log = logging.getLogger(__name__)

def two_point_extrapolate(x, xs, ys):
    """
+1 −1
Original line number Diff line number Diff line
@@ -1854,7 +1854,7 @@ class NetworkCandidateGraph(CandidateGraph):
        try:
            processing_queue = getattr(self, redis_queue)
        except AttributeError:
            log.warning(f'Unable to find attribute {redis_queue} on this object. Valid queue names are: "processing_queue" and "working_queue".')
            log.exception(f'Unable to find attribute {redis_queue} on this object. Valid queue names are: "processing_queue" and "working_queue".')

        env = self.config['env']
        condaenv = env['conda']
+5 −5
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ def propagate_ground_point(point,
                    preprocess=preprocess,
                    verbose=verbose)
        except Exception as e:
            log.warning(e)
            log.exception(e)
            continue
        
        if x is None:
@@ -86,7 +86,7 @@ def propagate_ground_point(point,
            log.info(f'Found a match with correlation: {metrics}, shift distance: {dist}, and cost {current_cost} ', )
    
    if best_match is None:
        log.info('Unable to propagate this ground point into any images.')
        log.warning('Unable to propagate this ground point into any images.')
        return
    
    dem = ncg.dem
@@ -142,7 +142,7 @@ def propagate_ground_point(point,
                sample, line = isis.ground_to_image(image["path"], lon_oc, lat_oc)
            except ValueError as e:
                if 'Requested position does not project in camera model' in e.stderr:
                    log.info(f'interesting point ({lon_oc},{lat_oc}) does not project to image {images["image_path"]}')
                    log.exception(f'interesting point ({lon_oc},{lat_oc}) does not project to image {images["image_path"]}')
                    continue

        if image['id'] == best_match[7]:
@@ -293,7 +293,7 @@ def find_ground_reference(point,
                                            verbose=verbose,
                                            **geom_kwargs)
        if x == None:
            log.info(f'Unable to match image {node["image_name"]} to {baseimage}.')
            log.warning(f'Unable to match image {node["image_name"]} to {baseimage}.')
            continue

        current_cost = cost_func(dist, metrics)
@@ -306,7 +306,7 @@ def find_ground_reference(point,
        else:
            log.info(f'Cost function not met. Unable to use {node["image_name"]} as reference')
    if sample == None:
        log.info('Unable to register this point to a ground source.')
        log.warning('Unable to register this point to a ground source.')
        return

    # A reference measure has been identified. This measure matched successfully to the ground.
+8 −8
Original line number Diff line number Diff line
@@ -1097,7 +1097,7 @@ def geom_match_classic(base_cube,
            )
        except CalledProcessError as e:
            if 'Requested position does not project in camera model' in e.stderr:
                log.info(f'Skip geom_match; Region of interest corner located at ({lon}, {lat}) does not project to image {input_cube.base_name}')
                log.exception(f'Skip geom_match; Region of interest corner located at ({lon}, {lat}) does not project to image {input_cube.base_name}')
                return None, None, None, None, None

    base_gcps = np.array([*base_corners])
@@ -1273,8 +1273,8 @@ def geom_match(destination_cube,
        center_x, center_y = spatial.isis.ground_to_image(source_cube.file_name, mlon, mlat)
    except CalledProcessError as e:
            if 'Requested position does not project in camera model' in e.stderr:
                log.info(f'Skip geom_match; Region of interest center located at ({mlon}, {mlat}) does not project to image {source_cube.base_name}')
                log.info('This should only appear when propagating ground points')
                log.exception(f'Skip geom_match; Region of interest center located at ({mlon}, {mlat}) does not project to image {source_cube.base_name}')
                log.exception('This should only appear when propagating ground points')
                return None, None, None, None, None

    # Compute the mapping between the destination corners and the source_cube corners in
@@ -1288,7 +1288,7 @@ def geom_match(destination_cube,
            )
        except CalledProcessError as e:
            if 'Requested position does not project in camera model' in e.stderr:
                log.info(f'Skip geom_match; Region of interest corner located at ({lon}, {lat}) does not project to image {source_cube.base_name}')
                log.exception(f'Skip geom_match; Region of interest corner located at ({lon}, {lat}) does not project to image {source_cube.base_name}')
                return None, None, None, None, None


@@ -1393,7 +1393,7 @@ def subpixel_register_measure(measureid,
                                                            match_func=match_func,
                                                            template_kwargs=subpixel_template_kwargs)
        except Exception as e:
            log.warning(f'geom_match failed on measure {measureid} with exception -> {e}')
            log.exception(f'geom_match failed on measure {measureid} with exception -> {e}')
            destination.ignore = True # geom_match failed
            currentlog['status'] = f"Failed to register measure {measureid}"
            resultlog.append(currentlog)
@@ -2046,7 +2046,7 @@ def estimate_affine_transformation(base_cube,
    passing_base_corners = []
    for x,y in base_corners:
        try:
            log.info('Processing: ', x,y)
            log.exception('Processing: ', x,y)
            lon, lat = spatial.isis.image_to_ground(base_cube.file_name, x, y)
            dst_corners.append(
                spatial.isis.ground_to_image(input_cube.file_name, lon, lat)
@@ -2232,7 +2232,7 @@ def subpixel_register_point_smart(pointid,
                                                        source.apriorisample, 
                                                        source.aprioriline)
        except Exception as e:
            log.warning(e) 
            log.exception(e) 
            m = {'id': measure.id,
                 'sample':measure.apriorisample,
                 'line':measure.aprioriline,
@@ -2539,7 +2539,7 @@ def validate_candidate_measure(measure_to_register,
        try:
            affine = estimate_affine_transformation(source_node.geodata, destination_node.geodata, sample, line)
        except:
            log.warning('Unable to transform image to reference space. Likely too close to the edge of the non-reference image. Setting ignore=True')
            log.exception('Unable to transform image to reference space. Likely too close to the edge of the non-reference image. Setting ignore=True')
            return [np.inf] * len(parameters)
        base_arr, dst_arr = affine_warp_image(source_node.geodata, 
                                                  destination_node.geodata, 
+9 −9
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ def place_points_in_overlap(overlap,
                    sample, line = isis.ground_to_image(node["image_path"], lon, lat)
                except CalledProcessError as e:
                    if 'Requested position does not project in camera model' in e.stderr:
                        log.warning(f'point ({lon}, {lat}) does not project to reference image {node["image_path"]}')
                        log.exception(f'point ({lon}, {lat}) does not project to reference image {node["image_path"]}')
                        continue
            if cam_type == "csm":
                lon_og, lat_og = oc2og(lon, lat, semi_major, semi_minor)
@@ -227,8 +227,8 @@ def place_points_in_overlap(overlap,
                p = isis.point_info(node["image_path"], newsample, newline, point_type="image")
            except CalledProcessError as e:
                if 'Requested position does not project in camera model' in e.stderr:
                    log.warning(node["image_path"])
                    log.warning(f'interesting point ({newsample}, {newline}) does not project back to ground')
                    log.exception(node["image_path"])
                    log.exception(f'interesting point ({newsample}, {newline}) does not project back to ground')
                    continue
            try:
                x, y, z = p["BodyFixedCoordinate"].value
@@ -292,7 +292,7 @@ def place_points_in_overlap(overlap,
                    sample, line = isis.ground_to_image(node["image_path"], updated_lon, updated_lat)
                #except CalledProcessError as e:
                except:  # CalledProcessError is not catching the ValueError that this try/except is attempting to handle.
                    log.warning(f'interesting point ({updated_lon},{updated_lat}) does not project to image {node["image_path"]}')
                    log.exception(f'interesting point ({updated_lon},{updated_lat}) does not project to image {node["image_path"]}')
                    # If the current_index is greater than the reference_index, the change in list size does
                    # not impact the positional index of the reference. If current_index is less than the
                    # reference_index, then the reference_index needs to de-increment by one for each time
@@ -424,7 +424,7 @@ def place_points_in_image(image,
                sample, line = isis.ground_to_image(node["image_path"], lon, lat)
            except CalledProcessError as e:
                if 'Requested position does not project in camera model' in e.stderr:
                    log.warning(f'point ({lon}, {lat}) does not project to reference image {node["image_path"]}')
                    log.exception(f'point ({lon}, {lat}) does not project to reference image {node["image_path"]}')
                    continue
        if cam_type == "csm":
            lon_og, lat_og = oc2og(lon, lat, semi_major, semi_minor)
@@ -457,8 +457,8 @@ def place_points_in_image(image,
                p = isis.point_info(node["image_path"], newsample, newline, point_type="image")
            except CalledProcessError as e:
                if 'Requested position does not project in camera model' in e.stderr:
                    log.warning(node["image_path"])
                    log.warning(f'interesting point ({newsample}, {newline}) does not project back to ground')
                    log.exception(node["image_path"])
                    log.exception(f'interesting point ({newsample}, {newline}) does not project back to ground')
                    continue
            try:
                x, y, z = p["BodyFixedCoordinate"].value
@@ -521,7 +521,7 @@ def place_points_in_image(image,
                    sample, line = isis.ground_to_image(node["image_path"], updated_lon, updated_lat)
                except CalledProcessError as e:
                    if 'Requested position does not project in camera model' in e.stderr:
                        log.warning(f'interesting point ({lon},{lat}) does not project to image {node["image_path"]}')
                        log.exception(f'interesting point ({lon},{lat}) does not project to image {node["image_path"]}')
                        insert = False

            point.measures.append(Measures(sample=sample,
@@ -566,7 +566,7 @@ def add_measures_to_point(pointid, cam_type='isis', ncg=None, Session=None):
                    sample, line = isis.ground_to_image(image.path, point_lon, point_lat)
                except CalledProcessError as e:
                    if 'Requested position does not project in camera model' in e.stderr:
                        log.warning(f'interesting point ({point_lon},{point_lat}) does not project to image {image.name}')
                        log.exception(f'interesting point ({point_lon},{point_lat}) does not project to image {image.name}')

            point.measures.append(Measures(sample=sample,
                                           line=line,
Loading