Skip to content

Missing Examples for user facing function #1666

Open

Description

@jbusecke

Description of the desired feature

First of all, the existing examples are really, really nice! They helped me a lot understanding the functionality.

I was however not able to find examples for pygmt.Figure.psconvert, pygmt.Figure.grd2cpt, and pygmt.set_display.

Furthermore many of the processing functions are not show in the examples as far as I can tell.

Activity

  1. added
    documentation
    and removed
    feature request
    on Dec 14, 2021
  2. weiji14 commented on Dec 14, 2021

    @weiji14
    Member

    First of all, the existing examples are really, really nice! They helped me a lot understanding the functionality.

    Thanks for the kind words, glad you found them helpful 😃

    I was however not able to find examples for pygmt.Figure.psconvert, pygmt.Figure.grd2cpt, and pygmt.set_display.

    Agree that pygmt.grd2cpt should have a gallery example, there's 7 for pygmt.makecpt at https://www.pygmt.org/v0.5.0/api/generated/pygmt.makecpt.html#examples-using-pygmt-makecpt so we could maybe change 1 or 2 over.

    As for pygmt.Figure.psconvert and pygmt.set_display, these functions are mostly for advanced users. We could perhaps add an inline usage docstring for these, similar to that at https://www.pygmt.org/v0.5.0/api/generated/pygmt.config.html.

    Furthermore many of the processing functions are not show in the examples as far as I can tell.

    Yes you are correct that most data processing functions don't have examples. The main reason is probably because we don't want to slow down the Docs Build CI which currently takes 15 minutes. Bearing in mind that a data processing gallery example would need to 1) run the data processing and 2) produce a plot, which is quite a lot, but definitely possible (there's a recent one @michaelgrund made at #1598).

    Action point: I think inline docstring might be the way to go with some of these examples. Upstream GMT has done this (e.g. at https://docs.generic-mapping-tools.org/6.3/basemap.html#examples), so we can probably translate these to PyGMT. The pygmt.grdfilter function has an example we can use as a reference. Key challenge might be to prevent these inline code examples from running in CI (but definitely check that the syntax is ok).

  3. willschlitzer commented on Dec 20, 2021

    @willschlitzer
    Contributor

    Action point: I think inline docstring might be the way to go with some of these examples. Upstream GMT has done this (e.g. at https://docs.generic-mapping-tools.org/6.3/basemap.html#examples), so we can probably translate these to PyGMT. The pygmt.grdfilter function has an example we can use as a reference. Key challenge might be to prevent these inline code examples from running in CI (but definitely check that the syntax is ok).

    I agree with using inline examples. I use the GMT inline examples to demonstrate the syntax for non-plotting modules when writing the tests for module-wrapping.

  4. willschlitzer commented on Dec 21, 2021

    @willschlitzer
    Contributor

    @GenericMappingTools/pygmt-maintainers Would it be a good idea to add inline docstring examples (without an associated plot) to all of our module docstrings? That way the page would be a one-stop-shop without needing to go to an example.

  5. maxrjones commented on Dec 22, 2021

    @maxrjones
    Member

    @GenericMappingTools/pygmt-maintainers Would it be a good idea to add inline docstring examples (without an associated plot) to all of our module docstrings? That way the page would be a one-stop-shop without needing to go to an example.

    Yes to me, as long as we can skip the inline examples in the CI and locally when needed.

  6. added this to the 0.6.0 milestone on Jan 8, 2022
  7. pinned this issue on Jan 14, 2022
  8. added
    help wanted
    on Mar 10, 2022
  9. modified the milestones: 0.6.0, 0.6.1 on Mar 11, 2022
  10. unpinned this issue on Mar 21, 2022
  11. modified the milestones: 0.6.1, 0.7.0 on Apr 9, 2022
  12. modified the milestones: 0.7.0, 0.8.0 on Jun 23, 2022
  13. modified the milestones: 0.8.0, 0.9.0 on Dec 11, 2022
  14. modified the milestones: 0.9.0, 0.10.0 on Mar 19, 2023
  15. modified the milestones: 0.10.0, 0.11.0 on Aug 29, 2023
  16. modified the milestones: 0.11.0, 0.12.0 on Dec 11, 2023
  17. removed this from the 0.12.0 milestone on Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions