-
Notifications
You must be signed in to change notification settings - Fork 229
clib: Add the virtualfile_out method for creating output virtualfile #3057
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 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a878635
clib.Session: Add the virtualfile_to_data method for creating virtual…
seisman 3ccc70d
Merge branch 'main' into virtualfile_to_data
seisman c8900d1
Merge branch 'main' into virtualfile_to_data
seisman 452f65f
Merge branch 'main' into virtualfile_to_data
seisman a633abf
Rename virtualfile_to_data to virtualfile_out
seisman 81b8ff0
Merge branch 'main' into virtualfile_to_data
seisman 59527e3
Improve the docstrings
seisman 00f23ff
Merge branch 'main' into virtualfile_to_data
seisman 9108917
Remove some doctests from virtualfile_out and improve the read_virtua…
seisman ee4cada
Sort alphabetically
seisman 888f1c9
Check the content of the output file
seisman 519c780
Remove unused imports in doctests
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
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.
Should we move this into a new
test_clib_virtualfile_out.py
file? Two reasons:GMT_IMAGE
andGMT_CUBE
in the future, and the doctest would get long.pygmt.info
orpygmt.grdinfo
.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 main purpose of these doctests are to show how to use this method and the outpu virtual file in other modules. So I think we can only keep the
dataset
one only and remove all others.Actually we can't. Because the virtual file is an output (i.e.,
GMT_OUT
), it can't be passed as an input toinfo
/grdinfo
. I.e.,lib.call_module("info", f"{vouttbl}")
won't work.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.
You can move the grid one to
test_clib_virtualfile_out.py
Ah ok, maybe not for the virtualfile then. But we should test that saving to a (non-virtual) file works (when
fname
is used), and try loading from there (i.e. roundtrip). Again, can put this intest_clib_virtualfile_out.py
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.
In commit 9108917, I've removed the doctest for
grid
and kept the doctests fordataset
andfname
. I also realized that these doctests are almost the same as the ones inread_virtualfile
. This makes sense, becauseread_virtualfile
was implemented to read the data from an output virtualfile. So, I also simplify the doctests inread_virtualfile
using the newly addedvirtualfile_out
method.In other words, we probably need to move the doctests of
read_virtualfile
into a separate test file in the future.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.
As mentioned in the above comment, the grid one is already doctested in the
read_virtualfile
method.Done in 888f1c9 but not in a separate test file.