Counting sunspot groups automatically: how the grouping rule sets the sunspot number

A 2024 study grouped sunspots on SDO/HMI images by machine and got the relative sunspot number to within 0.91 correlation of the official series. We rebuild its arithmetic and show why grouping, not spot finding, is the hard part.

The relative sunspot number is the longest-running measurement in astronomy, and it is not a count of spots. It is R = k (10 g + s), where g is the number of spot groups, s the number of individual spots and k a factor that matches one observer to the standard. A group is worth ten spots, which means that whoever draws the boundaries around the groups decides the answer. A 2024 paper in The Astronomical Journal built an automatic pipeline that finds, segments and groups spots on daily SDO/HMI continuum images of the Sun and reports R without a human in the loop. This article rebuilds that arithmetic with the sunspot counter, which does the same four steps in your browser on your own photograph, and shows how far R moves when only the grouping rule changes. To go further, fit the counts over a cycle with the solar cycle fitter and plan your own white-light session with the sun position calculator.

The paper in brief

The authors took one SDO/HMI continuum image a day at 08:45 UT, 507 of them, from January 2022 to May 2023, near the rise of solar cycle 25. Their pipeline is deliberately simple. A morphological closing with a disc-shaped element removes the spots and leaves a clean solar surface; subtracting that from the original leaves the dark regions. A fixed grey-level threshold (a lower one near the limb, to allow for limb darkening) turns those into candidate spots, and candidates that are too small or too shallow are thrown away. Nearby spots are then merged by erosion: shrinking each region until neighbours touch, so that one bounding box holds one group.

Their worked example is the image of 14 January 2022: 15 spots in 9 groups, so R = 10 × 9 + 15 = 105. Over the whole run they report a grouping and detection accuracy of 85.3 %, a correlation of 0.91 with the international (SILSO) series, and a scaling factor K = 1.03 for HMI continuum images, which is the k of Wolf’s formula for this particular “observer”. The honest part of the paper is that it says where the error lives: grouping. An earlier automatic method they cite reached only 44 % group-recognition accuracy, and another differed from the Wolf number by about 10 %.

Checked with the tools

The paper publishes no spot positions, so we cannot re-run its images. Instead we made our own synthetic white-light Sun with exactly the make-up of its worked example: 15 umbrae arranged in 9 groups on a limb-darkened disc (limb-darkening coefficient 0.6, penumbrae at 0.75 and umbrae at 0.3 of the local surface brightness, as the tool’s own demo image uses). The positions are our assumption. Then we ran the Sunspot counter’s real pipeline over it: findDisc, findSpots, groupSpots, wolfNumber.

Step 1: the detection. The tool found the disc at a radius of 314.2 pixels in a 700-pixel image and picked out 11 dark regions holding 15 umbral cores. That is the situation a real counter faces: the number of regions is not the number of spots, because several umbrae can share one penumbra, and the Wolf number counts umbrae (a region with none, a pore, counts as one).

Step 2: the grouping, and the paper’s number. At the page’s default grouping distance of 10° on the Sun, the tool reports g = 9, s = 15, R = 105 — the paper’s own figure, from an independent pipeline. With the paper’s HMI factor K = 1.03 it becomes 108.2.

Step 3: how much the rule matters. Figure 1 sweeps the grouping distance from 2° to 30°. Below about 8° our sprawling first group breaks into three and R climbs to 125; above about 18° two separate groups merge and R falls to 85, then to 65 by 25°. The answer is flat at 105 only between 8.5° and 18°. In other words, one image can legitimately give R from 65 to 125 depending on a single setting — a spread of nearly a factor of two.

One image, one grouping rule: the sunspot number movesOne image, one grouping rule: the sunspot number moves608010012051015202530Grouping distance (degrees on the Sun)Relative sunspot number Rthe paper’s R = 10510° defaultk = 1 (Zurich)K = 1.03 (the paper’s HMI factor)fibub.com
Figure 1. The relative sunspot number the Sunspot counter gets from one synthetic white-light image that holds 15 spots in 9 groups, as the grouping distance is changed. The plateau is the paper’s R = 105. Our image, not the paper’s.
Grouping distance Tool: g Tool: s Tool: R (k = 1) Tool: R (K = 1.03)
4° 11 15 125 128.8
6° 11 15 125 128.8
10° (default) 9 15 105 108.2
15° 9 15 105 108.2
20° 7 15 85 87.5
25° 5 15 65 67.0

Step 4: where an 85 % accuracy lands. Figure 2 is the simple consequence of the formula. Get one group wrong and R moves by 10 k; get one spot wrong and it moves by 1. On the paper’s example, miscounting a single group out of nine is a 9.5 % error in R, which is the same size as the ~10 % discrepancy the paper quotes for earlier automatic methods. Miscounting a single spot out of fifteen is a 0.95 % error. An automatic counter can afford to be sloppy about spots and must not be sloppy about groups.

Why grouping, not spot finding, sets the errorWhy grouping, not spot finding, sets the error80100120140-3-2-10123Miscount (groups or spots) away from the truthRelative sunspot number RR = 105wrong by n groupswrong by n spotsfibub.com
Figure 2. In R = k (10 g + s), one group counted wrongly moves R by 10, one spot by 1. This is why an automatic method is judged on its grouping.
Check Paper Our tool result
Worked example, 14 January 2022 15 spots, 9 groups, R = 105 g = 9, s = 15, R = 105 from our synthetic image at the default 10°
HMI scaling factor applied K = 1.03 R = 108.2
Cost of one grouping mistake ~10 % quoted for earlier methods 9.5 % (105 → 95 or 115)
Cost of one spot mistake not quoted 0.95 % (105 → 104 or 106)
Range over plausible grouping rules one rule only (erosion, fixed element) 65 to 125 for the same image, 2° to 30°

How we made the graphs

The charts and every number come from scripts/blog-figures/sunspot-grouping-hmi-automatic-relative-sunspot-number.mjs in fibub’s public code. It calls findDisc, findSpots, groupSpots, wolfNumber and spotCount from src/lib/sci/sunspots.ts, the maths behind the sunspot counter, and converts the page’s “degrees on the Sun” to the chord the clustering uses exactly as the tool page does: link = 2 sin(degrees / 2), in units of the disc radius, measured in three dimensions on the sphere so that spots squeezed together near the limb are not merged too eagerly.

From the paper: the 9 groups, 15 spots and R = 105 of the 14 January 2022 example, and K = 1.03. Our assumptions: the spot positions, the umbra and penumbra sizes, the limb-darkening coefficient of 0.6, the 700-pixel image and the pixel noise. The image is ours, not the paper’s, and nothing here is a reanalysis of SDO/HMI data.

How we test the maths

On every change to fibub, tests/sci.mjs runs the sunspot checks:

  • On the tool’s own demo Sun, findDisc must put the disc centre within 1 pixel and the radius within 2 pixels of the planted values (304 px and 264 px), and grouping at 10° must give g = 3, s = 7 and R = 37 — the number the tool page shows for its example.
  • A browser test in tests/run.mjs drives the live page: it reads “R = 37: 3 groups and 7 spots”, taps the lone spot to get “R = 26: 2 groups and 6 spots”, adds one by hand to get “R = 48: 4 groups and 8 spots”, and with k = 0.6 checks the page prints “R = 0.6 × (10 × 4 + 8) = 28.8”.
  • New with this article, in tests/sci-tools/sunspot-counter.mjs: our synthetic Sun built to the paper’s worked example must give 11 regions holding 15 umbrae, g = 9, s = 15 and R = 105 at 10°, R = 108.15 with K = 1.03, and the grouping plateau must run from 8.5° to 18°, with R = 125 at 4° and 65 at 25°.

Check it yourself

On the sunspot counter page you can repeat the group-sensitivity test in under a minute:

  1. Press Load the example. The Sunspot count panel reads R = 37: 3 groups and 7 spots.
  2. Leave Spot sensitivity on normal and Group spots closer than on 10° on the Sun.
  3. Type 1.03 into Your k factor, the paper’s HMI value. R becomes 38.1, and the panel spells the arithmetic out as 1.03 × (10 × 3 + 7).
  4. Set Group spots closer than to 15° on the Sun: on this well-separated example g stays 3, so R does not move. On a real image with a sprawling group it will.
  5. Put Your k factor back to 1 and tap the lone spot near the limb to leave it out. The count drops to R = 26: 2 groups and 6 spots — one group gone is 10 points, one spot is 1.
  6. Tap that spot again to bring it back (R = 37), then tap an empty part of the disc to add a spot by hand: it starts a group of its own, and the count goes to R = 48: 4 groups and 8 spots, a jump of 11, not 1.

What researchers can use it for

  • Audit an automatic count: run your own image through the tool at three grouping distances and quote the spread, not a single R, as the paper’s 85.3 % accuracy implies you should.
  • Find your personal k factor: count for a few months, then divide the international numbers by your own; the tool’s k field applies it straight away.
  • Teach why R is not a spot count: the “tap to remove a group” step makes the factor of ten obvious in a way no formula does.
  • Feed a cycle fit: export the daily counts as CSV and model the rise of cycle 25 with the solar cycle fitter or the time series.
  • Work from FITS: solar frames from a hydrogen-alpha or white-light rig open in the FITS viewer first, so you can check the exposure before counting.

The fine print

  • Our image is synthetic. It carries the paper’s spot and group totals, not its pixels, and the detection step on real HMI data has to cope with plage, intensity gradients and dust that our image does not have.
  • The tool groups by single-linkage distance on the sphere; the paper groups by morphological erosion. These are different rules and will disagree on borderline cases, which is the whole point of Figure 1.
  • Heliographic positions need the Sun’s P, B₀ and L₀ angles and a known image orientation. The tool reports positions relative to the disc centre only, so it cannot yet reproduce the paper’s group coordinates.
  • The international series applies its own observer weighting and a 13-month smoothing. A single-image R, from any pipeline, is not directly comparable to a published monthly number.

Sources

  • Zhao, C., Yang, S., Wang, T., Zhao, H., Liu, S., He, F. and Hu, Z. (2024), An Automatic Approach for Grouping Sunspots and Calculating Relative Sunspot Number on SDO/HMI Continuum Images, The Astronomical Journal 167(2): 51, doi:10.3847/1538-3881/ad11e2. Licence CC BY 4.0 (version of record), checked on the Crossref record for the DOI, 2026-11-24; no correction or retraction is recorded. Values used here: 507 daily SDO/HMI continuum images at 08:45 UT from January 2022 to May 2023; the worked example of 14 January 2022 with 15 spots in 9 groups giving R = 105; grouping accuracy 85.3 %; correlation 0.91 with the international series; scaling factor K = 1.03 for HMI continuum images. The full text was read from the author version at ar5iv (arXiv:2401.08949).
  • The relative (Wolf) sunspot number R = k (10 g + s): Wolf, R. (1856), Mittheilungen über die Sonnenflecken, Astronomische Mittheilungen 1; still the definition used by the international series.

If you are an author or publisher and want a credit or a passage changed or removed, tell us and we will act quickly.

Tools in this article

Read next