Skip to content

Commit

Permalink
BUG: fix inconsistencies is XYZ dataframes that trigger errors in cer…
Browse files Browse the repository at this point in the history
…tain cases.
  • Loading branch information
jcrivenaes committed Nov 14, 2024
1 parent 7173f59 commit 48b5791
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/xtgeo/xyz/_xyz_oper.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def get_fence(
# duplicates may still exist; skip those
df.drop_duplicates(subset=[fence.xname, fence.yname], keep="first", inplace=True)
df.reset_index(inplace=True, drop=True)
fence.set_dataframe(df)

if name:
fence.name = name
Expand All @@ -415,7 +416,6 @@ def get_fence(
)
return np.reshape(rval, (fence.nrow, 5), order="F")

fence.set_dataframe(df)
return fence


Expand Down Expand Up @@ -578,6 +578,7 @@ def extend(self, distance, nsamples, addhlen=True):
rown[self.yname] = newy

df_to_add = rown.to_frame().T
df_to_add = df_to_add.astype(dataframe.dtypes.to_dict()) # ensure same dtypes

dataframe = pd.concat([df_to_add, dataframe]).reset_index(drop=True)

Expand All @@ -603,7 +604,7 @@ def extend(self, distance, nsamples, addhlen=True):
rown[self.yname] = newy

df_to_add = rown.to_frame().T

df_to_add = df_to_add.astype(dataframe.dtypes.to_dict()) # ensure same dtypes
dataframe = pd.concat([dataframe, df_to_add]).reset_index(drop=True)

self.set_dataframe(dataframe)
Expand Down

0 comments on commit 48b5791

Please sign in to comment.