1#!/usr/bin/env bash
2# Testing gmt grdsample
3
4ps=sample.ps
5
6Rg=-20/20/-20/20
7# Create  grid by evaluating a Kelvin-Bessel * sqrt(r) function
8gmt grdmath -R$Rg -I1 0 0 CDIST 0.1 MUL KEI 0 0 CDIST 0.1 MUL SQRT ADD DUP UPPER DIV 10 MUL = tmp.nc
9gmt makecpt -Crainbow -T-6/10/1 > t.cpt
10# Draw all nodes as open circles
11gmt grdimage tmp.nc -JX4.5i -Ct.cpt -P -K -B10f5 -BWSne -Xc -Y0.75i > $ps
12gmt psscale -Dx5i/4.75i+w6i/0.15i+jML+e+n -O -K -Ct.cpt >> $ps
13# Resample to 0.2 spacing
14gmt grdsample tmp.nc -I0.2 -Gout.nc
15gmt grdimage out.nc -JX4.5i -Ct.cpt -O -B10f5 -BWSne -Xc -Y5i >> $ps
16