| 17982 | } |
| 17983 | |
| 17984 | unsigned int gmt_parse_array (struct GMT_CTRL *GMT, char option, char *argument, struct GMT_ARRAY *T, unsigned int flags, unsigned int tcol) { |
| 17985 | /* Many GMT modules need to set up an equidistant set of values to |
| 17986 | * serve as output times (or distances), binning boundaries, or similar. |
| 17987 | * We expect such 1-D arrays to be specified on the command line |
| 17988 | * via a syntax such as:] |
| 17989 | * |
| 17990 | * -T<argument> |
| 17991 | * |
| 17992 | * where <argument> is one of these: |
| 17993 | * [<min/max/]<inc>[<unit>|+a|e|i|n|b|l|t|u] |
| 17994 | * <file> |
| 17995 | * |
| 17996 | * Parsing: |
| 17997 | * 0) If <argument> is a single value and flags & GMT_ARRAY_SCALAR is set |
| 17998 | * then we create an array of one item. Otherwise <argument> may be |
| 17999 | * interpreted as <inc>. |
| 18000 | * 1) If <argument> is a file found in our search path then |
| 18001 | * we assume it contains one column with the final values. |
| 18002 | * These are then read in via GMT_Read_Data, which means |
| 18003 | * these values could be passed via VirtualFiles. |
| 18004 | * 2) If +n is given it means that <inc> is an integer that |
| 18005 | * says how many points we want equidistantly distributed |
| 18006 | * between <min> and <max>. |
| 18007 | * 3) If +i is given it means that <inc> is the reciprocal of |
| 18008 | * what is needed, e.g. use 24i instead of 0.041666... |
| 18009 | * 4) If <min>/<max> are missing then it means these will |
| 18010 | * be derived from the data extent. Unless +n is also |
| 18011 | * given then the data extremes will be rounded to the |
| 18012 | * first and last multiple of <inc> that is inside the |
| 18013 | * moin-max data range. |
| 18014 | * 5) If <unit> is given and is any of the temporal units |
| 18015 | * o|y then we will compute a non-equidistant set of calendar |
| 18016 | * time values. |
| 18017 | * 6) If <unit> is given and it is any of the spatial length units |
| 18018 | * d|m|s|e|f|k|M|n|u or c (Cartesian), then we will compute |
| 18019 | * distances along a track given by the first two columns and the |
| 18020 | * resulting distances are our time-series values. |
| 18021 | * 7) If +l is given then we are setting up a log10 array which is |
| 18022 | * equidistant in log10(t). Here, inc must be 1, 2, or 3 exclusively |
| 18023 | * which translates into |
| 18024 | * 8) If +b is given then we are setting up a log2 array which is |
| 18025 | * equidistant in log2(t). Here, inc must be an integer and indicates |
| 18026 | * the log2 increment. |
| 18027 | * 9) If +a is given then we will add the output array as a new output column. |
| 18028 | * 10) If +e is given when only an increment is given then we must keep the |
| 18029 | * increment exact and adjust max to ensure (max-min)/inc is an integer. |
| 18030 | * The default adjusts inc instead, if flag GMT_ARRAY_ROUND is passed. |
| 18031 | * 10) Since -T is a command-line option we enforce ISO calendar string format |
| 18032 | * only (yyyy-mm-ddT, yyyy-jjjT, yyyy-WwwT). |
| 18033 | * |
| 18034 | * 11) If +u is given then we ensure the input array has unique and sorted entries |
| 18035 | * and that duplicated are eliminated. |
| 18036 | * Note: The effects in 4) and 5) are only allowed if the corresponding |
| 18037 | * flags are passed to the parser. |
| 18038 | */ |
| 18039 | |
| 18040 | char txt[3][GMT_LEN32] = {{""}, {""}, {""}}, *m = NULL; |
| 18041 | int ns = 0; |
no test coverage detected