modules.geoDataProcess 模块帮助
本章节包含 modules.geoDataProcess 中与地质 / 钻孔 / 剖面数据处理相关的模块说明,例如:
按剖切线从地形点插值生成三维及二维地形线(
SliceTerrain)按钻孔与剖切线导出 CAD 用地质剖面(
ExportGeoSectionsByBores)为地质剖面钻孔补充柱状图信息(
AddBoreLogForGeoSections)地层编号补齐、按地层编号排序
钻孔类型 KCAD 映射等
MapBoreTypeToKCAD
模块简介与适用场景
MapBoreTypeToKCAD将钻孔一览表中的「钻孔类型」字段值映射为 KCAD(AutoCAD/中望CAD出图插件)所使用的标准钻孔类型名称。映射关系并非写死在代码里,而是通过 GDIM API 按当前 项目 ID 拉取;项目在 GDIM 中维护对照表时,Pipeline 可自动同步为最新映射(未命中键的处理见后文「行为与错误说明」)。
典型适用场景: 钻孔布置图、平面图等下游 KCAD / CAD 绘图流程要求钻孔类型枚举与标准一致。
端口说明
输入端口 -
InputTables:TableCollection或TableData``(单表时整张表即为钻孔一览表)。 - ``InputToken:Token;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
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
|
|
构造时可直接赋给 |
|
|
|
仅 ``TableCollection`` 输入时有效:集合内钻孔表名称或标题。单 |
|
|
|
待映射列的字段内部名或字段标题,未找到时抛出 |
|
|
|
鉴权与平台地址。构造器若设置 |
行为与错误说明
钻孔类型列的值经
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。
端口说明
输入端口 -
InputTables:TableCollection;须含layer_table与standard_layer_table。 -InputToken:Token;Pipeline 已配置 GDIM 运行上下文时可不连接。输出端口 -
OutputTables:补齐layer_number后的TableCollection;InputTables为空或无法解析 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
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
|
|
构造时可直接赋给 |
|
|
|
地层表在集合内的名称或标题。 |
|
|
|
新增地层编号列的字段内部名。 |
|
|
|
新增地层编号列的字段标题。 |
|
|
|
鉴权与项目定位信息;若未显式传入,模块会尝试从 pipeline 获取,也可通过 |
行为与错误说明
模块按
define_layer_fields与layer_table的 公共字段名 做 left join,从standard_layer_table取layer_number写回layer_table。layer_table已含layer_number_name或layer_number_title对应列时,发出warnings.warn并原样返回输入集合。GDIM 模板中
standard_layer_update.update_method不是"autoGeneration"时,发出warnings.warn并原样返回输入集合。layer_table或standard_layer_table缺失/为空、模板缺少standard_layer_update或define_layer_fields、define_layer_fields与layer_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按地层编号对TableData或TableCollection中的 layer 表排序,使用sort_layer_numbers自然排序规则(如1-3排在10-1前),可容忍部分非标准编号值。输入为
TableCollection时,仅对layer_table_name指定的表排序,集合内其余表原样保留。典型适用场景: 绘图、剖面、汇总或导出前统一层序顺序。
端口说明
输入端口 -
InputTable:TableData或TableCollection。输出端口 -
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
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
|
|
构造时可直接赋给 |
|
|
|
升序/降序;GDIM 界面通过 |
|
|
|
当输入为 |
|
|
|
地层编号列的字段内部名或字段标题。 |
行为与错误说明
排序基于
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
模块简介与适用场景
SliceTerrain按InputPolyLines定义的剖切线,从InputTerrainPoints地形点插值生成 三维地形线 与 **二维地形线**(桩号 + 高程)。典型适用场景:
地质剖面、地形剖面出图前,将散点地形与剖面线结合,得到沿剖迹的高程采样线;
与 CreatePolyLines、
GdimTerrainDataReader联用:前者提供剖切线顶点,后者或上游模块提供地形点。
常见下游模块:
ExportGeoSectionsByBores``(通过 ``InputTerrainLines接收三维地形线输出)。
端口说明
输入端口 -
InputTerrainPoints:地形点表(TableData)。须含x_coordinate、y_coordinate、z_coordinate``(或等价字段名/列标题);有效点至少 **3** 个。 - ``InputPolyLines:剖切线顶点表(TableData)。须含name、x_coordinate、y_coordinate;可选z_coordinate、bore_number。结构遵循PolyLinesTable。输出端口 -
OutputTerrainLines:三维地形线(TableData)。列包括name、x_coordinate、y_coordinate、z_coordinate、slice_point;输入剖切线含bore_number时输出保留该列(仅slice_point=True的行写入钻孔编号)。 -Output2DTerrainLines:二维地形线(TableData)。列包括name、chainage、z_coordinate、slice_point;bore_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
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
|
|
构造时可直接赋给 |
|
|
|
构造时可直接赋给 |
|
|
|
地形点 x/y/z 列标识(字段名或列标题),顺序为 x、y、z。为 |
|
|
|
剖切线相邻采样点的最大 水平 间距(米)。较长线段会先细分再插值高程;设为 |
Note
若
InputTerrainPoints或InputPolyLines为None,则两个输出端口均为None。地形点表为空、有效点不足 3 个,或
terrain_columns长度不为 3 时,抛出ValueError。slice_point为True的行对应剖切线 原始顶点;细分产生的中间采样点为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列表)。剖切线支持两种定义方式(由
InputPolyLines中bore_number列是否齐全决定,详见后文「剖切线定义方式说明」):钻孔定义:剖面线顶点即钻孔位置,按钻孔顺序生成剖面;
坐标点定义:剖面线为 XY 折线,需指定投影钻孔及可选的自定义投影坐标。
若
terrain_lines_required=True``(默认),须连接 ``InputTerrainLines``(通常来自 ``SliceTerrain);地形线与剖切线顶点 XY 须对齐。典型适用场景:GDIM / KCAD 地质剖面出图前,将钻孔、岩性、剖切线、地形线整合为
.gsc或下游AddBoreLogForGeoSections、GeoSectionsWriter可消费的结构化剖面数据。
端口说明
输入端口 -
InputMultiProfile1D:竖向钻孔数据(MultiProfile1D)。须含非空profiles_table与layers_table。 -InputMaterialTable:CAD 绘图用岩性表(MaterialTable)。 -InputPolyLines:剖切线顶点表(TableData)。须含name、x_coordinate、y_coordinate;可选bore_number。结构遵循PolyLinesTable。 -InputTerrainLines:沿剖切线的三维地形线(TableData),通常来自SliceTerrain.OutputTerrainLines。terrain_lines_required=True时为必填;须含name、x_coordinate、y_coordinate、slice_point等列(见TerrainLinesTable)。输出端口 -
OutputGeoSections:SectionForCadDraw对象列表;任一必填输入缺失或处理失败时为None。 -OutputGeoSections3D:Section3D对象列表;output_3d_sections=False或OutputGeoSections为None时为None。
剖切线定义方式说明
InputPolyLines 的解析模式由 PolyLinesTable.define_mode 自动判定:
模式 |
判定条件 |
主要参数 |
说明 |
|---|---|---|---|
``bores``(钻孔定义) |
每行 |
|
剖面线顶点顺序即钻孔顺序;考虑地形时,地形线与钻孔重合处高程以钻孔孔口为准。 |
``points``(坐标点定义) |
无 |
|
须连接非空 |
快速上手示例:在 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
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
各端口对应类型或 |
|
构造时可直接赋给对应输入端口;若为 |
|
|
|
是否使用地层编号; |
|
|
|
是否考虑地形线。 |
|
|
|
仅坐标点定义模式:剖面编号到待投影钻孔编号列表的映射。 |
|
|
|
仅坐标点定义模式:剖面编号到「钻孔编号 → (X, Y) 投影坐标」的映射;与 |
|
|
|
仅坐标点定义模式:是否将投影钻孔孔口高程与地形线对齐; |
|
|
|
是否生成 |
|
|
|
尖灭类型;当前仅支持 ``1``(孔上尖灭)。 |
|
|
|
是否合并相邻且 |
|
|
|
闭合区域计算用的网格步长。 |
|
|
|
闭合区域计算用的捕捉容差。 |
Note
InputMultiProfile1D、InputMaterialTable或InputPolyLines为None,或profiles_table/layers_table缺失时,两个输出均为None。terrain_lines_required=True且InputTerrainLines为None时,两个输出均为None。坐标点定义模式下
InputTerrainLines为空时,两个输出均为None。InputPolyLines为空或缺少必填列、同一条线顶点少于 2 个时,抛出ValueError。projected_bores、user_defined_projections、terrain_bores_alignment在 GDIM 界面上仅于坐标点定义模式可见(见update_ui_schema)。
在 pipeline 中的使用方式
与「快速上手示例:在 pipeline 中生成剖面」相同;常见做法是暴露 terrain_lines_required、projected_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="投影钻孔",
)
更多信息
上游:GIS 数据操作 中的
CreatePolyLines、本文SliceTerrain下游:
AddBoreLogForGeoSections``(补充柱状图信息)、``GeoSectionsWriter``(写出 ``.gsc)
AddBoreLogForGeoSections
模块简介与适用场景
AddBoreLogForGeoSections从InputTables读取钻孔、地层、原位测试、取样等表格数据,将 柱状图出图字段 合并进ExportGeoSectionsByBores已生成的SectionBore对象中。表格到
SectionBore的转换逻辑与 BoreLogDrawWriter 相同;模块仅按剖面中出现的bore_num筛选并转换对应钻孔。ExportGeoSectionsByBores已写入的剖面几何字段(如x_coord、top、elevations、depths、materials、layers_num、distance_to)在合并时 不会被表格数据覆盖。典型适用场景: KCAD 地质剖面
.gsc出图前,在剖面钻孔上叠加标贯、动探、静探、取样、岩土参数等柱状图信息,再经GeoSectionsWriter写出文件。
端口说明
输入端口 -
InputGeoSections:GeoSections``(``SectionForCadDraw列表)。通常来自ExportGeoSectionsByBores.OutputGeoSections,其中SectionBore已含剖面坐标与地层几何。 -InputTables:TableCollection。须含钻孔、地层及所需测试/取样/岩土参数表;字段映射见name_maps。输出端口 -
OutputGeoSections:合并柱状图信息后的GeoSections;InputGeoSections或InputTables为None时为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
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
|
|
构造时可直接赋给 |
|
|
|
构造时可直接赋给 |
|
|
``None``(空字典) |
柱状图 |
|
|
|
取样类型字符串到 KCAD 整数编码的映射,例如 |
Note
剖面中未出现
bore_num时,原样透传InputGeoSections。InputTables中找不到某bore_num时,模块发出warnings.warn,该SectionBore保持ExportGeoSectionsByBores输出不变。name_maps只需映射本模块要从表格读取的表与字段;剖面几何字段由上游ExportGeoSectionsByBores提供,无需在name_maps中重复配置。
在 pipeline 中的使用方式
典型链路:ExportGeoSectionsByBores → AddBoreLogForGeoSections → GeoSectionsWriter;InputTables 可与读表模块共用同一份 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
更多信息
上游:本文
ExportGeoSectionsByBores表格/字段映射参考:writers 模块帮助 中的
BoreLogDrawWriter下游:writers 模块帮助 中的
GeoSectionsWriter