test_reshuffle.py 文件源码

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

项目:ecmwf_models 作者: TUW-GEO 项目源码 文件源码
def test_reshuffle():

    inpath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                          "test_data")
    ts_path = tempfile.mkdtemp()
    startdate = "2000-01-01"
    enddate = "2000-01-02"
    parameters = ["39", "40"]

    args = [inpath, ts_path, startdate, enddate] + parameters
    main(args)
    assert len(glob.glob(os.path.join(ts_path, "*.nc"))) == 2589
    ds = ERAinterimTs(ts_path)
    ts = ds.read_ts(45, 15)
    ts_39_values_should = np.array([0.17183685,  0.17189026,  0.17173004,
                                    0.17175293,  0.17183685, 0.17189026,
                                    0.17171478,  0.1717453], dtype=np.float32)
    nptest.assert_allclose(ts['39'].values, ts_39_values_should)
    ts_40_values_should = np.array([0.17861938,  0.17861176,  0.17866516,
                                    0.17865753,  0.1786499, 0.17864227,
                                    0.17868042,  0.17867279], dtype=np.float32)
    nptest.assert_allclose(ts['40'].values, ts_40_values_should)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号