-
Notifications
You must be signed in to change notification settings - Fork 229
grdtrack not working with "profile" option #1827
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
Comments
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct. |
Ah yes, I think I know what's happening, this might be a bug introduced in #1189. In the meantime, you can try using this as a workaround. You can adjust the import pandas as pd
import pygmt
import numpy as np
region = [14.1, 15.2, 41.0, 41.6]
grid = pygmt.datasets.load_earth_relief(resolution="01s", region=region)
profile = "14.33/41.43/14.93/41.14" # these are the coordinates of A and B
points = pd.DataFrame(
data=np.linspace(start=(14.33, 41.43), stop=(14.93, 41.14), num=250),
columns=["x", "y"],
)
track = pygmt.grdtrack(points=points, grid=grid, newcolname="elevation")
print(track) produces x y elevation
0 14.330000 41.430000 1294.000000
1 14.332410 41.428835 1389.962382
2 14.334819 41.427671 1445.901806
3 14.337229 41.426506 1397.092802
4 14.339639 41.425341 1472.605211
... ... ... ...
245 14.920361 41.144659 235.882504
246 14.922771 41.143494 215.088483
247 14.925181 41.142329 170.312853
248 14.927590 41.141165 158.030026
249 14.930000 41.140000 173.000000
250 rows × 3 columns based on this chunk of code: https://github.com/weiji14/pyissm/blob/2a30cfa461b81493f41021bac0c3621a3e30c2ec/plot_figures.py#L105-L141 |
Ok, I see. |
Reopening the issue so that we can better track the bug report and fix it later. |
There are two different ways to specify input track coordinates to #. Pass a file or array to PR #1867 tries to fix the issue by detecting if
which is not friendly. I think we should reorder the function definition to |
Ok, considering that there is a workaround, I guess we could merge #1867 in v0.7.0. But shouldn't we start to raise a Or actually, can't we just change the function definition from |
I'm not sure if I understand you correctly. Do you mean changing the function definition or not? If we change the function definition, then the change should be in v0.7.0, not v0.6.1 following the semantic versioning. If we don't change the function definition, the |
Hi,
I'm trying to extract the topography from a grid along a certain path, going from A to B.
For this purpose, here is the code:
This is the error I get. It occurs with any grid provided, as long as the "profile" option is used and "points" is set to None.
I don't know if this is a bug or I'm just wrongly using the profile/points option is grdtrack.
Any clues on how to solve this?
Thank you!
System information
The text was updated successfully, but these errors were encountered: