.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_gallery/plot_mjo_phase.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_gallery_plot_mjo_phase.py: .. _mjo_phase_diagram_example: MJO Phase Space Trajectory Diagram =================================== Before proceeding with all the steps, first import some necessary libraries and packages .. GENERATED FROM PYTHON SOURCE LINES 10-15 .. code-block:: Python import xarray as xr import pandas as pd import easyclimate as ecl import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 16-33 Load MJO phase space data .. code-block:: python mjo_ds = xr.open_dataset('http://iridl.ldeo.columbia.edu/SOURCES/.BoM/.MJO/.RMM/dods', decode_times=False) T = mjo_ds.T.values mjo_ds['T'] = pd.date_range("1974-06-01", periods=len(T)) mjo_ds = ecl.utility.get_compress_xarraydata(mjo_ds) mjo_ds.to_netcdf("mjo_data.nc") Modify the name of the time parameter .. tip:: You can download following datasets here: :download:`Download mjo_data.nc ` .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python mjo_data = xr.open_dataset("mjo_data.nc").rename({"T": "time"}) mjo_data .. raw:: html
<xarray.Dataset> Size: 446kB
    Dimensions:    (time: 18566)
    Coordinates:
      * time       (time) datetime64[ns] 149kB 1974-06-01 1974-06-02 ... 2025-03-30
    Data variables:
        amplitude  (time) float32 74kB ...
        phase      (time) float32 74kB ...
        RMM1       (time) float32 74kB ...
        RMM2       (time) float32 74kB ...


.. GENERATED FROM PYTHON SOURCE LINES 38-39 Draw MJO Phase Space Trajectory Diagram .. GENERATED FROM PYTHON SOURCE LINES 39-49 .. code-block:: Python fig, ax = plt.subplots(figsize = (7.5, 7.5)) ecl.field.equatorial_wave.draw_mjo_phase_space_basemap() ecl.field.equatorial_wave.draw_mjo_phase_space( mjo_data = mjo_data.sel(time = slice('2024-12-01', '2024-12-31')), rmm1_dim = "RMM1", rmm2_dim = "RMM2", time_dim = "time" ) .. image-sg:: /auto_gallery/images/sphx_glr_plot_mjo_phase_001.png :alt: plot mjo phase :srcset: /auto_gallery/images/sphx_glr_plot_mjo_phase_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.463 seconds) .. _sphx_glr_download_auto_gallery_plot_mjo_phase.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_mjo_phase.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_mjo_phase.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_mjo_phase.zip `