code: def pvwatts_losses(soiling=2, shading=3, snow=0, mismatch=2, wiring=2,
                     connections=0.5, lid=1.5, nameplate_rating=1, age=0,
                     availability=3):
      r
  
      params = [soiling, shading, snow, mismatch, wiring, connections, lid,
                nameplate_rating, age, availability]
  
      # manually looping over params allows for numpy/pandas to handle any
      # array-like broadcasting that might be necessary.
      perf = 1
      for param in params:
          perf *= 1 - param/100
  
      losses = (1 - perf) * 100.
  
      return losses
docs: r"""
      Implements NREL's PVWatts system loss model [1]_:
  
      .. math::
  
          L_{total}(\%) = 100 [ 1 - \Pi_i ( 1 - \frac{L_i}{100} ) ]
  
      All parameters must be in units of %. Parameters may be
      array-like, though all array sizes must match.
  
      Parameters
      ----------
      soiling: numeric, default 2
      shading: numeric, default 3
      snow: numeric, default 0
      mismatch: numeric, default 2
      wiring: numeric, default 2
      connections: numeric, default 0.5
      lid: numeric, default 1.5
          Light induced degradation
      nameplate_rating: numeric, default 1
      age: numeric, default 0
      availability: numeric, default 3
  
      Returns
      -------
      losses: numeric
          System losses in units of %.
  
      References
      ----------
      .. [1] A. P. Dobos, "PVWatts Version 5 Manual"
             http://pvwatts.nrel.gov/downloads/pvwattsv5.pdf
             (2014).