xarray.DataArray.pr.convert

xarray.DataArray.pr.convert#

DataArray.pr.convert(dim: Hashable | str, *, conversion: Conversion, auxiliary_dimensions: dict[str, str] | None = None) DataArray#

Convert the data along the given dimension into the new categorization.

Maps the given dimension from one categorization (terminology) into another. Fetches the rules to do the mapping from the climate_categories package, and therefore will only work if there are conversions rules to convert from the current categorization to the new categorization. The input data must always be extensive (like, for example, total emissions in a year subdivided into multiple sectoral categories). Handling of intensive data (like, for example, average per-person emissions in a year subdivided into different territorial entities) is not supported.

Parameters:
dimstr

Dimension to convert. Has to be a dimension from da.dims.

conversionclimate_categories.Conversion

The conversion rules that describe the conversion from the old to the new categorization. Contains climate_categories.Categorization object for old and new categorization.

auxiliary_dimensionsdict[str, str], optional

Mapping of auxiliary categorizations to dimension names used in this DataArray. In conversions which contain rules which are valid only for certain orthogonal dimensions (e.g. a conversion between different sectoral terminologies, but some rules are only valid for specific countries), only the categorization is specified. Therefore, in this case you have to specify a mapping from categorization name to dimension name. Example: {“ISO3”: “area (ISO3)”}) .

Returns:
convertedxr.DataArray

A copy of the DataArray with the given dimension converted in the new categorization.