id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type
400039356,MDU6SXNzdWU0MDAwMzkzNTY=,2685,"porting to new resample when how is lambda/function unclear, wrong advice given.",410907,closed,0,,,1,2019-01-16T23:11:35Z,2023-09-12T15:54:41Z,2023-09-12T15:54:41Z,NONE,,,,"#### Code Sample, a copy-pastable example if possible

```python
In [19]: da = xr.DataArray(np.linspace(0, 11, num=12),
    ...: ...                   coords=[pd.date_range('15/12/1999',
    ...: ...                           periods=12, freq=pd.DateOffset(months=1))],
    ...: ...                   dims='time')
    ...: 
    ...:                                     

In [20]: fn = lambda values, axis: 3

In [21]: da.resample('QS-DEC', 'time', how=fn)
/home/lexfed/miniconda3/envs/jive/bin/ipython:1: FutureWarning: 
.resample() has been modified to defer calculations. 
Instead of passing 'dim' and how=""<function <lambda> at 0x7f1f9e573510>"", 
instead consider using .resample(time=""QS-DEC"").<function <lambda> at 0x7f1f9e573510>('time') 
  #!/home/lexfed/miniconda3/envs/jive/bin/python
Out[21]: 
<xarray.DataArray (time: 4)>
array([3, 3, 3, 3])
Coordinates:
  * time     (time) datetime64[ns] 1999-12-01 2000-03-01 2000-06-01 2000-09-01

```
#### Problem description

1)

Moving to new resample interface in newer xarray releases, it isn't clear how to port code where the how key word argument is a function/lambda.

Can someone please advise how to port code utilising passing to the how argument a function/lambda/etc.

2)

The Future Warning given, doesn't actually make sense where how is a function or lambda, that is not an attribute of the result of a resample.

e.g.
```
instead consider using .resample(time=""QS-DEC"").<function <lambda> at 0x7f1f9e573510>('time') 
 
```
#### Expected Output

#### Output of ``xr.show_versions()``

<details>
In [23]: xr.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.16.11-100.fc26.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_AU.UTF-8
LOCALE: en_AU.UTF-8

xarray: 0.10.6
pandas: 0.23.4
numpy: 1.14.4
scipy: 1.1.0
netCDF4: 1.4.0
h5netcdf: None
h5py: None
Nio: None
zarr: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.17.5
distributed: 1.21.8
matplotlib: 2.2.2
cartopy: None
seaborn: None
setuptools: 39.2.0
pip: 10.0.1
conda: None
pytest: 3.6.0
IPython: 6.4.0
sphinx: None


</details>
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2685/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
412693068,MDU6SXNzdWU0MTI2OTMwNjg=,2783,typos in tutorial.py,410907,closed,0,,,1,2019-02-21T00:29:22Z,2019-02-21T03:10:25Z,2019-02-21T03:10:25Z,NONE,,,,"'achived', should be achieved, I'll send a PR shortly.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2783/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue