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

Method setUp

xarray/tests/test_plot.py:3116–3128  ·  view source on GitHub ↗

Create a DataArray with a time-axis that contains cftime.datetime objects.

(self)

Source from the content-addressed store, hash-verified

3114class TestNcAxisNotInstalled(PlotTestCase):
3115 @pytest.fixture(autouse=True)
3116 def setUp(self) -> None:
3117 """
3118 Create a DataArray with a time-axis that contains cftime.datetime
3119 objects.
3120 """
3121 month = np.arange(1, 13, 1)
3122 data = np.sin(2 * np.pi * month / 12.0)
3123 darray = DataArray(data, dims=["time"])
3124 darray.coords["time"] = xr.date_range(
3125 start="2017", periods=12, freq="1ME", calendar="noleap", use_cftime=True
3126 )
3127
3128 self.darray = darray
3129
3130 def test_ncaxis_notinstalled_line_plot(self) -> None:
3131 with pytest.raises(ImportError, match=r"optional `nc-time-axis`"):

Callers

nothing calls this directly

Calls 3

DataArrayClass · 0.90
arangeMethod · 0.80
sinMethod · 0.80

Tested by

no test coverage detected