MCPcopy Index your code
hub / github.com/pydata/xarray / rename_vars

Method rename_vars

xarray/core/coordinates.py:852–873  ·  view source on GitHub ↗

Returns a new object with renamed variables. Parameters ---------- name_dict : dict-like, optional Dictionary whose keys are current variable or coordinate names and whose values are the desired names. **names : optional Keyword fo

(
        self,
        name_dict: Mapping[Any, Hashable] | None = None,
        **names: Hashable,
    )

Source from the content-addressed store, hash-verified

850 return cast(Self, self.to_dataset().rename_dims(dims_dict, **dims).coords)
851
852 def rename_vars(
853 self,
854 name_dict: Mapping[Any, Hashable] | None = None,
855 **names: Hashable,
856 ) -> Coordinates:
857 """Returns a new object with renamed variables.
858
859 Parameters
860 ----------
861 name_dict : dict-like, optional
862 Dictionary whose keys are current variable or coordinate names and
863 whose values are the desired names.
864 **names : optional
865 Keyword form of ``name_dict``.
866 One of name_dict or names must be provided.
867
868 Returns
869 -------
870 renamed : Coordinates
871 Coordinates object with renamed variables
872 """
873 return cast(Self, self.to_dataset().rename_vars(name_dict, **names).coords)
874
875
876class DatasetCoordinates(Coordinates):

Callers 1

test_rename_varsMethod · 0.95

Calls 1

to_datasetMethod · 0.95

Tested by 1

test_rename_varsMethod · 0.76