Module mjoindices.omi.wheeler_kiladis_mjo_filter

This module provides the 2-dim (temporal and longitudinal) filtering algorithm used by the OMI approach.

Although implemented generically, this module is not intended to be used stand-alone outside the OMI context, as it has only been extensively tested for the specific OMI filtering conditions.

Hence, there is usually no need for the users of the mjoindices package to call functions of this module themselves. Instead, they probably want to use the module mjoindices.omi.omi_calculator directly.

The complete algorithm is described by Kiladis et al. (2014)

class mjoindices.omi.wheeler_kiladis_mjo_filter.WKFilter[source]

This class contains the major Wheeler-Kiladis-Filtering functionality. The functionality is encapsulated in a class because values of intermediate processing steps are saved as class members for debugging purposes. To run the filtering, only the method perform_2dim_spectral_filtering() has to be executed.

perform_2dim_spectral_filtering(data: ndarray, time_spacing: float, period_min: float, period_max: float, wn_min: float, wn_max: float, do_plot: bool = False, save_debug: bool = False) ndarray[source]

Bandpass-filters OLR data in time- and longitude-direction according to the original Kiladis algorithm.

Note that the temporal and longitudinal dimension have in principle different characteristics, so that they are in detail treated a bit differently: While the time variable may evolve to infinity (thus, the number of data points and the time_spacing variable are needed to calculate the full temporal coverage), longitude is periodic with the periodicity of one globe (thus, it is assumed that the data covers exactly one globe and only passing the number of longitudes provides complete information).

Parameters:
  • data – The OLR data as 2-dim array: first dimension time, second dimension longitude, both equally spaced. The longitudinal dimension has to cover the full globe. The time dimension is further described by the variable time_spacing.

  • time_spacing – Temporal resolution of the data in days (often 1 or 0.5 (if two data points exist per day)).

  • period_min – Minimal period (in days) that remains in the dataset.

  • period_max – Maximal period (in days) that remains in the dataset.

  • wn_min – Minimal wavenumber (in cycles per globe) that remains in the dataset.

  • wn_max – Maximal wavenumber (in cycles per globe) that remains in the dataset.

  • do_plot – If True, diagnosis plots will be generated.

  • save_debug – If True, some variables will be filled with values of intermediate processing steps for debugging purposes.

Returns:

The filtered data.

mjoindices.omi.wheeler_kiladis_mjo_filter.detrend_vector(data: ndarray) ndarray[source]

Removes the trend from the given vector.

Parameters:

data – The vector to detrend

Returns:

The data with removed trend.

mjoindices.omi.wheeler_kiladis_mjo_filter.filter_olr_for_mjo_eof_calculation(olrdata: OLRData, do_plot: bool = False) OLRData[source]

Filters OLR data temporally and longitudinally with a bandwidth particularly selected for the EOF calculation.

The filter setup meets the description of Kiladis (2014) for the EOF calculation.

Parameters:
  • olrdata – The original OLR data

  • do_plot – If True, diagnosis plots will be generated.

Returns:

The filtered OLR data.

mjoindices.omi.wheeler_kiladis_mjo_filter.filter_olr_for_mjo_pc_calculation(olrdata: OLRData, do_plot: bool = False)[source]

Filters OLR data temporally with a bandwidth particularly selected for the PC calculation.

The filter algorithm is the same as for the combined temporal and longitudinal filtering, but the longitudinal bandpass filter constants are defined so broadly that effectively no longitudinal filtering is applied. The temporal filtering constants are chosen to meet the values in the description by Kiladis et al. (2014).

Parameters:
  • olrdata – The original OLR data.

  • do_plot – If True, diagnosis plots will be generated.

Returns:

The filtered OLR.

mjoindices.omi.wheeler_kiladis_mjo_filter.filter_olr_temporally(olrdata: OLRData, period_min: float, period_max: float, do_plot: bool = False)[source]

Filters OLR data temporally.

The filter algorithm is the same as for the combined temporal and longitudinal filtering, but the longitudinal bandpass filter constants are defined so broadly that effectively no longitudinal filtering is applied.

Note that this function has only been strictly tested for filtering constants used by the OMI algorithm.

Parameters:
  • olrdata – The original OLR data

  • period_min – Temporal filter constant: Only greater periods (in days) remain in the data.

  • period_max – Temporal filter constant: Only lower periods (in days) remain in the data.

  • do_plot – If True, diagnosis plots will be generated.

Returns:

The filtered OLR.

mjoindices.omi.wheeler_kiladis_mjo_filter.filter_olr_temporally_and_longitudinally(olrdata: OLRData, period_min: float, period_max: float, wn_min: float, wn_max: float, do_plot: bool = False) OLRData[source]

Performs a temporal and longitudinal bandpass filtering of the OLR data with configurable filtering thresholds.

Note that this function has only been strictly tested for filtering constants used by the OMI algorithm.

Parameters:
  • olrdata – The original OLR data.

  • period_min – Temporal filter constant: Only greater periods (in days) remain in the data.

  • period_max – Temporal filter constant: Only lower periods (in days) remain in the data.

  • wn_min – Longitudinal filter constant: Only greater wave numbers (in cycles per globe) remain in the data.

  • wn_max – Longitudinal filter constant: Only lower wave numbers (in cycles per globe) remain in the data.

  • do_plot – If True, diagnosis plots will be generated.

Returns:

The filtered OLR.

mjoindices.omi.wheeler_kiladis_mjo_filter.taper_vector_to_zero(data: ndarray, window_length: int) ndarray[source]

Taper the data in the given vector to zero at both the beginning and the ending.

Parameters:
  • data – The data to taper.

  • window_length – The length of the window (measured in vector indices), in which the tapering is applied for the beginning and the ending independently

Returns:

The tapered data.