code: def tn_mean(tasmin, freq='YS'):
      r
  
      arr = tasmin.resample(time=freq) if freq else tasmin
      return arr.mean(dim='time', keep_attrs=True)
docs: r"""Mean minimum temperature.
  
      Mean of daily minimum temperature.
  
      Parameters
      ----------
      tasmin : xarray.DataArray
        Minimum daily temperature [℃] or [K]
      freq : str, optional
        Resampling frequency
  
      Returns
      -------
      xarray.DataArray
        Mean of daily minimum temperature.
  
      Notes
      -----
      Let :math:`TN_{ij}` be the minimum temperature at day :math:`i` of period :math:`j`. Then mean
      values in period :math:`j` are given by:
  
      .. math::
  
          TN_{ij} = \frac{ \sum_{i=1}^{I} TN_{ij} }{I}