I'm trying to generate a simple profile for some gridded topography data in GMT. However, even though the end of the segment produced by project is clearly in the NaN region of the data set (I usually mask it but included NaN as grey here). When I extract values with grdtrack it exports values for the entire length of the segment. The beginning of the segment also starts in NaN region successfully exports NaN until valid values are reached (second picture). I've double checked that my projections and regions are consistent throughout. Anyone know what might be causing this behaviour
gmt begin lake png
gmt grdimage $DEM $region -JM6i -Qc
gmt project -C-66.225/18.330 -A105 -L0/0.9 -G0.001 -Q | gmt grdtrack -G$DEM > $depth
cut -f3,4 $depth > $depth1
gmt plot $depth -W0.1c,red
gmt end