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

Function _interval_to_double_bound_points

xarray/plot/utils.py:581–600  ·  view source on GitHub ↗

Helper function to deal with an xarray consisting of pd.Intervals. Each interval is replaced with both boundaries. I.e. the length of xarray doubles. yarray is modified so it matches the new shape of xarray.

(
    xarray: Iterable[pd.Interval], yarray: Iterable
)

Source from the content-addressed store, hash-verified

579
580
581def _interval_to_double_bound_points(
582 xarray: Iterable[pd.Interval], yarray: Iterable
583) -> tuple[np.ndarray, np.ndarray]:
584 """
585 Helper function to deal with an xarray consisting of pd.Intervals. Each
586 interval is replaced with both boundaries. I.e. the length of xarray
587 doubles. yarray is modified so it matches the new shape of xarray.
588 """
589
590 xarray1 = np.array([x.left for x in xarray])
591 xarray2 = np.array([x.right for x in xarray])
592
593 xarray_out = np.array(
594 list(itertools.chain.from_iterable(zip(xarray1, xarray2, strict=True)))
595 )
596 yarray_out = np.array(
597 list(itertools.chain.from_iterable(zip(yarray, yarray, strict=True)))
598 )
599
600 return xarray_out, yarray_out
601
602
603def _resolve_intervals_1dplot(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…