(arr)
| 326 | |
| 327 | |
| 328 | def array_repr(arr) -> str: |
| 329 | dims = OrderedDict((k, v) for k, v in zip(arr.dims, arr.shape, strict=True)) |
| 330 | if hasattr(arr, "xindexes"): |
| 331 | indexed_dims = arr.xindexes.dims |
| 332 | else: |
| 333 | indexed_dims = {} |
| 334 | |
| 335 | obj_type = f"xarray.{type(arr).__name__}" |
| 336 | arr_name = escape(repr(arr.name)) if getattr(arr, "name", None) else "" |
| 337 | |
| 338 | header_components = [ |
| 339 | f"<div class='xr-obj-type'>{obj_type}</div>", |
| 340 | f"<div class='xr-obj-name'>{arr_name}</div>", |
| 341 | format_dims(dims, indexed_dims), |
| 342 | ] |
| 343 | |
| 344 | sections = [array_section(arr)] |
| 345 | |
| 346 | if hasattr(arr, "coords"): |
| 347 | if arr.coords: |
| 348 | sections.append(coord_section(arr.coords)) |
| 349 | |
| 350 | if hasattr(arr, "xindexes"): |
| 351 | display_default_indexes = _get_boolean_with_default( |
| 352 | "display_default_indexes", False |
| 353 | ) |
| 354 | xindexes = filter_nondefault_indexes( |
| 355 | _get_indexes_dict(arr.xindexes), not display_default_indexes |
| 356 | ) |
| 357 | if xindexes: |
| 358 | indexes = _get_indexes_dict(arr.xindexes) |
| 359 | sections.append(index_section(indexes)) |
| 360 | |
| 361 | if arr.attrs: |
| 362 | sections.append(attr_section(arr.attrs)) |
| 363 | |
| 364 | return _obj_repr(arr, header_components, sections) |
| 365 | |
| 366 | |
| 367 | def dataset_repr(ds) -> str: |
nothing calls this directly
no test coverage detected
searching dependent graphs…