Skip to content
Snippets Groups Projects
Commit 3c276a43 authored by Lauren Adoram-Kershner's avatar Lauren Adoram-Kershner Committed by GitHub
Browse files

Merge pull request #132 from jessemapel/unmangle

Added name un-mangling when writing ISIS controlentworks out
parents 85945b3c bec15857
No related branches found
No related tags found
No related merge requests found
...@@ -260,16 +260,18 @@ class IsisStore(object): ...@@ -260,16 +260,18 @@ class IsisStore(object):
point_spec.id = _set_pid(i) point_spec.id = _set_pid(i)
point_spec.type = g.iloc[0].pointType point_spec.type = g.iloc[0].pointType
for attr, attrtype in self.point_attrs: for attr, attrtype in self.point_attrs:
if attr in g.columns: # Un-mangle common attribute names between points and measures
df_attr = self.point_field_map.get(attr, attr)
if df_attr in g.columns:
# As per protobuf docs for assigning to a repeated field. # As per protobuf docs for assigning to a repeated field.
if attr == 'aprioriCovar' or attr == 'adjustedCovar': if df_attr == 'aprioriCovar' or df_attr == 'adjustedCovar':
arr = g.iloc[0][attr] arr = g.iloc[0][df_attr]
if isinstance(arr, np.ndarray): if isinstance(arr, np.ndarray):
arr = arr.ravel().tolist() arr = arr.ravel().tolist()
point_spec.aprioriCovar.extend(arr) point_spec.aprioriCovar.extend(arr)
else: else:
setattr(point_spec, attr, attrtype(g.iloc[0][attr])) setattr(point_spec, attr, attrtype(g.iloc[0][df_attr]))
# The reference index should always be the image with the lowest index # The reference index should always be the image with the lowest index
point_spec.referenceIndex = 0 point_spec.referenceIndex = 0
...@@ -279,13 +281,13 @@ class IsisStore(object): ...@@ -279,13 +281,13 @@ class IsisStore(object):
measure_spec = point_spec.Measure() measure_spec = point_spec.Measure()
# For all of the attributes, set if they are an dict accessible attr of the obj. # For all of the attributes, set if they are an dict accessible attr of the obj.
for attr, attrtype in self.measure_attrs: for attr, attrtype in self.measure_attrs:
if attr in g.columns: # Un-mangle common attribute names between points and measures
setattr(measure_spec, attr, attrtype(m[attr])) df_attr = self.measure_field_map.get(attr, attr)
measure_spec.serialnumber = m.serialnumber if df_attr in g.columns:
setattr(measure_spec, attr, attrtype(m[df_attr]))
# ISIS pixels are centered on (0.5, 0.5). NDArrays are (0,0) based. # ISIS pixels are centered on (0.5, 0.5). NDArrays are (0,0) based.
measure_spec.sample = m['sample'] + 0.5 measure_spec.sample = m['sample'] + 0.5
measure_spec.line = m['line'] + 0.5 measure_spec.line = m['line'] + 0.5
measure_spec.type = m.measureType
measure_iterable.append(measure_spec) measure_iterable.append(measure_spec)
self.nmeasures += 1 self.nmeasures += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment