Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add inline example for pygmt.datasets.list_sample_data #1814

Closed
wants to merge 1 commit into from

Conversation

maxrjones
Copy link
Member

Description of proposed changes

This PR adds an inline example for pygmt.datasets.list_sample_data. It is a possible solution to #1774 and would be easier to maintain than table/list in the docstring since the output from the example could be easily updated.

It is listed as WIP because the style checks fail with line-too-long errors.

Addresses #1774

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@maxrjones maxrjones added documentation Improvements or additions to documentation skip-changelog Skip adding Pull Request to changelog labels Mar 13, 2022
@seisman seisman added this to the 0.6.1 milestone Mar 15, 2022
@seisman seisman modified the milestones: 0.6.1, 0.7.0 Apr 9, 2022
Comment on lines +29 to +35
{'bathymetry': 'Table of ship bathymetric observations off Baja California',
'fractures': 'Table of hypothetical fracture lengths and azimuths',
'hotspots': 'Table of locations, names, and symbol sizes of hotpots from Mueller et al., 1993',
'japan_quakes': 'Table of earthquakes around Japan from NOAA NGDC database',
'mars_shape': 'Table of topographic signature of the hemispheric dichotomy of Mars from Smith and Zuber (1996)',
'ocean_ridge_points': 'Table of ocean ridge points for the entire world',
'usgs_quakes': 'Table of global earthquakes from the USGS'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this list only 2-3 dataset names, and maybe use ... to indicate that this is an incomplete list? I don't want users to think the output in the example is the complete list.

   {'bathymetry': 'Table of ship bathymetric observations off Baja California',
    'fractures': 'Table of hypothetical fracture lengths and azimuths',
   ...
    'usgs_quakes': 'Table of global earthquakes from the USGS'}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1774. The idea of this PR is to better document the available sample data.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the goal is to document the complete list. Not sure if this is the best way to do that though, I'm open to other ideas.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still prefer a list in the load_sample_data function. The reasons are:

  1. It's more likely that people will read the documentation of load_sample_data first, then realize that they need to read the list_sample_data documentation to know what datasets are available
  2. Because the maximum length is 79 (or 80) for docstrings, a long description for a dataset must be split into two lines (e.g., description for mars_shape), otherwise the style check fails.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you proposing deprecating list_sample_data?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, list_sample_data is still useful to show the available datasets in interactive presentations.

@maxrjones
Copy link
Member Author

maxrjones commented Feb 1, 2023

Superseded by #2342

@maxrjones maxrjones closed this Feb 1, 2023
@maxrjones maxrjones deleted the inline-list-sample-data branch February 1, 2023 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants