code: def tropical_nights(tasmin, thresh='20.0 degC', freq='YS'):
      r
      thresh = utils.convert_units_to(thresh, tasmin)
      return tasmin.pipe(lambda x: (tasmin > thresh) * 1) \
          .resample(time=freq) \
          .sum(dim='time')
docs: r"""Tropical nights
  
      The number of days with minimum daily temperature above threshold.
  
      Parameters
      ----------
      tasmin : xarray.DataArray
        Minimum daily temperature [℃] or [K]
      thresh : str
        Threshold temperature on which to base evaluation [℃] or [K]. Default: '20 degC'.
      freq : str, optional
        Resampling frequency
  
      Returns
      -------
      xarray.DataArray
        Number of days with minimum daily temperature above threshold.
  
      Notes
      -----
      Let :math:`TN_{ij}` be the daily minimum temperature at day :math:`i` of period :math:`j`. Then
      counted is the number of days where:
  
      .. math::
  
          TN_{ij} > Threshold [℃]