High-resolution and Monte Carlo additions to the SASKTRAN radiative transfer model

The Optical Spectrograph and InfraRed Imaging System (OSIRIS) instrument on board the Odin spacecraft has been measuring limb-scattered radiance since 2001. The vertical radiance profiles measured as the instrument nods are inverted, with the aid of the SASKTRAN radiative transfer model, to obtain vertical profiles of trace atmospheric constituents. Here we describe two newly developed modes of the SASKTRAN radiative transfer model: a high-spatialresolution mode and a Monte Carlo mode. The high-spatialresolution mode is a successive-orders model capable of modelling the multiply scattered radiance when the atmosphere is not spherically symmetric; the Monte Carlo mode is intended for use as a highly accurate reference model. It is shown that the two models agree in a wide variety of solar conditions to within 0.2 %. As an example case for both models, Odin–OSIRIS scans were simulated with the Monte Carlo model and retrieved using the high-resolution model. A systematic bias of up to 4 % in retrieved ozone number density between scans where the instrument is scanning up or scanning down was identified. The bias is largest when the sun is near the horizon and the solar scattering angle is far from 90. It was found that calculating the multiply scattered diffuse field at five discrete solar zenith angles is sufficient to eliminate the bias for typical Odin–OSIRIS geometries.


Introduction
Remote sensing has played an integral role in our understanding and monitoring of Earth's atmosphere, notably in the study of ozone and the retrieval of vertically resolved atmospheric constituent profiles.Some of the first standard ozone profiles were retrieved using data from occultation instruments which provided high-quality, near-direct measurement of optical depth profiles.Although highly accurate, these instruments had limited sampling capabilities, generally measuring between 16 and 32 profiles per day.To help address this, several instruments that measure limb-scattered light in the ultraviolet (UV) to near infrared (NIR) have since been placed in orbit, including SCanning Imaging Absorption spectroMeter for Atmospheric CHartographY (SCIA-MACHY) (Bovensmann et al., 1999), OSIRIS (Optical Spectrograph and InfraRed Imaging System; Llewellyn et al., 2004), and OMPS (Ozone Mapping and Profiler Suite; Rault and Loughman, 2013).
While limb-scatter measurement provides greatly improved sampling rates, the signal interpretation is much more convoluted than for occultation measurements, owing to the complicated scattering paths of UV and visible light.Nevertheless, several successful retrieval algorithms have been implemented by the SCIAMACHY (von Savigny et al., 2005;Rozanov et al., 2007;Sonkaew et al., 2009), OMPS (Rault and Loughman, 2013), and OSIRIS (Haley et al., 2004;Degenstein et al., 2009) data processing groups to retrieve ozone profiles using the Hartley-Huggins and Chappuis absorption bands.In addition, several other species have been retrieved including NO 2 (Bourassa et al., 2011), BrO (Rozanov et al., 2011a), and H 2 O (Rozanov et al., 2011b).These retrievals rely heavily on the ability to accurately forward-model the radiance over a variety of solar illumination conditions, both over the course of an orbit and over the course of a single vertical scan.This is particularly important for retrievals, such as those listed above, which use a high-altitude normalization, as the local solar illumination condition varies with altitude and errors in modelling the diffuse radiance field leads to errors in the retrieved atmospheric constituents.While this ef- fect is greater in scanning instruments such as SCIAMACHY and OSIRIS, it is still present to a lesser degree in imaging instruments such as OMPS.For forward modelling, OSIRIS retrievals have typically relied on SASKTRAN, a spherical, successive-orders radiative transfer model (Bourassa et al., 2008).
This paper describes the addition of two new engines to the SASKTRAN framework which allow for Monte Carlo and high-spatial-resolution radiative transfer modelling.As an example of usage, systematic errors in the OSIRIS ozone retrieval due to low-resolution radiative transfer limitations are explored and results from model simulations are used to identify and improve treatment of problematic measurement conditions.

The SASKTRAN framework
The forward model used in this study is SASKTRAN.SASKTRAN is a radiative transfer framework consisting of two major components: a set of climatologies and optical properties which are used to specify the atmospheric state and an engine which solves the equation of radiative transfer for quantities of interest.Currently SASKTRAN consists of three separate engines: a standard successive-ordersof-scattering engine (SO), a high-spatial-resolution engine (HR), and a Monte Carlo engine (MC).All components of the SASKTRAN framework treat the planet and atmosphere as spherical, and all path lengths and angles are computed using a spherical geometry.

The successive-orders engine
The original SASKTRAN radiative transfer model outlined in Bourassa et al. (2008) has been incorporated into the newly designed SASKTRAN framework.The successiveorders engine (SO) uses the successive-orders-of-scattering method to calculate the radiance field in a region of interest and closely resembles the original model in Bourassa et al. (2008).Here we provide a brief overview of the method.
The radiance can be written in integral form, I (r 0 , ˆ ) = 0 s end J (s)e −τ (s,0) ds + I end (s end )e −τ (s end ,0) , (1) where s is distance along a path implicitly defined by an r 0 and ˆ , J is the source function, I end is the radiance at the end of the line of sight, and τ (s, 0) is the optical depth given by τ (s, 0) = where k is the extinction.Here we have followed the convention used in Bourassa et al. (2008) that s is 0 at the observer location and negative at the end point s end (see Fig. 1).In general, the source function depends on position in the atmosphere and a local look direction, making it a fivedimensional field.In the UV to NIR region, the source function consists of scattering alone and is given by where k scat is the scattering extinction, p is the normalized phase function, and the integral is over the unit sphere.
The radiance is calculated with the successive-orders-ofscattering method.Ignoring the discretization that needs to be done in a real model, the technique has an intuitive explanation beginning with the incoming solar irradiance.Solar rays are attenuated to all points in the atmosphere and scattered, forming the source function for light that has been scattered once.The scattered rays are then propagated through the atmosphere and, once again, scattered at all points, forming the source function for light that has been scattered twice.The process can then be repeated to find the source function for light that has been scattered to an arbitrary order.Mathematically we are applying Eqs. ( 1) and (3) iteratively until convergence is achieved.The ground surface is assumed to be Lambertian and is handled through the I end term in Eq. ( 1).For most wavelengths the source term becomes negligibly small (for limb-scatter retrievals) after 10 orders of scatter.More orders of scatter are required for strict convergence of the observed radiance in the 350-500 nm window, however, where Rayleigh scattering is strong and there is little absorption.
Once the full source function is known, the radiance for a specific line of sight can be calculated through a relatively simple line integral.We approximate the line integral by splitting the ray into segments where the extinction and source function are assumed to be constant.We call these segments cells.The successive-orders model finds the cell boundaries by calculating intersections of the line of sight with a set of spherical shells (Fig. 1), which by default are spaced uniformly in altitude with a separation of 1 km but can be placed on any user defined grid.An additional cell boundary is added at the tangent point to ensure that the start and end of a cell are not at the same altitude.
To perform the actual calculation of the source term, the integral in Eq. ( 3) must be discretized.If atmospheric properties are invariant with respect to rotation about the solar direction, then the diffuse radiation field is a function of altitude, solar zenith angle, and local look direction.This reduces the iterative integral from five dimensions to four.Fineness of the discretization of solar zenith angle is of particular importance when balancing accuracy with execution speed.We call the diffuse field calculated for a discrete set of local look directions and altitudes above a geographic location a diffuse profile.This is specified at a set of diffuse points at discrete altitudes and diffuse incoming and outgoing rays originating from each point at which the field is calculated in discrete directions.The lowest point on every diffuse profile is placed on the ground and handles the surface contributions to higher orders of scatter.Incoming and outgoing rays simply represent the discretization of Eq. ( 3) inside the engine.Accurate simulation of observed radiance requires more diffuse profiles when the line of sight spans a large gradient in solar zenith angle or when the tangent point is near the terminator.A limited study of the number of required diffuse profiles to achieve a precision of 0.2 % for extreme conditions is done in Sect.2.5.2.When performing the final radiance line integral, source terms from diffuse profiles are interpolated linearly in solar zenith angle; interpolation between points is linear in altitude, and interpolation between diffuse rays is bilinear on the triangle that bounds a query point or direction on a unit sphere.
Previously, SO would approximate the diffuse field by assuming the diffuse profiles are uncoupled.For example, when calculating the third-order-of-scatter source term a diffuse profile uses only its own second-order source term, rather than coupling to other profiles.The approximation affects the third and higher orders of scatter, and is thus small at many wavelengths, but can be significant in certain conditions, for example, near 350 nm looking across the terminator.This approximation has since been lifted, fully coupling diffuse profiles together.It should be noted that the coupling does not change the theoretical basis of the algorithm, as diffuse profiles were initially uncoupled only for ease of implementation.The coupling of diffuse profiles causes the model to use a large amount of RAM, approximately 700 MB for each diffuse profile.

The high-resolution engine
A new high-spatial-resolution engine under the SASKTRAN radiative transfer framework has been developed.The engine is intended for use in future satellite missions requiring higher detail in the radiative transfer calculation.The radiative transfer equation is solved in the same fashion as SO, but less information is cached for each wavelength.The reduc-tion in caching causes HR to use approximately one-seventh the RAM in identical configurations, at the expense of increased execution time.
Lower memory usage allows for higher-accuracy computations in both the single-scattered and diffuse radiation fields.In addition, several new features have been implemented: -the ability to handle areas of large or highly variable extinction (e.g.cirrus clouds, see Wiensz et al. (2013) for information about specifying subvisual cirrus in SASK-TRAN) through adaptive cell splitting; -support for atmospheric constituents which vary in two or three dimensions, e.g.latitude and longitude, rather than exclusively in altitude; -weighting functions for absorbing species can be approximated analytically in one and two dimensions for little computational cost.

Numerical integration improvements
Line integrals must be performed in two different areas when performing the successive-orders method: the calculation of optical depth and the integration of source terms along a path.Optical depth is calculated as in Loughman et al. (2015), where extinction is allowed to vary linearly in altitude within each cell.The integration of source terms requires the definition of both optical depth and extinction as functions of distance along a ray.The total optical depth for a ray is simply the sum of the optical depth for each cell individually.For a single cell, where τ (s j +1 , s j ) is the optical depth for cell j , k(s) and h(s) are the extinction and altitude as a function of path length respectively, and k 0 and k h are constants determined by values of k(s) on the cell boundary.From Eq. ( 4) we define an effective extinction, k j , for the cell j : where s j = |s j +1 − s j | is the distance from the start (s j ) to the end of the cell (s j +1 ).
When the extinction varies significantly between s 1 and s 2 , k j becomes a poor representation of the atmospheric state.To improve the representation of extinction along a ray, HR adds the capability to split cells when the ratio of total extinction between the start and end of a cell, min(k(s j ), k(s j +1 )) max(k(s j ), k(s j +1 )) , is less than a user-specified value (typically on the order of 0.95).This condition by itself can cause excessive splitting near the top of the atmosphere where the extinction is small but highly variable.Therefore, an additional condition is added that the optical depth of the cell must be greater than another user-specified value (typically 0.01) for the splitting to occur.The radiance along a specific line of sight as a result of atmospheric scattering may be written as the sum of radiance contributions from individual cells attenuated back to the observer, where I is the radiance seen by the observer, τ (s j , 0) is the optical depth from the observer to the start of cell j , and I j is the radiance at the start of the cell due to sources within the cell.The quantity I j may be written where J (s) is the source function.SO computes this integral by evaluating k(s) and J (s) at the cell midpoint and performing the integral where s m = (s j +s j +1 )/2.The HR mode improves this computation by letting J (s) be a quadratic function in (s − s j ) while keeping k(s) constant.The constant value of k(s) is chosen as the effective value of the extinction across the cell, k j , defined in Eq. ( 5).Note that the cell-splitting procedure outlined removes conditions where the assumption of constant k(s) is poor.The source function, J (s), is computed as the Lagrange interpolating polynomial through the start, middle, and end points of the cell.Similar techniques are used in Olson and Kunasz (1987) and Griffioen and Oikarinen (2000).By writing J (s) = α j + β j (s − s j ) + γ j (s − s j ) 2 for one cell j , the integral in Eq. ( 8) can be explicitly evaluated to obtain where the Lagrange coefficients α j , β j , γ j are given by α j = J (s j ) Terms of the form 1 − exp − k j s j when k j s j 1 are evaluated through a Taylor series approximation to avoid issues with numerical precision.

Two-and three-dimensional atmospheres
Support has been added in HR mode for the atmospheric constituents to vary in two or three dimensions.There are two main complications in breaking the assumption of horizontal homogeneity.First, the diffuse field now varies in an additional dimension; second, the line integration techniques need to be modified to deal with an additional dimension in which quantities may vary.
To account for the now five-dimensional diffuse field, diffuse profiles are not limited to placement at discrete solar zenith angles.Interpolation of the source function between diffuse profiles is done by finding the nearest three diffuse profiles and performing linear interpolation using the vertices of the formed triangle.
For a limb geometry measurement, simply finding intersections with a set of spherical shells, as is done in SO, causes cells near the tangent point to have lengths of up to 100 times the vertical spacing (usually 1 km).To combat this, the HR mode enhances the ray tracing stage by finding intersections with a list of arbitrary geometry primitives (e.g.spheres, cones, planes).The list of primitives used depends on the mode in which the model is operating.For a onedimensional atmosphere the list consists of a set of spheres, replicating SO.
There are three primary modes where the HR model supports variation of atmospheric constituents in more than one dimension.The first is the fully three-dimensional mode, wherein atmosphere is allowed to vary arbitrarily.Internally, the atmosphere is stored as a set of vertical profiles, specified above discrete geographic locations.For HR it is sufficient (and desirable, for time efficiency) to specify the atmosphere only on a region slightly larger than that where the diffuse field is to be solved.The Delaunay triangulation on a sphere of atmospheric profile locations is found, and queries of the atmospheric state are answered by interpolating between the three profiles which, when their locations are joined by geodesics to form a spherical triangle, bound the query point (Delaunay, 1934).The grid is conceptually shown in Fig. 2b.Calculating the points along the ray at which the bounding Delaunay triangle changes is computationally intensive, so for ray tracing purposes we approximate the grid by the intersections of a set of cones and planes.Successively larger ray tracing concentric cones are placed at the tangent point; planes containing the tangent point and centre of the Earth with various azimuth angles are also added.
For satellite tomography applications, a second mode is implemented where the atmosphere varies in the orbital plane, i.e. in altitude and in angle along the orbit track (Fig. 2a).The ray tracing primitives added in addition to the spherical shells are planes perpendicular to the orbit plane and passing through the centre of the Earth.These guarantee that variations in optical properties along the orbit plane are resolved even when sphere intersections are sparse.
As previously stated, the assumption of horizontal atmospheric homogeneity leads to the simplification that the diffuse field does not vary in solar azimuth.This simplification also holds when atmospheric constituents are allowed to vary in solar zenith angle as well as altitude.This special case is particularly useful for the inclusion of photochemically active species.Here, diffuse profiles can be placed once again in solar zenith angle without compromising the accuracy of the solution.To account for the additional variation in the numerical integration, cones of constant solar zenith angle are added to the ray tracing primitives list.

Analytical weighting functions
The HR model adds the capability to calculate weighting functions (derivatives of radiance with respect to atmospheric parameters) analytically with little computational overhead.Fast calculation of weighting functions is necessary for many retrieval algorithms.One method to compute the weighting functions is through finite-difference schemes, which requires the forward model to be run a second time with an atmospheric parameter slightly perturbed.Often when calculating weighting functions the forward model is run for single-scattering only to save on execution time.The singlescattering approximation was shown to produce weighting functions sufficient for use in O 3 and NO 2 retrievals in Kaiser and Burrows (2003).
Here we present a simple method for analytical computation of weighting functions which is fast, is more accurate than the single-scattering approximation, and extends naturally to two-and three-dimensional atmospheres.We start by taking the derivative of Eq. ( 7), or using the formulae for I j and τ (s j , 0), The first and second terms in the sum represent changes to the radiance contribution from specific cells, while the third term is the added attenuation.By adding ray tracing primitives which bound the perturbation ∂x, the integrals in the first and third terms can be performed (assuming we know ∂k(s)/∂x) using the techniques described in Sect.2.3.1.The second term is expensive to calculate exactly and depends on the nature of ∂x.
For absorbing species, i.e. x = k abs , we approximate ∂J (s)/∂k abs by only computing changes to the first-orderof-scattering source term, J 1 (s), analytically.The first-order source term is light scattered directly from the sun; thus a change in absorbing species can only affect the solar transmission (the optical depth from the sun to the scattering point), and therefore In spherically symmetric atmospheres the change in the higher-orders-of-scattering source term may be approximated by assuming the incoming radiance to a point in the atmosphere is constant below the local horizon and zero above.
Then the derivative of the multiply scattered source term, ∂J ms /∂k abs , is equal to the average slant extinction.The final weighting function may then be calculated using Eq. ( 13) and the same numerical integration techniques already within the model.The weighting functions for number density of a specific absorbing species can then be found by multiplying by that species' absorption cross section.
As an example, weighting functions for a typical ozone distribution were calculated for a line of sight with tan- Ozone weighting functions at a wavelength of 330 nm for a line of sight with tangent altitude 24.5 km.Shown are the results for the analytical method (AL), the finite-difference method when single scattering is only considered (SS), and the finite-difference method when multiple scattering is included (MS).The right panel shows the error in the analytical and single-scattering methods compared to the multiple scattering method.
gent altitude of 24.5 km and are shown in Fig. 3. Generally the analytical weighting functions agree with those calculated through the finite-difference method to within 2 % down to the peak value.Agreement below the peak value is worse.However, values below the peak have much less relevance to retrieval applications as they represent contributions from higher orders of scatter.In all cases the analytical weighting functions agree better than ones calculated with the single-scattering approximation.Calculation of the analytical weighting functions takes approximately one-fifth the time of a single radiative transfer calculation.For a single-scattering species, x = k i,scat , the scattering extinction of species i. Writing the normalized phase function of all species, p(s), as with p i representing the phase function of species i, and taking the derivative yields where ω i is the single scatter albedo of species i. Weighting functions for scattering species can then be found through the same line integration techniques described previously.

The Monte Carlo engine
As shown in Bourassa et al. (2008), the successive-orders method is sensitive to the density (and implicitly the place-ment) of diffuse profiles and to the resolution of rays incoming and outgoing to diffuse points.In particular, where gradients in the diffuse radiance field are large many profiles are required to capture the horizontal diffusion of light, and where the field is highly non-isotropic a high resolution of incoming/outgoing rays is required to preserve detail ergodic to the phase function.Since the order-n diffuse field is used to compute the order-(n + 1) field, any deficiencies in these resolutions or the interpolation schemes used in HR are necessarily compounded and amplified in the higher-order diffuse field.Diagnosis of such errors by comparison of the output of HR to that of other models is difficult, as support for various optical property and climatological species libraries is not common across models.Furthermore, the method used to solve the radiative transfer problem varies greatly from model to model, and each implementation is sensitive to computational limits in its own way.
It is desired, therefore, to test the discrete-ordinates successive-orders method as implemented in SO and HR while preserving the underlying framework of atmospheric state, optical properties, climatological species, ray tracing, and numerical integration.This motivates the development of the Monte Carlo engine, which uses optical properties, ray tracing algorithms, and quadrature identical to that of SO and HR (including those developments noted in Sects.2.3.1 and 2.3.2) but uses Monte Carlo integration to produce an unbiased (i.e.zero error in mean) estimate of observed radiance.

Monte Carlo integration
The backwards Monte Carlo algorithm for observers with a narrow field of view, as implemented in several radiative transfer codes (Collins et al., 1972;Oikarinen et al., 1999;Postylyakov, 2004;Deutschmann et al., 2011), relies on the method of inverse transform sampling, explained briefly below in terms of the diffuse radiance and source terms used in the SASKTRAN framework.The scope of this paper is limited to scalar radiative transfer; the addition of polarization to the SASKTRAN framework (for both MC and HR) is the subject of ongoing work.
The exactly (n + 1) times scattered radiance, I n+1 , at a point r and in look direction ˆ as derived from the equation of radiative transfer is written (for scalar light, for brevity) as where t is distance along the line of sight measured away from the observer (opposite to the direction of s), r := r + t ˆ , r := r + t ˆ (Bourassa et al., 2008).The change of variables from s (as used in 1) to t = −s is made because the backwards Monte Carlo algorithm considers ray paths coming "out of" the observer, whereas the successiveorders method considers diffuse light scattering "into" the observer line of sight.Under a change of variables to T (t) = e − t 0 k(t ) dt , Eq. ( 17) becomes r (T ) = r + t ˆ : T = T (t).Therefore, an unbiased estimate of I n+1 (r, ˆ ) is formed by taking the expected value of J n (r(T ), ˆ ) over the domain of integration and multiplying by the measure of the domain.Because the integral is over T , the expected value of the integrand must be taken with r (T ) distributed such that the distribution of T is uniform.Taking the notation that F (X) X∼ξ is the expected value of the random variable F when its argument X follows the distribution ξ , an unbiased estimate of Eq. ( 18) is given by .
Similarly, for scalar light (recall the scalar phase function depends on scattering angle only) the nth-order diffuse source term is where p(r, θ ) is the normalized phase function and ω 0 (r) is the single-scattering albedo k scat (r)/k(r).Then the expected value of the integrand over both domains of integration, where the scattering angle is sampled by forms an unbiased estimate of the integral.

Implementation
Estimates of I n for any observer are made by taking the mean of m n independent samples of Eq. ( 19).To draw a single sample of Eq. ( 19) for order of scatter n, transmission through the atmosphere along a ray is calculated.The atmosphere may be of any type supported generally in the SASKTRAN framework; i.e. the code supports 1-D, 2-D, and 3-D geometries.The ray may be any ray connected to the observer through some arbitrary ray history composed of (n − 1) scattering points joined by rays and terminating at the observer.If the ray intersects the ground it is terminated with transmission zero, i.e. photons are not allowed to enter the planetary surface.A target transmission is chosen randomly from a uniform distribution between 1 and the transmission at the end of the ray.If the ray hits the ground and the target transmission is smaller than the ray's transmission through the atmosphere, the scatter is said to happen at the ground intersection, where the ground is treated as a Lambertian surface.Otherwise, the cell in which the target transmission occurs is found, and the scatter point is found by iterating the transmission calculation inside the cell to within some userdefined threshold distance.For most applications this threshold is set to 50.0 m, and finer values result in no significant change in simulated radiances.For atmospheres with regions where the scattering extinction is very large (e.g.cloudy atmospheres); however, it may be desired to decrease this value to better capture the subsurface-like scattering that occurs on the boundary of the optically thick region.Transmission from the sun to the chosen scattering point, T sun , is then calculated, and the sample of I n is taken as T sun attenuated by the scattering probability from the sun direction into the ray direction, p(r, θ sun ), and by any factors (1 − T (t end )) and ω 0 (from Eq. 19 and 21 respectively) in the ray history back to the observer.Higher-order radiance I n+1 is sampled by using a scatter point r (n) s chosen during a sampling of I n to choose the distribution p(r (n) s , θ ) used to sample Eq. ( 21); for ground reflection p(r (n) s , θ ) is chosen according to Lambert's cosine law.In a time-forward sense, this chooses an incoming direction for the multiply scattered light; in the backwards Monte Carlo algorithm this chooses an outgoing direction ˆ s for the next element of the ray history.A sample of the higher-order radiance I n+1 (r (n+1) s , ˆ s ) is then drawn as was done for I n and is attenuated back to the observer through n i=1 (1 − T (i) (t end ))ω (i) 0 as described above.Reusing the 1 through n scattering points as the ray path history for the (n + 1)th-order scatter allows samples of I n+1 to be correlated to samples of I n , n < (n + 1) to reduce the computational effort of sampling I n+1 .Because the observer line of sight ray is cached and the (n + 1) order scattering point is connected to the observer through (n + 1) rays, reusing ray histories decreases the effort of sampling I n+1 by a factor n.
Following the backwards Monte Carlo algorithm, the ray history begins at the observer, with transmission along the observer line of sight providing the distribution T (1) (s) used to sample I 1 .The path is propagated to higher orders of scattering until the attenuation factor n−1 i=1 (1 − T (i) (s end ))ω (i) 0 falls below some user-specified minimum weight fraction, w min , of the already-measured radiance n−1 i=1 I n along that ray history.If the attenuation factor falls below w min n−1 i=1 I n , propagation is stopped; i.e. the ray path is truncated and samples of higher-order radiance are assumed to be zero.Truncation is typically performed for w min = σ u 3000 , where σ u is the user-desired standard deviation (SD) of the algorithm output as a fraction of the simulated signal.Thus the systematic underestimation of higher-order radiance is smaller than the SD in total simulated radiance by a factor of about 3000, which can be considered negligible.
If w min = 0, no truncation will occur and this error will be zero as all rays are propagated to some maximum order n p chosen according to a stratified sampling technique.
The algorithm is multithreaded over ray histories.That is, each thread propagates a separate ray history to n p orders of scatter, adding a sample to its thread-local estimate of I n when the ray is propagated to the nth order.The sample variance of samples of each order and sample covariance between samples of different orders are tracked in each thread.This continues until the estimated SD of n I n falls below σ u n I n or until a user-specified maximum number of ray histories, M u , have been generated.At this point samples of each order of scatter are merged between threads.Since each thread operates completely independently and there is no covariance between estimates from different ray histories, the samples generated by all threads can be merged and treated as though they were generated by a single thread.The sample variance of each I n and sample covariance between each I n 1 , I n 2 are calculated to estimate the sample variance in n max n=1 I n .Because the number of covariance terms grows as the square of the number of orders being tracked, samples of n ≥ n bin are binned together; typically n bin = 8 in our implementation.This estimate of sample variance of the observed radiance is accurate to approximately 5 or 10 % (when the higher-order signal is weak or strong respectively) when compared against the variance in MC output from many identical runs.SD of simulation output is therefore equal to the user-desired value to within 5 %.
Because MC resolves rays at every scattering event, it is simple to collect statistics about the physical distribution of scattering points as well as the variance and covariance of different orders of I n with essentially zero overhead; user options exist to allow output of these statistics.

Comparison between the high-resolution and
Monte Carlo engines

Timing
All timing is carried out on an Intel Core i7-4770 CPU at 3.40 GHz, with 16 GB RAM on a 64 bit Windows 7 OS.All calculations are performed with multithreading over seven threads where the algorithm can be multithreaded.Timing of the Monte Carlo engine is highly sensitive to wavelength and solar zenith angle: these determine the relative importance of higher-order scattering and geometry dependence of the solar source term in the neighbourhood of the line of sight.The importance of higher-order scattering is discussed in Sect.2.4.Variance of the solar source term increases the variance in samples of I n because ray histories are chosen independent of the spatial variation in the solar source term.For example, for a limb-viewing line of sight along the terminator many scattering points will be chosen close to the tangent point, but if the path from the tangent point to the sun is optically thick (e.g. as for UV wavelengths) these sam- ples are effectively zero, while most of the non-zero contribution to I n comes from samples at higher-altitude scattering points.
Table 1 shows the time required to produce MC data for the geometries shown in Fig. 4 (discussed in Sect.2.5.2),averaged over tangent altitude and solar azimuth angle.This is the time required to sample the observed radiance for SD 0.2 and 1.0 % of the measured signal, neglecting the time to fill look-up tables of optical properties and solar transmission (0.98 s per wavelength in MC, which caches solar transmission at high resolution).The above-mentioned deterioration in performance for optically thick lines of sight is obviousthis can be ameliorated using multiple-importance sampling techniques (Veach and Guibas, 1995), which will be implemented in future releases.For tangent heights above 30 km, where the atmosphere is less optically thick in the near UV, equivalent values for the leftmost data column of Table 1 are between 0.03 and 0.42 s.
HR simulations of the accuracy shown in Fig. 4, by contrast, require approximately 79 s per wavelength.The HR engine can simulate many observer lines of sight simultaneously and becomes slightly more efficient when many wavelengths are simulated, so direct comparison to MC is difficult.If HR is run at lower resolution but still with 11 diffuse profiles, which increases the error with respect to MC by at most 0.8 % for the configurations in Fig. 4, and by less than 0.4 % for the SZA < 89 • cases, the same simulation requires only 17 s per wavelength.
Direct comparison of the HR and SO (with coupled diffuse profiles) is more straightforward.Runtime (per wavelength) to simulate radiance over a large range of near-UV through near-IR wavelengths is shown in Table 2.The time required for either model to run is largely independent of wavelength and geometry, and is approximately constant for a reasonable number (i.e.≤ 5000) of lines of sight.While HR is consistently slower than SO by a factor of approximately 1.25, SO is memory-limited and cannot reproduce the accuracy of HR under conditions requiring many diffuse profiles.

Accuracy
The SO engine was compared to several other radiative transfer models in Bourassa et al. (2008).The HR engine can be configured to give results identical to those of SO to approximately machine precision; in any case their difference is orders of magnitude lower than the differences reported between models in Bourassa et al. (2008).The validation of SO in Bourassa et al. (2008) then applies equally to HR in this configuration.We will now compare the output of HR, configured at resolution higher than that which gives output identical to that of SO, to the MC engine built into the SASK-TRAN framework.HR and MC have been compared for a variety of solar conditions and wavelengths.The atmosphere used is representative of a "standard" atmosphere away from the Earth surface, consisting of Rayleigh scatterers, ozone, and aerosol.The surface albedo was set to 0.95 in order to maximize the multiply scattered signal and thereby accentuate divergence of the two engines.
Figure 4 shows the percent difference between output of the two engines for a set of observer-sun geometries at three wavelengths, with HR run using 11 diffuse profiles and MC run with 250 000 ray histories per line of sight for SD better than 0.2 % (recall the first-order signal often dominates and converges quickly in MC).With the exception of dusk conditions where the observer is looking across the terminator towards the dayside (top left-hand frames), there is agreement between the engines to within the 0.2 % maximum SD of MC output.The divergent cases are those in which the line of sight spans a large range of solar zenith angles and is optically thick due to scattering.Note that agreement is still good for wavelength 602.29 nm, for which the Rayleigh atmosphere is optically thin relative to wavelengths in the range of 340 nm. Figure 4 indicates that more than 11 diffuse profiles are needed for HR to converge only when the atmosphere is quite optically thick and the observer geometry is such that the diffuse source term changes drastically along the line of sight.
Figure 5 shows the number of diffuse profiles required to reach 0.2 % agreement between HR and MC for tangent altitude 10 km and wavelength 345 nm.The single-scattering albedo at 345 nm is high; therefore higher orders of scatter represent a large contribution to the simulated radiance.Figure 5 then represents the number of diffuse profiles required to simulate limb radiance accurate to 0.2 % in the approximate "worst-case" scenario in a one-dimensional atmosphere.Where MC is slow to converge (when the line of sight is in darkness where T (t) changes rapidly, the shaded region in Fig. 5), HR, using 119 coupled diffuse profiles, is taken as the reference engine.

Optical Spectrograph and InfraRed Imaging System
As an example usage case, the two radiative transfer models are applied to data from the Optical Spectrograph and InfraRed Imaging System (OSIRIS), a limb-scatter instrument launched in 2001 on board the Odin satellite (Llewellyn et al., 2004).Odin is in a sun-synchronous orbit at an altitude of 600 km with ascending and descending node local times of with MC, at 10 km altitude and 345 nm.In the shaded region the reference calculation was done using HR with 119 diffuse profiles.
18:00 and 06:00 respectively, providing coverage from 82 • S to 82 • N. The Optical Spectrograph (OS) is the primary instrument, measuring wavelengths between 284 and 810 nm with approximately 1.0 nm resolution.A single line of sight extends from the instrument and exposes the OS detector to limb-scatter radiance.Odin nods as it orbits, scanning the line of sight tangent point from 7 to 75 km during typical operation; during some scans this range is extended up to 110 km.A scan takes approximately 90 s and provides vertical sampling every 2 km with a vertical resolution of approximately 1 km.Solar zenith angle at the tangent point varies between 60 and 120 • , with the solar scattering angle between 60 and 120 • as well.For operational retrievals, only scans with a solar zenith angle at the tangent point less than 90 • are used.Figure 6 illustrates an up-scan-down-scan sequence of the OS line of sight when OSIRIS scans to 110 km.In panel A the satellite position is marked by open circles, and the tangent point by solid dots.For clarity only every fifth measurement is shown.Panel B shows the ground track of the tangent points and with contours of constant solar zenith angle.These scans have a solar scattering angle close to 60 • , which is representative of the largest change in solar zenith angle over the course of any OSIRIS scan.Scans with solar scattering angle near 90 • run more parallel to the contours and therefore experience little to no change in solar zenith angle.
A consequence of the scanning of the line of sight is that the line of sight tangent point traverses a larger distance during down-scans than up-scans, as up-scans tend to cancel the forward motion of the satellite.This causes larger changes in the local illumination conditions and has implications for the accurate modelling of the limb-scatter radiances.The tangent point of an up-scan typically covers approximately 4 • along the orbit track, with that of a down-scan covering 7 • ; most of this distance is covered in the latitudinal direction.For scans reaching 110 km this is extended to 7 and 11 • for up-and down-scans respectively.Many OSIRIS scans therefore span the terminator to an extent dependent upon solar angles and whether Odin is scanning up or down.The UV diffuse radiance field is remarkably difficult to model accurately in this geometry, which is problematic as bias in a radiative transfer model can propagate through a retrieval algorithm to cause systematic errors in retrieved atmospheric parameters.The character of this error in the OSIRIS ozone retrieval is explored in the following section, and it is shown to be remedied through the use of higher-resolution radiative transfer modelling.uration of the forward model may have induced errors in retrieved species profiles when OSIRIS is measuring difficultto-model geometries.
To test this two studies were performed.First, approximately 2600 OSIRIS scans where it is difficult to accurately model the diffuse field were selected from 2008 and 2009.These are scans with solar zenith angles greater than 80 • , and where the maximum scan altitude is greater than 100 km.Special mode scans where the line of sight is out of the orbital plane are excluded from this set.These criteria serve to maximize the variation in solar zenith angles over the duration of a scan.HR was then used to retrieve ozone with the OSIRIS data, once using one diffuse profile and again using five diffuse profiles.The single-profile retrieval represents the current Odin-OSIRIS data processing algorithm, whereas the five-profile retrieval represents roughly the best-quality retrieval that could easily be performed using the faster SO engine on a computer with 4 GB RAM.Ozone is retrieved using a multiplicative algebraic reconstruction technique as described in detail by Degenstein et al. (2009).
Next a simulation study was performed where MC was used to simulate the OSIRIS data with a SD of at most 0.2 %, roughly the reported precision of OSIRIS radiance measurements in the UV.For simulation purposes a monthly averaged ozone climatology, specified on a 500 m grid, was used rather than the scan-by-scan retrieved values to avoid biasing the results with retrieval errors.For each scan, the OSIRIS v5.07 NO 2 and aerosol data products were supplied as inputs to both MC and HR.Ozone was then retrieved with HR •100 %, as a function of solar scattering angle at select altitudes.Red and blue circles correspond to when the instrument is scanning upward and downward respectively.The left panel shows the results when retrieving from OSIRIS measurements, while the right panel is the results when retrieving from MC-simulated measurements.from the simulated data, again with both one and five diffuse profiles.Note that all simulations were performed using a one-dimensional atmosphere as is done in the OSIRIS operational retrievals.We make no attempt to quantify the effect of three-dimensional variability on the retrieval.

Discussion
Figure 8 shows the percent difference in retrieved ozone when the forward model is run with five diffuse profiles rather than one.The left panel shows the percent difference when retrieving from OSIRIS radiance measurements, while the right panel shows percent difference when retrieving from the MC-simulated scans.In general there is excellent agreement between the results retrieved from OSIRIS data and those retrieved from Monte Carlo-simulated data.This indicates that the observed biases are a consequence of the retrieval algorithm sensitivity to errors in the forward model rather than error inherent to the OSIRIS measurements.Furthermore, it is good evidence that MC is able to simulate OSIRIS scans effectively.The simulated data are noisier than the OSIRIS data, suggesting that the random noise component of the OSIRIS data is less than the maximum Monte Carlo SD of 0.2 %.Using more diffuse profiles in the retrieval forward model has the effect of changing retrieved values by up to a few percent for solar scattering angles far from 90 • .There is a distinct separation in the magnitude and direction of this effect when the instrument is scanning up vs. when the instrument is scanning down.The magnitude of the effect is less for up-scans owing to their smaller span in solar zenith angle (see Fig. 6).At high altitudes the effect is stronger, with a maximum systematic bias of approximately 4 % in the down-scanning backscatter case.Near 30 km the separation in the effect between up-and down-scans disappears; however there is still a clear systematic effect which depends on solar scattering angle.At low tangent altitudes the separation reappears and is reversed; down-scans now underestimate retrieved ozone, whereas at high altitudes this is overestimated.
To better understand the effect as a function of altitude, we separate scans into three distinct cases based on scattering angle, : -< 70 • (solar zenith angle increasing over the period of a scan), -85 • < < 105 • (solar zenith angle roughly constant over the period of a scan), -110 • < (solar zenith angle decreasing over the period of a scan), as shown in Fig. 7.No separation is observed between upand down-scans in the 85 • < < 95 • case.In the forwardscatter case ( < 70 • ), the magnitude of the relative bias between up-and down-scanning directions is largest at high altitudes, decreases to 0 at approximately 30 km, then switches sign and continues to increase with decreasing altitude.The backward-scatter case (110 • < ) shows a similar but reverse relative bias to the forward-scatter case: up-scans overestimate at high altitudes for backward-scatter geometries and underestimate in forward-scatter geometries.The forward and backward-scatter cases are not perfectly mirrored below approximately 30 km because changes in retrieved ozone are sensitive to the amount of forward-scattering aerosol present in the atmosphere.The excellent agreement of relative biases when comparing retrievals from simulated vs. OSIRIS measurements seen in Fig. 7 reinforces that the observed up-scan/down-scan bias separation is due to errors in the forward model, as suggested by Fig. 8.In order to understand the cause of the bias, we need to understand how changes in radiance affect the ozone retrieval.At high altitudes, the ozone retrieval uses measurement vectors of the form where λ is a wavelength sensitive to changes in ozone at tangent altitude h, λ ref is a reference wavelength not sensitive to ozone, and h ref is a high altitude where the radiances are normalized.The measurement vector, y, increases monotonically with the amount of ozone.For up-scans in which solar zenith angle increases over the period of one scan (solar scattering angle less than 90 • ), the high-altitude normalization measurement occurs at a solar zenith angle greater than that of the measurements used in the retrieval.As the diffuse field is (for simple atmospheres) a strictly decreasing function in solar zenith angle, both terms of the form I /I (h ref ) are systematically underestimated by the use of one diffuse profile.High altitudes in the ozone retrieval use retrieval wavelengths in the Hartley-Huggins absorption band: here the strong absorption means this wavelength is not very sensitive to changes in the diffuse field.The reference wavelength used at high altitude is approximately 350 nm, which has little absorption and is very sensitive to changes in the diffuse field.Thus the measurement vector is overall underestimated in this case, leading to an underestimation of retrieved ozone at high altitude, as seen in Fig. 7.At low altitudes the opposite effect is observed.Here, the retrieval wavelength used is in the Chappuis band, with normalization wavelengths on both sides of the band.The relative sensitivity of these wavelengths to changes in the diffuse field depends on the amount and type of aerosol present.Overall, however, the retrieval wavelength is more sensitive to the diffuse field than the reference wavelengths, leading to an overestimation of the measurement vector and thus ozone.
Down-scans have the opposite effect of up-scans.For the same geometry, the reference altitude measurement occurs at a solar zenith angle less than the retrieval measurements.This means that the terms I /I (h ref ) are systematically overestimated through the use of one diffuse profile.Therefore, by the same reasoning, retrieval from down-scan measurements should overestimate ozone at high altitudes and underestimate ozone at low altitudes, as observed in Fig. 7.
Similarly, scans with solar scattering angle greater than 90 • produce a reversed profile (solar zenith angle decreasing over the period of one scan).For up-scans, the normalization altitude has a local solar zenith angle less than the measurement's solar zenith angles, causing an overestimation of ozone at high altitudes and an underestimation of ozone at low altitudes.Once again, down-scans demonstrate the reverse bias.
The primary advantage of retrieving from simulated measurements is that the true state is known and can be compared against.In Fig. 9 the retrieved ozone profile using five diffuse profiles is compared to the known true state.The bias between up-and down-scanning directions is not present.Furthermore, there is excellent agreement in all cases above 20 km, suggesting five diffuse profiles is sufficient to estimate the multiply scattered field for ozone retrievals in OSIRIS geometries.The remaining ∼ 0.5 % underestimation in the backscattering case between 25 and 50 km is thought to be caused by the use of 1000 m homogeneous shells in the forward model.The cause of the "wobble" above 50 km is currently unknown, but it is suspected to be an issue of interpolating coarse-resolution OSIRIS measurements onto a finer grid near the highest reference altitude.
So far we have limited our discussion to ozone retrievals with OSIRIS geometries; however similar effects should exist for other instruments and species.The effect on other species is heavily dependent on the exact retrieval algorithm used; thus we merely reiterate that when using one diffuse profile the altitude normalized radiance, I /I (h ref ), has systematic biases which depend on the measurement geometry.For imaging instruments a similar effect exists.In an image, the high-altitude measurement has a tangent point closer to www.atmos-meas-tech.net/8/2609/2015/ the observer than the low-altitude measurements (there is approximately a 1 • change from 0 to 60 km in the tangent point for an imaging instrument orbiting at an altitude of 600 km).Therefore an imaging instrument will only exhibit the downscan biases shown in Figs. 8 and 6, albeit to a lesser degree.However, in more extreme cases where the scattering angle is closer to pure forward or backward scatter, the bias may be significant.

Conclusions
Two new radiative transfer models have been developed within the SASKTRAN framework: A new high-resolution successive-orders model and a Monte Carlo reference model.
The high-resolution model is intended for use as an accurate spherical radiative transfer model that operates without the assumption of horizontal homogeneity of the atmosphere and is fast enough for use in limb-scatter retrievals.Regions of large extinction (e.g.cirrus clouds) are handled through an adaptive integration step.Variations in atmospheric composition along the horizontal direction are accounted for through new two-and three-dimensional atmosphere modes.Weighting functions for number density of scattering and absorbing species can be approximated analytically.These approximate weighting functions deliver better performance than those calculated using the traditional single-scattering approximation and require negligible time to compute compared to the full radiative transfer calculation.
The Monte Carlo model is intended for use as an accurate reference model that estimates solutions to the radiative transfer problem without bias.The model is implemented within the SASKTRAN framework and is therefore useful as a tool for error checking other models within the framework.Furthermore, it can been used to prescribe the resolution necessary in faster successive-orders discrete-ordinates models to achieve accuracy to within some limit.In this work, configurations were found that allow the high-resolution model to agree with the Monte Carlo reference model to within 0.2 % for a wide variety of solar geometries and wavelengths.
The two radiative transfer models were used to identify and eliminate a bias in the OSIRIS ozone product.OSIRIS scans were simulated using the Monte Carlo model, and vertical profiles of ozone were retrieved from these simulated scans using the high-resolution model.It was shown that calculating the multiply scattered diffuse radiance field at only one solar zenith angle introduces a bias of up to 4 % for typical OSIRIS geometries.The shape and magnitude of the bias is different when the instrument is scanning up or down, and is an artefact of the correlation between scan height and local solar zenith angle, complicated by the use of a high-altitude normalization measurement in the retrieval algorithm.It was found that calculating the diffuse radiance field at five equally spaced solar zenith angles eliminates the effect and is sufficient to reduce biases in the OSIRIS ozone retrieval originating from horizontal gradients in the diffuse field to within 0.5 %.

Figure 1 .
Figure 1.The limb-scatter geometry used in SO, HR, and MC.The solar viewing angles are defined at the tangent point.

Figure 2 .
Figure 2. The two-and three-dimensional atmospheric grids used in HR.(a) A grid is shown consisting of altitude and angle along the line of sight direction, however, the plane can be placed in any direction (latitude, solar zenith angle, etc.).(b) The Delaunay grid used for three-dimensional atmospheres.The barycentric interpolation on the surface of the Earth is also shown.
Figure 3.Ozone weighting functions at a wavelength of 330 nm for a line of sight with tangent altitude 24.5 km.Shown are the results for the analytical method (AL), the finite-difference method when single scattering is only considered (SS), and the finite-difference method when multiple scattering is included (MS).The right panel shows the error in the analytical and single-scattering methods compared to the multiple scattering method.

Figure 4 .
Figure 4. Percent difference in simulated radiance between HR and MC ((HR − MC)/MC • 100 %) as a function of altitude at select solar zenith angles, θ , and solar azimuth angles φ.Dashed vertical lines indicate the estimated SD of the Monte Carlo results.HR was run with 11 diffuse profiles.

Figure 5 .
Figure5.Number of diffuse profiles needed to get 0.2 % agreement with MC, at 10 km altitude and 345 nm.In the shaded region the reference calculation was done using HR with 119 diffuse profiles.

Figure 6 .
Figure 6.Typical movement of the Odin satellite (open circles) and tangent point (closed circles) as the line of sight is scanned down and up, shown in red and blue respectively.The bottom panel shows the ground tracks of the tangent points; contours mark lines of constant zenith angle.

Figure 7 .
Figure7.Mean percent difference between retrieved ozone number density when the forward model is run with one diffuse profile compared to five, i.e.([O 3 ] (1) − [O 3 ] (5) )/[O 3 ] (5)• 100 %, as a function of altitude in select solar scattering angle bins.Shaded areas are the SD of the values.Solid and dashed lines represent simulated and OSIRIS measurements respectively.

Figure 8 .
Figure 8. Percent difference between retrieved ozone number density when the forward model is run with one diffuse profile compared to five, i.e. ([O3 ] (1) −[O 3 ] (5) )/[O 3 ] (5)•100 %, as a function of solar scattering angle at select altitudes.Red and blue circles correspond to when the instrument is scanning upward and downward respectively.The left panel shows the results when retrieving from OSIRIS measurements, while the right panel is the results when retrieving from MC-simulated measurements.

Figure 9 .
Figure 9. Mean percent error between the ozone profile retrieved when using five diffuse profiles in the forward model and the simulated known value, i.e. ([O 3 ] (5)− correct)/correct • 100 %.

Table 1 .
Seconds for MC to estimate the observed radiance for 3 wavelengths [nm] at 4 tangent point solar zenith angles (SZA) and 2 precisions (σ/I r ).

Table 2 .
Representative runtime (per wavelength) and RAM usage for HR and SO for similar resolutions and various numbers of diffuse profiles (DP).