code: def tx_max(tasmax, freq='YS'):
      r
  
      return tasmax.resample(time=freq).max(dim='time', keep_attrs=True)
docs: r"""Highest max temperature
  
      The maximum value of daily maximum temperature.
  
      Parameters
      ----------
      tasmax : xarray.DataArray
        Maximum daily temperature [℃] or [K]
      freq : str, optional
        Resampling frequency
  
      Returns
      -------
      xarray.DataArray
        Maximum value of daily maximum temperature.
  
      Notes
      -----
      Let :math:`TX_{ij}` be the maximum temperature at day :math:`i` of period :math:`j`. Then the maximum
      daily maximum temperature for period :math:`j` is:
  
      .. math::
  
          TXx_j = max(TX_{ij})