test_xrft.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:xrft 作者: rabernat 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号