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

Add grd2xyz option -L to limit output to a single vector #5705

Merged
merged 5 commits into from Aug 26, 2021

Conversation

PaulWessel
Copy link
Member

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.

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.
@PaulWessel PaulWessel added the new core module feature PR that implements a new core module feature label Aug 25, 2021
@PaulWessel PaulWessel self-assigned this Aug 25, 2021
@maxrjones maxrjones added the add-changelog Add PR to the changelog label Aug 25, 2021
@maxrjones
Copy link
Member

Nice! Just needs to be added to the usage message.

@PaulWessel
Copy link
Member Author

Should now be good to go, @meghanrjones

Comment on lines +18 to +23
0 30 0
10 30 300
20 30 600
30 30 900
40 30 1200
50 30 1500
Copy link
Member

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 ;
}

Copy link
Member Author

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...

Copy link
Member

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).

Copy link
Member Author

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.

Copy link
Member

@maxrjones maxrjones left a 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.

@PaulWessel PaulWessel merged commit 13d526c into master Aug 26, 2021
@PaulWessel PaulWessel deleted the grdcyz-vector-output branch August 26, 2021 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add-changelog Add PR to the changelog new core module feature PR that implements a new core module feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants