transpose_weights#

regridding.transpose_weights(weights)[source]#

Transpose the sparse matrix of weights calculated by regridding.weights().

This function works by swapping the indices, \((i, j, w) \rightarrow (j, i, w)\).

Transposed weights can be used with regridding.regrid_from_weights() to perform a transform in the opposite direction.

Parameters:

weights (tuple[ndarray, tuple[int, ...], tuple[int, ...]]) – Ragged array of weights computed by regridding.weights().

Return type:

tuple[ndarray, tuple[int, …], tuple[int, …]]