code: def warm_night_frequency(tasmin, thresh='22 degC', freq='YS'):
      r
      thresh = utils.convert_units_to(thresh, tasmin, )
      events = (tasmin > thresh) * 1
      return events.resample(time=freq).sum(dim='time')
docs: r"""Frequency of extreme warm nights
  
      Return the number of days with tasmin > thresh per period
  
      Parameters
      ----------
      tasmin : xarray.DataArray
        Minimum daily temperature [℃] or [K]
      thresh : str
        Threshold temperature on which to base evaluation [℃] or [K]. Default : '22 degC'
      freq : str, optional
        Resampling frequency
  
      Returns
      -------
      xarray.DataArray
        The number of days with tasmin > thresh per period