epygram.spectra — Class and functions for spectra

This module contains:

  • a class to handle variance spectrum;
  • a function to compute DCT spectrum from a 2D field;
  • a function to sort spectra with regards to their name;
  • a function to plot a series of spectra.

Classes

class epygram.spectra.Spectrum(variances, name=None, resolution=None, mean2=None, **kwargs)[source]

Bases: epygram.util.RecursiveObject

A spectrum can be seen as a quantification of a signal’s variance with regards to scale. If the signal is defined in physical space on N points, its spectral representation will be a squared mean value (wavenumber 0) and variances for N-1 wavenumbers. For details and documentation, see

Denis et al. (2002) : ‘Spectral Decomposition of Two-Dimensional Atmospheric Fields on Limited-Area Domains Using the Discrete Cosine Transform (DCT)’
dump(filename)

Writes the spectrum with formatted output in filename.

wavelengths[source]

Gets the wavelengths of the spectrum.

wavenumbers[source]

Gets the wavenumbers of the spectrum.

write(out)[source]

Writes the spectrum with formatted output in out.

out must be an output open file-like object (out.write() only is needed).

Functions

epygram.spectra.dctspectrum(x, log=None, verbose=False)[source]

Function dctspectrum takes a 2D-array as argument and returns its 1D DCT ellipse spectrum.

For details and documentation, see
Denis et al. (2002) : ‘Spectral Decomposition of Two-Dimensional Atmospheric Fields on Limited-Area Domains Using the Discrete Cosine Transform (DCT).’

log is an optional logging.Logger instance to which print info in verbose case.

epygram.spectra.sort(spectra)[source]

Sort a list of spectra with regards to their name.

epygram.spectra.plotspectra(spectra, slopes=[{'label': '-3', 'exp': -3, 'offset': 1}, {'label': '-5/3', 'exp': -1.6666666666666667, 'offset': 1}], zoom=None, unit='SI', title=None)[source]

To plot a series of spectra.

Args:

  • spectra = a Spectrum instance or a list of.

  • unit: string accepting LaTeX-mathematical syntaxes

  • slopes = list of dict( - exp=x where x is exposant of a A*k**-x slope - offset=A where A is logscale offset in a A*k**-x slope;

    a offset=1 is fitted to intercept the first spectra at wavenumber = 2

    • label=(optional label) appearing ‘k = label’ in legend)
  • zoom = dict(xmin=,xmax=,ymin=,ymax=)

  • title = string for title

Table Of Contents

Previous topic

epygram.profiles — Functions on vertical profiles

Next topic

epygram.args_catalog — Catalog of command-line arguments

This Page