You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add inline code examples in data processing module docstrings #1686
As first discussed in this comment, module docstrings should contain inline code examples to show a working example of the module with the correct syntax without needing to find an example page.
To prevent example functions from being run in tests, add _doctest_skip__ = [MODULE NAME] under the import statements.
Add a new target to the Makefile to invoke pytest without doctest, such that the tests without docstring examples can be run on every PR and doctests could be run occasionally.
changed the title [-]Add inline code examples in module docstrings[/-][+]Add inline code examples in data processing module docstrings[/+]on Jan 28, 2022
@GenericMappingTools/pygmt-maintainers Should this only be for data processing modules that can't be as easily demonstrated as a plotting function, or should there be in-line examples for all of our modules?
Should this only be for data processing modules that can't be as easily demonstrated as a plotting function, or should there be in-line examples for all of our modules?
Should this only be for data processing modules that can't be as easily demonstrated as a plotting function, or should there be in-line examples for all of our modules?
My vote is for all of them.
Sounds good to me.
Ok with doing inline examples for all, but maybe prioritize those that don't already have a gallery example first. E.g. don't do grdgradient until much later.
Are there any gridded datasets with holes in them to use for an example for grdfill? I can use the code from one of the tests, but it seems counterproductive to demo removing data from a grd file only to add it back in with grdfill.
Are there any gridded datasets with holes in them to use for an example for grdfill? I can use the code from one of the tests, but it seems counterproductive to demo removing data from a grd file only to add it back in with grdfill.
Are there any gridded datasets with holes in them to use for an example for grdfill? I can use the code from one of the tests, but it seems counterproductive to demo removing data from a grd file only to add it back in with grdfill.
Are there any gridded datasets with holes in them to use for an example for grdfill? I can use the code from one of the tests, but it seems counterproductive to demo removing data from a grd file only to add it back in with grdfill.
Hi! I'd like to contribute a small documentation improvement for the unchecked filter1d item in this issue.
My plan is to add a self-contained example demonstrating Gaussian filtering of a simple synthetic time series, limited to `pygmt/src/filter1d.py`.
I'll follow the existing inline-example conventions and validate the example before submitting a PR.
Thanks!
Activity
maxrjones commentedon Jan 20, 2022
Regarding the CI issue raised in #1666 (comment), here are two options:
[-]Add inline code examples in module docstrings[/-][+]Add inline code examples in data processing module docstrings[/+]willschlitzer commentedon Jan 28, 2022
@GenericMappingTools/pygmt-maintainers Should this only be for data processing modules that can't be as easily demonstrated as a plotting function, or should there be in-line examples for all of our modules?
My vote is for all of them.
maxrjones commentedon Jan 28, 2022
Sounds good to me.
weiji14 commentedon Jan 29, 2022
Ok with doing inline examples for all, but maybe prioritize those that don't already have a gallery example first. E.g. don't do
grdgradientuntil much later.Add inline example for select
10 remaining items
willschlitzer commentedon May 6, 2022
Are there any gridded datasets with holes in them to use for an example for
grdfill? I can use the code from one of the tests, but it seems counterproductive to demo removing data from a grd file only to add it back in withgrdfill.maxrjones commentedon May 6, 2022
Looking through https://oceania.generic-mapping-tools.org/cache/,
data_w_nans.ncseems like one option. Below is a picture from the gmt tests that uses that file.willschlitzer commentedon May 6, 2022
Thanks @meghanrjones!
maxrjones commentedon May 6, 2022
There's now a better file to use -
earth_relief_20m_holes.grd, see GenericMappingTools/gmt#6678 and GenericMappingTools/gmtserver-admin#155 for background.AisunZa commentedon Nov 10, 2026
Hi! I'd like to contribute a small documentation improvement for the unchecked
filter1ditem in this issue.