modules.geoDataProcess 模块帮助

本章节包含 modules.geoDataProcess 中与地质 / 钻孔 / 剖面数据处理相关的模块说明,例如:

  • 按剖切线从地形点插值生成三维及二维地形线(SliceTerrain

  • 按钻孔与剖切线导出 CAD 用地质剖面(ExportGeoSectionsByBores

  • 为地质剖面钻孔补充柱状图信息(AddBoreLogForGeoSections

  • 地层编号补齐、按地层编号排序

  • 钻孔类型 KCAD 映射等

MapBoreTypeToKCAD

模块简介与适用场景

  • MapBoreTypeToKCAD 将钻孔一览表中的「钻孔类型」字段值映射为 KCAD(AutoCAD/中望CAD出图插件)所使用的标准钻孔类型名称。

  • 映射关系并非写死在代码里,而是通过 GDIM API 按当前 项目 ID 拉取;项目在 GDIM 中维护对照表时,Pipeline 可自动同步为最新映射(未命中键的处理见后文「行为与错误说明」)。

  • 典型适用场景: 钻孔布置图、平面图等下游 KCAD / CAD 绘图流程要求钻孔类型枚举与标准一致。

端口说明

  • 输入端口 - InputTablesTableCollectionTableData``(单表时整张表即为钻孔一览表)。 - ``InputTokenToken;Pipeline 已配置 GDIM 运行上下文时可不连接。

  • 输出端口 - OutputTables:拷贝并写回映射结果后的数据,类型与输入一致;InputTables 为空或无法解析 token 时为 None

快速上手示例:单表映射

from gdisdk.modules import MapBoreTypeToKCAD

mapper = MapBoreTypeToKCAD(mname="MapBoreTypes")
mapper.InputToken = ("你的GDIM Token", "你的GDIM项目ID", None)
mapper.bore_type_field = "bore_type"  # 列内部名或字段标题均可
mapper.InputTables = your_bore_table_data  # TableData

mapper.execute()
out = mapper.OutputTables.data

快速上手示例:表集合中指定钻孔表

from gdisdk.modules import MapBoreTypeToKCAD

mapper = MapBoreTypeToKCAD(mname="MapBoreTypes")
mapper.InputToken = ("你的GDIM Token", "你的GDIM项目ID", None)
mapper.bore_table_name = "bore_table"   # 集合内表名或表标题,与 get_table 约定一致
mapper.bore_type_field = "bore_type"    # 或字段标题(与列元数据 title 一致)
mapper.InputTables = your_table_collection

mapper.execute()
out_tables = mapper.OutputTables.data

参数说明

MapBoreTypeToKCAD 参数一览

参数名

类型

默认值

说明

tables

TableCollection | TableData | None

None

构造时可直接赋给 InputTables;若为 None 则须在后续连接端口或属性赋值传入。

bore_table_name

str

"bore_table"

仅 ``TableCollection`` 输入时有效:集合内钻孔表名称或标题。单 TableData 输入时忽略。

bore_type_field

str

"bore_type"

待映射列的字段内部名或字段标题,未找到时抛出 ValueError,并列出可用字段名与标题。

token / proj_id / host

str | None

None

鉴权与平台地址。构造器若设置 proj_id 写入 self.proj_id,其优先级高于 InputToken 与 Pipeline 上的项目 ID。

行为与错误说明

  • 钻孔类型列的值经 Series.map(mapping_dict) 替换;映射表中没有的键会变成 pandas 中的缺失标记,请结合业务决定是否在前游清洗或使用 fillna

  • TableCollection 中找不到 bore_table_name,或表中无法按内部名/标题解析 bore_type_field 时,抛出 ValueError 并给出可用表、字段名与字段标题等线索。

在 pipeline 中的使用方式

from gdisdk.pipeline import PipeLine
from gdisdk.modules import MapBoreTypeToKCAD

pipe = PipeLine(app_name="BoreCadPrep", app_title="钻孔类型映射示例")
pipe.update_gdim_state(token="...", proj_id="...", host=None)

mapper = MapBoreTypeToKCAD("MapKcadBoreTypes")
# bore_reader.OutputTables >> mapper.InputTables
pipe.add_module(mapper)
pipe.run()

更多信息

AddLayerNumberByStdLayerTable

模块简介与适用场景

  • AddLayerNumberByStdLayerTable``layer_table``(地层表)缺少 ``layer_number``(地层编号)时,依据 ``standard_layer_table``(标准地层表)回填该列。

  • 模块会从 GDIM 模板(pipeline.gdim_template 或通过 token 拉取)中读取 standard_layer_update.define_layer_fields,据此确定 join 字段;输入须同时包含 layer_table``standard_layer_table``(详见后文「行为与错误说明」)。

  • 典型适用场景: 下游流程要求地层表含编号列,或 GDIM 标准地层配置为 “autoGeneration”(自动确定地层字段)时需自动补齐 layer_number

端口说明

  • 输入端口 - InputTablesTableCollection;须含 layer_tablestandard_layer_table。 - InputTokenToken;Pipeline 已配置 GDIM 运行上下文时可不连接。

  • 输出端口 - OutputTables:补齐 layer_number 后的 TableCollectionInputTables 为空或无法解析 GDIM 模板时为 None

快速上手示例:补齐 TableCollection 中的地层编号

from gdisdk.modules.geoDataProcess import AddLayerNumberByStdLayerTable

add_layer_num = AddLayerNumberByStdLayerTable(mname="AddLayerNum")
add_layer_num.InputToken = ("你的GDIM Token", "你的GDIM项目ID", None)
add_layer_num.InputTables = your_table_collection  # 须含 layer_table 与 standard_layer_table

add_layer_num.execute()
out_tables = add_layer_num.OutputTables.data

参数说明

AddLayerNumberByStdLayerTable 参数一览

参数名

类型

默认值

说明

tables

TableCollection | None

None

构造时可直接赋给 InputTables;若为 None 则须在后续连接端口或属性赋值传入。

layer_table_name

str

"layer_table"

地层表在集合内的名称或标题。

layer_number_name

str

"layer_number"

新增地层编号列的字段内部名。

layer_number_title

str

"地层编号"

新增地层编号列的字段标题。

token / proj_id / host

str | int | str | str | None

None

鉴权与项目定位信息;若未显式传入,模块会尝试从 pipeline 获取,也可通过 InputToken 传入。

行为与错误说明

  • 模块按 define_layer_fieldslayer_table公共字段名 做 left join,从 standard_layer_tablelayer_number 写回 layer_table

  • layer_table 已含 layer_number_namelayer_number_title 对应列时,发出 warnings.warn 并原样返回输入集合。

  • GDIM 模板中 standard_layer_update.update_method 不是 "autoGeneration" 时,发出 warnings.warn 并原样返回输入集合。

  • layer_tablestandard_layer_table 缺失/为空、模板缺少 standard_layer_updatedefine_layer_fieldsdefine_layer_fieldslayer_table 无公共字段、standard_layer_table 缺少 layer_number 列时,抛出 ValueError

  • join 后存在缺失的 layer_number``(NaN)时,抛出 ``ValueError 并指出第一条缺失的组合键值。

在 pipeline 中的使用方式

from gdisdk.pipeline.pipeline import PipeLine
from gdisdk.modules.readers import GdimTableReader
from gdisdk.modules.geoDataProcess import AddLayerNumberByStdLayerTable

pipe = PipeLine(app_name="AddLayerNumberDemo", app_title="补齐地层编号示例")
pipe.update_gdim_state(token="你的GDIM Token", proj_id="你的GDIM项目ID")

read_tables = GdimTableReader("ReadTables")
read_tables.table_fields = ["layer_table", "standard_layer_table"]

add_layer_num = AddLayerNumberByStdLayerTable("AddLayerNum")

links = read_tables.OutputTables >> add_layer_num.InputTables
pipe.add_links(links)
pipe.run()

out_tables = add_layer_num.OutputTables.data

更多信息

SortByLayerNumber

模块简介与适用场景

  • SortByLayerNumber 按地层编号对 TableDataTableCollection 中的 layer 表排序,使用 sort_layer_numbers 自然排序规则(如 1-3 排在 10-1 前),可容忍部分非标准编号值。

  • 输入为 TableCollection 时,仅对 layer_table_name 指定的表排序,集合内其余表原样保留。

  • 典型适用场景: 绘图、剖面、汇总或导出前统一层序顺序。

端口说明

  • 输入端口 - InputTableTableDataTableCollection

  • 输出端口 - OutputTable:排序后的数据,类型与输入一致;InputTable 为空、空表或空集合时为 None

快速上手示例:排序单张 layer 表

from gdisdk.dataclass.tables import TableData
from gdisdk.modules.geoDataProcess import SortByLayerNumber

table = TableData({"layer_number": ["2-1", "10-1", "1-3"], "v": [1, 2, 3]})

sort_mod = SortByLayerNumber(mname="Sort")
sort_mod.InputTable = table
sort_mod.order = "ascending"

sort_mod.execute()
out = sort_mod.OutputTable.data

快速上手示例:排序 TableCollection 中的 layer 表

from gdisdk.modules.geoDataProcess import SortByLayerNumber

sort_mod = SortByLayerNumber(mname="SortLayer")
sort_mod.layer_table_name = "layer_table"
sort_mod.layer_number_column = "layer_number"
sort_mod.order = "ascending"
sort_mod.InputTable = your_table_collection

sort_mod.execute()
out = sort_mod.OutputTable.data

参数说明

SortByLayerNumber 参数一览

参数名

类型

默认值

说明

table

TableCollection | TableData | None

None

构造时可直接赋给 InputTable;若为 None 则须在后续连接端口或属性赋值传入。

order

Literal["ascending", "descending"]

"ascending"

升序/降序;GDIM 界面通过 update_ui_schema 暴露为「地层编号排序」。

layer_table_name

str

"layer_table"

当输入为 TableCollection 时,指定要排序的表名或表标题。

layer_number_column

str

"layer_number"

地层编号列的字段内部名或字段标题。

行为与错误说明

  • 排序基于 sort_layer_numbers(..., raise_on_invalid=False);同一地层编号的多行保持相对顺序,再按编号整体重排。

  • layer_number_column 支持字段内部名、字段标题,或通过 title_to_name 解析的别名。

  • 找不到地层编号列时,发出 warnings.warn 并返回原表副本(不修改上游数据)。

  • TableCollection 中找不到 layer_table_name 对应表或该表为空时,发出 warnings.warn 并返回集合副本(其余表不变)。

  • 输出始终为新副本,不会就地修改 InputTable 中的对象。

在 pipeline 中的使用方式

from gdisdk.pipeline.pipeline import PipeLine
from gdisdk.modules.readers import GdimTableReader
from gdisdk.modules.geoDataProcess import SortByLayerNumber

pipe = PipeLine(app_name="SortLayerDemo", app_title="地层编号排序示例")
pipe.update_gdim_state(token="你的GDIM Token", proj_id="你的GDIM项目ID")

read_tables = GdimTableReader("ReadTables")
read_tables.table_fields = ["layer_table", "bore_table"]

sort_layer = SortByLayerNumber("SortLayer")
sort_layer.order = "ascending"

links = read_tables.OutputTables >> sort_layer.InputTable
pipe.add_links(links)
pipe.run()

out_tables = sort_layer.OutputTable.data

更多信息

SliceTerrain

模块简介与适用场景

  • SliceTerrainInputPolyLines 定义的剖切线,从 InputTerrainPoints 地形点插值生成 三维地形线**二维地形线**(桩号 + 高程)。

  • 典型适用场景:

    • 地质剖面、地形剖面出图前,将散点地形与剖面线结合,得到沿剖迹的高程采样线;

    • CreatePolyLinesGdimTerrainDataReader 联用:前者提供剖切线顶点,后者或上游模块提供地形点。

  • 常见下游模块:ExportGeoSectionsByBores``(通过 ``InputTerrainLines 接收三维地形线输出)。

端口说明

  • 输入端口 - InputTerrainPoints:地形点表(TableData)。须含 x_coordinatey_coordinatez_coordinate``(或等价字段名/列标题);有效点至少 **3** 个。 - ``InputPolyLines:剖切线顶点表(TableData)。须含 namex_coordinatey_coordinate;可选 z_coordinatebore_number。结构遵循 PolyLinesTable

  • 输出端口 - OutputTerrainLines:三维地形线(TableData)。列包括 namex_coordinatey_coordinatez_coordinateslice_point;输入剖切线含 bore_number 时输出保留该列(仅 slice_point=True 的行写入钻孔编号)。 - Output2DTerrainLines:二维地形线(TableData)。列包括 namechainagez_coordinateslice_pointbore_number 规则同上。

快速上手示例:按剖切线切地形

import pandas as pd

from gdisdk.dataclass.tables import TableData
from gdisdk.modules.geoDataProcess import SliceTerrain

terrain = TableData(
    pd.DataFrame(
        {
            "x_coordinate": [0.0, 100.0, 0.0, 100.0],
            "y_coordinate": [0.0, 0.0, 100.0, 100.0],
            "z_coordinate": [0.0, 100.0, 100.0, 200.0],
        }
    ),
    name="terrain_points",
    title="地形点",
)

poly_lines = TableData(
    pd.DataFrame(
        {
            "name": ["剖面1-1", "剖面1-1"],
            "x_coordinate": [0.0, 100.0],
            "y_coordinate": [0.0, 0.0],
            "bore_number": ["ZK1", "ZK2"],
        }
    ),
    name="poly_lines",
    title="剖切线",
)

mod = SliceTerrain(mname="SliceTerrain")
mod.max_segment_length = 25.0
mod.InputTerrainPoints = terrain
mod.InputPolyLines = poly_lines

mod.execute()
terrain_3d = mod.OutputTerrainLines.data
terrain_2d = mod.Output2DTerrainLines.data

快速上手示例:自定义地形点列名

import pandas as pd

from gdisdk.dataclass.tables import TableData
from gdisdk.modules.geoDataProcess import SliceTerrain

terrain = TableData(
    pd.DataFrame(
        {
            "east": [0.0, 100.0, 0.0, 100.0],
            "north": [0.0, 0.0, 100.0, 100.0],
            "elev": [0.0, 100.0, 100.0, 200.0],
        }
    )
)

poly_lines = TableData(
    pd.DataFrame(
        {
            "name": ["A-A", "A-A"],
            "x_coordinate": [0.0, 100.0],
            "y_coordinate": [0.0, 0.0],
        }
    )
)

mod = SliceTerrain(mname="SliceTerrainByColumns")
mod.terrain_columns = ["east", "north", "elev"]
mod.max_segment_length = 0.0  # 不细分剖切线段
mod.InputTerrainPoints = terrain
mod.InputPolyLines = poly_lines

mod.execute()
terrain_3d = mod.OutputTerrainLines.data

参数说明

SliceTerrain 参数一览

参数名

类型

默认值

说明

terrain_points

TableData | None

None

构造时可直接赋给 InputTerrainPoints;若为 None 则须在执行前连接端口或属性赋值。

poly_lines

TableData | None

None

构造时可直接赋给 InputPolyLines;若为 None 则须在执行前连接端口或属性赋值。

terrain_columns

list[str] | None

None

地形点 x/y/z 列标识(字段名或列标题),顺序为 x、y、z。为 None 时按 GeneralProps 默认字段名或标题(如 x_coordinate / X坐标)自动识别。

max_segment_length

float

10.0

剖切线相邻采样点的最大 水平 间距(米)。较长线段会先细分再插值高程;设为 <= 0 表示不细分,仅在剖切线顶点处采样。

Note

  • InputTerrainPointsInputPolyLinesNone,则两个输出端口均为 None

  • 地形点表为空、有效点不足 3 个,或 terrain_columns 长度不为 3 时,抛出 ValueError

  • slice_pointTrue 的行对应剖切线 原始顶点;细分产生的中间采样点为 False

  • 输入剖切线未含 bore_number 列时,输出不含该列。

在 pipeline 中的使用方式

from gdisdk.pipeline.pipeline import PipeLine
from gdisdk.modules.converters import ConvertToMultiProfile1D
from gdisdk.modules.geoDataProcess import ExportGeoSectionsByBores, SliceTerrain
from gdisdk.modules.gisOperators import CreatePolyLines
from gdisdk.modules.readers import GdimTableReader, GdimTerrainDataReader

pipe = PipeLine(app_name="SliceTerrainDemo", app_title="地形面切剖示例")

reader = GdimTableReader("ReadTables")
convert_bores = ConvertToMultiProfile1D("ConvertBores")
create_lines = CreatePolyLines("CreatePolyLines")
terrain_reader = GdimTerrainDataReader("TerrainReader")
terrain_reader.query_mode = "nearest_line"
slice_terrain = SliceTerrain("SliceTerrain")
export_sections = ExportGeoSectionsByBores("ExportSections")

links = (
    reader.OutputTables >> convert_bores.InputTables
    | convert_bores.OutputMultiProfile1D >> create_lines.InputMultiProfile1D
    | create_lines.OutputPolyLines >> terrain_reader.InputPolyLines
    | create_lines.OutputPolyLines >> slice_terrain.InputPolyLines
    | terrain_reader.OutputTerrainPoints >> slice_terrain.InputTerrainPoints
    | slice_terrain.OutputTerrainLines >> export_sections.InputTerrainLines
    | create_lines.OutputPolyLines >> export_sections.InputPolyLines
)
pipe.add_links(links)

pipe.add_attribute(
    attr_name="max_segment_length",
    module_name="SliceTerrain",
    param_name="max_segment_length",
    attr_title="剖切线最大段长",
)

pipe.run()

更多信息

ExportGeoSectionsByBores

模块简介与适用场景

  • ExportGeoSectionsByBores 根据 InputPolyLines 定义的剖切线,将 InputMultiProfile1D 钻孔数据与 InputMaterialTable 岩性表合成为 **CAD 出图用地质剖面**(SectionForCadDraw 列表),并可同步输出三维剖面(Section3D 列表)。

  • 剖切线支持两种定义方式(由 InputPolyLinesbore_number 列是否齐全决定,详见后文「剖切线定义方式说明」):

    • 钻孔定义:剖面线顶点即钻孔位置,按钻孔顺序生成剖面;

    • 坐标点定义:剖面线为 XY 折线,需指定投影钻孔及可选的自定义投影坐标。

  • terrain_lines_required=True``(默认),须连接 ``InputTerrainLines``(通常来自 ``SliceTerrain);地形线与剖切线顶点 XY 须对齐。

  • 典型适用场景:GDIM / KCAD 地质剖面出图前,将钻孔、岩性、剖切线、地形线整合为 .gsc 或下游 AddBoreLogForGeoSectionsGeoSectionsWriter 可消费的结构化剖面数据。

端口说明

  • 输入端口 - InputMultiProfile1D:竖向钻孔数据(MultiProfile1D)。须含非空 profiles_tablelayers_table。 - InputMaterialTable:CAD 绘图用岩性表(MaterialTable)。 - InputPolyLines:剖切线顶点表(TableData)。须含 namex_coordinatey_coordinate;可选 bore_number。结构遵循 PolyLinesTable。 - InputTerrainLines:沿剖切线的三维地形线(TableData),通常来自 SliceTerrain.OutputTerrainLinesterrain_lines_required=True 时为必填;须含 namex_coordinatey_coordinateslice_point 等列(见 TerrainLinesTable)。

  • 输出端口 - OutputGeoSectionsSectionForCadDraw 对象列表;任一必填输入缺失或处理失败时为 None。 - OutputGeoSections3DSection3D 对象列表;output_3d_sections=FalseOutputGeoSectionsNone 时为 None

剖切线定义方式说明

InputPolyLines 的解析模式由 PolyLinesTable.define_mode 自动判定:

剖切线定义方式对照

模式

判定条件

主要参数

说明

``bores``(钻孔定义)

每行 bore_number 均非空

terrain_lines_requireduse_layer_num

剖面线顶点顺序即钻孔顺序;考虑地形时,地形线与钻孔重合处高程以钻孔孔口为准。

``points``(坐标点定义)

bore_number 列,或存在空值

projected_boresuser_defined_projectionsterrain_bores_alignment

须连接非空 InputTerrainLines;将指定钻孔投影到剖切线后生成剖面。

快速上手示例:在 pipeline 中生成剖面

from gdisdk.pipeline.pipeline import PipeLine
from gdisdk.modules.converters import ConvertToMaterialTable, ConvertToMultiProfile1D
from gdisdk.modules.geoDataProcess import (
    AddLayerNumberByStdLayerTable,
    ExportGeoSectionsByBores,
    SliceTerrain,
)
from gdisdk.modules.gisOperators import CreatePolyLines
from gdisdk.modules.readers import GdimTableReader, GdimTerrainDataReader

pipe = PipeLine(app_name="ExportSectionsDemo", app_title="导出地质剖面示例")
pipe.update_gdim_state(token="你的GDIM Token", proj_id="你的GDIM项目ID")

reader = GdimTableReader("ReadTables")
reader.table_fields = ["layer_table", "standard_layer_table", "bore_table"]

add_layer_num = AddLayerNumberByStdLayerTable("AddLayerNum")
convert_material = ConvertToMaterialTable("ConvertMaterial")
convert_bores = ConvertToMultiProfile1D("ConvertBores")
create_lines = CreatePolyLines("CreatePolyLines")
terrain_reader = GdimTerrainDataReader("TerrainReader")
terrain_reader.query_mode = "nearest_line"
slice_terrain = SliceTerrain("SliceTerrain")
export_sections = ExportGeoSectionsByBores("ExportSections")

links = (
    reader.OutputTables >> add_layer_num.InputTables
    | add_layer_num.OutputTables >> convert_material.InputTable
    | add_layer_num.OutputTables >> convert_bores.InputTables
    | convert_material.OutputMaterialTable >> convert_bores.InputMaterialTable
    | convert_bores.OutputMultiProfile1D >> create_lines.InputMultiProfile1D
    | create_lines.OutputPolyLines >> terrain_reader.InputPolyLines
    | create_lines.OutputPolyLines >> slice_terrain.InputPolyLines
    | terrain_reader.OutputTable >> slice_terrain.InputTerrainPoints
    | convert_bores.OutputMultiProfile1D >> export_sections.InputMultiProfile1D
    | convert_material.OutputMaterialTable >> export_sections.InputMaterialTable
    | create_lines.OutputPolyLines >> export_sections.InputPolyLines
    | slice_terrain.OutputTerrainLines >> export_sections.InputTerrainLines
)
pipe.add_links(links)

export_sections.terrain_lines_required = True
export_sections.use_layer_num = True

pipe.run()

sections_2d = export_sections.OutputGeoSections.data
sections_3d = export_sections.OutputGeoSections3D.data

快速上手示例:坐标点定义剖面的投影参数

CreatePolyLines.define_poly_lines_by="points" 时,须在 ExportGeoSectionsByBores 上配置投影钻孔;user_defined_projections 可覆盖自动投影坐标。

from gdisdk.modules.geoDataProcess import ExportGeoSectionsByBores

export_sections = ExportGeoSectionsByBores("ExportSections")
export_sections.terrain_lines_required = True
export_sections.projected_bores = {
    "1-1": ["ZK1", "ZK2", "ZK3"],
    "2-2": ["ZK4", "ZK5"],
}
export_sections.user_defined_projections = {
    "1-1": {"ZK1": (100.0, 50.0)},
}
export_sections.terrain_bores_alignment = True

# 连接 InputMultiProfile1D、InputMaterialTable、InputPolyLines、InputTerrainLines 后:
export_sections.execute()
sections = export_sections.OutputGeoSections.data

参数说明

ExportGeoSectionsByBores 参数一览

参数名

类型

默认值

说明

bores / material_table / poly_lines / terrain_lines

各端口对应类型或 None

None

构造时可直接赋给对应输入端口;若为 None 则须在执行前连接端口或属性赋值。

use_layer_num

bool

True

是否使用地层编号;False 时按材质名自动生成编号。

terrain_lines_required

bool

True

是否考虑地形线。TrueInputTerrainLines 必填,且与 InputPolyLines 顶点 XY 对齐;False 时忽略地形参与剖面生成。

projected_bores

dict[str, list[str]] | None

None

仅坐标点定义模式:剖面编号到待投影钻孔编号列表的映射。

user_defined_projections

dict[str, dict[str, tuple[float, float]]] | None

None

仅坐标点定义模式:剖面编号到「钻孔编号 → (X, Y) 投影坐标」的映射;与 projected_bores 中同孔同剖面时覆盖自动投影。

terrain_bores_alignment

bool

False

仅坐标点定义模式:是否将投影钻孔孔口高程与地形线对齐;False 时输出钻孔线仍基于原始孔口,地层线基于对齐后数据计算。

output_3d_sections

bool

True

是否生成 OutputGeoSections3D

pinch_type

int

1

尖灭类型;当前仅支持 ``1``(孔上尖灭)。

merge_interfaces

bool

True

是否合并相邻且 geo_id 相同的地层界面线。

precision_grid_size

float

0.001

闭合区域计算用的网格步长。

snap_tolerance

float

0.001

闭合区域计算用的捕捉容差。

Note

  • InputMultiProfile1DInputMaterialTableInputPolyLinesNone,或 profiles_table / layers_table 缺失时,两个输出均为 None

  • terrain_lines_required=TrueInputTerrainLinesNone 时,两个输出均为 None

  • 坐标点定义模式下 InputTerrainLines 为空时,两个输出均为 None

  • InputPolyLines 为空或缺少必填列、同一条线顶点少于 2 个时,抛出 ValueError

  • projected_boresuser_defined_projectionsterrain_bores_alignment 在 GDIM 界面上仅于坐标点定义模式可见(见 update_ui_schema)。

在 pipeline 中的使用方式

与「快速上手示例:在 pipeline 中生成剖面」相同;常见做法是暴露 terrain_lines_requiredprojected_bores 等属性供 GDIM 界面编辑:

pipe.add_attribute(
    attr_name="terrain_lines_required",
    module_name="ExportGeoSectionsByBores",
    param_name="terrain_lines_required",
    attr_title="考虑地形",
)
pipe.add_attribute(
    attr_name="projected_bores",
    module_name="ExportGeoSectionsByBores",
    param_name="projected_bores",
    attr_title="投影钻孔",
)

更多信息

AddBoreLogForGeoSections

模块简介与适用场景

  • AddBoreLogForGeoSectionsInputTables 读取钻孔、地层、原位测试、取样等表格数据,将 柱状图出图字段 合并进 ExportGeoSectionsByBores 已生成的 SectionBore 对象中。

  • 表格到 SectionBore 的转换逻辑与 BoreLogDrawWriter 相同;模块仅按剖面中出现的 bore_num 筛选并转换对应钻孔。

  • ExportGeoSectionsByBores 已写入的剖面几何字段(如 x_coordtopelevationsdepthsmaterialslayers_numdistance_to)在合并时 不会被表格数据覆盖

  • 典型适用场景: KCAD 地质剖面 .gsc 出图前,在剖面钻孔上叠加标贯、动探、静探、取样、岩土参数等柱状图信息,再经 GeoSectionsWriter 写出文件。

端口说明

  • 输入端口 - InputGeoSectionsGeoSections``(``SectionForCadDraw 列表)。通常来自 ExportGeoSectionsByBores.OutputGeoSections,其中 SectionBore 已含剖面坐标与地层几何。 - InputTablesTableCollection。须含钻孔、地层及所需测试/取样/岩土参数表;字段映射见 name_maps

  • 输出端口 - OutputGeoSections:合并柱状图信息后的 GeoSectionsInputGeoSectionsInputTablesNone 时为 None

快速上手示例:补充剖面钻孔柱状图信息

from gdisdk.modules.geoDataProcess import AddBoreLogForGeoSections

add_bore_log = AddBoreLogForGeoSections(mname="AddBoreLog")
add_bore_log.name_maps = {
    "table_names": {
        "bore_table": "bore_table",
        "layer_table": "layer_table",
        "spt_table": "spt_table",
    },
    "field_names": {
        "bore_table": {"bore_num": "bore_number"},
        "layer_table": {
            "bore_num": "bore_number",
            "layer_num": "layer_number",
        },
        "spt_table": {
            "bore_num": "bore_number",
            "spt_depths": "test_point_top_depth",
            "spt_lengths": "penetration_depth",
            "spt_numbers": "blow_count",
        },
    },
}
add_bore_log.sample_types_map = {
    "厚壁原状": 0,
    "薄壁原状": 0,
    "扰动样": 1,
    "岩石样": 2,
    "水样": 3,
}
add_bore_log.InputGeoSections = geo_sections_from_export
add_bore_log.InputTables = your_table_collection

add_bore_log.execute()
enriched_sections = add_bore_log.OutputGeoSections.data

参数说明

AddBoreLogForGeoSections 参数一览

参数名

类型

默认值

说明

geo_sections

GeoSections | None

None

构造时可直接赋给 InputGeoSections;示例中推荐初始化后通过 InputGeoSections 赋值。

tables

TableCollection | None

None

构造时可直接赋给 InputTables;示例中推荐初始化后通过 InputTables 赋值。

name_maps

dict[str, dict[str, str]] | None

``None``(空字典)

柱状图 .gsc 内部表名/字段名与 InputTables 实际表名/字段名的映射,含 table_namesfield_names 两个子字典;结构与 BoreLogDrawWriter 一致。

sample_types_map

dict[str, int] | None

None

取样类型字符串到 KCAD 整数编码的映射,例如 {"厚壁原状": 0, "扰动样": 1}

Note

  • 剖面中未出现 bore_num 时,原样透传 InputGeoSections

  • InputTables 中找不到某 bore_num 时,模块发出 warnings.warn,该 SectionBore 保持 ExportGeoSectionsByBores 输出不变。

  • name_maps 只需映射本模块要从表格读取的表与字段;剖面几何字段由上游 ExportGeoSectionsByBores 提供,无需在 name_maps 中重复配置。

在 pipeline 中的使用方式

典型链路:ExportGeoSectionsByBoresAddBoreLogForGeoSectionsGeoSectionsWriterInputTables 可与读表模块共用同一份 TableCollection

from gdisdk.pipeline.pipeline import PipeLine
from gdisdk.modules.geoDataProcess import (
    AddBoreLogForGeoSections,
    ExportGeoSectionsByBores,
)
from gdisdk.modules.readers import GdimTableReader
from gdisdk.modules.writers import GeoSectionsWriter

pipe = PipeLine(app_name="GeoSectionsWithBoreLog", app_title="剖面柱状图补充示例")

reader = GdimTableReader("ReadTables")
export_sections = ExportGeoSectionsByBores("ExportSections")
add_bore_log = AddBoreLogForGeoSections("AddBoreLog")
write_gsc = GeoSectionsWriter("WriteGsc")
write_gsc.gsc_file_name = "geo_sections.gsc"

add_bore_log.name_maps = {
    "table_names": {"bore_table": "bore_table", "layer_table": "layer_table"},
    "field_names": {
        "bore_table": {"bore_num": "bore_number"},
        "layer_table": {"bore_num": "bore_number", "layer_num": "layer_number"},
    },
}

links = (
    reader.OutputTables >> add_bore_log.InputTables
    | export_sections.OutputGeoSections >> add_bore_log.InputGeoSections
    | add_bore_log.OutputGeoSections >> write_gsc.InputGeoSections
)
pipe.add_links(links)
pipe.run()

sections = add_bore_log.OutputGeoSections.data

更多信息