15
15
from pvlib ._deprecation import deprecated
16
16
17
17
from pvlib import (atmosphere , iam , inverter , irradiance ,
18
- singlediode as _singlediode , temperature , tracking )
18
+ singlediode as _singlediode , temperature , tools )
19
19
from pvlib .tools import _build_kwargs
20
20
from pvlib ._deprecation import pvlibDeprecationWarning
21
21
@@ -1129,14 +1129,12 @@ def __init__(self,
1129
1129
1130
1130
self .name = name
1131
1131
1132
- def __repr__ (self ):
1132
+ def __repr__ (self , name = 'BaseArray' ):
1133
1133
attrs = ['name' , 'module' ,
1134
1134
'albedo' , 'racking_model' , 'module_type' ,
1135
1135
'temperature_model_parameters' ,
1136
1136
'strings' , 'modules_per_string' ]
1137
- return 'BaseArray:\n ' + '\n ' .join (
1138
- f'{ attr } : { getattr (self , attr )} ' for attr in attrs
1139
- )
1137
+ return tools .repr (self , attrs , name = name , level = 1 )
1140
1138
1141
1139
def _extend_repr (self , name , attributes ):
1142
1140
"""refactor into non-cringy super() gymnastics"""
@@ -1321,7 +1319,7 @@ def __init__(
1321
1319
racking_model = None ,
1322
1320
name = None
1323
1321
):
1324
-
1322
+ self . name = name
1325
1323
self .surface_tilt = surface_tilt
1326
1324
self .surface_azimuth = surface_azimuth
1327
1325
@@ -1339,8 +1337,10 @@ def __init__(
1339
1337
)
1340
1338
1341
1339
def __repr__ (self ):
1342
- attrs = ['surface_tilt' , 'surface_azimuth' ]
1343
- return self ._extend_repr ('FixedTiltArray' , attrs )
1340
+ parent_repr = super ().__repr__ (name = 'FixedArray' )
1341
+ attrs = ['name' , 'surface_tilt' , 'surface_azimuth' ]
1342
+ this_repr = tools .repr (self , attrs , level = 1 )
1343
+ return parent_repr + '\n ' + this_repr
1344
1344
1345
1345
def get_aoi (self , solar_zenith , solar_azimuth ):
1346
1346
"""
@@ -1521,6 +1521,7 @@ def __init__(
1521
1521
name = None
1522
1522
):
1523
1523
1524
+ self .name = name
1524
1525
self .axis_tilt = axis_tilt
1525
1526
self .axis_azimuth = axis_azimuth
1526
1527
self .max_angle = max_angle
@@ -1542,9 +1543,11 @@ def __init__(
1542
1543
)
1543
1544
1544
1545
def __repr__ (self ):
1545
- attrs = ['axis_tilt' , 'axis_azimuth' , 'max_angle' , 'backtrack' , 'gcr' ,
1546
- 'cross_axis_tilt' ]
1547
- return self ._extend_repr ('SingleAxisArray' , attrs )
1546
+ parent_repr = super ().__repr__ (name = 'SingleAxisArray' )
1547
+ attrs = ['name' , 'axis_tilt' , 'axis_azimuth' , 'max_angle' , 'backtrack' ,
1548
+ 'gcr' , 'cross_axis_tilt' ]
1549
+ this_repr = tools .repr (self , attrs , level = 1 )
1550
+ return parent_repr + '\n ' + this_repr
1548
1551
1549
1552
def singleaxis (self , apparent_zenith , apparent_azimuth ):
1550
1553
"""
@@ -1563,6 +1566,7 @@ def singleaxis(self, apparent_zenith, apparent_azimuth):
1563
1566
-------
1564
1567
tracking data
1565
1568
"""
1569
+ from pvlib import tracking
1566
1570
tracking_data = tracking .singleaxis (
1567
1571
apparent_zenith , apparent_azimuth ,
1568
1572
self .axis_tilt , self .axis_azimuth ,
0 commit comments