Skip to content

Commit 350b985

Browse files
committed
add tracking repr
1 parent 48dc2ae commit 350b985

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pvlib/tracking.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ def __init__(self, axis_tilt=0, axis_azimuth=0,
2929
super(SingleAxisTracker, self).__init__(**kwargs)
3030

3131
def __repr__(self):
32-
return ('SingleAxisTracker with max_angle: ' +
33-
str(self.max_angle))
32+
attrs = ['axis_tilt', 'axis_azimuth', 'max_angle', 'backtrack', 'gcr']
33+
sat_repr = ('SingleAxisTracker: \n ' + '\n '.join(
34+
(attr + ': ' + str(getattr(self, attr)) for attr in attrs)))
35+
# get the parent PVSystem info
36+
pvsystem_repr = super(SingleAxisTracker, self).__repr__()
37+
# remove the first line (contains 'PVSystem: \n')
38+
pvsystem_repr = '\n'.join(pvsystem_repr.split('\n')[1:])
39+
return sat_repr + '\n' + pvsystem_repr
40+
3441

3542
def singleaxis(self, apparent_zenith, apparent_azimuth):
3643
tracking_data = singleaxis(apparent_zenith, apparent_azimuth,

0 commit comments

Comments
 (0)