code: def heat_wave_index(tasmax, thresh='25.0 degC', window=5, freq='YS'):
      r
      thresh = utils.convert_units_to(thresh, tasmax)
      over = tasmax > thresh
      group = over.resample(time=freq)
  
      return group.apply(rl.windowed_run_count, window=window, dim='time')
docs: r"""Heat wave index.
  
      Number of days that are part of a heatwave, defined as five or more consecutive days over 25℃.
  
      Parameters
      ----------
      tasmax : xarrray.DataArray
        Maximum daily temperature [℃] or [K]
      thresh : str
        Threshold temperature on which to designate a heatwave [℃] or [K]. Default: '25.0 degC'.
      window : int
        Minimum number of days with temperature above threshold to qualify as a heatwave.
      freq : str, optional
        Resampling frequency
  
      Returns
      -------
      DataArray
        Heat wave index.