def clearness_index(ghi, solar_zenith, extra_radiation, min_cos_zenith=<NUM_LIT>,<EOL>max_clearness_index=<NUM_LIT>):
cos_zenith = tools.cosd(solar_zenith)<EOL>I0h = extra_radiation * np.maximum(cos_zenith, min_cos_zenith)<EOL>kt = ghi / I0h<EOL>kt = np.maximum(kt, <NUM_LIT:0>)<EOL>kt = np.minimum(kt, max_clearness_index)<EOL>return kt<EOL>
Calculate the clearness index.

The clearness index is the ratio of global to extraterrestrial
irradiance on a horizontal plane.

Parameters
----------
ghi : numeric
    Global horizontal irradiance in W/m^2.

solar_zenith : numeric
    True (not refraction-corrected) solar zenith angle in decimal
    degrees.

extra_radiation : numeric
    Irradiance incident at the top of the atmosphere

min_cos_zenith : numeric, default 0.065
    Minimum value of cos(zenith) to allow when calculating global
    clearness index `kt`. Equivalent to zenith = 86.273 degrees.

max_clearness_index : numeric, default 2.0
    Maximum value of the clearness index. The default, 2.0, allows
    for over-irradiance events typically seen in sub-hourly data.
    NREL's SRRL Fortran code used 0.82 for hourly data.

Returns
-------
kt : numeric
    Clearness index

References
----------
.. [1] Maxwell, E. L., "A Quasi-Physical Model for Converting Hourly
       Global Horizontal to Direct Normal Insolation", Technical
       Report No. SERI/TR-215-3087, Golden, CO: Solar Energy Research
       Institute, 1987.