save
方法用于将拓扑地形数据保存到指定文件中。
def save(self, file_path: str, **kwargs):
file_path
:保存文件的路径,必须是一个字符串。**kwargs
:可选参数,用于传递其他参数,如文件格式等。import gempy as gp
# 创建地质模型对象
model = gp.create_model('my_model')
# 配置数据和模型参数
gp.init_data(model, extent=[0, 1000, 0, 1000, 0, 1000], resolution=[20, 20, 20])
gp.set_interpolator(model, theano_optimizer='fast_compile')
gp.set_trend(model, order=1, cover=1)
gp.set_surfaces(model, ['surface_1', 'surface_2', 'surface_3', 'surface_4'])
gp.set_is_fault(model, [False, False, True, False])
gp.map_stack_to_surfaces(model, {'series': ['surface_1', 'surface_2'], 'fault': 'surface_3', 'unconformity': 'surface_4'})
gp.set_bottom_relation(model, {'bottom': 'surface_1', 'relation': 'Onlap'})
gp.set_section_grid(model, resolution=[20, 20])
# 计算拓扑地形数据
gp.compute_model(model)
# 保存拓扑地形数据
model.surfaces.to_topography().save('topography.txt', format='csv')
FileNotFoundError
:如果指定的文件路径不存在或无法创建,则会引发此异常。TypeError
:如果指定的文件格式不支持或参数无效,则会引发此异常。