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
Add grd2xyz option -L to limit output to a single vector #5705
Conversation
This need comes up all the time and over the years we have done piping via awk, grdtrack -W and probalby other acrobatics. Now, -Lc|r|x|yvalue handles it directly.
Nice! Just needs to be added to the usage message. |
Should now be good to go, @meghanrjones |
0 30 0 | ||
10 30 300 | ||
20 30 600 | ||
30 30 900 | ||
40 30 1200 | ||
50 30 1500 |
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 do not understand why the y coordinates for row index 2 are 30. I would expect them to be 20 based on the grid:
data:
x = 0, 10, 20, 30, 40, 50 ;
y = 0, 10, 20, 30, 40, 50 ;
z =
0, 0, 0, 0, 0, 0,
0, 100, 200, 300, 400, 500,
0, 200, 400, 600, 800, 1000,
0, 300, 600, 900, 1200, 1500,
0, 400, 800, 1200, 1600, 2000,
0, 500, 1000, 1500, 2000, 2500 ;
}
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.
y-coordinates to up (right-handed coordinate system).
rows start at ymax and go down...
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.
OK, this should be documented in the option as it is not a universal indexing system (e.g., MATLAB, xarray behavior is opposite).
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.
Yes, you are right about that. I think this is one of the few places where the user gets to enter a row index. I will add a note to the docs.
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.
Nice addition! Just recommend adding a note about the indexing direction.
This need comes up all the time and over the years we have done piping via awk, grdtrack -E , project -G and probably other acrobatics. Now, -Lc|r|x|yvalue handles it directly. If given row or column is outside grid limits then a warning ensues and no output is returned. For row and column coordinates we find the nearest row or column so you dont have to worry about getting enough decimals in -Lx0.33333, for instance.
I added a basic test with verified result.