It appears that github GMT grdtrack has the -Z (only value output) override the -s option (suppress NaN). I would expect this
#!/bin/bash
grdmath -R0/1/0/1 -I0.1 Y 0.5 GE 1 NAN = tmp.grd
for opt in "-s" "-s -Z";do
echo $0: option $opt
echo 0.5 0.75 | grdtrack -Gtmp.grd $opt
echo 0.5 0.25 | grdtrack -Gtmp.grd $opt
done
to out only the y = 0.25 entry (grid is meant to be NaN for y > 0.5, zero else), but I get
> ./test_grdtrack
./test_grdtrack: option -s
0.5 0.25 0
./test_grdtrack: option -s -Z
NaN
0