| 6 | |
| 7 | |
| 8 | class XArrayInteractive(Interactive): |
| 9 | @classmethod |
| 10 | def applies(cls, obj): |
| 11 | return isinstance(obj, (xr.DataArray, xr.Dataset)) |
| 12 | |
| 13 | def sel(self, **kwargs): |
| 14 | processed = {} |
| 15 | for k, v in kwargs.items(): |
| 16 | if isinstance(v, type) and issubclass(v, Widget): |
| 17 | if hasattr(v, 'end'): |
| 18 | values = self._current[k].values |
| 19 | v = v(name=k, start=values.min(), end=values.max()) |
| 20 | if hasattr(v, 'options'): |
| 21 | v = v(name=k, options={str(v): v for v in self._current[k].values}) |
| 22 | processed[k] = v |
| 23 | self._method = 'sel' |
| 24 | return self.__call__(**processed) |
| 25 | |
| 26 | sel.__doc__ = xr.DataArray.sel.__doc__ |
| 27 | |
| 28 | def isel(self, **kwargs): |
| 29 | processed = {} |
| 30 | for k, v in kwargs.items(): |
| 31 | if isinstance(v, type) and issubclass(v, Widget): |
| 32 | if hasattr(v, 'end'): |
| 33 | v = v(name=k, end=len(self._current[k])) |
| 34 | processed[k] = v |
| 35 | self._method = 'isel' |
| 36 | return self.__call__(**processed) |
| 37 | |
| 38 | isel.__doc__ = xr.DataArray.isel.__doc__ |
| 39 | |
| 40 | |
| 41 | def patch(name='hvplot', interactive='interactive', extension='bokeh', logo=False): |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…