-
Notifications
You must be signed in to change notification settings - Fork 224
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
pygmt.grd2xyz: Improve performance by storing output in virtual files #3097
Conversation
…et rid of temporary output files
CodSpeed Performance ReportMerging #3097 will degrade performances by 81.76%Falling back to comparing Summary
Benchmarks breakdown
|
@@ -52,44 +49,6 @@ def test_grd2xyz_format(grid): | |||
assert list(xyz_df.columns) == ["lon", "lat", "z"] | |||
|
|||
|
|||
def test_grd2xyz_file_output(grid): |
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 four tests are not directly related to grd2xyz
. test_grd2xyz_file_output
is already covered by the doctest of the Session.virtualfile_out
method. The other three tests will be covered by doctests in PR #3098.
Run the test locally:
In the main branch:
In this branch:
So, for this small test, the new version is much slower, as suggested by the CodeSpeed benchmark report. For a larger grid data:
In the main branch:
In this branch:
It's clear that for large output dataset, the new version is faster. |
Changes in this PR:
grd2xyz
function using thevirtualfile_out
/virtualfile_to_dataset
methods (address Consistent table-like output for PyGMT functions/methods #1318 and Get rid of temporary files from pygmt functions and plotting methods #2730)output_type
/outfile
parameters and return valuegrd2xyz
(see pygmt.grd2xyz: Improve performance by storing output in virtual files #3097 (comment)).test_grd2xyz
andtest_grd2xyz_format
tests into a single onePreview: https://pygmt-dev--3097.org.readthedocs.build/en/3097/api/generated/pygmt.grd2xyz.html#pygmt.grd2xyz