Skip to content

Commit c20a9ee

Browse files
committed
add more attributes to ModelChain repr
1 parent 50829ae commit c20a9ee

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

pvlib/modelchain.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,23 @@ def __init__(self, system, location,
322322
self.solar_position = None
323323

324324
def __repr__(self):
325-
return ('ModelChain for: ' + str(self.system) +
326-
' orientation_strategy: ' + str(self.orientation_strategy) +
327-
' clearsky_model: ' + str(self.clearsky_model) +
328-
' transposition_model: ' + str(self.transposition_model) +
329-
' solar_position_method: ' + str(self.solar_position_method) +
330-
' airmass_model: ' + str(self.airmass_model))
325+
attrs = [
326+
'orientation_strategy', 'clearsky_model', 'transposition_model',
327+
'solar_position_method', 'airmass_model', 'dc_model', 'ac_model',
328+
'aoi_model', 'spectral_model', 'temp_model', 'losses_model'
329+
]
330+
331+
def getmcattr(self, attr):
332+
"""needed to avoid recursion in property lookups"""
333+
out = getattr(self, attr)
334+
try:
335+
out = out.__name__
336+
except AttributeError:
337+
pass
338+
return out
339+
340+
return ('ModelChain: \n ' + '\n '.join(
341+
(attr + ': ' + getmcattr(self, attr) for attr in attrs)))
331342

332343
@property
333344
def orientation_strategy(self):

0 commit comments

Comments
 (0)