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

Method create_variables

xarray/tests/test_indexes.py:739–758  ·  view source on GitHub ↗
(self, variables=None)

Source from the content-addressed store, hash-verified

737 return cls()
738
739 def create_variables(self, variables=None):
740 if variables is None:
741 # For Coordinates.from_xindex(), return all variables the index can create
742 return {
743 "time": Variable(dims=("time",), data=[1, 2, 3]),
744 "valid_time": Variable(
745 dims=("time",),
746 data=[2, 3, 4], # time + 1
747 attrs={"description": "time + 1"},
748 ),
749 }
750
751 result = dict(variables)
752 if "time" in variables:
753 result["valid_time"] = Variable(
754 dims=("time",),
755 data=variables["time"].data + 1,
756 attrs={"description": "time + 1"},
757 )
758 return result
759
760
761def test_set_xindex_with_extra_variables() -> None:

Callers 2

test_create_variablesMethod · 0.45
indexes_and_varsMethod · 0.45

Calls 1

VariableClass · 0.90

Tested by

no test coverage detected