def test_spacing_tol(test_data_1d):
da = test_data_1d
da2 = da.copy().load()
# Create improperly spaced data
Nx = 16
Lx = 1.0
x = np.linspace(0, Lx, Nx)
x[-1] = x[-1] + .001
da3 = xr.DataArray(np.random.rand(Nx), coords=[x], dims=['x'])
# This shouldn't raise an error
xrft.dft(da3, spacing_tol=1e-1)
# But this should
with pytest.raises(ValueError):
xrft.dft(da3, spacing_tol=1e-4)
评论列表
文章目录