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

Turn all short aliases into long form #474

Merged
merged 25 commits into from
Jun 4, 2020
Merged

Turn all short aliases into long form #474

merged 25 commits into from
Jun 4, 2020

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Jun 1, 2020

Description of proposed changes

To make things more readable, we'll shift our documentation to use long form arguments by default. Starting from the common aliases R, J, B, U, CPT, G and W. Will move on to all others spread across across the API Reference page.

See also upstream GMT docs at https://docs.generic-mapping-tools.org/latest/std-opts.html.

New looking documentation for this branch can be previewed at https://pygmt-git-longaliascommonopts.gmt.now.sh/api/index.html

Files to change:

  • helpers/decorators.py
  • base_plotting.py
  • figure.py
  • gridding.py
  • mathops.py
  • modules.py

Fixes #473

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.

To make things more readable, we'll shift our documentation to use long form arguments by default. Starting from the common aliases R, J, B, U, CPT, G and W.
@weiji14 weiji14 added the documentation Improvements or additions to documentation label Jun 1, 2020
@weiji14 weiji14 added this to the 0.2.x milestone Jun 1, 2020
@weiji14 weiji14 marked this pull request as ready for review June 1, 2020 10:07
pygmt/helpers/decorators.py Outdated Show resolved Hide resolved
pygmt/helpers/decorators.py Outdated Show resolved Hide resolved
Also added timestamp (U) alias to the plotting functions that have them.

Co-Authored-By: Dongdong Tian <[email protected]>
@seisman
Copy link
Member

seisman commented Jun 2, 2020

Perhaps we should update all the short-form arguments (if they have aliases) in this PR, not to update them in multiple PRs. I can help with it if you also agree.

@weiji14
Copy link
Member Author

weiji14 commented Jun 2, 2020

Perhaps we should update all the short-form arguments (if they have aliases) in this PR, not to update them in multiple PRs. I can help with it if you also agree.

Might as well. I'll work on gridding.py, mathops.py first since I wrote those. Do you want to work on base_plotting.py?

@seisman
Copy link
Member

seisman commented Jun 2, 2020

Might as well. I'll work on gridding.py, mathops.py first since I wrote those. Do you want to work on base_plotting.py?

OK.

@weiji14 weiji14 changed the title Turn common aliases from short form to long form Turn all short aliases into long form Jun 2, 2020
Also standardize formatting of grdtrack docstring in line with other docs.
@weiji14
Copy link
Member Author

weiji14 commented Jun 2, 2020

Might as well. I'll work on gridding.py, mathops.py first since I wrote those. Do you want to work on base_plotting.py?

OK.

Alright, gridding.py and mathops.py are done, and I've handled the -n interpolation short alias in sampling.py too. Now moving on to modules.py, and gmt info seems to be a tricky one, as you mentioned in #147. Should I just turn the short aliases into long ones for now and ignore the fact that it produces strings like -Rw/e/s/n or -Tzmin/zmax/dz which go against the essence of this PR?

@seisman
Copy link
Member

seisman commented Jun 2, 2020

Should I just turn the short aliases into long ones for now and ignore the fact that it produces strings like -Rw/e/s/n or -Tzmin/zmax/dz which go against the essence of this PR

Yes, just ignore it.

Also document the required imagefile parameter that was missing.
@@ -634,7 +643,7 @@ def basemap(self, **kwargs):
[optionally] gridlines. A simple map scale or directional rose may also
be plotted.

At least one of the options *B*, *L*, or *T* must be specified.
At least one of the options *frame*, *L*, or *T* must be specified.
Copy link
Member Author

@weiji14 weiji14 Jun 3, 2020

Choose a reason for hiding this comment

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

I've only changed B to frame here for basemap. GMT.jl uses map_scale for L, rose for Td and compass for Tm (see https://www.generic-mapping-tools.org/GMT.jl/latest/#GMT.basemap), do we want to go with those?

Copy link
Member

Choose a reason for hiding this comment

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

Yes to me.

@weiji14
Copy link
Member Author

weiji14 commented Jun 4, 2020

Do you want to take a look at https://pygmt-git-longaliascommonopts.gmt.now.sh/api/index.html to see if we missed any stray short aliases (other than the ones we agreed not to change)?

P.S. Not a user facing change, but we should also update all the tests to use the long alias names at some point.

@seisman
Copy link
Member

seisman commented Jun 4, 2020

Do you want to take a look at https://pygmt-git-longaliascommonopts.gmt.now.sh/api/index.html to see if we missed any stray short aliases (other than the ones we agreed not to change)?

Made a small fix. Now it's good to me.

P.S. Not a user facing change, but we should also update all the tests to use the long alias names at some point.

Yes, I agree.

@weiji14 weiji14 merged commit 0267dd1 into master Jun 4, 2020
@weiji14 weiji14 added this to Done in Release v0.2.x via automation Jun 4, 2020
@weiji14 weiji14 deleted the longalias_commonopts branch June 4, 2020 04:32
@weiji14 weiji14 modified the milestones: 0.2.x, 0.1.x Jun 29, 2020
@weiji14 weiji14 mentioned this pull request Sep 18, 2020
5 tasks
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.

Only document the long-form arguments
2 participants