GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
859 stars 359 forks source link

gmtread errors when run from within subplot #4334

Closed joa-quim closed 4 years ago

joa-quim commented 4 years ago
julia> gmt("begin ")

julia> gmt("subplot begin 2x2 -Fs8c")

julia> gmt("read -Td  @Table_5_11.txt")
gmtread [ERROR]: Unrecognized option -B
gmtread [ERROR]: Unrecognized option -B
gmtread [ERROR]: Unrecognized option -B
gmtread [ERROR]: Unrecognized option -X
gmtread [ERROR]: Unrecognized option -Y
ERROR: Something went wrong when calling the module. GMT error number = 71

but works fine on classic

resetGMT()
gmt("read -Td  @Table_5_11.txt")
julia> gmt("read -Td  @Table_5_11.txt")
Vector{GMT.GMTdataset} with 1 segments
First segment DATA
52×3 Matrix{Float64}:
 0.3  6.1  870.0
 1.4  6.2  793.0
 2.4  6.1  755.0
...
PaulWessel commented 4 years ago

So when gmt read is called it is still the same session and the options are simply retained? The _B -X etc are options created by subplot and used in the psxy/basemap call at the start of a panel. So they live to be reused in the gmt read call?

PaulWessel commented 4 years ago

Perhaps a similar problem in mex if it is a persistent session.

joa-quim commented 4 years ago

So it looks the best medicine is let read (and write) be tolerant to those 2 (more?) options.

PaulWessel commented 4 years ago

Yes, I suppose that is pretty easy to do. Chemo today am so maybe this pm.

PaulWessel commented 4 years ago

Maybe better if the module that adds non-user-specified options (subplot, maybe in gmt_init.c as well) should remove them once they have served their purpose. Alternatively, those places should duplicate the options link, make changes to the duplicate link, use it, then dispose. I think the implementation simply assumed single process like CLI (or even pyGMT) but both mex and Julia will remember.