Sort key for coordinate ordering. Orders by: 1. Primary: index of the matching dimension in dataset dims. 2. Secondary: dimension coordinates (name == dim) come before non-dimension coordinates This groups non-dimension coordinates right after their associated dimen
(coord, dims)
| 444 | |
| 445 | |
| 446 | def _coord_sort_key(coord, dims): |
| 447 | """Sort key for coordinate ordering. |
| 448 | |
| 449 | Orders by: |
| 450 | 1. Primary: index of the matching dimension in dataset dims. |
| 451 | 2. Secondary: dimension coordinates (name == dim) come before non-dimension coordinates |
| 452 | |
| 453 | This groups non-dimension coordinates right after their associated dimension |
| 454 | coordinate. |
| 455 | """ |
| 456 | name, var = coord |
| 457 | |
| 458 | # Dimension coordinates come first within their dim section |
| 459 | if name in dims: |
| 460 | return (dims.index(name), 0) |
| 461 | |
| 462 | # Non-dimension coordinates come second within their dim section |
| 463 | # Check the var.dims list in backwards order to put (x, y) after (x) and (y) |
| 464 | for d in var.dims[::-1]: |
| 465 | if d in dims: |
| 466 | return (dims.index(d), 1) |
| 467 | |
| 468 | # Scalar coords or coords with dims not in dataset dims go at the end |
| 469 | return (len(dims), 1) |
| 470 | |
| 471 | |
| 472 | def coords_repr(coords: AbstractCoordinates, col_width=None, max_rows=None): |
nothing calls this directly
no test coverage detected
searching dependent graphs…