@@ -154,7 +154,7 @@ Here is a small example of a meta-index for geospatial, raster datasets (i.e.,
154154regularly spaced 2-dimensional data) that internally relies on two
155155``PandasIndex `` instances for the x and y dimensions respectively:
156156
157- .. code-block :: python
157+ .. jupyter-execute ::
158158
159159 from xarray import Index
160160 from xarray.core.indexes import PandasIndex
@@ -172,11 +172,12 @@ regularly spaced 2-dimensional data) that internally relies on two
172172 self._xy_indexes = xy_indexes
173173
174174 @classmethod
175- def from_variables (cls , variables ):
175+ def from_variables(cls, variables, * , options ):
176176 assert len(variables) == 2
177177
178178 xy_indexes = {
179- k: PandasIndex.from_variables({k: v}) for k, v in variables.items()
179+ k: PandasIndex.from_variables({k: v}, options=options)
180+ for k, v in variables.items()
180181 }
181182
182183 return cls(xy_indexes)
@@ -213,7 +214,7 @@ How to use a custom index
213214You can use :py:meth: `Dataset.set_xindex ` or :py:meth: `DataArray.set_xindex ` to assign a
214215custom index to a Dataset or DataArray, e.g., using the ``RasterIndex `` above:
215216
216- .. code-block :: python
217+ .. jupyter-execute ::
217218
218219 import numpy as np
219220 import xarray as xr
@@ -231,3 +232,4 @@ custom index to a Dataset or DataArray, e.g., using the ``RasterIndex`` above:
231232
232233 # RasterIndex now takes care of label-based selection
233234 selected = da_raster.sel(x=10, y=slice(20, 50))
235+ selected
0 commit comments