GenericMappingTools / gmt

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

Clipping fails for grdview #8036

Open PaulWessel opened 11 months ago

PaulWessel commented 11 months ago

Reduced the case reported on the forum reduced to this simple example:

gmt begin 3dbug png
    gmt grdview  @earth_relief_10m -JB-90/21/19/23/10c -R-92/-87/19/23 -p-30/90 -Cglobe -B -BWSen -Qi50
    gmt grdimage @earth_relief_10m -p -Cglobe -B -BWSen -X12c
gmt end show

Same plot but with two different modules. The left plot uses grdview which has a bug while grdimage does not.

3dbug

Both -Qi and -Qc give the same problem, but doing tiles (-Qs) is unaffected. Suspicion is that the computed mask polygon in grdview is not properly 3-D projected, while grdimage does not have such a thing.

joa-quim commented 11 months ago

I think this was fixed, right?

PaulWessel commented 11 months ago

No, and on the road.

PaulWessel commented 11 months ago

Strange things going on. I ran the grdview twice: One with -Qc (image on left) and another with -Qs (surface polygons on right). This yields correct for -Qs and a bad clip(?) for -Qc:

3dbug

However, if I edit the two PostScript files and remove all the stuff that plots the color surface or color image, we are left with basic setup, clip paths, and basemap. The diff of those edited files show no differences. So same clip path, which works fine for surfaces but not for tiling or images. Conclusion must be that the images and the tiling are not doing the right thing, even though they happen in separate branches in grdview code. Using polygon tiles (-T) shows the same bad clipping in grdview (but not in grdimage as the top plot shows).

Clearly, the pixels that do show (on the left image) are in the right place (comparing to surface on right) so it would seem the loop over pixels or tiles is skipping those locations since the clip is the same? Adding a vertical scale (-JZ3c) correctly strengths this in the z-dimensions but the clipping is the same. Any thoughts on how to figure this out is appreciated.

PaulWessel commented 11 months ago

Oops, grdview tiling (-T) also places this in the wrong place:

t

Looks rotated and shifted.