prompt: 
  We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  temperature.fuentes errors when given tz-aware inputs on pandas>=1.0.0
  **Describe the bug**
  When the weather timeseries inputs to `temperature.fuentes` have tz-aware index, an internal call to `np.diff(index)` returns an array of `Timedelta` objects instead of an array of nanosecond ints, throwing an error immediately after.  The error only happens when using pandas>=1.0.0; using 0.25.3 runs successfully, but emits the warning:
  
  ```
    /home/kevin/anaconda3/envs/pvlib-dev/lib/python3.7/site-packages/numpy/lib/function_base.py:1243: FutureWarning: Converting timezone-aware DatetimeArray to timezone-naive ndarray with 'datetime64[ns]' dtype. In the future, this will return an ndarray with 'object' dtype where each element is a 'pandas.Timestamp' with the correct 'tz'.
    	To accept the future behavior, pass 'dtype=object'.
    	To keep the old behavior, pass 'dtype="datetime64[ns]"'.
      a = asanyarray(a)
  ```
  
  **To Reproduce**
  ```python
  In [1]: import pvlib
     ...: import pandas as pd
     ...: 
     ...: index_naive = pd.date_range('2019-01-01', freq='h', periods=3)
     ...: 
     ...: kwargs = {
     ...:     'poa_global': pd.Series(1000, index_naive),
     ...:     'temp_air': pd.Series(20, index_naive),
     ...:     'wind_speed': pd.Series(1, index_naive),
     ...:     'noct_installed': 45
     ...: }
     ...: 
  
  In [2]: print(pvlib.temperature.fuentes(**kwargs))
  2019-01-01 00:00:00    47.85
  2019-01-01 01:00:00    50.85
  2019-01-01 02:00:00    50.85
  Freq: H, Name: tmod, dtype: float64
  
  In [3]: kwargs['poa_global'].index = index_naive.tz_localize('UTC')
     ...: print(pvlib.temperature.fuentes(**kwargs))
     ...: 
  Traceback (most recent call last):
  
    File "<ipython-input-3-ff99badadc91>", line 2, in <module>
      print(pvlib.temperature.fuentes(**kwargs))
  
    File "/home/kevin/anaconda3/lib/python3.7/site-packages/pvlib/temperature.py", line 602, in fuentes
      timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60
  
  TypeError: float() argument must be a string or a number, not 'Timedelta'
  ```
  
  **Expected behavior**
  `temperature.fuentes` should work with both tz-naive and tz-aware inputs.
  
  
  **Versions:**
   - ``pvlib.__version__``: 0.8.0
   - ``pandas.__version__``: 1.0.0+
   - python: 3.7.4 (default, Aug 13 2019, 20:35:49) \n[GCC 7.3.0]
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  
  --- BEGIN FILE ---
  ```
  ### pvlib/temperature.py
  """
  The ``temperature`` module contains functions for modeling temperature of
  PV modules and cells.
  """
  
  import numpy as np
  import pandas as pd
  from pvlib.tools import sind
  
  TEMPERATURE_MODEL_PARAMETERS = {
      'sapm': {
          'open_rack_glass_glass': {'a': -3.47, 'b': -.0594, 'deltaT': 3},
          'close_mount_glass_glass': {'a': -2.98, 'b': -.0471, 'deltaT': 1},
          'open_rack_glass_polymer': {'a': -3.56, 'b': -.0750, 'deltaT': 3},
          'insulated_back_glass_polymer': {'a': -2.81, 'b': -.0455, 'deltaT': 0},
      },
      'pvsyst': {'freestanding': {'u_c': 29.0, 'u_v': 0},
                 'insulated': {'u_c': 15.0, 'u_v': 0}}
  }
  """Dictionary of temperature parameters organized by model.
  
  There are keys for each model at the top level. Currently there are two models,
  ``'sapm'`` for the Sandia Array Performance Model, and ``'pvsyst'``. Each model
  has a dictionary of configurations; a value is itself a dictionary containing
  model parameters. Retrieve parameters by indexing the model and configuration
  by name. Note: the keys are lower-cased and case sensitive.
  
  Example
  -------
  Retrieve the open rack glass-polymer configuration for SAPM::
  
      from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
      temperature_model_parameters = (
          TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer'])
      # {'a': -3.56, 'b': -0.075, 'deltaT': 3}
  """
  
  
  def _temperature_model_params(model, parameter_set):
      try:
          params = TEMPERATURE_MODEL_PARAMETERS[model]
          return params[parameter_set]
      except KeyError:
          msg = ('{} is not a named set of parameters for the {} cell'
                 ' temperature model.'
                 ' See pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS'
                 ' for names'.format(parameter_set, model))
          raise KeyError(msg)
  
  
  def sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT,
                irrad_ref=1000):
      r'''
      Calculate cell temperature per the Sandia Array Performance Model.
  
      See [1]_ for details on the Sandia Array Performance Model.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric
          Wind speed at a height of 10 meters [m/s].
  
      a : float
          Parameter :math:`a` in :eq:`sapm1`.
  
      b : float
          Parameter :math:`b` in :eq:`sapm1`.
  
      deltaT : float
          Parameter :math:`\Delta T` in :eq:`sapm2` [C].
  
      irrad_ref : float, default 1000
          Reference irradiance, parameter :math:`E_{0}` in
          :eq:`sapm2` [W/m^2].
  
      Returns
      -------
      numeric, values in degrees C.
  
      Notes
      -----
      The model for cell temperature :math:`T_{C}` is given by a pair of
      equations (Eq. 11 and 12 in [1]_).
  
      .. math::
         :label: sapm1
  
         T_{m} = E \times \exp (a + b \times WS) + T_{a}
  
      .. math::
         :label: sapm2
  
         T_{C} = T_{m} + \frac{E}{E_{0}} \Delta T
  
      The module back surface temperature :math:`T_{m}` is implemented in
      :py:func:`~pvlib.temperature.sapm_module`.
  
      Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and
      ambient air temperature :math:`T_{a}` (C). Model parameters depend both on
      the module construction and its mounting. Parameter sets are provided in
      [1]_ for representative modules and mounting, and are coded for convenience
      in :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.
  
      +---------------+----------------+-------+---------+---------------------+
      | Module        | Mounting       | a     | b       | :math:`\Delta T [C]`|
      +===============+================+=======+=========+=====================+
      | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |
      +---------------+----------------+-------+---------+---------------------+
  
      References
      ----------
      .. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
         Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
         NM.
  
      See also
      --------
      sapm_cell_from_module
      sapm_module
  
      Examples
      --------
      >>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS
      >>> params = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
      >>> sapm_cell(1000, 10, 0, **params)
      44.11703066106086
      '''
      module_temperature = sapm_module(poa_global, temp_air, wind_speed,
                                       a, b)
      return sapm_cell_from_module(module_temperature, poa_global, deltaT,
                                   irrad_ref)
  
  
  def sapm_module(poa_global, temp_air, wind_speed, a, b):
      r'''
      Calculate module back surface temperature per the Sandia Array
      Performance Model.
  
      See [1]_ for details on the Sandia Array Performance Model.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric
          Wind speed at a height of 10 meters [m/s].
  
      a : float
          Parameter :math:`a` in :eq:`sapm1mod`.
  
      b : float
          Parameter :math:`b` in :eq:`sapm1mod`.
  
      Returns
      -------
      numeric, values in degrees C.
  
      Notes
      -----
      The model for module temperature :math:`T_{m}` is given by Eq. 11 in [1]_.
  
      .. math::
         :label: sapm1mod
  
         T_{m} = E \times \exp (a + b \times WS) + T_{a}
  
      Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and
      ambient air temperature :math:`T_{a}` (C). Model outputs are surface
      temperature at the back of the module :math:`T_{m}` and cell temperature
      :math:`T_{C}`. Model parameters depend both on the module construction and
      its mounting. Parameter sets are provided in [1]_ for representative
      modules and mounting, and are coded for convenience in
      :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.
  
      +---------------+----------------+-------+---------+---------------------+
      | Module        | Mounting       | a     | b       | :math:`\Delta T [C]`|
      +===============+================+=======+=========+=====================+
      | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |
      +---------------+----------------+-------+---------+---------------------+
  
      References
      ----------
      .. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
         Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
         NM.
  
      See also
      --------
      sapm_cell
      sapm_cell_from_module
      '''
      return poa_global * np.exp(a + b * wind_speed) + temp_air
  
  
  def sapm_cell_from_module(module_temperature, poa_global, deltaT,
                            irrad_ref=1000):
      r'''
      Calculate cell temperature from module temperature using the Sandia Array
      Performance Model.
  
      See [1]_ for details on the Sandia Array Performance Model.
  
      Parameters
      ----------
      module_temperature : numeric
          Temperature of back of module surface [C].
  
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      deltaT : float
          Parameter :math:`\Delta T` in :eq:`sapm2_cell_from_mod` [C].
  
      irrad_ref : float, default 1000
          Reference irradiance, parameter :math:`E_{0}` in
          :eq:`sapm2` [W/m^2].
  
      Returns
      -------
      numeric, values in degrees C.
  
      Notes
      -----
      The model for cell temperature :math:`T_{C}` is given by Eq. 12 in [1]_.
  
      .. math::
         :label: sapm2_cell_from_mod
  
         T_{C} = T_{m} + \frac{E}{E_{0}} \Delta T
  
      The module back surface temperature :math:`T_{m}` is implemented in
      :py:func:`~pvlib.temperature.sapm_module`.
  
      Model parameters depend both on the module construction and its mounting.
      Parameter sets are provided in [1]_ for representative modules and
      mounting, and are coded for convenience in
      :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.
  
      +---------------+----------------+-------+---------+---------------------+
      | Module        | Mounting       | a     | b       | :math:`\Delta T [C]`|
      +===============+================+=======+=========+=====================+
      | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |
      +---------------+----------------+-------+---------+---------------------+
  
      References
      ----------
      .. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
         Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
         NM.
  
      See also
      --------
      sapm_cell
      sapm_module
      '''
      return module_temperature + (poa_global / irrad_ref) * deltaT
  
  
  def pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0,
                  eta_m=0.1, alpha_absorption=0.9):
      r"""
      Calculate cell temperature using an empirical heat loss factor model
      as implemented in PVsyst.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric, default 1.0
          Wind speed in m/s measured at the same height for which the wind loss
          factor was determined.  The default value 1.0 m/2 is the wind
          speed at module height used to determine NOCT. [m/s]
  
      u_c : float, default 29.0
          Combined heat loss factor coefficient. The default value is
          representative of freestanding modules with the rear surfaces exposed
          to open air (e.g., rack mounted). Parameter :math:`U_{c}` in
          :eq:`pvsyst`.
          :math:`\left[\frac{\text{W}/{\text{m}^2}}{\text{C}}\right]`
  
      u_v : float, default 0.0
          Combined heat loss factor influenced by wind. Parameter :math:`U_{v}`
          in :eq:`pvsyst`.
          :math:`\left[ \frac{\text{W}/\text{m}^2}{\text{C}\ \left( \text{m/s} \right)} \right]`
  
      eta_m : numeric, default 0.1
          Module external efficiency as a fraction, i.e., DC power / poa_global.
          Parameter :math:`\eta_{m}` in :eq:`pvsyst`.
  
      alpha_absorption : numeric, default 0.9
          Absorption coefficient. Parameter :math:`\alpha` in :eq:`pvsyst`.
  
      Returns
      -------
      numeric, values in degrees Celsius
  
      Notes
      -----
      The Pvsyst model for cell temperature :math:`T_{C}` is given by
  
      .. math::
         :label: pvsyst
  
          T_{C} = T_{a} + \frac{\alpha E (1 - \eta_{m})}{U_{c} + U_{v} \times WS}
  
      Inputs to the model are plane-of-array irradiance :math:`E` (W/m2), ambient
      air temperature :math:`T_{a}` (C) and wind speed :math:`WS` (m/s). Model
      output is cell temperature :math:`T_{C}`. Model parameters depend both on
      the module construction and its mounting. Parameters are provided in
      [1]_ for open (freestanding) and close (insulated) mounting configurations,
      , and are coded for convenience in
      :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`. The heat loss
      factors provided represent the combined effect of convection, radiation and
      conduction, and their values are experimentally determined.
  
      +--------------+---------------+---------------+
      | Mounting     | :math:`U_{c}` | :math:`U_{v}` |
      +==============+===============+===============+
      | freestanding | 29.0          | 0.0           |
      +--------------+---------------+---------------+
      | insulated    | 15.0          | 0.0           |
      +--------------+---------------+---------------+
  
      References
      ----------
      .. [1] "PVsyst 6 Help", Files.pvsyst.com, 2018. [Online]. Available:
         http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].
  
      .. [2] Faiman, D. (2008). "Assessing the outdoor operating temperature of
         photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
  
      Examples
      --------
      >>> from pvlib.temperature import pvsyst_cell, TEMPERATURE_MODEL_PARAMETERS
      >>> params = TEMPERATURE_MODEL_PARAMETERS['pvsyst']['freestanding']
      >>> pvsyst_cell(1000, 10, **params)
      37.93103448275862
      """
  
      total_loss_factor = u_c + u_v * wind_speed
      heat_input = poa_global * alpha_absorption * (1 - eta_m)
      temp_difference = heat_input / total_loss_factor
      return temp_air + temp_difference
  
  
  def faiman(poa_global, temp_air, wind_speed=1.0, u0=25.0, u1=6.84):
      r'''
      Calculate cell or module temperature using the Faiman model.  The Faiman
      model uses an empirical heat loss factor model [1]_ and is adopted in the
      IEC 61853 standards [2]_ and [3]_.
  
      Usage of this model in the IEC 61853 standard does not distinguish
      between cell and module temperature.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric, default 1.0
          Wind speed in m/s measured at the same height for which the wind loss
          factor was determined.  The default value 1.0 m/s is the wind
          speed at module height used to determine NOCT. [m/s]
  
      u0 : numeric, default 25.0
          Combined heat loss factor coefficient. The default value is one
          determined by Faiman for 7 silicon modules.
          :math:`\left[\frac{\text{W}/{\text{m}^2}}{\text{C}}\right]`
  
      u1 : numeric, default 6.84
          Combined heat loss factor influenced by wind. The default value is one
          determined by Faiman for 7 silicon modules.
          :math:`\left[ \frac{\text{W}/\text{m}^2}{\text{C}\ \left( \text{m/s} \right)} \right]`
  
      Returns
      -------
      numeric, values in degrees Celsius
  
      Notes
      -----
      All arguments may be scalars or vectors. If multiple arguments
      are vectors they must be the same length.
  
      References
      ----------
      .. [1] Faiman, D. (2008). "Assessing the outdoor operating temperature of
         photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
  
      .. [2] "IEC 61853-2 Photovoltaic (PV) module performance testing and energy
         rating - Part 2: Spectral responsivity, incidence angle and module
         operating temperature measurements". IEC, Geneva, 2018.
  
      .. [3] "IEC 61853-3 Photovoltaic (PV) module performance testing and energy
         rating - Part 3: Energy rating of PV modules". IEC, Geneva, 2018.
  
      '''
      # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Dec., 2019
  
      # The following lines may seem odd since u0 & u1 are probably scalar,
      # but it serves an indirect and easy way of allowing lists and
      # tuples for the other function arguments.
      u0 = np.asanyarray(u0)
      u1 = np.asanyarray(u1)
  
      total_loss_factor = u0 + u1 * wind_speed
      heat_input = poa_global
      temp_difference = heat_input / total_loss_factor
      return temp_air + temp_difference
  
  
  def _fuentes_hconv(tave, windmod, tinoct, temp_delta, xlen, tilt,
                     check_reynold):
      # Calculate the convective coefficient as in Fuentes 1987 -- a mixture of
      # free, laminar, and turbulent convection.
      densair = 0.003484 * 101325.0 / tave  # density
      visair = 0.24237e-6 * tave**0.76 / densair  # kinematic viscosity
      condair = 2.1695e-4 * tave**0.84  # thermal conductivity
      reynold = windmod * xlen / visair
      # the boundary between laminar and turbulent is modeled as an abrupt
      # change at Re = 1.2e5:
      if check_reynold and reynold > 1.2e5:
          # turbulent convection
          hforce = 0.0282 / reynold**0.2 * densair * windmod * 1007 / 0.71**0.4
      else:
          # laminar convection
          hforce = 0.8600 / reynold**0.5 * densair * windmod * 1007 / 0.71**0.67
      # free convection via Grashof number
      # NB: Fuentes hardwires sind(tilt) as 0.5 for tilt=30
      grashof = 9.8 / tave * temp_delta * xlen**3 / visair**2 * sind(tilt)
      # product of Nusselt number and (k/l)
      hfree = 0.21 * (grashof * 0.71)**0.32 * condair / xlen
      # combine free and forced components
      hconv = (hfree**3 + hforce**3)**(1/3)
      return hconv
  
  
  def _hydraulic_diameter(width, height):
      # calculate the hydraulic diameter of a rectangle
      return 2 * (width * height) / (width + height)
  
  
  def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,
              wind_height=9.144, emissivity=0.84, absorption=0.83,
              surface_tilt=30, module_width=0.31579, module_length=1.2):
      """
      Calculate cell or module temperature using the Fuentes model.
  
      The Fuentes model is a first-principles heat transfer energy balance
      model [1]_ that is used in PVWatts for cell temperature modeling [2]_.
  
      Parameters
      ----------
      poa_global : pandas Series
          Total incident irradiance [W/m^2]
  
      temp_air : pandas Series
          Ambient dry bulb temperature [C]
  
      wind_speed : pandas Series
          Wind speed [m/s]
  
      noct_installed : float
          The "installed" nominal operating cell temperature as defined in [1]_.
          PVWatts assumes this value to be 45 C for rack-mounted arrays and
          49 C for roof mount systems with restricted air flow around the
          module.  [C]
  
      module_height : float, default 5.0
          The height above ground of the center of the module. The PVWatts
          default is 5.0 [m]
  
      wind_height : float, default 9.144
          The height above ground at which ``wind_speed`` is measured. The
          PVWatts defauls is 9.144 [m]
  
      emissivity : float, default 0.84
          The effectiveness of the module at radiating thermal energy. [unitless]
  
      absorption : float, default 0.83
          The fraction of incident irradiance that is converted to thermal
          energy in the module. [unitless]
  
      surface_tilt : float, default 30
          Module tilt from horizontal. If not provided, the default value
          of 30 degrees from [1]_ and [2]_ is used. [degrees]
  
      module_width : float, default 0.31579
          Module width. The default value of 0.31579 meters in combination with
          the default `module_length` gives a hydraulic diameter of 0.5 as
          assumed in [1]_ and [2]_. [m]
  
      module_length : float, default 1.2
          Module length. The default value of 1.2 meters in combination with
          the default `module_width` gives a hydraulic diameter of 0.5 as
          assumed in [1]_ and [2]_. [m]
  
      Returns
      -------
      temperature_cell : pandas Series
          The modeled cell temperature [C]
  
      Notes
      -----
      This function returns slightly different values from PVWatts at night
      and just after dawn. This is because the SAM SSC assumes that module
      temperature equals ambient temperature when irradiance is zero so it can
      skip the heat balance calculation at night.
  
      References
      ----------
      .. [1] Fuentes, M. K., 1987, "A Simplifed Thermal Model for Flat-Plate
             Photovoltaic Arrays", SAND85-0330, Sandia National Laboratories,
             Albuquerque NM.
             http://prod.sandia.gov/techlib/access-control.cgi/1985/850330.pdf
      .. [2] Dobos, A. P., 2014, "PVWatts Version 5 Manual", NREL/TP-6A20-62641,
             National Renewable Energy Laboratory, Golden CO.
             doi:10.2172/1158421.
      """
      # ported from the FORTRAN77 code provided in Appendix A of Fuentes 1987;
      # nearly all variable names are kept the same for ease of comparison.
  
      boltz = 5.669e-8
      emiss = emissivity
      absorp = absorption
      xlen = _hydraulic_diameter(module_width, module_length)
      # cap0 has units of [J / (m^2 K)], equal to mass per unit area times
      # specific heat of the module.
      cap0 = 11000
      tinoct = noct_installed + 273.15
  
      # convective coefficient of top surface of module at NOCT
      windmod = 1.0
      tave = (tinoct + 293.15) / 2
      hconv = _fuentes_hconv(tave, windmod, tinoct, tinoct - 293.15, xlen,
                             surface_tilt, False)
  
      # determine the ground temperature ratio and the ratio of the total
      # convection to the top side convection
      hground = emiss * boltz * (tinoct**2 + 293.15**2) * (tinoct + 293.15)
      backrat = (
          absorp * 800.0
          - emiss * boltz * (tinoct**4 - 282.21**4)
          - hconv * (tinoct - 293.15)
      ) / ((hground + hconv) * (tinoct - 293.15))
      tground = (tinoct**4 - backrat * (tinoct**4 - 293.15**4))**0.25
      tground = np.clip(tground, 293.15, tinoct)
  
      tgrat = (tground - 293.15) / (tinoct - 293.15)
      convrat = (absorp * 800 - emiss * boltz * (
          2 * tinoct**4 - 282.21**4 - tground**4)) / (hconv * (tinoct - 293.15))
  
      # adjust the capacitance (thermal mass) of the module based on the INOCT.
      # It is a function of INOCT because high INOCT implies thermal coupling
      # with the racking (e.g. roofmount), so the thermal mass is increased.
      # `cap` has units J/(m^2 C) -- see Table 3, Equations 26 & 27
      cap = cap0
      if tinoct > 321.15:
          cap = cap * (1 + (tinoct - 321.15) / 12)
  
      # iterate through timeseries inputs
      sun0 = 0
      tmod0 = 293.15
  
      # n.b. the way Fuentes calculates the first timedelta makes it seem like
      # the value doesn't matter -- rather than recreate it here, just assume
      # it's the same as the second timedelta:
      timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60
      timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)
  
      tamb_array = temp_air + 273.15
      sun_array = poa_global * absorp
  
      # Two of the calculations are easily vectorized, so precalculate them:
      # sky temperature -- Equation 24
      tsky_array = 0.68 * (0.0552 * tamb_array**1.5) + 0.32 * tamb_array
      # wind speed at module height -- Equation 22
      # not sure why the 1e-4 factor is included -- maybe the equations don't
      # behave well if wind == 0?
      windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4
  
      tmod0 = 293.15
      tmod_array = np.zeros_like(poa_global)
  
      iterator = zip(tamb_array, sun_array, windmod_array, tsky_array,
                     timedelta_hours)
      for i, (tamb, sun, windmod, tsky, dtime) in enumerate(iterator):
          # solve the heat transfer equation, iterating because the heat loss
          # terms depend on tmod. NB Fuentes doesn't show that 10 iterations is
          # sufficient for convergence.
          tmod = tmod0
          for j in range(10):
              # overall convective coefficient
              tave = (tmod + tamb) / 2
              hconv = convrat * _fuentes_hconv(tave, windmod, tinoct,
                                               abs(tmod-tamb), xlen,
                                               surface_tilt, True)
              # sky radiation coefficient (Equation 3)
              hsky = emiss * boltz * (tmod**2 + tsky**2) * (tmod + tsky)
              # ground radiation coeffieicient (Equation 4)
              tground = tamb + tgrat * (tmod - tamb)
              hground = emiss * boltz * (tmod**2 + tground**2) * (tmod + tground)
              # thermal lag -- Equation 8
              eigen = - (hconv + hsky + hground) / cap * dtime * 3600
              # not sure why this check is done, maybe as a speed optimization?
              if eigen > -10:
                  ex = np.exp(eigen)
              else:
                  ex = 0
              # Equation 7 -- note that `sun` and `sun0` already account for
              # absorption (alpha)
              tmod = tmod0 * ex + (
                  (1 - ex) * (
                      hconv * tamb
                      + hsky * tsky
                      + hground * tground
                      + sun0
                      + (sun - sun0) / eigen
                  ) + sun - sun0
              ) / (hconv + hsky + hground)
          tmod_array[i] = tmod
          tmod0 = tmod
          sun0 = sun
  
      return pd.Series(tmod_array - 273.15, index=poa_global.index, name='tmod')
  
  ```
  --- END FILE ---
  
  Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.
  
  Every *SEARCH/REPLACE* edit must use this format:
  1. The file path
  2. The start of search block: <<<<<<< SEARCH
  3. A contiguous chunk of lines to search for in the existing source code
  4. The dividing line: =======
  5. The lines to replace into the source code
  6. The end of the replace block: >>>>>>> REPLACE
  
  Here is an example:
  
  ```python
  ### mathweb/flask/app.py
  <<<<<<< SEARCH
  from flask import Flask
  =======
  import math
  from flask import Flask
  >>>>>>> REPLACE
  ```
  
  Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
  Wrap the *SEARCH/REPLACE* edit in blocks ```python...```.
  
instance: {"FAIL_TO_PASS": "[\"pvlib/tests/test_temperature.py::test_fuentes_timezone[Etc/GMT+5]\"]", "PASS_TO_PASS": "[\"pvlib/tests/test_temperature.py::test_sapm_cell\", \"pvlib/tests/test_temperature.py::test_sapm_module\", \"pvlib/tests/test_temperature.py::test_sapm_cell_from_module\", \"pvlib/tests/test_temperature.py::test_sapm_ndarray\", \"pvlib/tests/test_temperature.py::test_sapm_series\", \"pvlib/tests/test_temperature.py::test_pvsyst_cell_default\", \"pvlib/tests/test_temperature.py::test_pvsyst_cell_kwargs\", \"pvlib/tests/test_temperature.py::test_pvsyst_cell_ndarray\", \"pvlib/tests/test_temperature.py::test_pvsyst_cell_series\", \"pvlib/tests/test_temperature.py::test_faiman_default\", \"pvlib/tests/test_temperature.py::test_faiman_kwargs\", \"pvlib/tests/test_temperature.py::test_faiman_list\", \"pvlib/tests/test_temperature.py::test_faiman_ndarray\", \"pvlib/tests/test_temperature.py::test_faiman_series\", \"pvlib/tests/test_temperature.py::test__temperature_model_params\", \"pvlib/tests/test_temperature.py::test_fuentes[pvwatts_8760_rackmount.csv-45]\", \"pvlib/tests/test_temperature.py::test_fuentes[pvwatts_8760_roofmount.csv-49]\", \"pvlib/tests/test_temperature.py::test_fuentes_timezone[None]\"]", "base_commit": "04a523fafbd61bc2e49420963b84ed8e2bd1b3cf", "created_at": "2020-10-01T00:53:14Z", "environment_setup_commit": "6e5148f59c5050e8f7a0084b7ae39e93b80f72e6", "hints_text": "", "instance_id": "pvlib__pvlib-python-1072", "patch": "diff --git a/pvlib/temperature.py b/pvlib/temperature.py\n--- a/pvlib/temperature.py\n+++ b/pvlib/temperature.py\n@@ -599,8 +599,9 @@ def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,\n     # n.b. the way Fuentes calculates the first timedelta makes it seem like\n     # the value doesn't matter -- rather than recreate it here, just assume\n     # it's the same as the second timedelta:\n-    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60\n-    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)\n+    timedelta_seconds = poa_global.index.to_series().diff().dt.total_seconds()\n+    timedelta_hours = timedelta_seconds / 3600\n+    timedelta_hours.iloc[0] = timedelta_hours.iloc[1]\n \n     tamb_array = temp_air + 273.15\n     sun_array = poa_global * absorp\n", "problem_statement": "temperature.fuentes errors when given tz-aware inputs on pandas>=1.0.0\n**Describe the bug**\r\nWhen the weather timeseries inputs to `temperature.fuentes` have tz-aware index, an internal call to `np.diff(index)` returns an array of `Timedelta` objects instead of an array of nanosecond ints, throwing an error immediately after.  The error only happens when using pandas>=1.0.0; using 0.25.3 runs successfully, but emits the warning:\r\n\r\n```\r\n  /home/kevin/anaconda3/envs/pvlib-dev/lib/python3.7/site-packages/numpy/lib/function_base.py:1243: FutureWarning: Converting timezone-aware DatetimeArray to timezone-naive ndarray with 'datetime64[ns]' dtype. In the future, this will return an ndarray with 'object' dtype where each element is a 'pandas.Timestamp' with the correct 'tz'.\r\n  \tTo accept the future behavior, pass 'dtype=object'.\r\n  \tTo keep the old behavior, pass 'dtype=\"datetime64[ns]\"'.\r\n    a = asanyarray(a)\r\n```\r\n\r\n**To Reproduce**\r\n```python\r\nIn [1]: import pvlib\r\n   ...: import pandas as pd\r\n   ...: \r\n   ...: index_naive = pd.date_range('2019-01-01', freq='h', periods=3)\r\n   ...: \r\n   ...: kwargs = {\r\n   ...:     'poa_global': pd.Series(1000, index_naive),\r\n   ...:     'temp_air': pd.Series(20, index_naive),\r\n   ...:     'wind_speed': pd.Series(1, index_naive),\r\n   ...:     'noct_installed': 45\r\n   ...: }\r\n   ...: \r\n\r\nIn [2]: print(pvlib.temperature.fuentes(**kwargs))\r\n2019-01-01 00:00:00    47.85\r\n2019-01-01 01:00:00    50.85\r\n2019-01-01 02:00:00    50.85\r\nFreq: H, Name: tmod, dtype: float64\r\n\r\nIn [3]: kwargs['poa_global'].index = index_naive.tz_localize('UTC')\r\n   ...: print(pvlib.temperature.fuentes(**kwargs))\r\n   ...: \r\nTraceback (most recent call last):\r\n\r\n  File \"<ipython-input-3-ff99badadc91>\", line 2, in <module>\r\n    print(pvlib.temperature.fuentes(**kwargs))\r\n\r\n  File \"/home/kevin/anaconda3/lib/python3.7/site-packages/pvlib/temperature.py\", line 602, in fuentes\r\n    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60\r\n\r\nTypeError: float() argument must be a string or a number, not 'Timedelta'\r\n```\r\n\r\n**Expected behavior**\r\n`temperature.fuentes` should work with both tz-naive and tz-aware inputs.\r\n\r\n\r\n**Versions:**\r\n - ``pvlib.__version__``: 0.8.0\r\n - ``pandas.__version__``: 1.0.0+\r\n - python: 3.7.4 (default, Aug 13 2019, 20:35:49) \\n[GCC 7.3.0]\r\n\r\n\n", "repo": "pvlib/pvlib-python", "test_patch": "diff --git a/pvlib/tests/test_temperature.py b/pvlib/tests/test_temperature.py\n--- a/pvlib/tests/test_temperature.py\n+++ b/pvlib/tests/test_temperature.py\n@@ -190,3 +190,17 @@ def test_fuentes(filename, inoct):\n     night_difference = expected_tcell[is_night] - actual_tcell[is_night]\n     assert night_difference.max() < 6\n     assert night_difference.min() > 0\n+\n+\n+@pytest.mark.parametrize('tz', [None, 'Etc/GMT+5'])\n+def test_fuentes_timezone(tz):\n+    index = pd.date_range('2019-01-01', freq='h', periods=3, tz=tz)\n+\n+    df = pd.DataFrame({'poa_global': 1000, 'temp_air': 20, 'wind_speed': 1},\n+                      index)\n+\n+    out = temperature.fuentes(df['poa_global'], df['temp_air'],\n+                              df['wind_speed'], noct_installed=45)\n+\n+    assert_series_equal(out, pd.Series([47.85, 50.85, 50.85], index=index,\n+                                       name='tmod'))\n", "version": "0.7"}
parsed_commit_content: {"file_diffs":[{"old_file_content":"\"\"\"\nThe ``temperature`` module contains functions for modeling temperature of\nPV modules and cells.\n\"\"\"\n\nimport numpy as np\nimport pandas as pd\nfrom pvlib.tools import sind\n\nTEMPERATURE_MODEL_PARAMETERS = {\n    'sapm': {\n        'open_rack_glass_glass': {'a': -3.47, 'b': -.0594, 'deltaT': 3},\n        'close_mount_glass_glass': {'a': -2.98, 'b': -.0471, 'deltaT': 1},\n        'open_rack_glass_polymer': {'a': -3.56, 'b': -.0750, 'deltaT': 3},\n        'insulated_back_glass_polymer': {'a': -2.81, 'b': -.0455, 'deltaT': 0},\n    },\n    'pvsyst': {'freestanding': {'u_c': 29.0, 'u_v': 0},\n               'insulated': {'u_c': 15.0, 'u_v': 0}}\n}\n\"\"\"Dictionary of temperature parameters organized by model.\n\nThere are keys for each model at the top level. Currently there are two models,\n``'sapm'`` for the Sandia Array Performance Model, and ``'pvsyst'``. Each model\nhas a dictionary of configurations; a value is itself a dictionary containing\nmodel parameters. Retrieve parameters by indexing the model and configuration\nby name. Note: the keys are lower-cased and case sensitive.\n\nExample\n-------\nRetrieve the open rack glass-polymer configuration for SAPM::\n\n    from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS\n    temperature_model_parameters = (\n        TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer'])\n    # {'a': -3.56, 'b': -0.075, 'deltaT': 3}\n\"\"\"\n\n\ndef _temperature_model_params(model, parameter_set):\n    try:\n        params = TEMPERATURE_MODEL_PARAMETERS[model]\n        return params[parameter_set]\n    except KeyError:\n        msg = ('{} is not a named set of parameters for the {} cell'\n               ' temperature model.'\n               ' See pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS'\n               ' for names'.format(parameter_set, model))\n        raise KeyError(msg)\n\n\ndef sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT,\n              irrad_ref=1000):\n    r'''\n    Calculate cell temperature per the Sandia Array Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1`.\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by a pair of\n    equations (Eq. 11 and 12 in [1]_).\n\n    .. math::\n       :label: sapm1\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    .. math::\n       :label: sapm2\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model parameters depend both on\n    the module construction and its mounting. Parameter sets are provided in\n    [1]_ for representative modules and mounting, and are coded for convenience\n    in :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell_from_module\n    sapm_module\n\n    Examples\n    --------\n    >>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']\n    >>> sapm_cell(1000, 10, 0, **params)\n    44.11703066106086\n    '''\n    module_temperature = sapm_module(poa_global, temp_air, wind_speed,\n                                     a, b)\n    return sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                                 irrad_ref)\n\n\ndef sapm_module(poa_global, temp_air, wind_speed, a, b):\n    r'''\n    Calculate module back surface temperature per the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1mod`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1mod`.\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for module temperature :math:`T_{m}` is given by Eq. 11 in [1]_.\n\n    .. math::\n       :label: sapm1mod\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model outputs are surface\n    temperature at the back of the module :math:`T_{m}` and cell temperature\n    :math:`T_{C}`. Model parameters depend both on the module construction and\n    its mounting. Parameter sets are provided in [1]_ for representative\n    modules and mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_cell_from_module\n    '''\n    return poa_global * np.exp(a + b * wind_speed) + temp_air\n\n\ndef sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                          irrad_ref=1000):\n    r'''\n    Calculate cell temperature from module temperature using the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    module_temperature : numeric\n        Temperature of back of module surface [C].\n\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2_cell_from_mod` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by Eq. 12 in [1]_.\n\n    .. math::\n       :label: sapm2_cell_from_mod\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Model parameters depend both on the module construction and its mounting.\n    Parameter sets are provided in [1]_ for representative modules and\n    mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_module\n    '''\n    return module_temperature + (poa_global / irrad_ref) * deltaT\n\n\ndef pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0,\n                eta_m=0.1, alpha_absorption=0.9):\n    r\"\"\"\n    Calculate cell temperature using an empirical heat loss factor model\n    as implemented in PVsyst.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/2 is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u_c : float, default 29.0\n        Combined heat loss factor coefficient. The default value is\n        representative of freestanding modules with the rear surfaces exposed\n        to open air (e.g., rack mounted). Parameter :math:`U_{c}` in\n        :eq:`pvsyst`.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u_v : float, default 0.0\n        Combined heat loss factor influenced by wind. Parameter :math:`U_{v}`\n        in :eq:`pvsyst`.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    eta_m : numeric, default 0.1\n        Module external efficiency as a fraction, i.e., DC power / poa_global.\n        Parameter :math:`\\eta_{m}` in :eq:`pvsyst`.\n\n    alpha_absorption : numeric, default 0.9\n        Absorption coefficient. Parameter :math:`\\alpha` in :eq:`pvsyst`.\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    The Pvsyst model for cell temperature :math:`T_{C}` is given by\n\n    .. math::\n       :label: pvsyst\n\n        T_{C} = T_{a} + \\frac{\\alpha E (1 - \\eta_{m})}{U_{c} + U_{v} \\times WS}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2), ambient\n    air temperature :math:`T_{a}` (C) and wind speed :math:`WS` (m/s). Model\n    output is cell temperature :math:`T_{C}`. Model parameters depend both on\n    the module construction and its mounting. Parameters are provided in\n    [1]_ for open (freestanding) and close (insulated) mounting configurations,\n    , and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`. The heat loss\n    factors provided represent the combined effect of convection, radiation and\n    conduction, and their values are experimentally determined.\n\n    +--------------+---------------+---------------+\n    | Mounting     | :math:`U_{c}` | :math:`U_{v}` |\n    +==============+===============+===============+\n    | freestanding | 29.0          | 0.0           |\n    +--------------+---------------+---------------+\n    | insulated    | 15.0          | 0.0           |\n    +--------------+---------------+---------------+\n\n    References\n    ----------\n    .. [1] \"PVsyst 6 Help\", Files.pvsyst.com, 2018. [Online]. Available:\n       http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].\n\n    .. [2] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    Examples\n    --------\n    >>> from pvlib.temperature import pvsyst_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['pvsyst']['freestanding']\n    >>> pvsyst_cell(1000, 10, **params)\n    37.93103448275862\n    \"\"\"\n\n    total_loss_factor = u_c + u_v * wind_speed\n    heat_input = poa_global * alpha_absorption * (1 - eta_m)\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef faiman(poa_global, temp_air, wind_speed=1.0, u0=25.0, u1=6.84):\n    r'''\n    Calculate cell or module temperature using the Faiman model.  The Faiman\n    model uses an empirical heat loss factor model [1]_ and is adopted in the\n    IEC 61853 standards [2]_ and [3]_.\n\n    Usage of this model in the IEC 61853 standard does not distinguish\n    between cell and module temperature.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/s is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u0 : numeric, default 25.0\n        Combined heat loss factor coefficient. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u1 : numeric, default 6.84\n        Combined heat loss factor influenced by wind. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    All arguments may be scalars or vectors. If multiple arguments\n    are vectors they must be the same length.\n\n    References\n    ----------\n    .. [1] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    .. [2] \"IEC 61853-2 Photovoltaic (PV) module performance testing and energy\n       rating - Part 2: Spectral responsivity, incidence angle and module\n       operating temperature measurements\". IEC, Geneva, 2018.\n\n    .. [3] \"IEC 61853-3 Photovoltaic (PV) module performance testing and energy\n       rating - Part 3: Energy rating of PV modules\". IEC, Geneva, 2018.\n\n    '''\n    # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Dec., 2019\n\n    # The following lines may seem odd since u0 & u1 are probably scalar,\n    # but it serves an indirect and easy way of allowing lists and\n    # tuples for the other function arguments.\n    u0 = np.asanyarray(u0)\n    u1 = np.asanyarray(u1)\n\n    total_loss_factor = u0 + u1 * wind_speed\n    heat_input = poa_global\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef _fuentes_hconv(tave, windmod, tinoct, temp_delta, xlen, tilt,\n                   check_reynold):\n    # Calculate the convective coefficient as in Fuentes 1987 -- a mixture of\n    # free, laminar, and turbulent convection.\n    densair = 0.003484 * 101325.0 / tave  # density\n    visair = 0.24237e-6 * tave**0.76 / densair  # kinematic viscosity\n    condair = 2.1695e-4 * tave**0.84  # thermal conductivity\n    reynold = windmod * xlen / visair\n    # the boundary between laminar and turbulent is modeled as an abrupt\n    # change at Re = 1.2e5:\n    if check_reynold and reynold > 1.2e5:\n        # turbulent convection\n        hforce = 0.0282 / reynold**0.2 * densair * windmod * 1007 / 0.71**0.4\n    else:\n        # laminar convection\n        hforce = 0.8600 / reynold**0.5 * densair * windmod * 1007 / 0.71**0.67\n    # free convection via Grashof number\n    # NB: Fuentes hardwires sind(tilt) as 0.5 for tilt=30\n    grashof = 9.8 / tave * temp_delta * xlen**3 / visair**2 * sind(tilt)\n    # product of Nusselt number and (k/l)\n    hfree = 0.21 * (grashof * 0.71)**0.32 * condair / xlen\n    # combine free and forced components\n    hconv = (hfree**3 + hforce**3)**(1/3)\n    return hconv\n\n\ndef _hydraulic_diameter(width, height):\n    # calculate the hydraulic diameter of a rectangle\n    return 2 * (width * height) / (width + height)\n\n\ndef fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,\n            wind_height=9.144, emissivity=0.84, absorption=0.83,\n            surface_tilt=30, module_width=0.31579, module_length=1.2):\n    \"\"\"\n    Calculate cell or module temperature using the Fuentes model.\n\n    The Fuentes model is a first-principles heat transfer energy balance\n    model [1]_ that is used in PVWatts for cell temperature modeling [2]_.\n\n    Parameters\n    ----------\n    poa_global : pandas Series\n        Total incident irradiance [W/m^2]\n\n    temp_air : pandas Series\n        Ambient dry bulb temperature [C]\n\n    wind_speed : pandas Series\n        Wind speed [m/s]\n\n    noct_installed : float\n        The \"installed\" nominal operating cell temperature as defined in [1]_.\n        PVWatts assumes this value to be 45 C for rack-mounted arrays and\n        49 C for roof mount systems with restricted air flow around the\n        module.  [C]\n\n    module_height : float, default 5.0\n        The height above ground of the center of the module. The PVWatts\n        default is 5.0 [m]\n\n    wind_height : float, default 9.144\n        The height above ground at which ``wind_speed`` is measured. The\n        PVWatts defauls is 9.144 [m]\n\n    emissivity : float, default 0.84\n        The effectiveness of the module at radiating thermal energy. [unitless]\n\n    absorption : float, default 0.83\n        The fraction of incident irradiance that is converted to thermal\n        energy in the module. [unitless]\n\n    surface_tilt : float, default 30\n        Module tilt from horizontal. If not provided, the default value\n        of 30 degrees from [1]_ and [2]_ is used. [degrees]\n\n    module_width : float, default 0.31579\n        Module width. The default value of 0.31579 meters in combination with\n        the default `module_length` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    module_length : float, default 1.2\n        Module length. The default value of 1.2 meters in combination with\n        the default `module_width` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    Returns\n    -------\n    temperature_cell : pandas Series\n        The modeled cell temperature [C]\n\n    Notes\n    -----\n    This function returns slightly different values from PVWatts at night\n    and just after dawn. This is because the SAM SSC assumes that module\n    temperature equals ambient temperature when irradiance is zero so it can\n    skip the heat balance calculation at night.\n\n    References\n    ----------\n    .. [1] Fuentes, M. K., 1987, \"A Simplifed Thermal Model for Flat-Plate\n           Photovoltaic Arrays\", SAND85-0330, Sandia National Laboratories,\n           Albuquerque NM.\n           http://prod.sandia.gov/techlib/access-control.cgi/1985/850330.pdf\n    .. [2] Dobos, A. P., 2014, \"PVWatts Version 5 Manual\", NREL/TP-6A20-62641,\n           National Renewable Energy Laboratory, Golden CO.\n           doi:10.2172/1158421.\n    \"\"\"\n    # ported from the FORTRAN77 code provided in Appendix A of Fuentes 1987;\n    # nearly all variable names are kept the same for ease of comparison.\n\n    boltz = 5.669e-8\n    emiss = emissivity\n    absorp = absorption\n    xlen = _hydraulic_diameter(module_width, module_length)\n    # cap0 has units of [J / (m^2 K)], equal to mass per unit area times\n    # specific heat of the module.\n    cap0 = 11000\n    tinoct = noct_installed + 273.15\n\n    # convective coefficient of top surface of module at NOCT\n    windmod = 1.0\n    tave = (tinoct + 293.15) / 2\n    hconv = _fuentes_hconv(tave, windmod, tinoct, tinoct - 293.15, xlen,\n                           surface_tilt, False)\n\n    # determine the ground temperature ratio and the ratio of the total\n    # convection to the top side convection\n    hground = emiss * boltz * (tinoct**2 + 293.15**2) * (tinoct + 293.15)\n    backrat = (\n        absorp * 800.0\n        - emiss * boltz * (tinoct**4 - 282.21**4)\n        - hconv * (tinoct - 293.15)\n    ) / ((hground + hconv) * (tinoct - 293.15))\n    tground = (tinoct**4 - backrat * (tinoct**4 - 293.15**4))**0.25\n    tground = np.clip(tground, 293.15, tinoct)\n\n    tgrat = (tground - 293.15) / (tinoct - 293.15)\n    convrat = (absorp * 800 - emiss * boltz * (\n        2 * tinoct**4 - 282.21**4 - tground**4)) / (hconv * (tinoct - 293.15))\n\n    # adjust the capacitance (thermal mass) of the module based on the INOCT.\n    # It is a function of INOCT because high INOCT implies thermal coupling\n    # with the racking (e.g. roofmount), so the thermal mass is increased.\n    # `cap` has units J/(m^2 C) -- see Table 3, Equations 26 & 27\n    cap = cap0\n    if tinoct > 321.15:\n        cap = cap * (1 + (tinoct - 321.15) / 12)\n\n    # iterate through timeseries inputs\n    sun0 = 0\n    tmod0 = 293.15\n\n    # n.b. the way Fuentes calculates the first timedelta makes it seem like\n    # the value doesn't matter -- rather than recreate it here, just assume\n    # it's the same as the second timedelta:\n    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60\n    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)\n\n    tamb_array = temp_air + 273.15\n    sun_array = poa_global * absorp\n\n    # Two of the calculations are easily vectorized, so precalculate them:\n    # sky temperature -- Equation 24\n    tsky_array = 0.68 * (0.0552 * tamb_array**1.5) + 0.32 * tamb_array\n    # wind speed at module height -- Equation 22\n    # not sure why the 1e-4 factor is included -- maybe the equations don't\n    # behave well if wind == 0?\n    windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4\n\n    tmod0 = 293.15\n    tmod_array = np.zeros_like(poa_global)\n\n    iterator = zip(tamb_array, sun_array, windmod_array, tsky_array,\n                   timedelta_hours)\n    for i, (tamb, sun, windmod, tsky, dtime) in enumerate(iterator):\n        # solve the heat transfer equation, iterating because the heat loss\n        # terms depend on tmod. NB Fuentes doesn't show that 10 iterations is\n        # sufficient for convergence.\n        tmod = tmod0\n        for j in range(10):\n            # overall convective coefficient\n            tave = (tmod + tamb) / 2\n            hconv = convrat * _fuentes_hconv(tave, windmod, tinoct,\n                                             abs(tmod-tamb), xlen,\n                                             surface_tilt, True)\n            # sky radiation coefficient (Equation 3)\n            hsky = emiss * boltz * (tmod**2 + tsky**2) * (tmod + tsky)\n            # ground radiation coeffieicient (Equation 4)\n            tground = tamb + tgrat * (tmod - tamb)\n            hground = emiss * boltz * (tmod**2 + tground**2) * (tmod + tground)\n            # thermal lag -- Equation 8\n            eigen = - (hconv + hsky + hground) / cap * dtime * 3600\n            # not sure why this check is done, maybe as a speed optimization?\n            if eigen > -10:\n                ex = np.exp(eigen)\n            else:\n                ex = 0\n            # Equation 7 -- note that `sun` and `sun0` already account for\n            # absorption (alpha)\n            tmod = tmod0 * ex + (\n                (1 - ex) * (\n                    hconv * tamb\n                    + hsky * tsky\n                    + hground * tground\n                    + sun0\n                    + (sun - sun0) / eigen\n                ) + sun - sun0\n            ) / (hconv + hsky + hground)\n        tmod_array[i] = tmod\n        tmod0 = tmod\n        sun0 = sun\n\n    return pd.Series(tmod_array - 273.15, index=poa_global.index, name='tmod')\n","new_file_content":"\"\"\"\nThe ``temperature`` module contains functions for modeling temperature of\nPV modules and cells.\n\"\"\"\n\nimport numpy as np\nimport pandas as pd\nfrom pvlib.tools import sind\n\nTEMPERATURE_MODEL_PARAMETERS = {\n    'sapm': {\n        'open_rack_glass_glass': {'a': -3.47, 'b': -.0594, 'deltaT': 3},\n        'close_mount_glass_glass': {'a': -2.98, 'b': -.0471, 'deltaT': 1},\n        'open_rack_glass_polymer': {'a': -3.56, 'b': -.0750, 'deltaT': 3},\n        'insulated_back_glass_polymer': {'a': -2.81, 'b': -.0455, 'deltaT': 0},\n    },\n    'pvsyst': {'freestanding': {'u_c': 29.0, 'u_v': 0},\n               'insulated': {'u_c': 15.0, 'u_v': 0}}\n}\n\"\"\"Dictionary of temperature parameters organized by model.\n\nThere are keys for each model at the top level. Currently there are two models,\n``'sapm'`` for the Sandia Array Performance Model, and ``'pvsyst'``. Each model\nhas a dictionary of configurations; a value is itself a dictionary containing\nmodel parameters. Retrieve parameters by indexing the model and configuration\nby name. Note: the keys are lower-cased and case sensitive.\n\nExample\n-------\nRetrieve the open rack glass-polymer configuration for SAPM::\n\n    from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS\n    temperature_model_parameters = (\n        TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer'])\n    # {'a': -3.56, 'b': -0.075, 'deltaT': 3}\n\"\"\"\n\n\ndef _temperature_model_params(model, parameter_set):\n    try:\n        params = TEMPERATURE_MODEL_PARAMETERS[model]\n        return params[parameter_set]\n    except KeyError:\n        msg = ('{} is not a named set of parameters for the {} cell'\n               ' temperature model.'\n               ' See pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS'\n               ' for names'.format(parameter_set, model))\n        raise KeyError(msg)\n\n\ndef sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT,\n              irrad_ref=1000):\n    r'''\n    Calculate cell temperature per the Sandia Array Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1`.\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by a pair of\n    equations (Eq. 11 and 12 in [1]_).\n\n    .. math::\n       :label: sapm1\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    .. math::\n       :label: sapm2\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model parameters depend both on\n    the module construction and its mounting. Parameter sets are provided in\n    [1]_ for representative modules and mounting, and are coded for convenience\n    in :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell_from_module\n    sapm_module\n\n    Examples\n    --------\n    >>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']\n    >>> sapm_cell(1000, 10, 0, **params)\n    44.11703066106086\n    '''\n    module_temperature = sapm_module(poa_global, temp_air, wind_speed,\n                                     a, b)\n    return sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                                 irrad_ref)\n\n\ndef sapm_module(poa_global, temp_air, wind_speed, a, b):\n    r'''\n    Calculate module back surface temperature per the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1mod`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1mod`.\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for module temperature :math:`T_{m}` is given by Eq. 11 in [1]_.\n\n    .. math::\n       :label: sapm1mod\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model outputs are surface\n    temperature at the back of the module :math:`T_{m}` and cell temperature\n    :math:`T_{C}`. Model parameters depend both on the module construction and\n    its mounting. Parameter sets are provided in [1]_ for representative\n    modules and mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_cell_from_module\n    '''\n    return poa_global * np.exp(a + b * wind_speed) + temp_air\n\n\ndef sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                          irrad_ref=1000):\n    r'''\n    Calculate cell temperature from module temperature using the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    module_temperature : numeric\n        Temperature of back of module surface [C].\n\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2_cell_from_mod` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by Eq. 12 in [1]_.\n\n    .. math::\n       :label: sapm2_cell_from_mod\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Model parameters depend both on the module construction and its mounting.\n    Parameter sets are provided in [1]_ for representative modules and\n    mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_module\n    '''\n    return module_temperature + (poa_global / irrad_ref) * deltaT\n\n\ndef pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0,\n                eta_m=0.1, alpha_absorption=0.9):\n    r\"\"\"\n    Calculate cell temperature using an empirical heat loss factor model\n    as implemented in PVsyst.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/2 is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u_c : float, default 29.0\n        Combined heat loss factor coefficient. The default value is\n        representative of freestanding modules with the rear surfaces exposed\n        to open air (e.g., rack mounted). Parameter :math:`U_{c}` in\n        :eq:`pvsyst`.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u_v : float, default 0.0\n        Combined heat loss factor influenced by wind. Parameter :math:`U_{v}`\n        in :eq:`pvsyst`.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    eta_m : numeric, default 0.1\n        Module external efficiency as a fraction, i.e., DC power / poa_global.\n        Parameter :math:`\\eta_{m}` in :eq:`pvsyst`.\n\n    alpha_absorption : numeric, default 0.9\n        Absorption coefficient. Parameter :math:`\\alpha` in :eq:`pvsyst`.\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    The Pvsyst model for cell temperature :math:`T_{C}` is given by\n\n    .. math::\n       :label: pvsyst\n\n        T_{C} = T_{a} + \\frac{\\alpha E (1 - \\eta_{m})}{U_{c} + U_{v} \\times WS}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2), ambient\n    air temperature :math:`T_{a}` (C) and wind speed :math:`WS` (m/s). Model\n    output is cell temperature :math:`T_{C}`. Model parameters depend both on\n    the module construction and its mounting. Parameters are provided in\n    [1]_ for open (freestanding) and close (insulated) mounting configurations,\n    , and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`. The heat loss\n    factors provided represent the combined effect of convection, radiation and\n    conduction, and their values are experimentally determined.\n\n    +--------------+---------------+---------------+\n    | Mounting     | :math:`U_{c}` | :math:`U_{v}` |\n    +==============+===============+===============+\n    | freestanding | 29.0          | 0.0           |\n    +--------------+---------------+---------------+\n    | insulated    | 15.0          | 0.0           |\n    +--------------+---------------+---------------+\n\n    References\n    ----------\n    .. [1] \"PVsyst 6 Help\", Files.pvsyst.com, 2018. [Online]. Available:\n       http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].\n\n    .. [2] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    Examples\n    --------\n    >>> from pvlib.temperature import pvsyst_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['pvsyst']['freestanding']\n    >>> pvsyst_cell(1000, 10, **params)\n    37.93103448275862\n    \"\"\"\n\n    total_loss_factor = u_c + u_v * wind_speed\n    heat_input = poa_global * alpha_absorption * (1 - eta_m)\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef faiman(poa_global, temp_air, wind_speed=1.0, u0=25.0, u1=6.84):\n    r'''\n    Calculate cell or module temperature using the Faiman model.  The Faiman\n    model uses an empirical heat loss factor model [1]_ and is adopted in the\n    IEC 61853 standards [2]_ and [3]_.\n\n    Usage of this model in the IEC 61853 standard does not distinguish\n    between cell and module temperature.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/s is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u0 : numeric, default 25.0\n        Combined heat loss factor coefficient. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u1 : numeric, default 6.84\n        Combined heat loss factor influenced by wind. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    All arguments may be scalars or vectors. If multiple arguments\n    are vectors they must be the same length.\n\n    References\n    ----------\n    .. [1] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    .. [2] \"IEC 61853-2 Photovoltaic (PV) module performance testing and energy\n       rating - Part 2: Spectral responsivity, incidence angle and module\n       operating temperature measurements\". IEC, Geneva, 2018.\n\n    .. [3] \"IEC 61853-3 Photovoltaic (PV) module performance testing and energy\n       rating - Part 3: Energy rating of PV modules\". IEC, Geneva, 2018.\n\n    '''\n    # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Dec., 2019\n\n    # The following lines may seem odd since u0 & u1 are probably scalar,\n    # but it serves an indirect and easy way of allowing lists and\n    # tuples for the other function arguments.\n    u0 = np.asanyarray(u0)\n    u1 = np.asanyarray(u1)\n\n    total_loss_factor = u0 + u1 * wind_speed\n    heat_input = poa_global\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef _fuentes_hconv(tave, windmod, tinoct, temp_delta, xlen, tilt,\n                   check_reynold):\n    # Calculate the convective coefficient as in Fuentes 1987 -- a mixture of\n    # free, laminar, and turbulent convection.\n    densair = 0.003484 * 101325.0 / tave  # density\n    visair = 0.24237e-6 * tave**0.76 / densair  # kinematic viscosity\n    condair = 2.1695e-4 * tave**0.84  # thermal conductivity\n    reynold = windmod * xlen / visair\n    # the boundary between laminar and turbulent is modeled as an abrupt\n    # change at Re = 1.2e5:\n    if check_reynold and reynold > 1.2e5:\n        # turbulent convection\n        hforce = 0.0282 / reynold**0.2 * densair * windmod * 1007 / 0.71**0.4\n    else:\n        # laminar convection\n        hforce = 0.8600 / reynold**0.5 * densair * windmod * 1007 / 0.71**0.67\n    # free convection via Grashof number\n    # NB: Fuentes hardwires sind(tilt) as 0.5 for tilt=30\n    grashof = 9.8 / tave * temp_delta * xlen**3 / visair**2 * sind(tilt)\n    # product of Nusselt number and (k/l)\n    hfree = 0.21 * (grashof * 0.71)**0.32 * condair / xlen\n    # combine free and forced components\n    hconv = (hfree**3 + hforce**3)**(1/3)\n    return hconv\n\n\ndef _hydraulic_diameter(width, height):\n    # calculate the hydraulic diameter of a rectangle\n    return 2 * (width * height) / (width + height)\n\n\ndef fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,\n            wind_height=9.144, emissivity=0.84, absorption=0.83,\n            surface_tilt=30, module_width=0.31579, module_length=1.2):\n    \"\"\"\n    Calculate cell or module temperature using the Fuentes model.\n\n    The Fuentes model is a first-principles heat transfer energy balance\n    model [1]_ that is used in PVWatts for cell temperature modeling [2]_.\n\n    Parameters\n    ----------\n    poa_global : pandas Series\n        Total incident irradiance [W/m^2]\n\n    temp_air : pandas Series\n        Ambient dry bulb temperature [C]\n\n    wind_speed : pandas Series\n        Wind speed [m/s]\n\n    noct_installed : float\n        The \"installed\" nominal operating cell temperature as defined in [1]_.\n        PVWatts assumes this value to be 45 C for rack-mounted arrays and\n        49 C for roof mount systems with restricted air flow around the\n        module.  [C]\n\n    module_height : float, default 5.0\n        The height above ground of the center of the module. The PVWatts\n        default is 5.0 [m]\n\n    wind_height : float, default 9.144\n        The height above ground at which ``wind_speed`` is measured. The\n        PVWatts defauls is 9.144 [m]\n\n    emissivity : float, default 0.84\n        The effectiveness of the module at radiating thermal energy. [unitless]\n\n    absorption : float, default 0.83\n        The fraction of incident irradiance that is converted to thermal\n        energy in the module. [unitless]\n\n    surface_tilt : float, default 30\n        Module tilt from horizontal. If not provided, the default value\n        of 30 degrees from [1]_ and [2]_ is used. [degrees]\n\n    module_width : float, default 0.31579\n        Module width. The default value of 0.31579 meters in combination with\n        the default `module_length` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    module_length : float, default 1.2\n        Module length. The default value of 1.2 meters in combination with\n        the default `module_width` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    Returns\n    -------\n    temperature_cell : pandas Series\n        The modeled cell temperature [C]\n\n    Notes\n    -----\n    This function returns slightly different values from PVWatts at night\n    and just after dawn. This is because the SAM SSC assumes that module\n    temperature equals ambient temperature when irradiance is zero so it can\n    skip the heat balance calculation at night.\n\n    References\n    ----------\n    .. [1] Fuentes, M. K., 1987, \"A Simplifed Thermal Model for Flat-Plate\n           Photovoltaic Arrays\", SAND85-0330, Sandia National Laboratories,\n           Albuquerque NM.\n           http://prod.sandia.gov/techlib/access-control.cgi/1985/850330.pdf\n    .. [2] Dobos, A. P., 2014, \"PVWatts Version 5 Manual\", NREL/TP-6A20-62641,\n           National Renewable Energy Laboratory, Golden CO.\n           doi:10.2172/1158421.\n    \"\"\"\n    # ported from the FORTRAN77 code provided in Appendix A of Fuentes 1987;\n    # nearly all variable names are kept the same for ease of comparison.\n\n    boltz = 5.669e-8\n    emiss = emissivity\n    absorp = absorption\n    xlen = _hydraulic_diameter(module_width, module_length)\n    # cap0 has units of [J / (m^2 K)], equal to mass per unit area times\n    # specific heat of the module.\n    cap0 = 11000\n    tinoct = noct_installed + 273.15\n\n    # convective coefficient of top surface of module at NOCT\n    windmod = 1.0\n    tave = (tinoct + 293.15) / 2\n    hconv = _fuentes_hconv(tave, windmod, tinoct, tinoct - 293.15, xlen,\n                           surface_tilt, False)\n\n    # determine the ground temperature ratio and the ratio of the total\n    # convection to the top side convection\n    hground = emiss * boltz * (tinoct**2 + 293.15**2) * (tinoct + 293.15)\n    backrat = (\n        absorp * 800.0\n        - emiss * boltz * (tinoct**4 - 282.21**4)\n        - hconv * (tinoct - 293.15)\n    ) / ((hground + hconv) * (tinoct - 293.15))\n    tground = (tinoct**4 - backrat * (tinoct**4 - 293.15**4))**0.25\n    tground = np.clip(tground, 293.15, tinoct)\n\n    tgrat = (tground - 293.15) / (tinoct - 293.15)\n    convrat = (absorp * 800 - emiss * boltz * (\n        2 * tinoct**4 - 282.21**4 - tground**4)) / (hconv * (tinoct - 293.15))\n\n    # adjust the capacitance (thermal mass) of the module based on the INOCT.\n    # It is a function of INOCT because high INOCT implies thermal coupling\n    # with the racking (e.g. roofmount), so the thermal mass is increased.\n    # `cap` has units J/(m^2 C) -- see Table 3, Equations 26 & 27\n    cap = cap0\n    if tinoct > 321.15:\n        cap = cap * (1 + (tinoct - 321.15) / 12)\n\n    # iterate through timeseries inputs\n    sun0 = 0\n    tmod0 = 293.15\n\n    # n.b. the way Fuentes calculates the first timedelta makes it seem like\n    # the value doesn't matter -- rather than recreate it here, just assume\n    # it's the same as the second timedelta:\n    timedelta_seconds = poa_global.index.to_series().diff().dt.total_seconds()\n    timedelta_hours = timedelta_seconds / 3600\n    timedelta_hours.iloc[0] = timedelta_hours.iloc[1]\n\n    tamb_array = temp_air + 273.15\n    sun_array = poa_global * absorp\n\n    # Two of the calculations are easily vectorized, so precalculate them:\n    # sky temperature -- Equation 24\n    tsky_array = 0.68 * (0.0552 * tamb_array**1.5) + 0.32 * tamb_array\n    # wind speed at module height -- Equation 22\n    # not sure why the 1e-4 factor is included -- maybe the equations don't\n    # behave well if wind == 0?\n    windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4\n\n    tmod0 = 293.15\n    tmod_array = np.zeros_like(poa_global)\n\n    iterator = zip(tamb_array, sun_array, windmod_array, tsky_array,\n                   timedelta_hours)\n    for i, (tamb, sun, windmod, tsky, dtime) in enumerate(iterator):\n        # solve the heat transfer equation, iterating because the heat loss\n        # terms depend on tmod. NB Fuentes doesn't show that 10 iterations is\n        # sufficient for convergence.\n        tmod = tmod0\n        for j in range(10):\n            # overall convective coefficient\n            tave = (tmod + tamb) / 2\n            hconv = convrat * _fuentes_hconv(tave, windmod, tinoct,\n                                             abs(tmod-tamb), xlen,\n                                             surface_tilt, True)\n            # sky radiation coefficient (Equation 3)\n            hsky = emiss * boltz * (tmod**2 + tsky**2) * (tmod + tsky)\n            # ground radiation coeffieicient (Equation 4)\n            tground = tamb + tgrat * (tmod - tamb)\n            hground = emiss * boltz * (tmod**2 + tground**2) * (tmod + tground)\n            # thermal lag -- Equation 8\n            eigen = - (hconv + hsky + hground) / cap * dtime * 3600\n            # not sure why this check is done, maybe as a speed optimization?\n            if eigen > -10:\n                ex = np.exp(eigen)\n            else:\n                ex = 0\n            # Equation 7 -- note that `sun` and `sun0` already account for\n            # absorption (alpha)\n            tmod = tmod0 * ex + (\n                (1 - ex) * (\n                    hconv * tamb\n                    + hsky * tsky\n                    + hground * tground\n                    + sun0\n                    + (sun - sun0) / eigen\n                ) + sun - sun0\n            ) / (hconv + hsky + hground)\n        tmod_array[i] = tmod\n        tmod0 = tmod\n        sun0 = sun\n\n    return pd.Series(tmod_array - 273.15, index=poa_global.index, name='tmod')\n","header":{"file":{"path":"pvlib/temperature.py"},"misc_line":null},"index_line":null,"is_binary_file":false,"binary_line":null,"minus_file":{"path":"a/pvlib/temperature.py"},"plus_file":{"path":"b/pvlib/temperature.py"},"hunks":[{"descriptor":{"old_range":{"start":599,"length":8},"new_range":{"start":599,"length":9},"section":"def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,"},"line_group":{"all_lines":[{"content":"    # n.b. the way Fuentes calculates the first timedelta makes it seem like","type":"context"},{"content":"    # the value doesn't matter -- rather than recreate it here, just assume","type":"context"},{"content":"    # it's the same as the second timedelta:","type":"context"},{"content":"    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60","type":"deleted"},{"content":"    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)","type":"deleted"},{"content":"    timedelta_seconds = poa_global.index.to_series().diff().dt.total_seconds()","type":"added"},{"content":"    timedelta_hours = timedelta_seconds / 3600","type":"added"},{"content":"    timedelta_hours.iloc[0] = timedelta_hours.iloc[1]","type":"added"},{"content":"","type":"context"},{"content":"    tamb_array = temp_air + 273.15","type":"context"},{"content":"    sun_array = poa_global * absorp","type":"context"},{"content":"","type":"context"}]},"modified_entities":[],"added_entities":[],"deleted_entities":[]}]}],"old_commit_hash":"04a523fafbd61bc2e49420963b84ed8e2bd1b3cf","new_commit_hash":"c1f88e3b89effa0e6da2c88284c94cc6ca60ea11","commit_message":"suggestion from review","commit_date":"2020-10-08T18:58:57-06:00","metadata":{}}
problem_statement: temperature.fuentes errors when given tz-aware inputs on pandas>=1.0.0
  **Describe the bug**
  When the weather timeseries inputs to `temperature.fuentes` have tz-aware index, an internal call to `np.diff(index)` returns an array of `Timedelta` objects instead of an array of nanosecond ints, throwing an error immediately after.  The error only happens when using pandas>=1.0.0; using 0.25.3 runs successfully, but emits the warning:
  
  ```
    /home/kevin/anaconda3/envs/pvlib-dev/lib/python3.7/site-packages/numpy/lib/function_base.py:1243: FutureWarning: Converting timezone-aware DatetimeArray to timezone-naive ndarray with 'datetime64[ns]' dtype. In the future, this will return an ndarray with 'object' dtype where each element is a 'pandas.Timestamp' with the correct 'tz'.
    	To accept the future behavior, pass 'dtype=object'.
    	To keep the old behavior, pass 'dtype="datetime64[ns]"'.
      a = asanyarray(a)
  ```
  
  **To Reproduce**
  ```python
  In [1]: import pvlib
     ...: import pandas as pd
     ...: 
     ...: index_naive = pd.date_range('2019-01-01', freq='h', periods=3)
     ...: 
     ...: kwargs = {
     ...:     'poa_global': pd.Series(1000, index_naive),
     ...:     'temp_air': pd.Series(20, index_naive),
     ...:     'wind_speed': pd.Series(1, index_naive),
     ...:     'noct_installed': 45
     ...: }
     ...: 
  
  In [2]: print(pvlib.temperature.fuentes(**kwargs))
  2019-01-01 00:00:00    47.85
  2019-01-01 01:00:00    50.85
  2019-01-01 02:00:00    50.85
  Freq: H, Name: tmod, dtype: float64
  
  In [3]: kwargs['poa_global'].index = index_naive.tz_localize('UTC')
     ...: print(pvlib.temperature.fuentes(**kwargs))
     ...: 
  Traceback (most recent call last):
  
    File "<ipython-input-3-ff99badadc91>", line 2, in <module>
      print(pvlib.temperature.fuentes(**kwargs))
  
    File "/home/kevin/anaconda3/lib/python3.7/site-packages/pvlib/temperature.py", line 602, in fuentes
      timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60
  
  TypeError: float() argument must be a string or a number, not 'Timedelta'
  ```
  
  **Expected behavior**
  `temperature.fuentes` should work with both tz-naive and tz-aware inputs.
  
  
  **Versions:**
   - ``pvlib.__version__``: 0.8.0
   - ``pandas.__version__``: 1.0.0+
   - python: 3.7.4 (default, Aug 13 2019, 20:35:49) \n[GCC 7.3.0]
  
  
  
patch: diff --git a/pvlib/temperature.py b/pvlib/temperature.py
  --- a/pvlib/temperature.py
  +++ b/pvlib/temperature.py
  @@ -599,8 +599,9 @@ def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,
       # n.b. the way Fuentes calculates the first timedelta makes it seem like
       # the value doesn't matter -- rather than recreate it here, just assume
       # it's the same as the second timedelta:
  -    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60
  -    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)
  +    timedelta_seconds = poa_global.index.to_series().diff().dt.total_seconds()
  +    timedelta_hours = timedelta_seconds / 3600
  +    timedelta_hours.iloc[0] = timedelta_hours.iloc[1]
   
       tamb_array = temp_air + 273.15
       sun_array = poa_global * absorp
   
  
file_context: {"pvlib/temperature.py": "\"\"\"\nThe ``temperature`` module contains functions for modeling temperature of\nPV modules and cells.\n\"\"\"\n\nimport numpy as np\nimport pandas as pd\nfrom pvlib.tools import sind\n\nTEMPERATURE_MODEL_PARAMETERS = {\n    'sapm': {\n        'open_rack_glass_glass': {'a': -3.47, 'b': -.0594, 'deltaT': 3},\n        'close_mount_glass_glass': {'a': -2.98, 'b': -.0471, 'deltaT': 1},\n        'open_rack_glass_polymer': {'a': -3.56, 'b': -.0750, 'deltaT': 3},\n        'insulated_back_glass_polymer': {'a': -2.81, 'b': -.0455, 'deltaT': 0},\n    },\n    'pvsyst': {'freestanding': {'u_c': 29.0, 'u_v': 0},\n               'insulated': {'u_c': 15.0, 'u_v': 0}}\n}\n\"\"\"Dictionary of temperature parameters organized by model.\n\nThere are keys for each model at the top level. Currently there are two models,\n``'sapm'`` for the Sandia Array Performance Model, and ``'pvsyst'``. Each model\nhas a dictionary of configurations; a value is itself a dictionary containing\nmodel parameters. Retrieve parameters by indexing the model and configuration\nby name. Note: the keys are lower-cased and case sensitive.\n\nExample\n-------\nRetrieve the open rack glass-polymer configuration for SAPM::\n\n    from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS\n    temperature_model_parameters = (\n        TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer'])\n    # {'a': -3.56, 'b': -0.075, 'deltaT': 3}\n\"\"\"\n\n\ndef _temperature_model_params(model, parameter_set):\n    try:\n        params = TEMPERATURE_MODEL_PARAMETERS[model]\n        return params[parameter_set]\n    except KeyError:\n        msg = ('{} is not a named set of parameters for the {} cell'\n               ' temperature model.'\n               ' See pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS'\n               ' for names'.format(parameter_set, model))\n        raise KeyError(msg)\n\n\ndef sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT,\n              irrad_ref=1000):\n    r'''\n    Calculate cell temperature per the Sandia Array Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1`.\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by a pair of\n    equations (Eq. 11 and 12 in [1]_).\n\n    .. math::\n       :label: sapm1\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    .. math::\n       :label: sapm2\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model parameters depend both on\n    the module construction and its mounting. Parameter sets are provided in\n    [1]_ for representative modules and mounting, and are coded for convenience\n    in :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell_from_module\n    sapm_module\n\n    Examples\n    --------\n    >>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']\n    >>> sapm_cell(1000, 10, 0, **params)\n    44.11703066106086\n    '''\n    module_temperature = sapm_module(poa_global, temp_air, wind_speed,\n                                     a, b)\n    return sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                                 irrad_ref)\n\n\ndef sapm_module(poa_global, temp_air, wind_speed, a, b):\n    r'''\n    Calculate module back surface temperature per the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1mod`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1mod`.\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for module temperature :math:`T_{m}` is given by Eq. 11 in [1]_.\n\n    .. math::\n       :label: sapm1mod\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model outputs are surface\n    temperature at the back of the module :math:`T_{m}` and cell temperature\n    :math:`T_{C}`. Model parameters depend both on the module construction and\n    its mounting. Parameter sets are provided in [1]_ for representative\n    modules and mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_cell_from_module\n    '''\n    return poa_global * np.exp(a + b * wind_speed) + temp_air\n\n\ndef sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                          irrad_ref=1000):\n    r'''\n    Calculate cell temperature from module temperature using the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    module_temperature : numeric\n        Temperature of back of module surface [C].\n\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2_cell_from_mod` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by Eq. 12 in [1]_.\n\n    .. math::\n       :label: sapm2_cell_from_mod\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Model parameters depend both on the module construction and its mounting.\n    Parameter sets are provided in [1]_ for representative modules and\n    mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_module\n    '''\n    return module_temperature + (poa_global / irrad_ref) * deltaT\n\n\ndef pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0,\n                eta_m=0.1, alpha_absorption=0.9):\n    r\"\"\"\n    Calculate cell temperature using an empirical heat loss factor model\n    as implemented in PVsyst.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/2 is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u_c : float, default 29.0\n        Combined heat loss factor coefficient. The default value is\n        representative of freestanding modules with the rear surfaces exposed\n        to open air (e.g., rack mounted). Parameter :math:`U_{c}` in\n        :eq:`pvsyst`.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u_v : float, default 0.0\n        Combined heat loss factor influenced by wind. Parameter :math:`U_{v}`\n        in :eq:`pvsyst`.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    eta_m : numeric, default 0.1\n        Module external efficiency as a fraction, i.e., DC power / poa_global.\n        Parameter :math:`\\eta_{m}` in :eq:`pvsyst`.\n\n    alpha_absorption : numeric, default 0.9\n        Absorption coefficient. Parameter :math:`\\alpha` in :eq:`pvsyst`.\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    The Pvsyst model for cell temperature :math:`T_{C}` is given by\n\n    .. math::\n       :label: pvsyst\n\n        T_{C} = T_{a} + \\frac{\\alpha E (1 - \\eta_{m})}{U_{c} + U_{v} \\times WS}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2), ambient\n    air temperature :math:`T_{a}` (C) and wind speed :math:`WS` (m/s). Model\n    output is cell temperature :math:`T_{C}`. Model parameters depend both on\n    the module construction and its mounting. Parameters are provided in\n    [1]_ for open (freestanding) and close (insulated) mounting configurations,\n    , and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`. The heat loss\n    factors provided represent the combined effect of convection, radiation and\n    conduction, and their values are experimentally determined.\n\n    +--------------+---------------+---------------+\n    | Mounting     | :math:`U_{c}` | :math:`U_{v}` |\n    +==============+===============+===============+\n    | freestanding | 29.0          | 0.0           |\n    +--------------+---------------+---------------+\n    | insulated    | 15.0          | 0.0           |\n    +--------------+---------------+---------------+\n\n    References\n    ----------\n    .. [1] \"PVsyst 6 Help\", Files.pvsyst.com, 2018. [Online]. Available:\n       http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].\n\n    .. [2] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    Examples\n    --------\n    >>> from pvlib.temperature import pvsyst_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['pvsyst']['freestanding']\n    >>> pvsyst_cell(1000, 10, **params)\n    37.93103448275862\n    \"\"\"\n\n    total_loss_factor = u_c + u_v * wind_speed\n    heat_input = poa_global * alpha_absorption * (1 - eta_m)\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef faiman(poa_global, temp_air, wind_speed=1.0, u0=25.0, u1=6.84):\n    r'''\n    Calculate cell or module temperature using the Faiman model.  The Faiman\n    model uses an empirical heat loss factor model [1]_ and is adopted in the\n    IEC 61853 standards [2]_ and [3]_.\n\n    Usage of this model in the IEC 61853 standard does not distinguish\n    between cell and module temperature.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/s is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u0 : numeric, default 25.0\n        Combined heat loss factor coefficient. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u1 : numeric, default 6.84\n        Combined heat loss factor influenced by wind. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    All arguments may be scalars or vectors. If multiple arguments\n    are vectors they must be the same length.\n\n    References\n    ----------\n    .. [1] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    .. [2] \"IEC 61853-2 Photovoltaic (PV) module performance testing and energy\n       rating - Part 2: Spectral responsivity, incidence angle and module\n       operating temperature measurements\". IEC, Geneva, 2018.\n\n    .. [3] \"IEC 61853-3 Photovoltaic (PV) module performance testing and energy\n       rating - Part 3: Energy rating of PV modules\". IEC, Geneva, 2018.\n\n    '''\n    # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Dec., 2019\n\n    # The following lines may seem odd since u0 & u1 are probably scalar,\n    # but it serves an indirect and easy way of allowing lists and\n    # tuples for the other function arguments.\n    u0 = np.asanyarray(u0)\n    u1 = np.asanyarray(u1)\n\n    total_loss_factor = u0 + u1 * wind_speed\n    heat_input = poa_global\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef _fuentes_hconv(tave, windmod, tinoct, temp_delta, xlen, tilt,\n                   check_reynold):\n    # Calculate the convective coefficient as in Fuentes 1987 -- a mixture of\n    # free, laminar, and turbulent convection.\n    densair = 0.003484 * 101325.0 / tave  # density\n    visair = 0.24237e-6 * tave**0.76 / densair  # kinematic viscosity\n    condair = 2.1695e-4 * tave**0.84  # thermal conductivity\n    reynold = windmod * xlen / visair\n    # the boundary between laminar and turbulent is modeled as an abrupt\n    # change at Re = 1.2e5:\n    if check_reynold and reynold > 1.2e5:\n        # turbulent convection\n        hforce = 0.0282 / reynold**0.2 * densair * windmod * 1007 / 0.71**0.4\n    else:\n        # laminar convection\n        hforce = 0.8600 / reynold**0.5 * densair * windmod * 1007 / 0.71**0.67\n    # free convection via Grashof number\n    # NB: Fuentes hardwires sind(tilt) as 0.5 for tilt=30\n    grashof = 9.8 / tave * temp_delta * xlen**3 / visair**2 * sind(tilt)\n    # product of Nusselt number and (k/l)\n    hfree = 0.21 * (grashof * 0.71)**0.32 * condair / xlen\n    # combine free and forced components\n    hconv = (hfree**3 + hforce**3)**(1/3)\n    return hconv\n\n\ndef _hydraulic_diameter(width, height):\n    # calculate the hydraulic diameter of a rectangle\n    return 2 * (width * height) / (width + height)\n\n\ndef fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,\n            wind_height=9.144, emissivity=0.84, absorption=0.83,\n            surface_tilt=30, module_width=0.31579, module_length=1.2):\n    \"\"\"\n    Calculate cell or module temperature using the Fuentes model.\n\n    The Fuentes model is a first-principles heat transfer energy balance\n    model [1]_ that is used in PVWatts for cell temperature modeling [2]_.\n\n    Parameters\n    ----------\n    poa_global : pandas Series\n        Total incident irradiance [W/m^2]\n\n    temp_air : pandas Series\n        Ambient dry bulb temperature [C]\n\n    wind_speed : pandas Series\n        Wind speed [m/s]\n\n    noct_installed : float\n        The \"installed\" nominal operating cell temperature as defined in [1]_.\n        PVWatts assumes this value to be 45 C for rack-mounted arrays and\n        49 C for roof mount systems with restricted air flow around the\n        module.  [C]\n\n    module_height : float, default 5.0\n        The height above ground of the center of the module. The PVWatts\n        default is 5.0 [m]\n\n    wind_height : float, default 9.144\n        The height above ground at which ``wind_speed`` is measured. The\n        PVWatts defauls is 9.144 [m]\n\n    emissivity : float, default 0.84\n        The effectiveness of the module at radiating thermal energy. [unitless]\n\n    absorption : float, default 0.83\n        The fraction of incident irradiance that is converted to thermal\n        energy in the module. [unitless]\n\n    surface_tilt : float, default 30\n        Module tilt from horizontal. If not provided, the default value\n        of 30 degrees from [1]_ and [2]_ is used. [degrees]\n\n    module_width : float, default 0.31579\n        Module width. The default value of 0.31579 meters in combination with\n        the default `module_length` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    module_length : float, default 1.2\n        Module length. The default value of 1.2 meters in combination with\n        the default `module_width` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    Returns\n    -------\n    temperature_cell : pandas Series\n        The modeled cell temperature [C]\n\n    Notes\n    -----\n    This function returns slightly different values from PVWatts at night\n    and just after dawn. This is because the SAM SSC assumes that module\n    temperature equals ambient temperature when irradiance is zero so it can\n    skip the heat balance calculation at night.\n\n    References\n    ----------\n    .. [1] Fuentes, M. K., 1987, \"A Simplifed Thermal Model for Flat-Plate\n           Photovoltaic Arrays\", SAND85-0330, Sandia National Laboratories,\n           Albuquerque NM.\n           http://prod.sandia.gov/techlib/access-control.cgi/1985/850330.pdf\n    .. [2] Dobos, A. P., 2014, \"PVWatts Version 5 Manual\", NREL/TP-6A20-62641,\n           National Renewable Energy Laboratory, Golden CO.\n           doi:10.2172/1158421.\n    \"\"\"\n    # ported from the FORTRAN77 code provided in Appendix A of Fuentes 1987;\n    # nearly all variable names are kept the same for ease of comparison.\n\n    boltz = 5.669e-8\n    emiss = emissivity\n    absorp = absorption\n    xlen = _hydraulic_diameter(module_width, module_length)\n    # cap0 has units of [J / (m^2 K)], equal to mass per unit area times\n    # specific heat of the module.\n    cap0 = 11000\n    tinoct = noct_installed + 273.15\n\n    # convective coefficient of top surface of module at NOCT\n    windmod = 1.0\n    tave = (tinoct + 293.15) / 2\n    hconv = _fuentes_hconv(tave, windmod, tinoct, tinoct - 293.15, xlen,\n                           surface_tilt, False)\n\n    # determine the ground temperature ratio and the ratio of the total\n    # convection to the top side convection\n    hground = emiss * boltz * (tinoct**2 + 293.15**2) * (tinoct + 293.15)\n    backrat = (\n        absorp * 800.0\n        - emiss * boltz * (tinoct**4 - 282.21**4)\n        - hconv * (tinoct - 293.15)\n    ) / ((hground + hconv) * (tinoct - 293.15))\n    tground = (tinoct**4 - backrat * (tinoct**4 - 293.15**4))**0.25\n    tground = np.clip(tground, 293.15, tinoct)\n\n    tgrat = (tground - 293.15) / (tinoct - 293.15)\n    convrat = (absorp * 800 - emiss * boltz * (\n        2 * tinoct**4 - 282.21**4 - tground**4)) / (hconv * (tinoct - 293.15))\n\n    # adjust the capacitance (thermal mass) of the module based on the INOCT.\n    # It is a function of INOCT because high INOCT implies thermal coupling\n    # with the racking (e.g. roofmount), so the thermal mass is increased.\n    # `cap` has units J/(m^2 C) -- see Table 3, Equations 26 & 27\n    cap = cap0\n    if tinoct > 321.15:\n        cap = cap * (1 + (tinoct - 321.15) / 12)\n\n    # iterate through timeseries inputs\n    sun0 = 0\n    tmod0 = 293.15\n\n    # n.b. the way Fuentes calculates the first timedelta makes it seem like\n    # the value doesn't matter -- rather than recreate it here, just assume\n    # it's the same as the second timedelta:\n    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60\n    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)\n\n    tamb_array = temp_air + 273.15\n    sun_array = poa_global * absorp\n\n    # Two of the calculations are easily vectorized, so precalculate them:\n    # sky temperature -- Equation 24\n    tsky_array = 0.68 * (0.0552 * tamb_array**1.5) + 0.32 * tamb_array\n    # wind speed at module height -- Equation 22\n    # not sure why the 1e-4 factor is included -- maybe the equations don't\n    # behave well if wind == 0?\n    windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4\n\n    tmod0 = 293.15\n    tmod_array = np.zeros_like(poa_global)\n\n    iterator = zip(tamb_array, sun_array, windmod_array, tsky_array,\n                   timedelta_hours)\n    for i, (tamb, sun, windmod, tsky, dtime) in enumerate(iterator):\n        # solve the heat transfer equation, iterating because the heat loss\n        # terms depend on tmod. NB Fuentes doesn't show that 10 iterations is\n        # sufficient for convergence.\n        tmod = tmod0\n        for j in range(10):\n            # overall convective coefficient\n            tave = (tmod + tamb) / 2\n            hconv = convrat * _fuentes_hconv(tave, windmod, tinoct,\n                                             abs(tmod-tamb), xlen,\n                                             surface_tilt, True)\n            # sky radiation coefficient (Equation 3)\n            hsky = emiss * boltz * (tmod**2 + tsky**2) * (tmod + tsky)\n            # ground radiation coeffieicient (Equation 4)\n            tground = tamb + tgrat * (tmod - tamb)\n            hground = emiss * boltz * (tmod**2 + tground**2) * (tmod + tground)\n            # thermal lag -- Equation 8\n            eigen = - (hconv + hsky + hground) / cap * dtime * 3600\n            # not sure why this check is done, maybe as a speed optimization?\n            if eigen > -10:\n                ex = np.exp(eigen)\n            else:\n                ex = 0\n            # Equation 7 -- note that `sun` and `sun0` already account for\n            # absorption (alpha)\n            tmod = tmod0 * ex + (\n                (1 - ex) * (\n                    hconv * tamb\n                    + hsky * tsky\n                    + hground * tground\n                    + sun0\n                    + (sun - sun0) / eigen\n                ) + sun - sun0\n            ) / (hconv + hsky + hground)\n        tmod_array[i] = tmod\n        tmod0 = tmod\n        sun0 = sun\n\n    return pd.Series(tmod_array - 273.15, index=poa_global.index, name='tmod')\n"}
filelevel_patches: {"pvlib/temperature.py": "@@ -599,8 +599,9 @@ def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,\n     # n.b. the way Fuentes calculates the first timedelta makes it seem like\n     # the value doesn't matter -- rather than recreate it here, just assume\n     # it's the same as the second timedelta:\n-    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60\n-    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)\n+    timedelta_seconds = poa_global.index.to_series().diff().dt.total_seconds()\n+    timedelta_hours = timedelta_seconds / 3600\n+    timedelta_hours.iloc[0] = timedelta_hours.iloc[1]\n \n     tamb_array = temp_air + 273.15\n     sun_array = poa_global * absorp"}
messages.content: 
  We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  temperature.fuentes errors when given tz-aware inputs on pandas>=1.0.0
  **Describe the bug**
  When the weather timeseries inputs to `temperature.fuentes` have tz-aware index, an internal call to `np.diff(index)` returns an array of `Timedelta` objects instead of an array of nanosecond ints, throwing an error immediately after.  The error only happens when using pandas>=1.0.0; using 0.25.3 runs successfully, but emits the warning:
  
  ```
    /home/kevin/anaconda3/envs/pvlib-dev/lib/python3.7/site-packages/numpy/lib/function_base.py:1243: FutureWarning: Converting timezone-aware DatetimeArray to timezone-naive ndarray with 'datetime64[ns]' dtype. In the future, this will return an ndarray with 'object' dtype where each element is a 'pandas.Timestamp' with the correct 'tz'.
    	To accept the future behavior, pass 'dtype=object'.
    	To keep the old behavior, pass 'dtype="datetime64[ns]"'.
      a = asanyarray(a)
  ```
  
  **To Reproduce**
  ```python
  In [1]: import pvlib
     ...: import pandas as pd
     ...: 
     ...: index_naive = pd.date_range('2019-01-01', freq='h', periods=3)
     ...: 
     ...: kwargs = {
     ...:     'poa_global': pd.Series(1000, index_naive),
     ...:     'temp_air': pd.Series(20, index_naive),
     ...:     'wind_speed': pd.Series(1, index_naive),
     ...:     'noct_installed': 45
     ...: }
     ...: 
  
  In [2]: print(pvlib.temperature.fuentes(**kwargs))
  2019-01-01 00:00:00    47.85
  2019-01-01 01:00:00    50.85
  2019-01-01 02:00:00    50.85
  Freq: H, Name: tmod, dtype: float64
  
  In [3]: kwargs['poa_global'].index = index_naive.tz_localize('UTC')
     ...: print(pvlib.temperature.fuentes(**kwargs))
     ...: 
  Traceback (most recent call last):
  
    File "<ipython-input-3-ff99badadc91>", line 2, in <module>
      print(pvlib.temperature.fuentes(**kwargs))
  
    File "/home/kevin/anaconda3/lib/python3.7/site-packages/pvlib/temperature.py", line 602, in fuentes
      timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60
  
  TypeError: float() argument must be a string or a number, not 'Timedelta'
  ```
  
  **Expected behavior**
  `temperature.fuentes` should work with both tz-naive and tz-aware inputs.
  
  
  **Versions:**
   - ``pvlib.__version__``: 0.8.0
   - ``pandas.__version__``: 1.0.0+
   - python: 3.7.4 (default, Aug 13 2019, 20:35:49) \n[GCC 7.3.0]
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  
  --- BEGIN FILE ---
  ```
  ### pvlib/temperature.py
  """
  The ``temperature`` module contains functions for modeling temperature of
  PV modules and cells.
  """
  
  import numpy as np
  import pandas as pd
  from pvlib.tools import sind
  
  TEMPERATURE_MODEL_PARAMETERS = {
      'sapm': {
          'open_rack_glass_glass': {'a': -3.47, 'b': -.0594, 'deltaT': 3},
          'close_mount_glass_glass': {'a': -2.98, 'b': -.0471, 'deltaT': 1},
          'open_rack_glass_polymer': {'a': -3.56, 'b': -.0750, 'deltaT': 3},
          'insulated_back_glass_polymer': {'a': -2.81, 'b': -.0455, 'deltaT': 0},
      },
      'pvsyst': {'freestanding': {'u_c': 29.0, 'u_v': 0},
                 'insulated': {'u_c': 15.0, 'u_v': 0}}
  }
  """Dictionary of temperature parameters organized by model.
  
  There are keys for each model at the top level. Currently there are two models,
  ``'sapm'`` for the Sandia Array Performance Model, and ``'pvsyst'``. Each model
  has a dictionary of configurations; a value is itself a dictionary containing
  model parameters. Retrieve parameters by indexing the model and configuration
  by name. Note: the keys are lower-cased and case sensitive.
  
  Example
  -------
  Retrieve the open rack glass-polymer configuration for SAPM::
  
      from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
      temperature_model_parameters = (
          TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer'])
      # {'a': -3.56, 'b': -0.075, 'deltaT': 3}
  """
  
  
  def _temperature_model_params(model, parameter_set):
      try:
          params = TEMPERATURE_MODEL_PARAMETERS[model]
          return params[parameter_set]
      except KeyError:
          msg = ('{} is not a named set of parameters for the {} cell'
                 ' temperature model.'
                 ' See pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS'
                 ' for names'.format(parameter_set, model))
          raise KeyError(msg)
  
  
  def sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT,
                irrad_ref=1000):
      r'''
      Calculate cell temperature per the Sandia Array Performance Model.
  
      See [1]_ for details on the Sandia Array Performance Model.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric
          Wind speed at a height of 10 meters [m/s].
  
      a : float
          Parameter :math:`a` in :eq:`sapm1`.
  
      b : float
          Parameter :math:`b` in :eq:`sapm1`.
  
      deltaT : float
          Parameter :math:`\Delta T` in :eq:`sapm2` [C].
  
      irrad_ref : float, default 1000
          Reference irradiance, parameter :math:`E_{0}` in
          :eq:`sapm2` [W/m^2].
  
      Returns
      -------
      numeric, values in degrees C.
  
      Notes
      -----
      The model for cell temperature :math:`T_{C}` is given by a pair of
      equations (Eq. 11 and 12 in [1]_).
  
      .. math::
         :label: sapm1
  
         T_{m} = E \times \exp (a + b \times WS) + T_{a}
  
      .. math::
         :label: sapm2
  
         T_{C} = T_{m} + \frac{E}{E_{0}} \Delta T
  
      The module back surface temperature :math:`T_{m}` is implemented in
      :py:func:`~pvlib.temperature.sapm_module`.
  
      Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and
      ambient air temperature :math:`T_{a}` (C). Model parameters depend both on
      the module construction and its mounting. Parameter sets are provided in
      [1]_ for representative modules and mounting, and are coded for convenience
      in :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.
  
      +---------------+----------------+-------+---------+---------------------+
      | Module        | Mounting       | a     | b       | :math:`\Delta T [C]`|
      +===============+================+=======+=========+=====================+
      | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |
      +---------------+----------------+-------+---------+---------------------+
  
      References
      ----------
      .. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
         Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
         NM.
  
      See also
      --------
      sapm_cell_from_module
      sapm_module
  
      Examples
      --------
      >>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS
      >>> params = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
      >>> sapm_cell(1000, 10, 0, **params)
      44.11703066106086
      '''
      module_temperature = sapm_module(poa_global, temp_air, wind_speed,
                                       a, b)
      return sapm_cell_from_module(module_temperature, poa_global, deltaT,
                                   irrad_ref)
  
  
  def sapm_module(poa_global, temp_air, wind_speed, a, b):
      r'''
      Calculate module back surface temperature per the Sandia Array
      Performance Model.
  
      See [1]_ for details on the Sandia Array Performance Model.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric
          Wind speed at a height of 10 meters [m/s].
  
      a : float
          Parameter :math:`a` in :eq:`sapm1mod`.
  
      b : float
          Parameter :math:`b` in :eq:`sapm1mod`.
  
      Returns
      -------
      numeric, values in degrees C.
  
      Notes
      -----
      The model for module temperature :math:`T_{m}` is given by Eq. 11 in [1]_.
  
      .. math::
         :label: sapm1mod
  
         T_{m} = E \times \exp (a + b \times WS) + T_{a}
  
      Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and
      ambient air temperature :math:`T_{a}` (C). Model outputs are surface
      temperature at the back of the module :math:`T_{m}` and cell temperature
      :math:`T_{C}`. Model parameters depend both on the module construction and
      its mounting. Parameter sets are provided in [1]_ for representative
      modules and mounting, and are coded for convenience in
      :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.
  
      +---------------+----------------+-------+---------+---------------------+
      | Module        | Mounting       | a     | b       | :math:`\Delta T [C]`|
      +===============+================+=======+=========+=====================+
      | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |
      +---------------+----------------+-------+---------+---------------------+
  
      References
      ----------
      .. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
         Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
         NM.
  
      See also
      --------
      sapm_cell
      sapm_cell_from_module
      '''
      return poa_global * np.exp(a + b * wind_speed) + temp_air
  
  
  def sapm_cell_from_module(module_temperature, poa_global, deltaT,
                            irrad_ref=1000):
      r'''
      Calculate cell temperature from module temperature using the Sandia Array
      Performance Model.
  
      See [1]_ for details on the Sandia Array Performance Model.
  
      Parameters
      ----------
      module_temperature : numeric
          Temperature of back of module surface [C].
  
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      deltaT : float
          Parameter :math:`\Delta T` in :eq:`sapm2_cell_from_mod` [C].
  
      irrad_ref : float, default 1000
          Reference irradiance, parameter :math:`E_{0}` in
          :eq:`sapm2` [W/m^2].
  
      Returns
      -------
      numeric, values in degrees C.
  
      Notes
      -----
      The model for cell temperature :math:`T_{C}` is given by Eq. 12 in [1]_.
  
      .. math::
         :label: sapm2_cell_from_mod
  
         T_{C} = T_{m} + \frac{E}{E_{0}} \Delta T
  
      The module back surface temperature :math:`T_{m}` is implemented in
      :py:func:`~pvlib.temperature.sapm_module`.
  
      Model parameters depend both on the module construction and its mounting.
      Parameter sets are provided in [1]_ for representative modules and
      mounting, and are coded for convenience in
      :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.
  
      +---------------+----------------+-------+---------+---------------------+
      | Module        | Mounting       | a     | b       | :math:`\Delta T [C]`|
      +===============+================+=======+=========+=====================+
      | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |
      +---------------+----------------+-------+---------+---------------------+
      | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |
      +---------------+----------------+-------+---------+---------------------+
  
      References
      ----------
      .. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
         Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
         NM.
  
      See also
      --------
      sapm_cell
      sapm_module
      '''
      return module_temperature + (poa_global / irrad_ref) * deltaT
  
  
  def pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0,
                  eta_m=0.1, alpha_absorption=0.9):
      r"""
      Calculate cell temperature using an empirical heat loss factor model
      as implemented in PVsyst.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric, default 1.0
          Wind speed in m/s measured at the same height for which the wind loss
          factor was determined.  The default value 1.0 m/2 is the wind
          speed at module height used to determine NOCT. [m/s]
  
      u_c : float, default 29.0
          Combined heat loss factor coefficient. The default value is
          representative of freestanding modules with the rear surfaces exposed
          to open air (e.g., rack mounted). Parameter :math:`U_{c}` in
          :eq:`pvsyst`.
          :math:`\left[\frac{\text{W}/{\text{m}^2}}{\text{C}}\right]`
  
      u_v : float, default 0.0
          Combined heat loss factor influenced by wind. Parameter :math:`U_{v}`
          in :eq:`pvsyst`.
          :math:`\left[ \frac{\text{W}/\text{m}^2}{\text{C}\ \left( \text{m/s} \right)} \right]`
  
      eta_m : numeric, default 0.1
          Module external efficiency as a fraction, i.e., DC power / poa_global.
          Parameter :math:`\eta_{m}` in :eq:`pvsyst`.
  
      alpha_absorption : numeric, default 0.9
          Absorption coefficient. Parameter :math:`\alpha` in :eq:`pvsyst`.
  
      Returns
      -------
      numeric, values in degrees Celsius
  
      Notes
      -----
      The Pvsyst model for cell temperature :math:`T_{C}` is given by
  
      .. math::
         :label: pvsyst
  
          T_{C} = T_{a} + \frac{\alpha E (1 - \eta_{m})}{U_{c} + U_{v} \times WS}
  
      Inputs to the model are plane-of-array irradiance :math:`E` (W/m2), ambient
      air temperature :math:`T_{a}` (C) and wind speed :math:`WS` (m/s). Model
      output is cell temperature :math:`T_{C}`. Model parameters depend both on
      the module construction and its mounting. Parameters are provided in
      [1]_ for open (freestanding) and close (insulated) mounting configurations,
      , and are coded for convenience in
      :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`. The heat loss
      factors provided represent the combined effect of convection, radiation and
      conduction, and their values are experimentally determined.
  
      +--------------+---------------+---------------+
      | Mounting     | :math:`U_{c}` | :math:`U_{v}` |
      +==============+===============+===============+
      | freestanding | 29.0          | 0.0           |
      +--------------+---------------+---------------+
      | insulated    | 15.0          | 0.0           |
      +--------------+---------------+---------------+
  
      References
      ----------
      .. [1] "PVsyst 6 Help", Files.pvsyst.com, 2018. [Online]. Available:
         http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].
  
      .. [2] Faiman, D. (2008). "Assessing the outdoor operating temperature of
         photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
  
      Examples
      --------
      >>> from pvlib.temperature import pvsyst_cell, TEMPERATURE_MODEL_PARAMETERS
      >>> params = TEMPERATURE_MODEL_PARAMETERS['pvsyst']['freestanding']
      >>> pvsyst_cell(1000, 10, **params)
      37.93103448275862
      """
  
      total_loss_factor = u_c + u_v * wind_speed
      heat_input = poa_global * alpha_absorption * (1 - eta_m)
      temp_difference = heat_input / total_loss_factor
      return temp_air + temp_difference
  
  
  def faiman(poa_global, temp_air, wind_speed=1.0, u0=25.0, u1=6.84):
      r'''
      Calculate cell or module temperature using the Faiman model.  The Faiman
      model uses an empirical heat loss factor model [1]_ and is adopted in the
      IEC 61853 standards [2]_ and [3]_.
  
      Usage of this model in the IEC 61853 standard does not distinguish
      between cell and module temperature.
  
      Parameters
      ----------
      poa_global : numeric
          Total incident irradiance [W/m^2].
  
      temp_air : numeric
          Ambient dry bulb temperature [C].
  
      wind_speed : numeric, default 1.0
          Wind speed in m/s measured at the same height for which the wind loss
          factor was determined.  The default value 1.0 m/s is the wind
          speed at module height used to determine NOCT. [m/s]
  
      u0 : numeric, default 25.0
          Combined heat loss factor coefficient. The default value is one
          determined by Faiman for 7 silicon modules.
          :math:`\left[\frac{\text{W}/{\text{m}^2}}{\text{C}}\right]`
  
      u1 : numeric, default 6.84
          Combined heat loss factor influenced by wind. The default value is one
          determined by Faiman for 7 silicon modules.
          :math:`\left[ \frac{\text{W}/\text{m}^2}{\text{C}\ \left( \text{m/s} \right)} \right]`
  
      Returns
      -------
      numeric, values in degrees Celsius
  
      Notes
      -----
      All arguments may be scalars or vectors. If multiple arguments
      are vectors they must be the same length.
  
      References
      ----------
      .. [1] Faiman, D. (2008). "Assessing the outdoor operating temperature of
         photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
  
      .. [2] "IEC 61853-2 Photovoltaic (PV) module performance testing and energy
         rating - Part 2: Spectral responsivity, incidence angle and module
         operating temperature measurements". IEC, Geneva, 2018.
  
      .. [3] "IEC 61853-3 Photovoltaic (PV) module performance testing and energy
         rating - Part 3: Energy rating of PV modules". IEC, Geneva, 2018.
  
      '''
      # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Dec., 2019
  
      # The following lines may seem odd since u0 & u1 are probably scalar,
      # but it serves an indirect and easy way of allowing lists and
      # tuples for the other function arguments.
      u0 = np.asanyarray(u0)
      u1 = np.asanyarray(u1)
  
      total_loss_factor = u0 + u1 * wind_speed
      heat_input = poa_global
      temp_difference = heat_input / total_loss_factor
      return temp_air + temp_difference
  
  
  def _fuentes_hconv(tave, windmod, tinoct, temp_delta, xlen, tilt,
                     check_reynold):
      # Calculate the convective coefficient as in Fuentes 1987 -- a mixture of
      # free, laminar, and turbulent convection.
      densair = 0.003484 * 101325.0 / tave  # density
      visair = 0.24237e-6 * tave**0.76 / densair  # kinematic viscosity
      condair = 2.1695e-4 * tave**0.84  # thermal conductivity
      reynold = windmod * xlen / visair
      # the boundary between laminar and turbulent is modeled as an abrupt
      # change at Re = 1.2e5:
      if check_reynold and reynold > 1.2e5:
          # turbulent convection
          hforce = 0.0282 / reynold**0.2 * densair * windmod * 1007 / 0.71**0.4
      else:
          # laminar convection
          hforce = 0.8600 / reynold**0.5 * densair * windmod * 1007 / 0.71**0.67
      # free convection via Grashof number
      # NB: Fuentes hardwires sind(tilt) as 0.5 for tilt=30
      grashof = 9.8 / tave * temp_delta * xlen**3 / visair**2 * sind(tilt)
      # product of Nusselt number and (k/l)
      hfree = 0.21 * (grashof * 0.71)**0.32 * condair / xlen
      # combine free and forced components
      hconv = (hfree**3 + hforce**3)**(1/3)
      return hconv
  
  
  def _hydraulic_diameter(width, height):
      # calculate the hydraulic diameter of a rectangle
      return 2 * (width * height) / (width + height)
  
  
  def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,
              wind_height=9.144, emissivity=0.84, absorption=0.83,
              surface_tilt=30, module_width=0.31579, module_length=1.2):
      """
      Calculate cell or module temperature using the Fuentes model.
  
      The Fuentes model is a first-principles heat transfer energy balance
      model [1]_ that is used in PVWatts for cell temperature modeling [2]_.
  
      Parameters
      ----------
      poa_global : pandas Series
          Total incident irradiance [W/m^2]
  
      temp_air : pandas Series
          Ambient dry bulb temperature [C]
  
      wind_speed : pandas Series
          Wind speed [m/s]
  
      noct_installed : float
          The "installed" nominal operating cell temperature as defined in [1]_.
          PVWatts assumes this value to be 45 C for rack-mounted arrays and
          49 C for roof mount systems with restricted air flow around the
          module.  [C]
  
      module_height : float, default 5.0
          The height above ground of the center of the module. The PVWatts
          default is 5.0 [m]
  
      wind_height : float, default 9.144
          The height above ground at which ``wind_speed`` is measured. The
          PVWatts defauls is 9.144 [m]
  
      emissivity : float, default 0.84
          The effectiveness of the module at radiating thermal energy. [unitless]
  
      absorption : float, default 0.83
          The fraction of incident irradiance that is converted to thermal
          energy in the module. [unitless]
  
      surface_tilt : float, default 30
          Module tilt from horizontal. If not provided, the default value
          of 30 degrees from [1]_ and [2]_ is used. [degrees]
  
      module_width : float, default 0.31579
          Module width. The default value of 0.31579 meters in combination with
          the default `module_length` gives a hydraulic diameter of 0.5 as
          assumed in [1]_ and [2]_. [m]
  
      module_length : float, default 1.2
          Module length. The default value of 1.2 meters in combination with
          the default `module_width` gives a hydraulic diameter of 0.5 as
          assumed in [1]_ and [2]_. [m]
  
      Returns
      -------
      temperature_cell : pandas Series
          The modeled cell temperature [C]
  
      Notes
      -----
      This function returns slightly different values from PVWatts at night
      and just after dawn. This is because the SAM SSC assumes that module
      temperature equals ambient temperature when irradiance is zero so it can
      skip the heat balance calculation at night.
  
      References
      ----------
      .. [1] Fuentes, M. K., 1987, "A Simplifed Thermal Model for Flat-Plate
             Photovoltaic Arrays", SAND85-0330, Sandia National Laboratories,
             Albuquerque NM.
             http://prod.sandia.gov/techlib/access-control.cgi/1985/850330.pdf
      .. [2] Dobos, A. P., 2014, "PVWatts Version 5 Manual", NREL/TP-6A20-62641,
             National Renewable Energy Laboratory, Golden CO.
             doi:10.2172/1158421.
      """
      # ported from the FORTRAN77 code provided in Appendix A of Fuentes 1987;
      # nearly all variable names are kept the same for ease of comparison.
  
      boltz = 5.669e-8
      emiss = emissivity
      absorp = absorption
      xlen = _hydraulic_diameter(module_width, module_length)
      # cap0 has units of [J / (m^2 K)], equal to mass per unit area times
      # specific heat of the module.
      cap0 = 11000
      tinoct = noct_installed + 273.15
  
      # convective coefficient of top surface of module at NOCT
      windmod = 1.0
      tave = (tinoct + 293.15) / 2
      hconv = _fuentes_hconv(tave, windmod, tinoct, tinoct - 293.15, xlen,
                             surface_tilt, False)
  
      # determine the ground temperature ratio and the ratio of the total
      # convection to the top side convection
      hground = emiss * boltz * (tinoct**2 + 293.15**2) * (tinoct + 293.15)
      backrat = (
          absorp * 800.0
          - emiss * boltz * (tinoct**4 - 282.21**4)
          - hconv * (tinoct - 293.15)
      ) / ((hground + hconv) * (tinoct - 293.15))
      tground = (tinoct**4 - backrat * (tinoct**4 - 293.15**4))**0.25
      tground = np.clip(tground, 293.15, tinoct)
  
      tgrat = (tground - 293.15) / (tinoct - 293.15)
      convrat = (absorp * 800 - emiss * boltz * (
          2 * tinoct**4 - 282.21**4 - tground**4)) / (hconv * (tinoct - 293.15))
  
      # adjust the capacitance (thermal mass) of the module based on the INOCT.
      # It is a function of INOCT because high INOCT implies thermal coupling
      # with the racking (e.g. roofmount), so the thermal mass is increased.
      # `cap` has units J/(m^2 C) -- see Table 3, Equations 26 & 27
      cap = cap0
      if tinoct > 321.15:
          cap = cap * (1 + (tinoct - 321.15) / 12)
  
      # iterate through timeseries inputs
      sun0 = 0
      tmod0 = 293.15
  
      # n.b. the way Fuentes calculates the first timedelta makes it seem like
      # the value doesn't matter -- rather than recreate it here, just assume
      # it's the same as the second timedelta:
      timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60
      timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)
  
      tamb_array = temp_air + 273.15
      sun_array = poa_global * absorp
  
      # Two of the calculations are easily vectorized, so precalculate them:
      # sky temperature -- Equation 24
      tsky_array = 0.68 * (0.0552 * tamb_array**1.5) + 0.32 * tamb_array
      # wind speed at module height -- Equation 22
      # not sure why the 1e-4 factor is included -- maybe the equations don't
      # behave well if wind == 0?
      windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4
  
      tmod0 = 293.15
      tmod_array = np.zeros_like(poa_global)
  
      iterator = zip(tamb_array, sun_array, windmod_array, tsky_array,
                     timedelta_hours)
      for i, (tamb, sun, windmod, tsky, dtime) in enumerate(iterator):
          # solve the heat transfer equation, iterating because the heat loss
          # terms depend on tmod. NB Fuentes doesn't show that 10 iterations is
          # sufficient for convergence.
          tmod = tmod0
          for j in range(10):
              # overall convective coefficient
              tave = (tmod + tamb) / 2
              hconv = convrat * _fuentes_hconv(tave, windmod, tinoct,
                                               abs(tmod-tamb), xlen,
                                               surface_tilt, True)
              # sky radiation coefficient (Equation 3)
              hsky = emiss * boltz * (tmod**2 + tsky**2) * (tmod + tsky)
              # ground radiation coeffieicient (Equation 4)
              tground = tamb + tgrat * (tmod - tamb)
              hground = emiss * boltz * (tmod**2 + tground**2) * (tmod + tground)
              # thermal lag -- Equation 8
              eigen = - (hconv + hsky + hground) / cap * dtime * 3600
              # not sure why this check is done, maybe as a speed optimization?
              if eigen > -10:
                  ex = np.exp(eigen)
              else:
                  ex = 0
              # Equation 7 -- note that `sun` and `sun0` already account for
              # absorption (alpha)
              tmod = tmod0 * ex + (
                  (1 - ex) * (
                      hconv * tamb
                      + hsky * tsky
                      + hground * tground
                      + sun0
                      + (sun - sun0) / eigen
                  ) + sun - sun0
              ) / (hconv + hsky + hground)
          tmod_array[i] = tmod
          tmod0 = tmod
          sun0 = sun
  
      return pd.Series(tmod_array - 273.15, index=poa_global.index, name='tmod')
  
  ```
  --- END FILE ---
  
  Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.
  
  Every *SEARCH/REPLACE* edit must use this format:
  1. The file path
  2. The start of search block: <<<<<<< SEARCH
  3. A contiguous chunk of lines to search for in the existing source code
  4. The dividing line: =======
  5. The lines to replace into the source code
  6. The end of the replace block: >>>>>>> REPLACE
  
  Here is an example:
  
  ```python
  ### mathweb/flask/app.py
  <<<<<<< SEARCH
  from flask import Flask
  =======
  import math
  from flask import Flask
  >>>>>>> REPLACE
  ```
  
  Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
  Wrap the *SEARCH/REPLACE* edit in blocks ```python...```.
  
messages.role: user
verification_info: {"file_context": {"pvlib/temperature.py": "\"\"\"\nThe ``temperature`` module contains functions for modeling temperature of\nPV modules and cells.\n\"\"\"\n\nimport numpy as np\nimport pandas as pd\nfrom pvlib.tools import sind\n\nTEMPERATURE_MODEL_PARAMETERS = {\n    'sapm': {\n        'open_rack_glass_glass': {'a': -3.47, 'b': -.0594, 'deltaT': 3},\n        'close_mount_glass_glass': {'a': -2.98, 'b': -.0471, 'deltaT': 1},\n        'open_rack_glass_polymer': {'a': -3.56, 'b': -.0750, 'deltaT': 3},\n        'insulated_back_glass_polymer': {'a': -2.81, 'b': -.0455, 'deltaT': 0},\n    },\n    'pvsyst': {'freestanding': {'u_c': 29.0, 'u_v': 0},\n               'insulated': {'u_c': 15.0, 'u_v': 0}}\n}\n\"\"\"Dictionary of temperature parameters organized by model.\n\nThere are keys for each model at the top level. Currently there are two models,\n``'sapm'`` for the Sandia Array Performance Model, and ``'pvsyst'``. Each model\nhas a dictionary of configurations; a value is itself a dictionary containing\nmodel parameters. Retrieve parameters by indexing the model and configuration\nby name. Note: the keys are lower-cased and case sensitive.\n\nExample\n-------\nRetrieve the open rack glass-polymer configuration for SAPM::\n\n    from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS\n    temperature_model_parameters = (\n        TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer'])\n    # {'a': -3.56, 'b': -0.075, 'deltaT': 3}\n\"\"\"\n\n\ndef _temperature_model_params(model, parameter_set):\n    try:\n        params = TEMPERATURE_MODEL_PARAMETERS[model]\n        return params[parameter_set]\n    except KeyError:\n        msg = ('{} is not a named set of parameters for the {} cell'\n               ' temperature model.'\n               ' See pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS'\n               ' for names'.format(parameter_set, model))\n        raise KeyError(msg)\n\n\ndef sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT,\n              irrad_ref=1000):\n    r'''\n    Calculate cell temperature per the Sandia Array Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1`.\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by a pair of\n    equations (Eq. 11 and 12 in [1]_).\n\n    .. math::\n       :label: sapm1\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    .. math::\n       :label: sapm2\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model parameters depend both on\n    the module construction and its mounting. Parameter sets are provided in\n    [1]_ for representative modules and mounting, and are coded for convenience\n    in :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell_from_module\n    sapm_module\n\n    Examples\n    --------\n    >>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']\n    >>> sapm_cell(1000, 10, 0, **params)\n    44.11703066106086\n    '''\n    module_temperature = sapm_module(poa_global, temp_air, wind_speed,\n                                     a, b)\n    return sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                                 irrad_ref)\n\n\ndef sapm_module(poa_global, temp_air, wind_speed, a, b):\n    r'''\n    Calculate module back surface temperature per the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric\n        Wind speed at a height of 10 meters [m/s].\n\n    a : float\n        Parameter :math:`a` in :eq:`sapm1mod`.\n\n    b : float\n        Parameter :math:`b` in :eq:`sapm1mod`.\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for module temperature :math:`T_{m}` is given by Eq. 11 in [1]_.\n\n    .. math::\n       :label: sapm1mod\n\n       T_{m} = E \\times \\exp (a + b \\times WS) + T_{a}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and\n    ambient air temperature :math:`T_{a}` (C). Model outputs are surface\n    temperature at the back of the module :math:`T_{m}` and cell temperature\n    :math:`T_{C}`. Model parameters depend both on the module construction and\n    its mounting. Parameter sets are provided in [1]_ for representative\n    modules and mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_cell_from_module\n    '''\n    return poa_global * np.exp(a + b * wind_speed) + temp_air\n\n\ndef sapm_cell_from_module(module_temperature, poa_global, deltaT,\n                          irrad_ref=1000):\n    r'''\n    Calculate cell temperature from module temperature using the Sandia Array\n    Performance Model.\n\n    See [1]_ for details on the Sandia Array Performance Model.\n\n    Parameters\n    ----------\n    module_temperature : numeric\n        Temperature of back of module surface [C].\n\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    deltaT : float\n        Parameter :math:`\\Delta T` in :eq:`sapm2_cell_from_mod` [C].\n\n    irrad_ref : float, default 1000\n        Reference irradiance, parameter :math:`E_{0}` in\n        :eq:`sapm2` [W/m^2].\n\n    Returns\n    -------\n    numeric, values in degrees C.\n\n    Notes\n    -----\n    The model for cell temperature :math:`T_{C}` is given by Eq. 12 in [1]_.\n\n    .. math::\n       :label: sapm2_cell_from_mod\n\n       T_{C} = T_{m} + \\frac{E}{E_{0}} \\Delta T\n\n    The module back surface temperature :math:`T_{m}` is implemented in\n    :py:func:`~pvlib.temperature.sapm_module`.\n\n    Model parameters depend both on the module construction and its mounting.\n    Parameter sets are provided in [1]_ for representative modules and\n    mounting, and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`.\n\n    +---------------+----------------+-------+---------+---------------------+\n    | Module        | Mounting       | a     | b       | :math:`\\Delta T [C]`|\n    +===============+================+=======+=========+=====================+\n    | glass/glass   | open rack      | -3.47 | -0.0594 | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/glass   | close roof     | -2.98 | -0.0471 | 1                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | open rack      | -3.56 | -0.075  | 3                   |\n    +---------------+----------------+-------+---------+---------------------+\n    | glass/polymer | insulated back | -2.81 | -0.0455 | 0                   |\n    +---------------+----------------+-------+---------+---------------------+\n\n    References\n    ----------\n    .. [1] King, D. et al, 2004, \"Sandia Photovoltaic Array Performance\n       Model\", SAND Report 3535, Sandia National Laboratories, Albuquerque,\n       NM.\n\n    See also\n    --------\n    sapm_cell\n    sapm_module\n    '''\n    return module_temperature + (poa_global / irrad_ref) * deltaT\n\n\ndef pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0,\n                eta_m=0.1, alpha_absorption=0.9):\n    r\"\"\"\n    Calculate cell temperature using an empirical heat loss factor model\n    as implemented in PVsyst.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/2 is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u_c : float, default 29.0\n        Combined heat loss factor coefficient. The default value is\n        representative of freestanding modules with the rear surfaces exposed\n        to open air (e.g., rack mounted). Parameter :math:`U_{c}` in\n        :eq:`pvsyst`.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u_v : float, default 0.0\n        Combined heat loss factor influenced by wind. Parameter :math:`U_{v}`\n        in :eq:`pvsyst`.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    eta_m : numeric, default 0.1\n        Module external efficiency as a fraction, i.e., DC power / poa_global.\n        Parameter :math:`\\eta_{m}` in :eq:`pvsyst`.\n\n    alpha_absorption : numeric, default 0.9\n        Absorption coefficient. Parameter :math:`\\alpha` in :eq:`pvsyst`.\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    The Pvsyst model for cell temperature :math:`T_{C}` is given by\n\n    .. math::\n       :label: pvsyst\n\n        T_{C} = T_{a} + \\frac{\\alpha E (1 - \\eta_{m})}{U_{c} + U_{v} \\times WS}\n\n    Inputs to the model are plane-of-array irradiance :math:`E` (W/m2), ambient\n    air temperature :math:`T_{a}` (C) and wind speed :math:`WS` (m/s). Model\n    output is cell temperature :math:`T_{C}`. Model parameters depend both on\n    the module construction and its mounting. Parameters are provided in\n    [1]_ for open (freestanding) and close (insulated) mounting configurations,\n    , and are coded for convenience in\n    :data:`~pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS`. The heat loss\n    factors provided represent the combined effect of convection, radiation and\n    conduction, and their values are experimentally determined.\n\n    +--------------+---------------+---------------+\n    | Mounting     | :math:`U_{c}` | :math:`U_{v}` |\n    +==============+===============+===============+\n    | freestanding | 29.0          | 0.0           |\n    +--------------+---------------+---------------+\n    | insulated    | 15.0          | 0.0           |\n    +--------------+---------------+---------------+\n\n    References\n    ----------\n    .. [1] \"PVsyst 6 Help\", Files.pvsyst.com, 2018. [Online]. Available:\n       http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].\n\n    .. [2] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    Examples\n    --------\n    >>> from pvlib.temperature import pvsyst_cell, TEMPERATURE_MODEL_PARAMETERS\n    >>> params = TEMPERATURE_MODEL_PARAMETERS['pvsyst']['freestanding']\n    >>> pvsyst_cell(1000, 10, **params)\n    37.93103448275862\n    \"\"\"\n\n    total_loss_factor = u_c + u_v * wind_speed\n    heat_input = poa_global * alpha_absorption * (1 - eta_m)\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef faiman(poa_global, temp_air, wind_speed=1.0, u0=25.0, u1=6.84):\n    r'''\n    Calculate cell or module temperature using the Faiman model.  The Faiman\n    model uses an empirical heat loss factor model [1]_ and is adopted in the\n    IEC 61853 standards [2]_ and [3]_.\n\n    Usage of this model in the IEC 61853 standard does not distinguish\n    between cell and module temperature.\n\n    Parameters\n    ----------\n    poa_global : numeric\n        Total incident irradiance [W/m^2].\n\n    temp_air : numeric\n        Ambient dry bulb temperature [C].\n\n    wind_speed : numeric, default 1.0\n        Wind speed in m/s measured at the same height for which the wind loss\n        factor was determined.  The default value 1.0 m/s is the wind\n        speed at module height used to determine NOCT. [m/s]\n\n    u0 : numeric, default 25.0\n        Combined heat loss factor coefficient. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[\\frac{\\text{W}/{\\text{m}^2}}{\\text{C}}\\right]`\n\n    u1 : numeric, default 6.84\n        Combined heat loss factor influenced by wind. The default value is one\n        determined by Faiman for 7 silicon modules.\n        :math:`\\left[ \\frac{\\text{W}/\\text{m}^2}{\\text{C}\\ \\left( \\text{m/s} \\right)} \\right]`\n\n    Returns\n    -------\n    numeric, values in degrees Celsius\n\n    Notes\n    -----\n    All arguments may be scalars or vectors. If multiple arguments\n    are vectors they must be the same length.\n\n    References\n    ----------\n    .. [1] Faiman, D. (2008). \"Assessing the outdoor operating temperature of\n       photovoltaic modules.\" Progress in Photovoltaics 16(4): 307-315.\n\n    .. [2] \"IEC 61853-2 Photovoltaic (PV) module performance testing and energy\n       rating - Part 2: Spectral responsivity, incidence angle and module\n       operating temperature measurements\". IEC, Geneva, 2018.\n\n    .. [3] \"IEC 61853-3 Photovoltaic (PV) module performance testing and energy\n       rating - Part 3: Energy rating of PV modules\". IEC, Geneva, 2018.\n\n    '''\n    # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Dec., 2019\n\n    # The following lines may seem odd since u0 & u1 are probably scalar,\n    # but it serves an indirect and easy way of allowing lists and\n    # tuples for the other function arguments.\n    u0 = np.asanyarray(u0)\n    u1 = np.asanyarray(u1)\n\n    total_loss_factor = u0 + u1 * wind_speed\n    heat_input = poa_global\n    temp_difference = heat_input / total_loss_factor\n    return temp_air + temp_difference\n\n\ndef _fuentes_hconv(tave, windmod, tinoct, temp_delta, xlen, tilt,\n                   check_reynold):\n    # Calculate the convective coefficient as in Fuentes 1987 -- a mixture of\n    # free, laminar, and turbulent convection.\n    densair = 0.003484 * 101325.0 / tave  # density\n    visair = 0.24237e-6 * tave**0.76 / densair  # kinematic viscosity\n    condair = 2.1695e-4 * tave**0.84  # thermal conductivity\n    reynold = windmod * xlen / visair\n    # the boundary between laminar and turbulent is modeled as an abrupt\n    # change at Re = 1.2e5:\n    if check_reynold and reynold > 1.2e5:\n        # turbulent convection\n        hforce = 0.0282 / reynold**0.2 * densair * windmod * 1007 / 0.71**0.4\n    else:\n        # laminar convection\n        hforce = 0.8600 / reynold**0.5 * densair * windmod * 1007 / 0.71**0.67\n    # free convection via Grashof number\n    # NB: Fuentes hardwires sind(tilt) as 0.5 for tilt=30\n    grashof = 9.8 / tave * temp_delta * xlen**3 / visair**2 * sind(tilt)\n    # product of Nusselt number and (k/l)\n    hfree = 0.21 * (grashof * 0.71)**0.32 * condair / xlen\n    # combine free and forced components\n    hconv = (hfree**3 + hforce**3)**(1/3)\n    return hconv\n\n\ndef _hydraulic_diameter(width, height):\n    # calculate the hydraulic diameter of a rectangle\n    return 2 * (width * height) / (width + height)\n\n\ndef fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,\n            wind_height=9.144, emissivity=0.84, absorption=0.83,\n            surface_tilt=30, module_width=0.31579, module_length=1.2):\n    \"\"\"\n    Calculate cell or module temperature using the Fuentes model.\n\n    The Fuentes model is a first-principles heat transfer energy balance\n    model [1]_ that is used in PVWatts for cell temperature modeling [2]_.\n\n    Parameters\n    ----------\n    poa_global : pandas Series\n        Total incident irradiance [W/m^2]\n\n    temp_air : pandas Series\n        Ambient dry bulb temperature [C]\n\n    wind_speed : pandas Series\n        Wind speed [m/s]\n\n    noct_installed : float\n        The \"installed\" nominal operating cell temperature as defined in [1]_.\n        PVWatts assumes this value to be 45 C for rack-mounted arrays and\n        49 C for roof mount systems with restricted air flow around the\n        module.  [C]\n\n    module_height : float, default 5.0\n        The height above ground of the center of the module. The PVWatts\n        default is 5.0 [m]\n\n    wind_height : float, default 9.144\n        The height above ground at which ``wind_speed`` is measured. The\n        PVWatts defauls is 9.144 [m]\n\n    emissivity : float, default 0.84\n        The effectiveness of the module at radiating thermal energy. [unitless]\n\n    absorption : float, default 0.83\n        The fraction of incident irradiance that is converted to thermal\n        energy in the module. [unitless]\n\n    surface_tilt : float, default 30\n        Module tilt from horizontal. If not provided, the default value\n        of 30 degrees from [1]_ and [2]_ is used. [degrees]\n\n    module_width : float, default 0.31579\n        Module width. The default value of 0.31579 meters in combination with\n        the default `module_length` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    module_length : float, default 1.2\n        Module length. The default value of 1.2 meters in combination with\n        the default `module_width` gives a hydraulic diameter of 0.5 as\n        assumed in [1]_ and [2]_. [m]\n\n    Returns\n    -------\n    temperature_cell : pandas Series\n        The modeled cell temperature [C]\n\n    Notes\n    -----\n    This function returns slightly different values from PVWatts at night\n    and just after dawn. This is because the SAM SSC assumes that module\n    temperature equals ambient temperature when irradiance is zero so it can\n    skip the heat balance calculation at night.\n\n    References\n    ----------\n    .. [1] Fuentes, M. K., 1987, \"A Simplifed Thermal Model for Flat-Plate\n           Photovoltaic Arrays\", SAND85-0330, Sandia National Laboratories,\n           Albuquerque NM.\n           http://prod.sandia.gov/techlib/access-control.cgi/1985/850330.pdf\n    .. [2] Dobos, A. P., 2014, \"PVWatts Version 5 Manual\", NREL/TP-6A20-62641,\n           National Renewable Energy Laboratory, Golden CO.\n           doi:10.2172/1158421.\n    \"\"\"\n    # ported from the FORTRAN77 code provided in Appendix A of Fuentes 1987;\n    # nearly all variable names are kept the same for ease of comparison.\n\n    boltz = 5.669e-8\n    emiss = emissivity\n    absorp = absorption\n    xlen = _hydraulic_diameter(module_width, module_length)\n    # cap0 has units of [J / (m^2 K)], equal to mass per unit area times\n    # specific heat of the module.\n    cap0 = 11000\n    tinoct = noct_installed + 273.15\n\n    # convective coefficient of top surface of module at NOCT\n    windmod = 1.0\n    tave = (tinoct + 293.15) / 2\n    hconv = _fuentes_hconv(tave, windmod, tinoct, tinoct - 293.15, xlen,\n                           surface_tilt, False)\n\n    # determine the ground temperature ratio and the ratio of the total\n    # convection to the top side convection\n    hground = emiss * boltz * (tinoct**2 + 293.15**2) * (tinoct + 293.15)\n    backrat = (\n        absorp * 800.0\n        - emiss * boltz * (tinoct**4 - 282.21**4)\n        - hconv * (tinoct - 293.15)\n    ) / ((hground + hconv) * (tinoct - 293.15))\n    tground = (tinoct**4 - backrat * (tinoct**4 - 293.15**4))**0.25\n    tground = np.clip(tground, 293.15, tinoct)\n\n    tgrat = (tground - 293.15) / (tinoct - 293.15)\n    convrat = (absorp * 800 - emiss * boltz * (\n        2 * tinoct**4 - 282.21**4 - tground**4)) / (hconv * (tinoct - 293.15))\n\n    # adjust the capacitance (thermal mass) of the module based on the INOCT.\n    # It is a function of INOCT because high INOCT implies thermal coupling\n    # with the racking (e.g. roofmount), so the thermal mass is increased.\n    # `cap` has units J/(m^2 C) -- see Table 3, Equations 26 & 27\n    cap = cap0\n    if tinoct > 321.15:\n        cap = cap * (1 + (tinoct - 321.15) / 12)\n\n    # iterate through timeseries inputs\n    sun0 = 0\n    tmod0 = 293.15\n\n    # n.b. the way Fuentes calculates the first timedelta makes it seem like\n    # the value doesn't matter -- rather than recreate it here, just assume\n    # it's the same as the second timedelta:\n    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60\n    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)\n\n    tamb_array = temp_air + 273.15\n    sun_array = poa_global * absorp\n\n    # Two of the calculations are easily vectorized, so precalculate them:\n    # sky temperature -- Equation 24\n    tsky_array = 0.68 * (0.0552 * tamb_array**1.5) + 0.32 * tamb_array\n    # wind speed at module height -- Equation 22\n    # not sure why the 1e-4 factor is included -- maybe the equations don't\n    # behave well if wind == 0?\n    windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4\n\n    tmod0 = 293.15\n    tmod_array = np.zeros_like(poa_global)\n\n    iterator = zip(tamb_array, sun_array, windmod_array, tsky_array,\n                   timedelta_hours)\n    for i, (tamb, sun, windmod, tsky, dtime) in enumerate(iterator):\n        # solve the heat transfer equation, iterating because the heat loss\n        # terms depend on tmod. NB Fuentes doesn't show that 10 iterations is\n        # sufficient for convergence.\n        tmod = tmod0\n        for j in range(10):\n            # overall convective coefficient\n            tave = (tmod + tamb) / 2\n            hconv = convrat * _fuentes_hconv(tave, windmod, tinoct,\n                                             abs(tmod-tamb), xlen,\n                                             surface_tilt, True)\n            # sky radiation coefficient (Equation 3)\n            hsky = emiss * boltz * (tmod**2 + tsky**2) * (tmod + tsky)\n            # ground radiation coeffieicient (Equation 4)\n            tground = tamb + tgrat * (tmod - tamb)\n            hground = emiss * boltz * (tmod**2 + tground**2) * (tmod + tground)\n            # thermal lag -- Equation 8\n            eigen = - (hconv + hsky + hground) / cap * dtime * 3600\n            # not sure why this check is done, maybe as a speed optimization?\n            if eigen > -10:\n                ex = np.exp(eigen)\n            else:\n                ex = 0\n            # Equation 7 -- note that `sun` and `sun0` already account for\n            # absorption (alpha)\n            tmod = tmod0 * ex + (\n                (1 - ex) * (\n                    hconv * tamb\n                    + hsky * tsky\n                    + hground * tground\n                    + sun0\n                    + (sun - sun0) / eigen\n                ) + sun - sun0\n            ) / (hconv + hsky + hground)\n        tmod_array[i] = tmod\n        tmod0 = tmod\n        sun0 = sun\n\n    return pd.Series(tmod_array - 273.15, index=poa_global.index, name='tmod')\n"}, "filelevel_patches": {"pvlib/temperature.py": "@@ -599,8 +599,9 @@ def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,\n     # n.b. the way Fuentes calculates the first timedelta makes it seem like\n     # the value doesn't matter -- rather than recreate it here, just assume\n     # it's the same as the second timedelta:\n-    timedelta_hours = np.diff(poa_global.index).astype(float) / 1e9 / 60 / 60\n-    timedelta_hours = np.append([timedelta_hours[0]], timedelta_hours)\n+    timedelta_seconds = poa_global.index.to_series().diff().dt.total_seconds()\n+    timedelta_hours = timedelta_seconds / 3600\n+    timedelta_hours.iloc[0] = timedelta_hours.iloc[1]\n \n     tamb_array = temp_air + 273.15\n     sun_array = poa_global * absorp"}}