numpy_fallback

function of dascore.utils.patch source

numpy_fallback(
    name ,
    data ,
    func ,
    args = (),
    kwargs = None,
    stacklevel = 4,
)

Apply a function numpy can perform but the patch’s backend cannot.

Every patch and array argument is converted to numpy, the function is applied, and a patch it returns is converted back to the backend of data. Used wherever dascore meets an operation the array API standard cannot express.

Parameters

Parameter Description
name The name of the operation, used in the warning.
data The array whose backend the output should end up on.
func The function to apply.
args Positional arguments for func; patches and arrays are converted.
kwargs Keyword arguments for func; patches and arrays are converted.
stacklevel The stack level, as understood by warnings.warn, of the caller.