-
Notifications
You must be signed in to change notification settings - Fork 229
Session.virtualfile_in: Deprecate parameter 'required_z'. Use 'mincols' instead (will be removed in v0.20.0) #3369
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5d3d308
Rename 'required_z' to 'required_ncols' in _validate_data_input
seisman 406cb39
Rename 'required_z' to 'required_ncols' in Session.virtualfile_in
seisman af189e6
Rename 'required_z' to 'required_ncols' in Session.virtualfile_in tests
seisman 2d55e5a
Rename 'required_z' to 'required_ncols' in module wrappers
seisman 84e8d8a
Merge branch 'main' into refactor/virtualfile_in
seisman 5eeb37b
Rename required_ncols to the shorter ncols
seisman 2851af8
Merge branch 'main' into refactor/virtualfile_in
seisman 0e0c1d8
Deprecate required_z in a backward-compatible way
seisman f8293cd
Add one test with the deprecated 'required_z' parameter to increase c…
seisman 312aa39
Merge branch 'main' into refactor/virtualfile_in
seisman b7ca239
Move TODO comment to the top
seisman a01afbb
Merge branch 'main' into refactor/virtualfile_in
seisman da874d1
Put ncols before required_data
seisman 0612cdf
Merge branch 'main' into refactor/virtualfile_in
seisman 4fba462
Merge branch 'main' into refactor/virtualfile_in
seisman ef1f82a
Merge branch 'main' into refactor/virtualfile_in
seisman 4fae564
Merge branch 'main' into refactor/virtualfile_in
seisman 970b824
Update pygmt/clib/session.py
seisman c5eb0e9
Merge branch 'main' into refactor/virtualfile_in
seisman 41ff984
Rename ncols to mincols
seisman 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
|
||
|
||
def _validate_data_input( # noqa: PLR0912 | ||
data=None, x=None, y=None, z=None, required_z=False, required_data=True, kind=None | ||
data=None, x=None, y=None, z=None, ncols=2, required_data=True, kind=None | ||
) -> None: | ||
""" | ||
Check if the combination of data/x/y/z is valid. | ||
|
@@ -66,29 +66,29 @@ def _validate_data_input( # noqa: PLR0912 | |
Traceback (most recent call last): | ||
... | ||
pygmt.exceptions.GMTInvalidInput: Must provide both x and y. | ||
>>> _validate_data_input(x=[1, 2, 3], y=[4, 5, 6], required_z=True) | ||
>>> _validate_data_input(x=[1, 2, 3], y=[4, 5, 6], ncols=3) | ||
Traceback (most recent call last): | ||
... | ||
pygmt.exceptions.GMTInvalidInput: Must provide x, y, and z. | ||
>>> import numpy as np | ||
>>> import pandas as pd | ||
>>> import xarray as xr | ||
>>> data = np.arange(8).reshape((4, 2)) | ||
>>> _validate_data_input(data=data, required_z=True, kind="matrix") | ||
>>> _validate_data_input(data=data, ncols=3, kind="matrix") | ||
Traceback (most recent call last): | ||
... | ||
pygmt.exceptions.GMTInvalidInput: data must provide x, y, and z columns. | ||
>>> _validate_data_input( | ||
... data=pd.DataFrame(data, columns=["x", "y"]), | ||
... required_z=True, | ||
... ncols=3, | ||
... kind="vectors", | ||
... ) | ||
Traceback (most recent call last): | ||
... | ||
pygmt.exceptions.GMTInvalidInput: data must provide x, y, and z columns. | ||
>>> _validate_data_input( | ||
... data=xr.Dataset(pd.DataFrame(data, columns=["x", "y"])), | ||
... required_z=True, | ||
... ncols=3, | ||
... kind="vectors", | ||
... ) | ||
Traceback (most recent call last): | ||
|
@@ -116,6 +116,7 @@ def _validate_data_input( # noqa: PLR0912 | |
GMTInvalidInput | ||
If the data input is not valid. | ||
""" | ||
required_z = ncols >= 3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a temporary fix. Will refactor |
||
if data is None: # data is None | ||
if x is None and y is None: # both x and y are None | ||
if required_data: # data is not optional | ||
|
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
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
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
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.