-
Notifications
You must be signed in to change notification settings - Fork 235
WIP: Add return_table helper function #1336
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e668ec1
add return_table() to utils.py
willschlitzer 6d8b2e0
add import statements for pandas and numpy
willschlitzer 10f8238
update return_table import
willschlitzer 3546ef6
add exception handling for return_table
willschlitzer 8e59e57
update grdtrack.py and test_grdtrack.py to use return_table
willschlitzer 88832db
format grdtrack gallery example for using df_columns parameter
willschlitzer 3a98346
add test_grdtrack_output_types()
willschlitzer c8cef5e
add xarray and geopandas output options for return_table()
willschlitzer 46f2cd4
add tests for xarray and GeoDataFrame in test_grdtrack.py
willschlitzer b2a388f
add tests for xarray and GeoDataFrame as output options for return_ta…
willschlitzer d7084e5
change assert type to assert isinstance
willschlitzer 935bdaa
move geopandas import in test_grdtrack.py to use importskip
willschlitzer eae2eef
Merge branch 'master' into table-output-function
willschlitzer c65fb0e
remove geopandas from available return table options
willschlitzer 61f6126
add test for failure for invalid output type
willschlitzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising! A few comments:
format_optionsparameter forreturn_table. This could take a list, with defaults values including numpy, pandas, and str. This way, if it doesn't for example make sense to return string values then that could not be given as an option in the individual function documentation/implementation.str or numpy.ndarray or pandas.DataFrame or xarray.Dataset or geopandas.GeoDataFrame. It would be nice if all of these were output options too.numpy|pandas|strseems more readable.df_columnsneeds to be optional.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good; I'll have to get smarter on the last two but I don't see why it should be a problem.
I like the idea of keeping it short, especially when there is a default option (I anticipate it being a numpy array) and the strings are not also the same word as Python modules or variable types. But I understand how the single letters could be confusing.
Since this is a helper function, I envisioned that the argument for
df_columnswould be set up in the GMT function that is using it, such as using["x", "y", "z"]when calling this function inside ofgrd2xyz.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in c8cef5e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to agree with Meghan that long descriptive names like
numpy|pandas|strare preferable 🙂