Skip to content

Commit 61c6799

Browse files
committed
raise valueerror
1 parent 3106ba4 commit 61c6799

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

pvlib/atmosphere.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
from __future__ import division
88

9-
import logging
10-
pvl_logger = logging.getLogger('pvlib')
11-
129
import numpy as np
1310

1411
APPARENT_ZENITH_MODELS = ('simple', 'kasten1966', 'kastenyoung1989',
@@ -238,10 +235,7 @@ def relativeairmass(zenith, model='kastenyoung1989'):
238235
AM = ( 1.0 / (np.cos(zenith_rad) +
239236
0.00176759*(z)*((94.37515 - z) ** - 1.21563)) )
240237
else:
241-
pvl_logger.warning("%s is not a valid model type for relative airmass. The 'kastenyoung1989' model was used.",
242-
model)
243-
AM = ( 1.0 / (np.cos(zenith_rad) +
244-
0.50572*(((6.07995 + (90 - z)) ** - 1.6364))) )
238+
raise ValueError('%s is not a valid model for relativeairmass', model)
245239

246240
try:
247241
AM[z > 90] = np.nan

pvlib/test/test_atmosphere.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_alt2press():
3838
# two functions combined will generate unique unit tests for each model
3939
def test_airmasses():
4040
models = ['simple', 'kasten1966', 'youngirvine1967', 'kastenyoung1989',
41-
'gueymard1993', 'young1994', 'pickering2002', 'invalid']
41+
'gueymard1993', 'young1994', 'pickering2002']
4242
for model in models:
4343
yield run_airmass, model, ephem_data['zenith']
4444

@@ -47,6 +47,11 @@ def run_airmass(model, zenith):
4747
atmosphere.relativeairmass(zenith, model)
4848

4949

50+
@raises(ValueError)
51+
def test_airmass_invalid():
52+
atmosphere.relativeairmass(ephem_data['zenith'], 'invalid')
53+
54+
5055
def test_absoluteairmass():
5156
relative_am = atmosphere.relativeairmass(ephem_data['zenith'], 'simple')
5257
atmosphere.absoluteairmass(relative_am)

0 commit comments

Comments
 (0)