docs: def clearness_index(ghi, altitude, extra_radiation, min_sin_altitude=0.065,
                      max_clearness_index=2.0):
      """
      Calculate the clearness index.
  
      The clearness index is the ratio of global to extraterrestrial
      irradiance on a horizontal plane.
  
      Note:
          [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.
  
      Args:
          ghi: numeric
              Global horizontal irradiance in W/m^2.
          altitude: numeric
              True (not refraction-corrected) solar altitude angle in decimal
              degrees.
          extra_radiation: numeric
              Irradiance incident at the top of the atmosphere
          min_sin_altitude: numeric, default 0.065
              Minimum value of sin(altitude) to allow when calculating global
              clearness index `kt`. Equivalent to altitude = 3.727 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
      """
      sin_altitude = math.sin(math.radians(altitude))
      I0h = extra_radiation * max(sin_altitude, min_sin_altitude)
      kt = ghi / I0h
      kt = max(kt, 0)
      kt = min(kt, max_clearness_index)
      return kt