xarray.Dataset.pr.expand_dims

xarray.Dataset.pr.expand_dims#

Dataset.pr.expand_dims(dim: str, coord_value: str, terminology: str | None = None) Dataset#

Add a dimension and coordinate to dataset.

If a terminology is given, also adds it to attrs. Dimension has length 1. primap2 equivalent of xarray.Dataset.expand_dims().

To add a dimension to a PRIMAP2 DataArray use xarray.DataArray.expand_dims(). As PRIMAP2 DataArrays don’t have the coordinate information in the attributes, no additional code is needed.

Parameters:
dim

dimension to add. A coordinate with the same name will be added as well

coord_value

value for the coordinate

terminology

terminology of the dimension to add.

Returns:
with_dim

dataset with added dimension and coordinate