GenericMappingTools / gmt

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

Can't plot data points out of the [-180, 180, -90, 90] range on geographic maps for external wrappers #8606

Open seisman opened 3 weeks ago

seisman commented 3 weeks ago

See https://forum.generic-mapping-tools.org/t/plotting-points-out-of-90-degree-range/5479 for the initial issue report.

To reproduce the issue:

import pygmt
fig = pygmt.Figure()
fig.basemap(region="d", projection="Q10i", frame="afg")
fig.coast(land="#666666", water="skyblue")
fig.plot(x=60, y=110, style="c0.3c", fill="red", pen="black", no_clip=True)
fig.show()

The error plot [WARNING]: Latitude (110) at line # 1 exceeds -|+ 90! - set to NaN comes from the gmtlib_process_binary_input function. https://github.com/GenericMappingTools/gmt/blob/65e0917c21ca5b159f32a87358468d3fe987cb26/src/gmt_io.c#L4839

The equivalent CLI version works as expected. The reason is that, for GMT CLI, gmtio_ascii_input is called to read the data points, but for external wrappers, data are passed in binary buffers, so the gmtio_bin_input is called instead.

I guess the same issue exists for GMT.jl, so it should be declared as a GMT bug.

joa-quim commented 3 weeks ago

Yep. This works

C:\v>echo 60 110 | gmt plot -Rd -JQ10i -Baf -BWSen -N -Gred -Sc7p -png lixo

but this, not

Julia> plot([60 110], region="d", projection="Q10i", marker="c0.3c", fill="red", no_clip=true, Vd=1)
        psxy  -Rd -JQ10i -Baf -BWSen -N -Gred -Sc7p -P -K > c:\TMP/GMTjl_j.ps
psxy [WARNING]: Latitude (110) at line # 1 exceeds -|+ 90! - set to NaN