Skip to content

Commit

Permalink
fix geodiff to always return floats in dict
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewAnnex committed Feb 8, 2023
1 parent 9757e0b commit e81da4b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/asap_stereo/asap.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,14 @@ def get_geo_diff(self, ref_dem, src_dem=None):
'StdDev of difference': stats['stdDev'],
'Median difference': stats["mean"], # yes I know this isn't correct but gdal doens't compute this for us
}
for k, v in res.items():
try:
res[k] = float(v)
except ValueError:
try:
res[k] = float(''.join(re.findall(r'-?\d+\.?\d+', v))) # this won't grab all floats like Nans or si notation
except ValueError:
res[k] = 0.0
return res

def estimate_max_disparity(self, ref_dem, src_dem=None):
Expand Down

0 comments on commit e81da4b

Please sign in to comment.