PIPESIM 中的井轨迹(Trajectory)、管线几何(Geometry)和地温剖面(Geothermal Profile)等属于表格型数据。PTK 使用 pandas DataFrame 作为这类数据的载体,使得数据读取、处理和回写变得异常便捷。
读取管线几何数据
# 通过上下文路径
df = model.get_geometry(context="F_10")
# 或通过名称
df = model.get_geometry(Name="F_10")返回的 DataFrame 包含测量深度(MD)、高程(Elevation)、X/Y 坐标等列。文章源自云智设计-https://www.cidrg.com/cid-college/tutorial/26912.html
读取井轨迹
traj = model.get_trajectory(Name="GI_Well")
# DataFrame 列: MD, TVD, Inclination, Azimuth, X-offset, Y-offset读取地温剖面
geo = model.get_geothermal_profile(Name="F_10")设置数据表
将修改后的 DataFrame 写回模型:文章源自云智设计-https://www.cidrg.com/cid-college/tutorial/26912.html
model.set_geometry(context="F_20", dataframe=df)关键要求:写回的 DataFrame 必须与 get_geometry() 的列名一致,且索引从 0 开始。文章源自云智设计-https://www.cidrg.com/cid-college/tutorial/26912.html
读取 P-Q 曲线(Source/Sink)
pq = model.get_pq_curve(Source="SRC1")
# DataFrame: Pressure, FlowRate实战应用
典型的自动化场景:从 Excel 或 CSV 文件中读取测量数据,转换为 DataFrame 后批量写入管线几何。然后用 get_geometry() 验证写入结果。文章源自云智设计-https://www.cidrg.com/cid-college/tutorial/26912.html
import pandas as pd
# 从 CSV 读取管线坐标
csv_data = pd.read_csv('pipeline_data.csv')
# 写入模型
model.set_geometry(context="FL_NEW", dataframe=csv_data)
# 验证
verify = model.get_geometry(context="FL_NEW")
print(verify.head())这种方式特别适合处理来自 GIS 系统、测量队的管线数据导入。文章源自云智设计-https://www.cidrg.com/cid-college/tutorial/26912.html 文章源自云智设计-https://www.cidrg.com/cid-college/tutorial/26912.html






