Skip to content

Set column order for GMT_IS_REFERENCE|GMT_VIA_VECTOR #5989

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 2 commits into from
Nov 12, 2021
Merged
Changes from all commits
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
14 changes: 9 additions & 5 deletions src/gmt_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3941,14 +3941,18 @@ GMT_LOCAL struct GMT_DATASET * gmtapi_import_dataset (struct GMTAPI_CTRL *API, i
S = D_obj->table[D_obj->n_tables]->segment[0] = GMT_Alloc_Segment (API, smode, 0, n_columns, NULL, NULL);
SH = gmt_get_DS_hidden (S);
for (col = 0; col < V_obj->n_columns; col++) {
if (GMT->common.i.select) /* -i has selected some columns */
if (GMT->common.i.select) { /* -i has selected some columns */
col_pos = GMT->current.io.col[GMT_IN][col].col; /* Which data column to pick */
else if (GMT->current.setting.io_lonlat_toggle[GMT_IN] && col < GMT_Z) /* Worry about -: for lon,lat */
col_pos_out = GMT->current.io.col[GMT_IN][col].order; /* Which data column to place it on output */
}
else if (GMT->current.setting.io_lonlat_toggle[GMT_IN] && col < GMT_Z) { /* Worry about -: for lon,lat */
col_pos = 1 - col; /* Read lat/lon instead of lon/lat */
col_pos_out = col;
}
else
col_pos = col; /* Just goto that column */
S->data[col] = V_obj->data[col_pos].f8;
SH->alloc_mode[col] = VH->alloc_mode[col]; /* Inherit from what we got */
col_pos = col_pos_out = col; /* Just goto that column */
S->data[col_pos_out] = V_obj->data[col_pos].f8;
SH->alloc_mode[col_pos_out] = VH->alloc_mode[col]; /* Inherit from what we got */
}
DH = gmt_get_DD_hidden (D_obj);
if (smode) S->text = V_obj->text;
Expand Down