MJO Phase Space Trajectory Diagram

MJO Phase Space Trajectory Diagram#

Before proceeding with all the steps, first import some necessary libraries and packages

import xarray as xr
import pandas as pd
import easyclimate as ecl
import matplotlib.pyplot as plt

Load MJO phase space data

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 mjo_data.nc

mjo_data = xr.open_dataset("mjo_data.nc").rename({"T": "time"})
mjo_data
<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 ...


Draw MJO Phase Space Trajectory Diagram

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"
)
plot mjo phase

Total running time of the script: (0 minutes 3.463 seconds)