1 Introduction

Global-scale geophysical signals defined on the Earth’s surface can be expanded in a series of spherical harmonic functions, assuming a spherical approximation for the Earth’s figure. This type of representation is typical for the Earth’s disturbing gravitational potential (and its related functionals) and magnetic field (Hofmann-Wellenhof and Moritz 2006; Blakely 1995). A series of spherical harmonics on the two-dimensional sphere is analogous to a Fourier series on the real line, or to a two-dimensional Fourier series on the plane. Following the same analogy, the coefficients of a spherical harmonic expansion correspond to the signal spectrum and provide similar insights as the Fourier spectrum regarding the frequency decomposition of a signal. In the context of spherical harmonic representation, frequency implies spatial frequency, i.e., periodicity with respect to positions in space.

Apart from examining the frequency content of a signal, the calculation of spherical harmonic coefficients, a procedure commonly referred to as spherical harmonic analysis, offers several computational benefits. For instance, the spherical convolution of two fields in the spatial domain is reduced to multiplication of their spectra in the spherical harmonic domain. This property is especially important in gravity field modeling, where convolution integrals are common. Such integrals describe the convolution between a spatial signal, which constitutes an observed quantity derived by sampling, and an integral kernel that corresponds to an analytical function. Several methods for the spherical harmonic analysis of sampled data exist (Colombo 1981; Sneeuw 1994; Blais 2011a, b; Rexer and Hirt 2015; Plonka et al. 2018; Sun 2021). The evaluation of convolution integrals in the spherical harmonic domain usually depends on whether methods for the calculation of spherical harmonic coefficients of integral kernels are available. The development of mathematical expressions that perform this task in an accurate and efficient manner is therefore of great importance.

A representative example of an integral kernel in physical geodesy is the Stokes kernel, which is used for the gravimetric determination of geoidal undulations. In other words, geoidal undulations can be derived via the spherical convolution of gravity anomalies with the Stokes kernel. Several other Stokes-like kernels exist that form corresponding integral relations among different functionals of the Earth’s disturbing potential. An extensive list of such kernels is provided in Hirt et al. (2011). Mathematical expressions for the calculation of their spherical harmonic coefficients have already been developed, and their derivation is usually based on skillful algebraic manipulation of the generating function of Legendre polynomials (Hotine 1969).

In many practical applications, geophysical signals are observed in a limited region of the Earth’s surface. The evaluation of convolution integrals for local-scale studies is done by truncating the kernel function to a radius that encloses the area of available observations (Vanńček et al. 2003). The corresponding truncation error needs to be calculated in these cases, in order to estimate the effect of neglecting the areas outside the evaluation radius. Methods for the calculation of spherical harmonic coefficients of truncated kernels (i.e., compactly supported kernels) are therefore also needed. This issue has been extensively studied for the Stokes and Vening–Meinesz kernels (de Witte 1967; Hagiwara 1972; Paul 1973; Hagiwara 1976; Paul 1983).

Filtering of a geophysical signal defined on a spherical surface is also a process that can be described with a convolution integral, denoting the convolution of the spatial signal with the corresponding filter kernel. In this case, the filter kernel is also defined by an analytical function. Methods for the calculation of spherical harmonic coefficients of filter kernels are therefore required to perform filtering in the spherical harmonic domain. Mathematical expressions in the form of recurrence relations for the spherical harmonic coefficients of the isotropic Pellinen, Gaussian, truncated Gaussian and Hanning filter kernels were derived by Jekeli (1981).

Filtering methods in the spherical harmonic domain have gained an increased interest since the development of the first Gravity Recovery and Climate Experiment (GRACE) and GRACE Follow-On (GRACE-FO) temporal geopotential solutions. The isotropic Gaussian filter has also been used extensively in GRACE-related applications. In addition to physical geodesy, the task of calculating the spherical harmonic coefficients of analytical functions is also relevant in other branches of geosciences, such as geostatistics, to assess the validity (i.e., positive definiteness) and examine the properties of covariance functions (Huang et al. 2011; Lantuéjoul et al. 2019).

In this paper, we develop expressions for the calculation of spherical harmonic coefficients of monomial and polynomial functions. We are mostly interested in isotropic, i.e., rotationally symmetric, functions that are still used primarily in gravity field modeling. In addition to purely polynomial functions, our expressions can be practical for the calculation of spherical harmonic coefficients of the polynomial part of already existing kernels.

The use of polynomial expressions is common in geostatistics, and specifically in the design of polynomial covariance functions, to model the stochastic characteristics of a random field. Apart from their mathematical simplicity, another property of polynomial functions that makes them appealing for such applications is their infinite differentiability. To the best of our knowledge, there is a lack of supporting literature on the use of polynomial kernels in gravity field modeling, and the calculation of their spherical harmonic coefficients. The only relevant study appears to be the paper of Ma (2016), where expressions for the Gegenbauer coefficients of isotropic polynomial functions are derived. These expressions are then used to characterize covariance matrices whose entries are polynomials of order up to four. Since the Gegenbauer coefficients are a generalization of spherical harmonic coefficients for higher-dimensional spheres (i.e., spheres of dimension higher than two), the expressions of Ma (2016) are also a generalization of our expressions.

The novelty of our work lies on the fact that the expressions derived here can be used for the calculation of spherical harmonic coefficients of compactly supported and piecewise polynomials, whereas the study of Ma (2016) examines the case of polynomials defined on the entire sphere. We further discuss the relevance of our methods in gravity field modeling and provide examples and applications that are motivated from the discussion of the present section.

The paper is organized as follows. In Sect. 2 we provide a brief mathematical overview of the representation of isotropic functions in the spherical harmonic domain by means of the discrete Legendre transform. We also derive a generalization, i.e., the compactly supported discrete Legendre transform, that permits the spherical harmonic representation of piecewise functions and functions of compact support. In Sect. 3 we develop a recurrent algorithm for the calculation of spherical harmonic coefficients of isotropic monomials and extend our mathematical formulation to isotropic polynomials. In Sect. 4 we design a numerical experiment to assess the relative accuracy of our recurrent algorithm. Sections 5 and 6 discuss two potential applications of our algorithm in gravity field modeling. In Sect. 5, the concept of isotropic B-spline filtering on the sphere is introduced, where filter kernels are described by piecewise polynomial functions. Analytical expressions for the representation of B-spline filter kernels in the spatial and spherical harmonic domains are also provided. The third-order B-spline filter is examined in detail and used for the denoising of a GRACE-FO monthly gravity field solution. In Sect. 6, we review some isotropic polynomial covariance models on the sphere and provide analytical expressions for the calculation of their spherical harmonic coefficients that are based on our algorithm. Finally, Sect. 7 provides a summary of this work and highlights the main conclusions.

2 Spherical harmonic representation of isotropic functions

Two-point functions are typically used in geodesy to model the spatial covariance of a random field, and as kernel functions of integral transforms to describe the relation between the integration and calculation points (Devaraju and Sneeuw 2018). A two-point function \(f(\phi _{1},\lambda _{1},\phi _{2},\lambda _{2})\) defined on a spherical surface is isotropic, i.e., invariant under rotation of the reference system, when it only depends on the spherical distance \(\psi \in [0, \pi ]\) between two points \(A_{1}(\phi _{1},\lambda _{1})\) and \(A_{2}(\phi _{2},\lambda _{2})\):

$$\begin{aligned} f (\phi _{1},\lambda _{1},\phi _{2},\lambda _{2}) \equiv f(\psi ), \end{aligned}$$
(1)

where \(\psi \) is given by

$$\begin{aligned} \psi = \cos ^{-1} \big ( \sin \phi _{1} \sin \phi _{2} + \cos \phi _{1} \cos \phi _{2} \cos (\lambda _{1} - \lambda _{2}) \big ) \end{aligned}$$
(2)

and with \(\phi \in [-\pi /2, \pi /2]\) and \(\lambda \in [0, 2 \pi )\) being the geocentric latitude and longitude, respectively. The dimensionless spherical harmonic coefficients \(F_{n}\) of an isotropic function f are given by the discrete Legendre transform \({\mathscr {J}}\), which is defined as (Jekeli 2017, p. 54)

$$\begin{aligned} F_{n} = {\mathscr {J}} \{ f (\psi ) \} = \frac{1}{2} \int _{0}^{\pi } f (\psi ) P_{n} (\cos \psi ) \sin \psi \, \textrm{d} \psi , \end{aligned}$$
(3)

with \(P_{n}\) denoting the Legendre polynomials of degree \(n \in {{\mathbb {N}}}_{0}\). The isotropic function f can be reconstructed from the sequence of coefficients \(F_{n}\) using the inverse Legendre transform \({\mathscr {J}}^{-1}\) as follows:

$$\begin{aligned} f (\psi ) = {\mathscr {J}}^{-1} \{ F_{n} \} = \sum _{n = 0}^{\infty } (2 n + 1) F_{n} P_{n} (\cos \psi ). \end{aligned}$$
(4)

In practice, the sum of Eq. (4) is evaluated up to a maximum degree \(n_{\textrm{max}}\), for which the coefficients \(F_{n}\) are available. As in Fourier analysis, a greater \(n_{\textrm{max}}\) results in a better reconstruction of f.

The operational calculus and properties of the discrete Legendre transform have been studied by mathematicians since the early fifties (Tranter 1950; Churchill 1954), and several generalizations have been developed since then. For \(n \in {\mathbb {R}}\), the discrete Legendre transform can be generalized to the continuous Legendre transform (Butzer et al. 1980). As for the kernel function, the Gegenbauer and Jacobi transforms (Conte 1955; Scott 1953) are also considered generalizations of the discrete Legendre transform because the Gegenbauer and Jacobi polynomials are both generalizations of the Legendre polynomials.

In this section, we generalize the transform \({\mathscr {J}}\) with respect to the integration interval. We therefore define the compactly supported discrete Legendre transform \({\mathscr {J}}_{I}\), for which the signal is analyzed in the subinterval of spherical distance \(I = [\psi _{1},\psi _{2}] \subset [0,\pi ]\), i.e.,

$$\begin{aligned} F_{n}^{(I)} = {\mathscr {J}}_{I} \{ f (\psi ) \} = \frac{1}{2} \int _{I} f (\psi ) P_{n} (\cos \psi ) \sin \psi \, \textrm{d} \psi . \end{aligned}$$
(5)

Based on the definition of Eq. (5), the transition from \({\mathscr {J}}\) to \({\mathscr {J}}_{I}\) is done by constraining f to be compactly supported in I, i.e., \(f (\psi ) = 0, \ \forall \psi \notin I\). The following relation can therefore be formulated:

$$\begin{aligned} \begin{aligned} {\mathscr {J}}_{I} \{ f (\psi ) \}&= \frac{1}{2} \int _{I} f (\psi ) P_{n} (\cos \psi ) \sin \psi \, \textrm{d} \psi \\&= \frac{1}{2} \int _{0}^{\pi } \big ( f (\psi ) \, \textbf{1}_{I} (\psi ) \big ) P_{n} (\cos \psi ) \sin \psi \, \textrm{d} \psi \\&= {\mathscr {J}} \{ f (\psi ) \, \textbf{1}_{I} (\psi ) \}, \end{aligned} \end{aligned}$$
(6)

where \(\textbf{1}_{I}\) is the indicator function (i.e., a unit boxcar function), defined as

$$\begin{aligned} \textbf{1}_{I} (\psi ) = {\left\{ \begin{array}{ll} 1, &{} \psi \in I \\ 0, &{} \psi \notin I \end{array}\right. }. \end{aligned}$$
(7)

A relation between \(F_{n}\) and \(F_{n}^{(I)}\) is also provided in Appendix A. This relation is based on an alternative formulation of the indicator function and is derived using some well-known methods (e.g., Wieczorek and Simons 2005; Gupta and Narasimhan 2007; Dahlen and Simons 2008). The rationale for constraining f using the indicator function comes from the fact that, in the present study, f is assumed to be an analytical function (i.e., a polynomial function). The indicator function corresponds to an ideal window and ensures that f is perfectly suppressed outside and perfectly preserved inside interval I. The use of any other window w in Eq. (6) will introduce large distortions in both the shape and properties of f. As a consequence, the resulting spherical harmonic coefficients will correspond to the distorted analytical function \(w (\psi ) f (\psi )\), and not the original intended one. In addition, the compactly supported Legendre transform as defined in Eq. (6) appears naturally when the spectrum of a piecewise or compactly supported analytical function is required. This is demonstrated in subsequent sections.

The spatial confinement of f by a user-specified window w (e.g., a Gaussian or any other smooth window) provides a more general definition of the compactly supported discrete Legendre transform, which is also in better agreement with the definition of the short-time Fourier transform. The choice of a smooth window, instead of an ideal window, would be a more appropriate choice for localized spectral analysis of geophysical signals on the sphere. In this type of applications, the accurate estimation of periodic constituents in the frequency spectrum is ensured by the use of a smooth window that mitigates leakage effects. A relation between \(F_{n}\) and \(F_{n}^{(I)}\) using any window w can also be derived using the method presented in Appendix A, provided that the spectrum of w can be easily calculated. For simple cases where w is centered at \(\psi = 0\), and a Gaussian or a Hanning window is selected, the spectrum of w can be calculated using the recurrence relations given in Jekeli (1981).

Since this study assumes f to be an analytical function, and not a geophysical signal, we only consider the case \(w (\psi ) = \textbf{1}_{I} (\psi )\). It can be easily deduced that \({\mathscr {J}}_{I} \{ f (\psi ) \} = {\mathscr {J}} \{ f (\psi ) \}\) for \(I = [0,\pi ]\). Accounting for the properties of the indicator function, it is also evident by Eq. (6) that \({\mathscr {J}} \{ \textbf{1}_{I} (\psi ) \} = {\mathscr {J}}_{I} \{ \textbf{1}_{I} (\psi ) \} = {\mathscr {J}}_{I} \{ 1 \}\) and \({\mathscr {J}} \{ \textbf{1}_{I} (\psi ) \textbf{1}_{J} (\psi ) \} = {\mathscr {J}}_{I} \{ \textbf{1}_{J} (\psi ) \} = {\mathscr {J}}_{J} \{ \textbf{1}_{I} (\psi ) \} = {\mathscr {J}}_{I \cap J} \{ \textbf{1}_{I} (\psi ) \textbf{1}_{J} (\psi ) \} = {\mathscr {J}}_{I \cap J} \{ 1 \}\). The reconstruction of f from \(F_{n}^{(I)}\) in the interval of support I is possible by the application of \({\mathscr {J}}^{-1}\) as follows:

$$\begin{aligned} {\mathscr {J}}^{-1} \{ F_{n}^{(I)} \} = {\left\{ \begin{array}{ll} f (\psi ), &{} \psi \in I \\ 0, &{} \psi \notin I \end{array}\right. } \end{aligned}$$
(8)

The compactly supported discrete Legendre transform can be especially useful for the analysis of piecewise functions (e.g., covariance functions, window functions and filter kernels with compact support). We do not examine the mathematical properties of the compactly supported discrete Legendre transform, as it is outside the main scope of this study. We henceforth use the term “Legendre transforms” to refer to both the discrete Legendre transform and the compactly supported discrete Legendre transform.

3 Spherical harmonic coefficients of isotropic polynomials

In this section, we provide expressions for the Legendre transforms of the monomial \(\psi ^{m}\), with \(m \in {{\mathbb {N}}}_{0}\), which represents the basis function of a polynomial vector space. We first treat the general case of the compactly supported discrete Legendre transform, and then corresponding expressions are provided for the discrete Legendre transform. These results are afterward used to derive expressions for the calculation of spherical harmonic coefficients of any polynomial, including piecewise polynomials, of any order m.

3.1 The compactly supported discrete Legendre transform of monomials

The compactly supported discrete Legendre transform of the m-th-order monomial \(\psi ^{m}\), denoted as \(\Psi _{n,m}^{(I)}\), is given by

$$\begin{aligned} \Psi _{n,m}^{(I)} = \frac{1}{2} \int _{\psi _{1}}^{\psi _{2}} \psi ^{m} P_{n} (\cos \psi ) \sin \psi \, \textrm{d} \psi . \end{aligned}$$
(9)

The derivation of a closed-form expression for the integral of Eq. (9) can be a very demanding, if not an impossible, task. It is therefore customary in the geodetic practice, and also for reasons of computational efficiency, to evaluate integrals in the form of Eq. (9) using recurrence relations. These are usually derived by exploiting corresponding recurrence relations and other properties of the Legendre polynomials.

In the case of Eq. (9), we closely follow the procedure given in Jekeli (1981, Appendix B), which we also outline in Appendix B, and derive a recurrence relation for \(\Psi _{n,m}^{(I)}\) that reads

$$\begin{aligned} \begin{aligned} \Psi _{n,m}^{(I)} ={}&\frac{1}{(n + 1)^{2}} \Big [ (n - 2)^{2} \Psi _{n - 2,m}^{(I)} + (n + 1)^{2} B_{n,m} (\psi ) |^{\psi _{2}}_{\psi _{1}} \\&- (n - 2)^{2} B_{n - 2,m} (\psi ) |^{\psi _{2}}_{\psi _{1}} - D_{n - 1,m} (\psi ) |^{\psi _{2}}_{\psi _{1}} \\ {}&+ m (m - 1) (\Psi _{n - 2,m - 2}^{(I)} - \Psi _{n,m - 2}^{(I)}) \Big ], \quad n > 1 \end{aligned} \end{aligned}$$
(10)

where

$$\begin{aligned} B_{n,m} (\psi ) |^{\psi _{2}}_{\psi _{1}} = B_{n,m}(\psi _{2}) - B_{n,m}(\psi _{1}) \end{aligned}$$
(11a)
$$\begin{aligned} D_{n,m} (\psi ) |^{\psi _{2}}_{\psi _{1}} = D_{n,m}(\psi _{2}) - D_{n,m}(\psi _{1}) \end{aligned}$$
(11b)

and with the parameters \(B_{n,m}(\psi )\) and \(D_{n,m}(\psi )\) defined using the auxiliary variable \(k_{n} (t) = P_{n - 1} (t) - P_{n + 1} (t)\) as

$$\begin{aligned} B_{n,m}(\psi )&= \frac{\psi ^{m} k_{n} (\cos \psi )}{2 (2 n + 1)} \end{aligned}$$
(12a)
$$\begin{aligned} D_{n,m}(\psi )&= \frac{m \psi ^{m - 1} \sin \psi \, k_{n} (\cos \psi )}{2}. \end{aligned}$$
(12b)

Recurrence relations for the calculation of \(B_{n,m}(\psi )\) and \(D_{n,m}(\psi )\) are provided in Appendix C. For \(n = \{0,1\}\), the coefficients \(\Psi _{0,m}^{(I)}\) and \(\Psi _{1,m}^{(I)}\) are given by the definite integrals

$$\begin{aligned} \Psi _{0,m}^{(I)}&= \frac{1}{2} \int _{\psi _{1}}^{\psi _{2}} \psi ^{m} \sin \psi \, \textrm{d} \psi \end{aligned}$$
(13a)
$$\begin{aligned} \Psi _{1,m}^{(I)}&= \frac{1}{2} \int _{\psi _{1}}^{\psi _{2}} \psi ^{m} \cos \psi \sin \psi \, \textrm{d} \psi \nonumber \\&= \frac{1}{4} \int _{\psi _{1}}^{\psi _{2}} \psi ^{m} \sin 2 \psi \, \textrm{d} \psi . \end{aligned}$$
(13b)

Equations (13a) and (13b) can be evaluated by the closed-form expressions (Gradshteyn and Ryzhik 2014, §2.633, eq. 1)

$$\begin{aligned} \Psi _{0,m}^{(I)}&={}\sum _{k = 0}^{m} \frac{(m)^{\underline{m - k}}}{2} \, \Big [ \psi _{1}^{m - k} \cos \Big ( \psi _{1} + \frac{k \pi }{2} \Big ) \nonumber \\&\quad - \psi _{2}^{m - k} \cos \Big ( \psi _{2} + \frac{k \pi }{2} \Big ) \Big ] \end{aligned}$$
(14a)
$$\begin{aligned} \Psi _{1,m}^{(I)}&={}\sum _{k = 0}^{m} \frac{(m)^{\underline{m - k}}}{2^{k + 3}} \, \Big [ \psi _{1}^{m - k} \cos \Big ( 2 \psi _{1} + \frac{k \pi }{2} \Big ) \nonumber \\&\quad - \psi _{2}^{m - k} \cos \Big ( 2 \psi _{2} + \frac{k \pi }{2} \Big ) \Big ], \end{aligned}$$
(14b)

with \((\cdot )^{{\underline{s}}}\) denoting the falling factorial, i.e., \((x)^{{\underline{s}}} = x (x - 1) (x - 2) \dots (x - s + 1)\).

The following recurrence relations can also be derived for \(\Psi _{0,m}^{(I)}\) and \(\Psi _{1,m}^{(I)}\) using the results in Gradshteyn and Ryzhik (2014, §2.631, eqs. 1 and 2)

$$\begin{aligned} \begin{aligned} \Psi _{0,m}^{(I)} ={}&- m (m - 1) \Psi _{0,m - 2}^{(I)} \\ {}&+ \frac{1}{2} \Big [ \psi _{2}^{m - 1} (m \sin \psi _{2} - \psi _{2} \cos \psi _{2}) \\ {}&- \psi _{1}^{m - 1} (m \sin \psi _{1} - \psi _{1} \cos \psi _{1}) \Big ], \end{aligned} \end{aligned}$$
(15)

with initial conditions

$$\begin{aligned} \Psi _{0,0}^{(I)} =&\frac{\cos \psi _{1} - \cos \psi _{2}}{2} \end{aligned}$$
(16a)
$$\begin{aligned} \Psi _{0,1}^{(I)} =&\frac{\sin \psi _{2} - \sin \psi _{1} - \psi _{2} \cos \psi _{2} + \psi _{1} \cos \psi _{1}}{2}, \end{aligned}$$
(16b)

and

$$\begin{aligned} \Psi _{1,m}^{(I)}= & {} - \frac{m (m - 1)}{4} \Psi _{1,m - 2}^{(I)} \nonumber \\{} & {} + \frac{1}{16} \Big [ \psi _{2}^{m - 1} (m \sin 2 \psi _{2} - 2 \psi _{2} \cos 2 \psi _{2}) \nonumber \\{} & {} - \psi _{1}^{m - 1} (m \sin 2 \psi _{1} - 2 \psi _{1} \cos 2 \psi _{1}) \Big ], \end{aligned}$$
(17)

with initial conditions

$$\begin{aligned} \Psi _{1,0}^{(I)}&= \frac{\cos 2 \psi _{1} - \cos 2 \psi _{2}}{8} \end{aligned}$$
(18a)
$$\begin{aligned} \Psi _{1,1}^{(I)}&= \frac{\sin 2 \psi _{2} - \sin 2 \psi _{1} - 2 \psi _{2} \cos 2 \psi _{2} + 2 \psi _{1} \cos 2 \psi _{1}}{16}. \end{aligned}$$
(18b)

The relations provided in the present section and in Appendix C allow the development of a framework for the calculation of \(\Psi _{n,m}\) in an entirely recurrent fashion (e.g., Algorithm 1). As an example, Fig. 1a shows the spherical harmonic coefficients of the monomials \(\psi \), \(\psi ^{2}\) and \(\psi ^{3}\) up to \(n_{\textrm{max}} = 200\) and for \(I = [80^{\circ },120^{\circ }]\). The reconstructed monomials are presented in Fig. 1b, with the Gibbs effect being clearly visible at discontinuity points, e.g., endpoints of interval I, (Gelb 1997).

figure a
Fig. 1
figure 1

(a) Absolute magnitude of spherical harmonic coefficients \(\Psi _{n,m}^{(I)}\) of monomial \(\psi ^{m}\) as function of degree n. The evaluation is performed in the interval \(I = [80^{\circ },120^{\circ }]\). (b) Spatial representation of monomial \(\psi ^{m}\) as function of spherical distance. Dotted and solid lines represent original and reconstructed functions, respectively

3.2 The discrete Legendre transform of monomials

The discrete Legendre transform of the m-th-order monomial \(\psi ^{m}\) is given by

$$\begin{aligned} \Psi _{n,m} = \frac{1}{2} \int _{0}^{\pi } \psi ^{m} P_{n} (\cos \psi ) \sin \psi \, \textrm{d} \psi \end{aligned}$$
(19)

and can be calculated by setting \(\psi _{1} = 0\) and \(\psi _{2} = \pi \) in the equations of Sect. 3.1. The \(B_{n,m} (\psi ) |^{\pi }_{0}\) and \(D_{n,m} (\psi ) |^{\pi }_{0}\) parameters become

$$\begin{aligned}&B_{n,m} (\psi ) |^{\pi }_{0} = {\left\{ \begin{array}{ll} \pi ^{m}, &{} n = 0 \\ 0, &{} n \ne 0 \end{array}\right. } \end{aligned}$$
(20a)
$$\begin{aligned}&D_{n,m} (\psi ) |^{\pi }_{0} = 0. \end{aligned}$$
(20b)

The recurrence relations of Eqs. (10), (15) and (17) are simplified as follows:

$$\begin{aligned}&\Psi _{n,m} ={}\frac{1}{(n + 1)^{2}} \Big [ (n - 2)^{2} \Psi _{n - 2,m} \nonumber \\&\qquad + m (m - 1) (\Psi _{n - 2,m - 2} - \Psi _{n,m - 2}) \Big ], \quad n > 1 \end{aligned}$$
(21a)
$$\begin{aligned}&\Psi _{0,m} = - m (m - 1) \Psi _{0,m - 2} + \frac{\pi ^{m}}{2} \end{aligned}$$
(21b)
$$\begin{aligned}&\Psi _{1,m} = - \frac{m (m - 1)}{4} \Psi _{1,m - 2} - \frac{\pi ^{m}}{8} , \end{aligned}$$
(21c)

with initial conditions

$$\begin{aligned} \Psi _{0,0} = 1 \text { , } \Psi _{0,1} = \frac{\pi }{2} \text { , } \Psi _{1,0} = 0 \text { and } \Psi _{1,1} = - \frac{\pi }{8}. \end{aligned}$$
(22)

Equation (21a) can be verified using the more general results given in Ma (2016). In his study, he provides recurrence relations for the discrete Gegenbauer transform of \(\psi ^{m}\), defined as

$$\begin{aligned} \Xi _{n,d,m} = \int _{0}^{\pi } \psi ^{m} P_{n}^{(d)} (\cos \psi ) \sin ^{2 d} \psi \, \textrm{d} \psi , \end{aligned}$$
(23)

where \(P_{n}^{(d)}\) is the Gegenbauer polynomials. The Legendre polynomials are special cases of Gegenbauer polynomials, with \(P_{n} = P_{n}^{(1/2)}\). Setting \(d = 1/2\) to Eq. (23), it is directly evident that

$$\begin{aligned} \Xi _{n,\frac{1}{2},m} = 2 \Psi _{n,m}. \end{aligned}$$
(24)

The recurrence relation of Ma (2016) for \(\Xi _{n,1/2,m}\) reads after some algebraic manipulation

$$\begin{aligned} \Xi _{n,\frac{1}{2},m}= & {} \frac{1}{(n + 1)^{2}} \bigg [ (n - 2)^{2} \Xi _{n - 2,\frac{1}{2},m}\nonumber \\{} & {} + \frac{m (m - 1) (2 n - 1)}{n (n - 1)} \Xi _{n - 2,\frac{3}{2},m - 2} \bigg ], \quad n > 1.\nonumber \\ \end{aligned}$$
(25)

Substituting Eq. (24) into Eq. (25) and solving with respect to \(\Psi _{n,m}\) gives

$$\begin{aligned} \begin{aligned} \Psi _{n,m} ={}&\frac{1}{(n + 1)^{2}} \bigg [ (n - 2)^{2} \Psi _{n - 2,m} \\ {}&+ \frac{m (m - 1) (2 n - 1)}{2 n (n - 1)} \Xi _{n - 2,\frac{3}{2},m - 2} \bigg ], \quad n > 1. \end{aligned} \end{aligned}$$
(26)

In order to show that Eqs. (21a) and (26) are equivalent, it is sufficient to prove that

$$\begin{aligned} \Psi _{n - 2,m - 2} - \Psi _{n,m - 2} = \frac{2 n - 1}{2 n (n - 1)} \Xi _{n - 2,\frac{3}{2},m - 2}, \end{aligned}$$
(27)

which is done in Appendix D, thus confirming the validity of Eq. (21a).

3.3 The Legendre transforms of polynomials

The compactly supported discrete Legendre transform of the M-th-order polynomial

$$\begin{aligned} s (\psi ) = \sum _{m = 0}^{M} \alpha _{m} \psi ^{m} \end{aligned}$$
(28)

can be derived using the linearity property

$$\begin{aligned} {\mathscr {J}}_{I}\{a x (\psi ) + b y (\psi )\} = a {\mathscr {J}}_{I}\{x (\psi )\} + b {\mathscr {J}}_{I}\{y (\psi )\}, \end{aligned}$$
(29)

where \(\alpha _{m}\), a and b are constants. Implementing the linearity property to Eq. (28) results in the expression

$$\begin{aligned} S_{n}^{(I)} = {\mathscr {J}}_{I} \{ s (\psi ) \} = \sum _{m = 0}^{M} \alpha _{m} {\mathscr {J}}_{I} \{ \psi ^{m} \} = \sum _{m = 0}^{M} \alpha _{m} \Psi _{n,m}^{(I)}.\nonumber \\ \end{aligned}$$
(30)

The calculation of \(\Psi _{n,m}^{(I)}\) is discussed in Sect. 3.1 and offers a simple and elegant way of evaluating the spherical harmonic coefficients of any polynomial. The recurrent calculation of \(\Psi _{n,m}^{(I)}\) is also especially convenient and efficient for polynomials with no missing monomial terms, i.e., with \(\alpha _{m} \ne 0, \ \forall m \in \{ x \in {{\mathbb {N}}}_{0}: x \le M \}\). Figure 2 shows the spherical harmonic coefficients and spatial reconstruction of a fifth-order polynomial \(s (\psi )\), as defined by Eq. (28), with \(\{ \alpha _{0},\cdots ,\alpha _{5} \} = \{ -5.537, \, 21.129, \, -30.938, \, 21.875, \, -7.5, \, 1 \}\) in \(I = [52^{\circ },120^{\circ }]\). The spherical harmonic coefficients are calculated up to \(n_{\textrm{max}} = 200\) using Eq. (30) and the procedure described in Sect. 3.1.

Fig. 2
figure 2

(a) Absolute magnitude of spherical harmonic coefficients \(S_{n}^{(I)}\) of a fifth-order polynomial \(s (\psi )\) as function of degree n. The evaluation is performed in the interval \(I = [52^{\circ },120^{\circ }]\). (b) Spatial representation of fifth-order polynomial \(s (\psi )\) as function of spherical distance. Dotted and solid lines represent original and reconstructed functions, respectively

The results given so far in this section can be further generalized for piecewise polynomials. Let q be a piecewise function of K nonzero segments, with each segment \(q_{k}\) to be defined in the interval \(I_{k} = [\psi _{1,k},\psi _{2,k}]\), i.e.,

$$\begin{aligned} q(\psi ) = {\left\{ \begin{array}{ll} q_{1} (\psi ), &{} \psi \in I_{1} \\ q_{2} (\psi ), &{} \psi \in I_{2} \\ \vdots \\ q_{K} (\psi ), &{} \psi \in I_{K} \\ 0, &{} \text {elsewhere} \end{array}\right. }, \end{aligned}$$
(31)

and with \(I_{k}\) being mutually disjoint, i.e., \(I_{i} \cap I_{j} = \varnothing \) for \(i \ne j\). Equation (31) can also take the form

$$\begin{aligned} q (\psi ) = \sum _{k = 1}^{K} q_{k} (\psi ) \, \textbf{1}_{I_{k}} (\psi ). \end{aligned}$$
(32)

Assuming that each segment \(q_{k}\) is a polynomial of order \(M_{k}\) with constants \(\alpha _{m,k}\), Eq. (32) is rewritten as

$$\begin{aligned} q (\psi ) = \sum _{k = 1}^{K} \sum _{m = 0}^{M_{k}} \alpha _{m,k} \, \psi ^{m} \, \textbf{1}_{I_{k}} (\psi ). \end{aligned}$$
(33)

We note that Eqs. (32) and (33), unlike Eq. (31), can also be used for overlapping intervals \(I_{k}\). The compactly supported discrete Legendre transform of q in I is given by

$$\begin{aligned} Q_{n}^{(I)} = {\mathscr {J}}_{I} \{q (\psi )\}= & {} \sum _{k = 1}^{K} \sum _{m = 0}^{M_{k}} \alpha _{m,k} \, {\mathscr {J}}_{I} \{ \psi ^{m} \, \textbf{1}_{I_{k}} (\psi ) \} \nonumber \\= & {} \sum _{k = 1}^{K} \sum _{m = 0}^{M_{k}} \alpha _{m,k} \Psi _{n,m}^{(I \cap I_{k})}, \end{aligned}$$
(34)

where \(I \cap I_{k} = [\max (\psi _{1},\psi _{1,k}), \min (\psi _{2},\psi _{2,k})]\). Equation (34) again indicates the importance and relevance of the mathematical developments of Sect. 3.1 for the calculation of spherical harmonic coefficients of piecewise polynomials. Analogous expressions to the ones provided in the present section can be derived for the discrete Legendre transform by substituting \(S_{n}^{(I)} = S_{n}\), \({\mathscr {J}}_{I} = {\mathscr {J}}\), \(\Psi _{n,m}^{(I)} = \Psi _{n,m}\), \(Q_{n}^{(I)} = Q_{n}\) and \(\Psi _{n,m}^{(I \cap I_{k})} = \Psi _{n,m}^{(I_{k})}\).

4 Numerical assessment

It is widely known that a sequence evaluated using a recurrence relation is susceptible to inaccuracies. These inaccuracies are due to the accumulation of truncation and round-off errors coming from each cycle of the recurrence procedure (Gautschi 1967). Since our method for the calculation of \(\Psi _{n,m}^{(I)}\) is also based on recurrence relations, we design a numerical experiment to access its accuracy. We compare the recurrent calculation of \(\Psi _{n,m}^{(I)}\) using double-precision floating-point number format, which is MATLAB’s default numeric setup, against the recurrent calculation using extended precision floating-point number format. Extending the numerical precision (i.e., significant digits) of all computations, usually at the expense of computational efficiency, is a simple approach for reducing the propagation of truncation and round-off errors. This approach has been recently used by Bucha et al. (2019) and Piretzidis and Sideris (2019) to evaluate unstable recurrence relations of geodetic interest. We define the relative accuracy of \(\Psi _{n,m}^{(I)}\) as the relative difference

$$\begin{aligned} \sigma _{n,m}^{(I)} = \Bigg | \frac{ \big ( \Psi _{n,m}^{(I)} \big )_{\textrm{dp}} - \big ( \Psi _{n,m}^{(I)} \big )_{\textrm{ep}}}{\big ( \Psi _{n,m}^{(I)} \big )_{\textrm{ep}}} \Bigg |, \end{aligned}$$
(35)

where the subscripts “dp” and “ep” denote recurrent calculation using double precision and extended precision, respectively. All extended precision calculations are performed with 32 significant digits. In theory, the relative accuracy \(\sigma _{n,m}^{(I)}\) depends on four variables at most, i.e., the spherical harmonic degree n, the polynomial order m and the two endpoints \(\psi _{1}\) and \(\psi _{2}\) of the interval I.

Extensive numerical experiments on the evaluation of \(\sigma _{n,m}^{(I)}\) for different combinations of \(\psi _{1}\) and \(\psi _{2}\) revealed that, in practice, \(\sigma _{n,m}^{(I)}\) is highly dependent on \(\psi _{2}\) and not on \(\psi _{1}\). Therefore, to simplify the presentation of our results, we use the approximation \(\sigma _{n,m}^{([\psi _{1},\psi _{2}])} \approx \sigma _{n,m}^{([0,\psi _{0}])}\) and further assess the relative accuracy for different values of n, m and \(\psi _{0}\). The results are given in the upper panels of Fig. 3. It is evident that \(\sigma _{n,m}^{([0,\psi _{0}])}\) is strongly influenced by both m and \(\psi _{0}\), with an increasing m and decreasing \(\psi _{0}\) to result in a relative accuracy of larger magnitude.

The results of Fig. 3 also suggest that the relative accuracy slightly deteriorates as n increases, but to a far lesser extent than it does for varying m and \(\psi _{0}\). The larger magnitude of \(\sigma _{n,m}^{([0,\psi _{0}])}\) for increasing m indicates that the order-wise recurrence relations given by Eqs. (15) and (17) result in a large error growth. These errors are subsequently propagated by Eq. (10) to the rest of the coefficients. The calculation of \(\Psi _{0,m}^{(I)}\) and \(\Psi _{1,m}^{(I)}\) using Eqs. (14a) and (14b), instead of Eqs. (15) and (17), respectively, is also inaccurate after a certain order and does not provide any advantages.

In order to mitigate the propagation of large errors, we propose a hybrid method for the calculation of \(\Psi _{n,m}^{(I)}\), where the coefficients \(\Psi _{0,m}^{(I)}\) and \(\Psi _{1,m}^{(I)}\) are evaluated using numerical integration, and the coefficients \(\Psi _{n,m}^{(I)}\) for \(n > 1\) are evaluated recurrently using Eq. (10). The numerical integration is performed here using the Gauss-Legendre quadrature method (Kythe and Schäferkotter 2005, §3.2.2). The relative accuracy of the hybrid method is again calculated using the extended precision arithmetic method as a reference. The results are provided in the middle row of Fig. 3, where an improvement of the relative accuracy of the hybrid method with respect to the double-precision recurrent method is evident. Additional tests showed that extending the degree n for which the coefficients \(\Psi _{n,m}^{(I)}\) are evaluated numerically can further improve the relative accuracy of the hybrid method.

Finally, the last row of Fig. 3 presents the relative accuracy of \(\Psi _{n,m}^{(I)}\) calculated using Gauss-Legendre quadrature. It is evident that \(\sigma _{n,m}^{([0,\psi _{0}])}\) is not systematically affected by m and \(\psi _{0}\) in their examined range, whereas it shows a larger magnitude as n increases. Previous studies (e.g., Piretzidis and Sideris 2019) have demonstrated that numerical integration is not accurate for evaluating coefficients with a magnitude (in absolute value) close to or smaller than the relative accuracy level of the selected floating-point format. Evidence of such behavior is also provided in the numerical experiments of Sect. 6.2. Therefore, deteriorating relative accuracy should also be expected for the calculation of \(\Psi _{n,m}^{(I)}\) using numerical integration as the absolute value of \(\Psi _{n,m}^{(I)}\) decreases.

Fig. 3
figure 3

Relative accuracy of \(\Psi _{n,m}^{([0,\psi _{0}])}\) for different values of \(\psi _{0}\) using the recurrent approach (top), the hybrid approach (middle) and Gauss–Legendre quadrature (bottom)

5 Isotropic B-spline filtering on the sphere

The study of spectral-domain filtering techniques is an important area of research in the geodetic community since the development of the first GRACE-based temporal geopotential models. These models are affected by large correlated errors and their filtering prior to any geophysical interpretation is always necessary. A first possible application of the methods developed in Sect. 3 is the efficient calculation of the spherical harmonic coefficients of polynomial low-pass filters. Simple yet rigorous techniques of deriving the coefficients of these filters permit the study of their spectral characteristics. Such low-pass filters can subsequently be used to smooth functionals of the Earth’s gravity field in the spherical harmonic domain.

In the present section, we introduce the concept of isotropic B-spline filtering on the sphere. It is a special case of isotropic filtering with the filter kernel to be described by B-spline curves. B-splines are continuous piecewise polynomial functions of finite support, with applications to interpolation, regression and parametric modeling of curves and surfaces. Due to their characteristics, they provide an excellent testbed for implementing the methods provided in Sect. 3. B-splines have been previously used in geodetic studies for atmosphere modeling (Haji-Aghajany et al. 2020; Schmidt et al. 2020), topography/bathymetry modeling (Boergens et al. 2021; Zhang et al. 2022) and multiresolutional analysis (Mautzl et al. 2005). A review of the literature suggests that B-splines have not been systematically utilized in the context of filtering a spatial geophysical signal defined on the sphere. Therefore, apart from testing the methodology of Sect. 3, we take the opportunity to also examine B-splines in this context. We first summarize the underlying mathematical theory of isotropic filtering on the sphere and its implementation in the spatial and spherical harmonic domains. We then provide relations for the calculation of B-spline windows and filter kernels. As an example, we derive the expressions for the third-order B-spline filter and demonstrate its applicability to the filtering of a GRACE-FO monthly solution.

5.1 Isotropic filtering on the sphere

The filtering of a spatial field \(g (\phi ,\lambda )\) with an isotropic filter kernel \(h (\psi )\) is expressed with the following convolution integral:

$$\begin{aligned} {\bar{g}} (\phi ,\lambda ) = h(\psi ) *g(\phi ,\lambda ) = \frac{1}{4 \pi } \iint _{\Omega ^{\prime }} g(\phi ^{\prime },\lambda ^{\prime }) h (\psi ) \, \textrm{d} \Omega ^{\prime },\nonumber \\ \end{aligned}$$
(36)

where “\(*\)” denotes convolution, \(\Omega ^{\prime }\) is the integration domain (surface of unit sphere) and \(\textrm{d} \Omega ^{\prime } = \cos \phi ^{\prime } \, \textrm{d} \phi ^{\prime } \, \textrm{d} \lambda ^{\prime }\) is the area element of \(\Omega ^{\prime }\). The spherical distance \(\psi \) in Eq. (36) corresponds to the distance between the evaluation point \((\phi ,\lambda )\) and the running integration point \((\phi ^{\prime },\lambda ^{\prime })\). The filter kernel \(h (\psi )\) is usually a normalized window function \(w (\psi )\) (Jekeli 1981, eq. 51), i.e.,

$$\begin{aligned} h (\psi )=\frac{w (\psi )}{\tilde{w}}, \end{aligned}$$
(37)

where \(\tilde{w}\) represents the spatial average of \(w (\psi )\) on the unit sphere and is calculated by

$$\begin{aligned} \tilde{w}= & {} \frac{1}{4 \pi } \int _{0}^{2 \pi } \int _{0}^{\pi } w(\psi ) \sin \psi \, \textrm{d} \psi \textrm{d} \lambda \nonumber \\ {}= & {} \frac{1}{2} \int _{0}^{\pi } w(\psi ) \sin \psi \, \textrm{d} \psi . \end{aligned}$$
(38)

The evaluation of Eq. (36) is performed efficiently in the spherical harmonic domain using convolution theorems. The set of spherical harmonic coefficients of the \((\phi ,\lambda )\)-dependent function g are given by the forward Fourier–Legendre transform \(\bar{{\mathscr {J}}}\), defined as

(39)

where are the fully normalized associated Legendre functions of harmonic degree n and order (not to be confused with the polynomial order m defined in Sect. 3). The inverse Fourier–Legendre transform \(\bar{{\mathscr {J}}}^{-1}\) reads

(40)

For an isotropic function, it holds \(\bar{{\mathscr {J}}} \equiv {\mathscr {J}}\). The spherical harmonic coefficients of \({\bar{g}}\) are derived using the convolution theorem

(41)

where \(H_{n}\) denotes the Legendre transform of the filter kernel \(h (\psi )\). In the sequel, we discuss the use of B-spline windows for the construction of related isotropic kernels that can be used as spatial low-pass filters.

5.2 B-spline windows and filters

B-spline windows are a family of tapered window functions that can be used for truncating (i.e., space-limiting) a signal or for the design of low-pass filters. The K-th-order B-spline window function is a piecewise polynomial of order \(K - 1\) that is obtained from the cascaded convolution of K rectangular window functions. B-spline windows were introduced and described mathematically by Toraichi et al. (1989). Adapting their closed-form expression of the unnormalized K-th-order B-spline window for the spherical case results in the function

$$\begin{aligned} v(\psi ) = \sum _{k = 0}^{K - 1} \frac{(-1)^{k}}{k ! (K - k)!} \bigg ( \psi - \frac{2 k - K}{K} \psi _{0} \bigg )^{K - 1} \textbf{1}_{I_{k}} (\psi ), \end{aligned}$$
(42)

where the interval \(I_{k}\) is given by the intersection

$$\begin{aligned} I_{k} = [0, \psi _{0}] \cap \bigg ( \frac{2 k - K}{K} \psi _{0},\infty \bigg ) \end{aligned}$$
(43)

and with \(\psi _{0} \in (0,\pi ]\) denoting the window length for which \(v(\psi ) = 0, \ \forall \psi > \psi _{0}\). The window length \(\psi _{0}\) can also be expressed in terms of the great-circle distance \(r = R \psi _{0}\) on the surface of a sphere of radius R.

It is evident that Eq. (42) has the same form as Eq. (32). Using the binomial theorem, Eq. (42) can also be written in the form of Eq. (33) as follows:

$$\begin{aligned} v(\psi )= & {} \sum _{k = 0}^{K - 1} \sum _{m = 0}^{K - 1} \frac{(-1)^{K + k - m - 1}}{k ! (K - k)!} \left( {\begin{array}{c}K - 1\\ m\end{array}}\right) \nonumber \\{} & {} \times \bigg ( \frac{2 k - K}{K} \psi _{0} \bigg )^{K - m - 1} \psi ^{m} \, \textbf{1}_{I_{k}} (\psi ). \end{aligned}$$
(44)

The K-th-order B-spline window function, normalized so that \(w(0) = 1\), is then given by

$$\begin{aligned} w(\psi ) = \frac{v(\psi )}{v(0)}. \end{aligned}$$
(45)

We note that in the work of Toraichi et al. (1989), Eq. (42) is multiplied by the constant \(K^{K}\). Since w is normalized, this constant is disregarded here as trivial. An analytical expression for the spatial average \(\tilde{w}\) is derived by substituting Eqs. (44) and (45) into Eq. (38) and reads as follows:

$$\begin{aligned} \tilde{w}= & {} \frac{1}{2 \, v(0)} \sum _{k = 0}^{K - 1} \sum _{m = 0}^{K - 1} \frac{(-1)^{K + k - m - 1}}{k ! (K - k)!} \left( {\begin{array}{c}K - 1\\ m\end{array}}\right) \nonumber \\{} & {} \quad \times \bigg ( \frac{2 k - K}{K} \psi _{0} \bigg )^{K - m - 1} \int _{I_{k}} \psi ^{m} \sin \psi \, \textrm{d} \psi \nonumber \\= & {} \frac{1}{v(0)} \sum _{k = 0}^{K - 1} \sum _{m = 0}^{K - 1} \frac{(-1)^{K + k - m - 1}}{k ! (K - k)!} \left( {\begin{array}{c}K - 1\\ m\end{array}}\right) \nonumber \\{} & {} \quad \times \bigg ( \frac{2 k - K}{K} \psi _{0} \bigg )^{K - m - 1} \Psi _{0,m}^{(I_{k})}. \end{aligned}$$
(46)

The filter kernel \(h (\psi )\) is then derived using Eq. (37), and the filter coefficients \(H_{n}\) are given by the relation

$$\begin{aligned} \begin{aligned} H_{n} ={}&\frac{1}{\tilde{w} v (0)} \sum _{k = 0}^{K - 1} \sum _{m = 0}^{K - 1} \frac{(-1)^{K + k - m - 1}}{k ! (K - k)!} \left( {\begin{array}{c}K - 1\\ m\end{array}}\right) \\ {}&\times \bigg ( \frac{2 k - K}{K} \psi _{0} \bigg )^{K - m - 1} \Psi _{n,m}^{(I_{k})}, \end{aligned} \end{aligned}$$
(47)

where it is evident by the last two equations that \(H_{0} = 1\). The first-order B-spline window corresponds to a rectangular (or spherical cap) window, the second order is a Bartlett (or triangular) window and the fourth order is a Parzen window (Toraichi et al. 1989). In the next subsection we derive expressions for the third-order B-spline window and filter kernel.

5.3 The third-order B-spline filter

Substituting \(K = 3\) in Eq. (42), we derive the following expression for the unnormalized third-order B-spline window:

$$\begin{aligned} v(\psi ) = \sum _{k = 0}^{2} \frac{(-1)^{k}}{k ! (3 - k)!} \bigg ( \psi - \frac{2 k - 3}{3} \psi _{0} \bigg )^{2} \textbf{1}_{I_{k}} (\psi ), \end{aligned}$$
(48)

which, upon expanding the sum, yields

$$\begin{aligned} v(\psi )= & {} \underbrace{\frac{1}{6} {(\psi + \psi _{0})^{2} \, \textbf{1}_{I_{0}} (\psi )}}_{\textcircled {1}} \hspace{5.0pt}\underbrace{- \ \frac{1}{2} \bigg ( \psi + \frac{\psi _{0}}{3} \bigg )^{2} \, \textbf{1}_{I_{1}} (\psi )}_{\textcircled {2}} \nonumber \\{} & {} \underbrace{+ \ \frac{1}{2} \bigg ( \psi - \frac{\psi _{0}}{3} \bigg )^{2} \, \textbf{1}_{I_{2}} (\psi )}_{\textcircled {3}} \end{aligned}$$
(49)

with

$$\begin{aligned}&\textbf{1}_{I_{0}} = [0, \psi _{0}] \cap (-\psi _{0}, \infty ) = [0, \psi _{0}] \end{aligned}$$
(50a)
$$\begin{aligned}&\textbf{1}_{I_{1}} = [0, \psi _{0}] \cap \bigg (-\frac{\psi _{0}}{3},\infty \bigg ) = [0, \psi _{0}] \end{aligned}$$
(50b)
$$\begin{aligned}&\textbf{1}_{I_{2}} = [0, \psi _{0}] \cap \bigg ( \frac{\psi _{0}}{3},\infty \bigg ) = \bigg ( \frac{\psi _{0}}{3},\psi _{0} \bigg ]. \end{aligned}$$
(50c)

Equation (49) consists of two nonzero segments and can be written in symbolic form as

$$\begin{aligned} v(\psi ) = {\left\{ \begin{array}{ll} \textcircled {1} + \textcircled {2}, &{} \psi \le \frac{\psi _{0}}{3} \\ \textcircled {1} + \textcircled {2} + \textcircled {3}, &{} \frac{\psi _{0}}{3} < \psi \le \psi _{0} \\ 0, &{} \psi > \psi _{0} \end{array}\right. }. \end{aligned}$$
(51)

Expanding the terms \(\textcircled {1}\) through \(\textcircled {3}\) of Eq. (51), and taking into account that all indicator functions equal 1 inside their interval of support, we derive the expression

$$\begin{aligned} v(\psi ) = {\left\{ \begin{array}{ll} \frac{\psi _{0}^{2} - 3 \psi ^{2}}{9}, &{} \psi \le \frac{\psi _{0}}{3} \\ \frac{\psi _{0}^{2} - 2 \psi _{0} \psi + \psi ^{2}}{6}, &{} \frac{\psi _{0}}{3} < \psi \le \psi _{0} \\ 0, &{} \psi > \psi _{0} \end{array}\right. }, \end{aligned}$$
(52)

with \(v(0) = \psi _{0}^{2} / 9\). The normalized third-order B-spline window is given by

$$\begin{aligned} w(\psi ) = \frac{v(\psi )}{v(0)} = {\left\{ \begin{array}{ll} 1 - \frac{3 \psi ^{2}}{\psi _{0}^{2}}, &{} \psi \le \frac{\psi _{0}}{3} \\ \frac{3 \psi ^{2}}{2 \psi _{0}^{2}} - \frac{3 \psi }{\psi _{0}} + \frac{3}{2}, &{} \frac{\psi _{0}}{3} < \psi \le \psi _{0} \\ 0, &{} \psi > \psi _{0} \end{array}\right. }. \end{aligned}$$
(53)

The spatial average \(\tilde{w}\) has the analytical form

$$\begin{aligned} \tilde{w} = \frac{3}{2 \psi _{0}^{2}} \bigg ( 2 + \frac{\psi _{0}^{2}}{3} - 3 \cos \frac{\psi _{0}}{3} + \cos \psi _{0} \bigg ) \end{aligned}$$
(54)

and the isotropic filter kernel \(h (\psi )\) is given by Eq. (37). Based on Eq. (53) and the theory given in Sect. 3, the spherical harmonic coefficients \(H_{n}\) of the filter \(h (\psi )\) can be evaluated by

$$\begin{aligned} H_{n}= & {} \frac{1}{\tilde{w}} \Big ( \Psi _{n,0}^{([0,\psi _{0}/3])} - \frac{3}{\psi _{0}^{2}} \Psi _{n,2}^{([0,\psi _{0}/3])} \nonumber \\{} & {} + \frac{3}{2 \psi _{0}^{2}} \Psi _{n,2}^{([\psi _{0}/3,\psi _{0}])} - \frac{3}{\psi _{0}} \Psi _{n,1}^{([\psi _{0}/3,\psi _{0}])} \nonumber \\{} & {} + \frac{3}{2} \Psi _{n,0}^{([\psi _{0}/3,\psi _{0}])} \Big ). \end{aligned}$$
(55)

Figure 4 shows the spatial and spherical harmonic representation of the isotropic third-order B-spline filter kernel for different window lengths.

Fig. 4
figure 4

(a) Kernel function \(h (\psi )\) as function of distance on the Earth’s surface \(R \psi \) (R = 6378136.3 m) and (b) absolute magnitude of spherical harmonic coefficients \(H_{n}\) as function of degree n for the isotropic third-order B-spline filter

5.4 Application to GRACE-FO filtering

We demonstrate the use of the third-order B-spline filter in the post-processing of GRACE-FO monthly solutions. We use the Level 2 RL06 products calculated by the Center for Space Research (CSR), The University of Texas at Austin. Level 2 products correspond to monthly sets of spherical harmonic coefficients of the Earth’s gravity field and have been available since June 2018. Time-varying geopotential models derived from GRACE and GRACE-FO contain correlated errors that dominate the higher frequencies (i.e., higher degrees and orders) of the gravity field spectrum. Due to GRACE-FO’s orbital and sampling characteristics (Peidou and Pagiatakis 2020; Pagiatakis and Peidou 2021), the spatial-domain geometry of these errors follows a characteristic north–south distribution commonly referred to as striping. The correlated errors are usually reduced using low-pass filters or specialized decorrelation techniques.

Since the results of this section are not used for geophysical interpretation, no corrections (e.g., addition of degree-one coefficients, replacement of \(C_{2,0}\) coefficients, etc.) or prior decorrelation are applied to Level 2 products. We use the standard procedure of Wahr et al. (1998) and calculate filtered surface mass variations \(\Delta \sigma \) in terms of equivalent water height (EWH) using the equation

(56)

where \(\rho _\textrm{ave}\) is the Earth’s average density, \(\rho _\textrm{w}\) is the water density, \(\kappa _{n}\) are the load-deformation coefficients of degree n and are the filtered spherical harmonic coefficient variations.

The coefficients are calculated in two steps. In the first step, the contribution of the GRACE-only static geopotential model ITSG-Grace2018s (Kvas et al. 2019; Mayer-Gürr et al. 2018) is removed from each set of resulting in the coefficient variations . In the second step, the coefficients are filtered using Eq. (41) resulting in the filtered coefficient variations .

Figure 5 shows the filtered maps of EWH variations, corresponding to the monthly solution of November 2019, using the third-order B-spline filter with different window lengths. The dominant striping effect is clearly evident in the unfiltered EWH variations of Fig. 5a. The use of a larger window length reduces the striping effect and produces smoother EWH variations. This behavior is typical and resembles other low-pass filters used for denoising GRACE and GRACE-FO data, such as the isotropic Gaussian filter (Jekeli 1981; Piretzidis and Sideris 2022).

Fig. 5
figure 5

(a) Original and filtered GRACE-FO surface mass changes in cm of EWH derived using an isotropic third-order B-spline filter with (b) \(r = 600\) km, (c) \(r = 1000\) km and (d) \(r = 1400\) km

6 Isotropic polynomial covariance functions

As a second application of the methods given in Sect. 3, we discuss the calculation and study of polynomial covariance functions in the spherical harmonic domain. In the first part of the present section, we outline some aspects of covariance functions used in gravity field modeling. In the second part, we examine some isotropic polynomial covariance functions and provide expressions for the calculation of their spherical harmonic coefficients.

6.1 Covariance functions in gravity field modeling

Covariance functions are important mathematical components in geostatistics, since they provide essential information for the spatial or spatiotemporal correlation of a random field. In physical geodesy and gravity field modeling, covariance functions are primarily used to model the stochastic behavior of the Earth’s disturbing potential and its related functionals, as well as other signals of geophysical interest. Covariance functions are also essential in the implementation of statistical methods (e.g., least-squares collocation) for the optimal estimation, interpolation and filtering of spatial fields. The use of such statistical tools and techniques is motivated by the fact that certain geophysical signals exhibit a random behavior in the lateral direction (Jekeli 2010).

Since the true covariance function of a spatial field is never known, an empirical covariance function is usually estimated using discrete observations. The true covariance function is also approximated by an analytical model that is fitted to the empirical one. Due to their simplicity, isotropic analytical covariance functions are still used extensively in geodetic applications to describe the stochastic nature of signals.

The isotropic covariance function \(C (\psi )\) of a spatial random field \(g (\phi ,\lambda )\) defined on the spherical surface is given by (Hofmann-Wellenhof and Moritz 2006, eq. 9-32)

$$\begin{aligned} C (\psi ) = \frac{1}{8 \pi ^{2}} \iint _{\Omega } \int _{0}^{2 \pi } g (\phi ,\lambda ) g (\phi ^{\prime },\lambda ^{\prime }) \, \textrm{d} \alpha \, \textrm{d} \Omega , \end{aligned}$$
(57)

where \(\psi \) and \(\alpha \) are the polar coordinates (spherical distance and azimuth, respectively) of point \(A (\phi ,\lambda )\) and \(A^{\prime } (\phi ^{\prime },\lambda ^{\prime })\). The spherical harmonic representation of \(C (\psi )\), denoted as \(\Gamma _{n} = {\mathscr {J}} \{ C (\psi ) \}\), can be derived from Eq. (3). As already discussed, only discrete values of \(g (\phi ,\lambda )\) are usually available in practice, which allow the empirical estimation of \(C (\psi )\) in one step and the fitting of an analytical model to the estimated empirical values in a subsequent step. Although a large variety of analytical covariance models are available in the literature, the ones that should be accounted for are those that are valid (i.e., positive definite) in the examined space. The criteria that ensure the positive definiteness of a covariance model on the sphere, based on the characterization of \(\Gamma _{n}\), are derived by Schoenberg (1942) as follows:

$$\begin{aligned}&\text {Criterion 1: }\Gamma _{n} \ge 0 \end{aligned}$$
(58a)
$$\begin{aligned}&\text {Criterion 2: }\sum _{n = 0}^{\infty } \Gamma _{n} < \infty . \end{aligned}$$
(58b)

In addition to Schoenberg’s criteria, the analytical covariance model to be used should capture the properties of the examined spatial field. For example, a covariance function for the gravitational potential should be harmonically continued into free space (i.e., outside the Earth’s masses).

Another important attribute of covariance functions is their support length. Compactly supported covariance functions, also known as finite covariance functions, play an important role in stochastic modeling. This type of covariance functions assumes zero auto-correlation after a specific distance and offers certain computational advantages. For example, in the context of optimal statistical estimation, the use of a compactly supported covariance function produces sparse covariance matrices that are faster to be calculated and stored, and results in a linear system of equations that is easier to be solved. Such covariance functions have been previously studied in Sansò and Schuh (1987), Arabelos and Tscherning (1998), Moreaux et al. (1999), Moreaux (2008). In the following subsection, we discuss some examples of compactly supported polynomial covariance functions and provide expressions for their spectral representation.

6.2 Expressions for spherical harmonic coefficients of some isotropic polynomial covariance models on the sphere

A review of the recent literature on a wide variety of topics (e.g., geostatistics, multivariate analysis, stochastic analysis, etc.) reveals that isotropic polynomial covariance models exist and are a subject of ongoing research (Schubert and Schuh 2023). The validity of these models was firstly examined on Euclidean spaces and later on spherical surfaces. The transition to the sphere is done by a simple substitution of the Euclidean distance by the great-circle distance (Gneiting 2013). Early investigations showed that some of these models meet the positive definiteness criteria for the two-dimensional sphere \({\mathbb {S}}^{2} = \{ x \in {\mathbb {R}}^{3}: \Vert x \Vert = R \}\) of arbitrary radius R and therefore allow the design of rigorous covariance functions on such surfaces.

A list of commonly studied isotropic polynomial covariance models is provided in Table 1 along with their parameter range that guarantees positive definiteness in \({\mathbb {S}}^{2}\). For more information regarding the positive definiteness of these models, the reader is referred to the work of Gneiting (2013). Some examples on the study and use of these models in gravity field modeling, in the context of optimal estimation of gravity field functionals, are given in Moreaux (2008) and Klees and Prutkin (2010). It is evident by their expressions that all models listed in Table 1 are compactly supported. The \(\psi _{0}\) parameter denotes the range of the covariance function, for which \(C (\psi ) = 0\) for \(\psi > \psi _{0}\), and controls the extent of spatial correlation (Christakos 1992, p. 76);  (Wackernagel 2003, p. 58). The range \(\psi _{0}\) can also be expressed as a great-circle distance \(r = R \psi _{0}\) on the Earth’s surface, as already done for the window length in Sect. 5.2. The \(\tau \) parameter controls the shape of the covariance function.

Table 1 Isotropic polynomial covariance models on the sphere (Gneiting 2013)

The spherical covariance model is given by a third-order polynomial expression. From a geometric perspective, this expression describes the normalized volume of the intersection of two spheres with diameter \(\psi _{0}\) (in linear units) and with their centers separated by a vector of magnitude \(\psi \) (also in linear units) (Wackernagel 2003, p. 60). In other words, the spherical model is derived by the normalized self-convolution of the indicator function of a ball with diameter \(\psi _{0}\) in \({\mathbb {R}}^{3}\). Using the theory of Sect. 3, the spherical harmonic coefficients of the spherical model are given by

$$\begin{aligned} \Gamma _{n}= & {} \Psi _{n,0}^{([0,\min (\psi _{0},\pi )])} - \frac{3}{2 \psi _{0}} \Psi _{n,1}^{([0,\min (\psi _{0},\pi )])} \nonumber \\{} & {} + \frac{1}{2 \psi _{0}^{3}} \Psi _{n,3}^{([0,\min (\psi _{0},\pi )])}. \end{aligned}$$
(59)

The self-convolution of a ball in higher-dimensional spaces gives rise to the so-called Euclid’s hat functions. Gneiting (1999) showed that particular representations of the Euclid’s hat functions correspond to the Askey covariance model, which was introduced by Askey (1973) and is a polynomial function of order \(\tau \). Using the binomial theorem, the Askey covariance model is written as

$$\begin{aligned} C (\psi ) = \sum _{m = 0}^{\tau } (-1)^{m} \left( {\begin{array}{c}\tau \\ m\end{array}}\right) \psi _{0}^{-m} \psi ^{m} \textbf{1}_{[0,\min (\psi _{0},\pi )]} (\psi ) \end{aligned}$$
(60)

and its spherical harmonic coefficients are calculated by

$$\begin{aligned} \Gamma _{n} = \sum _{m = 0}^{\tau } (-1)^{m} \left( {\begin{array}{c}\tau \\ m\end{array}}\right) \psi _{0}^{-m} \Psi _{n,m}^{([0,\min (\psi _{0},\pi )])}. \end{aligned}$$
(61)

One common drawback of the spherical and Askey covariance models is their non-differentiability (Wackernagel 2003, p. 58); (Schaback 2011). A family of covariance models with no such limitation is the Wendland models (Wendland 1995). These models represent polynomials of arbitrary order and smoothness. They are developed via the repeated application of the “Montée” integral operator of Matheron (1965) to the Askey covariance model (Gneiting 2002). The most frequently used Wendland models are the ones with smoothness degree two and four, termed \(C^{2}\)- and \(C^{4}\)-Wendland models, and correspond to polynomial functions of order \(\tau + 1\) and \(\tau + 2\), respectively. The binomial expansion of the \(C^{2}\)- and \(C^{4}\)-Wendland models reads as follows

$$\begin{aligned} C (\psi ) ={}&\sum _{m = 0}^{\tau } (-1)^{m} \left( {\begin{array}{c}\tau \\ m\end{array}}\right) \psi _{0}^{-m} \bigg ( \psi ^{m} + \frac{\tau }{\psi _{0}} \psi ^{m + 1} \bigg ) \nonumber \\ {}&\times \textbf{1}_{[0,\psi _{0}]} (\psi ) \end{aligned}$$
(62a)
$$\begin{aligned} C (\psi ) ={}&\sum _{m = 0}^{\tau } (-1)^{m} \left( {\begin{array}{c}\tau \\ m\end{array}}\right) \psi _{0}^{-m} \bigg ( \psi ^{m} + \frac{\tau }{\psi _{0}} \psi ^{m + 1} \nonumber \\ {}&+ \frac{\tau ^{2} - 1}{3 \psi _{0}^{2}} \psi ^{m + 2} \bigg ) \textbf{1}_{[0,\psi _{0}]} (\psi ) \end{aligned}$$
(62b)

and their spherical harmonic coefficients are given by the expressions

$$\begin{aligned} \Gamma _{n}&= \sum _{m = 0}^{\tau } (-1)^{m} \left( {\begin{array}{c}\tau \\ m\end{array}}\right) \psi _{0}^{-m} \bigg ( \Psi _{n,m}^{([0,\psi _{0}])} + \frac{\tau }{\psi _{0}} \Psi _{n,m + 1}^{([0,\psi _{0}])} \bigg ) \end{aligned}$$
(63a)
$$\begin{aligned} \Gamma _{n}&={}\sum _{m = 0}^{\tau } (-1)^{m} \left( {\begin{array}{c}\tau \\ m\end{array}}\right) \psi _{0}^{-m} \bigg ( \Psi _{n,m}^{([0,\psi _{0}])} + \frac{\tau }{\psi _{0}} \Psi _{n,m + 1}^{([0,\psi _{0}])} \nonumber \\&\quad + \frac{\tau ^{2} - 1}{3 \psi _{0}^{2}} \Psi _{n,m + 2}^{([0,\psi _{0}])} \bigg ), \end{aligned}$$
(63b)

respectively. Figures 6 and 7 show some examples of the covariance models of Table 1 in the spatial and spherical harmonic domain for different values of \(\psi _{0}\) and \(\tau \). The all-positive values of \(\Gamma _{n}\) in Fig. 7 are expected since the covariance models of Table 1 are positive definite; hence, the Schoenberg’s criteria apply.

Fig. 6
figure 6

Spatial representation of (a) spherical, (b) Askey, (c) \(C^{2}\)-Wendland and (d) \(C^{4}\)-Wendland covariance models

Fig. 7
figure 7

Spherical harmonic representation of (a) spherical, (b) Askey, (c) \(C^{2}\)-Wendland and (d) \(C^{4}\)-Wendland covariance models

The method for the evaluation of \(\Psi _{n,m}^{(I)}\) (e.g., recurrent, hybrid, etc.) plays a crucial role in the calculation of spherical harmonic coefficients of positive definite covariance functions as the propagation of numerical errors in higher degrees can result in negative \(\Gamma _{n}\) values. For example, the calculation of \(\Gamma _{n}\) for the \(C^{4}\)-Wendland model with parameter pairs \(\{r, \tau \} = \{600\text { km}, 7\}\) and \(\{1400\text { km}, 6\}\) using the recurrent method yields \(\Gamma _{n}\) values with increasing oscillations up to \(n \approx 2300\) and 1800, respectively, and negative values afterward (Fig. 8a). For the same model and parameter pairs, the hybrid method shows a behavior similar to the recurrent method, with the oscillatory and negative \(\Gamma _{n}\) values to become evident in higher degrees (Fig. 8b). The use of Gauss–Legendre quadrature (GLQ) numerical integration leads to inaccurate results when \(\Gamma _{n}\) values are close to the relative accuracy level of the implemented floating-point format. Since the GLQ numerical integration is performed using a double-precision floating-point format, inaccurate results start to manifest when \(\Gamma _{n} < 2.2 \times 10^{-16}\), which corresponds to \(n > 2050\) for the second parameter pair, and with negative \(\Gamma _{n}\) values appearing in higher degrees (Fig. 8c). The numerical integration method is also important. For comparison, Fig. 8c also shows the resulting \(\Gamma _{n}\) values using MATLAB’s function integral that implements the adaptive quadrature (ADQ) method of Shampine (2008) with a built-in control of the absolute and relative error. The relative error tolerance is chosen to be equal to \(2.2 \times 10^{-16}\). The ADQ numerical integration results in negative and divergent values when \(\Gamma _{n} \approx 10^{-12}\) and appears to perform worse than the GLQ for this application. Finally, the recurrent calculation of \(\Gamma _{n}\) using extended precision arithmetic results in smoothly decreasing and positive values, corroborating the superiority of the method (Fig. 8d). We also note that any deviation of the covariance model parameters from their corresponding ranges given in the third column of Table 1 results in a non-positive definite covariance function, i.e., some \(\Gamma _{n}\) values might be negative (Fig. 9).

Fig. 8
figure 8

Calculation of \(C^{4}\)-Wendland model coefficients using (a) recurrence method with double precision, (b) hybrid method, (c) GLQ (solid lines) and ADQ (dotted lines) numerical integration, and (d) recurrence method with extended precision. Negative coefficients are ignored

Fig. 9
figure 9

Examples of parameters resulting in non-positive definite covariance functions using the \(C^{2}\)-Wendland and \(C^{4}\)-Wendland models. Negative coefficients are ignored

As a final remark, we briefly mention the applicability of the methods developed in Sect. 3 for the analysis of piecewise polynomial covariance functions. Such functions are studied by Sünkel (1978) as non-positive definite approximations of exact covariance functions. In his work, he examined simple approximations using piecewise step functions, linear functions and cubic spline functions (corresponding to piecewise zeroth-, first-, and third-order polynomials, respectively).

7 Summary and conclusions

Despite their simple mathematical form, polynomial functions still provide viable modeling options in applied and natural sciences, including Earth sciences. In an effort to better facilitate the use of such functions in geodetic applications, and specifically in gravity field modeling where certain tasks are performed in the spherical harmonic domain, we developed a recurrent method for the calculation of spherical harmonic coefficients of monomials and polynomials defined on the two-dimensional sphere. We limit our analysis to isotropic polynomial functions; therefore, their spherical harmonic coefficients were evaluated using the discrete Legendre transform. The transition from the discrete Legendre transform to the more generalized compactly supported discrete Legendre transform enabled the extension of our recurrent method to piecewise polynomials and polynomials with compact support.

A numerical assessment of the method was performed to evaluate the accuracy of all recurrence relations. Results indicate that the recurrence relations used for the calculation of coefficients of fixed degree \(n = \{0,1\}\) and increasing polynomial order m quickly become inaccurate due to the propagation of large numerical errors. Since these relations are used for the initialization of the recurrent method, their numerical errors also propagate to the rest of the coefficients. The polynomial order for which the coefficients can be evaluated accurately depends on the interval of support and the overall accuracy requirements of the application under study. The numerical errors of the recurrent method were easily reduced using extended precision arithmetic techniques. Alternatively, a hybrid method was developed for the mitigation of numerical errors, where the coefficients for \(n = \{0,1\}\) were evaluated using numerical integration and the coefficients for \(n > 1\) were evaluated recurrently using standard double precision. Studying the relative accuracy of the hybrid method showed that it allows the accurate calculation of coefficients for higher monomial orders than the double-precision recurrent method. For application where accuracy is important, we recommend the implementation of the recurrent method using extended precision arithmetic.

Based on our developments, we constructed a framework for isotropic B-spline filtering on the sphere and provided explicit expressions for the calculation of B-spline weights and filter kernels in the spatial and spherical harmonic domains. We demonstrated the use of the third-order B-spline filter for reducing the correlated errors in a GRACE-FO monthly gravity field solution. Results showed that the third-order B-spline filter follows the same behavior as other low-pass filters, i.e., a larger window length results in a smoother gravity field solution. Additional analysis of the spectral characteristics of B-spline filters, and comparison with other low-pass filtering techniques, could shed more light on their performance.

We finally examine some positive definite polynomial covariance models in the spatial and spherical harmonic domains. The calculation of their spherical harmonic coefficients is carried out by implementing our recurrent method to analytical expressions that were also developed in this study. The first Schoenberg criterion, stating that a positive definite covariance function has nonnegative coefficients, was experimentally verified for all models. A decay of the coefficients toward zero is also observed for all covariance models. This decay can be attributed to the second Schoenberg criterion that guarantees the convergence of the infinite series of coefficients of positive definite functions. Our numerical investigations showed that the method of calculating spherical harmonic coefficients of positive definite covariance functions is extremely important, especially for higher degrees, since the propagation of even small numerical errors can result in negative coefficients. The recommended approach for calculating spherical harmonic coefficients of polynomial functions for such applications is again the recurrent method using extended precision arithmetic.