Description of the problem
Both Python numpy and Matlab can have a datetime called NaT, i.e., not-a-time. It's similar to NaN but for time. Not sure if Julia also has something similar.
GMT can't handle NaT. It's OK for command line, but not for external interfaces like PyGMT.
Currently, when a NaT string is passed to GMT, it reports an error and keeps running.
Unable to parse 1 datetime strings (ISO datetime format required)
We should at least change the error to warning.
What's worse is:
|
for (row = 0; row < V->n_rows; row++) { |
|
if (gmt_scanf (API->GMT, dt[row], GMT_IS_ABSTIME, &(t_vector[row])) == GMT_IS_NAN) n_bad++; |
|
} |
GMT converts the datetime strings as double values relative to the epoch time internally. In the codes above, if
dt[row]="NaT", the function
gmt_scanf() returns
GMT_IS_NAN and the variable
t_vector[row] is untouched. The value of
t_vector[row] is 0, which means 1970-01-01T12:00:00. The plot is incorrect if we're plotting a calendar plot around 1970-01-01.
Ping @PaulWessel, @joa-quim and @weiji14.