Normal-mode function representation of global 3-D data sets : open-access software for the atmospheric research community

This article presents new software for the analysis of global dynamical fields in (re)analyses, weather forecasts and climate models. A new diagnostic tool, developed within the MODES project, allows one to diagnose properties of balanced and inertio-gravity (IG) circulations across many scales. In particular, the IG spectrum, which has only recently become observable, can be studied simultaneously in the mass and wind fields while considering the whole model depth in contrast to the majority of studies. The paper includes the theory of normal-mode function (NMF) expansion, technical details of the Fortran 90 code, examples of namelists which control the software execution and outputs of the software application on the ERA Interim reanalysis data set. The applied libraries and default compiler are from the open-source domain. A limited understanding of Fortran suffices for the successful implementation of the software. The presented application of the software to the ERA Interim data set reveals several aspects of the large-scale circulation after it has been partitioned into the linearly balanced and IG components. The global energy distribution is dominated by the balanced energy while the IG modes contribute around 10 % of the total wave energy. However, on sub-synoptic scales, IG energy dominates and it is associated with the main features of tropical variability on all scales. The presented energy distribution and features of the zonally averaged and equatorial circulation provide a reference for the validation of climate models.


Introduction
Spherical harmonics have been used extensively for representing many geophysical quantities over the globe.They are useful for the decomposition of global circulation data because they are eigensolutions of the global barotropic vorticity equation involving the Laplace operator on the sphere.Furthermore, spherical harmonics are used as basis functions for the numerical discretization of dynamical terms of the global prognostic equations for numerical weather prediction (NWP) in some of the major global NWP models (e.g.ECMWF).A scale-dependent distribution of atmospheric kinetic energy at a given horizontal level is readily produced from spherical harmonics as a function of the global wave number (e.g.Boer and Shepherd, 1983).
It is however often more desirable to represent flow patterns not only of the horizontal velocity components but also of the associated mass-field variables as functions of longitude, latitude and height.Our picture of the atmosphere is that of a vibrating system with many modes of oscillations, like a musical instrument.Hence, it is desirable to have some vector functions to represent simultaneously both the wind field and the mass field corresponding to the various modes.Such modes are provided by the eigensolutions of the primitive equations linearized around a simple reference state of rest, and they are known as normal modes.
It is the objective of this article to present the development and application of a software package that applies 3-D vector harmonic functions based on the natural modes of oscillations for representing global circulation patterns in terms of a single expansion series.The development of 3-D vec-tor functions is based on the theoretical work by Kasahara and Puri (1981).They derived a set of three-dimensional orthogonal normal-mode functions (NMFs) and applied it to hemispheric data from the National Center for Environmental Prediction (NCEP).The orthogonal expansion basis was derived for the vertical σ coordinate which is naturally suited for the representation of data on the Earth.
The derivation of NMFs by Kasahara and Puri (1981) was not utilized until Žagar et al. (2009a) applied the method to the comparison of levels of inertio-gravity (IG) energy in modern analysis data sets on model levels.Several other recent papers applied the method to the diagnosis of data assimilation systems, especially their balance properties and the scale-dependent properties of short-range forecast errors (Žagar et al., 2011, 2012, 2013).
A more extensive work based on the application of NMFs has been carried out in the pressure system.Tanaka (1985) and Tanaka and Kung (1988) derived a 3-D normal-mode scheme for the pressure vertical coordinate.The method was applied to a number of research topics ranging from baroclinicity (Kasahara and Tanaka, 1989) and blocking (Tanaka and Terasaki, 2006) to global energetics and energy conversion studies (Tanaka and Kimura, 1996;Marques and Castanheira, 2012).In the case of the pressure system, global circulation is represented by winds and geopotential on 10-20 standard-pressure levels.
The most important application of normal modes in NWP research has been the initialization of operational forecast models, known as non-linear normal-mode initialization (NNMI) (Baer and Tribbia, 1977;Machenhauer, 1977;Wergen, 1988;Errico, 1997).With the advance of modern data assimilation methodologies such as 4-D-Var (e.g.Le Dimet and Talagrand, 1986) and the application of digital filtering for initialization (e.g.Lynch and Huang, 1992) the use of NNMI has been greatly reduced.One of more recent applications of NNMI is within the NCEP global NWP system (Kleist et al., 2009).We also note that the sets of normal modes derived for the initialization of NWP models were, in general, not 3-D orthogonal, though orthogonal model normal modes can be constructed (Kasahara and Shigehisa, 1983).
The global horizontal structures of normal modes, known as Hough functions, have been used to analyze atmospheric variability (Madden, 2007, and references therein).Some fundamental properties of the large-scale tropical circulation in both the atmosphere and the ocean have been described in terms of normal modes on the equatorial-β plane (e.g.Gill, 1980).The equatorial Kelvin, the mixed Rossbygravity (MRG), the equatorially trapped IG and Rossby modes which are characterized by small phase speeds have been associated with the most energetic modes of tropical variability.This has been verified by direct observations, by derived quantities and in weather and climate models.Wave properties have been diagnosed by using mass-field information such as outgoing long-wave radiation (e.g.Wheeler and Kiladis, 1999), brightness temperature (e.g.Yang et al., 2003), precipitation (e.g.Kim and Alexander, 2013) and climate models (e.g.Lin et al., 2006).In contrast to these studies based on spectral-temporal filtering, the representation of global data in terms of normal modes represents temperature field and wind field simultaneously in terms of balanced (quasi-rotational) and unbalanced (eastward-propagating IG -EIG and westward-propagating IG -WIG) motions of different vertical and horizontal scales.
A separation of non-linear atmospheric motions into the high-frequency IG and low-frequency balanced motions is possible only if the simplification of linearized equations around some specific resting background state is introduced.Furthermore, the vertical part of solutions can be obtained analytically only for some special cases such as the isothermal atmosphere (Daley, 1991, Chapter 6) or a constant stability profile (e.g.Terasaki and Tanaka, 2007).For realistic temperature and stability profiles, solutions need to be obtained numerically and numerical procedures for the solution of the vertical structure of global normal modes have been considered in several papers (e.g.Kasahara and Puri, 1981;Kasahara, 1984;Staniforth et al., 1985).
The 3-D orthogonality of normal modes allowed Kasahara and Puri (1981) to estimate the contribution of IG modes to the total wave (zonal wave number > 0) energy.They found that the percentage of total wave energy associated with the IG modes was small.This result was in agreement with quasi-geostrophic scaling and the poor quality of the tropical analyses in late 1970s.It agreed also with a study by Daley (1983) that estimated an average percentage of ageostrophic motions in early analyses of ECMWF to be about 10 % implying that about 1 % of atmospheric wave energy was associated with unbalanced flows.Thirty years later, data assimilation methodology and an unprecedented number of highquality atmospheric observations provide us with a different picture of the global circulation.In particular, reanalysis data sets (e.g.Dee et al., 2011) are used to validate atmospheric variability represented by climate models to justify their simulation of climate scenarios for the future.
In relation to a more reliable representation of physical processes in later analyses, especially convection, and the associated divergent circulation, Žagar et al. (2009a) reported that the level of IG energy is about 10 % of the total wave energy; in other words, in current analysis data sets about one-third of global wave circulation is associated with unbalanced modes.Realistic climate models validated against (re)analyses should be characterized by a similar amount of unbalanced energy and its scale distribution.The application of 3-D normal modes presented in this paper provides a picture of the unbalanced component of the global circulation in the latest reanalyses of the ECMWF, the ERA Interim data set (Dee et al., 2011).
The following presents details of the software for NMF analysis and describes the sequence of steps applied to generate a picture of the unbalanced component of global circu-lation.The application of the software is controlled through Fortran namelists which are provided in the Appendix.It is shown that a moderate user effort suffices for the application of the software to other global data sets.In particular, we discuss the choice of several namelist parameters and outline the future directions of the software development.The most important direction is the comparison of energy distributions in reanalyses and climate simulations of the present-day climate followed by the comparison of the simulated presentday unbalanced circulation and its projections.Most of the unbalanced large-scale planetary and synoptic-scale circulation is found in the tropics.However, the tropics is the region with the largest uncertainties in both short-range forecasts (e.g.Žagar et al., 2013) and in climate models (e.g.Lin et al., 2006).Evaluation of models' ability to reproduce the unbalanced tropical circulation can be expected to provide new insights on model performance that is helpful to diagnose model deficiencies and define improvements.
The paper is structured as follows: the next section presents the theory of normal modes as an updated extended summary of the article by Kasahara and Puri (1981), hereafter denoted KP1981.Section 3 provides a step-by-step description of various components of the normal-mode software.In Sect. 4 we present outputs of the normal-mode diagnostics of ERA Interim by using a few standard diagnostics.Summary and conclusions are provided in Sect. 5. Several appendices contain examples of namelists which are edited by a user to run the software.

Derivation of 3-D normal-mode functions
The derivation of 3-D normal modes presented in this section follows KP1981, although the notation is somewhat different.The reader is also referred to several other cited papers for any missing details.

Model of the atmosphere
As a model of the atmosphere, we deal with the traditional hydrostatic baroclinic primitive equation system on a sphere, customarily adopted for NWP (Kasahara, 1974(Kasahara, , 1975)).The model describes the time evolution of eastward and northward velocity components (u , v ) and geopotential height as functions of longitude λ latitude ϕ vertical coordinate σ and time t.The σ coordinate is defined by where p and p s denote the pressure and surface pressure, respectively (Phillips, 1957).
Although the atmospheric model is non-linear, we are interested in small-amplitude motions around the basic state of an atmosphere at rest.Therefore, we can deal with a linearized adiabatic and inviscid version of the model.Solutions of such a system with appropriate boundary conditions are referred to as normal modes (Lamb, 1932).It should be noted that we are dealing with free oscillations instead of forced oscillations such as atmospheric tides (Chapman and Lindzen, 1970).
A new geopotential variable introduced by KP1981 accounts for the fact that the surface pressure p s varies and it is defined as where = gz.Here, z denotes the height corresponding to the hydrostatic pressure and g the Earth's gravity.Also, T 0 (σ ) denotes the globally averaged temperature at a given σ level and R the gas constant of air.It is convenient to introduce a modified geopotential height h = P /g in the subsequent development.
The system of linearized equations describing oscillations (u , v , h ) superimposed on a basic state of rest with temperature T 0 as a function of σ takes the following form: Here, a is the Earth's radius and is the Earth's rotation rate.Equation ( 5) is obtained as a combination of the continuity and thermodynamic equations after the change of variable and by using the suitable boundary conditions.For details see KP1981.The boundary conditions for the system of Eqs.(3)-( 5) are The static stability parameter 0 is defined as and it is a function of the globally averaged temperature on σ levels, T 0 , its vertical gradient and σ .As inferred from the work of Taylor (1936), the 3-D linearized model (3)-( 5) can be solved by the method of separation of the variables.It means that the vector of 3-D model variables [u , v , h ] T as functions of (λ, ϕ, σ ) and time t is represented as the product of 2-D motions and the vertical structure function G(σ ): Two systems of equations governing three-dimensional motions are connected by particular values of a separation parameter D which is called the equivalent height following Taylor (1936).It turns out that the governing system of the two-dimensional functions is identical in form with the global shallow-water equations having the water depth of equivalent height, D. This system is also known as the Laplace tidal equations without forcing.

Vertical structure equation
We first discuss the vertical structure functions G(σ ) governed by the vertical structure equation (VSE).Solutions of the VSE were first investigated by physicists in connection with the theory of atmospheric tides under various basic state temperature profiles and upper boundary conditions.
For the tidal problems, however, solutions of VSE are calculated under specified tide generating mechanisms with a prescribed value of equivalent height corresponding to a given wave frequency.In contrast, for normal-mode problems, solutions of the VSE are sought for free oscillations (no forcing and dissipation) that determine the values of equivalent height and corresponding vertical functional profiles.During the late 1960s Jacobs and Wiin-Nielsen (1966) and Simons (1968), for example, investigated solutions of the VSE in pressure coordinates based on quasi-geostrophic modelling.
Since then many investigators have examined various aspects of the VSE and its solutions.We shall summarize them briefly in the following.
The vertical structure function G(σ ) is a solution of the VSE written in the dimensionless form as where Here, H * is a scaling constant with the dimension of height, H * = 8 km, and R and g are the gas constants of air and gravity, respectively.We assume that S>0 for stable stratification.A typical profile of S is shown in Fig. 2c Together with homogeneous boundary conditions ( 11)-( 12), the VSE (10) constitutes a Sturm-Liouville problem (Hildebrand, 1958) and its properties are well known.For example, solutions of Eq. ( 10) exist only for a set of positive values of equivalent height D as the eigenvalues, and the corresponding solutions, called the eigenfunctions, are orthogo-nal in the sense that where δ ij = 1 if i = j and zero otherwise.
In an atmosphere with a realistic temperature profile, there is always one discrete solution of Eq. ( 10).This is called the external or Lamb mode, with the value of D being approximately 10 km.Its corresponding structure function has the largest vertical scale with no zero-crossing point in the vertical.Thus, this mode represents a vertically averaged motion and it is often referred to as the barotropic mode.In addition to this external mode, there is a continuous or discrete spectrum of internal modes.These depend on the upper boundary conditions with varying values of D all smaller than that of the external mode.The structure functions corresponding to the internal modes have various zero-crossing points on the vertical axis.In the next section, examples of vertical structure functions (VSFs) for ERA Interim data sets are discussed in detail.Characteristics of the spectrum of VSE solutions have been investigated extensively.For example, Cohn and Dee (1989) showed that the nature of the mode spectrum depends only on the behaviour of the coefficients of VSE near the top of model atmosphere.
With the objective to construct the 3-D NMFs to represent global atmospheric motions, we must account for both internal modes and external modes.Moreover, we need to choose the boundary conditions that yield a discrete spectrum of internal modes by using the same top boundary conditions as conditions adopted by the NWP and climate models which are being analyzed.Thus, we can represent the spectrum of D in the following order, where the integer subscript m can be chosen as large as one wishes to calculate depending on the solution method.The maximal number of vertical modes that can be resolved (i.e.maximal value of m) is determined by the available vertical resolution (i.e. the number of vertical grid points).In other words, when applied to NWP and climate models, the appropriate set of vertical structure functions is determined by the corresponding boundary conditions and the models' vertical resolution.
The case where m = 1 corresponds to the external mode.It is associated to the largest equivalent height D 1 and its eigenfunction G 1 has no zero-crossing point in its profile.The remaining cases, m ≥ 2, are referred to as the internal modes and the Gs have (m − 1) zero-crossing (nodal) points.Vertical structure functions for several modes computed for the ERA Interim vertical coordinate are shown in Fig. 4. Details of their numerical calculation are presented in Sect.3.
The structure functions G m (σ ), which are normalized and orthogonal, are said to be complete in the sense that a well-behaved function f (σ ) can be represented by a series: where the coefficients C m can be obtained from the inverse transform with the aid of the orthogonality condition (13).In reality we use a finite number of modes to represent f (σ ).

Horizontal structure equations
After the 3-D model is decomposed into the product of a 2-D system and the VSE as seen in Eq. ( 9), we then have m systems of horizontal structure equations (HSEs) corresponding to m equivalent heights D m which are the eigenvalues of VSE (10).The HSEs are identical to linearized global shallowwater equations with the depth D m .These are sometimes referred to as the barotropic primitive equations.In the following presentation, we drop the subscript m for simplicity, but actually we are dealing with m systems of HSEs describing oscillations around a background state.
To write down the HSEs, we make the dependent variables (u, v, h) and time t dimensionless as follows: Therefore, the HSEs are written as follows: where W denotes the vector dependent variable and L is the linear differential matrix operator in which γ is a dimensionless parameter defined as the ratio of shallow-water gravity wave speed and twice the rotation speed of Earth: Since Eq. ( 18) is a linear system with respect to time, the solution W can be expressed in terms of harmonics in time as where H k n (λ, ϕ) represents the horizontal structure functions with zonal wave number k and meridional index n.The corresponding dimensionless frequency ν k n also depends on k and n.Now, we define the global inner product as where µ = sin(ϕ) and the asterisk ( * ) denotes the complex conjugate.Subscript p refers to a particular mode corresponding to a zonal wave number k p and a meridional index n p .Subscript r indicates another mode.
Then, the linear operator (20) has the following property: This can be verified by forming relevant inner products, integrating them globally, and using Green's theorem.For details see Platzman (1972).
By substituting Eq. ( 22) into Eq.( 18), we find that H p is the eigenfunction of L such that Therefore, by using Eqs.( 22) and ( 25) we can ascertain from Eq. ( 24) that Now we discuss some very important properties of the eigenvalues and eigenfunctions of Eq. ( 20).Let us consider the following two cases of Eq. ( 26): 1.The case of p = r.Because H p , H * r becomes proportional to the total energy of the normal-mode solution of the linearized system that must not vanish, we require that ν p = ν * r .Therefore, the ν p must be real and we can drop the asterisk from the notation of eigenfrequency.
2. The case of p = r.Because ν p = ν r , we must have H p , H * r = 0, meaning that H p corresponding to ν p must be orthogonal to the H r associated with ν r which is different from ν p .
Since the magnitude of H p is arbitrary, we use Eq. ( 23) to define the following normalization of H r : where the right-hand side is unity if p = r, and zero otherwise.
Separation of variables and the periodic boundary conditions in the longitudinal direction lead to the solution of H k n for discrete values of k in the form where the meridional dependence is described by the vector function which has three components: zonal velocity U , meridional velocity V , and geopotential height Z, all having zonal wave number k and meridional index n.The factor i, (i = √ −1) in front of V is introduced to account for the phase shift of π/2 of V with respect to U and Z.
By substituting Eq. ( 28) with Eq. ( 29) into Eq.( 27), we find This is the orthogonality condition for p associated with frequency ν p .
Various aspects of the eigensolutions of HSEs, including the methods of solution, their asymptotic characters, and tables of their eigenvalues (wave frequencies) and the eigenfunctions (meridional profiles) are discussed by Margules (1892), Hough (1898), Dikii (1965), Flattery (1967), Longuet-Higgins (1968), Kasahara (1976) and Phillips (1990).Because Hough (1898) was the first to solve the normal-mode problem by means of spherical harmonics, the eigensolutions H k n as defined by Eq. ( 28) are now referred to as Hough functions (Siebert, 1961) or Hough harmonics.
The general algorithm for solving system (18) as used by Kasahara (1976) involves the replacement of the wind components by velocity potential and stream function variables by using the Helmholtz theorem and the assumption that new non-dimensional dependent variables are proportional to harmonic functions in longitude with zonal wave number and in time with the dimensionless frequency.The meridionally dependent variables are expressed in terms of series of the associated Legendre polynomials of order n and rank k.The resulting equations for the three expansion coefficients as functions of k and n contain two independent systems.In one case, the velocity potential and the geopotential height are symmetric with respect to the Equator whereas the stream function is antisymmetric.In another case, velocity potential and height are antisymmetric with respect to the Equator and the stream function is symmetric.In each case, the frequency is obtained as the eigenvalue of the matrix problem.Two dispersion relationships describe the frequency of two kinds of solutions, the so-called first kind and the second kind of Hough solutions.So-called solutions of the first kind describe high-frequency WIG and EIG waves.Solutions of the second kind describe low-frequency, westward-propagating, predominantly rotational waves of the Rossby-Haurwitz type.We denote the two kinds of solutions IG and ROT for IG and Rossby-Haurwitz type of motions, respectively.
For the zonal wave number k = 0 the second kind of waves are degenerate.This creates a difficulty in representing the zonally averaged circulations.However, it is possible to derive the set of orthogonal functions for those modes as discussed by Kasahara (1978) and Shigehisa (1983).The software package that calculates the wave frequencies and associated Hough functions including their meridional derivatives by specifying the equivalent height and wave number was developed by Swarztrauber and Kasahara (1985) and it is a part of the present NMF software package.
Figure 1 shows the frequency behaviour of the two classes of solutions for four equivalent depths: 10, 1 km, 100, and 10 m.Eastward-propagating solutions are shown for positive wave numbers while negative wave numbers correspond to the westward-propagating waves.Discrete values of frequencies are shown by symbols for the range of integer value of the zonal wave number from zero to 30.Frequencies for EIG and WIG waves are shown for the same range of zonal wave numbers.The lowest meridional modes (n = 0) of EIG solutions and balanced solutions are known as the Kelvin wave (KW) and the MRG wave, respectively.Their properties have been investigated by Matsuno (1966) for the equatorial-β plane.Frequencies of the MRG wave and the KW fill a part of the frequency gap between the IG and balanced modes (other than MRG).For D = 10 km, a frequency gap between the IG and ROT waves is largest.As the equivalent depth reduces, the frequency gap becomes smaller while the frequencies of the MRG and KW modes become more distinct from other frequencies.In particular, the frequencies for MRG waves at large scales become closer to that of WIG modes than to other ROT modes.In contrast, frequencies of KW at large scales become more separated from other EIG modes.Indeed, the observed properties of both MRG and KW in the tropical atmosphere had been associated with small equivalent depths of the order of 10 m (e.g.Wheeler and Kiladis, 1999).
Properties of equatorial MRG and KWs as well as of other eigensolutions of linearized shallow-water equations on the equatorial-β plane have been usually discussed with respect to the basic state of rest.The same applies to HSE (18), i.e. frequencies of wave solutions associated with Eq. ( 18) and shown in Fig. 1 for several mean fluid depths do not include the effect of zonal flows.
When the mean zonal flow is taken into account, the frequencies of wave solutions of the linearized global shallowwater equations become different from the wave frequencies associated with the linearization around the state of rest.Kasahara (1980) showed that in this case the frequency spectrum can become continuous, except for a few of the lowest balanced modes.Furthermore, solutions to such system can become unstable due to barotropic instability.On the other  , 3, 6, 9, 14, 19, 24, 29, 34, 39, 49, 59 and 69.For the balanced modes (ROT), shown are meridional modes n = 0, 1, 3, 5, 7, 9, 14, 19, 24, 29, 34, 39, 49, 59 and , 3, 6, 9, 14, 19, 24, 29, 34, 39, 49, 59 and 69.For the balanced modes (ROT), meridional modes are shown for n = 0, 1, 3,5,7,9,14,19,24,29,34,39,49,59  hand, the structure of associated Hough functions does not change significantly if the linearization is performed around the non-zero mean zonal flow (see corrigendum to Kasahara, 1980).This implies that it is suitable to use the 3-D normal modes constructed with reference to the basic state at rest as a universal set of the spectral expansion functions to represent global atmospheric data.

Expansion of discrete global data onto NMF
An input data vector X for the projection is built by the zonal and meridional winds (u, v) and modified geopotential height h = P /g defined on the horizontal regular Gaussian grid and vertical sigma levels at time step t, with the time subscript dropped.
Equation ( 2) is applied to compute geopotential P .The projection is performed on the pre-computed vertical structure functions, G(σ ), the meridionally dependent part of the horizontal Hough vector functions, k n (ϕ), and the harmonic waves in the longitudinal direction.The procedure derived in the previous section is applied in the steps summarized as follows.The input data on j th σ level are first represented by a series of the vertical structure functions G m (j ).For a single data point λ, ϕ, σ j the expansion is The scaling matrix S m in Eq. ( 32), which makes the vector X m (λ, ϕ) for the input to the HSE dimensionless, is defined in accordance with Eq. ( 17) as The integer subscript m spans from the external vertical mode m = 1 to the total number of vertical modes M. Discrete functions, G m (j ), are derived using the finite difference N. Žagar et al.: Normal-mode function representation: software description and applications solution method for the σ vertical coordinate in KP1981 and they satisfy Here, J is the number of vertical levels.The vector X m is calculated by the reverse transform of Eq. ( 32) through the multiplication of Eq. ( 32) by G m (j ) and summation of the result from j = 1 to J with the use of the orthogonality condition (33).The result becomes Definition of the vector X m in Eq. ( 34) makes use of the notation defined in Eq. ( 17).Equations ( 32) and ( 34) are the vertical transform pair.
The dimensionless horizontal coefficient vector X m (λ, ϕ) for a given vertical mode m can now be projected onto the Hough harmonics H k n as where the maximal number of zonal waves is denoted by K, including zero for the mean zonal state.For every given vertical mode m, the Hough harmonics are characterized by the two indices for the combined meridional mode n and the zonal wave number k.The subscript n for the meridional mode indicates all combined meridional normal modes including rotational (ROT) N R , EIG N E , and WIG N W modes. Thus, R = N R + N E + N W .The global orthogonality condition for the Hough functions is Eq. ( 27).The scalar complex coefficient χ k n (m) can be obtained from Eq. ( 35) by multiplying Eq. ( 35) by H k n * , the complex conjugate of H k n , and integrating the resultant equation with respect to λ from 0 to 2π , and with respect to ϕ from −π/2 to +π/2, and using the orthonormality condition ( 27).The result is Equations ( 35) and ( 36) are the horizontal transform pair.

Energy product
One of the advantages of expanding the fields of atmospheric motions by the NMFs is that the global total energy can be derived from a particular type of scalar product, called the energy product.A history on the origin of the energy product is discussed by Platzman (1992).Here, the energy product is calculated from the complex coefficients obtained by Eq. ( 36).The partition of total energy into the kinetic and available potential energies becomes straightforward.Likewise, the energy spectrum with respect to longitudinal, meridional and vertical scales as well as wave species can be calculated easily.A detailed derivation of the global energy equation in normal-mode space from the linearized atmospheric model represented by Eqs. ( 3)-( 5) has been presented in KP1981.
The conservation equation of global total energy in the system in the modal space is given by where and Here, K m and P m denote the specific kinetic energy and potential energy, respectively, of the mth vertical mode.The energy P m is more appropriately referred to as an approximation to available potential energy.This represents a portion of the total potential energy which may be available for conversion into kinetic energy (Lorenz, 1955(Lorenz, , 1960)).From Eq. ( 34) it is clear that the components u m , v m and h m are defined as The global energy product of the mth vertical mode is defined by the following scalar product I m , where χ k n * is the complex conjugate form of Eq. ( 36) and it is given by Note that in Eq. ( 41) the energy product is summed with respect to the meridional mode index from n = 1 to R and zonal wave number k = −K to K as done in Eq. ( 35).
Applying the expression for X m (λ, φ) from Eq. ( 34) and the orthogonality condition Thus, to obtain the global total energy I the summation of the scalar product I m with respect to the vertical mode is required as Also note that similar to Eq. ( 41) we can express the global energy of the kth zonal wave number as I k , and the global energy contained in the nth meridional mode as I n , 3 Formulation of the NMF software The software consists of a new code written mainly in Fortran 90 which needs to be combined with several basic libraries available in the public domain.The external libraries needed for the software implementation are the libraries for handling the input data in GRIB (GRIdded Binary) and NetCDF (Network Common Data Form) formats and the LAPACK (Linear Algebra PACKage) and ALFPACK (Associated Legendre Functions PACKage) libraries for solving the eigenvalue problem.While a version of the LAPACK (version 3.4) and a somewhat modified ALFPACK source code are provided with the package, the NetCDF and GRIB-API (GRIB-Application Program Interface) libraries need to be installed by the user.The ALFPACK package, which is used for the computation of the associated Legendre functions of the first kind, originates from NCAR (Swarztrauber and Kasahara, 1985).
Once the above libraries are correctly installed and their paths provided in the Mkinclude file located in the main directory NMF_MODES, the execution of make command produces five binaries which compute -the Gaussian grid and weights; -the vertical structure functions; -the horizontal structure functions; -projection of 3-D global data; -filtering of selected modes back to physical space.
The first three steps need to be applied at the beginning of any project work related to a particular global data set as they provide a set of eigenmodes for the projection.The main job, that of the 3-D projection, can be carried out for any number of input files which are recognized by their date flags.The same approach is applied in the case of modal filtering which reads an input file with the Hough coefficients χ k n (m) and provides their physical-space equivalent for a user-defined subset of values (k, n, m).
All auxiliary input files are direct-access binary files except the input file with the vertical coordinate definition which is kept in text format.Such files for the ECMWF system are available online, e.g. from http://old.ecmwf.int/products/data/technical/model_levels (as on 9 August 2014), and can be directly copied to the input file.All outputs files, vertical structure functions, horizontal structure functions and output files of 3-D projection with the Hough expansion coefficients have the direct-access binary format.Outputs of the filtering can be saved as direct-access binary format or text files.It is planned in future work to replace the binary format with the NetCDF format for all input and output files.
Compilation is straightforward and it has been successfully applied on Linux systems and Mac OS as well as the large IBM and CRAY computers of ECMWF.The applied Fortran compiler is by default gfortran.Other compilers, the Intel Fortran and the IBM Fortran have also been used and no problems specific to different compilers were found.Small and big endian computers have also been used.

Computation of the Gaussian grid parameters
The computation of the Gaussian grid on which the 3-D normal-mode projection is carried out is easily performed by specifying only two input values in the namelists gaussian.One is the number of the Gaussian grid points between the poles and the second is the name of the output file which contains locations of the Gaussian latitudes and their weights.The namelists is stored in the input file gauss.cnf.An example is available in Appendix A. The subsequent computations of the meridional profiles of Hough functions, the projection and the modal filtering use this file.
Input data for the projection needs to be provided on a regular Gaussian grid.The software performs no horizontal data interpolation.The regular Gaussian grid is available for extraction directly from the ECMWF data archiving system MARS.Data sets on non-Gaussian grids should be interpolated to the Gaussian grid by the user.This can be done by using standard operators such as the NetCDF operator (NCO) (http://nco.sourceforge.net)and climate data operator (CDO) (https://code.zmaw.de/projects/cdo)or a language like NCL (http://www.ncl.ucar.edu).

Computation of the vertical structure functions
The described procedure for the NMF representation assumes that the input data are defined on vertical σ levels or that they can be vertically interpolated to σ levels.If the input data are not on σ levels, the definition of the σ coordinate needs to be provided.It is used as input to the VSE (10) and later as input information for the interpolation from the levels of input data to σ levels.The software currently manages input data on σ and on hybrid levels and the latter are interpolated to the predefined sigma levels by the software.If the vertical coordinate is not sigma or the hybrid sigma pressure, there is no option available in the software to process the data.The user must define a σ coordinate for his/her input data.For example, the sigma coordinate for the standardpressure level data can easily be computed as σ = p/p s and the vertical interpolation of input data needs to be performed from pressure to σ levels.The software has mainly been applied to the ECMWF data, which are defined on hybrid vertical levels.Subroutines for their interpolation to corresponding σ levels are well tested and included in the software.
In addition to the σ coordinate, the stability profile defined by Eq. ( 8) is another required input to the program for the computation of the vertical structure functions.For the hybrid coordinate of the ECMWF model and several climate models (e.g.NCAR climate model, EC-Earth) values of σ are readily obtained from the available values of average full and half-level pressures.In order to compute the stability profile, globally averaged temperature T 0 on each σ level needs to be specified.The profile of T 0 presented in Fig. 2a is computed from ERA Interim reanalyses for the year of 2000 but it varies little if a multi-year period is used.The same applies for the stability profile computed by Eq. ( 8) from dT 0 /dσ and the σ levels.The profile of 0 for ERA Interim is presented in Fig. 2b.It can be seen that the values of 0 are positive and they vary little throughout the troposphere; however, in the upper stratosphere and the mesosphere 0 increases significantly so that overall it can vary several orders of magnitude between the surface and 0.1 hPa.As a result, the stability parameter S which is computed for use in Eq. ( 10) has a profile with values rapidly increasing in the upper stratosphere (Fig. 2c).
Appendix B shows parameters in the input namelist vs-fcalc_cnf needed for the computation of vertical structure functions.The input file with namelists is vsfcalc.cnf.In addition to the two binary input files, a user specifies the names of two output files which will contain the vertical structure functions and equivalent depths.In principle, the number of vertical modes, which correspond to the number of vertical structure functions saved in the output file, is the same as the number of vertical sigma levels.However, one may not want to use all vertical structure functions in the projection due to small equivalent depths associated with higher vertical modes.As seen in Fig. 3 showing vertical structure functions for ERA Interim, equivalent depths range from about  D = 10 km down to centimetres or even millimetres.There is a rapid drop in values of equivalent depth after the leading five vertical modes.In the case of ERA Interim presented in Fig. 3, there are four equivalent depths greater than 1 km, 11 equivalent depths between 1 km and 100 m while further 18 equivalent depths have values greater than 10 m. Between 10 and 1 m there are 14 depths and the remaining 13 values of equivalent depth are between 1 m and 4 mm.These values define M values of the constant γ (Eq.21) for M systems of the HSEs (18).As illustrated in the next section, the meridional extent of the horizontal structure functions is associated with the magnitude of D. The Hough functions corresponding to equivalent depths of the order of 10 m are meridionally bounded to the tropics.Correspondingly, small equivalent depths have been extensively used to characterize various equatorial waves.This relies on the theory of tropical wave solutions derived for the equatorial-β plane (Matsuno, 1966).Instead of the Hough functions characterizing the spherical wave solutions, linear wave solutions for the shallow-water equations on the equatorial-β plane with the prescribed value of D are given in terms of the parabolic cylinder functions.The linear theory of tropical waves has been successfully employed to represent some of the most dominant variability of the tropical atmosphere (e.g.Gill, 1980;Heckley and Gill, 1984;Biello and Majda, 2005).The spectral-temporal filtering of tropical data has been used to derive the shallow-water phase speeds of equatorial waves coupled to convection; the estimated range of equivalent depths varies between 10 and 100 m (e.g.Hayashi, 1981;Wheeler and Kiladis, 1999).As discussed in previous papers, the equivalent depth for the first vertical mode (m = 1) depends only on the surface temperature, which is a global constant, and the model ver-tical depth (Cohn and Dee, 1989).The equivalent depths for m > 1 are relatively insensitive to the value of the surface boundary condition, but they are sensitive to the stability and the depth of the top model layers (Staniforth et al., 1985).In the case of ERA Interim, there are on average 12 levels beneath 850 hPa, 10 levels from 850 to 500 hPa and 13 levels between 500 and 100 hPa.The remaining 25 levels are in the stratosphere (21 levels under 1 hPa) and mesosphere (4 levels above 1 hPa).If instead of 60 hybrid models levels we select only the 21 levels closest to the standard-pressure levels, the corresponding equivalent depths are different for higher vertical modes as can be seen in Fig. 3b.
The shapes of vertical structure functions for the ERA Interim 60-level system are shown in Fig. 4a and b for the first seven vertical modes (Fig. 4a) and for selected higher modes (Fig. 4b).The solutions for first seven vertical modes are also shown for the case of 21 levels (Fig. 4c) defined by values of average pressure closest to the standard pressure.This figure can be compared with other figures from literature including plots from KP1981 and Žagar et al. (2009a).Each vertical mode m is associated with m − 1 zero crossings in the vertical profile.Therefore, the mode m = 1, which does not change sign, has traditionally been commonly referred to as the barotropic mode.Lower modes have larger amplitudes in the troposphere and the stratosphere, whereas the relevant structure of G m functions moves downward towards the surface as the value of m increases (Fig. 4b).We note that the second mode has its single zero crossing at around 30 hPa and that the leading seven modes have no zero crossings under 300 hPa.Traditionally, these modes have been referred to as the first baroclinic mode, the second baroclinic mode, etc., on in the discussion of tropospheric circulation.However, such terms are not suitable in the present case of models with model top levels high above the tropopause.Since several vertical modes correspond to the traditional picture of the first baroclinic mode, using any one of them provides an incomplete picture of the circulation associated with the first baroclinic mode.Instead, we need to sum a number of vertical modes in order to discuss representative circulations in physical space.

Computation of the horizontal structure functions
A separate program computes the meridional structure of Hough harmonics, i.e. vectors U k n (φ), V k n (φ) and Z k n (φ) for a range of values k and n for each equivalent depth.Appendix C shows parameters which need to be specified in the input file houghcalc.cnfvia several namelists.Two input namelists, meridional_grid and vsf_cnf, are previously defined.In the namelist vsf_cnf, the user specifies the number of vertical modes (i.e.equivalent depths) for which the horizontal structure functions are computed.The range of horizontal modal indices is specified in the houghcalc_cnf namelist by the initial (szw) and final (ezw) values of the zonal wave number and by the number of meridional modes (parameter  maxl).Currently, the same value of meridional modes maxl applies to all three motion types, EIG, WIG and ROT modes, so that the total number of meridional modes is R = 3×maxl.The namelist output defines the name of the output files with Hough meridional profiles and how the outputs are stored (binary or text format).Further explanations are provided in Appendix C.
The size of output binary files can be relatively large if a large zonal and meridional truncation is requested.For example, for the presented ERA Interim data set, we have used 200 zonal wave numbers and 70 meridional modes for each of the IG and balanced modes.With a single file per zonal wave number, there are as many files with meridional structure of Hough function as zonal wave numbers.The computation of horizontal structure functions is also the most memory intensive computation.However, once these files are computed, they can be used repeatedly for projection purposes and they are read only once at the beginning of projection and filtering.
The meridional profiles of the Hough functions corresponding to the Kelvin mode and to the n = 1 balanced mode are shown in Fig. 5 for two zonal wave numbers and for two vertical modes.The displayed vertical modes m = 1 and m = 10 have equivalent depths of ca. 10 km and 220 m, respectively.We can see that an increased value of the vertical mode index, i.e. a reduced value of equivalent depth is associated with a stronger equatorial trapping of the horizontal structure functions.Similar equatorial trapping of horizontal structure functions occurs when the zonal wave number increases for the same equivalent depth.In Fig. 5 the solution for (k,m)=(1,10) appears equatorially trapped nearly as much as the solution for (k,m)=(31,1).For the barotropic mode, the horizontal structure of all modes is global.This tells us that the Hough functions associated with small equivalent depths are strongly bounded to the Equator and hence not useful for the projection of data in the extra-tropical regions.Furthermore, these numerically obtained small equivalent depths are associated with vertical structure functions that are representative only of the lower troposphere and the boundary layer.Therefore, even if one can solve the VSE for all vertical modes, the number of vertical modes we keep in the computation of the horizontal structure functions (parameter num_vmode in namelist vsf_cnf in Appendix C) should in principle be smaller than the number of model levels.For the results presented in the next section for ERA Interim, we kept 43 vertical modes with equivalent depths greater than 1 m.While it is not wrong to keep all vertical modes, we found that not using vertical modes with equivalent depth smaller then 1 m is a good option in the case of models with many vertical levels such as the ECMWF model.

Projection of 3-D data on normal-mode functions
Namelists for the meridional grid and vertical structure functions defined in previous subsections are also used in the input file normal.cnffor the projection that is given in Appendix D. In addition, namelist hough_cnf specifies input files with the meridional Hough functions while the remaining namelists provide information about the input data.The user can choose to save the globally averaged vertical temperature profile T 0 and surface pressure field.These can be used for a posteriori interpolation from sigma levels back to the hybrid (or other) model levels or for the computation of temperature perturbations from the geopotential perturbations.Namelist input_data describes the data format and the vertical grid.The data valid for a single time step can be contained in several files which together must contain fields of temperature, wind components and specific humidity on model levels as well as surface pressure and orography.Horizontally, all fields must be on the regular Gaussian grid.Specific humidity is used in the computation of modellevel geopotential.An option to use the software without humidity data will soon become available in the package.The projection software works in the following way.First, the input files with the meridional grid, vertical structure functions and horizontal structure functions are read.This is followed by the reading of the input data.The modified geopotential variable is computed on the input model levels that are subsequently interpolated vertically to the predefined sigma levels if needed.This provides the input vector X defined by Eq. ( 31).The vertical projection ( 34) is carried out first followed by the horizontal projection (36).The resulting Hough coefficients are saved in the output file with a prefix defined by the variable coef3DNMF_fname which is appended by the date as specified in the namelist time.Currently, the output file is a direct-access binary file but in the near future we plan to make all outputs NetCDF format files.The data reading and the projection step are carried out in the loop over time which is defined in the namelist time.The variable dt defines a regular time step between subsequent files.Outputs of the projection of 30 years of ERA Interim data (once per day at 12:00 UTC) are presented in the next section.

Filtering of modes to physical space
The inverse projection or filtering of modes back to physical space is defined by Eqs. ( 35) and ( 32) for the inverse horizontal and vertical projections, respectively.Not all modes need to be inverted back to physical space.For example, it may be of interest to separate the balanced and IG components of circulation.Tropical modes are of special interest as many studies deal with the characteristics of the Kelvin mode and MRG mode throughout the tropical atmosphere.The NMF software can filter any mode or a set of modes back to physical space.Appendix E contains an example of input file nor-mal_inverse.cnffor the filtering of a selected range of (k, n, m) modal indices.In addition to several namelists shared with the file normal.cnf,two namelists, nor-mal_cnf_inverse and filter_cnf are needed specifically for the filtering purpose.The former is similar to normal_cnf as it defines the input and output file names and formats.The latter defines the range of the zonal, meridional and vertical modes which are to be filtered.The meridional filtering range is defined separately for the EIG, WIG and balanced modes.If the filtering range is specified in terms of the zonal wave numbers or vertical modes, the range of associated meridional modes to be filtered out can be specified by the user.Projection of all modes back to physical space is achieved by choosing the index value of the starting mode to filter (e.g.eig_n_s) greater than the truncation value for the same mode (i.e.eig_n_s > maxl).In the next section we shall discuss outputs of filtering of the balanced and IG circulation.

Modal analysis of ERA Interim: climatological properties
We now present some average properties for the ERA Interim (Dee et al., 2011(Dee et al., ) 30 year period 1980(Dee et al., -2009.Daily input data valid at 12:00 UTC were specified on a 512 × 256 horizontal grid and 60 vertical levels.Projected fields containing χ k n (m) coefficients were saved to files using the parameters provided in Appendix D. The presented climatological properties are obtained in several ways.The global energy distributions presented in Figs.6-8 were obtained by averaging energy in a single zonal wave number and meridional mode as defined by Eqs. ( 47) and (48), respectively.Zonal averages, cross-equatorial flow and horizontal circulation on selected levels were produced by averaging coefficients χ k n (m) over the 30 year period for each mode followed by the inverse projection to physical space based on filtering criteria.Appendix E provides an example of a namelist for filtering the IG circulation.

Scale-dependent energy distribution
Figure 6 shows the average energy distribution as a function of the zonal wave number as defined by Eq. ( 47).The spectra    are shown up to the maximal truncation used for the projection: zonal wave number 200, which corresponds to a grid spacing about 100 km at the Equator and about 70 km in midlatitudes.One can see that the total energy spectra follows the −3 law all the way from the synoptic scales (k > 5) down to the smallest analyzed scale.As in Žagar et al. (2009a), we note a major difference between the balanced and unbalanced energy spectra; the latter are characterized by a flatter slope, especially on planetary and synoptic scales.Furthermore, IG energy is not equally split into EIG and WIG contributions, as shown in Fig. 6b.On planetary scales, the EIG dominate.This is largely due to a contribution of KWs as noted in the previous study (Žagar et al., 2009b, c).
For the planetary wave numbers 1-5, the total (and balanced) energy spectrum is flatter than for synoptic scales; en-ergy injected at scales associated with baroclinic instability inversely cascades to larger scales (Charney, 1971).The energy scaling law in planetary scales appear closer to −1 than to the theoretically expected −5/3 law (e.g.Lilly, 1973).Further details about this part of the spectrum can be discussed in relation to Fig. 6c which shows the balanced energy spectra for different meridional modes.The MRG spectrum (denoted n = 0 ROT) appears flat at planetary scales, a feature noticed also in operational ECMWF analyses by Žagar et al. (2009b).The balanced energy spectra for meridional modes 1-5, which represent the majority of variability in midlatitudes, have a −5/3 slope as expected by the quasigeostrophic turbulence theory (Charney, 1971;Tung and Orlando, 2003).
The total energy distribution shows no sign of slope flattening in sub-synoptic scales in comparison to synoptic scales.On the contrary, after a zonal wave number of around 100 the total energy spectrum becomes somewhat steeper (Fig. 6a).This lack of variability in sub-synoptic scales has been noted also in other studies of NWP models (e.g.Frehlich and Sharman, 2008) including the NMF results of various analysis systems (Žagar et al., 2009a).One can also notice in Fig. 6a that the slope of IG energy spectra becomes steeper as the horizontal scale reduces.In subsynoptic scales, the IG energy clearly dominates over balanced energy.
A relative contribution of the two energy components is further presented in Fig. 7.This figure shows that at the zonal wave numbers 28-30, which correspond to the resolution of about 700 km at the Equator and to around 500 km in the midlatitudes, the unbalanced component of energy becomes greater than the balanced component.Given the global 3-D nature of our spectra and a lack of previous similar investigations, it is difficult to discuss the origin of this scale in ERA Interim data and its realism.A similar scale has been known from observations as the scale of the major shift in the slope of energy spectra (derived for both wind and temperature data) from a −3 to −5/3 range (Nastrom and Gage, 1985).However, a similar change of the slope of the total energy spectra is absent in Fig. 6.Furthermore, energy spectra derived from models are usually based on single level data (e.g.Burgess et al., 2013;Blažica et al., 2013) and they show only kinetic energy; correspondingly, their comparison with the spectrum in Fig. 6a which represents the vertically integrated total energy is not simple.Blažica et al. (2013) showed that on mesoscale in midlatitudes the divergent component of kinetic energy is at least equally as large as the rotational component and that the slopes of the corresponding spectra depend on the altitude (see also Burgess et al., 2013).In our global case with the tropics dominated by divergent circulations, we find that the unbalanced component makes up 80 % or more of the total energy beyond zonal wave number 100 (about 150 km in midlatitudes) (Fig. 7).On planetary scales, the contribution of IG wave energy is about 10 % or less of the total wave energy in these scales.However, as the large-scale energy contains most of the energy, the overall contribution of unbalanced energy to total energy is somewhat less than 10 %.In planetary scales alone (zonal wave numbers 1-5) there is 80 % of total energy; synoptic scales (zonal wave numbers 6 to 15) contain about 15 % of the global total energy while sub-synoptic scales (k > 15) contribute about 5 % of the total global energy in ERA Interim (Fig. 7).Since reanalyses such as ERA Interim provide the most reliable picture of the general circulation, the numbers above can be used to evaluate the energy distribution in climate models.
The meridional energy distribution is presented in Fig. 8.The dominance of balanced energy over IG energy is clearly seen for all meridional modes except for the lowest, n = 0.The reason is that the lowest meridional mode for EIG modes is the Kelvin mode while the MRG wave is saved as n = 0 balanced mode.The KW is the most energetic unbalanced mode of the global atmosphere (Žagar et al., 2009b) and its energy level, especially when shown together with n = 0 WIG mode, exceeds the energy level of the MRG mode.The balanced energy distribution has a peak in meridional modes n = 3-7 which have the most significant structure in the midlatitudes (not shown).As n increases, the IG energy component reduces much more rapidly than the balanced energy component.This can be expected since as n increases, the meridional structure of modes become less and less relevant for the tropics where the IG circulation dominates.
From the physical point of view, it is more complicated to discuss the energy distribution as a function of vertical mode.As discussed in the previous section, it is difficult to discuss a single vertical mode separately except perhaps the barotropic mode.Nevertheless, the vertical energy distribution displays characteristics for the balanced and IG modes that can be physically interpreted.In particular, the vertical distribution of IG energy appears related to tropical convection which generates a majority of tropical IG motions.Several distinct maxima in energy distribution can be associated with free-propagating large-scale IG modes, with deep convection and with convectively coupled waves (figure not shown).An exact physical interpretation of these energy maxima in relation to dominant equatorial waves derived from observations can be obtained by filtering these vertical modes back to physical space and comparing their properties with independent observations.This is a subject of a separate paper.

Average circulation
Figure 9 shows the climatological  zonal winds in January and July, averaged zonally.The three pairs of panels for each month correspond to the total, balanced and IG component.The sum of the balanced and IG components correspond to the total average zonal wind.While Fig. 9a and d resemble the known properties of the zonally averaged zonal wind from earlier reanalyses and global climate models (GCMs) (e.g.Hartman, 2007)    culation into the balanced and IG components has not been presented earlier.Figure 9 shows that the IG component is non-zero in the polar regions of the Southern Hemisphere in both seasons and in the winter stratosphere.In January, there are easterlies in the polar region south of 60 • S up to about 300 hPa and westerlies above.In July, IG easterlies are found from the surface up to 500 hPa.There is a weak unbalanced component of the zonal wind near the surface in the tropics and in the upper stratosphere above 30 hPa in the winter hemisphere.Tropospheric unbalanced easterlies are associated with the impact of Antarctic orography on circulation which in model-level data projects onto IG modes as a stationary signal.In addition, the gradient wind balance must be a contributing factor to the strength of IG circulation in the winter stratosphere (polar vortex) and possibly also in the troposphere around Antarctica.Similarly, a non-zero zonally averaged meridional wind is found in the upper tropical troposphere and near the surface in the subtropical region in the winter hemisphere in relation to the flow from the summer to the winter hemisphere (Fig. 10).Although the climatological meridional winds in the extra tropics are weak, they are present in the boundary layer of the Southern Hemisphere as well as in the summer tropical stratosphere.Since the zonally averaged meridional wind is completely associated with the IG circulation, the balanced and total components are not shown (figures are identical).
A further insight into the meridional wind in the tropics is provided in Fig. 11.This shows the longitudinal features of cross-equatorial circulation for balanced and IG components.In this figure, several known dynamical properties of tropical circulation can be associated with the balanced and IG components.In January, we recognize vertically propagating IG waves in the stratosphere (Fig. 11a and c).The cross-equatorial flow in the upper troposphere and near the surface are in opposite directions and mostly associated with the IG modes.A shift from northerly to southerly winds from winter to summer is associated with the movement of the Hadley cell and the inter-tropical convergence zone (ITCZ).This is especially intense in the Indian Ocean sector due to the monsoon.Another feature seen in Fig. 11 is the impact of orography.It is obvious in the lower troposphere due to the African land massif and in the eastern Pacific due to the Andes.Such features of the lower tropospheric circulation are absent when the vertical structure of circulation is analyzed by using data on standard-pressure levels which remove the impact of orography by the interpolation.While the presented complex structure of winds near the surface may appear less familiar, these are realistic winds as analyzed by ERA Interim on its hybrid model levels which are almost the same as sigma levels close to the surface.We do not go into more detailed research on various features in Figs.9-11 as their proper study and a more exact quantification of the IG component is beyond the scope of the present paper.Our purpose is primarily to illustrate the diagnostic capabilities of the NMF software.
The horizontal climatological structure of wind field is shown in several figures for two levels.We display model level 51 which is located in the lower troposphere close to 900 hPa and at model level 31 located at about 229 hPa as an example of the upper tropospheric flow.January and July circulation are compared in Figs.12-15 for the upper troposphere (Figs. 12 and 14) and the lower troposphere (Figs. 13  and 15).These figures show that the IG circulation, although just a part of the total wind, has an important role in providing a major part of the cross-equatorial flow.It modifies the large-scale balanced flow which is primarily zonal across most of the tropics except in the eastern Pacific.In January, the cross-equatorial IG winds over the western Pa-    cific and Indian oceans together with the zonal balanced winds constitute the total circulation with south-easterly directions (Fig. 12); the opposite applies in July when the IG component enhances cross-equatorial circulation by adding the northern component to balanced easterlies over Indonesia and Indian oceans (Fig. 14).A dominant feature of the IG circulation in July is an almost purely divergent flow over the south-east Asian monsoon region.Another outflow region is found over South America.
The IG circulation close to 900 hPa is comparable in magnitude to the balanced flow.Climatological meridional winds in the central and western Pacific and Indian Ocean in ERA Interim come mainly from the unbalanced flow, especially in January (Fig. 13).Thus, the ITCZ location is defined by the IG circulation.The extent to which this result is associated with the model dynamics and physics, i.e. the first-guess field in data assimilation in comparison to observations and the multivariate coupling imposed through the 4-D-Var in the ERA Interim system, is a complex question beyond the scope of this paper.
Finally, we show an example from the climatology of the most studied mode of tropical dynamics, the Kelvin mode.In Fig. 16 the KW is shown at two levels; besides the upper troposphere level 31 shown in other figures, we also show model level 27 closer to the tropical tropopause, where the KW amplitude is largest in July.The prevalent feature of KW climatology is the zonal wave number k = 1 structure with a negative geopotential perturbation in the upper troposphere over the Indian Ocean and equatorial Africa (easterlies) and a positive perturbation over the most of the Pacific (westerly winds).There is approximately an opposite picture in the lower troposphere over the Pacific with the strongest easterlies over the western and central Pacific (not shown).The climatological KW signal is very weak over the Atlantic and South America in the upper troposphere.This suggests that the climatological picture of the tropics as envisaged by Gill (1980) and implemented in many reduced models of the tropics (e.g.Majda et al., 2004) applies best to the western Pacific, where the low-level easterlies in the ERA Interim are due to the KW response to the heating over Indonesia.A steady-state response from idealized models including the  long-wave approximation, as is assumed in many theoretical studies, in tropical basins other than the western and central Pacific appears appreciably modified by IG modes other than the KW and by the MRG mode, in agreement with expectations from more complex studies (e.g.Kasahara, 1984;Geisler and Stevens, 1982).

Conclusions
We presented the theory of the NMFs, technical details of the code dealing with their application on global 3-D data and examples of the software application to the reanalysis data set ERA Interim.It is argued and illustrated by examples that the normal-mode procedure, once an important part of the initialization of NWP models, can be applied for a range of other topics.In particular, normal modes can be used to evaluate the unbalanced circulation across many scales.The current global observing system provides an unprecedented number of observations, mainly from satellites.Together with advanced assimilation procedures and highresolution global models, high-density observations for the first time in history can resolve IG waves across many scales (e.g.Shutts and Vosper, 2011).Furthermore, improved vertical discretization, a higher model top level and complex parametrizations of moist processes have proven to success-fully represent vertical wave propagation, especially in the tropics.Thus, operational analyses display significant similarities regarding the large-scale divergent modes (e.g.Žagar et al., 2009b).This is encouraging for the evaluation of climate models using normal modes, an application envisaged early by Williamson and Dickinson (1976).The evaluation of present-day and past climates simulated by climate models through their comparison with analyses and the newest reanalyses is crucial in relation to climate scenarios.Since the models are characterized by significant problems in simulating the tropical inter-seasonal variability (e.g.Lin et al., 2006;Hung et al., 2013), the evaluation of the global unbalanced circulation can lead to a new understanding of models' deficiencies and provide new ideas for their improvements.
In particular, the spatio-temporal details of the large-scale equatorial modes such as the KW are identified simultaneously in the mass field and wind field.Furthermore, the analysis is done by considering the entire model depth in contrast to the majority of existing studies.Although the NMF representation is applied independently to instantaneous atmospheric states, the time series of Hough projection coefficients for various modes and their physical-space equivalents link together to provide a spatio-temporal picture consistent with the linear wave theory which has been the backbone of our understanding of atmospheric dynamics.This has been illustrated in Žagar et al. (2009b).A long-term analysis of the vertical wave propagation in ERA Interim is under preparation.As such, the NMF method for wave identification is complementary to other methods such as the spectral-temporal filtering.An important advantage of the NMF method is information on the variance contained in each wave number and mode.
The paper has presented technical details of the software implementation which is considered user friendly.A limited knowledge of Fortran (or a similar programming language) is judged sufficient to implement and modify the software.The software application is controlled through a limited number of parameters in several namelists.A set of open-source libraries for reading the input data and for solving the eigenvalue problem are used as well as the gfortran compiler for the software compilation.
The presented representation of the ERA Interim data set in terms of NMFs has revealed climatological features of the large-scale circulation.We showed that the global energy distribution is dominated by the balanced energy with the IG modes making less than 10 % of the total wave energy.However, beyond zonal wave number 30 (a scale around 700 km), the level of global IG energy exceeds the level of balanced energy.Even though the presented energy distribution is not in agreement with observations as the slope of spectra remains −3 all the way to the smallest resolvable scale, at this point this result is as good as possible to evaluate the energy distribution and balance in climate models.Similar reasoning applies to other presented features such as the zonally averaged and equatorial circulation.
The software is available from http://www.fmf.uni-lj.si/~zagarn/modes.php and support for its implementation is provided by the MODES team at the University of Ljubljana.The real-time spectra and maps of the balanced and IG circulation in the operational ECMWF forecast model can be found at http://meteo.fmf.uni-lj.For each mode filtered out, all zonal wave number and all vertical modes are taken into account wig_n_s, wig_n_e -first and last WIG mode to be filtered out rot_n_s, rot_n_e -first and last ROT mode to be filtered out kmode_s, kmode_e -first and last zonal wave number to be filtered out.
For each zonal wave number filtered out, all meridional and vertical modes are taken into account vmode_s, vmode_e -first and last vertical mode to be filtered out.
For each vertical mode filtered out, all meridional and zonal modes are taken into account in the next section.The equivalent height is denoted by D. Solutions of the VSE are sought under the boundary conditions that no mass transport takes place through the Earth's surface and the model top.They are represented by dG dσ + rG = 0 where r = the model top σ = σ T .

Figure 1 .
Figure 1.Frequencies of spherical normal modes for different equivalent depths.(a) D=10 km, (b) D=1 km, (c) D=100 m and (d) D=10 m.Frequencies are normalized by 2Ω factor and shown in logarithmic scale.Frequencies of the easterly and westerly inertia-gravity modes (EIG and WIG, respectively) are shown for the meridional modes n equal 0, 1, 3, 6, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.For the balanced modes (ROT), shown are meridional modes n = 0, 1,3, 5, 7, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.Frequencies of the Kelvin modes (n = 0 EIG) and mixed Rossby-gravity modes (n = 0 ROT) are shown by magenta-coloured symbols.Frequencies of ROT modes n > 1 are denoted by gray circles and interconnected by dashed black lines.For the EIG and WIG modes frequencies are shown by blue and red symbols, respectively.Negative frequencies correspond to negative values of zonal wavenumbers.Frequencies for k = 0 are zero for all ROT modes, for the MRG mode, for the Kelvin mode and for the n = 0 WIG mode and therefore do not appear in the figures.For n > 0 and k = 0, frequencies of the WIG modes have opposite sign and equal values as frequencies of the EIG modes.For k > 1, frequencies of the WIG modes have larger absolute values than frequencies of the EIG modes for the same n.
Figure 1.Frequencies of spherical normal modes for different equivalent depths.(a) D=10 km, (b) D=1 km, (c) D=100 m and (d) D=10 m.Frequencies are normalized by 2Ω factor and shown in logarithmic scale.Frequencies of the easterly and westerly inertia-gravity modes (EIG and WIG, respectively) are shown for the meridional modes n equal 0, 1, 3, 6, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.For the balanced modes (ROT), shown are meridional modes n = 0, 1,3, 5, 7, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.Frequencies of the Kelvin modes (n = 0 EIG) and mixed Rossby-gravity modes (n = 0 ROT) are shown by magenta-coloured symbols.Frequencies of ROT modes n > 1 are denoted by gray circles and interconnected by dashed black lines.For the EIG and WIG modes frequencies are shown by blue and red symbols, respectively.Negative frequencies correspond to negative values of zonal wavenumbers.Frequencies for k = 0 are zero for all ROT modes, for the MRG mode, for the Kelvin mode and for the n = 0 WIG mode and therefore do not appear in the figures.For n > 0 and k = 0, frequencies of the WIG modes have opposite sign and equal values as frequencies of the EIG modes.For k > 1, frequencies of the WIG modes have larger absolute values than frequencies of the EIG modes for the same n.

Figure 1 .
Figure 1.Frequencies of spherical normal modes for different equivalent depths.(a) D = 10 km, (b) D = 1 km, (c) D = 100 m and (d) D = 10 m.Frequencies are normalized by 2 factor and shown in a logarithmic scale.Frequencies of the easterly and westerly inertiagravity modes (EIG and WIG, respectively) are shown for the meridional modes n = 0, 1, 3, 6, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.For the balanced modes (ROT), meridional modes are shown for n = 0, 1,3, 5, 7, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.Frequencies of the Kelvin modes (n = 0 EIG) and MRG modes (n = 0 ROT) are shown by magenta-coloured symbols.Frequencies of ROT modes n > 1 are denoted by grey circles and interconnected by dashed black lines.The EIG and WIG mode frequencies are shown by blue and red symbols, respectively.Negative frequencies correspond to negative values of zonal wave numbers.Frequencies for k = 0 are zero for all ROT modes, for the MRG mode, for the Kelvin mode and for the n = 0 WIG mode.For n > 0 and k = 0, frequencies of the WIG modes have opposite signs and equal values as the EIG mode frequencies.For k > 1, frequencies of the WIG modes have larger absolute values than frequencies of the EIG modes for the same n.
Figure 1.Frequencies of spherical normal modes for different equivalent depths.(a) D = 10 km, (b) D = 1 km, (c) D = 100 m and (d) D = 10 m.Frequencies are normalized by 2 factor and shown in a logarithmic scale.Frequencies of the easterly and westerly inertiagravity modes (EIG and WIG, respectively) are shown for the meridional modes n = 0, 1, 3, 6, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.For the balanced modes (ROT), meridional modes are shown for n = 0, 1,3, 5, 7, 9, 14, 19, 24, 29, 34, 39, 49, 59  and 69.Frequencies of the Kelvin modes (n = 0 EIG) and MRG modes (n = 0 ROT) are shown by magenta-coloured symbols.Frequencies of ROT modes n > 1 are denoted by grey circles and interconnected by dashed black lines.The EIG and WIG mode frequencies are shown by blue and red symbols, respectively.Negative frequencies correspond to negative values of zonal wave numbers.Frequencies for k = 0 are zero for all ROT modes, for the MRG mode, for the Kelvin mode and for the n = 0 WIG mode.For n > 0 and k = 0, frequencies of the WIG modes have opposite signs and equal values as the EIG mode frequencies.For k > 1, frequencies of the WIG modes have larger absolute values than frequencies of the EIG modes for the same n.

Figure 2 .
Figure 2. Globally-averaged vertical profiles of (a) temperature, (b) stability Γ0 and (c) normalized stability parameter S on model lev which is input to the vertical structure equation (10).Profiles are based on ERA Interim model-level data for year 2000.Labels on y-axis a average pressures of the model levels.Values of stability at various levels in (b) are scaled by different factors for clarity reasons.Under 2 hPa stability is not scaled.

Figure 2 .
Figure 2. Globally averaged vertical profiles of (a) temperature T 0 , (b) stability 0 and (c) normalized stability parameter S on model levels.The stability profile is input to the vertical structure equation (10).Profiles are based on ERA Interim model-level data for year 2000.Labels on y axis are average pressures of the model levels.Values of stability at various levels in (b) are scaled by different factors for clarity reasons.Under 200 hPa stability is not scaled.

Figure 3 .
Figure 3. Values of the equivalent depths obtained as solution of the vertical structure equation for ERA Interim modelling system.(a) 60 model levels and (b) 21 model levels closest to the standard 21 pressure levels.A part of equivalent depths in (a) is also shown multiplied by factor 100 (modes 21-50) and by factor 10000 (modes 51 to 60).A part of aquivalent depths in (b) is similarly multiplied by factor 10 (modes 11-16) and by f actor 100 (modes 16 to 21).

Figure 3 .
Figure 3. Values of the equivalent depths D obtained as solution of the vertical structure equation for ERA Interim modelling system: (a) 60 model levels and (b) the 21 model levels closest to the standard 21 pressure levels.A part of equivalent depths in (a) is also shown multiplied by factor 100 (modes 21-50) and by factor 10 000 (modes 51 to 60).A part of equivalent depths in (b) is similarly multiplied by factor 10 (modes 11-16) and by factor 100 (modes 16 to 21).

Figure 4 .
Figure 4. Vertical structure functions for (a) first seven vertical modes and (b) modes 10, 15, 20, 30, 40 50 and 60, derived for 60 model levels of ERA Interim.(c) As (a) but for the case of 21 model levels closest to the standard 21 pressure levels.

Figure 4 .
Figure 4. Vertical structure functions for (a) the first seven vertical modes and (b) modes 10, 15, 20, 30, 40 50 and 60, derived using the 60 model levels of ERA Interim; (c) same as (a) but for the 21 model levels closest to the standard 21 pressure levels.

Figure 5 .
Figure 5. Meridional structure of the Hough harmonics for (top) Kelvin mode and (bottom) n = 1 balanced mode.The four panels for each mode correspond to various combinations of the zonal wave number k and vertical mode m, as defined in each panels' title.

Figure 6 .
Figure 6.Atmospheric energy spectra.(a) Energy distribution in balanced (red line) and inertio-gravity (blue line) motions and their sum (total wave energy, in black) as a function of the zonal wavenumber.(b) As (a) but IG (black), EIG (red) and WIG (blue).(c) As (a) but balanced spectra for meridional modes n = 0, 1, 3, 5, 11.Spectra are obtained by averaging 30 years of outputs from ERA Interim, 12 UTC analysis.Summation is performed over (a,b) all (m, n) and (c) all m and the mean state (k = 0) is not included.Short dashed lines (black) correspond to the spectra with slopes −3, −1 and −5/3 as written next to the lines.

Figure 6 .Figure 7 .
Figure 6.Atmospheric energy spectra.(a) Energy distribution in balanced (red line) and inertio-gravity (blue line) motions and their sum (total wave energy, in black) as a function of the zonal wave number; (b) same as (a) but IG (black), EIG (red) and WIG (blue); (c) same as (a) but balanced spectra for meridional modes n = 0, 1, 3, 5, 11.Spectra are obtained by averaging 30 years of outputs from ERA Interim, 12:00 UTC analysis.Summation is performed over (a, b) all (m, n) and (c) all m and the mean state (k = 0) is not included.Short dashed lines (black) correspond to the spectra with slopes −3, −1 and −5/3 as written next to the lines.

Figure 7 .Figure 8 .
Figure7.Ratio of balanced (red line) and inertio-gravity (blue line) energy and total energy in each zonal wave number.Averaging is performed for the 30-year period and for all (m, n).

Figure 8 .
Figure8.Distribution of total, balanced and inertio-gravity wave energy in meridional modes.Summation is performed over all (m, k).The mean state (k = 0) is not included.

Figure 9 .
Figure9shows the climatological zonal winds in January and July, averaged zonally.The three pairs of panels for each month correspond to the total, balanced and IG component.The sum of the balanced and IG components correspond to the total average zonal wind.While Fig.9aand d resemble the known properties of the zonally averaged zonal wind from earlier reanalyses and global climate models (GCMs) (e.g.Hartman, 2007), the splitting of cir-

Figure 9 .
Figure 9. Meridional profile of the zonally averaged (a, d) total, (b, e) balanced and (c, f) unbalanced components of the zonal wind in (a-c) January and (d-f) July.Westerlies are shaded while easterlies are drawn by blue isolines.Contour intervals are 4 m s −1 for the balanced and 2 m s −1 for the IG speeds.

Figure 10 .
Figure 10.As in Fig. 9 but for the IG component of the zonally-averaged meridional wind.(a) January and (b) July.Contour interval is 0.5 m/s.

Figure 10 .
Figure 10.As in Fig. 9 but for the IG component of the zonally averaged meridional wind: (a) January and (b) July.Contour interval is 0.5 m s −1 .

Figure 11 .
Figure 11.Meridional winds along the Equator in (a, b) January and (c, d) July.(a, c) All modes and (b, d) unbalanced modes.Spacing is every 2 m s −1 with positive values (northerly wind) in shades of magenta and negative values (southerly wind) in the blue shades.Wind are averaged in the belt between 5 degrees off the Equator (14 Gaussian grid points).

Figure 12 .
Figure 12.Climatological horizontal winds in January on ERA Interim model level 31 (about 229 hPa) for (a) the total circulation, (b) balanced circulation and (c) unbalanced circulation.Wind intensity is shown by both colours and length of the wind vectors.Colour bar (in m s −1 ) is the same for the total circulation and for the balanced circulation (every 1 m s −1 ), whereas the unbalanced winds are coloured with a spacing every 0.5 m s −1 .

Figure 13 .
Figure 13.As in Fig. 12 but for the model level 51 (about 909 hPa).

Figure 14 .
Figure 14.As in Fig. 12 but for July.

Figure 15 .
Figure 15.As in Fig. 13 but for July.

Figure 16 .
Figure 16.Climatological Kelvin wave in ERA Interim for July on (a) model level 27, at about 133 hPa and (b) and model level 31, at about 229 hPa.Isolines for the geopotential height are drawn every 10 m, starting from ±10 m with positive values coloured in magenta and negative values in blue shades.

www.geosci-model-dev.net/8/1169/2015/ Geosci. Model Dev., 8, 1169-1195, 2015
of the input file name with Hough expansion coefficients to be inverted to physical space inverse_fname -prefix of the output file name with zonal wind, meridional wind and modified geopotential on sigma levels in physical space inv2hybrid -true if interpolation from sigma to hybrid model levels is performed upon filtering to compute winds and geopotential on hybrid levels ps_fname -prefix of the input file name of surface pressure file meant_fname -prefix of the input name of file with temperature profile saveasci -true if output of inverse should be saved also in text format afname -prefix of the name of output text format aformat -format for output 3-D data saving eig_n_s, eig_n_e -first and last EIG mode to be filtered out.