convert_dataset¶
- earthkit.utils.units.convert_dataset(data: xarray.Dataset, target_units: str | Unit | Units | dict[str, str | Unit | Units] | None = None, source_units: str | Unit | Units | dict[str, str | Unit | Units] | None = None) xarray.Dataset[source]¶
Convert the units of variables in an xarray.Dataset.
- Parameters:
data (xarray.Dataset) – The Dataset to convert.
target_units (str) – The units to convert to.
source_units (str, optional) – The units to match. If None, any variable with units compatible with
target_unitswill be converted. If provided, only variables whose current units matchsource_unitswill be converted.
- Returns:
The converted Dataset.
- Return type: