Reconstructing the Past of Magnetic Declination at the Real Observatorio de Madrid †

: The agonic line, characterized by zero values of geomagnetic declination, has had a westward drift during the last centuries, crossing the location of the Real Observatorio de Madrid at the end of the year 2021. This fact, which was monitored by the Instituto Geogr á fico Nacional, moves us to study the evolution of the magnetic declination in this emblematic emplacement between the last two crosses of the agonic line. Our results point out that the current westward drift started around the year 1810 and, before this period, the agonic line moved from west to east, crossing the location of the Real Observatorio around 1650–1675.


Introduction
During the last months of the year 2021, the agonic line, or 0 • magnetic declination line, crossed the location of the Real Observatorio de Madrid (ROM), changing the declination value in this emplacement from the west (negative values) to east (positive values).This westward drift of the agonic line was monitored at the Instituto Geográfico Nacional (IGN, https://www.ign.es/web/ign/portal/paso-de-la-linea-agona-por-madridaccessed on 27 December 2023), by deducting the declination value at the ROM coordinates through the geomagnetic field variations measured at the Observatorio Geofísico de San Pablo de los Montes (SPT).This is not the first time that the sign change of the declination has taken place at the ROM location due to the drifting movement toward the east or west of the agonic line.The last time this event occurred was during the opposite eastward drift of the agonic line.
The interest in monitoring the cross of the agonic line by the ROM, a center without a great tradition in the study of geomagnetism, comes because it was the first place in Spain where daily measurements of magnetic declination and inclination were made along September 1855 [1].Later, this observatory was the first center of the Instituto Geográfico Nacional where daily measurements of these parameters were obtained between 1879 and 1901 [2].These measurements provided ROM with a historical position in the geomagnetic community and aroused in us an interest in knowing the evolution of the geomagnetic declination in this place since the last cross of the agonic line.

Materials and Methods
There are very few magnetic declination data observed in Madrid.Apart from the measurements taken at ROM between 1879 and 1901 and the rejected ones of 1855 due to some measurement errors, we only found a determination obtained by Dr. Lamont in 1858 at ROM [3], and other three previous values for Madrid City [1].
With this scarce amount of data, it was impossible to reconstruct the evolution of the declination at ROM, so we need to select other sources of data to obtain a curve of variation of declination for this emplacement.

Selection of Data
The most important and accurate source of declination data is the measurements obtained at Geomagnetic Observatories.Data from all observatories that IGN has had working in the Iberian Peninsula along the 20th century were selected.Data from other observatories in Spain such as the Real Observatorio de la Armada and the Observatorio del Ebro were also selected.
Further, in order to complete the coverture of data, data from other observatories that have worked in Portugal (Lisbon and Coimbra) and the south of France (Toulouse and Perpignan) were selected.Table 1 shows information about data selected from observatories in Spain, France and Portugal.Since these data only cover the second half of the 19th century, in order to go back in time, the declination data was completed using the HISTMAG database [4].This is a database that integers historical geomagnetic data from all around the world along with other non-direct geomagnetic information such as archeomagnetic and volcanic data.Using this database, we select the declination data located in a circular area of 1000 km of radius around San Pablo de los Montes Observatory and covering a temporal period from 1500 to 1900.The result provides a set of 3483 declination values, mainly from marine expeditions around the Iberian Peninsula, and less frequently from measurements on land.

Relocation of Data
All data selected in the previous section (observatory and historical data) were relocated to the ROM coordinates (latitude = 40.400• N; longitude = 3.6879 • W) using the declination spatial gradient obtained from two geomagnetic models.For data between 1590 and 1900, the GUFM1 model [5] was considered, and for data after 1900, the IGRF-13 model [6] was used.The final relocated data is plotted versus time in Figure 1.

Preliminary Declination Curve
By means of a bootstrapping method applied to the relocated data, we obtain a preliminary curve.This approach provides a temporal fitting taking into account a base of penalised cubic B-splines.The error margins of the curve were estimated considering three different uncertainty values in the declination measurement according to the date on which they were obtained: 1' for observatory data after 1900; 0.5° for historical data between 1750 and 1900; and 1° for historical data before 1750.
The result was a declination curve for the ROM that was presented at the 10th Spanish-Portuguese Assembly of Geodesy and Geophysics [7].This declination curve showed a minimum declination value of −20.8° in the year 1811, and then a progressive increase until it obtained a 0° value at the end of 2021.The previous value of 0° was situated at ROM for the year 1668.

Improvement of Curve Fitting
The above-cited preliminary study shows the evolution of the declination at ROM for the last 432 years.Nevertheless, an improvement has been made considering some data selections and fitting parameters that were not considered in the previous study.
As in the previous case, we apply a bootstrap method to generate the declination curve, but now the data is ranked into two categories: historical data covering the earliest times up to 1950, and the instrumental data series covering from 1850 to the most modern values.
The smoothing parameter of the declination curve (λ) has been modified in the fitting approach showing an optimal value of λ = 0.1 for the historical data and λ = 0.001 for the instrumental series.Additionally, it has been considered a set of b-spline functions separated by knot points every 20 and 40 years for each kind of data, respectively.To obtain the error bars of the declination curve, the bootstrap approach considers a total of 1000 iterations.
The resulting curves with the error bands obtained by applying the above-mentioned approach have been merged at 1900 resulting in the declination curve for the ROM (see Figure 1).

Declination Data Residual
Once the optimal declination curve for the ROM is obtained, it has been calculated the residues of each database used in the calculation process with respect to the fitted curve.

Preliminary Declination Curve
By means of a bootstrapping method applied to the relocated data, we obtain a preliminary curve.This approach provides a temporal fitting taking into account a base of penalised cubic B-splines.The error margins of the curve were estimated considering three different uncertainty values in the declination measurement according to the date on which they were obtained: 1 ′ for observatory data after 1900; 0.5 • for historical data between 1750 and 1900; and 1 • for historical data before 1750.
The result was a declination curve for the ROM that was presented at the 10th Spanish-Portuguese Assembly of Geodesy and Geophysics [7].This declination curve showed a minimum declination value of −20.8 • in the year 1811, and then a progressive increase until it obtained a 0 • value at the end of 2021.The previous value of 0 • was situated at ROM for the year 1668.

Improvement of Curve Fitting
The above-cited preliminary study shows the evolution of the declination at ROM for the last 432 years.Nevertheless, an improvement has been made considering some data selections and fitting parameters that were not considered in the previous study.
As in the previous case, we apply a bootstrap method to generate the declination curve, but now the data is ranked into two categories: historical data covering the earliest times up to 1950, and the instrumental data series covering from 1850 to the most modern values.
The smoothing parameter of the declination curve (λ) has been modified in the fitting approach showing an optimal value of λ = 0.1 for the historical data and λ = 0.001 for the instrumental series.Additionally, it has been considered a set of b-spline functions separated by knot points every 20 and 40 years for each kind of data, respectively.To obtain the error bars of the declination curve, the bootstrap approach considers a total of 1000 iterations.
The resulting curves with the error bands obtained by applying the above-mentioned approach have been merged at 1900 resulting in the declination curve for the ROM (see Figure 1).

Declination Data Residual
Once the optimal declination curve for the ROM is obtained, it has been calculated the residues of each database used in the calculation process with respect to the fitted curve.
For this, it has been considered the two independent types of data: historical data and instrumental data, as defined above.
The histograms of the residuals obtained for each series are shown in Figure 2. The histogram of the historical data (Figure 2a) points out the sum of two types of distributions: a Gaussian distribution plus a Laplacian distribution, both centered at 0 • .The histogram of the instrumental data (Figure 2b) follows a Gaussian distribution centered at 0 • .These results indicate an appropriate fitting of both kinds of data to obtain the declination curve at the ROM coordinates.
For this, it has been considered the two independent types of data: historical data and instrumental data, as defined above.
The histograms of the residuals obtained for each series are shown in Figure 2. The histogram of the historical data (Figure 2a) points out the sum of two types of distributions: a Gaussian distribution plus a Laplacian distribution, both centered at 0°.The histogram of the instrumental data (Figure 2b) follows a Gaussian distribution centered at 0°.These results indicate an appropriate fitting of both kinds of data to obtain the declination curve at the ROM coordinates.

Discussion and Conclusions
In this work, an improvement of the declination curve for the ROM obtained in previous work has been carried out.The new declination curve has a better variability than the preliminary one and it is better adapted to original data.The goodness of the new fit has been verified with the distribution of the residuals obtained between the original data and the fitted curve.
According to the new curve, the declination presented an eastward drift up to 1810 crossing the agonic line by the ROM around 1657 (see Figure 3).Then, the declination turns to a westward drift crossing again the agonic line at the ROM coordinates at the end of 2021.

Discussion and Conclusions
In this work, an improvement of the declination curve for the ROM obtained in previous work has been carried out.The new declination curve has a better variability than the preliminary one and it is better adapted to original data.The goodness of the new fit has been verified with the distribution of the residuals obtained between the original data and the fitted curve.
According to the new curve, the declination presented an eastward drift up to 1810 crossing the agonic line by the ROM around 1657 (see Figure 3).Then, the declination turns to a westward drift crossing again the agonic line at the ROM coordinates at the end of 2021.
For this, it has been considered the two independent types of data: historical data and instrumental data, as defined above.
The histograms of the residuals obtained for each series are shown in Figure 2. The histogram of the historical data (Figure 2a) points out the sum of two types of distributions: a Gaussian distribution plus a Laplacian distribution, both centered at 0°.The histogram of the instrumental data (Figure 2b) follows a Gaussian distribution centered at 0°.These results indicate an appropriate fitting of both kinds of data to obtain the declination curve at the ROM coordinates.

Discussion and Conclusions
In this work, an improvement of the declination curve for the ROM obtained in previous work has been carried out.The new declination curve has a better variability than the preliminary one and it is better adapted to original data.The goodness of the new fit has been verified with the distribution of the residuals obtained between the original data and the fitted curve.
According to the new curve, the declination presented an eastward drift up to 1810 crossing the agonic line by the ROM around 1657 (see Figure 3).Then, the declination turns to a westward drift crossing again the agonic line at the ROM coordinates at the end of 2021.

Figure 1 .
Figure 1.Fitted declination curve obtained for the Real Observatorio de Madrid (blue solid line) and its error margins (red dashed lines).In the background, relocated data that have been used for curve fitting (grey dots).

Figure 1 .
Figure 1.Fitted declination curve obtained for the Real Observatorio de Madrid (blue solid line) and its error margins (red dashed lines).In the background, relocated data that have been used for curve fitting (grey dots).

Figure 2 .
Figure 2. Distribution of residuals between original data and the fitted declination curve of the ROM: (a) histogram of residuals for the historical data series; (b) histogram of residuals for the instrumental data series.

Figure 3 .
Figure 3. Detail of the declination curve.The yellow cross shows the date when the declination at ROM had a 0° value, changing from east values (positive) to west values (negative).

Figure 2 .
Figure 2. Distribution of residuals between original data and the fitted declination curve of the ROM: (a) histogram of residuals for the historical data series; (b) histogram of residuals for the instrumental data series.

Figure 2 .
Figure 2. Distribution of residuals between original data and the fitted declination curve of the ROM: (a) histogram of residuals for the historical data series; (b) histogram of residuals for the instrumental data series.

Figure 3 .
Figure 3. Detail of the declination curve.The yellow cross shows the date when the declination at ROM had a 0° value, changing from east values (positive) to west values (negative).

Figure 3 .
Figure 3. Detail of the declination curve.The yellow cross shows the date when the declination at ROM had a 0 • value, changing from east values (positive) to west values (negative).

Table 1 .
Geomagnetic observatories where the declination data have been selected.