diff --git a/doc/rst/source/grdtrack.rst b/doc/rst/source/grdtrack.rst index ec866692579..3e8e8fc710d 100644 --- a/doc/rst/source/grdtrack.rst +++ b/doc/rst/source/grdtrack.rst @@ -139,6 +139,9 @@ Optional Arguments counter-clockwise. Finally, you can use **+f** to set a fixed azimuth for all profiles. **Note**: If |-C| is set and *spacing* is given then that sampling scheme overrules any modifier set in |-E|. + Currently, there is a bug when |-C| and |-E| use different units + (see PR `#8728 `_ ). + If you use both, please manually specify the same unit for each. .. _-D: diff --git a/src/grdtrack.c b/src/grdtrack.c index 1a9fb7e2816..acb82767691 100644 --- a/src/grdtrack.c +++ b/src/grdtrack.c @@ -815,6 +815,16 @@ 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); + + /* !!! TEMPORARY METHOD !!! */ + /* Currently we cannot use different units in -C and -E, we have to prevent this bug first. See PR #8728 */ + /* 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). " + "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]);