gempy.core.model.Project
的rename_features
方法用来更改地质模型中所有的特征名称,包括surface,series和faults。
Project.rename_features(rename_dict: dict)
rename_dict: dict
:包含原特征名称和新特征名称的字典。import gempy as gp
# 创建一个具有两个surface的Project
geo_model = gp.create_model('Test_rename_features')
gp.init_data(geo_model, [0, 10, 0, 10, 0, 10], [2, 2, 2], path_i='Test_rename_features_path_i.csv', path_o='Test_rename_features_path_o.csv')
gp.map_stack_to_surfaces(geo_model, {'Fault': 'Fault', 'Layer2': 'Layer2'})
gp.set_is_fault(geo_model, 'Fault')
gp.set_is_finite(geo_model)
# 输出原始的Surface信息
print('Original surfaces:')
print(geo_model._surfaces.df.head())
# 重命名'Fault'和'Layer2'这两个Surface
geo_model.rename_features({'Fault': 'NewFault', 'Layer2': 'NewLayer2'})
# 输出修改后的Surface信息
print('Renamed surfaces:')
print(geo_model._surfaces.df.head())
运行以上示例代码,会得到以下输出:
Original surfaces:
surface series order_surfaces color id
0 Fault Default series 1 #015482 1
1 Layer2 Default series 2 #9f0052 2
Renamed surfaces:
surface series order_surfaces color id
0 NewFault Default series 1 #015482 1
1 NewLayer2 Default series 2 #9f0052 2