Skip to content

FIX: check whether -C and -E use different unit in grdtrack #8728

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

Merged
merged 4 commits into from
May 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/grdtrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,14 @@ EXTERN_MSC int GMT_grdtrack (void *V_API, int mode, void *args) {
if (gmt_init_distaz (GMT, Ctrl->E.unit, Ctrl->E.mode, GMT_MAP_DIST) == GMT_NOT_A_VALID_TYPE) /* Initialize the distance unit and scaling */
Return (GMT_NOT_A_VALID_TYPE);

/* Check whether -C and -E use different unit */
if (Ctrl->C.active && Ctrl->C.unit != Ctrl->E.unit){
GMT_Report (API, GMT_MSG_ERROR,
"Option -C and -E shoule take the same unit, but received %c (-C) and %c (-E). "
Copy link
Member

Choose a reason for hiding this comment

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

Can you please rephrase this to:
"Sorry but a current limitation obliges that options -C and -E must have the same unit, but received %c (-C) and %c (-E). "
"You must explicitly set the same unit for -C and -E.\n", Ctrl->C.unit, Ctrl->E.unit);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for delay response. Maybe you can edit it later ?

"Recommend you explicitly set the same unit for -C and -E.\n", Ctrl->C.unit, Ctrl->E.unit);
Return (GMT_RUNTIME_ERROR);
}

/* Set default spacing to half the min grid spacing: */
Ctrl->E.step = 0.5 * MIN (GC[0].G->header->inc[GMT_X], GC[0].G->header->inc[GMT_Y]);
if (gmt_M_is_geographic (GMT, GMT_IN)) { /* Convert to km if geographic or degrees if arc-units */
Expand Down
Loading