Determine GHI, DNI, DHI from POA global using the GTI DIRINT model.

    .. warning::

        Model performance is poor for AOI greater than approximately
        80 degrees `and` plane of array irradiance greater than
        approximately 200 W/m^2.

    Parameters
    ----------
    poa_global : array-like
        Plane of array global irradiance in W/m^2.

    aoi : array-like
        Angle of incidence of solar rays with respect to the module
        surface normal.

    solar_zenith : array-like
        True (not refraction-corrected) solar zenith angles in decimal
        degrees.

    solar_azimuth : array-like
        Solar azimuth angles in decimal degrees.

    times : DatetimeIndex
        Time indices for the input array-like data.

    surface_tilt : numeric
        Surface tilt angles in decimal degrees. Tilt must be >=0 and
        <=180. The tilt angle is defined as degrees from horizontal
        (e.g. surface facing up = 0, surface facing horizon = 90).

    surface_azimuth : numeric
        Surface azimuth angles in decimal degrees. surface_azimuth must
        be >=0 and <=360. The Azimuth convention is defined as degrees
        east of north (e.g. North = 0, South=180 East = 90, West = 270).

    pressure : numeric, default 101325.0
        The site pressure in Pascal. Pressure may be measured or an
        average pressure may be calculated from site altitude.

    use_delta_kt_prime : bool, default True
        If True, indicates that the stability index delta_kt_prime is
        included in the model. The stability index adjusts the estimated
        DNI in response to dynamics in the time series of GHI. It is
        recommended that delta_kt_prime is not used if the time between
        GHI points is 1.5 hours or greater. If use_delta_kt_prime=True,
        input data must be Series.

    temp_dew : None, float, or array-like, default None
        Surface dew point temperatures, in degrees C. Values of temp_dew
        may be numeric or NaN. Any single time period point with a
        temp_dew=NaN does not have dew point improvements applied. If
        temp_dew is not provided, then dew point improvements are not
        applied.

    albedo : numeric, default 0.25
        Surface albedo

    model : String, default 'isotropic'
        Irradiance model.

    model_perez : String, default 'allsitescomposite1990'
        Used only if model='perez'. See :py:func:`perez`.

    calculate_gt_90 : bool, default True
        Controls if the algorithm evaluates inputs with AOI >= 90 degrees.
        If False, returns nan for AOI >= 90 degrees. Significant speed ups
        can be achieved by setting this parameter to False.

    max_iterations : int, default 30
        Maximum number of iterations for the aoi < 90 deg algorithm.

    Returns
    -------
    data : OrderedDict or DataFrame
        Contains the following keys/columns:

            * ``ghi``: the modeled global horizontal irradiance in W/m^2.
            * ``dni``: the modeled direct normal irradiance in W/m^2.
            * ``dhi``: the modeled diffuse horizontal irradiance in
              W/m^2.

    References
    ----------
    .. [1] B. Marion, A model for deriving the direct normal and
           diffuse horizontal irradiance from the global tilted
           irradiance, Solar Energy 122, 1037-1046.
           :doi:`10.1016/j.solener.2015.10.024`

def gti_dirint(poa_global, aoi, solar_zenith, solar_azimuth, times,
               surface_tilt, surface_azimuth, pressure=101325.,
               use_delta_kt_prime=True, temp_dew=None, albedo=.25,
               model='perez', model_perez='allsitescomposite1990',
               calculate_gt_90=True, max_iterations=30):
    """
    Determine GHI, DNI, DHI from POA global using the GTI DIRINT model.

    .. warning::

        Model performance is poor for AOI greater than approximately
        80 degrees `and` plane of array irradiance greater than
        approximately 200 W/m^2.

    Parameters
    ----------
    poa_global : array-like
        Plane of array global irradiance in W/m^2.

    aoi : array-like
        Angle of incidence of solar rays with respect to the module
        surface normal.

    solar_zenith : array-like
        True (not refraction-corrected) solar zenith angles in decimal
        degrees.

    solar_azimuth : array-like
        Solar azimuth angles in decimal degrees.

    times : DatetimeIndex
        Time indices for the input array-like data.

    surface_tilt : numeric
        Surface tilt angles in decimal degrees. Tilt must be >=0 and
        <=180. The tilt angle is defined as degrees from horizontal
        (e.g. surface facing up = 0, surface facing horizon = 90).

    surface_azimuth : numeric
        Surface azimuth angles in decimal degrees. surface_azimuth must
        be >=0 and <=360. The Azimuth convention is defined as degrees
        east of north (e.g. North = 0, South=180 East = 90, West = 270).

    pressure : numeric, default 101325.0
        The site pressure in Pascal. Pressure may be measured or an
        average pressure may be calculated from site altitude.

    use_delta_kt_prime : bool, default True
        If True, indicates that the stability index delta_kt_prime is
        included in the model. The stability index adjusts the estimated
        DNI in response to dynamics in the time series of GHI. It is
        recommended that delta_kt_prime is not used if the time between
        GHI points is 1.5 hours or greater. If use_delta_kt_prime=True,
        input data must be Series.

    temp_dew : None, float, or array-like, default None
        Surface dew point temperatures, in degrees C. Values of temp_dew
        may be numeric or NaN. Any single time period point with a
        temp_dew=NaN does not have dew point improvements applied. If
        temp_dew is not provided, then dew point improvements are not
        applied.

    albedo : numeric, default 0.25
        Surface albedo

    model : String, default 'isotropic'
        Irradiance model.

    model_perez : String, default 'allsitescomposite1990'
        Used only if model='perez'. See :py:func:`perez`.

    calculate_gt_90 : bool, default True
        Controls if the algorithm evaluates inputs with AOI >= 90 degrees.
        If False, returns nan for AOI >= 90 degrees. Significant speed ups
        can be achieved by setting this parameter to False.

    max_iterations : int, default 30
        Maximum number of iterations for the aoi < 90 deg algorithm.

    Returns
    -------
    data : OrderedDict or DataFrame
        Contains the following keys/columns:

            * ``ghi``: the modeled global horizontal irradiance in W/m^2.
            * ``dni``: the modeled direct normal irradiance in W/m^2.
            * ``dhi``: the modeled diffuse horizontal irradiance in
              W/m^2.

    References
    ----------
    .. [1] B. Marion, A model for deriving the direct normal and
           diffuse horizontal irradiance from the global tilted
           irradiance, Solar Energy 122, 1037-1046.
           :doi:`10.1016/j.solener.2015.10.024`
    """

    aoi_lt_90 = aoi < 90

    # for AOI less than 90 degrees
    ghi, dni, dhi, kt_prime = _gti_dirint_lt_90(
        poa_global, aoi, aoi_lt_90, solar_zenith, solar_azimuth, times,
        surface_tilt, surface_azimuth, pressure=pressure,
        use_delta_kt_prime=use_delta_kt_prime, temp_dew=temp_dew,
        albedo=albedo, model=model, model_perez=model_perez,
        max_iterations=max_iterations)

    # for AOI greater than or equal to 90 degrees
    if calculate_gt_90:
        ghi_gte_90, dni_gte_90, dhi_gte_90 = _gti_dirint_gte_90(
            poa_global, aoi, solar_zenith, solar_azimuth,
            surface_tilt, times, kt_prime,
            pressure=pressure, temp_dew=temp_dew, albedo=albedo)
    else:
        ghi_gte_90, dni_gte_90, dhi_gte_90 = np.nan, np.nan, np.nan

    # put the AOI < 90 and AOI >= 90 conditions together
    output = OrderedDict()
    output['ghi'] = ghi.where(aoi_lt_90, ghi_gte_90)
    output['dni'] = dni.where(aoi_lt_90, dni_gte_90)
    output['dhi'] = dhi.where(aoi_lt_90, dhi_gte_90)

    output = pd.DataFrame(output, index=times)

    return output