### Global-to-local transfer functions

Time-varying electric and magnetic fields are described by Maxwell’s equations, which in the frequency domain are given by

$$\begin{aligned} \begin{aligned} \dfrac{1}{\mu _0}\nabla \times \vec {B}&= \sigma \vec {E} + \vec {j}^{ext} \\ \nabla \times \vec {E}&= -i\omega \vec {B}, \end{aligned} \end{aligned}$$

(1)

where \({\mu _0}\) is the magnetic permeability of free space, \(\sigma (\vec {r})\) the conductivity of the medium, \(\omega\) the angular frequency, and \(\vec {B}(\vec {r},\omega )\) and \(\vec {E}(\vec {r},\omega )\) are the magnetic and electric fields, respectively. \(\vec {j}^{ext}(\vec {r},\omega )\) describes the extraneous current due to daily magnetic field variations. The position vector is defined as \(\vec {r} = (r,\theta ,\phi )\), where \(r, \theta , \phi\) are the distance from Earth’s center, the colatitude, and the longitude in a geographic spherical coordinate system, respectively. At the desired periods, displacement currents can be neglected. If the extraneous current is surrounded by an insulator, thus including the non-conducting atmosphere below the ionosphere, it can be represented as a sheet current (Guzavina et al. 2019):

$$\begin{aligned} \vec {j}^{ext}(\vec {r},\omega ) = -\delta (r-b)\vec {e}_r \times \nabla _{H}\Psi (\Omega ,\omega ), \end{aligned}$$

(2)

with \(\delta\) Dirac’s delta function, \(b = a + h\), \(a = 6371.2\) km is Earth’s mean radius and *h* is the altitude at which the sheet current \(\vec {j}^{ext}(\vec {r},\omega )\) flows. This problem setup implies that we do not calculate the EM field inside the ionosphere. \(\vec {e}_r\) is the radial unit vector of the spherical coordinate system, \(\Omega = (\theta ,\phi )\), and \(\nabla _{H}\Psi\) denotes the tangential gradient of the stream function with

$$\begin{aligned} \nabla _{H} = \vec {e}_{\theta }\dfrac{1}{r}\frac{\partial }{\partial \theta } + \vec {e}_{\phi }\frac{1}{r \sin \theta }\frac{\partial }{\partial \phi }. \end{aligned}$$

(3)

Following the approach by Guzavina et al. (2019), the stream function \(\Psi\) can be described as a linear combination of spatial modes:

$$\begin{aligned} \Psi (\Omega ,\omega _{p}) = \sum _{l \in L^{PB}(p)} \epsilon _{l}(\omega _{p})\Psi _{l}(\Omega ), \end{aligned}$$

(4)

where \(L^{PB}(p)\) is the set of modes obtained from the physics-based approach describing the source at frequency \(\omega _{p}\). We consider \(\omega _p = \dfrac{2\pi p}{T}\), where \(p = 1,2,..,6\) is capped at the 6*th* time harmonic and \(T =\) 24 h. Combining Eq. (2) and Eq. (4), the extraneous current can be written as

$$\begin{aligned} \vec {j}^{ext}(\vec {r},\omega _{p}) = \sum _{l \in L^{PB}(p)} \epsilon _{l}(\omega _{p})\vec {j}_{l}(\vec {r}), \end{aligned}$$

(5)

where

$$\begin{aligned} \vec {j}_{l}(\vec {r}) = - \delta (r-b) \vec {e}_r \times \nabla _{H}\Psi _{l}(\Omega ). \end{aligned}$$

(6)

Recalling Maxwell’s equations then gives

$$\begin{aligned} \begin{aligned} \dfrac{1}{\mu _0}\nabla \times \vec {B}_{l}&= \sigma \vec {E}_{l} + \vec {j}_{l} \\ \nabla \times \vec {E}_{l}&= -i\omega _p\vec {B}_{l}. \end{aligned} \end{aligned}$$

(7)

As Maxwell’s equations are linear with respect to the source, the magnetic field can then be expressed as

$$\begin{aligned} \vec {B}(\vec {r},\omega _{p}) = \sum _{l \in L^{PB}(p)} \epsilon _{l}(\omega _{p})\vec {B}_{l}(\vec {r},\omega _{p}). \end{aligned}$$

(8)

For comparison, the SH parametrization used by Guzavina et al. (2019) for the stream function is given as

$$\begin{aligned} \Psi (\vec {r},\omega _p) = -\dfrac{a}{\mu _0}\sum _{n,m \in L^{SH}(p)} \dfrac{2n+1}{n+1} \left( \dfrac{b}{a}\right) ^n \epsilon _n^m(\omega _p) S_n^m(\Omega ). \end{aligned}$$

(9)

Similar to the PB parametrization, \(L^{SH}(p)\) describes the set of terms using SH parametrization. The source \(\vec {j}^{ext}\) is then written as

$$\begin{aligned} \vec {j}^{ext}(\vec {r},\omega _{p}) = \sum _{n,m \in L^{SH}(p)} \epsilon _n^m(\omega _{p})\vec {j}_n^m(\vec {r}), \end{aligned}$$

(10)

and

$$\begin{aligned} \vec {j}_n^m(\vec {r}) = \dfrac{\delta (r-b)}{\mu _0}\dfrac{2n+1}{n+1}\left( \dfrac{b}{a}\right) ^{n-1} \vec {e}_r \times \nabla _{\perp } S_n^m. \end{aligned}$$

(11)

Here, *n* and *m* denote the degree and order of the spherical harmonic \(S_n^m = P_n^{|m|}(\cos \theta )e^{im\phi }\), with \(P_n^{|m|}\) the Schmidt quasi-normalised associated Legendre functions and \(\nabla _{\perp } = r \nabla _H\). The double sum in Eq. (9) is given as (Schmucker 1999)

$$\begin{aligned} \sum _{n,m \in L^{SH}(p)} = \sum _{m=p-1}^{p+1} \sum _{n=m}^{m+3}. \end{aligned}$$

(12)

With this parametrization, Maxwell’s equations for \(\vec {j}_n^m\) can be written as

$$\begin{aligned} \begin{aligned} \dfrac{1}{\mu _0}\nabla \times \vec {B}_{n}^m&= \sigma \vec {E}_{n}^m + \vec {j}_{n}^m \\ \nabla \times \vec {E}_{n}^m&= -i\omega _p\vec {B}_{n}^m, \end{aligned} \end{aligned}$$

(13)

and the magnetic field can be expressed as

$$\begin{aligned} \vec {B}(\vec {r},\omega _{p}) = \sum _{n,m \in L^{SH}(p)} \epsilon _{n}^m(\omega _{p})\vec {B}_{n}^m(\vec {r},\omega _{p}). \end{aligned}$$

(14)

\(\vec {B}_n^m\) and \(\vec {B}_l\) both represent a set of global-to-local (G2L) “magnetic” transfer functions (TFs). They relate the global source coefficient \(\epsilon _n^m\) (or \(\epsilon _l\), in the case of \(\vec {B}_l\)) to the locally measured magnetic field \(\vec {B}\). In principle, one can obtain three TFs corresponding to each local magnetic field component. However, it is advantageous to use the (observed) tangential components only to estimate \(\epsilon _n^m\) (or \(\epsilon _l\)). This is due to a reduced sensitivity of the tangential components to the subsurface conductivity (Kuvshinov 2008). Furthermore, only the “radial” TF is estimated, relating the local radial component of the magnetic field with the pre-estimated \(\epsilon _n^m\) (or \(\epsilon _l\)). In the nomenclature of Püthe et al. (2015) this TF is denoted as \(T_n^m\) and reads

$$\begin{aligned} Z(\vec {r},\omega _{p}) = \sum _{n,m \in L^{SH}(p)} \epsilon _{n}^m(\omega _{p})T_n^m(\vec {r},\omega _{p}), \end{aligned}$$

(15)

where \(Z = -B_r\) and \(T_n^m = -B_{n,r}^m\). In our case “radial” TFs are expressed as

$$\begin{aligned} Z(\vec {r},\omega _{p}) = \sum _{l \in L^{PB}(p)} \epsilon _l(\omega _{p})T_l(\vec {r},\omega _{p}), \end{aligned}$$

(16)

where \(T_l = -B_{r}^l\).

### Obtaining spatial modes

To obtain the spatial modes introduced in Eq. (4), we use the stream function \(\Psi\) given by TIE-GCM. TIE-GCM is a numerical solver simulating the dynamics, composition, electrodynamics, and temperature of the coupled thermosphere–ionosphere system (Roble et al. 1988; Qian et al. 2014; Maute 2017). The TIE-GCM simulation employed in this study is described in Egbert et al. (2020), and the main points are repeated herein for context. The simulated ionospheric current has contributions from the neutral wind dynamo, gravity, and plasma pressure-gradient forcing (Maute and Richmond 2017a), and high-latitude magnetosphere–ionosphere coupling. The tidal and wave variability at the lower boundary of TIE-GCM (approximately at 97 km) is informed by 3-hourly Modern-Era Retrospective analysis for Research and Applications (MERRA) reanalysis data for the year 2009 (Häusler et al. 2010; Maute 2017). The magnetosphere–ionosphere coupling at high latitudes is simulated using empirical ion convection (Heelis et al. 1982) and auroral particle precipitation (Emery et al. 2012) patterns driven by the 3-hourly Kp index. The TIE-GCM simulation is conducted for the solar maximum conditions by using 2002 values for F10.7 and Kp. The full three-dimensional divergence-free ionospheric current system and its associated magnetic perturbation is determined using a stand-alone electrodynamics module (Maute and Richmond 2017a). One of the outputs from this model is the desired stream function computed for the period between January 13th 01:00 and December 16th 24:00 2009 at a “coarse” \(2^{\circ } \times 5^{\circ }\) grid with a sampling interval of 1 h. Examples of the TIE-GCM stream function for equinoctial and solstice days are presented in Figs. 1 and 2.

Since we will work in the frequency domain, TIE-GCM \(\Psi\) is first converted from the time to frequency domain by applying a Fourier transform (FT) to the \(\Psi\) time series at all grid points. The length of the time segment on which FT is applied is referred to as segment length *s*. The total number of non-overlapping segments *S* is given as \(S = M/s\), where *M* is the time series’ total length. We then construct a matrix *F* for each period \(\omega _p\) as

$$\begin{aligned} F(\omega _{p}) = \begin{pmatrix} \Psi _{1}^{1}(\omega _{p}) &{} \Psi _{2}^{1}(\omega _{p}) &{} \cdots &{} \Psi _{N}^{1}(\omega _{p}) \\ \Psi _{1}^{2}(\omega _{p}) &{} \Psi _{2}^{2}(\omega _{p}) &{} \cdots &{} \Psi _{N}^{2}(\omega _{p}) \\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ \Psi _{1}^{S}(\omega _{p}) &{} \Psi _{2}^{S}(\omega _{p}) &{} \cdots &{} \Psi _{N}^{S}(\omega _{p}) \end{pmatrix}, \end{aligned}$$

(17)

where *N* is the number of grid points. Thus \(\Psi _{i}^{j}\) is the time-spectra estimate at the *j*th time segment at the *i*th grid point. Furthermore, according to the PCA concept, we form the covariance matrix *R*:

$$\begin{aligned} R(\omega _{p}) = F(\omega _{p})^{H}F(\omega _{p}) \end{aligned}$$

(18)

and apply to *R* an eigenvalue decomposition. Here, the superscript *H* denotes the Hermitian transpose. The eigenvectors represent the eigenmodes \(\Psi _l\), or principal components (PCs), whereas the eigenvalues give the respective PC’s variance contribution. The PCs are uncorrelated over space, as they are eigenvectors that are orthogonal to each other (Björnsson and Venegas 1997). They are usually sorted in order from the largest to the smallest eigenvalues. The PC corresponding to the largest eigenvalue will explain the most variance, followed by the second, third PC, etc. In practice, the PCs corresponding to a few of the largest eigenvalues explain most of the analyzed fields’ variance. The cumulative variance of *n* PCs can be calculated as (e.g., Alken et al. 2017; Egbert et al. 2020)

$$\begin{aligned} \kappa _{n} = \dfrac{\sum \limits ^{n}_{i=1} \lambda _{i}}{\sum \limits ^{N}_{i=1} \lambda _{i}}, \end{aligned}$$

(19)

where \(\lambda _i\) is the eigenvalue corresponding to *i*th PC, and *N* the total number of modes which in our case equals the number of grid points, i.e., \(N = 90 \times 72 = 6480\). As it will be shown later in the paper, one needs at most 25 PCs (spatial modes) to explain more than 99% of the variance. This is a dramatic reduction from the total 6480 spatial modes. Moreover, even fewer modes are needed to achieve a meaningful agreement when fitting the data in practice. This will be discussed later in the paper.

### Estimating external source coefficients

Figure 3 presents a workflow to estimate the external source coefficients, which are further used to assess the agreement with observatory data. Specifically, PCA is first applied to the output from the physics-based model. PCA is performed for different months and time series lengths to analyze the influence of different PCA setups on the resulting fit. Second, from the recovered modes \(\Psi _{l}(\omega _p)\) (determined at a coarse, \(2^{\circ } \times 5^{\circ }\), grid) the extraneous current \(\vec {j}_{l}\) produced by each mode \(1,2,..,L^{PB}\) at period \(\omega _p\) is calculated according to Eq. (6) using finite differences. The number of \(L^{PB}\) is investigated during the analysis and will be discussed later in the paper. Furthermore, \(\vec {j}_{l}\) is interpolated at a finer, \(1^{\circ } \times 1^{\circ }\), grid. The finer grid is required to compute the magnetic field \(\vec {B}_{l}\) as accurate as feasible. The magnetic field computation relies on a numerical solution of Maxwell’s equations given in Eq. (7). This is done with the use of the X3DG solver (Kuvshinov 2008) which is based on a volume integral equation approach with contracting kernel (cf. Pankratov and Kuvshinov 2016). The solver requires—along with \(\vec {j}_{l}\)—a reference model of Earth’s conductivity; here, the conductivity distribution described by Grayver et al. (2017) is used. Specifically, the conductivity model consists of a radially varying 1-D structure throughout the Earth with a layer of laterally varying conductance (of \(1^{\circ } \times 1^{\circ }\) resolution) at the surface, accounting for the non-uniform distribution of the oceans and continents.

The external source coefficients \(\epsilon _l\) described in Eq. (8) are calculated from the X3DG-derived tangential magnetic fields and the hourly-mean tangential magnetic fields from the global network of geomagnetic observatories. A detailed description of the observatory data used for the external coefficients’ estimation can be found in Guzavina et al. (2019). Time spectra of the observatory magnetic fields are obtained at time harmonics of daily variations (i.e., at periods 24, 12, 8, 6, 4.8, and 4 h) for every day of the considered time interval. The source coefficients are estimated for the *k*th day (\(k=1,2,..., K\)) and *p*th frequency (\(p=1,2,...,6\)) using a Huber-weighted robust regression method (Aster et al. 2018) as applied to the following minimization problem:

$$\begin{aligned} \left\| {\mathbf {d}}_{k}(\omega _p) - \text {H}(\omega _p, \{ \sigma \}) \, {\tilde{{\epsilon }}}_k(\omega _p) \right\| _{\text {Huber}} \underset{{\tilde{{\epsilon }}}_k(\omega _p)}{\longrightarrow }\min , \end{aligned}$$

(20)

where *k* denotes the *k*th day, *K* is the number of days, \({\mathbf {d}}_{k}(\omega _p)\) is a data vector containing the *p*th time spectra of the observed tangential magnetic fields for the *k*th day, \({\tilde{{\epsilon }}}_k(\omega _p)\) is a vector with the estimated external source coefficients, and *H* is a matrix containing the predicted tangential magnetic fields. \(\{ \sigma \}\) denotes the 3-D conductivity distribution in the reference model described above. As an example, for *p* = 1 (period of 24 h), the corresponding vectors and matrix look as follows:

$$\begin{aligned} {\mathbf {d}}_{k}= & {} (X_{k}^{\text {obs}}(\vec {r}_1, \omega _{1}), \cdots , X_{k}^{\text {obs}}(\vec {r}_N, \omega _{1}), Y_{k}^{\text {obs}}(\vec {r}_1, \omega _{1}), \cdots , Y_{k}^{\text {obs}}(\vec {r}_N, \omega _{1}))^T, \end{aligned}$$

(21)

$$\begin{aligned} {\tilde{{\epsilon }}}_k= & {} ({{\tilde{\epsilon }}}_{1,k}(\omega _{1}), {{\tilde{\epsilon }}}_{2,k}(\omega _{1}), \cdots , {{\tilde{\epsilon }}}_{L^{PB}(1),k}(\omega _{1}))^T, \end{aligned}$$

(22)

$$\begin{aligned} \text {H}= & {} \begin{pmatrix} X_{1}(\vec {r}_1, \omega _{1}, \{ \sigma \}) &{} X_{2}(\vec {r}_1, \omega _{1}, \{ \sigma \}) &{} \cdots &{} X_{L^{PB}(1)}(\vec {r}_1, \omega _{1}, \{ \sigma \})\\ X_{1}(\vec {r}_2, \omega _{1}, \{ \sigma \}) &{} X_{2}(\vec {r}_2, \omega _{1}, \{ \sigma \}) &{} \cdots &{} X_{L^{PB}(1)}(\vec {r}_2, \omega _{1}, \{ \sigma \})\\ \vdots \\ X_{1}(\vec {r}_N, \omega _{1}, \{ \sigma \}) &{} X_{2}(\vec {r}_N, \omega _{1}, \{ \sigma \}) &{} \cdots &{} X_{L^{PB}(1)}(\vec {r}_N, \omega _{1}, \{ \sigma \})\\ Y_{1}(\vec {r}_1, \omega _{1}, \{ \sigma \}) &{} Y_{2}(\vec {r}_1, \omega _{1}, \{ \sigma \}) &{} \cdots &{} Y_{L^{PB}(1)}(\vec {r}_1, \omega _{1}, \{ \sigma \})\\ Y_{1}(\vec {r}_2, \omega _{1}, \{ \sigma \}) &{} Y_{2}(\vec {r}_2, \omega _{1}, \{ \sigma \}) &{} \cdots &{} Y_{L^{PB}(1)}(\vec {r}_2, \omega _{1}, \{ \sigma \})\\ \vdots \\ Y_{1}(\vec {r}_N, \omega _{1}, \{ \sigma \}) &{} Y_{2}(\vec {r}_N, \omega _{1}, \{ \sigma \}) &{} \cdots &{} Y_{L^{PB}(1)}(\vec {r}_N, \omega _{1}, \{ \sigma \})\\ \end{pmatrix}. \end{aligned}$$

(23)

Here, the superscript *T* denotes the transpose of a vector, \(X = -B_\theta\) and \(Y = B_\phi\) are north- and east-directed magnetic field components, respectively. Note that the number of geomagnetic observatories used for the external coefficients’ estimation can be adjusted for their latitudinal position. In the paper, we explore two sets of observatory data: data from observatories from all latitudes and observatories with geomagnetic latitudes restricted to poleward of \(\pm 5^{\circ }\) and equatorward of \(\pm 55^{\circ }\). With the latter restrictions, the influence on the results of both the equatorial and auroral electrojets can be minimized.

### Assessing the agreement with observatory data

To quantitatively assess the performance of different setups during the PCA analysis, we will use the coefficient of determination \(R^2\), which is defined as

$$\begin{aligned} R^2_k ({\mathcal {B}}, \omega _p) = 1-\dfrac{\sum \limits ^N_{j=1}|{\mathcal {B}}_k^{\text {obs}}(\vec {r}_j,\omega _p) - {\mathcal {B}}_k^{\text {pred}}(\vec {r}_j,\omega _p,\{ \sigma \})|^2}{\sum \limits ^N_{j=1}|{\mathcal {B}}_k^{\text {obs}}(\vec {r}_j,\omega _p) - \overline{{\mathcal {B}}}_k^{\text {obs}}(\omega _p)|^2} \end{aligned}$$

(24)

where \(\vec {r}_j\) is the observatory location, \({\mathcal {B}}\) stands for either magnetic field component *X*, *Y*, or *Z*. \(\overline{{\mathcal {B}}}\) is the mean of the observed magnetic field component over *N* used observatories at day *k*, and it is calculated as

$$\begin{aligned} \overline{{\mathcal {B}}}_k^{\text {obs}}(\omega _p) = \dfrac{1}{N} \sum _{j=1}^N {\mathcal {B}}_k^{\text {obs}}(\vec {r}_j,\omega _p). \end{aligned}$$

(25)

The predicted fields are calculated as

$$\begin{aligned} {\mathcal {B}}_k^{\text {pred}}(\vec {r}_j,\omega _p,\{ \sigma \}) = \sum _{l \in L^{PB}(p)} \epsilon _{l,k}(\omega _p) {\mathcal {B}}_l(\vec {r}_j,\omega _p,\{ \sigma \}). \end{aligned}$$

(26)

The closer this coefficient is to one, the better the accumulative (i.e., across all observatories) agreement between predicted and observed (i.e., estimated from the data) magnetic fields at the *p*th frequency/period.