Skip to content

Commit

Permalink
fix renaming issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mjfield2 committed Apr 24, 2024
1 parent 4d7209f commit 0c72130
Showing 1 changed file with 69 additions and 5 deletions.
74 changes: 69 additions & 5 deletions gstatsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,14 @@ def skrige(prediction_grid, df, xx, yy, zz, num_points, vario, radius, quiet=Fal
azimuth = vario[0]
major_range = vario[2]
minor_range = vario[3]
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)

if 'X' in df.columns and xx != 'X':
df = df.drop(columns=['X'])
if 'Y' in df.columns and yy != 'Y':
df = df.drop(columns=['Y'])
if 'Z' in df.columns and zz != 'Z':
df = df.drop(columns=['Z'])

df = df.rename(columns = {xx: "X", yy: "Y", zz: "Z"})
mean_1 = df['Z'].mean()
Expand Down Expand Up @@ -798,7 +805,14 @@ def okrige(prediction_grid, df, xx, yy, zz, num_points, vario, radius, quiet=Fal
azimuth = vario[0]
major_range = vario[2]
minor_range = vario[3]
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)

if 'X' in df.columns and xx != 'X':
df = df.drop(columns=['X'])
if 'Y' in df.columns and yy != 'Y':
df = df.drop(columns=['Y'])
if 'Z' in df.columns and zz != 'Z':
df = df.drop(columns=['Z'])

df = df.rename(columns = {xx: "X", yy: "Y", zz: "Z"})
var_1 = vario[4]
Expand Down Expand Up @@ -881,7 +895,14 @@ def skrige_sgs(prediction_grid, df, xx, yy, zz, num_points, vario, radius, quiet
azimuth = vario[0]
major_range = vario[2]
minor_range = vario[3]
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)

if 'X' in df.columns and xx != 'X':
df = df.drop(columns=['X'])
if 'Y' in df.columns and yy != 'Y':
df = df.drop(columns=['Y'])
if 'Z' in df.columns and zz != 'Z':
df = df.drop(columns=['Z'])

df = df.rename(columns = {xx: 'X', yy: 'Y', zz: 'Z'})
xyindex = np.arange(len(prediction_grid))
Expand Down Expand Up @@ -964,7 +985,14 @@ def okrige_sgs(prediction_grid, df, xx, yy, zz, num_points, vario, radius, quiet
azimuth = vario[0]
major_range = vario[2]
minor_range = vario[3]
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)

if 'X' in df.columns and xx != 'X':
df = df.drop(columns=['X'])
if 'Y' in df.columns and yy != 'Y':
df = df.drop(columns=['Y'])
if 'Z' in df.columns and zz != 'Z':
df = df.drop(columns=['Z'])

df = df.rename(columns = {xx: "X", yy: "Y", zz: "Z"})
xyindex = np.arange(len(prediction_grid))
Expand Down Expand Up @@ -1053,6 +1081,13 @@ def cluster_sgs(prediction_grid, df, xx, yy, zz, kk, num_points, df_gamma, radiu
simulated value for each coordinate in prediction_grid
"""

if 'X' in df.columns and xx != 'X':
df = df.drop(columns=['X'])
if 'Y' in df.columns and yy != 'Y':
df = df.drop(columns=['Y'])
if 'Z' in df.columns and zz != 'Z':
df = df.drop(columns=['Z'])

df = df.rename(columns = {xx: "X", yy: "Y", zz: "Z", kk: "K"})
xyindex = np.arange(len(prediction_grid))
random.shuffle(xyindex)
Expand Down Expand Up @@ -1159,7 +1194,21 @@ def cokrige_mm1(prediction_grid, df1, xx1, yy1, zz1, df2, xx2, yy2, zz2, num_poi
azimuth = vario[0]
major_range = vario[2]
minor_range = vario[3]
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)

if 'X' in df1.columns and xx1 != 'X':
df1 = df1.drop(columns=['X'])
if 'Y' in df1.columns and yy1 != 'Y':
df1 = df1.drop(columns=['Y'])
if 'Z' in df1.columns and zz1 != 'Z':
df1 = df1.drop(columns=['Z'])

if 'X' in df2.columns and xx2 != 'X':
df2 = df2.drop(columns=['X'])
if 'Y' in df2.columns and yy2 != 'Y':
df2 = df2.drop(columns=['Y'])
if 'Z' in df2.columns and zz2 != 'Z':
df2 = df2.drop(columns=['Z'])

df1 = df1.rename(columns = {xx1: "X", yy1: "Y", zz1: "Z"})
df2 = df2.rename(columns = {xx2: "X", yy2: "Y", zz2: "Z"})
Expand Down Expand Up @@ -1272,6 +1321,21 @@ def cosim_mm1(prediction_grid, df1, xx1, yy1, zz1, df2, xx2, yy2, zz2, num_point
major_range = vario[2]
minor_range = vario[3]
rotation_matrix = make_rotation_matrix(azimuth, major_range, minor_range)

if 'X' in df1.columns and xx1 != 'X':
df1 = df1.drop(columns=['X'])
if 'Y' in df1.columns and yy1 != 'Y':
df1 = df1.drop(columns=['Y'])
if 'Z' in df1.columns and zz1 != 'Z':
df1 = df1.drop(columns=['Z'])

if 'X' in df2.columns and xx2 != 'X':
df2 = df2.drop(columns=['X'])
if 'Y' in df2.columns and yy2 != 'Y':
df2 = df2.drop(columns=['Y'])
if 'Z' in df2.columns and zz2 != 'Z':
df2 = df2.drop(columns=['Z'])

df1 = df1.rename(columns = {xx1: "X", yy1: "Y", zz1: "Z"})
df2 = df2.rename(columns = {xx2: "X", yy2: "Y", zz2: "Z"})
xyindex = np.arange(len(prediction_grid))
Expand Down

0 comments on commit 0c72130

Please sign in to comment.