Skip to content

Commit

Permalink
Merge branch 'master' into psconvert-no-file-dup
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim committed Jan 5, 2025
2 parents 4e5a2c4 + 2015787 commit ae5b221
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/gmt_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ struct GMT_COMMON {
char string[GMT_LEN256];
} a;
struct b { /* -b[i][o][s|S][d|D][#cols][cvar1/var2/...] */
bool active[2]; /* true if current input/output is in native binary format */
bool active[3]; /* true if current input/output is in native binary format */
bool nc[2]; /* True if netcdf i/o */
bool o_delay; /* true if we don't know number of output columns until we have read at least one input record */
bool bin_primary; /* true if we need to switch back to binary after reading a secondary file in ascii */
Expand Down
2 changes: 1 addition & 1 deletion src/gmt_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -4835,7 +4835,7 @@ int gmtlib_process_binary_input (struct GMT_CTRL *GMT, uint64_t n_read) {
gmtio_adjust_periodic_lon (GMT, &GMT->current.io.curr_rec[col_no]);
break;
case GMT_IS_LAT:
if (GMT->current.io.curr_rec[col_no] < -90.0 || GMT->current.io.curr_rec[col_no] > +90.0) {
if (!GMT->common.b.active[2] && (GMT->current.io.curr_rec[col_no] < -90.0 || GMT->current.io.curr_rec[col_no] > +90.0)) {
GMT_Report (GMT->parent, GMT_MSG_WARNING, "Latitude (%g) at line # %" PRIu64 " exceeds -|+ 90! - set to NaN\n", GMT->current.io.curr_rec[col_no], GMT->current.io.rec_no);
GMT->current.io.curr_rec[col_no] = GMT->session.d_NaN;
}
Expand Down
7 changes: 6 additions & 1 deletion src/psxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,8 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
Return (GMT_RUNTIME_ERROR);
GMT_Report (API, GMT_MSG_DEBUG, "Operation will require %d input columns [n_cols_start = %d]\n", n_needed, n_cols_start);

if (Ctrl->N.active && GMT->common.b.active[GMT_IN]) GMT->common.b.active[2] = true; /* To signal gmtlib_process_binary_input that lats may be of |90| */

if (GMT->common.R.active[RSET] && GMT->common.J.active && gmt_map_setup (GMT, GMT->common.R.wesn))
Return (GMT_PROJECTION_ERROR);
if (S.u_set) { /* When -Sc<unit> is given we temporarily reset the system unit to these units so conversions will work */
Expand Down Expand Up @@ -2430,7 +2432,10 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
gmt_M_rgb_copy (current_pen.rgb, save_pen.rgb);
if (Ctrl->H.active) current_pen = nominal_pen;
} while (true);
if (GMT->common.t.variable) { /* Reset the transparencies */

GMT->common.b.active[2] = false; /* Reset this because externals have long memory and -N may not be used in a future call */

if (GMT->common.t.variable) { /* Reset the transparencies */
double transp[2] = {0.0, 0.0}; /* None selected */
PSL_settransparencies (PSL, transp);
}
Expand Down
6 changes: 5 additions & 1 deletion src/psxyz.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,9 +929,11 @@ EXTERN_MSC int GMT_psxyz (void *V_API, int mode, void *args) {
}
}

if (gmt_check_binary_io (GMT, n_needed))
if (gmt_check_binary_io(GMT, n_needed))
Return (GMT_RUNTIME_ERROR);

if (Ctrl->N.active && GMT->common.b.active[GMT_IN]) GMT->common.b.active[2] = true; /* Signal gmtlib_process_binary_input that lats may be of |90| */

if (S.symbol == GMT_SYMBOL_QUOTED_LINE) {
if (gmt_contlabel_prep (GMT, &S.G, NULL))
Return (GMT_RUNTIME_ERROR);
Expand Down Expand Up @@ -1706,6 +1708,8 @@ EXTERN_MSC int GMT_psxyz (void *V_API, int mode, void *args) {
}
} while (true);

GMT->common.b.active[2] = false; /* Reset this because externals have long memory and -N may not be used in a future call */

if (GMT_End_IO (API, GMT_IN, 0) != GMT_NOERROR) { /* Disables further data input */
Return (API->error);
}
Expand Down

0 comments on commit ae5b221

Please sign in to comment.