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

Handle single array item #34

Merged
merged 2 commits into from
Aug 25, 2018
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
3 changes: 2 additions & 1 deletion doc_classic/rst/source/explain_array.rst_
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ array where *inc* can be 1 (every magnitude), 2, (1, 2, 5 times magnitude) or 3
(1-9 times magnitude). For less than every magnitude, use a negative integer *inc*.
Append **+n** if *inc* is meant to indicate the number of equidistant coordinates
instead. Alternatively, give a *file* with output coordinates in the first column,
or provide a comma-separated *list* of coordinates.
or provide a comma-separated *list* of coordinates. If you only want a *single* value
then you must append a comma to distinguish the list from the setting of *inc*.

If the module allows you to set up an absolute time series, append a valid time unit from the list
**y**\ ear, m\ **o**\ nth, **w**\ eek, **d**\ ay, **h**\ our, **m**\ inute, and **s**\ econd
Expand Down
3 changes: 2 additions & 1 deletion doc_modern/rst/source/explain_array.rst_
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ array where *inc* can be 1 (every magnitude), 2, (1, 2, 5 times magnitude) or 3
(1-9 times magnitude). For less than every magnitude, use a negative integer *inc*.
Append **+n** if *inc* is meant to indicate the number of equidistant coordinates
instead. Alternatively, give a *file* with output coordinates in the first column,
or provide a comma-separated *list* of coordinates.
or provide a comma-separated *list* of coordinates. If you only want a *single* value
then you must append a comma to distinguish the list from the setting of *inc*.

If the module allows you to set up an absolute time series, append a valid time unit from the list
**y**\ ear, m\ **o**\ nth, **w**\ eek, **d**\ ay, **h**\ our, **m**\ inute, and **s**\ econd
Expand Down
5 changes: 4 additions & 1 deletion src/gmt_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -15615,7 +15615,10 @@ unsigned int gmt_create_array (struct GMT_CTRL *GMT, char option, struct GMT_ARR
uint64_t k;
unsigned int pos = 0;
char p[GMT_LEN64] = {""};
for (k = 0, T->n = 1; k < strlen (T->list); k++) if (T->list[k] == ',') T->n++; /* Count the commas */
for (k = 0, T->n = 1; k < strlen (T->list); k++) {
if (T->list[k] == ',' && T->list[k+1])
T->n++; /* Count the commas */
}
T->array = gmt_M_memory (GMT, NULL, T->n, double);
k = 0;
while ((gmt_strtok (T->list, ",", &pos, p))) {
Expand Down