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

Method swappable_dims

properties/test_index_manipulation.py:227–241  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

225
226 @property
227 def swappable_dims(self):
228 ds = self.dataset
229 options = []
230 for dim in self.indexed_dims:
231 choices = [
232 name
233 for name, var in ds._variables.items()
234 if var.dims == (dim,)
235 # TODO: Avoid swapping a dimension to itself
236 and name != dim
237 ]
238 options.extend(
239 (a, b) for a, b in itertools.zip_longest((dim,), choices, fillvalue=dim)
240 )
241 return options
242
243 @rule(data=st.data())
244 # TODO: swap_dims is basically all broken if a multiindex is present

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected