MCPcopy Index your code
hub / github.com/pydata/xarray / dataset_repr

Function dataset_repr

xarray/core/formatting.py:777–811  ·  view source on GitHub ↗
(ds)

Source from the content-addressed store, hash-verified

775
776@recursive_repr("<recursive Dataset>")
777def dataset_repr(ds):
778 nbytes_str = render_human_readable_nbytes(ds.nbytes)
779 summary = [f"<xarray.{type(ds).__name__}> Size: {nbytes_str}"]
780
781 col_width = _calculate_col_width(ds.variables)
782 max_rows = OPTIONS["display_max_rows"]
783
784 dims_start = pretty_print("Dimensions:", col_width)
785 dims_values = dim_summary_limited(
786 ds.sizes, col_width=col_width + 1, max_rows=max_rows
787 )
788 summary.append(f"{dims_start}({dims_values})")
789
790 if ds.coords:
791 summary.append(coords_repr(ds.coords, col_width=col_width, max_rows=max_rows))
792
793 unindexed_dims_str = unindexed_dims_repr(ds.dims, ds.coords, max_rows=max_rows)
794 if unindexed_dims_str:
795 summary.append(unindexed_dims_str)
796
797 summary.append(data_vars_repr(ds.data_vars, col_width=col_width, max_rows=max_rows))
798
799 display_default_indexes = _get_boolean_with_default(
800 "display_default_indexes", False
801 )
802 xindexes = filter_nondefault_indexes(
803 _get_indexes_dict(ds.xindexes), not display_default_indexes
804 )
805 if xindexes:
806 summary.append(indexes_repr(xindexes, max_rows=max_rows))
807
808 if ds.attrs:
809 summary.append(attrs_repr(ds.attrs, max_rows=max_rows))
810
811 return "\n".join(summary)
812
813
814def dims_and_coords_repr(ds) -> str:

Callers

nothing calls this directly

Calls 12

typeFunction · 0.85
_calculate_col_widthFunction · 0.85
pretty_printFunction · 0.85
dim_summary_limitedFunction · 0.85
coords_reprFunction · 0.85
unindexed_dims_reprFunction · 0.85
indexes_reprFunction · 0.85
_get_indexes_dictFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…