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

Let psxy -N be usable with binary input. #8663

Merged
merged 2 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
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
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| */
Copy link
Member

Choose a reason for hiding this comment

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

Do we make the same change to plot3d?


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
Loading