Partial Dataset repr for use inside DataTree inheritance errors.
(ds)
| 812 | |
| 813 | |
| 814 | def dims_and_coords_repr(ds) -> str: |
| 815 | """Partial Dataset repr for use inside DataTree inheritance errors.""" |
| 816 | summary = [] |
| 817 | |
| 818 | col_width = _calculate_col_width(ds.coords) |
| 819 | max_rows = OPTIONS["display_max_rows"] |
| 820 | |
| 821 | dims_start = pretty_print("Dimensions:", col_width) |
| 822 | dims_values = dim_summary_limited( |
| 823 | ds.sizes, col_width=col_width + 1, max_rows=max_rows |
| 824 | ) |
| 825 | summary.append(f"{dims_start}({dims_values})") |
| 826 | |
| 827 | if ds.coords: |
| 828 | summary.append(coords_repr(ds.coords, col_width=col_width, max_rows=max_rows)) |
| 829 | |
| 830 | unindexed_dims_str = unindexed_dims_repr(ds.dims, ds.coords, max_rows=max_rows) |
| 831 | if unindexed_dims_str: |
| 832 | summary.append(unindexed_dims_str) |
| 833 | |
| 834 | return "\n".join(summary) |
| 835 | |
| 836 | |
| 837 | def diff_name_summary(a, b) -> str: |
no test coverage detected
searching dependent graphs…