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

Add common alias spacing (-I) for specifying grid increments #1288

Merged
merged 5 commits into from
May 24, 2021

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented May 24, 2021

Description of proposed changes

Used to specify the grid spacing. See also https://github.com/GenericMappingTools/gmt/blob/6.2.0rc1/doc/rst/source/explain_-I.rst_

Preview at https://pygmt-git-common-aliases-spacing-gmt.vercel.app/api/generated/pygmt.surface.html

This PR expands and standardizes the spacing (-I) parameter's docstring in blockmean, blockmedian, grdfilter and surface. The {I} common option will also be useful for many future PyGMT modules according to https://github.com/GenericMappingTools/pygmt/pull/1273/files#r637586300:

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 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

@weiji14 weiji14 added the documentation Improvements or additions to documentation label May 24, 2021
@weiji14 weiji14 added this to the 0.4.0 milestone May 24, 2021
@weiji14 weiji14 added this to In progress in Release v0.4.x via automation May 24, 2021
@weiji14 weiji14 self-assigned this May 24, 2021
@willschlitzer
Copy link
Contributor

One thing I've been meaning to ask about at the gmt repo is why their are a limited number of options listed for units next to xinc and yinc. Rather than **-I**\ *xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]] wouldn't it make more sense for it to be **-I**\ *xinc*\ [**+e**\|\ **f**\|\ **k**\|\ **M**\|\ **n**\|\ **u**][/\ *yinc*\ [**+e**\|\ **f**\|\ **k**\|\ **M**\|\ **n**]]?

@maxrjones
Copy link
Member

One thing I've been meaning to ask about at the gmt repo is why their are a limited number of options listed for units next to xinc and yinc. Rather than **-I**\ *xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]] wouldn't it make more sense for it to be **-I**\ *xinc*\ [**+e**\|\ **f**\|\ **k**\|\ **M**\|\ **n**\|\ **u**][/\ *yinc*\ [**+e**\|\ **f**\|\ **k**\|\ **M**\|\ **n**]]?

The +e|n are modifiers that can be appended in addition to the units. For example:
spacing='0.5e+e' indicates a 0.5 m grid spacing in which the region argument is adjusted to match the grid spacing (0.5m), rather than the default of the grid spacing being adjusted to match the region. So the full description would be:
-Ixinc[e|f|k|M|n|u][+e|n][/yinc[e|f|k|M|n|u][+e|n]]. The gmt docs are not consistent for whether [e|f|k|M|n|u] is included in the synopsis (e.g., basemap -L+w), summarized as something like unit (e.g., grd2xyz -W+u), or just mentioned in the full description (e.g., -I descriptions). I guess for pygmt we should pick which version seems the most clear to use throughout.

@seisman
Copy link
Member

seisman commented May 24, 2021

So the full description would be:
-Ixinc[e|f|k|M|n|u][+e|n][/yinc[e|f|k|M|n|u][+e|n]]. The gmt docs are not consistent for whether [e|f|k|M|n|u] is included in the synopsis (e.g., basemap -L+w), summarized as something like unit (e.g., grd2xyz -W+u), or just mentioned in the full description (e.g., -I descriptions). I guess for pygmt we should pick which version seems the most clear to use throughout.

I can't find the original discussions in the GMT repository, but I believe the GMT developers agree with omitting units in the synopsis to make it shorter.

@seisman seisman mentioned this pull request May 24, 2021
5 tasks
Copy link
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@maxrjones
Copy link
Member

The preview looks odd, like this is somehow splitting up the parameters sections.
image

@weiji14
Copy link
Member Author

weiji14 commented May 24, 2021

The preview looks odd, like this is somehow splitting up the parameters sections.

Ok, fixed with cab6ac1 (thanks @seisman)! Preview now looks ok, though not sure why it's starting on a different line still:

image

One thing I've been meaning to ask about at the gmt repo is why their are a limited number of options listed for units next to xinc and yinc. Rather than **-I**\ *xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]] wouldn't it make more sense for it to be **-I**\ *xinc*\ [**+e**\|\ **f**\|\ **k**\|\ **M**\|\ **n**\|\ **u**][/\ *yinc*\ [**+e**\|\ **f**\|\ **k**\|\ **M**\|\ **n**]]?

The +e|n are modifiers that can be appended in addition to the units. For example:
spacing='0.5e+e' indicates a 0.5 m grid spacing in which the region argument is adjusted to match the grid spacing (0.5m), rather than the default of the grid spacing being adjusted to match the region. So the full description would be:
-Ixinc[e|f|k|M|n|u][+e|n][/yinc[e|f|k|M|n|u][+e|n]]. The gmt docs are not consistent for whether [e|f|k|M|n|u] is included in the synopsis (e.g., basemap -L+w), summarized as something like unit (e.g., grd2xyz -W+u), or just mentioned in the full description (e.g., -I descriptions). I guess for pygmt we should pick which version seems the most clear to use throughout.

I've followed the format in https://github.com/GenericMappingTools/gmt/blob/6.2.0rc1/doc/rst/source/explain_-I.rst_ which is used in most of upstream GMT, though you're right that there is some inconsistency throughout the documentation pages. Personally, the e|f|k|m|n block looks confusing, and most people probably won't need to declare the units (especially the imperial ones 😛). But I'm biased as a Cartesian map maker using only +e|n so will defer to what Geographical users prefer.

@weiji14 weiji14 marked this pull request as ready for review May 24, 2021 23:22
@weiji14 weiji14 merged commit 6d915a4 into master May 24, 2021
@weiji14 weiji14 deleted the common-aliases/spacing branch May 24, 2021 23:24
Release v0.4.x automation moved this from In progress to Done May 24, 2021
@weiji14 weiji14 mentioned this pull request Sep 18, 2021
5 tasks
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…MappingTools#1288)

Used to specify the grid spacing. See also
https://github.com/GenericMappingTools/gmt/blob/6.2.0rc1/doc/rst/source/explain_-I.rst_.

* Use standardized spacing (I) docstring in blockmean, blockmedian, grdfilter and surface

Co-authored-by: Dongdong Tian <[email protected]>
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
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants