code: def max_1day_precipitation_amount(pr, freq='YS'):
      r
  
      out = pr.resample(time=freq).max(dim='time', keep_attrs=True)
      return utils.convert_units_to(out, 'mm/day', 'hydro')
docs: r"""Highest 1-day precipitation amount for a period (frequency).
  
      Resample the original daily total precipitation temperature series by taking the max over each period.
  
      Parameters
      ----------
      pr : xarray.DataArray
        Daily precipitation values [Kg m-2 s-1] or [mm]
      freq : str, optional
        Resampling frequency one of : 'YS' (yearly) ,'M' (monthly), or 'QS-DEC' (seasonal - quarters starting in december)
  
      Returns
      -------
      xarray.DataArray
        The highest 1-day precipitation value at the given time frequency.
  
      Notes
      -----
      Let :math:`PR_i` be the mean daily precipitation of day `i`, then for a period `j`:
  
      .. math::
  
         PRx_{ij} = max(PR_{ij})
  
      Examples
      --------
      The following would compute for each grid cell of file `pr.day.nc` the highest 1-day total
      at an annual frequency:
  
      >>> pr = xr.open_dataset('pr.day.nc').pr
      >>> rx1day = max_1day_precipitation_amount(pr, freq="YS")