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

Function _coord_sort_key

xarray/core/formatting.py:446–469  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

444
445
446def _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
472def coords_repr(coords: AbstractCoordinates, col_width=None, max_rows=None):

Callers

nothing calls this directly

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…