cf.RegridOperator.tosparse

RegridOperator.tosparse()[source]

Convert the weights to scipy sparse array format in-place.

The weights attribute is set to a Compressed Sparse Row (CSR) array (i.e. a scipy.sparse._arrays.csr_array instance) that combines the weights and the row and column indices, and the row and col attributes are set to None.

The dst_mask attribute is also updated to True for destination grid points for which the weights are all zero.

A CSR array is used as the most efficient sparse array type given that we expect no changes to the sparsity structure, and any further modification of the weights to account for missing values in the source grid will always involve row-slicing.

If the weights are already in a sparse array format then no action is taken.

New in version 3.13.0.

Returns

None