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

Expand table-like input options for Figure.contour #1531

Merged
merged 3 commits into from
Sep 22, 2021
Merged

Conversation

maxrjones
Copy link
Member

Description of proposed changes

This PR expands table-like input options for Figure.contour while refactoring to use virtualfile_from_data.

Addresses #949

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

@maxrjones maxrjones added the enhancement Improving an existing feature label Sep 21, 2021
@maxrjones
Copy link
Member Author

@weiji14, can you clarify whether each function needs a test for every input option (relates to #1455 (review))? #1523 added a test that covers each option (except geopandas). So, to me it seems that using pytest.mark.parametrize("array_func,kind", [(np.array, "matrix"), (pd.DataFrame, "vector"), (xr.Dataset, "vector")] for a test in "test_contour.py", "test_surface.py", etc. would be redundant with "pygmt/tests/test_clib.py:test_virtualfile_from_data_required_z_matrix".

@weiji14
Copy link
Member

weiji14 commented Sep 21, 2021

@weiji14, can you clarify whether each function needs a test for every input option (relates to #1455 (review))? #1523 added a test that covers each option (except geopandas). So, to me it seems that using pytest.mark.parametrize("array_func,kind", [(np.array, "matrix"), (pd.DataFrame, "vector"), (xr.Dataset, "vector")] for a test in "test_contour.py", "test_surface.py", etc. would be redundant with "pygmt/tests/test_clib.py:test_virtualfile_from_data_required_z_matrix".

On second thought, maybe not every function since it does get redundant. But I feel it would be nice to test at least 1 for the clib, 1 data processing function (done for nearneighbor), and 1 for a plotting function. So I'd add a parametrize test to contour, but not to others like plot, histogram, etc.

@maxrjones
Copy link
Member Author

On second thought, maybe not every function since it does get redundant. But I feel it would be nice to test at least 1 for the clib, 1 data processing function (done for nearneighbor), and 1 for a plotting function. So I'd add a parametrize test to contour, but not to others like plot, histogram, etc.

Thanks for the input, I added one to this PR.

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Nicely done :)

@weiji14 weiji14 added the final review call This PR requires final review and approval from a second reviewer label Sep 22, 2021
@seisman seisman added this to the 0.5.0 milestone Sep 22, 2021
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Sep 22, 2021
@seisman seisman merged commit ef108d9 into main Sep 22, 2021
@seisman seisman deleted the refactor-contour-data branch September 22, 2021 23:37
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…ls#1531)

* Expand table-like input options for Figure.contour
* Test pandas, numpy, xarray input in test_contour.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants