Iterates over all corresponding nodes, recording differences between data at each location.
(a: DataTree, b: DataTree, compat)
| 1138 | |
| 1139 | |
| 1140 | def diff_nodewise_summary(a: DataTree, b: DataTree, compat): |
| 1141 | """Iterates over all corresponding nodes, recording differences between data at each location.""" |
| 1142 | |
| 1143 | summary = [] |
| 1144 | for path, (node_a, node_b) in group_subtrees(a, b): |
| 1145 | a_ds, b_ds = node_a.dataset, node_b.dataset |
| 1146 | |
| 1147 | if not a_ds._all_compat(b_ds, compat): |
| 1148 | path_str = "root node" if path == "." else f"node {path!r}" |
| 1149 | dataset_diff = diff_dataset_repr(a_ds, b_ds, compat) |
| 1150 | data_diff = indent( |
| 1151 | "\n".join(dataset_diff.split("\n", 1)[1:]), prefix=" " |
| 1152 | ) |
| 1153 | nodediff = f"Data at {path_str} does not match:\n{data_diff}" |
| 1154 | summary.append(nodediff) |
| 1155 | |
| 1156 | return "\n\n".join(summary) |
| 1157 | |
| 1158 | |
| 1159 | def diff_datatree_repr(a: DataTree, b: DataTree, compat): |
no test coverage detected
searching dependent graphs…