From c5208f0abd5d26f60a41972050dae77dcab6af57 Mon Sep 17 00:00:00 2001 From: Aisun <193120803+AisunZa@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:05:01 +0330 Subject: [PATCH 1/5] docs: add filter1d usage example --- pygmt/src/filter1d.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pygmt/src/filter1d.py b/pygmt/src/filter1d.py index 6ded1b1cb01..7a9e5178728 100644 --- a/pygmt/src/filter1d.py +++ b/pygmt/src/filter1d.py @@ -16,7 +16,7 @@ use_alias, validate_output_table_type, ) - +__doctest_skip__ = ["filter1d"] @fmt_docstring @use_alias(E="end", F="filter_type", N="time_col") @@ -114,6 +114,22 @@ def filter1d( ``outfile``) - :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set (depends on ``output_type``) + + Examples + -------- + Filter a noisy time series using a Gaussian filter. + + >>> import numpy as np + >>> import pygmt + >>> time = np.arange(10.0) + >>> observations = np.array( + ... [1.0, 2.0, 4.0, 2.0, 3.0, 6.0, 5.0, 4.0, 3.0, 2.0] + ... ) + >>> data = np.column_stack((time, observations)) + >>> filtered = pygmt.filter1d( + ... data=data, filter_type="g3", end=True + ... ) + """ if kwargs.get("F") is None: raise GMTParameterError(required="filter_type") From 3b25b6057a30c78d0fb1458e6cd4ac5a03c2ee55 Mon Sep 17 00:00:00 2001 From: Aisun <193120803+AisunZa@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:12:43 +0330 Subject: [PATCH 2/5] docs: add filter1d usage example --- pygmt/src/filter1d.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pygmt/src/filter1d.py b/pygmt/src/filter1d.py index 7a9e5178728..f422fe47d38 100644 --- a/pygmt/src/filter1d.py +++ b/pygmt/src/filter1d.py @@ -16,8 +16,10 @@ use_alias, validate_output_table_type, ) + __doctest_skip__ = ["filter1d"] + @fmt_docstring @use_alias(E="end", F="filter_type", N="time_col") def filter1d( @@ -115,9 +117,12 @@ def filter1d( - :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set (depends on ``output_type``) + Examples -------- - Filter a noisy time series using a Gaussian filter. + Apply a Gaussian filter to smooth a noisy time series. The input + contains time values in the first column and observations in the + second column. Setting ``end=True`` retains the endpoints. >>> import numpy as np >>> import pygmt @@ -129,7 +134,7 @@ def filter1d( >>> filtered = pygmt.filter1d( ... data=data, filter_type="g3", end=True ... ) - + """ if kwargs.get("F") is None: raise GMTParameterError(required="filter_type") From 8ff78827356b3a8d2cb9132ba56defe79c155fdd Mon Sep 17 00:00:00 2001 From: Aisun <193120803+AisunZa@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:22:42 +0330 Subject: [PATCH 3/5] style: remove trailing whitespace from filter1d docstring --- pygmt/src/filter1d.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/src/filter1d.py b/pygmt/src/filter1d.py index f422fe47d38..ac4ad615ebf 100644 --- a/pygmt/src/filter1d.py +++ b/pygmt/src/filter1d.py @@ -116,7 +116,6 @@ def filter1d( ``outfile``) - :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set (depends on ``output_type``) - Examples -------- From 5dc259948175cf04732ce0c3699cc52a1063f93f Mon Sep 17 00:00:00 2001 From: Aisun <193120803+AisunZa@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:26:07 +0330 Subject: [PATCH 4/5] style: format filter1d docstring example --- pygmt/src/filter1d.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pygmt/src/filter1d.py b/pygmt/src/filter1d.py index ac4ad615ebf..c75128fe12b 100644 --- a/pygmt/src/filter1d.py +++ b/pygmt/src/filter1d.py @@ -126,12 +126,11 @@ def filter1d( >>> import numpy as np >>> import pygmt >>> time = np.arange(10.0) - >>> observations = np.array( - ... [1.0, 2.0, 4.0, 2.0, 3.0, 6.0, 5.0, 4.0, 3.0, 2.0] - ... ) + + >>> observations = np.array([1.0, 2.0, 4.0, 2.0, 3.0, 6.0, 5.0, 4.0, 3.0, 2.0]) >>> data = np.column_stack((time, observations)) - >>> filtered = pygmt.filter1d( - ... data=data, filter_type="g3", end=True + >>> filtered = pygmt.filter1d(data=data, filter_type="g3", end=True) + ... ) """ From a423b9f20439d730c697efcb3c5bab561eadba76 Mon Sep 17 00:00:00 2001 From: Aisun <193120803+AisunZa@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:30:01 +0330 Subject: [PATCH 5/5] docs: remove leftover doctest continuation --- pygmt/src/filter1d.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pygmt/src/filter1d.py b/pygmt/src/filter1d.py index c75128fe12b..884bd1378be 100644 --- a/pygmt/src/filter1d.py +++ b/pygmt/src/filter1d.py @@ -130,9 +130,6 @@ def filter1d( >>> observations = np.array([1.0, 2.0, 4.0, 2.0, 3.0, 6.0, 5.0, 4.0, 3.0, 2.0]) >>> data = np.column_stack((time, observations)) >>> filtered = pygmt.filter1d(data=data, filter_type="g3", end=True) - - ... ) - """ if kwargs.get("F") is None: raise GMTParameterError(required="filter_type")