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

Function decompose_interp

xarray/core/missing.py:846–875  ·  view source on GitHub ↗

Decompose the interpolation into a succession of independent interpolation keeping the order

(indexes_coords: SourceDest)

Source from the content-addressed store, hash-verified

844
845
846def decompose_interp(indexes_coords: SourceDest) -> Generator[SourceDest, None]:
847 """Decompose the interpolation into a succession of independent interpolation keeping the order"""
848
849 dest_dims = [
850 dest[1].dims if dest[1].ndim > 0 else (dim,)
851 for dim, dest in indexes_coords.items()
852 ]
853 partial_dest_dims: list[tuple[Hashable, ...]] = []
854 partial_indexes_coords: SourceDest = {}
855 for i, index_coords in enumerate(indexes_coords.items()):
856 partial_indexes_coords.update([index_coords])
857
858 if i == len(dest_dims) - 1:
859 break
860
861 partial_dest_dims += [dest_dims[i]]
862 other_dims = dest_dims[i + 1 :]
863
864 s_partial_dest_dims = {dim for dims in partial_dest_dims for dim in dims}
865 s_other_dims = {dim for dims in other_dims for dim in dims}
866
867 if not s_partial_dest_dims.intersection(s_other_dims):
868 # this interpolation is orthogonal to the rest
869
870 yield partial_indexes_coords
871
872 partial_dest_dims = []
873 partial_indexes_coords = {}
874
875 yield partial_indexes_coords

Callers 1

interpFunction · 0.85

Calls 2

itemsMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…