-
Notifications
You must be signed in to change notification settings - Fork 224
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
Sensible array outputs for pygmt info #575
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also renamed 'fname' argument to 'table' since `info` supports both file name inputs and pandas.DataFrame tables now.
When either of per_column (C), spacing (I), or nearest_multiple (T) are used in `pygmt.info`, output the result as a numpy.ndarray which would be more usable that a raw string that is meant for the command line world. Also improve the docstring of `pygmt.info` to mention that numpy.ndarray outputs are being reported.
This was referenced Sep 6, 2020
Closed
weiji14
changed the title
WIP Sensible array outputs for pygmt info
Sensible array outputs for pygmt info
Sep 7, 2020
weiji14
force-pushed
the
sensible_info_outputs
branch
from
September 7, 2020 05:28
283a70b
to
6b99727
Compare
seisman
reviewed
Sep 9, 2020
seisman
approved these changes
Sep 9, 2020
Cool, thanks for reviewing, this will be a great addition for v0.2.0! I'll temporarily disable the required Windows Py3.8 test (random unrelated failure we should investigate at some point) to merge this (because I don't want to waste another 15min of CI resources). |
weiji14
added a commit
to weiji14/deepicedrain
that referenced
this pull request
Sep 13, 2020
Bumps [pygmt](https://github.com/GenericMappingTools/pygmt) from 0.1.2-36-g4939ee2a to 0.2.0. - [Release notes](https://github.com/GenericMappingTools/pygmt/releases) - [Changelog](https://github.com/GenericMappingTools/pygmt/blob/master/doc/changes.rst) - [Commits](GenericMappingTools/pygmt@v0.1.2-36-g4939ee2a...v0.2.0) This includes several enhancements such as 'Sensible array outputs for pygmt info' (GenericMappingTools/pygmt#575) and 'Allow passing in pandas dataframes to x2sys_cross' (GenericMappingTools/pygmt#591) that will make our crossover analysis work and figure generation easier! Also edited Github Actions workflow to only run Docker build on Pull Requests when ready to review or when review is requested (i.e. not when PR is in draft mode).
weiji14
added a commit
to weiji14/deepicedrain
that referenced
this pull request
Sep 15, 2020
Bumps [pygmt](https://github.com/GenericMappingTools/pygmt) from 0.1.2-36-g4939ee2a to 0.2.0. - [Release notes](https://github.com/GenericMappingTools/pygmt/releases) - [Changelog](https://github.com/GenericMappingTools/pygmt/blob/master/doc/changes.rst) - [Commits](GenericMappingTools/pygmt@v0.1.2-36-g4939ee2a...v0.2.0) This includes several enhancements such as 'Sensible array outputs for pygmt info' (GenericMappingTools/pygmt#575) and 'Allow passing in pandas dataframes to x2sys_cross' (GenericMappingTools/pygmt#591) that will make our crossover analysis work and figure generation easier! Also edited Github Actions workflow to only run Docker build on Pull Requests when ready to review or when review is requested (i.e. not when PR is in draft mode).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
Output the result of
pygmt.info
as a numpy.ndarray when either of per_column (C), spacing (I), or nearest_multiple (T) are used. This would be more usable that a raw string that is meant for the command line world.This implements @seisman's original suggestion at #147 (comment), with both 1D and 2D array outputs supported!
Examples:
The parsing uses a bit of regex to remove the "-R", "-I" from the raw string, and split on "/" or " " delimiters.
pygmt/pygmt/modules.py
Lines 125 to 130 in 05a3f23
Note: Merge after #574!!! ✔️
Fixes #147
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.