Skip to content

Commit 85694aa

Browse files
committed
FIX: check whether -C and -E use different unit
1 parent cd47fef commit 85694aa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/grdtrack.c

+8
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,14 @@ EXTERN_MSC int GMT_grdtrack (void *V_API, int mode, void *args) {
816816
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 */
817817
Return (GMT_NOT_A_VALID_TYPE);
818818

819+
/* Check whether -C and -E use different unit */
820+
if (Ctrl->C.active && Ctrl->C.unit != Ctrl->E.unit){
821+
GMT_Report (API, GMT_MSG_ERROR,
822+
"Option -C and -E shoule take the same unit, but received %c (-C) and %c (-E). "
823+
"Recommend you explicitly set the same unit for -C and -E.\n", Ctrl->C.unit, Ctrl->E.unit);
824+
Return (GMT_RUNTIME_ERROR);
825+
}
826+
819827
/* Set default spacing to half the min grid spacing: */
820828
Ctrl->E.step = 0.5 * MIN (GC[0].G->header->inc[GMT_X], GC[0].G->header->inc[GMT_Y]);
821829
if (gmt_M_is_geographic (GMT, GMT_IN)) { /* Convert to km if geographic or degrees if arc-units */

0 commit comments

Comments
 (0)