Skip to content

Commit c004d9f

Browse files
committed
fix: fault orientation init as empty df rather than nan
1 parent 4211b9e commit c004d9f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

LoopStructural/modelling/input/process_data.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(
7878
self.contacts = contacts
7979
self._contact_orientations = None
8080
self.contact_orientations = contact_orientations
81-
self._fault_orientations = None
81+
self._fault_orientations = pd.DataFrame(columns=["X", "Y", "Z", "gx", "gy", "gz", "coord", "feature_name"])
8282
self.fault_orientations = fault_orientations
8383
self._fault_locations = None
8484
self.fault_locations = fault_locations
@@ -313,10 +313,11 @@ def fault_properties(self, fault_properties):
313313
pts = self.fault_orientations.loc[
314314
self.fault_orientations["feature_name"] == fname, ["gx", "gy", "gz"]
315315
]
316-
fault_properties.loc[
317-
fname,
318-
["avgNormalEasting", "avgNormalNorthing", "avgNormalAltitude"],
319-
] = np.nanmean(pts, axis=0)
316+
if len(pts)>0:
317+
fault_properties.loc[
318+
fname,
319+
["avgNormalEasting", "avgNormalNorthing", "avgNormalAltitude"],
320+
] = np.nanmean(pts, axis=0)
320321
if (
321322
"avgSlipDirEasting" not in fault_properties.columns
322323
or "avgSlipDirNorthing" not in fault_properties.columns
@@ -399,7 +400,7 @@ def data(self):
399400
dataframes.append(self.contacts)
400401
if self.contact_orientations is not None:
401402
dataframes.append(self.contact_orientations)
402-
if self.fault_orientations is not None:
403+
if len(self.fault_orientations) > 0:
403404
dataframes.append(self.fault_orientations)
404405
if self.fault_locations is not None:
405406
dataframes.append(self.fault_locations)

0 commit comments

Comments
 (0)