MCPcopy Index your code
hub / github.com/pydata/xarray / maybe_variable

Method maybe_variable

xarray/core/dataset.py:3901–3906  ·  view source on GitHub ↗
(obj, k)

Source from the content-addressed store, hash-verified

3899 obj = self if assume_sorted else self.sortby(list(coords))
3900
3901 def maybe_variable(obj, k):
3902 # workaround to get variable for dimension without coordinate.
3903 try:
3904 return obj._variables[k]
3905 except KeyError:
3906 return as_variable((k, range(obj.sizes[k])))
3907
3908 def _validate_interp_indexer(x, new_x):
3909 # In the case of datetimes, the restrictions placed on indexers

Callers

nothing calls this directly

Calls 1

as_variableFunction · 0.90

Tested by

no test coverage detected