modify_order_features
函数是gempy.core.model.ImplicitCoKriging
类中的一个方法。该函数实现了通过对预测网格的顺序特征进行修改来改进预测结果的功能。该函数是修改函数序列特征的主要接口。
grid
: gempy.core.grid.Grid
类型,预测网格对象。grads
: numpy.ndarray
类型,在当前位置处计算出的梯度值。values
: numpy.ndarray
类型,当前位置处的模型值。residuals
: numpy.ndarray
类型,模型残差。返回值为修改后的特征函数序列,也是numpy.ndarray
类型。
gempy.core.model.ImplicitCoKriging
中创建对象。model = ImplicitCoKriging()
set_parameters
方法设置模型参数。model.set_parameters(nn=3, output='continuous', drift_terms=1, c_kwargs={"n_categories":10})
resolution = 50
extent = np.array([[-3_000, 3_000], [-3_000, 3_000], [-3_000, 3_000]])
grid = Grid(extent=extent, resolution=resolution)
modify_order_features
方法修改预测网格的顺序特征。grads = model.compute_model_gradient_at(grid)
mod_vals, _ = model.block_forward_pass(grid)
residuals = model.residuals(grid, mod_vals)
.modified_features = modify_order_features(
grid=grid,
grads=grads,
values=mod_vals,
residuals=residuals
)
以下代码演示了如何使用modify_order_features
函数修改预测网格的顺序特征。
import gempy as gp
# Create model object
model = gp.create_model('test')
# Add surfaces
gp.add_surfaces(
model,
['rock1', 'rock2', 'rock3', 'rock4'],
colors=['red', 'green', 'blue', 'yellow'],
)
# Add series
gp.add_series(
model,
['fault', 'sediments'],
order_series=['fault', 'sediments'],
add_to_model=True
)
# Add fault
gp.add_faults(model, ['fault1'], series_name='fault', fault_boundaries=[-200, 0], fault_dip=45)
# Add interfaces
gp.set_interpolator(model, theano_optimizer='fast_compile', verbose=['bla'])
gp.set_c_o_type(model)
gp.add_data(model, -1000, 1000, 0, grade=[0], series='fault')
gp.add_data(model, 0, 0, 0, grade=[1], series='sediments')
gp.add_data(model, -500, 500, -2000, grade=[1], series='sediments')
gp.add_data(model, -500, 500, -1000, grade=[2], series='sediments')
gp.add_data(model, -1000, 1000, -1500, grade=[3], series='sediments')
model.surfaces.df['order_surface'] = [-2, -1, 1, 2]
gp.map_series_to_surfaces(model)
gp.set_frequencies(model)
# Define grid and compute model
resolution = 50
extent = np.array([[-3_000, 3_000], [-3_000, 3_000], [-3_000, 3_000]])
grid = gp.Grid(extent=extent, resolution=resolution)
model.set_parameters(nn=3, output='continuous', drift_terms=1, c_kwargs={"n_categories":10})
grads = model.compute_model_gradient_at(grid)
mod_vals, _ = model.block_forward_pass(grid)
residuals = model.residuals(grid, mod_vals)
.modified_features = gp.modify_order_features(
grid=grid,
grads=grads,
values=mod_vals,
residuals=residuals
)
# Plot results
gp.plot_3d(model)