Skip to content

Commit 0eee43e

Browse files
committed
reprs for PVSystem and Location
1 parent 3a61341 commit 0eee43e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

pvlib/location.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ def __init__(self, latitude, longitude, tz='UTC', altitude=0,
8484
# super(Location, self).__init__(**kwargs)
8585

8686
def __repr__(self):
87-
return ('{}: latitude={}, longitude={}, tz={}, altitude={}'
88-
.format(self.name, self.latitude, self.longitude,
89-
self.tz, self.altitude))
87+
attrs = ['name', 'latitude', 'longitude', 'altitude', 'tz']
88+
return ('Location: \n ' + '\n '.join(
89+
(attr + ': ' + str(getattr(self, attr)) for attr in attrs)))
9090

9191

9292
@classmethod

pvlib/modelchain.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ def __repr__(self):
325325
attrs = [
326326
'orientation_strategy', 'clearsky_model', 'transposition_model',
327327
'solar_position_method', 'airmass_model', 'dc_model', 'ac_model',
328-
'aoi_model', 'spectral_model', 'temp_model', 'losses_model'
329-
]
328+
'aoi_model', 'spectral_model', 'temp_model', 'losses_model']
330329

331330
def getmcattr(self, attr):
332331
"""needed to avoid recursion in property lookups"""

pvlib/pvsystem.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ def __init__(self,
144144
super(PVSystem, self).__init__(**kwargs)
145145

146146
def __repr__(self):
147-
return ('PVSystem with tilt:' + str(self.surface_tilt) +
148-
' and azimuth: ' + str(self.surface_azimuth) +
149-
' with Module: ' + str(self.module) +
150-
' and Inverter: ' + str(self.inverter))
147+
attrs = ['surface_tilt', 'surface_azimuth', 'module', 'inverter',
148+
'albedo', 'racking_model']
149+
return ('PVSystem: \n ' + '\n '.join(
150+
(attr + ': ' + str(getattr(self, attr)) for attr in attrs)))
151151

152152
def get_aoi(self, solar_zenith, solar_azimuth):
153153
"""Get the angle of incidence on the system.

0 commit comments

Comments
 (0)