Skip to content

Commit 8626690

Browse files
pierreloicqpre-commit-ci[bot]dcherian
authored
[DOC] resample and then apply func on time+other variables (#7725)
* [DOC] resample and then apply func on time+other variables: * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update doc/user-guide/time-series.rst --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Deepak Cherian <[email protected]>
1 parent a0141cd commit 8626690

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/user-guide/time-series.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ resampling group:
225225
226226
ds.resample(time="6H").reduce(np.mean)
227227
228+
You can also resample on the time dimension while applying reducing along other dimensions at the same time
229+
by specifying the `dim` keyword argument
230+
231+
.. code-block:: python
232+
233+
ds.resample(time="6H").mean(dim=["time", "latitude", "longitude"])
234+
228235
For upsampling, xarray provides six methods: ``asfreq``, ``ffill``, ``bfill``, ``pad``,
229236
``nearest`` and ``interpolate``. ``interpolate`` extends ``scipy.interpolate.interp1d``
230237
and supports all of its schemes. All of these resampling operations work on both

0 commit comments

Comments
 (0)