MCPcopy
hub / github.com/pydata/xarray / drop_vars

Method drop_vars

xarray/core/coordinates.py:773–801  ·  view source on GitHub ↗

Drop variables from this Coordinates object. Note that indexes that depend on these variables will also be dropped. Parameters ---------- names : hashable or iterable or callable Name(s) of variables to drop. If a callable, this is object is passed as it

(
        self,
        names: str
        | Iterable[Hashable]
        | Callable[
            [Coordinates | Dataset | DataArray | DataTree],
            str | Iterable[Hashable],
        ],
        *,
        errors: ErrorOptions = "raise",
    )

Source from the content-addressed store, hash-verified

771 )
772
773 def drop_vars(
774 self,
775 names: str
776 | Iterable[Hashable]
777 | Callable[
778 [Coordinates | Dataset | DataArray | DataTree],
779 str | Iterable[Hashable],
780 ],
781 *,
782 errors: ErrorOptions = "raise",
783 ) -> Self:
784 """Drop variables from this Coordinates object.
785
786 Note that indexes that depend on these variables will also be dropped.
787
788 Parameters
789 ----------
790 names : hashable or iterable or callable
791 Name(s) of variables to drop. If a callable, this is object is passed as its
792 only argument and its result is used.
793 errors : {"raise", "ignore"}, default: "raise"
794 Error treatment.
795
796 - ``'raise'``: raises a :py:class:`ValueError` error if any of the variable
797 passed are not in the dataset
798 - ``'ignore'``: any given names that are in the dataset are dropped and no
799 error is raised.
800 """
801 return cast(Self, self.to_dataset().drop_vars(names, errors=errors).coords)
802
803 def drop_dims(
804 self,

Callers 1

test_drop_varsMethod · 0.95

Calls 1

to_datasetMethod · 0.95

Tested by 1

test_drop_varsMethod · 0.76