(29) Gridding spherical surface data using splines

Finally, we demonstrate how gridding on a spherical surface can be accomplished using Green’s functions of surface splines, with or without tension. Global gridding does not work particularly well in Cartesian coordinates hence the chosen approach. We use greenspline to produce a crude topography grid for Mars based on radii estimates from the Mariner 9 and Viking Orbiter spacecrafts. This data comes from Smith and Zuber [Science, 1996] and is used here as a small (N = 370) remote data set we can use to demonstrate spherical surface gridding. Since greenspline must solve a N by N matrix system your system memory may impose limits on how large data sets you can handle; also note that the spherical surface spline in tension is particularly slow to compute.

Our script must first estimate the ellipsoidal shape of Mars from the parameters given by Smith and Zuber so that we can remove this reference surface from the gridded radii. We run the gridding twice: First with no tension using Parker‘s [1990] method and then with tension using the Wessel and Becker [2008] method. The grids are then imaged with grdimage and grdcontour and a color bar is placed between them.

using GMT

# Make Mars PROJ_ELLIPSOID given their three best-fitting axes:
a = 3399.472; b = 3394.329; c = 3376.502;
Gproj_ellipsoid = gmt("grdmath -Rg -I4 -r X COSD " * "$a" * " DIV DUP MUL X SIND " * "$b" * 
                      " DIV DUP MUL ADD Y COSD DUP MUL MUL Y SIND " * "$c" * " DIV DUP MUL ADD SQRT INV =")
#  Do both Parker and Wessel/Becker solutions (tension = 0.9975)
Gmars  = greenspline("@mars370.txt", region=:global360, inc=4, reg=true,  grid=true, mode=4, splines=:p)
Gmars2 = gmt("greenspline -R? @mars370.txt -D4 -Sq0.9975 -G", Gproj_ellipsoid);
# Scale to km and remove PROJ_ELLIPSOID
Gmars  = Gmars  / 1000 - Gproj_ellipsoid
Gmars2 = Gmars2 / 1000 - Gproj_ellipsoid
mars_cpt = makecpt(cmap=:rainbow, range=(-7,15));

grdimage(Gmars2, region=:global360, shade=(azim=45, norm="e0.75"),
frame=(axes=:Wsne, annot=30, grid=30), proj=(name=:Hammer, center=0), xshift=2)
grdcontour!(Gmars2, cont=1, annot=5, labels=(line="z+/z-",))
plot!("@mars370.txt", marker=:circle, ms=0.1, fill=:black)
text!(mat2ds([0 90], "b)"), noclip=true, offset=(-9, -0.5), font=(14,"Helvetica-Bold"), justify=:LB)

grdimage!(Gmars, frame=:same, shade=(azim=45, norm="e0.75"), yshift=9, dpi=200)
grdcontour!(Gmars, cont=1, annot=5, labels=(line="z+/z-",))
plot!("@mars370.txt", marker=:circle, ms=0.1, fill=:black )
colorbar!(pos=(anchor=:BC, offset=(0,0.4), length=(12, 0.25), horizontal=true),
          shade=true, frame=(annot=2, ticks=1), ylabel=:km)
text!(text_record([0 90], "a)"), noclip=true, offset=(-9, -0.5),
      font=(14,"Helvetica-Bold"), justify=:LB, show=true)