DOI: 10.5281/zenodo.17731151
title: The Impact of MJO on Extreme Heatwave Events in South China

description: # MJO-Heatwave Connection Analysis

Code and data for reproducing figures in the manuscript:**"The Impact of MJO on Extreme Heatwave Events in South China"**

## Repository Structure

```submission/├── code/│   ├── preprocessing/       # Data preprocessing scripts│   │   ├── compute_olr_composites.py│   │   ├── compute_wind_composites.py│   │   ├── compute_geopotential_composites.py│   │   ├── compute_era5_hovmoller_composites.py│   │   ├── compute_variance_contribution.py│   │   └── compute_temperature_composites.py│   ├── analysis/            # Statistical analysis scripts│   │   ├── composite_analysis.py      # Main composite analysis│   │   ├── regional_analysis.py       # Regional heatwave analysis│   │   ├── mjo_phase_composites.py    # MJO phase composite analysis│   │   ├── heatwave_statistics.py     # Heatwave event statistics│   │   ├── identify_heatwaves.py      # Heatwave identification│   │   ├── probability_bootstrap.py   # Bootstrap significance testing│   │   ├── spectral_analysis.py       # Spectral/wavelet analysis│   │   ├── power_spectrum.py          # Power spectrum analysis│   │   ├── statistical_tests.py       # Statistical test utilities│   │   └── ...│   └── visualization/       # Figure generation scripts│       ├── figure1_spatial_distribution.py│       ├── figure2_duration_analysis.py│       ├── figure3_temporal_evolution.py│       ├── figure4_mjo_phase_distribution.py│       ├── figure5_era5_hovmoller.py│       ├── figure6_spatial_evolution.py│       ├── figure7_circulation_patterns.py│       ├── figure8a_olr_preevent_composite.py│       ├── figure8b_mjo_phase_fraction.py│       ├── figure9_phase_lag_probability.py│       └── figure10_phase_evolution.py├── data/│   ├── processed/           # Processed heatwave and station data│   ├── mjo/                 # MJO RMM index data│   └── plotting/            # Pre-computed composites for figures├── original_notebooks/      # Original Jupyter notebooks (research code)├── figures/                 # Output directory for generated figures├── environment.yml          # Conda environment specification├── requirements.txt         # Python dependencies└── LICENSE                  # MIT License```

## Quick Start

### 1. Setup Environment

```bash# Using conda (recommended)conda env create -f environment.ymlconda activate mjo_heatwave

# Or using pippip install -r requirements.txt```

### 2. Generate Figures

All figures can be generated using the pre-computed data included in `data/plotting/`:

```bashcd code/visualization

# Generate individual figurespython figure1_spatial_distribution.pypython figure2_duration_analysis.pypython figure3_temporal_evolution.pypython figure4_mjo_phase_distribution.pypython figure5_era5_hovmoller.pypython figure6_spatial_evolution.pypython figure7_circulation_patterns.pypython figure8a_olr_preevent_composite.pypython figure8b_mjo_phase_fraction.pypython figure9_phase_lag_probability.pypython figure10_phase_evolution.py```

Figures will be saved to `figures/`.

## Data Description

### Pre-computed Composites (`data/plotting/`)

| File | Description | Used by ||------|-------------|---------|| `olr_mjo_phase_composites.nc` | OLR anomaly by MJO phase (1-8) | Figure 7 || `wind_mjo_phase_composites.nc` | 850 hPa wind by MJO phase | Figure 7 || `geopotential_mjo_phase_composites.nc` | 500 hPa geopotential height by phase | Figure 10 || `era5_hovmoller_composites.nc` | ERA5 Hovmöller diagrams | Figure 5 || `olr_event_composites_mean_5d.nc` | OLR composite around events (≥5 days) | Figure 6, 8a || `wind_event_composites_mean_5d.nc` | Wind composite around events (≥5 days) | Figure 6, 8a || `*.csv` | Temperature composites and statistics | Figures 1-4, 8-9 |

### Processed Data (`data/processed/`)

| File | Description ||------|-------------|| `persistent_events.csv` | Identified persistent heatwave events || `heatwave_events_all.csv` | All heatwave events || `station_locations.csv` | Weather station coordinates || `tmax_anomaly.csv` | Daily temperature anomalies |

### MJO Data (`data/mjo/`)

| File | Description ||------|-------------|| `rmm_index_1979_2020.csv` | RMM index (amplitude ≥ 1.0) || `rmm_index_all_amplitudes.csv` | Full RMM index data |

## Original Research Notebooks

The `original_notebooks/` directory contains the original Jupyter notebooks used during research:

| Notebook | Description ||----------|-------------|| `01_synthesis_tmax_mjo.ipynb` | Main synthesis analysis || `02_mjo_phase_temperature_composite.ipynb` | MJO phase composites || `03_olr_anomaly_analysis.ipynb` | OLR anomaly analysis || `04_preprocess_temperature.ipynb` | Temperature preprocessing || `05_preprocess_mjo.ipynb` | MJO data preprocessing || `06_heatwave_event_statistics.ipynb` | Event statistics || `07_regional_heatwave_analysis.ipynb` | Regional analysis || `08_south_china_heatwave_spatial.ipynb` | South China spatial analysis || `09_heatwave_probability_bootstrap.ipynb` | Bootstrap probability analysis || `10_power_spectrum_analysis.ipynb` | Power spectrum analysis || `11_lanczos_filter.ipynb` | Lanczos bandpass filter || `12_spectral_analysis.ipynb` | Spectral analysis |

## Methods

### Filtering- **Lanczos bandpass filter**: 201 weights, 30-60 day period- Applied to raw anomaly data before compositing ("filter then composite")

### Event Definition- Persistent heatwave events: ≥2 consecutive days above 90th percentile- Default analysis uses events with duration ≥5 days (25 events)- Option to use all events ≥2 days (146 events) via `--min-duration 2`

### MJO Phase Composites- Based on RMM index with amplitude ≥1.0- Persistent MJO: ≥3 consecutive days in same phase- 8 phases representing eastward propagation

## Requirements

- Python ≥3.8- numpy, pandas, xarray- matplotlib, cartopy- scipy- meteva (for map plotting utilities)

## Citation

If you use this code or data, please cite:[Paper citation to be added upon publication]

## License

MIT License - see LICENSE file

## Contact

[zhenhua.li@gmail.com]