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.
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
Refactor the virtualfile_in function to accept more 1-D arrays #2744
base: main
Are you sure you want to change the base?
Refactor the virtualfile_in function to accept more 1-D arrays #2744
Changes from 18 commits
66c4b97
78c28cd
f849e5a
f37413b
3de7666
93b91d0
2eecf48
1d6e568
6f9fc19
68034ed
0db21bc
7cf5290
b0b6d2a
fa875ef
2ee0df2
d5c8340
30bacb1
4465f9b
593f252
409337f
872fd59
3ed0eb2
efa7a11
23fc3ea
aa05333
5c10fc4
525a353
2f3fcc4
b55a9ad
46be0fa
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The validation checks have been moved from within
data_kind
tovirtualfile_from_data
here. But inplot.py
, we actually usedata_kind
on its own here:pygmt/pygmt/src/plot.py
Line 217 in 3076ddc
Are we ok with raising GMTInvalidInput much later here in
virtualfile_from_data
(after all the keyword argument parsing), rather than early on indata_kind
?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 think it's more useful to pass the list of column names instead, i.e., replacing
ncols=2
withnames=["x", "y"]
.So, for most modules,
vectors=["x", "y"]
andnames=["x", "y"]
orvectors=[x, y, z]
andnames=["x", "y", "z"]
.For more complicated modules like
plot
orplot3d
, the names can benames=["x", "y", "direction_arg1", "direction_arg2", "fill", "size", "symbol", "transparency"]
.The column names will be very useful when the GMTInvalidInput exception is raised.
For example, instead of
"Column 5 can't be None."
, we can say"Column 5 ('size') can't be None."
. Instead of"data must have at least 8 columns."
, we can sayThere 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.
Done in f37413b
Check warning on line 117 in pygmt/helpers/utils.py
Codecov / codecov/patch
pygmt/helpers/utils.py#L117
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.
Missing unit test for this if-condition.
Check warning on line 130 in pygmt/helpers/utils.py
Codecov / codecov/patch
pygmt/helpers/utils.py#L130
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.
Missing unit test for this if-condition.