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

pygmt.grdtrack: Add 'output_type' parameter for output in pandas/numpy/file formats #3106

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Mar 13, 2024

Description of proposed changes

Same as #3103 but for grdtrack.

Preview: https://pygmt-dev--3106.org.readthedocs.build/en/3106/api/generated/pygmt.grdtrack.html#pygmt.grdtrack

Benchmarks:

>>> import pygmt
>>> points = pygmt.datasets.load_sample_data(name="ocean_ridge_points")
>>> for inc in ["30m", "10m", "06m"]:
...     %timeit df = pygmt.grdtrack(points=points, grid=f"@earth_relief_{inc}_g", newcolname="bathymetry")
...

Main branch:

20.5 ms ± 154 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
57.6 ms ± 227 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
139 ms ± 268 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

This branch:

14.1 ms ± 3.08 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
49.1 ms ± 174 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
130 ms ± 161 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Mar 13, 2024
@seisman seisman added this to the 0.12.0 milestone Mar 13, 2024
@seisman seisman added needs review This PR has higher priority and needs review. and removed needs review This PR has higher priority and needs review. labels Mar 13, 2024
@michaelgrund michaelgrund added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Mar 15, 2024
Comment on lines 271 to 273
- None if ``outfile`` is set (output will be stored in file set by ``outfile``)
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- None if ``outfile`` is set (output will be stored in file set by ``outfile``)
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)
- ``None`` if ``outfile`` is set (output will be stored in file set by ``outfile``)
- :class:`pandas.DataFrame` or :class:`numpy.ndarray` if ``outfile`` is not set
(depends on ``output_type``)

@seisman seisman merged commit 8220180 into main Mar 15, 2024
10 of 14 checks passed
@seisman seisman deleted the output/grdtrack branch March 15, 2024 13:22
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Mar 19, 2024
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.

None yet

3 participants