def test_albedo_cases_orig(): # test 'litesoil', constant albedo ground = bifacial_radiance.GroundObj('litesoil') testvals_litesoil = ([.29], [.187], [.163], [.213]) np.testing.assert_allclose(_groundtest(ground), testvals_litesoil, atol=.001) ground = bifacial_radiance.GroundObj(0.2) testvals_const = ([.2], [.2], [.2], [.2]) np.testing.assert_allclose(_groundtest(ground), testvals_const, atol=.001)
def test_RGB_timeseries(): # test 3xN albedo array with two timesteps albedo = np.array([[0.2, 0.3, 0.4], [0.12, 0.13, 0.26]]) # 2 RGB Albedo ground = bifacial_radiance.GroundObj(albedo) testval = _groundtest(ground) testvals_const = ([[.2,.12], [.3, .13], [.4, .26], [.3,.17]]) np.testing.assert_allclose(testval, testvals_const) # test 4xN albedo array which should be trimmed and raise a warning albedo_bad = np.array([[0.2, 0.3, 0.4, 0.5], [0.12, 0.13, 0.26, 0.5]]) # invalid ground = pytest.warns(UserWarning, bifacial_radiance.GroundObj, albedo_bad) np.testing.assert_allclose(_groundtest(ground), testvals_const)
def test_albedo_greaterthan_one(): ground = bifacial_radiance.GroundObj(2) assert ground.ReflAvg[0] == 1
def test_printGroundMaterials(): ground = bifacial_radiance.GroundObj('litesoil') assert ground.printGroundMaterials()[1] == 'litesoil'