Recommendations for spectral fitting of SO2 from miniature multi-axis differential optical absorption spectroscopy (MAX-DOAS) measurements

Fitting sulfur dioxide (SO2) differential slant column densities (dSCDs) from multi-axis differential optical absorption spectroscopy (MAX-DOAS) measurements of scattered sunlight is challenging because actinic light intensity is low in the wavelength regions where the SO2 absorption features are strongest. SO2 dSCDs were fit with different wavelength windows (λlow to λhigh) from ambient measurements with calibration cells of 2.2× 1017 and 2.2× 1016 molec. cm−2 inserted in the light path at different viewing elevation angles using an Ocean Optics USB2000 spectrometer in a miniature MAX-DOAS instrument. SO2 dSCDs were the least accurate, and fit errors were highest for fitting windows with λlow < 307 or λlow > 312 nm. The SO2 dSCDs also exhibited an inverse relationship with the depth of the differential features in the SO2 absorption cross section for fitting windows with λlow < 307 nm. Spectra measured at low viewing elevation angles (i.e., α = 2) exhibited less accurate SO2 dSCDs for the same fitting windows compared with higher angles. The use of a 400 nm shortpass filter or a polynomial to account for stray light (the offset function) increased the accuracy of the SO2 dSCDs for many different fitting windows, decreased fit errors, and decreased the dSCDs’ dependence on the depth of the SO2 differential absorption features. These results suggest that the radiance at shorter wavelengths was increased by stray light. The inaccuracies at lower fitting wavelengths were increased by stray light originating from light with λ> 400 nm. Deviation of the SO2 dSCD from the true value depended on the SO2 concentration for some fitting windows rather than exhibiting a consistent bias. Uncertainties in the SO2 dSCD reported by the fit algorithm were more than 50 % less than the true error for many windows, particularly for the measurements without the filter or offset function. For retrievals with the filter or offset function, increasing λhigh > 320 nm tended to decrease the reported fit uncertainty but did not increase the accuracy. Based on the results of this study, a short-pass filter and a fitting window of 307.5 < λ< 319 nm are recommended for the retrieval of SO2 SCDs from miniature MAX-DOAS measurements. If a filter is not available or conflicts with other species to be determined (e.g., NO2 or HCHO), the offset function should be enabled, and a fit window 307.5 < λ< 319 nm is still recommended.


Introduction
The differential optical absorption spectroscopy (DOAS) technique has been used since its introduction by Brewer et al. (1973), Noxon (1975), Perner et al. (1976), and Platt et al. (1979) to measure atmospheric species with narrowband structures of absorption in the visible and near-UV wavelength region. A major challenge for the successful determination of the trace gases of slant column densities (SCDs) using the DOAS method is the optimization of the retrieval parameters (Platt and Stutz, 2008;Vogel et al., 2013). These parameters depend on the atmospheric composition, measurement conditions, and which DOAS instrument is used. The wavelength range of the retrieval (the "fitting window") is a key parameter that depends on the differential absorption features of the trace gas in question (Vogel et al., 2013). Retrieval of the differential SCDs (dSCDs) of sulfur dioxide (SO 2 ) from multi-axis DOAS (MAX-DOAS) measurements is challenging in a number of ways, such as the fact that the SO 2 absorption features are strongest in the wavelength region where the intensity of solar light becomes relatively small. There are three major regions of photo-absorption by SO 2 in the UV range: the very weak absorption in the A band from 340 to 390 nm, the moderately strong B band from 260 to 340 nm, and the strongest C band from 180 to 240 nm. MAX-DOAS spectroscopy commonly uses the SO 2 B band in the near UV, which has absorption peaks of increasing strength with decreasing wavelength (Hermans et al., 2009;Xie et al., 2013). Retrievals of SO 2 dSCDs in the 300-325 nm range are complicated by the low intensity of scattered sunlight that results in high photon shot noise (Bobrowski et al., 2010). Actinic flux at the surface level of the Earth decreases by several orders of magnitude in the 320-290 nm region due to a steep increase in O 3 absorption with decreasing wavelengths (Kreuter and Blumthaler, 2009). O 3 differential absorption features can also cause interference in the fit due to the similarity to the SO 2 differential absorption features between 315 and 326 nm (Rix et al., 2012). An additional challenge due to the low UV intensity is that stray light in spectrometers can be a significant proportion of the measured signal, causing an underestimation of the true optical density (and dSCD) and reducing fit accuracy (Bobrowski et al., 2010;Kreuter and Blumthaler, 2009). Stray light impacts tend to be severe for the widely used compact spectrometers, such as the instrument from Ocean Optics utilized in this study (Bobrowski et al., 2010).
The optimal fitting window for the retrieval of SO 2 column densities from MAX-DOAS spectra must have a lower wavelength (λ low ) that is small enough to include strong features of SO 2 absorption but large enough to ensure enough solar signal and prevent significant stray light effects. The upper wavelength of the fit range (λ high ) should ensure that the fitting window includes multiple SO 2 absorption structures while excluding wavelengths where SO 2 absorption features are so weak that degrees of freedom (DOF) are unnecessarily increased, increasing the fitting uncertainty. MAX-DOAS fit windows must be relatively narrow compared with direct sun-viewing applications, as the air mass factors used to convert SCDs to vertical column densities (VCD) differ with wavelength due to scattering (Fioletov et al., 2016). An overly broad fit window also risks the inclusion of strong absorption features from other gases (Vogel et al., 2013) and increased errors due to insufficient correction of the broadband terms (Marquard et al., 2000;Pukite et al., 2010). However, an overly narrow fit window can lead to cross-correlation between the reference absorption cross sections (Vogel et al., 2013). Inclusion of upper wavelengths with weak SO 2 in the fit can improve the fit results by allowing a better distinction between SO 2 absorption features and other fit components (e.g., O 3 absorption features and Ring spectrum).
A further complication is that for measurements of very large column densities of SO 2 (e.g., from volcanic studies), the optimal wavelength window may be present at higher wavelengths where SO 2 absorption features are weaker (Bobrowski et al., 2010). High optical densities below 320 nm from large column densities can cause nonlinearities in the relationship between the column density and the measured optical density in the fit. This phenomenon occurs for large (actual) optical densities if the cross section in the fit was not recorded with the same spectrometer as the measurements, which is common, and the instrument's spectral resolution is too low to completely resolve the absorption bands (Kern, 2009;Platt and Stutz, 2008). Large column densities of SO 2 result in optical densities in the B band that can exceed unity, violating the assumption in the standard DOAS retrieval of weak absorption with optical depths of less than ∼ 0.1 (Bobrowski et al., 2010;Bobrowski and Platt, 2007;Fickel and Delgado Granados, 2017;Kern, 2009;Platt and Stutz, 2008). Compact spectrometers typically have an insufficient spectral resolution for the optical density of the SO 2 absorption bands to be proportional after convolution for large column densities (Bobrowski et al., 2010;Platt and Stutz, 2008). Consequently, the true column density can be underestimated because the differential absorption line depths from the standard DOAS convolution approximation can be greater than mathematically correct convolution (Bobrowski et al., 2010;Kern, 2009;Yang et al., 2007). Underestimation has been shown to increase with decreasing wavelength from 320 to 300 nm and increasing column density of SO 2 (Kern, 2009). This effect is important for volcanic plume studies and in the most polluted urban and industrial environments Despite the importance of using an optimal fitting window, various windows have been used to retrieve MAX-DOAS SO 2 SCDs in the literature, and few studies have attempted to assess the impact of the window's wavelength range on the SO 2 SCDs (Vogel et al., 2013). Fitting windows in previous MAX-DOAS studies include 305-317.5 nm (Tan et al., 2018), 307.5-328 nm (Schreier et al., 2015), 307.6-325 nm (Jin et al., 2016), 307.8-330 nm , 310-320 (Irie et al., 2011), and 307.5 to 315.0 nm (Bobrowski and Platt, 2007). Salerno et al. (2009) examined the sensitivity of SO 2 SCDs to the fitting window in the 300-320 nm region using calibration cells of SO 2 of 3.2 × 10 17 and 8.5 × 10 17 molec. cm −2 . An optimal fitting window of 306.7-314.7 nm was determined based on the smallest SCD errors by varying the wavelengths of the fit window. However, the variations of the lower and upper window limits were only conducted for a single fixed upper limit and lower limit, respectively. Moreover, as the column densities were relatively large, which is more representative of volcanic plumes, the determined fitting window may not be ideal for the smaller SO 2 column densities often observed in urban studies. Fickel and Delgado Granados (2017) observed a high dependence of SO 2 SCDs from measurements of a volcanic plume on the fitting window, particularly for large column densities. The authors suggested using different fitting windows for different column densities: 310-322 nm for SO 2 column densities < 10 17 molec. cm −2 , 322-334 nm for column densities > 10 18 molec. cm −2 , and 314.7-326.7 nm for intermediate column densities. A modelling study by Bobrowski et al. (2010) suggested using fitting windows in the higher 360-390 nm range for column densities on the order of 10 19 molec. cm −2 because the SO 2 absorption features are much weaker. Therefore, DOAS retrievals of SO 2 from instruments that observe a wide range of column densities can switch fitting windows depending on the magnitude of the retrieved SCDs. For example, TROPOMI satellite retrievals of SO 2 use 312-326 nm as a baseline window but use 325-335 nm for SO 2 SCDs > 4 × 10 17 molec. cm −2 and 360-390 nm for SCDs > 6.7×10 18 molec. cm −2 (Theys et al., 2017).
In this study, MAX-DOAS measurements of two different calibration gas cells with column densities of SO 2 representative of polluted urban conditions were conducted to examine the variation in the retrieved SO 2 dSCDs with (1) different fitting windows, (2) different viewing elevation angles (α), (3) the use of a 400 nm short-pass filter, and (4) the offset function enabled.

Methods
The miniature MAX-DOAS instrument (Hoffmann Messtechnik GmbH model no. 16127) consisted of a sealed metal box with a UV fibre-coupled spectrometer and all of the electronics inside. Incident scattered sunlight received by the cylindrical black telescope in front of the entrance optics is focused into the quartz fibre by a cylindrical quartz lens with a focal length of 40 mm. The MAX-DOAS instrument used a relatively low-cost and commonly employed compact spectrometer, an Ocean Optics USB2000 spectrograph. The spectrometer has a 50 µm wide entrance slit and a Sony ILX511 linear silicon charge-coupled device (CCD) array detector (2048 pixels, with a pixel size of 14 µm ×200 µm; signal-to-noise ratio at full signal is 250 : 1). The spectral range of the spectrometer is 290-433 nm, with a resolution of ∼ 0.7 nm full width at half maximum (FWHM) in the fitting range used. A Peltier stage cooled the spectrograph to maintain the chosen temperature of 5 • C. A stepper motor mounted underneath allowed the instrument to point at different α above the horizon. The instrument was connected to a laptop via USB to transfer spectrometric data and allow automated measurements using JScript programs using the DOASIS software package.
MAX-DOAS spectra of scattered solar light were recorded with an SO 2 calibration gas cell (Resonance Ltd.) inserted in the light path (in the telescope tube). The two cylindrical gas cells with a 22 mm diameter and 14.13 mm thickness had calibrated slant column densities (SCDs) of 2.2 × 10 17 molec. cm −2 (higher) and 2.2 × 10 16 (lower) (±10 %) molec. cm −2 respectively. Active DOAS measure-ments of the SO 2 gas cells confirmed the SCDs. These SCDs would be equivalent to an air mass with SO 2 mixing ratios of 41 and 4 ppb, respectively, for an α = 30 • measurement within a homogeneous boundary layer of 1 km, assuming the measurement was fit against a zenith-pointing reference spectrum observing outside of the SO 2 -polluted zone, calculated using Eq. (2) in Davis et al. (2019). For each cell, spectra were recorded around solar noon in September in Toronto (43.773 • N, −79.506 • W), Ontario, between 12:53 and 13:26 LT (local time) at α = 90, 30, 15, 8, 4, and 2 • above the horizon, followed by a 90 • measurement without the gas cell. This second zenith measurement was used as the Fraunhofer reference spectrum (FRS) in the fit. The time between the 2 and 90 • measurements in one sequence (both containing the SO 2 cell) was less than 13 min. The FRS were obtained less than 35 min after the beginning of the respective sequence of cell measurements. Each recorded spectrum was the average of 1000 spectra with an integration time of ∼ 115 ms. The experiment was repeated for both gas cells by placing a 400 nm short-pass filter (Edmund Optics TECHSPEC ® OD 2 no. 47-285) within the telescope between the MAX-DOAS lens and the SO 2 gas cell. The fused silica filter had a thickness of 3 mm, a cut-off wavelength of 400 nm, and a transmission wavelength range of 250-385 nm. The blocking optical density was ≥ 2.0, and the transmission was > 85 % in the transmission range. Spectra collected using the filter were fit against a FRS collected by measuring a 90 • spectrum without a gas cell but including the filter.
Trace gas differential slant column densities (dSCDs) were obtained using the DOAS method (Platt and Stutz, 2008) with the DOASIS software (Institute of Environmental Physics, Heidelberg University, 2009). All spectra were corrected for dark current and electronic offset and were wavelength calibrated using measurements of a mercury (Hg) lamp. A Fraunhofer reference spectrum (FRS), a Ring spectrum, a third-order polynomial, and absorption cross sections of SO 2 at 293 K and O 3 at 293 and 223 K were included in all fits (Bogumil et al., 2003). The shift and squeeze terms were allowed for the fit components with the Ring spectrum terms linked to the FRS terms and the O 3 cross section terms linked to the SO 2 cross section terms (shift limited to −0.2 to 0.2 nm). The shift and squeeze terms are included in the DOAS analyses to compensate for wavelength shifts due to instrumental instabilities, such as temperature changes during measurements altering the pixel-to-wavelength calibration Stutz and Platt, 1996). In the case of the FRS, the shift and squeeze terms also compensate for the "tilt effect" that increases fit residuals by artificially shifting the spectral positions of Fraunhofer and molecular absorptions lines between the measurement and reference spectra that have different viewing elevation angles . The tilt effect arises because atmospheric modification of the spectral structures in the spectrum occurs before convolution with the instrument slit function, and the modi-fications are noncommutative but are applied in the reverse order by the analysis procedure . The cross sections were obtained from the MPI-MAINZ UV/VIS Spectral Atlas of Gaseous Molecules of Atmospheric Interest (Keller-Rudek et al., 2013). The reported uncertainty in the SO 2 absorption cross section is ∼ 3 % (Bogumil et al., 2003). DOASIS fits dSCDs using an iterative algorithm based on the Levenberg-Marquardt method that finds the optimal solution by minimizing a cost function. The cost function includes the deviation between the measured spectrum and the spectrum modelled using the components included in the fit. Details on the DOASIS fitting algorithm can be found in Kraus (2006). The SO 2 dSCDs were fit in DOASIS with varying fitting windows using λ low = 303-318 and λ high = 310-340 nm in ∼ 0.2 nm increments. The "retrieval interval mapping" technique (Vogel et al., 2013) was used to visualize and systematically evaluate the variations in the SO 2 dSCDs. The dSCDs are displayed as contour plots where λ low and λ high are the first and second dimensions, and the dSCDs are denoted using a colour scale.
For each calibration gas cell (higher and lower), four scenarios were fit: (i) the base case "B" with no filter and no offset function, (ii) no filter with the offset function enabled "B+O", (iii) with the filter and offset disabled "B+F", and (iv) with both the filter and offset enabled "B+ F+O". SO 2 dSCDs were considered "accurate" if they were within ±10 % of the higher calibration cell value and ±50 % of the lower calibration cell value, 2.2 × 10 17 and 2.2 × 10 16 molec. cm −2 , respectively. The background SO 2 in the atmosphere in Toronto was assumed to be negligible (< 1 ppb) because there are currently no significant sources in Toronto (ECCC, 2018). A few industrial sources of < 1600 t yr −1 of SO 2 were present south-west of Toronto (ECCC, 2018), but the measurements were conducted under north-easterly wind conditions. Typical hourly average mixing ratios of SO 2 in northern Toronto are < 0.5 ppb (Ontario Ministry of the Environment, 2019).

Results
Examples of spectral retrievals of SO 2 from the α = 2 • spectrum in the base case (no filter and the offset function disabled) are shown in Fig. 1.

Higher concentration reference cell
The SO 2 dSCDs' fit from the α = 2 and α = 30 • measurements using the higher concentration cell are shown in Fig. 2 with varying fitting windows for the four scenarios. The deviations of the SO 2 dSCDs from the expected value of 2.2×10 17 molec. cm −2 (fit errors) are shown in Fig. 3, where the purple and green colours indicate under-and overestimation, respectively. Grey and black areas indicate that the dSCD under-and overestimated the expected value by more than 8 × 10 16 molec. cm −2 , respectively. For the base case, the windows with λ low < 307 nm ("low wavelengths") underestimated the expected SO 2 dSCD, as indicated by the grey areas in Fig. 2 (B) and the purple areas in Fig. 3 (B). The addition of the short-pass filter increased the accuracy of the SO 2 dSCDs for most windows, especially in the low wavelengths (Figs. 2, 3; B+F). These results suggest that stray light originating from wavelengths > 400 nm increased the underestimation of SO 2 dSCDs at low wavelengths. Stray light is a well-known source of interference in spectroscopic measurements that reduces accuracy and can obscure weak spectral lines (Kristensson et al., 2014). Ideally, a spectrometer's detector receives only light with the correct spectral bandwidth window at each pixel (Lindon et al., 2000). Stray light is additional light of an incorrect wavelength that enhances the background signal in ways that can vary across the spectral range (Kristensson et al., 2014). Sources of stray light include imperfections in the diffraction grating, leakage of light into the instrument, and scattering off mirrors and dust inside the instrument (Lindon et al., 2000). Stray light results in apparent negative deviations from Beer's law (Choudhury and Prayagi, 2015), causing an underestimation of the retrieved SO 2 dSCD by "filling in" the measured intensity reduced by SO 2 absorption features and an underestimation of the real optical density (Bobrowski et al., 2010). Stray light has an enhanced effect at low wavelengths because of the low measured signal and sensitivity near the lower end of the actinic spectral range (Choudhury and Prayagi, 2015). Many fitting windows with λ low < 307 and λ high < 320 nm still underestimated the SO 2 dSCD even with the filter (Fig. 2; B+F). The remaining underestimation is likely due to stray light originating from < 400 nm and the effects of nonlinearity between the column density and measured optical density because of the relatively large differential optical densities of SO 2 of > 0.08 in the regions of strong absorption below 307 nm ( Fig. 1; Kern, 2009;Platt and Stutz, 2008). See Fig. 3.21 in Kern (2009) for the percentages of underestimation by the retrieved column density of the actual column densities (1 × 10 17 to 1 × 10 19 SO 2 molec. cm −2 ) for windows in the 300-320 nm region and a spectrometer with similar spectral resolution (0.8 nm). Enabling the offset function increased the accuracy of the SO 2 dSCDs of many windows compared with the base case (Figs. 2, 3; B+O). The offset function resulted in slightly more windows with accurate dSCDs than the filter for windows with λ low < 311 nm because the offset function attempts to compensate for all the stray light, not just the stray light originating from > 400 nm ( Fig. 2; B+F and B+O). The use of both the offset function and the filter slightly improved the dSCD accuracy for a few windows compared with the filter or offset function alone, mostly for windows with large λ high , > 324 nm ( Fig. 2;  B+F+O).
Fitting windows produced more accurate SO 2 dSCDs from spectra measured at higher α (90 and 30 • ) compared with the lowest α (2 and 4 • ) in the base case (B in Figs. 2 and 3, Figure 1. Examples of spectral retrievals of SO 2 from the base case (no filter and the offset function disabled) from spectra measured at a 2 • viewing elevation angle using the 307.5-320 nm fitting window. Retrieved dSCDs were 2.23(±0.08)×10 17 and 4.10(±0.66)×10 16 molec. cm −2 for the higher and lower concentration measurements, respectively. and S1 in the Supplement). Windows with λ low < 307 nm underestimated SO 2 dSCDs more from the 2 • than from the 30 • measurements (B in Fig. 3). The spectra collected at higher α are expected to produce more accurate SO 2 dSCDs because of the greater UV signal intensity (Fig. 4). The impact of stray light on fits from the lower angle spectra is further increased because the visible light intensity, which is a potential source of stray light, is the same or higher than for measurements at higher α (Fig. 4). The difference in the accuracy of SO 2 dSCDs between low and high α spectra decreased with the use of the filter or the offset function (Figs. 2, 3), which was an expected result.
Fitting windows with λ low > 312 nm often overestimated the SO 2 dSCDs for all scenarios, as indicated by the green and black areas in Fig. 3, probably because the SO 2 absorption features become relatively weak (Fig. 4). Fickel and Delgado Granados (2017) proposed the use of the higher wavelength fitting window of 314.7-326.7 rather than 310-322 nm for SO 2 column densities between 10 17 and 10 18 molec. cm −2 . In contrast, the results of this study found that SO 2 dSCDs from the higher range were less accurate than those from the lower range. The threshold for using fitting windows with higher wavelengths due to large optical densities may be greater than 10 17 molec. cm −2 .
The SO 2 dSCDs exhibited a dependence on the features of the SO 2 absorption cross section for λ low < 307 nm for the base case (B in Figs. 2 and 3) that will be discussed in Sect. 3.3. Figures 5 and 6 show the SO 2 dSCDs and their deviations from the expected value (fit error), respectively, for the lower concentration measurements for all the scenarios. Purple and green areas in Fig. 6 indicate dSCDs were underand overestimated, respectively. Black and grey areas indicate dSCDs that were over-and underestimated by more than 2.0 × 10 16 molec. cm −2 , respectively. The SO 2 dSCDs from the base case exhibited a dependence on the SO 2 absorption that will be discussed in Sect. 3.3. In the base case, the lower concentration measurements had fewer windows that produced accurate SO 2 dSCDs compared with the higher concentration measurements (B in Figs. 2 and 5). Most of the fitting windows produced SO 2 dSCDs that were > 100 % over-or underestimated for the lower concentration 2 • spectrum (B in Figs. 5 and 6, and S1). In contrast, the lower concentration 90 • measurement exhibited accurate SO 2 dSCDs for all fitting windows with λ low < 311 nm (Fig. S1). This difference highlights that measurements at lower α experience greater inaccuracies from the reduced solar intensity and greater impact of stray light. While the higher concentration dSCDs from the 2 • measurements were consistently underestimated for windows with λ low < 307 nm, the lower concentration measurements often overestimated the dSCDs (B in Figs. 5 and 6). This overestimation in spite of the influence of stray light could be due to interference from O 3 , as the similarity between the absorption features of SO 2 and O 3 can introduce instability in the retrieval (Kraus, 2006;Rix et al., 2012). The deviation of the dSCD from the true value can depend on the SO 2 concentration rather than exhibiting a consistent bias for a fitting window. The use of the filter or offset function increased the accuracy of the SO 2 dSCDs for most windows for spectra measured at angles ≤ 15 • (Figs. 3, 6; B+F and B+O). The improved accuracy due to the filter indicates that stray light originating from wavelengths > 400 nm significantly decreased the accuracy of the SO 2 Figure 2. The SO 2 dSCDs' fit from higher concentration measurements at 2 • (left column) and 30 • (right column) elevation angles for the base case, B; with the offset, B+O; with the filter, B+F; and with the filter and offset, B+F+O. Grey and black areas indicate that dSCDs were > 10 % less and > 10 % more than the expected value, respectively. The true value of the cell is 2.2 × 10 17 molec. cm −2 (yellow). dSCDs for fitting windows at both lower and higher wavelengths. Unexpectedly, the use of both the filter and offset function for the 30 • measurement reduced the accuracy of the SO 2 dSCDs compared with the base case for some windows with λ low < 307 and λ high < 320 nm ( Fig. 6; B+F+O). As the stray light to signal ratio is expected to be lower for the higher elevation measurements, and the filter already reduced the stray light, the offset function may have incorrectly estimated the relatively small amount of remaining stray light at some wavelengths. The offset function may have added unnecessary freedom to the fit, increasing instability and inaccuracy in the dSCD. Moreover, the offset function compensates for stray light by assuming the stray light is proportional to the measured intensity (see . If light from wavelengths outside the fitting window contributes to stray light, this assumption is invalid, and the offset function may increase uncertainty in the fit. The short-pass filter may be the preferred method of reducing the impact of stray light compared with the offset function because the filter directly addresses rather than modelling the source of the problem. However, the problems from using both the filter and offset function can be mitigated by using a fitting window with λ low > 307 nm.

Dependence of the dSCD on the SO 2 absorption features
In the base case, the SO 2 dSCDs exhibited an inverse relationship with the depth of the differential SO 2 absorption features for windows with λ low < 307 and λ high < 330 nm for non-zenith measurements (B in Figs. 2 and 5). The variation in the SO 2 dSCD as a function of λ low from the α = 2 • measurements, given λ high of 315 and 324 nm, are shown   . SO 2 dSCDs' fit from the lower concentration measurements at 2 • (left column) and 30 • (right column) elevation angles for the base case, B; with the offset, B+O; with the filter, B+F; and with the filter and offset, B+F+O. Grey and black areas indicate dSCDs that were < 50 % less and > 50 % more than the expected value, respectively. The true value of the higher concentration cell is 2.2 × 10 16 molec. cm −2 (yellow).
in Figs. 7 and 8, respectively. The SO 2 dSCDs varied up to 3.4×10 16 and 3.0×10 16 molec. cm −2 for a 0.4 nm change in λ low for the higher and lower concentration measurements, respectively (Figs. 7,8). Note that for the lower concentration measurement, the difference in the retrieved SO 2 dSCDs between using λ low of 304 and 308.5 nm is an order of magnitude in the base case (Fig. 7). For both concentrations, using the filter or enabling the offset function reduced the dependence of the dSCDs on λ low (Figs. 7, 8) and increased the accuracy of many of the low wavelength fitting windows (Figs. 3, 6). The SO 2 dSCD dependency was increased by stray light, exhibiting the greatest underestimation when λ low coincided with an SO 2 absorption peak. Errors due to stray light are enhanced in wavelength regions where absorption is high (Choudhury and Prayagi, 2015). The measured sig-nal was further reduced surrounding an SO 2 absorption peak (e.g., ∼ 304.4 nm) compared with an absorption minimum, and stray light "filled in" the decreased intensity due to the absorption maxima. If an absorption peak is the strongest SO 2 feature included in the fit, the resultant deviation between the modelled and measured spectrum in the peak region requires the fit algorithm to underestimate the SO 2 dSCD to minimize the cost function (see the Supplement for fitting algorithm details). The inverse relationship between the dSCD and the SO 2 absorption features was strongest at λ low < 307 nm because absorption was greatest and the solar signal was smallest (Figs. 4, 7, 8). The dSCDs exhibited less dependence on the λ low when λ low = 307-311 nm due to increased solar intensity and weaker SO 2 absorption (Fig. 4). For both higher and lower concentration measure- Figure 6. Lower concentration fit errors (deviations of SO 2 dSCDs from the expected value of 2.2 × 10 16 molec. cm −2 ) from the measurements at 2 • (left column) and 30 • (right column) elevation angles for the base case, B; with the offset, B+O; with the filter, B+F; and with the filter and offset, B+F+O. Purple and green areas indicate that dSCDs were under-and overestimated, respectively. Black and grey areas indicate that dSCDs were over-and underestimated by more than 2.0 × 10 16 molec. cm −2 , respectively. ments, the anti-correlation of the SO 2 dSCD in the base case was more pronounced for windows with λ high = 324 than with λ high = 315 nm (Figs. 7, 8).

Fit uncertainties and accuracy
The uncertainty in the SO 2 dSCD reported by the fitting algorithm and the actual deviation from the expected value shall be referred to as the "fit uncertainty" and the "fit error", respectively. While the fit uncertainty reported by the retrieval is commonly used as the error on the retrieved dSCD, this uncertainty is not always expected to accurately represent the true error. The divergence is due to factors including assumptions about the independence of errors, and the pres-ence of spectral noise and structures in the fit residual (Stutz and Platt, 1996). Tests of modelled spectra with noise added found that when noise becomes large, the true errors of the retrieved trace gas coefficient were > 10 % larger than the retrieved error, and the difference was proportional to the noise level. Moreover, the inclusion of random residual structures in the spectra caused the fit uncertainty to underestimate the true error by a factor of 3 (Stutz and Platt, 1996). It is useful to examine which fitting windows exhibited the greatest difference between the fit uncertainty and error. The fit uncertainties from the 2 • spectrum are shown for the higher and lower concentration measurements in the left columns of Figs. 9 and 10, respectively. The fit uncertainties for the base case were the greatest for windows with λ low < 306 and λ high < 315 nm, and with λ low > 312 nm (B in Figs. 9 and 10). The purple and black regions in Figs. 9 and 10 indicate that the fit error was greater than the fit uncertainty, and the green regions indicate that fit error was less than the fit uncertainty. For the higher concentration measurement in the base case, the fit error was significantly greater than the fit uncertainty (by > 2.2 × 10 16 molec. cm −2 ) for most windows when λ low < 305 nm (black regions in Fig. 9, case B), corresponding to fit uncertainties that were 20 %-50 % of the fit errors (Fig. S2). Therefore, fitting windows for the higher-concentration measurements in low wavelength regions (impacted by stray light and nonlinearity effects) can not only produce less accurate SO 2 dSCDs but also exhibit larger divergences between fit uncertainty and error (B in Figs. 2,3,and 9,and S2). For the lower concentration measurement, the fit error was > 1.1 × 10 16 molec. cm −2 greater than the fit uncertainty for most windows in the base case (black regions in Fig. 10, case B). The use of the filter or enabling the offset function reduced the fit uncertainties by up to 50 % and decreased the difference between the fit errors and uncertain- ties, particularly for windows with λ low < 309 nm (Figs. 9,10,S2). Note that when the filter or offset function was used, increasing λ high > ∼ 320 nm or decreasing the λ low < ∼ 307 nm decreased the fit uncertainty but not the fit error for some windows (Figs. 6, 8).

Summary and recommendations
Measurements of calibration gas cells with column densities of 2.2 × 10 17 and 2.2 × 10 16 molec. cm −2 SO 2 were conducted using a miniature MAX-DOAS instrument with an Ocean Optics USB2000 spectrometer. In the base case, SO 2 dSCDs were least accurate and had the largest fit uncertainties for fitting windows with λ low < 307 and > 312 nm due to stray light and low solar signal, and weak SO 2 absorption, respectively. Fitting windows exhibited less accurate SO 2 dSCDs for spectra recorded at lower compared with higher α due to the reduced UV signal. Therefore, choosing an accurate fitting window is particularly important for measurements at low α. Windows with λ low < 307 nm generally underestimated SO 2 dSCDs from higher concentration measurements for all scenarios. In contrast, many windows with λ low < 307 nm from the lower concentration measurements overestimated the SO 2 dSCD that were overes- Figure 9. Higher concentration SO 2 dSCDs' fit uncertainties (a, b, c) and the difference between the fit error and uncertainty (d, e, f) from spectra measured at a 2 • elevation angle for the base case, B; with the offset, B+O; and with the filter, B+F. Black areas indicate errors > 1.1×10 16 molec. cm −2 for the absolute error (a, b, c) and > 2.2×10 16 molec. cm −2 for the difference (underestimation) between the actual and fit error.
timated from the higher-concentration measurement. In the base case, the SO 2 fit uncertainties were significantly less than the actual known fit error for many windows for both concentration measurements. Using the short-pass filter or the offset function increased the accuracy of the SO 2 dSCDs, decreased the fit uncertainty, and decreased the difference between the fit uncertainty and error compared with the base case for most windows. Some low wavelength windows continued to underestimate the SO 2 dSCDs despite the filter for the higher-concentration measurements. The remaining underestimation was probably due to significant stray light that originated from < 400 nm and nonlinearity in the relationship between the column density and the measured optical density owing to large optical depths of SO 2 at these lower wavelengths (e.g., > 0.08). A low-pass filter with a lower cut-off wavelength (i.e., λ cut-off = 340 nm) may address the first factor, as may the use of spectrometers with reduced stray light. A spectrometer with an improved spectral resolution should help reduce the impact of the second factor (Kern, 2009). SO 2 dSCDs exhibited an inverse dependence on the depth of the differential features in the SO 2 absorption cross section in the base case. The dependence decreased with the use of the short-pass filter or the offset function, implying that stray light contributed to the dependence. Using both the filter and offset function decreased the accuracy of the lower concentration dSCDs of SO 2 for some windows with λ low < 307 and λ high < 320 nm compared with the base case. Increasing the λ high to more than ∼ 320 nm tended to decrease the fit uncertainty but not necessarily the fit error for measurements with the filter or offset function. Note that this study focused on the impact of two retrieval parameters (the fitting window wavelength and offset function) but that several other parameters can be varied in the SO 2 dSCD fit. These parameters include the order of the DOAS and offset function polynomials and the choice of the literature cross sections for the trace gases. The DOAS analysis could also be expanded to include a correction to reduce the impacts of the wavelength dependence of the Ring effect in the near UV due to aerosol and multiple Rayleigh scattering, as described in Langford et al. (2007). Additional factors that could impact the retrieved dSCD include the solar zenith and azimuth angles during measurement. A limitation of this study is the lack of measurements at high solar zenith angles (near dawn and dusk) when the SCDs of O 3 are larger and change rapidly with time. In such cases, fit accuracy may benefit from extending the upper limit of the fit window to allow for better discrimination between the differential absorption features in the O 3 and SO 2 cross Figure 10. Lower concentration SO 2 dSCDs' fit errors (a, b, c) and the difference between the fit uncertainty and error (d, e, f) from spectra measured at a 2 • elevation angle for the base case, B; with the offset, B+O; and with the filter, B+F. Black areas indicate errors of > 2.2×10 16 molec. cm −2 for the absolute error (a, b, c) and a > 1.1×10 16 molec. cm −2 underestimation of the fit error by the fit uncertainty.
sections. Future studies could repeat these experiments by measuring at different solar geometries and varying the other fit parameters. Furthermore, the SO 2 column densities measured in this study were chosen to be representative of a range typical of polluted urban settings. Greater SO 2 column densities (> 1 × 10 18 molec. cm −2 ) can be observed in volcanic areas and close to major industrial sources; discussions on retrieving these high SO 2 column densities can be found in Bobrowski et al. (2010) and Fickel and Delgado Granados (2017).
Based on the results of this study, it is recommended that fitting windows for SO 2 have λ low > 307 nm to avoid the effects of stray light, low solar signal, and, for higher column densities, the effects of nonlinearity between the measured optical depth and the column density for optical densities 0.05, and λ low < 312 nm because of weak SO 2 features. Fitting windows are recommended to have a λ high less than ∼ 320 nm to avoid increased underestimation of the fit error by the fit uncertainty unless there are concerns about interference from large O 3 absorptions, such as at high solar zenith angles. A fitting window should not be chosen only because it has a smaller fit uncertainty, as this does not guarantee a more accurate dSCD. A short-pass filter with a cut-off close to the λ high of the SO 2 fitting window improves the accuracy of MAX-DOAS SO 2 measurements. In the absence of a fil-ter or if a filter would conflict with other species to be determined (e.g., NO 2 ), the offset function should be used to compensate for stray light. Even in the case that SO 2 and NO 2 are to be fit simultaneously, a filter with λ cut-off = 550 nm may reduce stray light. A short-pass filter may be preferred over the offset function for reducing stray light impacts because the filter removes stray light while the offset function mathematically compensates for stray light by assuming it is proportional to the measured intensity (see Eqs. 11 and 12 in Supplement). The offset function may increase fit error if this assumption is invalid or if little stray light is present. If a short-pass filter or the offset function is used, the 307.5-319 nm fitting window for miniature MAX-DOAS measurements of SO 2 is recommended. Ultimately, the use of higher quality spectrometers with reduced stray light and improved spectral resolution for MAX-DOAS measurements is desirable, but this is a greater expense compared with the low-cost spectrometer used in this study. Viewing elevation angle λ cut-off Cut-off wavelength of the short-pass filter λ high Upper limit wavelength of the fitting window λ low Lower limit wavelength of the fitting window B Base case measurement (no filter and offset function disabled) B+F Measurement with the short-pass filter B+F+O Measurement with the short-pass filter fit using the offset function B+O Measurement with the fit using the offset function dSCD Differential slant column density FRS Fraunhofer reference spectrum HCHO Formaldehyde MAX-DOAS Multi-axis differential optical absorption spectroscopy molec.  (Davis and McLaren, 2020).
Author contributions. ZYWD was responsible for the MAX-DOAS study concept, design, investigation and data analysis, data visualization, and writing and revising the paper. RM was responsible for the MAX-DOAS supervision and contributed to revising the paper.
Competing interests. The authors declare that they have no conflict of interest.
Financial support. This research has been supported by the Natural Sciences and Engineering Research Council of Canada (grant no. RGPIN-2018-05898) and the Collaborative Research and Training Experience (CREATE) program "Integrating Atmospheric Chemistry and Physics from Earth to Space" (IACPES; grant no. 398061-2011).
Review statement. This paper was edited by Jochen Stutz and reviewed by Christoph Kern and one anonymous referee.