iwfm.diagnostics.detect_residual_clusters

iwfm.diagnostics.detect_residual_clusters(residual_summary, node_coords=None, z_threshold=2.0)[source]

Identify nodes with persistently high residuals.

If node_coords are provided, groups flagged nodes by spatial proximity. Otherwise returns a flat list of outlier nodes.

Parameters:
  • residual_summary (ResidualSummary) – From read_residual_hdf.

  • node_coords (list of (float, float), optional) – XY coordinates per node (1-indexed matching node_id).

  • z_threshold (float) – Z-score threshold for flagging outlier nodes.

Returns:

[{node_id, layer, mean_rhs, z_score, cluster_id?}]

Return type:

list of dict