def METHOD_NAME(snw: xarray.DataArray, freq: str = "AS-JUL") -> xarray.DataArray:
    """Maximum snow amount day of year.
    Day of year when surface snow amount reaches its peak value. If snow amount is 0 over entire period, return NaN.
    Parameters
    ----------
    snw : xarray.DataArray
        Surface snow amount.
    freq : str
        Resampling frequency.
    Returns
    -------
    xarray.DataArray
        The day of year at which snow amount reaches its maximum value.
    """
    # Identify periods where there is at least one non-null value for snow depth
    valid = at_least_n_valid(snw.where(snw > 0), n=1, freq=freq)
    # Compute doymax. Will return first time step if all snow depths are 0.
    out = generic.select_resample_op(
        snw.where(snw > 0, 0), op=generic.doymax, freq=freq
    )
    out.attrs.update(units="", is_dayofyear=np.int32(1), calendar=get_calendar(snw))
    # Mask arrays that miss at least one non-null snd.
    return out.where(~valid)