def test_first_solar_spectral_correction_range(): with pytest.warns(UserWarning, match='Exceptionally high pw values'): out = atmosphere.first_solar_spectral_correction(np.array([.1, 3, 10]), np.array([1, 3, 5]), module_type='monosi') expected = np.array([0.96080878, 1.03055092, nan]) assert_allclose(out, expected, atol=1e-3) with pytest.warns(UserWarning, match='Exceptionally high pw values'): out = atmosphere.first_solar_spectral_correction(6, 1.5, max_pw=5, module_type='monosi') with pytest.warns(UserWarning, match='Exceptionally low pw values'): out = atmosphere.first_solar_spectral_correction(np.array([0, 3, 8]), np.array([1, 3, 5]), module_type='monosi') expected = np.array([0.96080878, 1.03055092, 1.04932727]) assert_allclose(out, expected, atol=1e-3) with pytest.warns(UserWarning, match='Exceptionally low pw values'): out = atmosphere.first_solar_spectral_correction(0.2, 1.5, min_pw=1, module_type='monosi')
def test_first_solar_spectral_correction(module_type, expect): ams = np.array([1, 3, 5]) pws = np.array([1, 3, 5]) ams, pws = np.meshgrid(ams, pws) out = atmosphere.first_solar_spectral_correction(pws, ams, module_type) assert_allclose(out, expect, atol=0.001)
def test_first_solar_spectral_correction_ambiguous(): with pytest.raises(TypeError): atmosphere.first_solar_spectral_correction(1, 1)
def test_first_solar_spectral_correction_supplied(): # use the cdte coeffs coeffs = (0.87102, -0.040543, -0.00929202, 0.10052, 0.073062, -0.0034187) out = atmosphere.first_solar_spectral_correction(1, 1, coefficients=coeffs) expected = 0.99134828 assert_allclose(out, expected, atol=1e-3)
def test_first_solar_spectral_correction_ambiguous(): with pytest.raises(TypeError): atmosphere.first_solar_spectral_correction(1, 1)
def test_first_solar_spectral_correction_supplied(): # use the cdte coeffs coeffs = (0.87102, -0.040543, -0.00929202, 0.10052, 0.073062, -0.0034187) out = atmosphere.first_solar_spectral_correction(1, 1, coefficients=coeffs) expected = 0.99134828 assert_allclose(out, expected, atol=1e-3)
def test_first_solar_spectral_correction(module_type, expect): ams = np.array([1, 3, 5]) pws = np.array([1, 3, 5]) ams, pws = np.meshgrid(ams, pws) out = atmosphere.first_solar_spectral_correction(pws, ams, module_type) assert_allclose(out, expect, atol=0.001)
def test_first_solar_spectral_correction_ambiguous(): atmosphere.first_solar_spectral_correction(1, 1)
def run_fs_test(module_type): out = atmosphere.first_solar_spectral_correction(pws, ams, module_type) assert_allclose(out, expect[module_type], atol=0.001)