modules.geoDataProcess 模块帮助
本章节包含 modules.geoDataProcess 中与地质 / 钻孔 / 剖面数据处理相关的模块说明,例如:
按剖切线从地形点插值生成三维及二维地形线(
SliceTerrain)按钻孔与剖切线导出 CAD 用地质剖面(
ExportGeoSectionsByBores)为地质剖面钻孔补充柱状图信息(
AddBoreLogForGeoSections)地层编号补齐、按地层编号排序
按孔口高程补全分层表的层厚、层顶/层底深度和高程(
CompleteLayerTable)按参考规范计算标准贯入表或动力触探表的修正击数(
CalculateCorrectedBlowCount)钻孔类型 KCAD 映射等
MapBoreTypeToKCAD
模块简介与适用场景
MapBoreTypeToKCAD将钻孔一览表中的「钻孔类型」字段值映射为 KCAD(AutoCAD/中望CAD出图插件)所使用的标准钻孔类型名称。映射关系并非写死在代码里,而是通过 GDIM API 按当前 项目 ID 拉取;项目在 GDIM 中维护对照表时,Pipeline 可自动同步为最新映射。
对照表未覆盖的取值会**保留原单元格内容**,并通过
GDIDataQualityWarning提示(详见后文「行为与错误说明」),便于在 GDIM 中核对后再补全项目映射或修正源数据。典型适用场景: 钻孔布置图、平面图等下游 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`` 输入时有效:集合内钻孔表名称或标题。单 |
|
|
|
待映射列的字段内部名或字段标题,未找到时抛出 |
|
|
|
鉴权与平台地址。构造器若设置 |
行为与错误说明
模块按 GDIM 项目「钻孔类型映射」对照表(
get_bore_type_mapping)对钻孔类型列做Series.replace:对照表中存在的 源类型名称 会被替换为对应的 KCAD 标准名称。对照表中**没有**的取值不会被清空或改为缺失值,保留输入时的原字符串;若列中仍存在无法映射为 KCAD 标准钻孔类型的取值,会发出 ``GDIDataQualityWarning``(可在 GDIM 界面查看),并在消息中列出未映射的类型,便于补全项目对照表或修正钻孔一览表数据。
若项目在 GDIM 中尚未配置任何钻孔类型映射,
get_bore_type_mapping会返回空对照表并输出控制台提示,此时整列保持原样。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
更多信息
CompleteLayerTable
模块简介与适用场景
CompleteLayerTable读取TableCollection中的钻孔表与地层表,把地层表补成同时包含layer_thickness、layer_bottom_depth、layer_top_elevation、layer_bottom_elevation、layer_top_depth五列。bore_table_name与layer_table_name用表名或表标题指定钻孔表和地层表,默认是bore_table、layer_table。bore_table需要字段名bore_number与bore_top。layer_table需要字段名bore_number,以及reference_column指定的参考列。参考列只能是layer_bottom_depth``(默认)、``layer_thickness或layer_bottom_elevation。layer_top_depth和layer_top_elevation由参考列算出,不能作为参考列。列只按字段名匹配。参考列是唯一依据,其余四个层位列按它重算,因此与参考列矛盾的原值会被覆盖。参考列不能有空值,地层表中的钻孔也必须在钻孔表中有孔口高程,否则抛出中文
ValueError。默认按地层表当前行序视为从上到下。order_by_reference=True时,层底深度按从小到大、层底高程按从大到小排序后再计算,结果仍写回原行;层厚没有上下方向,仍按当前行序。深度与高程用孔口高程互换。首层顶面深度按 0 计。典型适用场景: 分层表只录入了层底深度或层厚,下游统计、剖面或出图需要层顶、层底的深度和高程同时存在。
端口说明
输入端口 -
InputTables:TableCollection,须含钻孔表与地层表。默认表名或表标题为bore_table、layer_table。输出端口 -
OutputTables:补全层位列后的TableCollection。InputTables为空时为None。
快速上手示例:由层底深度补全层位
from gdisdk.dataclass.tables import TableCollection, TableData
from gdisdk.modules.geoDataProcess import CompleteLayerTable
bore_table = TableData(
{"bore_number": ["BH1"], "bore_top": [20.0]},
name="bore_table",
)
layer_table = TableData(
{"bore_number": ["BH1", "BH1"], "layer_bottom_depth": [2.0, 5.0]},
name="layer_table",
)
tables = TableCollection()
tables.add_table(bore_table)
tables.add_table(layer_table)
complete = CompleteLayerTable(mname="CompleteLayers", reference_column="layer_bottom_depth")
complete.InputTables = tables
complete.execute()
out = complete.OutputTables.data
layers = out.get_table("layer_table")
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
|
|
构造时可直接赋给 |
|
|
|
钻孔表的表名或表标题。 |
|
|
|
地层表的表名或表标题。 |
|
|
|
作为计算依据的层位字段名。只能是 |
|
|
|
为 |
行为与错误说明
新增列的字段标题取自
GeoResults:层厚「地层厚度」、层底深度「层底深度」、层顶高程「层顶高程」、层底高程「层底高程」、层顶深度「层顶深度」,单位为 m。换算关系:
layer_top_elevation = bore_top - layer_top_depth,layer_bottom_elevation = bore_top - layer_bottom_depth,layer_thickness = layer_bottom_depth - layer_top_depth。除参考列外,这些结果会覆盖原值。同一钻孔内,上一层的层底即下一层的层顶。默认按当前行序从上到下。
order_by_reference为True时,层底深度按从小到大排序,层底高程按从大到小排序,然后再推算。结果仍写回原行。首层顶面深度按 0 计。先确认钻孔表和地层表存在,并检查必要字段,再深拷贝整个
TableCollection后写入地层表。输入集合不会被修改。找不到
bore_table_name或layer_table_name、两个参数指向同一张表、缺少bore_number或bore_top、reference_column不是layer_thickness、layer_bottom_depth、layer_bottom_elevation之一,或地层表没有该参考列时,抛出ValueError。参考列存在空值时,抛出中文ValueError。钻孔表中钻孔编号为空或重复时,抛出中文
ValueError。地层表中钻孔编号为空、钻孔在钻孔表中不存在,或对应孔口高程为空时,同样抛出中文ValueError,不输出结果。
在 pipeline 中的使用方式
from gdisdk.pipeline.pipeline import PipeLine
from gdisdk.modules.readers import GdimTableReader
from gdisdk.modules.geoDataProcess import CompleteLayerTable
pipe = PipeLine(app_name="CompleteLayerDemo", app_title="补全地层层位示例")
pipe.update_gdim_state(token="你的GDIM Token", proj_id="你的GDIM项目ID")
read_tables = GdimTableReader("ReadTables")
read_tables.table_fields = ["bore_table", "layer_table"]
complete_layers = CompleteLayerTable("CompleteLayers")
links = read_tables.OutputTables >> complete_layers.InputTables
pipe.add_links(links)
pipe.run()
out_tables = complete_layers.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列表)。输出的SectionBore/SectionMaterial字段名与 GDIM 保留字段名一致(v0.3.4+),经GeoSectionsWriter写入.gsc时不再使用旧的缩写逻辑名。剖切线支持两种定义方式(由
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 相同(保留表名/字段名与 v0.3.4+.gscJSON 一致);模块仅按剖面中出现的bore_number筛选并转换对应钻孔。ExportGeoSectionsByBores已写入的剖面几何字段(bore_mileage、bore_top、layer_bottom_elevation、layer_bottom_depth、material_id、layer_number、offset_distance)在合并时 不会被表格数据覆盖。典型适用场景: KCAD 地质剖面
.gsc出图前,在剖面钻孔上叠加标贯、动探、静探、取样、岩土参数等柱状图信息,再经GeoSectionsWriter写出文件。
端口说明
输入端口 -
InputGeoSections:GeoSections``(``SectionForCadDraw列表)。通常来自ExportGeoSectionsByBores.OutputGeoSections,其中SectionBore已含剖面坐标与地层几何。 -InputTables:TableCollection。须含钻孔、地层及所需测试/取样/岩土参数表;表结构为标准 GDIM 保留名时可省略name_maps``(可选 ``sonic_logging_table、sampling_log_table、proposed_geotechnical_parameters_table等,规则同BoreLogDrawWriter)。输出端口 -
OutputGeoSections:合并柱状图信息后的GeoSections;InputGeoSections或InputTables为None时为None。
快速上手示例:补充剖面钻孔柱状图信息
from gdisdk.modules.geoDataProcess import AddBoreLogForGeoSections
add_bore_log = AddBoreLogForGeoSections(mname="AddBoreLog")
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``(空字典) |
输入表未使用 GDIM 保留名时的表/字段映射( |
|
|
|
取样类型字符串到 KCAD 整数编码的映射,例如 |
Note
剖面中未出现
bore_number时,原样透传InputGeoSections。InputTables中找不到某bore_number时,模块发出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"
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
CalculateCorrectedBlowCount
模块简介与适用场景
CalculateCorrectedBlowCount按所选参考规范,为标准贯入表或动力触探表逐行计算修正击数,写入 ``corrected_blow_count``(修正击数)。当前只实现《岩土工程勘察规范》GB 50021-2001(2009 年版):标贯按钻杆长度取校正系数;重型动力触探按杆长与换算击数查表 B.0.1;轻型、超重型直接采用实测击数。系数表与跳过规则见后文「计算规则说明」。
模块用表的
name``(或 ``table_name)识别表种,只接受spt_table、dpt_table。参与计算的列只按字段内部名读取。某一行缺少击数、缺少总杆长,或动探类型无法识别时,该行不写入新的修正击数,并发出GDIWarning。典型适用场景: 统计、承载力估算或报告引用修正击数之前,把实测击数换算后写回试验表。
端口说明
输入端口 -
InputTable:TableData。表名须为 ``spt_table``(标准贯入表)或 ``dpt_table``(动力触探表)。输出端口 -
OutputTable:写入corrected_blow_count后的试验表。InputTable为None或空表时为None。
快速上手示例:计算标贯修正击数
from gdisdk.dataclass.tables import TableData
from gdisdk.modules.geoDataProcess import CalculateCorrectedBlowCount
spt = TableData(
{
"bore_number": ["ZK1"],
"blow_count": [18],
"penetration_depth": [0.30],
"total_rod_length": [6.5],
},
name="spt_table",
)
calc = CalculateCorrectedBlowCount(mname="CorrectBlow")
calc.reference_standard = "gb50021"
calc.InputTable = spt
calc.execute()
out = calc.OutputTable.data
动力触探表同样接入 InputTable,表名设为 dpt_table,并提供 ``dpt_type``(动探类型)。
参数说明
参数名 |
类型 |
默认值 |
说明 |
|---|---|---|---|
|
|
|
构造时可直接赋给 |
|
|
|
参考规范代码。GDIM 界面标题为「参考规范」,当前可选项只有 |
输入字段
列名使用字段内部名。下表标题是 GDIM 保留字段的常见标题,模块不按标题匹配。
字段内部名 |
常见标题 |
适用表 |
作用 |
|---|---|---|---|
|
击数 |
标贯、动探 |
实测击数。缺失时跳过该行。 |
|
总杆长(m) |
标贯、重型动探 |
钻杆长度。缺失、无法转为数字或小于 0 时跳过该行。轻型、超重型不使用。 |
|
贯入深度 |
标贯、重型动探 |
实际贯入距离。缺失或非正时按标准贯入距离计。 |
|
动探类型 |
动探 |
区分轻型、重型、超重型。为空时按重型处理。 |
|
修正击数 |
标贯、动探 |
结果列。表中没有该列时新增;跳过的行保留原值,新列中为空。 |
bore_number、spt_number、dpt_number、test_point_top_depth 只用于警告中的行标识,不参与计算。
计算规则说明
规范为 GB 50021-2001(2009 年版)。标贯与重型动力触探:
修正击数 = round(α × N', 2)
N' = 击数 × (标准贯入距离 / 实际贯入距离)
标贯标准贯入距离为 0.30 m,重型动力触探为 0.10 m。
penetration_depth的数值大于 1 时按厘米换算为米(除以 100),否则按米。因此30与0.30都表示 0.30 m。空值、非数或小于等于 0 时,按上一条的标准贯入距离计,并发出GDIWarning。
标贯校正系数 α 只随钻杆长度变化,相邻表列之间线性内插。杆长小于等于 3 m 时 α 为 1.00;大于 21 m 时按 21 m 取值,并在警告中说明。
钻杆长度 L (m) |
≤3 |
6 |
9 |
12 |
15 |
18 |
21 |
|---|---|---|---|---|---|---|---|
α |
1.00 |
0.92 |
0.86 |
0.81 |
0.77 |
0.73 |
0.70 |
重型动力触探的 α 取自规范表 B.0.1,按杆长与 N’ 双线性内插。杆长限制在 2–20 m,N’ 限制在 5–50;超出端点时用端点系数,不再另发警告。
杆长 L (m) |
N’=5 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
50 |
|---|---|---|---|---|---|---|---|---|---|
2 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
1.00 |
4 |
0.96 |
0.95 |
0.93 |
0.92 |
0.90 |
0.89 |
0.87 |
0.86 |
0.84 |
6 |
0.93 |
0.90 |
0.88 |
0.85 |
0.83 |
0.81 |
0.79 |
0.78 |
0.75 |
8 |
0.90 |
0.86 |
0.83 |
0.80 |
0.77 |
0.75 |
0.73 |
0.71 |
0.67 |
10 |
0.88 |
0.83 |
0.79 |
0.75 |
0.72 |
0.69 |
0.67 |
0.64 |
0.61 |
12 |
0.85 |
0.79 |
0.75 |
0.70 |
0.67 |
0.64 |
0.61 |
0.59 |
0.55 |
14 |
0.82 |
0.76 |
0.71 |
0.66 |
0.62 |
0.58 |
0.56 |
0.53 |
0.50 |
16 |
0.79 |
0.73 |
0.67 |
0.62 |
0.57 |
0.54 |
0.51 |
0.48 |
0.45 |
18 |
0.77 |
0.70 |
0.63 |
0.57 |
0.53 |
0.49 |
0.46 |
0.43 |
0.40 |
20 |
0.75 |
0.67 |
0.59 |
0.53 |
0.48 |
0.44 |
0.41 |
0.39 |
0.36 |
动探类型按下面顺序识别:
含「轻型」或
N10:轻型。修正击数等于实测击数保留两位小数,不做贯入距离换算和杆长修正,并给出说明性警告。含「超重型」或
N120:超重型。同样直接采用实测击数并保留两位小数,不发警告。等于「重型动力触探」、含「重型」,或含
N63.5/N63:重型,按表 B.0.1 修正。dpt_type为空时也按重型处理。其余取值:无法识别,跳过该行并警告。
因此 GDIM 中的「轻型动力触探」「重型动力触探」「超重型动力触探」分别对应轻型、重型、超重型。
行为与错误说明
输出是输入表的深拷贝,不修改
InputTable。表名不是
spt_table或dpt_table时,发出GDIWarning并返回副本,不计算、也不新增corrected_blow_count。reference_standard不是已实现的规范时,同样警告并返回副本。可计算的行写入两位小数的修正击数。跳过的行保留该列原值;列是本次新增时,这些单元格为空。
InputTable为None或空表时,OutputTable为None。
在 pipeline 中的使用方式
先从 GDIM 表集合中取出 spt_table 或 dpt_table,再接入本模块。reference_standard 可暴露到 GDIM 界面。
from gdisdk.pipeline.pipeline import PipeLine
from gdisdk.modules.filters import TableSelector
from gdisdk.modules.geoDataProcess import CalculateCorrectedBlowCount
from gdisdk.modules.readers import GdimTableReader
pipe = PipeLine(app_name="CorrectedBlowDemo", app_title="修正击数计算示例")
pipe.update_gdim_state(token="你的GDIM Token", proj_id="你的GDIM项目ID")
reader = GdimTableReader("ReadTables")
reader.table_fields = ["spt_table"]
pick = TableSelector("PickSpt")
pick.table_name = "spt_table"
calc = CalculateCorrectedBlowCount("CorrectBlow")
links = (
reader.OutputTables >> pick.InputTables
| pick.OutputTable >> calc.InputTable
)
pipe.add_links(links)
pipe.add_attribute(
attr_name="reference_standard",
module_name="CorrectBlow",
param_name="reference_standard",
attr_title="参考规范",
)
pipe.run()
out = calc.OutputTable.data
更多信息
从表集合取出单表:filters 模块帮助 中的
TableSelector