예제 #1
0
def test_make_vars(od, tNX, tNY, X0):
    ds = od._ds.reset_coords()
    if isinstance(tNX, int) and isinstance(tNY, int) and isinstance(X0, int):
        nds = make_array(ds, tNX, tNY, X0)
        assert (set(nds.dims) - set(ds.dims)) == set([])
        assert nds.dims["X"] == tNX
        assert nds.dims["Y"] == tNY
        assert nds.dims["Z"] == ds.dims["Z"]
        assert nds.dims["time"] == ds.dims["time"]
    else:
        with pytest.raises(TypeError):
            nds = make_array(ds, tNX, tNY, X0)
예제 #2
0
def test_init_vars(od, tNX, tNY, X0, varlist):
    ds = od._ds.reset_coords()
    nds = make_array(ds, tNX, tNY, X0)
    nds = init_vars(ds, nds, varlist)
    for var in varlist:
        assert set(ds[var].dims) - set(nds[var].dims) == set(["face"])