modules.contaDataProcess

Classes

class modules.contaDataProcess.ContaDataToNumeric

将 TableData 或 TableCollection 中指定列的污染物浓度类字符串转为数值型。

Inherits from:

PipeModule

Methods:

__init__(mname: str = 'ContaDataToNumeric', auto_run: bool = True, table: PortTypeHint.TableData | PortTypeHint.TableCollection | None = None, process_type: Literal[auto, include, exclude] = 'auto', process_tables: list[str] | None = None, concentration_fields: list[str] | dict[str, list[str]] | None = None, missing_error_type: Literal[error, warning, gdi_warning] = 'error', invalid_value_action: Literal[error, drop_column, drop_row, to_nan, to_detect_limit] = 'error', invalid_warning_type: Literal[warning, gdi_warning] = 'gdi_warning', detect_limit: float = 0.0, less_than_multiplier: float = 0.5) None

初始化 ContaDataToNumeric 模块。

Parameters

tablesPortTypeHint.TableData | PortTypeHint.TableCollection | None, default: None

待处理为数字的污染物浓度值表或表集合。 process_type : Literal[“auto”, “include”, “exclude”], default: “auto” 字段选择模式。 auto:自动选择 data_formatpollutantConcentration 的字段; include:仅处理 concentration_fields 中的字段; exclude:处理除 concentration_fields 外所有字段。

process_tableslist[str] | None, default: None

InputTableTableCollection 时,指定待处理的表名或表标题列表。 未指定时处理集合中的全部表;未出现在列表中的表保持原样输出。 concentration_fields : list[str] | dict[str, list[str]] | None, default: None 参与 include/exclude 模式的字段名或字段标题列表。

  • TableData + list[str]:作用于该表。

  • TableData + dict[str, list[str]]:键必须为表名或表标题。

  • TableCollection + dict[str, list[str]]:键为各表表名或表标题,

值为对应表需参与 include/exclude 的字段列表。

  • TableCollection + list[str]:对 process_tables 中各表使用同一字段列表。

detect_limitfloat, default: 0.0

第二类特殊字符串(如 nd小于检出限)对应的数值。

less_than_multiplierfloat, default: 0.5

<数字 形式字符串的换算系数,最终值为该系数乘以 < 后的数字。 missing_error_type : Literal[“error”, “warning”, “gdi_warning”], default: “error” 当 process_tablesconcentration_fields 中配置的表或字段在 InputTable 中不存在时的处理方式。 error 抛出 KeyErrorwarning 输出 UserWarninggdi_warning 输出 GDIWarning 并在 GDIM 中显示警告。 invalid_value_action : Literal[“error”, “drop_column”, “drop_row”, “to_nan”, “to_detect_limit”], default: “drop_row” 待处理列中出现无法识别的单元格值时的处理方式。 error 抛出 ValueErrordrop_column 删除整列;drop_row 删除整行; to_nan 转为 NaNto_detect_limit 转为 detect_limit。 空字符串与 None 会转为 NaN,不视为无效值。 invalid_warning_type : Literal[“warning”, “gdi_warning”], default: “gdi_warning” 当 invalid_value_action 不为 error 时,无效值处理告警的类型。 warning 输出 UserWarninggdi_warning 输出 GDIWarning 并在 GDIM 中显示警告。 Ports

InputTablePortTypeHint.TableData | PortTypeHint.TableCollection

待处理为数字的污染物浓度值表或表集合。

OutputTablePortTypeHint.TableData | PortTypeHint.TableCollection

处理为数字的污染物浓度值表或表集合。

update_ui_schema(reset: bool = False) dict[str, UIAttributeSchema]
execute() PortTypeHint.TableData | PortTypeHint.TableCollection | None

Attributes:

InputTable: PortReference[PortTypeHint.TableData | PortTypeHint.TableCollection]
OutputTable: PortReference[PortTypeHint.TableData | PortTypeHint.TableCollection]