From 90e7b5c3d66aeee00bc135ee2af718e09a382222 Mon Sep 17 00:00:00 2001 From: Stephen Mather Date: Fri, 16 Aug 2024 11:21:02 -0400 Subject: [PATCH] swap NaNs --- opendm/gcp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opendm/gcp.py b/opendm/gcp.py index 31f193166..61f19425f 100644 --- a/opendm/gcp.py +++ b/opendm/gcp.py @@ -1,5 +1,6 @@ import glob import os +import numpy as np from opendm import log from opendm import location from pyproj import CRS @@ -19,6 +20,7 @@ def read(self): # Strip eventual BOM characters contents = contents.replace('\ufeff', '') + contents = contents.replace('NaN', '0') lines = list(map(str.strip, contents.split('\n'))) if lines: @@ -71,6 +73,7 @@ def parse_entry(self, entry): parts = entry.split() x, y, z, px, py, filename = parts[:6] extras = " ".join(parts[6:]) + return GCPEntry(float(x), float(y), float(z), float(px), float(py), filename, extras) def get_entry(self, n): @@ -241,4 +244,4 @@ def __str__(self): return "{} {} {} {} {} {} {}".format(self.x, self.y, self.z, self.px, self.py, self.filename, - self.extras).rstrip() \ No newline at end of file + self.extras).rstrip()