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

Method isel

xarray/core/dataset.py:2748–2901  ·  view source on GitHub ↗

Returns a new dataset with each array indexed along the specified dimension(s). This method selects values from each array using its `__getitem__` method, except this method does not require knowing the order of each array's dimensions. Parameters --

(
        self,
        indexers: Mapping[Any, Any] | None = None,
        drop: bool = False,
        missing_dims: ErrorOptionsWithWarn = "raise",
        **indexers_kwargs: Any,
    )

Source from the content-addressed store, hash-verified

2746 return attached_coords, attached_indexes
2747
2748 def isel(
2749 self,
2750 indexers: Mapping[Any, Any] | None = None,
2751 drop: bool = False,
2752 missing_dims: ErrorOptionsWithWarn = "raise",
2753 **indexers_kwargs: Any,
2754 ) -> Self:
2755 """Returns a new dataset with each array indexed along the specified
2756 dimension(s).
2757
2758 This method selects values from each array using its `__getitem__`
2759 method, except this method does not require knowing the order of
2760 each array's dimensions.
2761
2762 Parameters
2763 ----------
2764 indexers : dict, optional
2765 A dict with keys matching dimensions and values given
2766 by integers, slice objects or arrays.
2767 indexer can be a integer, slice, array-like or DataArray.
2768 If DataArrays are passed as indexers, xarray-style indexing will be
2769 carried out. See :ref:`indexing` for the details.
2770 One of indexers or indexers_kwargs must be provided.
2771 drop : bool, default: False
2772 If ``drop=True``, drop coordinates variables indexed by integers
2773 instead of making them scalar.
2774 missing_dims : {"raise", "warn", "ignore"}, default: "raise"
2775 What to do if dimensions that should be selected from are not present in the
2776 Dataset:
2777 - "raise": raise an exception
2778 - "warn": raise a warning, and ignore the missing dimensions
2779 - "ignore": ignore the missing dimensions
2780
2781 **indexers_kwargs : {dim: indexer, ...}, optional
2782 The keyword arguments form of ``indexers``.
2783 One of indexers or indexers_kwargs must be provided.
2784
2785 Returns
2786 -------
2787 obj : Dataset
2788 A new Dataset with the same contents as this dataset, except each
2789 array and dimension is indexed by the appropriate indexers.
2790 If indexer DataArrays have coordinates that do not conflict with
2791 this object, then these coordinates will be attached.
2792 In general, each array's data will be a view of the array's data
2793 in this dataset, unless vectorized indexing was triggered by using
2794 an array indexer, in which case the data will be a copy.
2795
2796 Examples
2797 --------
2798
2799 >>> dataset = xr.Dataset(
2800 ... {
2801 ... "math_scores": (
2802 ... ["student", "test"],
2803 ... [[90, 85, 92], [78, 80, 85], [95, 92, 98]],
2804 ... ),
2805 ... "english_scores": (

Callers 15

__getitem__Method · 0.95
selMethod · 0.95
headMethod · 0.95
tailMethod · 0.95
thinMethod · 0.95
dropnaMethod · 0.95
queryMethod · 0.95
drop_duplicatesMethod · 0.95
test_groupby_datasetFunction · 0.95
test_resampleMethod · 0.95

Calls 10

_isel_fancyMethod · 0.95
_construct_directMethod · 0.95
either_dict_or_kwargsFunction · 0.90
is_fancy_indexerFunction · 0.90
drop_dims_from_indexersFunction · 0.90
isel_indexesFunction · 0.90
itemsMethod · 0.80
valuesMethod · 0.45
copyMethod · 0.45
updateMethod · 0.45