Add grd2xyz option -L to limit output to a single vector#5705
Add grd2xyz option -L to limit output to a single vector#5705PaulWessel merged 5 commits intomasterfrom
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.
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.
y-coordinates to up (right-handed coordinate system).
rows start at ymax and go down...
There was a problem hiding this comment.
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.
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.
maxrjones
left a comment
There was a problem hiding this comment.
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.