generate_well_structure
Generates well structure diagrams and detailed reports from well data. Accepts JSON input to create visualizations for straight, deviated, and horizontal wells.
Instructions
生成井身结构示意图及相关报告。
基于提供的井数据(JSON格式),调用井身结构生成器生成井身结构示意图(PNG)、 井身结构信息图(PNG)和详细的Markdown格式报告。支持直井、定向井、水平井等 多种井型,可配置地层、钻井液压力、井身结构等详细参数。
功能描述: 1. 接收并验证井数据的完整性和合法性 2. 调用外部生成器程序生成井身结构可视化图表 3. 创建带时间戳的归档文件夹保存所有生成文件 4. 返回图片路径和详细报告内容
Args: well_data (Dict[str, Any]): 井数据字典,必需。包含以下字段:
必填字段:
wellName (str): 井名
totalDepth_m (float): 井深,单位:米,必须大于0。若用户未明确指出,则采用最大钻头深度(wellboreStructure下的 bottomDepth_m)减去1米。
wellType (str): 井型,可选值:
- "straight well": 直井
- "deviated well": 定向井
- "horizontal well": 水平井
deviationData (Dict): 井眼轨迹参数(直井时,至少包含 "kickoffPoint_m",或deviationAngle_deg 字段)
- kickoffPoint_m (float): 绘图造斜点,单位:米 (默认null)
- REAL_kickoffPoint_m (float): 显示造斜点,单位:米 (默认null)
- targetPointA_m (float): A靶点井深,单位:米 (默认null)
- targetPointA_verticalDepth_m (float): A靶点垂深,单位:米 (默认null)
- targetPointB_m (float): B靶点井深,单位:米 (默认null)
- deviationAngle_deg (float): 井斜角,单位:度,(默认为null,直井为0)
- DistanceAB_m (float): A、B靶点距离,单位:米 (默认null)
stratigraphy (List[Dict]): 地层分层信息数组
- name (str): 地层名称
- topDepth_m (float): 顶深,单位:米
- bottomDepth_m (float): 底深,单位:米
注意:相邻地层的bottomDepth_m必须等于下一地层的topDepth_m
drillingFluidAndPressure (List[Dict]): 钻井液密度和压力剖面数组
- topDepth_m (float): 区间顶深,单位:米
- bottomDepth_m (float): 区间底深,单位:米
- porePressure_gcm3 (float): 孔隙压力当量密度,单位:g/cm³
- pressureWindow_gcm3 (Dict): 安全密度窗口
- min (float): 最小安全密度,单位:g/cm³
- max (float): 最大安全密度,单位:g/cm³
wellboreStructure (Dict): 井身物理结构
- holeSections (List[Dict]): 裸眼井段数组
- topDepth_m (float): 井段顶深,单位:米
- bottomDepth_m (float): 井段底深,单位:米
- diameter_mm (float): 钻头直径,单位:毫米
- note_in (str, 可选): 备注说明
- casingSections (List[Dict]): 套管程序数组
- topDepth_m (float): 套管悬挂点深度,单位:米
- bottomDepth_m (float): 套管鞋深度,单位:米
- od_mm (float): 套管外径,单位:毫米
- note_in (str, 可选): 备注说明
可选字段:
legendConfig (Dict): 图例和样式配置
- casingLegend (bool): 是否显示套管图例
- holeLegend (bool): 是否显示井筒图例
- kickoffLegend (bool): 是否显示造斜点图例
- targetPointsLegend (bool): 是否显示靶点图例
- fill (bool): 是否填充套管-井筒环空
- simpleinfo (bool): 是否使用简化信息图
pilotHoleGuideLine (Dict): 导眼井辅助线配置,放置在wellboreStructure内。
- display (bool): 是否显示辅助线
- highlight (bool): 是否高亮显示
- side_tracking (bool): 是否标记为侧钻点Returns: Dict[str, Any]: 生成结果字典,包含以下字段:
成功时 (success=True):
success (bool): True,表示生成成功
report_content (str): Markdown格式的详细报告内容
response (str): 包含图片路径的格式化响应文本
notice (str): 使用提示信息
well_info (Dict): 井基本信息
- well_name (str): 井名
- well_type (str): 井型
- total_depth (float): 井深
archive_folder (str): 归档文件夹相对路径
structure_image_path (str): 井身结构图绝对路径
info_image_path (str): 井身信息图绝对路径
失败时 (success=False):
success (bool): False,表示生成失败
error (str): 错误描述信息
error_code (str): 错误代码,可能的值:
- "VALIDATION_ERROR": 数据验证失败
- "FILE_UPDATE_ERROR": 文件更新失败
- "GENERATOR_ERROR": 生成器启动或运行失败
- "FOLDER_CREATION_ERROR": 文件夹创建失败
- "FILE_ARCHIVE_ERROR": 文件归档失败
- "FOLDER_PATH_ERROR": 路径获取失败
- "UNKNOWN_ERROR": 未知错误
details (str): 详细错误信息Raises: 本函数不会主动抛出异常,所有错误均通过返回字典中的success字段和error信息表示。
Notes: - 服务端具有较强容错性,部分数据缺失时会自动生成默认值 - 所有生成的文件会自动归档到以时间戳命名的文件夹中 - 不要向用户复述或展示原始JSON数据,直接使用工具生成结果 - 进行任何数据修改操作前必须提醒用户
Examples: >>> well_data = { ... "wellName": "Well_Z101", ... "totalDepth_m": 6900, ... "wellType": "deviated well", ... "deviationData": { ... "kickoffPoint_m": 3060, ... "deviationAngle_deg": 30, ... "targetPointA_m": 5090, ... "targetPointA_verticalDepth_m": 4825, ... "targetPointB_m": 6890, ... "DistanceAB_m": 1800, ... "REAL_kickoffPoint_m": 3060 ... }, ... "stratigraphy": [ ... {"name": "遂宁组", "topDepth_m": 0, "bottomDepth_m": 150}, ... {"name": "沙溪庙组", "topDepth_m": 150, "bottomDepth_m": 1112}, ... ...... ... ], ... "drillingFluidAndPressure": [ ... {"topDepth_m": 0, "bottomDepth_m": 150, ... "porePressure_gcm3": 1.085, ... "pressureWindow_gcm3": {"min": 1.05, "max": 1.10}}, ... ...... ... ], ... "wellboreStructure": { ... "holeSections": [ ... {"topDepth_m": 0, "bottomDepth_m": 152, ... "diameter_mm": 660.4, "note_in": "26""}, ... ...... ... ], ... "casingSections": [ ... {"topDepth_m": 0, "bottomDepth_m": 150.62, ... "od_mm": 508, "note_in": "20"导管"}, ... ...... ... ], ... "pilotHoleGuideLine": { ... "topDepth_m": 3060, ... "bottomDepth_m": 6900, ... "diameter_mm": 215.9, ... "display": true, ... "highlight": true, ... "side_tracking": true ... } ... }, ... "legendConfig": { ... "casingLegend": false, ... "holeLegend": false, ... "kickoffLegend": true, ... "targetPointsLegend": true, ... "fill": false, ... "simpleinfo": true ... } ... } >>> result = generate_well_structure(well_data) >>> if result["success"]: ... print(f"生成成功!图片路径:{result['structure_image_path']}") ... else: ... print(f"生成失败:{result['error']}")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| well_data | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |