

def test_transient2d():
    ml = flopy.modflow.Modflow()
    dis = flopy.modflow.ModflowDis(ml, nlay=10, nrow=10, ncol=10, nper=3)
    t2d = Transient2d(ml, (10, 10), np.float32, 10.0, 'fake')
    a1 = t2d.array
    assert (a1.shape == (3, 1, 10, 10)), a1.shape
    t2d.cnstnt = 2.0
    assert np.array_equal(t2d.array, (np.zeros((3, 1, 10, 10)) + 20.0))
    t2d[0] = 1.0
    t2d[2] = 999
    assert np.array_equal(t2d[0].array, np.ones((ml.nrow, ml.ncol)))
    assert np.array_equal(t2d[2].array, (np.ones((ml.nrow, ml.ncol)) * 999))
    m4d = t2d.array
    t2d2 = Transient2d.from_4d(ml, 'rch', {
        'rech': m4d,
    })
    m4d2 = t2d2.array
    assert np.array_equal(m4d, m4d2)

dataset/ETHPy150Open modflowpy/flopy/autotest/t004_test.py test_transient2d/original