-
Notifications
You must be signed in to change notification settings - Fork 361
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
Let GMT_Put_Vector accept GMT_DATETIME as type #3396
Conversation
This means we expect an array of text strings (char **) and we convert ISO time-stamps to internal doubles.
A working script works with the master branch but crashes using this branch. The error message is:
|
Sorry about that, try now. |
Merged the master in so now no more memory leak for your case. |
In Julia
|
GMT command line also supports input data like |
As you (may) know, GMT has several methods for reading its input. Command line is focused on files, but other modes are reading datasets from input matrices, sets of vectors, another dataset, etc. I seems you may be asking about a general method that expects an array of text records. You would then open a VirtualFile with a new modifier, e.g..,
and then pass input as the virtual file to the module. Is that what is needed? As for the original question about Put_Vector I think having the ability to pass datetime strings is reasonable since that is a common time representation, but to extend this to give text representations for longitude etc seems too much. Yet I am not using the API as you are so you tell me if the VirtualFile solution above would solve what you are trying to do. If we had to solve this via GMT_Put_Vector then I can imagine inventing a GMT_GEO_STRING type that is passed just like the GMT_DATETIME is now passed and we could do the conversion the same way. |
It seems a good solution for complicated input types. |
Yes of course, sorry. Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR now works well for PyGMT.
@joa-quim's test is using another API function?
Yes, I think he wants to feed an array of strings (i.e., a virtual text file) into GMT, but that is not implemented (yet). We will let @joa have the last word on that tomorrow, but unless he is useing GMT_Put_Vector I think this one will then be closed and merged. |
I assume this was ment for @joa-quim ,) |
Yes, @joa-quim sorry. |
Yes, what I want is to pass a dataset with text and that being recognized. |
Perhaps those who are most motivated to see this done should take the lead? I truly have my hands full these days. Because our modules either read via GMT_Read_Data or via GMT_Get_Record there needs to be two slightly different implementations added. Our gmt_ascii_input does all the work of parsing except that it reads the next record from a file pointer, whereas you will want to give it that record from a text array.. We probably need to rearrange gmt_ascii_input so that we dont duplicate all that code just to access an array. |
I think it's a very low priority for PyGMT. It's OK for me to merge it as it is. |
Yes, it would not go into this branch anyway. @joa OK for you to make a clear feature request for this. |
See this issue for context. This PR allows for calling GMT_Put_Vector with type = GMT_DATETIME and the array as an array of strings (char **) and we convert ISO time-stamps to internal doubles for internal column representation.
I did not add the same for GMT_Get_Vector. Some issues arose:
I suggest you first try this branch to see if you can get those values in there and test this first. Meanwhile, I will go back to master and let the alloc_mode be an array with one entry per column, just like we have for data type. Then we can free those columns that were internally allocated and ignore the others. OK?