Skip to content

Commit

Permalink
Add example to docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
lochhh committed Jun 7, 2024
1 parent 5fe0016 commit 157684b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions movement/move_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,30 @@ def filtering_wrapper(
Raises
------
AttributeError
If the required data variables are not present in the dataset.
RuntimeError
If the requested function fails to execute.
Examples
--------
Apply a median filter to the ``position`` data variable and
store this back into the Dataset ``ds``.
If ``data_vars`` is not supplied, the filter will be applied to
the ``position`` data variable by default.
>>> filtered_position = ds.move.median_filter(window=3)
>>> ds.update({"position": filtered_position})
Apply a Savitzky-Golay filter to both the ``position`` and
``velocity`` data variables and store these back into the
Dataset ``ds``. ``filtered_data`` is a dictionary, where the keys
are the data variable names and the values are the filtered
DataArrays.
>>> filtered_data = ds.move.savgol_filter(
... window=3, data_vars=["position", "velocity"]
... )
>>> ds.update(filtered_data)
"""
ds = self._obj
if data_vars is None: # Default to filter on position
Expand Down

0 comments on commit 157684b

Please sign in to comment.