So, you suggest to use GeographicLib to calculate the geoid?

Is it possible to do it from the spherical harmonic coefficients? (In gmtsar we found that there two egm96 grid that are slightly different and I want to calculate from them).

These are distant recalls but I remember that I wrote a OMP MEX (one of the my very few successes with OMP) for Mirone that used Geographclib to compute EGM86 (and maybe 2008). The code is for sure in the Mirone repo, just need for a digging drill. Also remember to have tried sph2grd and found lots of troubles in it. Somewhere in some tracking system there must be an issue of mine referring it.

To update this thread, Xiaohua, Esteban & I compared grids from geographicLib and from ICGEM ( but found they differ significantly, by up to a meter or more. There seems to be more to the geoid calculation than just knowing the coefficients; as far as I understand it, tide model definition and to what order the the topographic correction is made are also important. The ICGEM grid is a close match to NGA’s geoid grid, so GMTSAR now includes ICGEM’s grid at 1/8 degree sampling, with a script to convert GMT’s SRTM dataset to ellipsoid-relative heights here: Hope this is useful!