set_orientations_object是gempy.core.model.ImplicitCoKriging中的一个方法,用于将倾向方向信息添加到模型中。
set_orientations_object(self, orientations_df: pandas.DataFrame, indices: Union[str, List[str], None] = None, polarity_column: str = None, **kwargs) -> None
orientations_df:包含倾向方向信息的数据帧,必须包含以下列:X,Y,Z,dip和azimuth列。例如:
X           Y           Z           dip   azimuth
10.024662   10.109165   -0.000078   0.0   0.0
10.356562   10.067508   -0.000078   0.0   0.0
10.688466   10.025850   -0.000078   0.0   0.0
11.020365   9.984192    -0.000078   0.0   0.0
indices:选定需要设置倾向方向信息的点的索引,可以是单个索引或索引列表。如果为None,则默认为所有点。
polarity_column:包含倾向方向极性信息的列名。如果未提供,则默认为None。
其他参数:可选参数和默认值如下:
range_min = -np.inf
range_max = np.inf
inplace = True
verbose = True
ignore_inactive = False
该函数不返回任何值。
ValueError:如果orientations_df缺少必需列,则会引发此异常。
IndexError:如果indices包含一个无效的索引,则会引发此异常。
KeyError:如果polarity_column无效,则会引发此异常。
import pandas as pd 
import gempy as gp 
# 创建数据帧
orientations = pd.DataFrame({'X': [10.024662, 10.356562, 10.688466, 11.020365],
                              'Y': [10.109165, 10.067508, 10.025850, 9.984192],
                              'Z': [-0.000078, -0.000078, -0.000078, -0.000078],
                              'dip': [0, 0, 0, 0],
                              'azimuth': [0, 0, 0, 0]})
# 创建Gempy模型
model = gp.create_model('test')
# 添加点
gp.init_data(model, [0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 1, 0], [1, 1, 2, 2], [0, 0, 1, 1], [1, 1, 0, 0], 
              surface_points_df=pd.DataFrame({'X': [0, 1, 1, 0], 'Y': [0, 0, 1, 1], 'Z': [0, 1, 1, 0]}))
# 添加倾向方向信息
gp.set_orientations_object(model, orientations)
# 运行模型
gp.compute_model(model)