convert_array

earthkit.utils.units.convert_array(data: Any, target_units: str | Unit | Units | dict[str, str | Unit | Units] | None = None, source_units: str | Unit | Units | dict[str, str | Unit | Units] | None = None) Any[source]

Convert data from one set of units to another.

Parameters:
  • data (array-like) – The data to convert.

  • target_units (str) – The units to convert to.

  • source_units (str) – The units of the data.

Returns:

The converted data, or the original data if conversion is not possible.

Return type:

array-like