To aid other researchers and follow the tenets of reproducible research, we have posted online the Matlab code we used to perform much of our research. The latest release version of the code is hosted on GitHub. The different model packages we manage are:

SLEPIAN_Alpha: Computation of Spherical Harmonics, Slepian functions, and Transforms
SLEPIAN_Bravo: Linear inverse problems using Spherical Harmonics and Slepian functions
SLEPIAN_Charlie: Spectral estimation problems using Spherical Harmonics and
Slepian functions
SLEPIAN_Delta: Analysis of time-variable gravity from the GRACE satellite mission using Spherical Harmonics and Slepian functions

Check out our Eos article detailing the release of these packages! Below we've listed the main elements of the code available with descriptions, and outlined a general set of instructions by which to use it. Since it depends heavily on other code Frederik has written and posted, we recommend downloading all of the related functions and packages, and adding that directory to your matlab path. Several of the functions are written to take advantage of the Matlab parallel computing if you have that capability. One or two of these functions also require the Matlab mapping toolbox.

Making the most of GRACE
Function Description
Clmlmp2Crrp Given a spectral covariance matrix, evaluates it in space
Clmlmp2Cab Given a spectral covariance matrix, turns it into a Slepian covariance matrix
cov2plm Given a spectral covariance matrix, generates spherical harmonics realizations
grace2plmt Turns monthly GRACE data files into a single matrix for time-dependent analysis. This function does corrections for C2,0 from the SLR values of Cheng and Tapley,  and degree 1 values from Swenson, .
grace2slept Transform the result of GRACE2PLMT into a Slepian basis
grs Computes parameters for a certain geodetic reference system
integratebasis Integrates Slepian eigenfunctions given as spherical harmonics expansions
kernelcp Finds the kernel whose eigenfunctions are optimally concentrated (parallel version of KERNELC)
lovenums Returns elastic Love numbers for a certain Earth model
periodfit Find and fit periodic cycles through a data set
plm2avg Integrates and averages spherical harmonic expansions
plm2avgp Integrates and averages spherical harmonic expansions (parallel version of PLM2AVG)
pmlt2diff Turns monthly GRACE data matrix into a month-to-month difference map
plmt2resid Turns monthly GRACE data matrix into residuals after fitting analysis in the spherical harmonic basis
plmresid2cov Turns GRACE residual time series into a spherical-harmonic spectral covariance matrix
slepresid2cov Turns GRACE residual time series into a Slepian covariance matrix
resid2plot Plots GRACE residual time series
rotateGp Rotates a matrix returned by GLMALPHA (parallel)
slept2resid Turns monthly GRACE data matrix into residuals after fitting in the Slepian basis
timeseriesfit Fits polynomial functions to time series with an F-test criterion

The specific results from our paper Harig and Simons , can be generalized to work on other regions or signals. Here is the general outline with which to do that.

1. Set up your data and directory structure, and then with GRACE2PLMT read in the GRACE data files into a matrix for use in Matlab. This function does corrections for C2,0 from the SLR values of Cheng and Tapley,  and degree 1 values from Swenson, .

2. Decide on your choice of basis, depending on your region of interest and the bandwidth you want. Using GRACE2SLEPT, project the results of GRACE2PLMT into your chosen basis. We recommend that your basis is chosen based on a set of synthetic experiments which estimate the leakage/recovery tradeoffs.

3. Next run SLEPT2RESID to fit a choice of functions (e.g. lines, quadratics, etc.) to the Slepian coefficients. Note: if you want to remove a model of GIA then you should do that before this step, using a function like CORRECT4PGR.

4. If you want to examine the total mass trend in a region, this information is calculated and returned as a result from SLEPT2RESID. To summarize, each Slepian coefficient up to the Shannon truncation is multiplied by the integral (found using INTEGRATEBASIS) of the corresponding function over the region. This total data is then fit with TIMESERIESFIT which allows fitting with a custom data variance.

5. If you want the total map of mass change, multiply the difference between estimated signal coefficients by the corresponding Slepian function, and add them up. Remember the appropriate units. This sum can then be expanded to space using PLM2XYZ By limiting the set of coefficients you use, you can instead make this for any date span, such as for several years or a single year.

Harig, C., Kevin W. Lewis, Alain Plattner, and F. J. Simons. A suite of software analyzes data on the sphere. Eos, 96, 2015. http://dx.doi.org/10.1029/2015EO025851

Harig, C. and F. J. Simons. Mapping Greeenland's mass loss in space and time. Proc. Natl. Acad. Sc., 109(49), 19934-19937, 2012.

Dahlen, F. A & Simons, F. J. (2008) Spectral estimation on a sphere in geophysics and cosmology. Geophys. J. Int. 174, 774-807.

Slepian, D. (1983) Some comments on Fourier analysis, uncertainty, and modeling. SIAM Review 25, 379-393.

Simons, F. J, Dahlen, F. A, & Wieczorek, M. A. (2006) Spatiospectral concentration on a sphere. SIAM Review 48, 504-536.

Simons, F. J & Dahlen, F. A. (2006) Spherical Slepian functions and the polar gap in geodesy. Geophys. J. Int. 166, 1039-1061.

Simons, F. J. (2010) in Handbook of Geomathematics, eds. Freeden, W, Nashed, M. Z, & Sonar, T. (Springer-Verlag), pp. 891-923.

Wieczorek, M. A & Simons, F. J. (2005) Localized spectral analysis on the sphere. Geo136 phys. J. Int. 162, 655-675.