Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/rst/source/grdtrack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Required Arguments
|-G| as many times as you have grids you wish to sample.
Alternatively, use **-G+l**\ *list* to pass a file whose first word
in the trailing text record will be extracted as the file names.
Note, this means that file must have at least one numeric column before the text holding the grid names.
The grids are sampled and results are output in the order given.
(See :ref:`Grid File Formats <grd_inout_full>`). **Note**: If *gridfile*
is a remote global grid and no registration is specified then **grdtrack**
Expand Down
13 changes: 9 additions & 4 deletions src/grdtrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,18 +389,23 @@ static int parse (struct GMT_CTRL *GMT, struct GRDTRACK_CTRL *Ctrl, struct GMT_O
n_errors++;
break;
}
if ((c = strstr (opt->arg, "+l"))) { /* Gave +l<listofgrids> */
if ((c = strstr(opt->arg, "+l"))) { /* Gave +l<listofgrids> */
char file[PATH_MAX] = {""};
struct GMT_DATASET *L = NULL;
struct GMT_DATASEGMENT *S = NULL;
uint64_t row;
if (c[2] == '\0') { /* No list file given */
GMT_Report (API, GMT_MSG_ERROR, "Option -G: No listfile appended after modifier +l\n");
GMT_Report(API, GMT_MSG_ERROR, "Option -G: No listfile appended after modifier +l\n");
n_errors++;
break;
}
if ((L = GMT_Read_Data (API, GMT_IS_DATASET, GMT_IS_FILE, GMT_IS_NONE, GMT_READ_NORMAL, NULL, &c[2], NULL)) == NULL) {
GMT_Report (API, GMT_MSG_WARNING, "Error reading list file %s\n", &c[2]);
if ((L = GMT_Read_Data(API, GMT_IS_DATASET, GMT_IS_FILE, GMT_IS_NONE, GMT_READ_NORMAL, NULL, &c[2], NULL)) == NULL) {
GMT_Report(API, GMT_MSG_WARNING, "Error reading list file %s\n", &c[2]);
n_errors++;
break;
}
if (L->table[0]->n_segments == 0) {
GMT_Report(API, GMT_MSG_WARNING, "The list file, %s, must have at least one numeric column before the grid names.\n", &c[2]);
n_errors++;
break;
}
Expand Down
Loading