Field modeling
We start from the magnetic potential due to an internal source,
$$\begin{aligned} V^{int}(r,\theta ,\phi ,t) = a \sum _{n=1}^N \sum _{m=0}^n \left( \frac{a}{r} \right) ^{n+1} \left[ g_n^m(t) \cos {m \phi } + h_n^m(t) \sin {m \phi } \right] P_n^m(\cos {\theta }), \end{aligned}$$
(1)
where \(r,\theta ,\phi\) are radial distance, colatitude, and longitude in a geocentric spherical coordinate system, t is time, \(a = 6371.2 \, \hbox {km}\) is the approximate mean Earth radius, \(g_n^m(t), h_n^m(t)\) are the timedependent Gauss coefficients representing the internal field, N is the series truncation limit, for which we choose a value of 50, and \(P_n^m(\cos {\theta })\) are the Schmidt seminormalized associated Legendre functions. We represent the time dependence of the Gauss coefficients up to spherical harmonic degree 15 using basis splines (Bsplines),
$$\begin{aligned} g_n^m(t) = \sum _{j=1}^3 g_{n,j}^m N_j(t), \quad h_n^m(t) = \sum _{j=1}^3 h_{n,j}^m N_j(t), \end{aligned}$$
(2)
where \(N_j(t)\) are cubic Bsplines with no interior knots over the model interval. Since we do not place interior knots, this effectively makes each \(g_n^m(t), h_n^m(t)\) a quadratic polynomial over the model interval. For degrees 16 through N, we use static coefficients \(g_n^m(t) = g_n^m\) and \(h_n^m(t) = h_n^m\) to represent the timeindependent lithospheric field.
When fitting satellite measurements, it is also important to account for a low SH degree external field, \({\mathbf {B}}^{ext}({\mathbf {r}},t)\) representing magnetospheric ring and tail current sources. We do not coestimate an external field for our IGRF13 candidates, instead using the CHAOS6 external field model (Finlay et al. 2016; Olsen et al. 2014) as a priori information, which is parameterized by the RC index, which tracks the symmetric part of the magnetospheric ring current and is derived from a network of low and midlatitude observatories. The model which we then fit to the satellite observations is given by
$$\begin{aligned} {\mathbf {B}}^{model}({\mathbf {r}},t) = {\mathbf {B}}^{int}({\mathbf {r}},t) + {\mathbf {B}}^{ext}({\mathbf {r}},t), \end{aligned}$$
(3)
where \({\mathbf {B}}^{int}({\mathbf {r}},t) =  \nabla V^{int}({\mathbf {r}},t)\) represents the internal field sources parameterized by the Gauss coefficients as discussed above.
The Swarm vector measurements are recorded by a fluxgate magnetometer colocated with three star cameras on an optical bench system situated on a boom. Since the Swarm attitude parameters are referenced to the star camera frame, also known as the common reference frame (CRF), the measurements recorded in the vector fluxgate magnetometer (VFM) frame need to be rotated to CRF before completing the rotation to an Earthfixed frame with the attitude rotation. Therefore, the vector measurement in a NorthEastCenter (NEC) Earthfixed frame is given by
$$\begin{aligned} {\mathbf {B}}^{NEC}({\mathbf {r}}_i,t_i) = R_{CRF}^{NEC}({\mathbf {r}}_i,t_i) R_{VFM}^{CRF}(\alpha (t_i),\beta (t_i),\gamma (t_i)) {\mathbf {B}}^{VFM}_i, \end{aligned}$$
(4)
where \({\mathbf {B}}^{VFM}_i\) is the VFM measurement made at \(({\mathbf {r}}_i,t_i)\), \(R_{CRF}^{NEC}\) represents the attitude rotation from CRF to NEC and is provided in the Swarm Level 1b data files as a time series of quaternions, and \(R_{VFM}^{CRF}\) is a rotation from VFM to CRF, parameterized by three timedependent Euler angles, \(\alpha (t),\beta (t),\gamma (t)\). We use a 123 Euler angle convention, and our rotation matrix \(R_{VFM}^{CRF}\) can be found in Alken et al (2020a, Eqs. 23−26). We use Bsplines for the time dependence of the Euler angles,
$$\begin{aligned} \varvec{\alpha }(t) = \sum _j \varvec{\alpha }_j N_j(t), \end{aligned}$$
(5)
where \(\varvec{\alpha }(t) = (\alpha (t),\beta (t),\gamma (t))\) is the vector time series of Euler angles and similarly for the coefficients \(\varvec{\alpha }_j\). Here, we choose the \(N_j(t)\) to be cubic Bsplines with 30day separation between knots. This allows a slow temporal change in the alignment parameters which could be caused by thermal variations on the satellite. The Gauss coefficients parameterizing the internal field are then computed by minimizing the cost function
$$\begin{aligned} \chi ^2 = \sum _{i=1}^{N_{vec}} w_i^{(\varvec{\epsilon })}  \varvec{\epsilon }_i ^2 + \sum _{i=1}^{N_{scal}} w_i^{(f)} f_i^2, \end{aligned}$$
(6)
where
$$\begin{aligned} \varvec{\epsilon }_i&= B^{NEC}({\mathbf {r}}_i,t_i)  {\mathbf {B}}^{model}({\mathbf {r}}_i,t_i), \end{aligned}$$
(7)
$$\begin{aligned} f_i&= F_i   {\mathbf {B}}^{model}({\mathbf {r}}_i,t_i)  \end{aligned}$$
(8)
and \(F_i\) is the Swarm scalar field measurement made at \(({\mathbf {r}}_i,t_i)\). The weights \(w_i^{(\varvec{\epsilon })}, w_i^{(f)}\) are designed to achieve a uniform weighting over all latitudes and longitudes, and are detailed in Alken et al (2020a, p. 15). The minimization problem is nonlinear, and so we use a Levenberg–Marquardt iterative method to determine the final set of Gauss coefficients and Euler angles.
Data selection and preprocessing
We first partition the Swarm A and B data into halforbital tracks, which span from one pole to the other. For each track, we compute a rootmeansquare (rms) difference with respect to spherical harmonic degrees 1–15 of the CHAOS6x9 core field model (Finlay et al. 2016) for each vector component as well as the total field component. Tracks whose rms difference exceeds 200 nT in any component are discarded from the analysis. This procedure aims to remove anomalous data recorded during satellite maneuvers. CHAOS6x9, which is built from data through April 2019, will contain secular variation forecast errors when applied to measurements in late 2019; however, the chosen threshold of 200 nT far exceeds these errors, so the procedure will only discard measurements contaminated by nongeophysical noise. Next, we select data for geomagnetically quiet periods using the Kp and RC indices (Olsen et al. 2014) with the following criteria,

Kp index does not exceed 2 from a time period starting 2 h before the track start time to the track end time.

The temporal change of the RC index dRC/dt does not exceed 3 nT/h from 3 h prior to the track start time to the track end time.
Next, we remove ionospheric field contributions on the dayside with the following criteria,

For quasidipole (QD) (Richmond 1995) latitudes equatorward of \(\pm 55^{\circ }\), the track’s local time of ascending or descending node is between midnight and 05:00.

For QD latitudes poleward of \(\pm 55^{\circ }\), the sun is at least \(10^{\circ }\) below the horizon, according to the zenith angle.

For QD latitudes poleward of \(\pm 55^{\circ }\), we use only scalar field measurements from Swarm to minimize perturbations caused by the highlatitude fieldaligned current systems. Below \(\pm 55^{\circ }\), we use all components (vector and scalar).
Parent models
We built two parent models from two different time periods, one for the DGRF2015 main field candidate, and the other for the IGRF2020 main field and secular variation candidates. For the DGRF2015 parent model, we used a symmetric time window centered on 2015.0. Since the first Swarm data is available on 26 November 2013, our window included data until 5 February 2016. Our final DGRF2015 coefficients were determined by evaluating the Gauss coefficients \(g_n^m(t),h_n^m(t)\) at \(t = 2015.0\) and truncating them to SH degree and order 13. For the IGRF2020 parent model, we used a 3year time window from 16 September 2016 to 16 September 2019. In our previous experience, at least 3 years of data are needed to allow the core field to change enough in order to resolve the smaller high SH degree and order Gauss coefficients and their secular variation and acceleration. Our secular variation model for 2020.0–2025.0 was taken to be the first time derivative of the Gauss coefficients evaluated at the timestamp of the last data point available in our time window (16 September 2019). Denoting this time as \(t_f\), the secular variation coefficients are then \({\dot{g}}_n^m(t_f), {\dot{h}}_n^m(t_f)\), truncated to SH degree and order 8, which was requested by the IGRF13 call. The main field coefficients for 2020.0 were computed by performing a linear extrapolation of our Gauss coefficients from \(t_f\) to 2020.0 using the secular variation at \(t_f\),
$$\begin{aligned} g_n^m(2020)&= g_n^m(t_f) + (2020  t_f) {\dot{g}}_n^m(t_f), \end{aligned}$$
(9)
$$\begin{aligned} h_n^m(2020)&= h_n^m(t_f) + (2020  t_f) {\dot{h}}_n^m(t_f). \end{aligned}$$
(10)
These IGRF2020 coefficients were then truncated to SH degree and order 13 for our final IGRF13 candidate model.