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_format为pollutantConcentration的字段;include:仅处理concentration_fields中的字段;exclude:处理除concentration_fields外所有字段。- process_tableslist[str] | None, default: None
当
InputTable为TableCollection时,指定待处理的表名或表标题列表。 未指定时处理集合中的全部表;未出现在列表中的表保持原样输出。 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_tables或concentration_fields中配置的表或字段在InputTable中不存在时的处理方式。error抛出KeyError;warning输出UserWarning;gdi_warning输出GDIWarning并在 GDIM 中显示警告。 invalid_value_action : Literal[“error”, “drop_column”, “drop_row”, “to_nan”, “to_detect_limit”], default: “drop_row” 待处理列中出现无法识别的单元格值时的处理方式。error抛出ValueError;drop_column删除整列;drop_row删除整行;to_nan转为NaN;to_detect_limit转为detect_limit。 空字符串与None会转为NaN,不视为无效值。 invalid_warning_type : Literal[“warning”, “gdi_warning”], default: “gdi_warning” 当invalid_value_action不为error时,无效值处理告警的类型。warning输出UserWarning;gdi_warning输出GDIWarning并在 GDIM 中显示警告。 Ports- InputTablePortTypeHint.TableData | PortTypeHint.TableCollection
待处理为数字的污染物浓度值表或表集合。
- OutputTablePortTypeHint.TableData | PortTypeHint.TableCollection
处理为数字的污染物浓度值表或表集合。
Attributes:
- InputTable: PortReference[PortTypeHint.TableData | PortTypeHint.TableCollection]
- OutputTable: PortReference[PortTypeHint.TableData | PortTypeHint.TableCollection]