@@ -375,6 +375,30 @@ def snlinverter(self, v_dc, p_dc):
375
375
return snlinverter (self .inverter_parameters , v_dc , p_dc )
376
376
377
377
378
+ def localize (self , location = None , latitude = None , longitude = None ,
379
+ ** kwargs ):
380
+ """Creates a LocalizedPVSystem object using this object
381
+ and location data. Must supply either location object or
382
+ latitude, longitude, and any location kwargs
383
+
384
+ Parameters
385
+ ----------
386
+ location : None or Location
387
+ latitude : None or float
388
+ longitude : None or float
389
+ **kwargs : see Location
390
+
391
+ Returns
392
+ -------
393
+ localized_system : LocalizedPVSystem
394
+ """
395
+
396
+ if location is None :
397
+ location = Location (latitude , longitude , ** kwargs )
398
+
399
+ return LocalizedPVSystem (pvsystem = self , location = location )
400
+
401
+
378
402
class LocalizedPVSystem (PVSystem , Location ):
379
403
"""
380
404
The LocalizedPVSystem class defines a standard set of
@@ -385,8 +409,26 @@ class LocalizedPVSystem(PVSystem, Location):
385
409
See the :class:`PVSystem` class for an object model that
386
410
describes an unlocalized PV system.
387
411
"""
388
- def __init__ (self , ** kwargs ):
389
- super (LocalizedPVSystem , self ).__init__ (** kwargs )
412
+ def __init__ (self , pvsystem = None , location = None , ** kwargs ):
413
+
414
+ # get and combine attributes from the pvsystem and/or location
415
+ # with the rest of the kwargs
416
+
417
+ if pvsystem is not None :
418
+ pv_dict = pvsystem .__dict__
419
+ else :
420
+ pv_dict = {}
421
+
422
+ if location is not None :
423
+ loc_dict = location .__dict__
424
+ else :
425
+ loc_dict = {}
426
+
427
+ new_kwargs = dict (list (pv_dict .items ()) +
428
+ list (loc_dict .items ()) +
429
+ list (kwargs .items ()))
430
+
431
+ super (LocalizedPVSystem , self ).__init__ (** new_kwargs )
390
432
391
433
392
434
def systemdef (meta , surface_tilt , surface_azimuth , albedo , series_modules ,
0 commit comments