案例一:按所需深度筛选钻孔
案例概述
本案例演示了一个常见需求:从钻孔一览表中筛选出深度大于 20 m 的钻孔。
你将学到
将原始数据的表格交给 GdiSDK,然后通过标准查询模块快速得到结果。
用
gdisdk.dataclass.tables.TableData存储钻孔一览表的数据。用
FieldMetadata给字段补充标题与单位(可选)。用
TablesQuery按条件筛选钻孔数据,并从输出端口拿到结果表。理解
query_template的基本写法(如本例中的depth > 20)。
实现思路
准备钻孔数据(如 GDIM 中已有钻孔一览表可直接读取)。
将数据封装为
TableData,必要时补充FieldMetadata。创建
TablesQuery,设置query_template = "depth > 20"。从
OutputTables获取筛选后的结果。
关键代码
本例的关键在于对钻孔数据进行筛选,相应的代码如下。
table_data = TableData({...}, name="钻孔一览表")
table_data.update_fields_metadata([...])
query_table = TablesQuery("QueryTable")
query_table.query_template = "depth > 20"
query_table.InputTables = table_data
query_table.execute()
更进一步
完整代码请查看以下链接中的『案例一』: