Technical note: Evaluation of profile retrievals of aerosols and trace gases for MAX-DOAS measurements under different aerosol scenarios based on radiative transfer simulations

Abstract. Ground-based Multi-AXis Differential Optical Absorption
Spectroscopy (MAX-DOAS) is a state-of-the-art remote sensing technique for
deriving vertical profiles of trace gases and aerosols. However, MAX-DOAS
profile inversions under aerosol pollution scenarios are challenging because
of the complex radiative transfer and limited information content of the
measurements. In this study, the performances of two inversion algorithms
were evaluated for various aerosol pollution scenarios based on synthetic
slant column densities (SCDs) derived from radiative transfer simulations.
Compared to previous studies, in our study, much larger ranges of aerosol optical depth (AOD) and
NO2 vertical column densities (VCDs) are covered. One inversion algorithm is based on optimal
estimation; the other uses a parameterized approach. In this analysis, three
types of profile shapes for aerosols and NO2 were considered:
exponential, Boltzmann, and Gaussian. First, the systematic deviations of
the retrieved aerosol profiles from the input profiles were investigated.
For most cases, the AODs of the retrieved profiles were found to be
systematically lower than the input values, and the deviations increased
with increasing AOD. In particular for the optimal estimation algorithm and for
high AOD, these findings are consistent with the results in previous studies.
The assumed single scattering albedo (SSA) and asymmetry parameter (AP) have a systematic
influence on the aerosol retrieval. However, for most cases the influence of
the assumed SSA and AP on the retrieval results are rather small (compared
to other uncertainties). For the optimal estimation algorithm, the agreement
with the input values can be improved by optimizing the covariance matrix of
the a priori uncertainties. Second, the aerosol effects on the NO2 profile
retrieval were tested. Here, especially for the optimal estimation
algorithm, a systematic dependence on the NO2 VCD was found, with a
strong relative overestimation of the retrieved results for low NO2
VCDs and an underestimation for high NO2 VCDs. In contrast, the
dependence on the aerosol profiles was found to be rather low.
Interestingly, the results for both investigated wavelengths (360 and 477 nm) were found to be rather similar, indicating that the differences in the
radiative transfer between both wavelengths have no strong effect. In
general, both inversion schemes can retrieve the near-surface values of
aerosol extinction and trace gas concentrations well.


aerosols and NO2 were considered: exponential, Boltzmann, and Gaussian. First, the systematic deviations of the retrieved aerosol profiles from the input profiles were investigated. For most cases, the AODs of the retrieved profiles were found to be systematically lower than the input values, and the deviations increased with increasing AOD. Especially for the optimal estimation algorithm and for high AOD, these findings 5 are consistent to the results in previous studies. The assumed single scattering albedo and asymmetry factor have a systematic influence on the aerosol retrieval. However, for most cases the influence of the assumed SSA and AP on the retrieval results are rather small (compared to other uncertainties). For the optimal estimation algorithm the agreement with the input values can be improved by optimizing the covariance matrix 10 of the a priori uncertainties. Second, the aerosol effects on the NO2 profile retrieval were tested. Here, especially for the optimal estimation algorithm, a systematic dependence on the NO2 VCD was found with a strong relative overestimation of the retrieved results for low NO2 VCDs and an underestimation for high NO2 VCDs. In contrast, the dependence on the aerosol profiles was found to be rather low. Interestingly, 15 the results for both investigated wavelengths (360 nm and 477 nm) were found to be rather similar indicating that the differences in the radiative transfer between both wavelengths have no strong effect. In general, both inversion schemes can well retrieve the near-surface values of aerosol extinction and trace gases concentrations. 20

Introduction
In recent years, several large-scale aerosol pollution incidents in China (Hu et al., 2014;Huang et al., 2014;Zhang et al., 2015) have drawn increasing attention due to their effects on atmospheric visibility and health. Atmospheric aerosols also exert direct and indirect effects on global climate change and radiative balance (Seinfeld and Pandis, 1998;IPCC, 2007). The physical and chemical properties, and the spatial-temporal distributions of aerosols can both affect remote sensing 5 measurements of trace gases in the atmosphere (Seinfeld and Pandis, 1998;Quinn and Coffmann, 1998;Bond et al., 2001;Sheridan et al., 2001). Measuring the optical properties of aerosols, understanding the role of aerosols in atmospheric processes, and assessing the effects of aerosols on remote sensing observations of trace gases are important goals in the study of atmospheric pollution. 10 The ground-based Multi-AXis Differential Optical Absorption Spectroscopy (MAX-DOAS) technique can be performed with a relatively simple set-up and very low power consumption in the ultraviolet (UV) and visible (Vis) spectral range to synchronously measure the vertical distributions of aerosol optical extinction and concentrations of several trace gases (e.g., NO2, SO2, HCHO, HONO, and CHOCHO) in the troposphere 15 (Hönninger and Platt, 2002;Hönninger et al., 2004;Wittrock et al., 2004;Wagner et al., 2004;Frieß et al., 2006). Spectra of scattered sunlight are measured at different elevation angles (EAs) by the MAX-DOAS instrument. The spectra are analyzed by the DOAS technique (Platt and Stutz, 2008), which makes use of the characteristic "fingerprint" absorptions of the different trace gases with respect to a reference 20 spectrum taken for zenith. The results of the spectral fitting process are the so-called differential slant column densities (DSCDs) of the trace gases and the oxygen collision complex (O2-O2 or O4), with the DSCD defined as the difference between the trace-gas concentration integrated along the effective light path and the corresponding integrated trace-gas concentration in the zenith sky reference spectrum. The MAX-DOAS technique basically utilizes the EA dependence of differential absorption structures of O4 to derive the vertical distribution of the aerosol extinction (Wagner et al., 2004;Frieß 5 et al., 2006). The vertical profiles and vertical column densities (VCDs) of trace gases can be retrieved from the EA dependence of DSCDs using also the result of the aerosol profile inversion from MAX-DOAS (Irie et al., 2008(Irie et al., , 2009Li et al., 2010;Clé mer et al., 2010;Hartl and Wenig, 2013;Hendrick et al., 2014;Vlemmix et al., 2015;Frieß et al., 2006). 10 Recent research on MAX-DOAS has focused on the following aspects: (1) profile inversion algorithms (Hönninger and Platt, 2002;Wagner et al., 2004;Frieß et al., 2006Frieß et al., , 2011Clé mer et al., 2010;Hay, 2010;Vlemmix et al., 2011;Yilmaz, 2012;Hartl and Wenig, 2013;Holla, 2013;Wang et al., 2013a, b;Zielcke, 2015;Bösch et al., 2018;Beirle et al., 2019;Friedrich et al., 2019;Spinei et al., 2019;Frieß et al., 2019); (2) 15 long-term observation of trace gases and aerosols (e.g., Irie et al., 2008a;Roscoe et al., 2010;Li et al., 2013;Ma et al., 2013;Pinardi et al., 2013;Hendrick et al., 2014;Kanaya et al., 2014;Chan et al., 2015;Tian et al., 2017Tian et al., , 2018Wang et al., 2017a); (3) cloud identification and data correction (Gielen et al., 2014;Wagner et al., 2014; and (4) satellite and model data validation (e.g., Halla 20 et al., 2011;Ma et al., 2013;Pinardi et al., 2013;Chan et al., 2015;De Smedt et al., 2015;Vlemmix et al., 2015;Jin et al., 2016;Drosoglou et al., 2017;Wang et al., 2017b;Boersma et al., 2018;Liu et al., 2018). In this study we focus on the first aspect. At present, algorithms for the retrieval of vertical profiles from MAX-DOAS measurements can be separated into optimal estimation methods (OEMs) (Rodgers, 2000) and parameterized algorithms, which describe the shapes of atmospheric profiles with a limited set (usually 2 to 3) of parameters. In Frieß et al. (2019), different MAX-5 DOAS inversion schemes have been compared for synthetic input data for AODs up to 1 (plus a fog and two cloud scenarios). Given the importance and complexity of the aerosol effects on the atmospheric radiative transfer, it is also important to study the impact of heavy aerosol loads on the MAX-DOAS inversion algorithm.
Here, we compare the aerosol and trace gas profiles retrieved from MAX-DOAS by 10 two inversion algorithms (PriAM and MAPA, for details see below) with the input values (used as input for the DSCD simulations) for different aerosol scenarios. We also investigate the effects of the aerosol extinction and optical properties, including single-scattering albedo (SSA) and the asymmetry parameter (AP), on the aerosols profiles retrieved by PriAM in the UV and Vis. 15 This manuscript is organized as follows. Section 2 briefly describes the basic settings for the aerosol and NO2 profile inversions and for the tests of the profile comparisons.
The analysis strategy of this study is presented in Section 2.1. The model scenarios and radiative transfer model (RTM) settings are specified in Section 2.2. The 2 profile retrieval algorithms (PriAM and MAPA v. 0.98) are described in Section 2.3. The 20 effects of aerosols on the profile retrievals are discussed in Section 3.

Analysis strategy
The analysis strategy of this study is depicted in Fig. 1. A set of atmospheric scenarios variations of (orange box on the left side), including the viewing geometries, singlescattering albedos, and asymmetry parameters, was used to simulate the SCDs of traces 5 gases and O4, which will be described in detail in Section 2.2. The first step was to quantitatively evaluate the effect of different aerosol loads on the aerosol inversion (The upper part of the Fig.1). For that purpose the simulated O4 DSCDs were used as input for the aerosol profile retrievals. The retrieved and input aerosol profiles were then compared in order to characterize the effect of the aerosol properties (in particular the 10 AODs) on the retrieved aerosol profiles. The second step was to quantitatively evaluate the effect of different aerosol loads on the trace gas inversion (the bottom half of the Fig.1). For the trace gas retrievals, we apply 2 retrieval strategies where either the retrieved (S1, red box in the lower half of Fig.1) or the input (S2, red box in the lower half of Fig.1) aerosol profile is used.

RTM parameters
Before the effects of different aerosol loads on the retrieval of aerosol and trace gas profiles were analyzed, some basic parameters were prescribed for simulating the O4 and trace gas SCDs for the 'assumed input profiles' in the RTM. In this study, the 20 SCIAMACHY radiative transfer model (SCIATRAN) (version 2.2, Rozanov et al., 2005) is used in the forward model calculations. Here it is important to note that while SCIATRAN is also used in PriAM, in the MAPA algorithm a different RTM (MCARTIM, Deutschmann et al., 2011) is used. The differences of the simulated O4 DSCDs by both models are discussed in section 3.1.2.
SCIATRAN models radiative transfer processes in the terrestrial atmosphere and ocean in the spectral range from the ultraviolet to the thermal infrared including all significant 5 radiative transfer processes, e.g., the Rayleigh scattering, scattering by aerosol and cloud particles, and absorption by gaseous components and aerosols (Rozanov et al.,2014 Kreher et al., 2020). In the real atmosphere, a large variability of aerosol and trace gas profiles exists. However, we had to limit our profile shapes to typical profile shapes, which occur in the atmosphere. In this study, three different profile shapes were used, which are Exponential, Boltzmann, and Gaussian profile shapes: For RTM calculations, vertical profiles of the aerosol extinction  and NO2 5 concentration c are generated by multiplying f with the respective a priori column:

Figure S1
displays the corresponding vertical profiles for the different shapes. Table 1 lists the parameters used for RTM, including solar/viewing geometry, a priori 10 AOD/VCD, and parameters for the different profile shapes. The profile shape scenarios are introduced in detail in Section 3.1.

Description of the retrieval algorithms
The retrieval algorithms used in the comparison were PriAM and MAPA, as listed in 15  (Wang et al., 2013a andb, 2016), is based on the nonlinear optimal estimation method using the Levenberg-Marquardt modified Gauss-Newton numerical iteration procedure (Rodgers, 2000). PriAM uses the radiative transfer model (RTM) SCIATRAN version 2.2 (Rozanov et al., 2005) to calculate the weighting functions and other simulated quantities. PriAM consists of a 2-step inversion procedure. In the first step, aerosol extinction profiles are retrieved from the dependence of the O4 DSCDs on 5 elevation angle. The single-scattering albedo and asymmetry parameters have to be prescribed for the aerosol retrieval, e.g. based on other auxiliary measurements.
Subsequently, profiles of the trace gas number density are retrieved from the respective DSCDs in each MAX-DOAS elevation angle sequence (Wang et al., 2017). In order to avoid negative concentrations in the retrieved results (which are not possible in the 10 actual atmosphere), the retrievals are performed in logarithmic space. Here it should be noted that since the distribution probabilities of the retrieved profiles around the a priori profiles become asymmetric due to the inversion in logarithmic space, the sensitivity of the inversion to large values is greater than the sensitivity in linear space . PriAM can retrieve trace gas and aerosol profiles on any arbitrary vertical 15 grid. In this study, vertical layers with 200-m resolution in the altitude range below 4.0 km were used.

MAPA algorithm
The Mainz profile algorithm (MAPA) is a parameter-based inversion method using a It is worth noting that the maximum AOD in MAPA is 3, since higher AODs were not included in the RTM look-up table; therefore, only aerosol scenarios with AOD ≤ 3 15 were included in this study for MAPA.

Results and discussion
In order to simulate the effects of different aerosol loads on the MAX-DOAS profile inversion algorithms, the aerosol and trace gas profiles were set up with 5 AOD and 5 20 VCD values as presented in Tables 1 and different height parameters as shown in Table   1). The fitting error for all O4 DSCDs is set as 0.03×10 43 molecules 2 cm -5 , and that for NO2 DSCDs to 1% of the NO2 DSCDs in the PriAM and MAPA retrievals.
In order to limit the number of investigated profiles, first a sensitivity study with PriAM was carried for the selected profile shapes in Table 1 (these best represent the variety of realistic profile shapes). Based on the result shown in Figs. S2 to S4 it turned out that one height parameter is mostly representative for the parameterization with 5 Gaussian and Boltzmann profiles. For the exponential profiles, two height parameters were chosen, because for both height parameters systematically different results were obtained: when the scale heights of the exponential profiles are low, the retrieved profiles are close to the input profiles. But for high scale height, the retrieval underestimates the scale height of the exponential profiles. 10 The settings of the 4 chosen profile shapes are listed in Table 1. The 4 profiles are exponential profiles with scale heights of 0.5 km and 1.0 km, respectively, Gaussian profiles with the peak height at 1.0 km and FWHM of 0.5 km, and Boltzmann profiles with a height of 1.5km.
A similar sensitivity study was also performed for the trace gas profiles. The results of 15 the sensitivity analysis (Figs. S5 to S7) for NO2 profiles are consistent with the findings for the aerosol profiles. Thus the settings of the NO2 profile shapes for all further tasks are the same as for the aerosol profile in Table 1.

20
In this Section the effect of different AOD on the retrieval of aerosol profiles are  lifted layer retrieved by MAPA was close to the truth, although the aerosol extinction was underestimated. PriAM underestimated the width of the lifted layer, but the aerosol extinction was closer to the input value (Fig. 2). The height at which the maximum magnitudes of the absolute deviations for the Gaussian-shaped profiles mainly occurred was 1.5 km. The relative deviations between the retrieved and input aerosol profiles for 15 different AOD scenarios are similar for the same retrieval algorithm with the magnitude of the relative deviations for AOD >1.0 obviously greater than for AOD < 1.0. But the magnitude of the relative deviation does not increase with the increase in AOD.

Differences of the O4 SCDs simulated by SCIATRAN and MCARTIM
PriAM and MAPA use different RT models, which might partly explain systematic The comparison results for the O4 DSCDs ( Fig. S10) show that differences between the SCIATRAN and MCARTIM simulations using the same SSA and AP of 0.9 and 0.72, respectively, are up to 9%. If also different aerosol properties were used, these differences increased further. 10 In the next step, the differences of the retrieval results for the different input DSCDs

Sensitivity study of the a priori profile and the a priori profile covariance matrix
In order to improve the profile inversion accuracy for high AODs, the influence of the a priori profile and the a priori profile covariance matrix (Sa) was examined for PriAM.
Here it should be noted that an exponential shape with an AOD of 0.2 and a scale height of 1.0km was used as universal a priori profile in this study. In order to investigate the importance of the a priori profile for the aerosol profile retrieval, the influence of the a 5 priori profile was analyzed by changing the a priori profile to different aerosol profile shapes. Also, in addition to an AOD of 0.2 a second AOD value of 2.0 is used. The a priori profiles used in the sensitivity test are presented in Fig. 3. Here it should be noted that either the exponential profile shapes (universal a priori profile in PriAM in this study) or the same profile shapes (Boltzmann or Gaussian) as the input profiles are also 10 used as a priori profiles (referred to as 'corresponding a priori profiles' in the following). The comparison of the retrieved profiles using the different a priori profiles with the input profiles are shown in Fig. 4. It is found that the inversion results of the aerosol profile were slightly improved by changing the a priori profiles to the corresponding profile shapes, and that for the high AOD scenarios the inversion results 15 were further improved by increasing the AOD of the corresponding a priori profile ( Fig.4). However, increasing the AOD of the universal (exponential) a priori profile exhibited only little effect on the inversion results of the Boltzmann and Gaussian shapes. It is worth noting that when the input aerosol extinction coefficient was small, the use of a priori profiles with high AOD often yielded unrealistic results. 20 We also investigated the retrieval results in a perfect scenario in which the a priori profile agrees with the input profile. The results are presented in Fig. 5. The results show that the retrieved aerosol profiles are basically the same as the input profiles, and the relative deviation is less than 0.05% (Fig. S14 of the supplement). This sensitivity study shows that a) PriAM is implemented in a proper way and b) improved retrieval results can be obtained with improved a priori profiles. This provides a possibility for real measurements to obtain more accurate aerosol profiles if independent information 5 on the a priori profiles is available, e.g. from Lidar observations and sun photometers.
The Sa is the covariance matrix of the a priori profile (N×N), and its diagonal elements are the square of the a priori state uncertainties with the off-diagonal elements calculated from the Gaussian function with the correlation length of 0.5 km (Frieß et al., 2006). The universal a priori settings of Sa in this study was such that the diagonal 10 elements decreased exponentially with height. As a consequence, the smaller the Sa values, the more the inversion results depends on the prior state vector. The diagonal elements of Sa for the aerosol profile were set as the square of the a priori profile uncertainty. The standard settings for the a priori profile uncertainty were 10% of the a priori profile. To describe this ratio, a new symbol (Sa_ratio) is introduced (see Table   15 4). The effect of different Sa values on the retrieval of the 4 aerosol profiles was studied, and the results for an AOD of 5.0 are shown in Also the slopes are very close to unity. Therefore, it can be concluded that the 20 discrepancies of the retrieved aerosol profiles from the input profiles were not caused by failed convergences of the retrievals but must be related to systematic performances of the inversion algorithms in solving the ill-conditioned problem or RTM differences.  Table 1). Next, the simulated O4 DSCDs were 10 used to retrieve the aerosol extinction profiles by PriAM using the "correct" SSA and AP values (hence, the same values as they were applied in the corresponding O4 DSCD simulations). The retrieved aerosol profiles for all SSA and AP values are shown in Fig.   9. These results reveal that especially for low AODs the retrieved aerosol extinction profiles are very consistent for these scenarios. The relative and absolute deviations of 15 the resulting aerosol extinction profiles to the input profiles are presented in Fig. S16 and Fig. S17. The results are consistent with those presented in Figs.2 and S9. It is worth noting that the magnitude of the relative deviation for the Boltzmann aerosol profiles retrieved for SSA = 0.9 and AP = 0.72 was smaller than for the other scenarios.

AOD comparison of
In the next step, the effect of incorrect SSA and AP values (Table 3) on the aerosol 20 profile inversion was studied using the PriAM standard settings with SSA = 0.9 and AP = 0.72 for the simulation of the O4 DSCDs. The comparison of the retrieved profiles from the profiles with the incorrect SSA and AP values are presented in Fig. 10. It was found that when the SSA was smaller than the input value, the retrieved extinction profiles were larger than the input profiles and vice versa. It is worth noting that the result at 0 km is found to be opposite. For the AP the opposite dependency was found.
The effect of incorrect SSA and AP values on the aerosol profiles retrieved by PriAM 5 increased with increasing AOD with the absolute deviations of the extinction coefficient increasing from 0.01 to 1.5 km -1 as the AOD increased from 0.1 to 5.0.

NO2 results
First, the effects of different aerosol extinction profiles on the trace gas profile inversion were employed to retrieve the NO2 profiles (see Section 2.1). Here, as for the aerosol 15 inversions, also the scenario with SZA = 60°, RAA = 120°, SSA = 0.9, and AP = 0.72 was used. For the NO2 profiles, the exponential profile shape with a VCD of 1.0 × 10 16 molecules cm -2 was utilized as the universal a priori profile for PriAM. In the real atmosphere, the profiles of aerosols and NO2 are often quite different.

Comparison of NO2 profiles retrieved by PriAM and MAPA
Therefore, the effect of 4 typical aerosol profile shapes on the retrieval of Boltzmann 5 NO2 profiles by PriAM and MAPA using S1 with 3 AODs (0.3, 1.0, and 3.0) and 5 VCD values was further studied. The results showed that the relative and absolute deviations (Figs.S22and Fig.S23) between the Boltzmann NO2 profiles retrieved for the 4 aerosol profile shapes and the input NO2 profiles was basically the same, which means that the influence of the aerosol profile shapes on the retrieval of the NO2 profiles 10 is small.
The NO2 profiles for the 5 VCDs retrieved for scenarios S1 and S2 by PriAM were further compared with the input NO2 profiles for the 4 AOD conditions (0.3, 1.0, 3.0, and 5.0) (Fig. 13). The magnitude of the absolute deviations between the retrieved NO2 profiles using S1 and the input values were smaller than those for scenario S2, mainly 15 because the retrieved scale heights for the S1 inversions were closer to the input scale height (Fig. S25 of the supplement). An interesting phenomenon was the occurrence of some singular values (outliers which deviate from the true values in some layers) in the upper layers of the retrieved profiles for low NO2 VCDs (mainly for NO2 VCD < 1 × 10 16 molecules cm -2 ). The NO2 profiles retrieved for scenario S1 were more stable 20 than the profiles for scenario S2, with fewer singular values. When the AOD was large but the NO2 VCD was small, the magnitude of the absolute deviations of the NO2 number density at high altitudes was rather large, mainly because the lack of upperlevel information for the NO2 profiles made the inversion results more dependent on the a priori profile. When the VCD increased, although the box-AMF at high altitudes was small, the NO2 number density at high altitudes also contribute to the SCDs due to the high NO2 VCD. Thus, when the AOD was large, the value at high altitudes of the 5 NO2 profile can be better retrieved for increased NO2 VCDs.
The smaller the covariance matrix of the a priori profile (Sa), the more the retrieved profile depends on the a priori profile, which determines the degree to which the retrieved profile deviates from the a priori profile. As standard value of the Sa diagonal elements for retrieval of NO2 profiles, we used the square of 50% of the a priori profile. 10 And an a priori profile of exponential shape is used for NO2 retrieval (shown in Fig.   14), which may cause the great difference between the retrieved and input NO2 profile, especially for the Gaussian and Boltzmann NO2 profiles. In order to reduce the occurrence of single outliers in the upper layer of the NO2 profile, the Sa was reduced, thus making the retrieved profile more dependent on the a priori profile. The effect of 15 the Sa reduction on the retrieval of the 4 NO2 profile types was examined for AODs of 0.3 and 5.0 (Fig. 15). The Sa reduction increased the stability of the NO2 profile retrievals for low NO2 VCDs while simultaneously increasing the retrieved scale height.
The increase of Sa for high AOD conditions did not improve the inversion results but instead increased the occurrence of single outliers. For low NO2 VCDs, the 20 overestimation of the NO2 profile above 2.0 km can be explained by the higher values of the a priori profile at the upper layers, because when the AOD is large, the information content for the NO2 distribution at upper layers is very sparse, and the inversion results mainly depend on the a priori profile.
We also investigated the retrieval results if exactly the a priori profiles were used as input profiles. The results are presented in Fig. 16. In contrast to the aerosol inversion, here for some scenarios substantial differences are found, which in general increase 5 with increasing NO2 VCD and AOD. The smallest deviations are found for exponential and Boltzmann profiles, whereas for Gaussian profiles larger differences are found. The magnitude of the relative deviation increases from 20% to 50% with the NO2 VCD increasing from 1×10 14 to 10×10 16 molecules cm -2 (Fig. S28). It is important to note that the relative deviations for the retrieved NO2 profile by using both the aerosol and 10 NO2 a priori profiles as input profiles are less than those if only the aerosol a priori profile is used as input profile (PriAM by S2). This finding also provides guidance for gas inversions in the real atmosphere, if the aerosol and gas profiles can be provided as the a priori profile by other monitoring techniques, the inversion results of MAX-DOAS will be more accurate.

Comparison of the retrieved NO2 DSCD by PriAM and MAPA and the input NO2 DSCD for scenario (S1)
The NO2 DSCDs retrieved by PriAM and MAPA for scenario S1 were compared with the input NO2 DSCDs for 4 AOD scenarios and 5 VCDs, as shown in Fig. 17. The 20 correlations between the NO2 DSCDs retrieved by PriAM and the input values were similar, and for both algorithms values very close to 1.0 were found. Also for the slopes values close to 1.0 were found.

Comparison of the NO2 VCDs retrieved by PriAM and MAPA
The NO2 VCDs retrieved by PriAM and MAPA were compared with the input NO2 VCDs for 3 AOD scenarios and 5 VCDs, as shown in Fig. 18. The NO2 VCDs were 5 retrieved for PriAM for scenarios S1 and S2, and for MAPA for scenario S1. The VCDs retrieved by MAPA were closer to the input VCDs than those retrieved by PriAM. The retrievals of NO2 VCDs by MAPA and PriAM were only slightly affected by the AOD.
However, especially for PriAM, a strong and systematic dependence of the relative deviations on the NO2 VCD was found for all profile shapes. While for small NO2 10 VCDs the retrieved VCDs systematically overestimate the true NO2 VCDs (by up to 60% for PriAM), for large NO2 VCDs a systematic underestimation is observed (up to -20%). For Gaussian and Boltzmann profiles the deviations are larger than for the exponential profiles. Best agreement is found for NO2 VCDs around 1×10 16 molecules cm -2 . Here it should, however, be noted that while for low NO2 VCDs the magnitude of 15 the relative deviations are large, the magnitude of the absolute deviations are rather small.

Discussion
In this section we discuss the most important findings of our investigations and compare shapes is much larger, which allows a more detailed interpretation of the results.
Interestingly, the underestimation is systematically smaller for MAPA compared to PriAM, which indicates that only a part of the underestimation can be attributed 20 to the missing sensitivity of MAX-DOAS measurements towards higher altitudes.
In most cases, the larger effect for OE algorithms is probably due to the smoothing effect.
(2) Another important finding of this study is that the NO2 profiles are not very sensitive to the aerosol profiles confirming similar findings by Frieß et al. (2019).
(3) Further, it was found that the influence of the assumed asymmetry parameter and 5 single scattering albedo have typically a minor effect on the retrieval results. This is an important result, because usually the optical properties of aerosols are not well known. However, for aerosol inversions, the errors can still be up to 25%.
Thus it is still important to use reasonable values for both parameters to minimize the remaining uncertainties. For the NO2 inversion the influence of the asymmetry 10 parameter and single scattering albedo is smaller, similar as found by Hong et al. interesting to note that similar results are found for different profile shapes. This finding is probably caused by the fact that the trace gas VCD is mostly constrained by measurements at high elevation angles and the fact that the trace gas SCDs for these elevation angles only weakly depend on the profile shape. 5 Overall, the reason for the underestimation of the retrieved NO2 VCD for low NO2 VCDs is not yet fully understood. However, for the OE algorithm it might be caused by the influence of the a priori profile on the retrieval result. Interestingly, in this study a similar underestimation was also found for the parameterised algorithm (which was not observed by Frieß et al., 2019). This finding is currently unexplained,   Next, the differences of the PriAM and MAPA profile retrievals from the input profiles for different aerosol conditions were examined. We found that both algorithms have systematic deficiencies in retrieving the 4 profile shapes. Especially at low (above 0.2 km) and high (above 1.5 km) altitudes, often deviations from the true values are found, while for altitudes in between best agreement is found. The algorithms can reasonably retrieve the 4 aerosol profile shapes of AODs < 1.0 for two wavelengths, but for AODs > 1.0 the retrieved values systematically underestimate the true AODs. The smallest 5 magnitude of the relative deviations (typically <20%) were found for exponential profile shapes, with a scale height of 0.5 km. Large magnitude of the relative deviations (up to >50%) are found for the other profile shapes, especially for high AODs. Such a systematic underestimation has also been found in several previous studies (e.g. Irie et al., 2008, Frieß et al., 2016, Bösch et al. 2018, and Tirpitz et al., 2021. The systematic  Then, for PriAM, the effect of using different a priori profiles and a priori profile covariance matrices (Sa) was studied. The results showed that the retrieval results of the aerosol profiles were slightly improved when the same a priori profile shape as the input profile shape was used. The main reason is probably that the corresponding a priori bias was reduced. In addition, the inversion results were more consistent with the input profiles when the AOD of the a priori profile was increased for high AOD scenarios. The effect of the Sa value for the 4 aerosol shapes was investigated for the In the next part, the effects of the aerosol retrieval on the NO2 profile retrieval were 15 studied for PriAM and MAPA. Two strategies were utilized to retrieve the NO2 profiles, in which either the retrieved or the input aerosol profiles served as input for the retrievals of the NO2 profiles in strategy 1 (S1) and strategy 2 (S2), respectively.
Strategy S1 was applied both to PriAM and MAPA, while strategy S2 was only applied to PriAM. 20 From these studies several conclusions could be drawn: The relative deviations of the retrieved NO2 VCDs do only slightly depend on the AOD or the shape of the aerosol profiles. In contrast, especially for PriAM, a systematic dependence on the NO2 VCD was found. For low NO2 VCDs the retrieved NO2 VCDs largely underestimate the true NO2 VCDs by up to 60%, while for high NO2 VCDs a systematic underestimation up to -30% is found. Here it should be noted that in spite of the large relative deviations for low NO2 VCDs, the absolute deviations are rather small. The underestimation of the 5 true NO2 VCD for high NO2 VCDs by the retrieved profiles was not reported before. It is probably caused by non-linearities in the radiative transport for strong NO2 absorptions. The increase of the Sa values did not improve the inversion results for high AODs, but instead lead to the occurrence of single outliers in some layers.
We also performed a consistency check of the optimal estimation algorithm by using 10 exactly the a priori profiles as input profiles. For the aerosol retrieval, almost the exact input profiles were retrieved (differences < 0.05%) indicating that there are no inconsistencies in the algorithm. However, for the trace gas profiles no such perfect agreement was found, especially towards scenarios with high AODs and NO2 VCDs indicating the more complex dependencies of trace gas retrievals compared to aerosol 15 retrievals. Here it is important to note that the relative deviations for the retrieved NO2 profile by using both the aerosol and NO2 a priori profiles as input profiles are smaller than those for scenarios for which only the aerosol a priori profile is used as input profile.

Figure 17. Correlation plots between the retrieved NO2 DSCDs by PriAM and MAPA versus the input NO2 DSCDs for 3 AOD scenarios and 5 VCDs for scenario S1
The colors refer to the VCD values and algorithms shown at the top. PriAM (S1 and S2) and MAPA (S1) for 3 AOD scenarios and 5 VCDs.
The colors and shapes refer to the deviations of the retrieved and input NO2 VCDs of the different algorithms at different AODs shown at the right.