Closed seisman closed 3 years ago
Just noting that this has a bit of overlap with #633 [which is about passing in string types (e.g. DMS coordinates) to the x
and y
parameter of some functions].
Ping @PaulWessel. How does GMT convert DMS strings to float? Is it possible to allow external programs to pass DMS strings via GMT_Put_Vector
? Or is it easier or better to convert DMS strings to float numbers first?
This is done during proccessing of ASCII data records. I am sure we could implement something similar to what we did with DATETIME. Maybe need some other flags like GMT_TEXT_LONGITUDE etc.
I see two separate ways of how to do this, with some different benefits:
In either case we should also allow GMT_TEXT to pass Cartesian coordinates via text, e.g. "3.1415", "1.2e-05". Unless you can see some perceived benefit of option 2, I think option 1 is straightforward, does not have any side-effects (like redefining the value of GMT_IS_LON) and simply adds two now vector "types" to the mix. Any comment?
One thing this proposal does not address is if you want the converted data to be a double, float, int, etc. [double]. For that we would need to do something slight more complicated like GMT_FLOAT|GMT_TEXTLAT. I think that would be better, and wee should implement that for GMT_DATETIME as well.
Description of the desired feature
In GMT, geographical coordinates can be given in floating points or many different geographical formats (e.g.,
23:30:30E
), but PyGMT doesn't support these common geographical formats yet.Here is a script to show what it looks like:
Expected output:
Actual output
Possible solutions
Here are two possible solutions in my mind:
GMT_Put_Vector
doesn't support string-like geographical coordinates. It could be a missing feature of the GMT API. With the new data type added, PyGMT still needs to determine if a string is a valid geographical coordinate before passing to GMT.3:30W
is still a little different from floating points-3.5
. For3:30W
, GMT knows the input is geographical coordinates and may have more automatic settings for geographical coordinates.Are you willing to help implement and maintain this feature? Yes, but contributions are welcome.