1 Introduction

The Sun has been observed and studied by humans for millennia due to its influence in our lives (Vaquero and Vázquez 2009). In particular, we have sunspot records available before the telescopic era, carried out mainly in Asia (Yau and Stephenson 1988; Vaquero, Gallego, and García 2002). However, the first sunspot drawing was made by a monk from Worcester (England) on 8th December in the year AD 1128 during the period known as the Medieval Solar Maximum and includes two sunspots (Willis and Stephenson 2001). However, more or less systematic sunspot observations started with the use of the telescope as an astronomical instrument at the beginning of the 17th century (Hoyt and Schatten 1998; Vaquero et al.2016; Muñoz-Jaramillo and Vaquero 2018).

The most striking sunspot drawings made in the first years of the telescopic era were carried out by Galileo Galilei, Christoph Scheiner, and Johannes Hevelius (Galilei and Scheiner 2010; Hevelius 1647). Since then, hundreds of observers have made drawings and taken photographs or digital images of the photosphere in order to study the phenomena that take place in it. Sunspot positions can be measured from these drawings or images and provide important information about the solar activity. For example, Ribes and Nesme-Ribes (1993) showed a strong hemispheric asymmetry during the Maunder Minimum from the calculation of the heliographic latitudes of the sunspots recorded by several observers of that time. More recently, Arlt (2009) presented the first butterfly diagram for 18th century from Staudacher’s sunspot records. We can also highlight the sunspot positions measured from Galileo’s (Vokhmyanin and Zolotova 2018) and Horrebow’s (Karoff et al.2019) sunspot records. Moreover, sunspots have been extensively used to calculate the solar rotation rates during past centuries basing on the determination of their heliographic coordinates (Abarbanell and Wöhl 1981; Sánchez-Bajo, Vaquero, and Gallego 2010). In addition, the sunspot area is a main indicator of the solar activity, closely related with other indices as the sunspot number (Carrasco et al.2016). For this reason, accurate measurements of sunspot parameters (positions, areas, etc.) made from historical observations are of great interest.

The calculation of these sunspot parameters from drawings or photographs in historical archives is not a simple task, mainly due to the different instruments, procedures, etc., used by historical solar observers. In this way, the modern computer resources are especially powerful to analyze historical drawings. Regarding this fact, different computer programs have been proposed to measure sunspot parameters from digitized images. Among these programs, Sungrabber (Hrzina et al.2007) has been used to analyze historical sunspot drawings made in 1884 at the Royal Astronomical Observatory of the Spanish Navy (Galaviz et al.2016). In this way, drawings recorded by Zucconi in the period 1754–1760 were analyzed by using HSUNSPOTS (Cristo, Vaquero, and Sánchez-Bajo 2011). More recently, CAMS (Computer Aided Measurement for Sunspots) has been proposed (Çakmak 2014) to determine the heliographic coordinates of sunspot groups besides other parameters as, for example, the group length. In addition, Barata et al. (2018) developed a software to detect solar plages and Carrasco et al. (2018) another one to identify the sunspot umbrae and penumbrae in order to study the umbrae-penumbrae ratio during the Maunder minimum. Although these programs provide good results in the measurement of the sunspot parameters, note that this field is open to enhance not only the technical aspects in the evaluation of them, but also other related with the appearance, flexibility and user-friendliness. In relation to this, in this work, we present the software Soonspot, developed with the aim of improving the functions and manageability presented in previous software of this kind. The outline of the paper is as follows: Section 2 is devoted to the presentation of the main features of the program, including a short guide of use. In Section 3, in order to check the accuracy of the results obtained with Soonspot, we compare the measured sunspot positions and areas of groups included in several solar images taken by the DPD (http://fenyi.solarobs.csfk.mta.hu/) with the data provided by this observatory about these same sunspot groups. Due to its main applicability to the analysis of historical solar observations, we have used Soonspot to analyze sunspot observations made by Hevelius (1647) in Section 4. Finally, the main conclusions of this work are presented in Section 5.

2 Description of the Software

Soonspot is software intended to measure sunspot positions and areas from solar images. It has been programmed in M, the programming language of Matlab (https://www.mathworks.com) and it runs under the Windows operating system. We have used the user interface of Matlab to develop the software. In this way, the user does not have to know the programming code to work with the software and the application is easy to run. The requirements of the computer where the software will be installed are the same as for Matlab since it needs its routines (Matlab Component Runtime) to execute the application. These routines are incorporated in the install setup of the software. We note that the user does not need to install Matlab in their computer, only the Matlab Runtime in order to run the program. Furthermore, the install setup contains the executable file for Soonspot and a “readme” file including information about the installation and use of the program. The software can be downloaded from the website of the Historical Archive of Sunspot Observations (http://haso.unex.es/).

In order to determine the sunspot parameters, users must complete three successive steps with different interfaces. In the first interface (Figure 1, top panel), the solar image must be loaded, the solar limb set and the image binarized. Soonspot can work with several image formats: jpg, tif or tiff and bmp. Moreover, once loaded, the image can be rotated in minimum intervals equal to 0.01°, both clockwise and counterclockwise, according to the needs of the user, without quality losses. A particular advantage of Soonspot over other programs is the ease to fix the solar limb, which is set by clicking in three different points of it, doing finally double click to finish the process. Thus, this task is done independently of the size, illumination or contrast of the image. We note that the solar disks in some historical drawings have an elliptical shape rather than circular and, in that case, the solar limb should be converted to a circle before using Soonspot in order to improve the accurate of the measurements. Once the solar limb is set, the following step involves the binarization of the image, necessary prior to calculate the sunspot areas. In regard to this, the user must select the binarization threshold. Note that the binarization process convert the RGB image (each pixel has a value between 0 and 255 as a function of its color) to a black and white image (each pixel can only have a value equal to 1 if the pixel is white or 0 if black). In this way, the binarization threshold ranges between 0 and 1 and all the pixels below that threshold are considered like black whereas those above the threshold are taken as white. According to this procedure, one can see that higher values of the binarization threshold imply darker binarized images. Once completed the binarization process, it is easy to calculate the area of a sunspot, because this is determined by the number of black pixels corresponding to that sunspot. In addition, as the umbra is darker than penumbra, the user can also measure only the umbral area applying a higher value of the binarization threshold. On the first interface, the user can zoom in any region of interest in order to choose the more suitable threshold. Figure 2 shows an example of binarization. Subsequently, the user must select the sunspots to study clicking the select button, delimiting the area of the sunspot with the mouse pointer and doing double click to save the data (each sunspot is independently saved). When all the sunspots are selected, the user must click on “Next” to pass to the second interface.

Figure 1
figure 1

First (top panel), second (middle panel) and third (bottom panel) interface of Soonspot including a sunspot observation registered by telescope on board of the Solar Dynamic Observatory on 23 March 2015 [source: https://sdo.gsfc.nasa.gov/].

Figure 2
figure 2

Results of the binarization process applied to sunspot 12420 observed on 22 September 2015 (from the Debrecen Photoheliographic Data). The binarization thresholds used were 0.7 (top panel) and 0.4 (bottom panel). Note that the area of the entire sunspot is reproduced in the top panel and only the umbral area of the sunspot in the bottom panel.

The selection of the sunspots can be confirmed in the second interface (Figure 1, middle panel) pressing the button “Set”. In this second step, it can be also selected the orientation of the image with respect to the directions north-south and west-east by a double click on the north and west so that the first of two clicks is further north and west than the second one, respectively. The software also allows one to select the north-south orientation of the image following the Earth or Sun axis. Note that the solar north and west of the image included in Figure 1 are located above and to the right of the image, respectively. Data about the sunspots like the name, area and position (or gravity center if an entire group was selected) in pixel units are displayed at the bottom left in the middle panel.

In order to determine heliographic coordinates, we need the observation date and the solar parameters \(P\), \(B _{0}\) and \(L _{0}\). The observation date (in Gregorian calendar) will be introduced in the third interface, with the hour and minutes expressed in Universal Time. Note that these data can be changed avoiding to select newly the sunspots. Data about sunspots including names, areas (in millionths of solar hemisphere, msh) and heliographic coordinates are shown clicking on “Show Heliographic Coordinates of sunspot”. These data can be saved in a .txt or .xlsx file pressing the button “Save”.

The calculations of the coordinates are carried out using the formulas included in Meeus (1991). Note that the heliographic coordinates are corrected by precession and nutation and the area corrected by foreshortening is (Meadows 2002)

$$ A_{\mathrm{M}} = \frac{10^{6} A_{\mathrm{S}}}{2\pi R^{2} \cos \rho } = \frac{10^{6} A_{\mathrm{S}}}{2\pi R^{2} [ \sin B_{0} \sin B+ \cos B _{0} \cos B \cos ( L- L_{0} ) ]} $$

where \(A _{\mathrm{M}}\) is the sunspot area in millionths of solar hemisphere; \(A _{\mathrm{S}}\), the sunspot area (in pixels); \(R\), the radius of the solar image (in pixels); \(\rho \), the angular distance from the solar disc center to the sunspot; \(B\), the heliographic latitude of the sunspot; \(B _{0}\), the heliographic latitude of the solar disc center; \(L\), the heliographic longitude of the sunspot; and \(L _{0}\), the heliographic longitude of the solar disc center.

3 A Comparison Using Data Recorded at the Debrecen Photoheliographic Data

In order to check the accuracy of the results obtained by Soonspot, we have compared the areas and heliographic coordinates calculated from Soonspot for sunspot groups recorded in several solar images obtained at the DPD (http://fenyi.solarobs.csfk.mta.hu/) with the positions and areas provided by DPD corresponding to the same groups (Table 1). We have selected one observation day per year from 2011 to 2017: 26 November 2011, 15 October 2012, 3 January 2013, 1 March 2014, 22 September 2015, 10 May 2016, and 4 September 2017. The total area of a group is calculated adding the area of all the sunspots of the group and the heliographic coordinates like the average between the sunspots that depicts the limits of each group. The mean error of the difference in the heliographic latitude and longitude measurements corresponding to the same groups obtained by both procedures is 0.14° in latitude and 0.23° in longitude. Furthermore, the maximum difference found in latitude is equal to 0.35°, corresponding to the group named by the DPD as 12415 on 22 September 2015 and 0.69° in longitude, corresponding to the group 11356 recorded by the DPD on 26 November 2011. We have obtained both mean relative errors in latitude and longitude lower than 1%. These results show that Soonspot is an accurate tool to measure heliographic coordinates. Note, for example, that in the analysis of historical drawings, the uncertainty in the positions (unavailable) is the main source of errors and, for this reason, the uncertainties actually measure the precision of the data rather than its accuracy. Thus, we can assume that the errors in the determination of heliographic coordinates are around, in the worst case, one degree. In regard to the comparison of areas, the mean relative errors of the differences in the umbra and total area measurements between both procedures are greater than those obtained in the heliographic coordinates, that is, 23.3% corresponding to total area and 44.6% in the case of the umbral area. In general, the umbral area determined using Soonspot has been underestimated. However, in the case of the total areas, we have overestimated the measurements of the sunspot groups recorded on 26 November 2011, 15 October 2012 and 1 March 2014, whereas total areas were underestimated in the other four cases. These differences are probably due to the different procedures used to determine the sunspot areas, taking into account that the selected binarization threshold is the key parameter to provide the value of the umbral and total areas. Changes in this threshold lead to noticeable changes in these parameters.

Table 1 Comparison between areas and heliographic coordinates obtained from Soonspot and DPD for seven observation days. “Group” column shows the name assigned to each group, “Umbrae” and “Total” give the umbrae and total area (msh) measured according to both procedures, and “B” and “L” the latitude and Carrington longitude, respectively.

4 An Example: The Sunspot Observations Recorded by Hevelius in the 17th Century

We have applied Soonspot to the sunspot observations recorded by Hevelius (1647) as an application example to historical observers. Hevelius made very detailed sunspot observations from the end of the year 1642 to the beginning of 1645. These observations are of great interest because they are the only systematic sunspot observations available just on the onset of the Maunder minimum (Carrasco et al.2019). Hevelius (1647) published these sunspot records in an appendix of the documentary source Selenographia providing both textual descriptions and sunspot drawings. Thus, we calculated the sunspot positions and areas recorded by Hevelius (1647).

Hevelius set a fixed line for the ecliptic which represents the east-west line in the drawings and therefore we have to correct the orientation of the images. First, the orientation of the images must be corrected according to the angle of the ecliptic with respect to the east-west direction of the celestial equator. Second, a sunspot observed in different days is represented in the same drawing. Note that the ecliptic fixed line is not referred to a particular observation day and that fact implies that the position measurements can be affected by a small error due to the daily variation of the orientation of the ecliptic (0.26° in average). For this reason, after correcting the ecliptic angle with respect to the east-west line, a procedure based on the minimization of the latitude variations of the sunspot groups has been used to calculate the heliographic coordinates. These corrections are explained in more detail in Galaviz (2018).

Sunspot positions and areas were measured after carrying out those corrections. The binarization threshold used for the calculations of the total and umbral areas was 0.7 and 0.35, respectively. Figure 3 depicts the sunspot positions calculated for all sunspots recorded by Hevelius (1647). Colors are according to the different area ranges established where dark colors represent the greatest sunspots. We can see that sunspots were observed in the interval ±20° in latitude and slightly appeared more in the northern solar hemisphere (541) than the southern (435) (Carrasco et al.2019). Moreover, we have calculated the average of the umbra-penumbra ratio for all the sunspots obtaining a value equal to 0.26. This value agrees with work carried out in order to study this ratio both during the Maunder minimum (Carrasco et al.2018) and other epochs (Steinegger, Brandt, and Schmidt 1990; Vaquero et al.2005).

Figure 3
figure 3

Sunspot positions according to the sunspot observations recorded by Hevelius (1647). Colors represent different area ranges with dark colors for the greatest areas.

In order to study the distribution of areas, we have obtained the relative size distribution of the umbral and total group areas recorded by Hevelius (1647) (Figure 4). We have followed the methodology employed by Bogdan et al. (1988). Thus, we can see that both the umbral and the total group areas are found to be distributed lognormally such as is shown by Bogdan et al. (1988). We can see that lower areas present a greater deviation with respect to the lognormal distribution than larger areas. This fact can be due to a greater uncertainty in the determination of the lower sunspot areas. On the other hand, we show in Figure 5 how the selection in Soonspot of different binarization thresholds influences in the determination of areas (top panel), heliographic latitudes (middle panel), and longitudes (bottom panel). For that purpose, we have selected the sunspot observation made at DPD on 15 October 2012 where groups G, H, I, J, and K were recorded. According to the group areas, the binarization threshold that should be applied in Soonspot in order to obtain the area values provided by DPD is around 0.7 for all the groups. Note that the vertical gray bar in Figure 5 (top panel) includes all the cut-off between the curves that represent the area calculated from Soonspot applying different binarization thresholds and the area value provided by DPD (represented by the dashed horizontal lines). Furthermore, we can see that the binarization threshold does not provide significant errors in the determination of the heliographic latitudes and longitudes. The greatest differences in the calculation of the latitude and longitude are found in group G for latitudes and H for longitudes. Averaging the values of the latitudes and longitudes obtained from Soonspot for groups G and H applying different thresholds, we obtained a difference equal to 2.5% and 0.8% with respect to the value provided by DPD, respectively.

Figure 4
figure 4

Umbral (left panel) and total (right panel) area distribution according to the sunspot observation recorded by Hevelius (1647). The areas are given in millionths of solar hemisphere (msh).

Figure 5
figure 5

Comparison of the determination of areas (top panel), heliographic latitudes (middle panel) and longitudes (bottom panel) of the sunspot groups recorded by DPD on 15 October 2012 as a function of different binarization thresholds selected in Soonspot. Curves and symbols represents measurements obtained from Soonspot and dashed horizontal lines the data provided by DPD. Red, black, blue, orange, and green colors represent group G, H, I, J, and K recorded by DPD on 15 October 2012, respectively. Areas are given in millionths of solar hemisphere and heliographic latitudes in degrees.

5 Conclusions

We present a program for calculating heliographic coordinates and areas of sunspots from digitized images. The software uses three very simple graphical interfaces. In the first one, sunspots are selected. Here, the images can be rotated without quality loss in order to correct its orientation, the solar limb is set with three simple mouse clicks and a binarization threshold must be selected with the aim to measure correctly the sunspot area and coordinates according to the features of the solar drawing or photograph. In the second one, data about the sunspots like the name, area and position in pixel units are provided. In the third interface, after introducing the observation date, information referred to names, areas and heliographic coordinates are shown about sunspots. These data can be saved in a .txt or .xlsx file.

The program has been checked using modern solar images of the DPD. These results show a very good agreement between the heliographic coordinates determined using Soonspot and data provided by the DPD for the same images. Differences are greater in the case of areas, due to the difficulty in its determination. Furthermore, the program has been used in the analysis of the drawings performed by Hevelius in the 17th century. We show that the number of sunspots observed by Hevelius in the northern hemisphere is slightly greater than the southern. The average value of the umbrae-penumbrae ratio calculated in this work regarding all the sunspots recorded by Hevelius is compatible with values of that parameter obtained in other studies. In addition, we have studied the relative size distribution of the umbral and total group area and they are distributed lognormally such as Bogdan et al. (1988) showed using more recent sunspot observations recorded at the Mount Wilson Observatory. Regarding the measurements of heliographic latitudes and longitudes, we can see that the binarization threshold does not have a significant influence in the calculation. Considering the observation made at DPD on 15 October 2012 and averaging all the values obtained in latitudes and longitudes for the same groups with different thresholds, the greatest differences were obtained for groups G for latitudes and H for longitudes with a value equal to 2.5% and 0.8% with respect to the value provided by DPD, respectively.