convert

earthkit.utils.array.convert(array, *, device=None, array_namespace=None, **kwargs)[source]

Return a copy/view of a converted array.

Parameters:
  • array (array) – The array to convert.

  • device (array namespace-specific device spec or str) – The device to which the array should be moved. For example, “cpu”, “cuda:0”, etc.

  • array_namespace (str or array namespace) –

    The array namespace to use for the conversion. If None, the following logic is applied: - if the device is “cpu”, it will use numpy - otherwise it will use the namespace of the array v, but if that

    backend is numpy, it will use the cupy backend.

  • **kwargs – forwarded to the underlying call