<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wetdays(pr, thresh='1.0 mm/day', freq='YS'):
 r"""Wet days Return the total number of days during period with precipitation over threshold. Parameters pr : xarray.DataArray Daily precipitation [mm] thresh : str Precipitation value over which a day is considered wet. Default: '1 mm/day'. freq : str, optional Resampling frequency defining the periods defined in http://pandas.pydata.org/pandas-docs/stable/timeseries.html#resampling. Returns ------- xarray.DataArray The number of wet days for each period [day] Examples -------- The following would compute for each grid cell of file `pr.day.nc` the number days with precipitation over 5 mm at the seasonal frequency, ie DJF, MAM, JJA, SON, DJF, etc.: """

    thresh = utils.convert_units_to(thresh, pr, 'hydro')

    wd = (pr >= thresh) * 1
    return wd.resample(time=freq).sum(dim='time')