A free software package for the computation of the three-dimensional normal modes of an hydrostatic atmosphere is presented. This software performs the computations in isobaric coordinates and was developed for two user-friendly languages: MATLAB and Python. The software can be used to expand the global atmospheric circulation onto the 3-D normal modes. This expansion allows the computation of a 3-D energetic scheme, which partitions the energy reservoirs and energy interactions between 3-D spatial scales, barotropic and baroclinic components, and balanced (rotational) and unbalanced (divergent) circulation fields. Moreover, by retaining only a subset of the expansion coefficients, the 3-D normal mode expansion can be used for spatial-scale filtering of atmospheric motion, filtering of balanced motion and mass unbalanced motions, and barotropic and baroclinic components. Fixing the meridional scale, the 3-D normal mode filtering can be used to isolate tropical components of the atmospheric circulation. All of these features are useful both in data analysis and in assessment of general circulation atmospheric models.

The use of the three-dimensional normal mode functions (3-D NMFs) of the linearised primitive equations as a basis to expand the global horizontal wind and mass fields simultaneously was presented for the first time by

The original work of

The 3-D normal mode expansion has been applied in several type of studies, such as the comparisons of reanalysis datasets

Recently,

In the traditional shallow atmosphere approximation, a set of primitive equations in isobaric coordinates may be written as follows:

Multiplying Eq. (

The right-hand side of Eqs. (

The linearised system (

Following this, the separable vertical structures

The VSE (

Another set of boundary conditions assumes that the atmospheric mass is bounded by an isobaric surface

The vertical structure functions (VSFs),

Using this orthonormality condition, one can define a vertical transform

It can be shown

In this software package, the VSE is solved by using the spectral method introduced by

Figure

The first 12 vertical structure functions derived using

The first 12 vertical structure functions derived using

The baroclinic structures in both Figs.

Applying the vertical transform (

Equation (

Since Eq. (

For

It can be shown that for real

The Hough vector function,

In order to distinguish each wave type, i.e. the westward-propagating Rossby wave and the westward- and eastward-propagating gravity inertia waves, the meridional index

As shown in

Figure

Dimensionless frequencies

The meaning of eastward and westward propagations is lost in the case of

Figure

Asymptotic dimensionless frequencies

As mentioned above, the horizontal modes include Kelvin, westward and eastward inertio-gravity (WIG and EIG, respectively), Rossby, and mixed Rossby–gravity (MRG) waves. As an illustration of the software outputs, the horizontal structure functions were calculated for each equivalent height computed in Sect.

Meridional structures of the barotropic (

Meridional structures of two baroclinic Hough harmonics (

The Hough vector functions define modes in the transformed variables as given by Eq. (

The same as in Fig.

The three-dimensional (3-D) normal mode functions (NMFs) are obtained by the product of the vertical normal modes

The expansion coefficients

Using the 3-D NMFs of the linearised primitive Eqs. (

Derivation of the 3-D NME may be summarised as follows.

Applying the vertical transform (

The kinetic energy,

In the transformed 3-D normal mode space, the total energy

Substituting Eq. (

The terms

As another illustration of the capabilities of the current software, in Fig.

A detailed analysis of the spectra in Fig.

Spectra of total energy

A disadvantage of the 3-D NME is that one cannot separate the available potential and kinetic energies, only the total energy (

Extended energy cycle diagram describing the flow of energy among the zonal mean and eddy components and among the barotropic and baroclinic components for ERA-Interim in DJF (top values) and JJA (bottom values) climates. Units are

The same as in Fig.

The term

The energy cycle diagram of Fig.

As an alternative,

Although boundary condition (

The use of the boundary condition (

The software presented here consists of tools or functions for specific tasks and includes a Python and a MATLAB version. The Python version requires NumPy and SciPy modules and works with both Python 2 and 3. The netCDF4 library is recommended. The input–output data format for each function may be either the native format of the chosen version, i.e. “.mat” for MATLAB and “.npz” for Python, or netCDF for both versions.

The tasks to be achieved with the functions in the software include the solution of the VSE (

Other applications of this software include the spatial-scale filtering of atmospheric motion and filtering of balanced motion and mass unbalanced motions by retaining an appropriate subset of terms in the expansion (

The vertical structure equation (VSE), (

The solution of HSE (

The complex expansion coefficients

The zonal and meridional wind,

All functions described above have the same name in both versions, MATLAB and Python, differing only in the file extension (“.m” and “.py”, respectively). The software tools presented here include two more functions used to compute the vertical and the Hough transforms. In the MATLAB version there are two separate functions,

The exact version of the software code used to produce the results presented in this paper is archived on Zenodo (

CAFM conceived the idea, wrote the initial version of the software code for MATLAB, and tested the final version of the software for both MATLAB and Python. MMA wrote the software code for Python and the final version of the code for MATLAB and collaborated in the tests of the software. JMC elaborated the structure of the software and collaborated in writing the initial version of the software code for MATLAB and in the software tests. All authors contributed to writing the manuscript.

The authors declare that they have no conflict of interest.

The code is made publicly available without any warranty.

Carlos A. F. Marques was supported by the Portuguese Foundation for Science and Technology (FCT) under grant no. SFRH/BPD/76232/2011. The ERA-Interim data have been obtained from the ECMWF data server. Thanks are due to FCT/MCTES for the financial support to CESAM (UIDP/50017/2020+UIDB/50017/2020) through national funds.

This research has been supported by the Portuguese Foundation for Science and Technology (FCT) (grant no. SFRH/BPD/76232/2011) and by FCT/MCTES through national funds for the financial support to CESAM (UIDP/50017/2020+UIDB/50017/2020).

This paper was edited by David Ham and reviewed by two anonymous referees.