Smoothing data series by means of cubic splines : quality of approximation and introduction of a repeating spline approach

Cubic splines with equidistant spline sampling points are a common method in atmospheric science for the 10 approximation of background conditions by means of filtering superimposed fluctuations from a data series. What is defined as background or superimposed fluctuation depends on the specific research question. The latter also determines whether the spline or the residuals—the subtraction of the spline from the original time series—are further analysed. Based on test data sets, we show that the quality of approximation of the background state is not increasing continuously with increasing number of spline sampling points / decreasing distance between two spline sampling points. Splines can 15 generate considerable artificial oscillations in the background and the residuals. We introduce a repeating spline approach which is able to significantly reduce this phenomenon. We apply it not only to the test data but also to TIMED-SABER temperature data and choose the distance between two spline sampling points in a way that we are sensitive for a large spectrum of gravity waves. 20


Introduction
It is essential for the analysis of atmospheric wave signatures like gravity waves that these fluctuations are properly separated from the background.Therefore, particular attention must be attributed to this step during data analysis.
Splines are a common method in atmospheric science for the approximation of atmospheric background conditions.The shortest wavelength or period which can be resolved by the spline is twice the sampling point distance according to the Nyquist theorem.Depending on the field of interest, either the smoothed data series or the residuals -the subtraction of a spline from the original time series -are further analysed (see, for example, the work of Kramer et al., 2016;Baumgarten et al., 2015;Zhang et al., 2012;Wüst andBittner, 2011, 2008;Young et al., 1997;Eckermann et al., 1995).
Algorithms for the calculation of splines are implemented in many programming languages and in various code packages, making them easy to use.Nevertheless, spline approximations sometimes need to be handled with care when it comes to physical interpretation.
Figure 1 explains our motivation for the work presented below.It shows the squared temperature residuals averaged over 1 year for the years 2010-2014 versus height between 44 and 48 • N and 5 and 15 • E (approximately 500 profiles per year).This region includes the Alps, where gravity waves are supposed to be generated.The vertical temperature profiles are derived from the SABER (Sounding of the Atmosphere using Broadband Emission Radiometry) instrument on board the satellite TIMED (Thermosphere Ionosphere Mesosphere Energetics Dynamics), data version 2.0 (details about this data version can be found in Wüst et al. (2016) and references therein, for example).For the calculation of the residuals, we applied a cubic spline routine with equidistant sam-Published by Copernicus Publications on behalf of the European Geosciences Union.(colour-coded).They are derived from TIMED-SABER, data version 2.0 by using a cubic spline routine with equidistant sampling points for detrending.The distance between two spline sampling points is 10 km.All vertical SABER temperature profiles which were retrieved between 44 and 48 • N and 5 and 15 • O are used (that means approximately 30-50 profiles per month and approximately 500 profiles per year).pling points.As mentioned above, the shortest wavelength which can be resolved by the spline is two times the distance between two consecutive spline sampling points.At the same time, this wavelength is the largest resolvable one in the residuals.The number of spline sampling points (and the length of the data series) therefore determines the sensitivity of the spline to specific wavelengths.The distance of 10 km between two spline sampling points ensures sensitivity for a large spectrum of gravity waves.Therefore, we take the squared temperature residuals as a simple proxy for gravity wave activity with vertical wavelengths up to 20 km.It is evident that the mean squared residuals do not only reveal a strong and continuous increase with height (note the logarithmic x axis) as expected since gravity wave amplitudes should increase due to the exponentially decreasing atmospheric background pressure with altitude.Superimposed on this general increase of gravity wave activity are well-pronounced oscillations with wavelengths of ca. 10 km, which is nearly equal to the distance between two spline sampling points.
Since we are not aware of any physical reason for this oscillation, we formulate the hypothesis that this is an artefact of the analysis.In order to avoid or at least reduce such problems, here we propose a repeating variation of the cubic spline approach, which we explain in Sect. 2. In Sect.3, we apply the original and the repeating approach to test data sets.The results are discussed in Sect. 4. A brief summary is given in Sect. 5.

Methods and algorithms
The approach we investigate here relies on cubic splines with equidistant sampling points.Since spline theory is well elaborated, we will not go into much detail here.The algorithm we use is based on Lawson and Hanson (1974).
The first step for the adaption of a spline function to a data series on an interval [a, b] is choosing the number of spline sampling points (also called knots).These points divide the interval for which the spline is calculated into subintervals of equal length.For each subinterval a third-order polynomial needs to be defined, which means the coefficients have to be determined.At the spline sampling points, not only the function value, but also the first and second derivatives of the two adjacent polynomials need to be equal.The optimal set of coefficients is calculated according to a least squares approach where the sum of the squared differences between the data series and the spline is minimized.
As mentioned above, the number of spline sampling points (and the length of the data series) determines the sensitivity of the spline to specific wavelengths.Since the length of the data series must be an integer number of the distance between two spline sampling points, only certain distances between two consecutive spline sampling points can be chosen if the whole data series is approximated.We would like to operate the spline algorithm by providing the shortest wavelength which shall be resolved by the spline.That means that we have to cut the upper part of the profile in each case.This is only possible for data sets of sufficient length such as the SABER temperature profiles, which we used for this purpose.In detail, our spline algorithm works as follows.The scheme includes the repeating as well as the non-repeating algorithm.
Step 1: Provision of shortest wavelength We provide the algorithm with the shortest wavelength which shall be resolved by the spline (in the following denoted by lim).It is equal to the doubled distance between two spline sampling points; therefore the distance between two spline sampling points is equal to lim/2.
Step 2: Determination of x-values of the spline sampling points The minimal x-value of the data series is subtracted from the maximal x-value, the difference is divided by lim/2.If the result is a whole number, 1 is added.If this is not the case, the closest integer less than the result is calculated and 1 is added.This is the number of spline sampling points used for the next step.It is denoted by n: Knowing lim/2 and the minimal x-value, the x-values of the further spline sampling points can be calculated.
Step 3: Calculation of spline approximation The spline approximation is calculated based on Lawson and Hanson (1974).If the length of the data series is not equal to an integer multiple of lim/2, the surplus part at the end of the data series is not subject of this step.For the non-repeating approach, the spline algorithm stops here.
Step 4 (only in the case of the repeating approach): Iteration of starting point The first point of the data series is removed and steps 2 and 3 are repeated.If the starting point is equal to the original minimal x-value plus lim/2, the algorithm proceeds with step 5.
Step 5 (only in the case of the repeating approach): Calculation of the final spline The mean of all splines derived before is calculated.That is the final (repeating) spline.
For the repeating approach, the length of the data series is not the same in each iteration since data at the beginning and the end of the data series are not necessarily part of each iteration: at the beginning of the data series, this holds for all x-values between the minimal x-value and the minimal xvalue plus lim/2 (see step 4), and at the end of the data series, this is the case for all values between the maximal x-value and the maximal x-value minus lim/2 (see step 3).
For the non-repeating approach, data are cut only at the end of the data series if the length of the data series is not equal to an integer multiple of lim/2.

Case studies
The purpose of this section is to help to understand the general behaviour of splines if the data set contains waves with a wavelength of double the sampling point distance, which may happen in the general case of an unknown mixture of waves.
We generate a basic example using an artificial sine with a vertical wavelength of 3 km, a phase of zero and an amplitude of one.The function is sampled every 375 m (that means at its zero crossings, at its extrema and once in between the zero crossing and the next extremum/the extremum and the next zero crossing).
The values for the sampling rate and the vertical wavelength are set arbitrarily.However, the spatial resolution of 375 m is motivated through the spatial resolution of TIMED-SABER, an instrument which is commonly used for the investigation of gravity waves (e.g.Zhang et al., 2012;Ern et al., 2011;Wright et al., 2011;Krebsbach and Preusse, 2007) and which delivered also the temperature profiles we used in Fig. 1.
Figure 2a shows the test data series (dotted line) between 15 and 100 km height.This large height range is chosen since it facilitates the demonstration of our results.A non-repeating spline with a distance of 1.5 km between two spline sampling points is fitted (solid line).According to the Nyquist theorem, the chosen distance between two spline sampling points is small enough to resolve the oscillation in our test data.In parts (b) and (c) of Fig. 2, a spline with a distance of 1.6 and 1.4 km between two spline sampling points is calculated.Parts (d) to (f) of Fig. 2 focus on the height range of 15 to 50 km of Fig. 2a to c: here, the height-coordinates of the spline sampling points are plotted additionally (dashed-dotted lines).The asterisks mark the sampling points of the original sine.The spline adaption in Fig. 2a/d differs significantly from the spline adaption in Fig. 2b/e and 2c/f: apart from a slight oscillation at the beginning/end of the height interval, the spline is equal to zero in Fig. 2a/d.The spline approximation plotted in Fig. 2b and c shows a beat-like structure across the whole height range.
In order to give an overview concerning the quality of adaption not only for some chosen examples as they were shown in Fig. 2, the test data set is approximated by a cubic spline with varying numbers of spline sampling points.The squared differences between the spline and the test data are summed up between 20 and 40 km (this height interval is chosen in order to be consistent with Fig. 7 later).We call this value the sum of squared residuals which is equal to the approximation error in this case.It does not decrease continuously with an increasing number of spline sampling points and/or decreasing distance between two spline sampling points but it is characterized through a superimposed oscillation which reaches its maximum for a distance of ca.1.5 km between two spline sampling points (Fig. 3, solid line).When changing the phase of the test data set to π/2 (instead of zero), the sum of squared residuals for a distance of ca.1.5 km between two spline sampling points is much lower (Fig. 3, dashed line).This makes it clear that the sum of squared residuals depends on the phase of the oscillation (one can also say on the exact position of the spline sampling points).
The analysis described above is repeated, but the phase of the oscillation varies between 0 and 2π .The sum of squared residuals (between 20 and 40 km) is calculated for three different distances between two spline sampling points: 1.5 km (Fig. 4, solid line), 1.4 km (Fig. 4, short dashes) and 1.6 km (Fig. 4, long dashes).The dependence on the phase is most pronounced for a distance of 1.5 km: the sum of squared residuals is minimal for a phase of π/2 and 3π/2.For a phase of 0 and π, the opposite holds.
This example directly motivates the application of the repeating spline approach on the same test data set (see Fig. 5a-f, which can be directly compared to Fig. 2a-f residuals depends much less on the distance between two spline sampling points (Fig. 6a) and on the phase of the test data set (Fig. 6b).Only for a distance of 1.6 km between two spline sampling points is a slight phase dependence still visible (Fig. 6b).
Until now, we showed only test data which are not superimposed on a larger-scale variation like the atmospheric temperature background.Now, three sinusoidals with vertical wavelengths of 3, 5 and 13 km, phase 0, π/3 and π/5, and amplitude 2.0 (growing amplitude with height neglected for simplicity reasons) are superimposed on a realistic vertical temperature background (Fig. 7a).The background is based on CIRA-86 (COSPAR International Reference Atmosphere, Committee on space Research and NASA National Space Science Data Center, 2006) temperature data for 45 • N for January, which are transferred to a regular grid using a cubic spline with a distance of 3 km between two spline sampling points.It was checked that the spline did not cause additional signatures.The sum of squared residuals shows three steps but no superimposed oscillations (Fig. 7b): the first step at ca. 6 to 7 km (distance between two spline sampling points), the second one at ca. 2 to 3 km and the last one at 1 to 2 km.Following Nyquist's sampling theorem, this observation can be explained through the ability of the spline to adapt the original wavelengths.Even if the sum of squared residuals decreases much more smoothly for the repeating approach than for the non-repeating one with decreasing distance between two spline sampling points, the approximation of the CIRA-background is in both cases not optimal (Fig. 7d and dashed lines in Fig. 7a and b).The realistic back- ground makes it clear why we restrict the calculation of the sum of squared residuals to the height range between 20 and 40 km: this height interval is especially chosen to exclude the stratopause, since the fast changing temperature gradient can cause additional problems for the spline approximation.Furthermore, the choice of this interval ensures that the data used for Fig. 7b are part of each iteration step (which is not the case for the data at the beginning and the end of the data series; see Sect. 2).

Discussion
In Sect.3, we showed that the quality of a spline which approximates the background, and its ability to filter for a specific part of the wave spectrum, vary: 1. with the number of spline sampling points, and 2. with the exact position (height coordinate) of the spline sampling points.
While the first statement can be explained Nyquist's sampling theorem, the second one is not well known.When the distance between two spline sampling points matches exactly half the wavelength of the test data, the approximation is worst for a phase of 0 and π .In this case, the spline sampling points are located exactly between the extrema of the test data.If the height coordinates of the spline sampling points agree with the height coordinates of the extrema of the test data, the opposite holds (in Appendix A, we provide a mathematical explanation for this observation).The dependence of the quality of approximation on the phase of the test data decreases with greater/smaller distances between two spline sampling points (Fig. 3).These findings directly motivate the use of the presented repeating spline approach which is characterized by varying positions (height coordinate) of the spline sampling points.
Furthermore, we showed that if the distance between two spline sampling points is only slightly larger or smaller than half the wavelength present in the data series and if enough S. Wüst et al.: Smoothing data series by means of cubic splines The solid oscillating (non-oscillating) line depicts three sinusoidals with vertical wavelengths of 3, 5 and 13 km, phase 0, π/3 and π/5, and amplitude 2.0 (the CIRA background).The dashed line shows the spline approximations for the repeating (black) and non-repeating (grey) spline approach (sampling point distance 10 km).Part (b) is as part (a) but focussing on the height interval between 20 and 40 km for which the sum of squared residuals is calculated in part (c).The range of the x and y axes differs from the ones used in Figs. 3 and 6a. Part (d) shows the difference between the spline (i.e. the approximated background, grey: non-repeating approach, black: repeating approach) and the CIRAbackground (i.e. the original background).
wave trains are present (which might not be the case in reality), the non-repeating spline resembles a beat (see Fig. 2b  and c; an explanation is given in Appendix B).The subtraction of such a beat will lead to an artificial oscillation in the residuals with a periodically increasing and decreasing amplitude reaching ca.70-80 % of the original amplitude at maximum (Fig. 2e and f).This oscillation must not be interpreted as a gravity wave of varying amplitude, for example, and the described effect has to be taken into account when analysing wavelengths similar to the doubled distance between two spline sampling points.1, for detrending the repeating cubic spline routine with equidistant sampling points as it is described in Sect. 2 is used.(b) Mean squared residuals for the repeating (dashed line) and the non-repeating (solid line) approach for the year 2014.(c) Mean (non-squared) residuals for the non-repeating approach for the years 2010 to 2014 and (d) mean (non-squared) residuals for the repeating approach.
For our case studies, we used a constant and a realistic CIRA-based temperature background profile.For both background profiles, we showed that the sum of squared residuals decreases much more smoothly with an increasing number of spline sampling points for the repeating approach compared to the non-repeating one (compare Fig. 3 to Fig. 6a) and the amplitude of the beat-like structure is reduced.
However, the motivation for this work was -as already mentioned -the results shown in Fig. 1 which are characterized by a strong superimposed oscillation with a wavelength of approximately 10 km for which we do not have a physical explanation.Figure 8a now depicts the mean squared residuals after the application of the repeating spline to the same data set; Fig. 8b focuses on the year 2014 (the dashed line is based on the application of the repeating spline, the solid line refers to the non-repeating spline).This year is chosen arbitrarily and allows the direct comparison of the repeating and non-repeating approach.The amplitude of the superimposed oscillation is reduced significantly but the oscillation can still be observed.This supports our hypothesis that the strong superimposed oscillation described in Fig. 1 is an artefact of the non-repeating spline detrending procedure.Furthermore, it now becomes obvious that gravity wave activity increases less with altitude between approximately 45 and 60 km height compared to the height range below and above.This is in accordance with the literature (e.g.Mzé et al., 2014;Offermann et al., 2009).For most heights, the mean squared residuals are smaller for the repeating approach than for the non-repeating one.At 38 km height, for example, the difference reaches ca.2.5 K 2 , which is approximately 32 % (referring to the mean value of both approaches).Shuai et al. (2014) use an earlier version of TIMED-SABER temperature data (1.07) and a different detrending procedure as we do in order to derive monthly averages of the squared temperature fluctuations for the years 2002-2010.They provide this parameter in dB (10•log 10 (T GW 2 )) with the squared temperature fluctuation T GW 2 .For 100 km (25 km) height, we extract a yearly mean of ca.21 dB (4 dB) for 50 • N from their Fig. 2, which means a squared temperature fluctuation of ca.126 K 2 (2.5 K 2 ).These values agree very well with the ones provided here but it cannot be decided whether they match better with the ones based on the repeating or non-repeating approach (Figs. 1 or 8a).However, the overall structure, which is characterized by a slow increasing or even a nearly constant gravity wave activity in the upper stratosphere, can be observed in their Fig. 2 (and in parts also Fig. 3a) and our Fig.8a.
In order to give a comprehensive comparison of the repeating and non-repeating spline algorithm, we also calculate the mean (non-squared) residuals.In this case, the results look very similar.In both cases, they again show an oscillation with a vertical wavelength of 10-20 km (Fig. 8c for the non-repeating approach, Fig. 8d for the repeating spline approach).We can explain this in the following way: when calculating the mean (non-squared) residuals and the mean squared residuals at a specific height, one refers to two different parameters of the distribution of residuals at that spe- cific height.While the mean (non-squared) residuals estimate the mean of the distribution, the mean squared residuals refer to the variance of the distribution.We conclude that at a defined height, the repeating approach changes the mean of the distribution of the residuals only slightly, but it reduces its spread significantly.For individual profiles, the approximation through the repeating approach is therefore less variable on average and can be recommended.The repeating approach can also be recommended if squared residuals are needed for further analysis (e.g. for the calculation of the wave potential energy).If non-squared residuals will be analysed, it does not make a difference on average which approach is applied; for the individual profile, however, this does not necessarily hold.In this case, only waves with amplitudes larger than 0.5 K in the stratosphere and 1.0 K in the mesosphere (Fig. 8c and d) should be taken seriously.
It is known that the tropo-, strato-and mesopause, where the temperature gradient becomes zero and changes, are challenging for approximation methods.The same holds for the beginning and the end of a data series.This becomes evident when a smooth profile like a CIRA-temperature profile is detrended with different numbers of spline sampling points (see Fig. 9a-d).In these cases, the residuals show oscillations for both approaches, the repeating and the non-repeating spline, which become smaller with decreasing distance between two spline sampling points.Compared to Fig. 7d, which shows the difference between the approximated background and the real one in the presence of typical gravity wave signatures, and restricted to the height range above 40 km, the strength and the position of the oscillations (in Fig. 9d) change only slightly (see Fig. 10a).That means the non-optimal approximation of the smooth temperature background, i.e. without any gravity waves, is the most likely reason for the oscillations observed in the mean SABER residuals for both approaches (see Fig. 8c and d).
However, for the non-repeating approach strength and position of the oscillation in the residuals (detrended CIRA background) change when another starting height is chosen while the oscillation is only slightly shifted in the vertical for the repeating approach (Fig. 10b and c).For Fig. 1, the starting height varied mostly in the range of ca. 2 km.A comparison of Figs. 1 and 8c reveals that the height coordinates of the local extrema of the mean residuals correspond approximately to the ones of the mean squared residuals.The less pronounced dependence of the repeating spline approach on the starting height (Fig. 10b) is therefore the most likely reason for the lower variance of the residuals (as described above).
There exist many methods to approximate/detrend/filter time series (see e.g Baumgarten et al., 2015, and references therein) and we do not claim that the presented repeating cubic spline is the best method for every purpose and every data series.It is just one possible algorithm which reduces artefacts of the non-repeating cubic spline routine as proposed by Lawson and Hanson (1974) if the data set contains waves with wavelengths of about double the sampling point distance, which is mostly not known in advance.Furthermore, it reduces its dependence on the starting height.However, it comes with enhanced computational effort which is of special importance when analysing large data sets.

Summary
It is essential for the analysis of atmospheric wave signatures like gravity waves that these fluctuations are properly separated from the background.Therefore, particular attention must be attributed to this step.
Cubic splines with equidistant sampling points are a common method in atmospheric science for the approximation of superimposed, large-scale structures in data series.The subtraction of the spline from the original time series allows the investigation of the residuals by means of different spectral analysis techniques.However, splines can generate artificial oscillations in the residuals -especially if the background is described by a coarse spline or if the data set contains waves with wavelengths of about double the sampling point distance -which must not be interpreted in terms of gravity waves.The ability of a spline to approximate the background state (and large-scale wave-induced fluctuations) does not only vary with the number of spline sampling points, but also with their exact position.
Since knowledge about the wavelengths present in the data set is normally not available in advance, this directly motivates the use of a repeating spline which is based on changing starting points.It comes with enhanced computational effort but can be recommended for the approximation/detrending of individual profiles and if squared residuals are needed for further analysis (e.g. for the calculation of the wave potential energy).
Data availability.The SABER data are available at the SABER home page http://saber.gats-inc.com/data.php.The CIRA data are available at http://data.ceda.ac.uk/badc/cira/data/ (Committee on Space Research, 2016).Both data providers do not offer a DOI.
The test data sets are superimposed sinusoidal oscillations.Their parameters are given in the manuscript, so they can easily be reproduced.

Figure 1 .
Figure1.Mean squared temperature residuals for the years 2010 to 2014 (colour-coded).They are derived from TIMED-SABER, data version 2.0 by using a cubic spline routine with equidistant sampling points for detrending.The distance between two spline sampling points is 10 km.All vertical SABER temperature profiles which were retrieved between 44 and 48 • N and 5 and 15 • O are used (that means approximately 30-50 profiles per month and approximately 500 profiles per year).

Figure 2 .
Figure2ashows the test data series (dotted line) between 15 and 100 km height.This large height range is chosen since it facilitates the demonstration of our results.A non-repeating spline with a distance of 1.5 km between two spline sampling points is fitted (solid line).According to the Nyquist theorem, the chosen distance between two spline sampling points is small enough to resolve the oscillation in our test data.In parts (b) and (c) of Fig.2, a spline with a distance of 1.6 and 1.4 km between two spline sampling points is calculated.Parts (d) to (f) of Fig.2focus on the height range of 15 to 50 km of Fig.2ato c: here, the height-coordinates of the spline sampling points are plotted additionally (dashed-dotted lines).The asterisks mark the sampling points of the original sine.The spline adaption in Fig.2a/d differs significantly from the spline adaption in Fig.2b/e and 2c/f: apart from a slight oscillation at the beginning/end of the height interval, the spline is equal to zero in Fig.2a/d.The spline approximation plotted in Fig.2b and cshows a beat-like structure across the whole height range.In order to give an overview concerning the quality of adaption not only for some chosen examples as they were shown in Fig.2, the test data set is approximated by a cubic spline with varying numbers of spline sampling points.The squared differences between the spline and the test data are summed up between 20 and 40 km (this height interval is chosen in order to be consistent with Fig.7later).We call this value the sum of squared residuals which is equal to the approximation error in this case.It does not decrease continuously with an increasing number of spline sampling points and/or decreasing distance between two spline sampling points but it is characterized through a superimposed oscillation which reaches its maximum for a distance of ca.1.5 km between two spline sampling points (Fig.3, solid line).When changing the phase of the test data set to π/2 (instead of zero), the sum of squared residuals for a distance of ca.1.5 km between two spline sampling points is much lower (Fig.3, dashed line).This makes it clear that the sum of squared residuals depends on the phase of the oscillation (one can also say on the exact position of the spline sampling points).The analysis described above is repeated, but the phase of the oscillation varies between 0 and 2π .The sum of squared residuals (between 20 and 40 km) is calculated for three different distances between two spline sampling points: 1.5 km (Fig.4, solid line), 1.4 km (Fig.4, short dashes) and 1.6 km (Fig.4, long dashes).The dependence on the phase is most pronounced for a distance of 1.5 km: the sum of squared residuals is minimal for a phase of π/2 and 3π/2.For a phase of 0 and π, the opposite holds.This example directly motivates the application of the repeating spline approach on the same test data set (see Fig.5a-f, which can be directly compared to Fig.2a-f: the black line represents the final spline approximation and the different colours refer to the spline approximations during the different iteration steps).In this case, the sum of squared

Figure 3 .Figure 4 .
Figure3.This figure shows the differences between the spline and the approximated test data (solid line: phase of 0, dashed line: phase of π/2) which are summed up between 20 and 40 km.They are plotted against the distance between the number of spline sampling points and/or the distance between spline sampling points.The number of spline sampling points and/or distance between spline sampling points refers to the whole height range between 15 and 100 km.

Figure 5 .
Figure 5. Here, the results based on the repeating spline approach are shown.The different colours refer to the different spline approximations (to keep it as clear as possible, we only show the first four iterations, a fifth one exists for case (b) and (e); see step 4 of the algorithm).The black line represents the final spline approximation.The distance between two spline sampling points in parts (a) to (f) agrees with the respective values in Fig. 2 parts (a) to (f).While parts (a) to (c) show the height range between 15 and 100 km, parts (d) to (f) focus on the height range between 15 to 50 km.The asterisks have the same meaning as in Fig. 2.

Figure 6 .
Figure 6.Part (a) is equivalent to Fig. 3, part (b) is equivalent to Fig. 4, but here the repeating spline approach is used.
Figure 7. (a)The solid oscillating (non-oscillating) line depicts three sinusoidals with vertical wavelengths of 3, 5 and 13 km, phase 0, π/3 and π/5, and amplitude 2.0 (the CIRA background).The dashed line shows the spline approximations for the repeating (black) and non-repeating (grey) spline approach (sampling point distance 10 km).Part (b) is as part (a) but focussing on the height interval between 20 and 40 km for which the sum of squared residuals is calculated in part (c).The range of the x and y axes differs from the ones used inFigs.3 and 6a.Part (d)  shows the difference between the spline (i.e. the approximated background, grey: non-repeating approach, black: repeating approach) and the CIRAbackground (i.e. the original background).
Figure 8.(a) As Fig. 1, for detrending the repeating cubic spline routine with equidistant sampling points as it is described in Sect. 2 is used.(b) Mean squared residuals for the repeating (dashed line) and the non-repeating (solid line) approach for the year 2014.(c) Mean (non-squared) residuals for the non-repeating approach for the years 2010 to 2014 and (d) mean (non-squared) residuals for the repeating approach.

Figure 9
Figure 9. (a) Original CIRA temperature profile (which was detrended between ca. 14 and 110 km as the SABER data); (b)-(d) are residuals for a sampling point distance of 2.5, 5 and 10 km between 20 and 100 km height (grey: non-repeating spline, black: repeating spline).

Figure 10
Figure 10.(a) Superposition of Fig. 9d (dashed lines, residuals after detrending the CIRA temperature background without superimposed gravity waves) and Fig. 7d (solid lines, difference between the original and the approximated background in the presence of gravity waves); (b) and (c) are residuals of the repeating (black) and non-repeating (grey) spline approximation (max.wavelength: 20 km) of the CIRA temperature profile detrended between varying starting heights (15-20 km) and 115 km.