Gmt example 15, incomplete clipping using gmt mask

GMT example 15

gmt mask does incomplete clipping - unless -Fl or -Fr has been specified.

I tried dumping clipping paths to a file and clipping using gmt clip - the same incomplete clipping unless -Fl or -Fr has been specified while dumping the paths with gmt mask

demo code:

gmt begin ex15-mk-forum png
	gmt convert @ship_15.txt -bo > ship.b
	region=$(gmt info ship.b -I1 -bi3d)
	gmt subplot begin 2x2 -M0.3c/0.1c -Fs7.5c/0 $region -JM7.5c -BWSne -T"Gridding with missing data" -Scb -Srl
		#   Grid via surface but mask out area with no data
		gmt blockmedian -I10m ship.b -b3d > ship_10m.b
		gmt surface ship_10m.b -Gship.nc -bi
		gmt mask -I10m ship_10m.b -bi3d -c0,0
        gmt grdimage ship.nc
		gmt mask -C
        gmt mask -I10m ship_10m.b -bi3d -Dcontour.txt
		gmt plot contour.txt -Wfaint,black
        echo "Incomplete masking using 'gmt mask', -c0,0" | gmt text -F+cTR -Dj3p
		#   Grid via surface but mask out area with no data
		gmt mask -I10m ship_10m.b -bi3d -c0,1 -Fl
		gmt grdimage ship.nc
		gmt mask -C
        echo "Masking using 'gmt mask -Fl', -c0,1" | gmt text -F+cTR -Dj3p
        gmt plot contour.txt -Wfaint,black
        #
        gmt mask -I10m ship_10m.b -bi3d -c1,1 -T -Gorange
        gmt plot ship.b -bi3d -Sc0.005c
        echo "mask -T -Gorange and ship track, -c1,1" | gmt text -F+cTR -Dj3p
	gmt subplot end
gmt end show
rm -f ship.b ship_10m.b ship.nc ship_clipped.nc

plot:

I’m confused. clip does not have a -F option. How come you didn’t get an error running?

gmt mask -I10m ship_10m.b -bi3d -c0,1 -Fl

Hoops, forget. It’s psmask not psclip.

If either -Fl or -Fr makes it work, that seems to indicate that the algorithm expects all polygons to have the same handedness and it misses those that are different from the first polygon it checked.