Skip to content

Commit

Permalink
Merge pull request #563 from NREL/256_moduleNotFound
Browse files Browse the repository at this point in the history
fixes #256 - not useful error when trying to load a module not in .json
  • Loading branch information
cdeline authored Oct 13, 2024
2 parents dbf2062 + bcc8120 commit 0b1c9d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bifacial_radiance/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def readModule(self, name=None):

return moduleDict
else:
print('Error: module name {} doesnt exist'.format(name))
raise Exception('Error: module name "{}" doesnt exist'.format(name))
return {}


Expand Down
14 changes: 14 additions & 0 deletions tests/test_bifacial_radiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,5 +604,19 @@ def test_raypath():
assert '.' in re.split(':|;', os.environ['RAYPATH'])

os.environ['RAYPATH'] = raypath0

def test_GH256_nomodule_error():
moduletype = 'moduletypeNOTonJason'
startdate= '09_23_08'
enddate = '09_23_08'
demo = bifacial_radiance.RadianceObj('test')
metdata = demo.readWeatherFile(MET_FILENAME, starttime=startdate, endtime=enddate)
demo.setGround()
sceneDict = {'pitch': 7,'hub_height':2, 'nMods':1, 'nRows': 1, 'module_type':moduletype}
trackerdict = demo.set1axis(metdata = metdata, cumulativesky = False)
foodict = demo.gendaylit1axis()
with pytest.raises(Exception):
foodict = demo.makeScene1axis(trackerdict=foodict, module=moduletype,
sceneDict=sceneDict, cumulativesky=False)


0 comments on commit 0b1c9d4

Please sign in to comment.