Greenspline to smooth a surface

Hello,

I have a 2-D netcdf grid file with three columns: lat, lon and elevation (i.e., a 3-D topographic surface), which can be visualized by GMT module grdview. Now I am trying to generate a new surface at new positions which are nodes of an unstructured triangular mesh. I wonder how I can use greenspline to “interpolate” the elevations at the new positions ? A related question is, can we use greenspline to smooth the original surface ? If not, are there other options ?

Not exactly. A regular grid has only the third variable (plus a mechanism to compute the horizontal coordinates.)

Extract the x,y values of those nodes and feed than to grdtrack

greenspline is a slow program (but I have little experience with it). Better use grdfilter.

Hi Joaquim,

Thanks for the suggestions ! I’ve tried grdfilter and indeed, it’s much faster than greenspline. Now another issue is grid conversion: (lon, lat, elv) to (x,y, elv). It appears mapproject is the right program to do this, but I haven’t got it working.

I wonder how I can convert my grid file (xxx.nc with netCDF format) with geographic coordinates into another grid with x & y in a simple Mercator projection, for example, -JM. Because eventually, I need this new grid to build a regional geological model.

Many thanks !

If it’s a grid, grdproject does the work I think

Thanks, looks like the grdproject did the job !