Code from: Zonal atmospheric energy fluxes and interannual shifts in the Walker circulation
Abstract
The archive includes scripts for computing the energy flux potential (EFP), the zonal and meridional components of divergent atmospheric energy transport, the Pacific energy flux prime meridian (EFPM) index, zonal streamfunction diagnostics, Walker circulation position and strength indices, precipitation centroid metrics, EFPM decomposition by energy components and regional band, and ENSO-removed EFPM residuals. The code reads monthly ERA5 reanalysis data and an ERA5-derived mass-consistent atmospheric energy and moisture budget dataset, converts them to July–June annual means, computes the diagnostics described above, and generates the main and supplementary figures associated with the study. The archive is organized by computation type, allowing major diagnostics to be calculated once and reused across multiple figures. The dataset can be reused for reproducibility and method development. The deposited files do not include ERA5 or other external datasets in their original form. Instead, users must obtain the original ERA5 reanalysis and related ERA5-derived source datasets directly from their original repositories and under their respective terms of use.
Dataset DOI: 10.5061/dryad.b2rbnzswc
Description of the data and file structure
This dataset contains Python code and derived analysis outputs for the manuscript "Zonal atmospheric energy fluxes and interannual shifts in the Walker circulation" submitted to the Journal of Climate.
No new data was generated for this project. The ERA5 monthly averaged data on single levels from 1940 to present were accessed from Hersbach et al. (2023), and the mass-consistent atmospheric energy and moisture budget monthly dataset derived from ERA5 reanalysis from Mayer et al. (2021).
Files and variables
N/A, not applicable
Code/software
Python analysis code is contained in code.tar. Python code is provided for data processing and computation, and for generating each figure. Python version 3.11.7 was used. All required packages are included in the Python script. Each computation has its own folder containing the script or scripts used to calculate the corresponding variable, index, or derived field. These computed outputs are then used in one or more figure-generation scripts in the subfolders.
The scripts are self-contained. Rather than relying on separate preprocessing scripts or shared subroutine files, each computation script includes the steps needed for its own analysis. Depending on the diagnosis, these steps may include:
-
reading the required ERA5 and ERA5-derived input data,
-
converting monthly data to July–June annual means,
-
computing the relevant diagnostic or index,
-
saving intermediate or final derived outputs.
This structure was adopted so that each major diagnostic is computed once and can then be reused across multiple figures.
Main computations included in the code.tar
The code archive contains folders for the main diagnostics used in the manuscript, including:
EFP & Pacific EFPM folder:
Script - EFP from energy flux divergence: EFP is computed by solving the Poisson equation on the sphere using the vertically integrated atmospheric energy flux divergence field. Uh and vh are derived from the horizontal gradient of EFP and used to diagnose the zonal and meridional structure of atmospheric energy transport. Figure S1 used this output for plotting. The script for Figure S1 can be found in the figure folder. This code was adapted from the original python code provided by William Boos developed for the Boos and Korty (2016) study.
Derived dataset:
ERA5_Q_annual_final.nc
Coordinates:
-
latitude: (latitude) float32 3kB -90.0 -89.75 -89.5 ... 89.5 89.75 90.0
-
year: (year) datetime64[ns] 344B 1979-07-01 1980-07-01 ... 2021-07-01
-
longitude (longitude) float32 6kB -180.0 -179.8 -179.5 ... 179.5 179.8
Variable:
- tediv (units: W m -2, long_name: Divergence of vertical integral of total energy flux)
ERA5_EFP_uh_vh.nc
Coordinates:
-
latitude: (latitude) float32 3kB -90.0 -89.75 -89.5 ... 89.5 89.75 90.0
-
year: (year) datetime64[ns] 344B 1979-07-01 1980-07-01 ... 2021-07-01
-
longitude (longitude) float32 6kB -180.0 -179.8 -179.5 ... 179.5 179.8
Variables:
Efp (units: W, long_name: energy flux potential)
Uh (units: m/s, long_name:zonal divergent wind from EFP)
Vh (units: m/s, long_name:meridional divergent wind from EFP)
Script - Pacific EFPM: Pacific EFPM is derived from zonal divergent energy transport (uh), defined as the longitude where the zonal component of divergent atmospheric energy transport is zero and divergent, i.e., uh=0 and xuh>0. The Pacific EFPM index served as the main index to measure walker circulation position change in the paper. The output index file is used in Figure 1 for time series plot, Figure 2, 6, S3, S5, S6 for correlation analysis, Figure 3, 5, 7 for regression analysis, and Figure 4 for composite analysis (standardized version used).
Derived datasets:
smoothed_pacific_EFPM.nc:
Coordinates:
- year: (year) datetime64[ns] 344B 1979-07-01 1980-07-01 ... 2021-07-01
Data variables:
- EFPM (long_name: Energy Flux Prime Meridian, units: degrees_east)
smoothed_pacific_EFPM_std.txt
This file contains the standardized and smoothed time series of the Pacific contribution to the Energy Flux Prime Meridian (EFPM). It is used for time series analysis, correlation, and regression with other climate indices.
Format
-
Plain text (CSV-style), comma-separated
-
Two columns with header
Columns
-
Year: integer year corresponding to the July–June annual mean (e.g., 1979 represents July 1979 – June 1980) -
EFPM_standardized: standardized (mean = 0, standard deviation = 1)
smoothed_pacific_EFPM.txt
Format
-
Plain text (CSV-style), comma-separated
-
Two columns with header
Columns
-
Year: integer year corresponding to the July–June annual mean (e.g., 1979 represents July 1979 – June 1980) -
EFPM_longitude: longitude (in degrees east) of the EFPM position
Units
EFPM_longitude: degrees east (°E), typically on a [0–360] or [-180–180] grid depending on processing
Precipitation centroid
Script - ppt centroid: Following Nicknish et al (2023), the script computes the precipitation centroid (in longitude) over the Maritime continent and western Pacific. The definition of the precipitation centroid can be found on 2.c in the paper. The output precipitation centroid output file is used to compare with the Pacific EFPM in Figure 2. The script for plotting can be found in the figure folder.
Derived dataset:
95_250centroid.nc
Coordinates:
- valid_time (valid_time) datetime64[ns] 344B 1979-07-01 ... 2021-07-01
Data variable:
- ppt_centroid (long_name: Zonal centroid of precipitation, units: degrees_east)
Nino3.4
Script - nino3.4: The Niño3.4 index is computed from monthly mean temperature averaged over 5°N–5°S, 170°W–120°W using cosine-latitude weighting. Monthly anomalies are applied and then averaged into the July–June annual means. The annual series is restricted to 1979–2021, linearly detrended, and standardized to produce the final Niño3.4 index. The output index is used to compare with the Pacific EFPM in Figure 2. The script for plotting can be found in the figure folder.
Derived dataset:
nino34_index.txt
Format
-
Plain text (CSV-style), comma-separated
-
Two columns with header
Columns
-
Year: integer year corresponding to the July–June annual mean (e.g., 1979 represents July 1979 – June 1980) -
NINO34_detrended_std: Niño 3.4 index after detrending and standardization
Units
- Dimensionless (standardized index; mean = 0, standard deviation = 1)
SOI
The Southern Oscillation Index (SOI) is calculated from ERA5 monthly mean sea level pressure using the difference between Tahiti and Darwin. Monthly sea level pressure is extracted at the grid points nearest Tahiti (17.5°S, 210.4°E) and Darwin (12.5°S, 130.8°E). These monthly series are averaged into the July–June annual means. The annual SOI is then defined as the standardized Tahiti-minus-Darwin pressure difference, where the standardization uses the 1940–2024 climatological mean and standard deviation. The final output is restricted to 1979–2021. The output index is compared with the Pacific EFPM in Figure S3. The full plotting script can be found in the figure folder.
Derived dataset:
SOI(era5)_index.txt
Format
-
Plain text, space-separated
-
Two columns with headers
Columns
-
Year: integer year corresponding to the July–June annual mean (e.g., 1979 represents July 1979 – June 1980) -
SOI: Southern Oscillation Index value
Units
- Dimensionless index
Zonal Streamfunction folder
Script - Streamfunction: the zonal mass streamfunction is computed from the divergent component of zonal wind following Yu and Zwiers (2010) and Yu et al. (2012). The divergent zonal wind is averaged over 5°S–5°N and vertically integrated in pressure coordinates from the top of the atmosphere to the surface. The resulting streamfunction represents the zonal overturning mass transport of the equatorial atmosphere and serves as a dynamical diagnostic of the Walker circulation. Figure 4 used this streamfunction data output for composite analysis. Figure S4 used this data output for a time series plot. The scripts for figures can be found in the figure folder.
In addition, indices of Walker circulation position and strength are derived from zonal streamfunction using the methods described in the manuscript.
Derived datasets:
Era5_uv_annual_final.nc
Coordinates:
-
pressure_level (pressure_level) float64 80B 950.0 850.0 ... 150.0 50.0
-
latitude: (latitude) float64 6kB 90.0 89.75 89.5 ... -89.75 -90.0
-
longitude: (longitude) float64 12kB 0.0 0.25 0.5 ... 359.2 359.5 359.8
-
year: (year) int64 672B 1940 1941 1942 1943 ... 2021 2022 2023
Data variables:
-
u (long_name: U component of wind, units: m s -1)
-
v (long_name: v component of wind, units: m s -1)
Era5_ud_annual.nc
Coordinates:
-
year: (year) int64 672B 1940 1941 1942 1943 ... 2020 2021 2022 2023
-
latitude: (latitude) float64 6kB -90.0 -89.75 -89.5 ... 89.5 89.75 90.0
-
longitude (longitude) float64 12kB 0.0 0.25 0.5 0.75 ... 359.2 359.5 359.8
-
lev: (lev) float64 80B 950.0 850.0 750.0 650.0 ... 250.0 150.0 50.0
Data variables:
- ud (units: m s -1, long_name: irrotational_eastward_wind)
era5_SF.nc
Coordinates:
-
year: (year) int64 672B 1940 1941 1942 1943 ... 2021 2022 2023
-
pressure_level (pressure_level) int64 88B 0 100 200 300 ... 800 900 1000
-
longitude: (longitude) float64 12kB 0.0 0.25 0.5 ... 359.2 359.5 359.8
Data variables:
- psi (units: kg s^-1, long_name: Zonal mass streamfunction)
Script - Walker position: A longitude-based Walker circulation position index is derived from the zonal streamfunction following Bayr et al. (2014). The zonal streamfunction is first vertically averaged between 700 and 300 hPa, and the longitudes at which this vertically averaged field crosses zero are then identified. The zero crossing represents the zonal position of the ascending branch of the Walker circulation. In years with multiple zero crossings, the relevant longitude is defined as the easternmost zero crossing immediately west of the dominant positive streamfunction center over the Pacific. The Walker position output file is used to compare with EFPM in Figure 2. The plotting script for Figure 2 can be found in the figure folder.
Derived dataset:
Zero_lon_1979_2021.nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variable:
- Psi_zero_lon (long_name: Longitude of Walker streamfunction zero crossing, units:: degrees_east)
Script - Walker strength: A Walker circulation strength index is derived from the zonal streamfunction as the maximum streamfunction value at 500 hPa within the equatorial Pacific sector spanning 150°E–120°W. This index represents the peak zonal overturning mass transport associated with the Walker circulation and provides a measure of its overall intensity. The Walker strength output file is used to compare with EFPM in Figure 2. The plotting script for Figure 2 can be found in the figure folder. As an additional check, Walker's circulation strength is also evaluated using a vertical-velocity-based metric in this script, as described in the supplementary information. The output file is used to compare with the EFPM in Figure S5. The plotting script for Figure S5 can be found in the figure folder.
Derived datasets:
Streamfunction_strength.txt
This file contains a time series of Walker circulation strength derived from the zonal streamfunction.
Format
-
Plain text (CSV-style), comma-separated
-
Two columns with header
Columns
-
Year: integer year corresponding to the July–June annual mean (e.g., 1979 represents July 1979 – June 1980) -
psi500_max: maximum zonal streamfunction value used as a measure of Walker circulation strength
Units
psi500_max: kg s⁻¹ (mass streamfunction)
walker_strength(w).nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variable:
WC_strength (description: ERA5 Walker circulation strength, Jul–Jun annual mean, derived from vertical velocity. units: Pa s-1)
EFPM decomposition:
Script - tur_rad_EFP&EFPM: EFP is derived from prescribed net energy input (NEI) fields using the approximation. In this framework, NEI represents the net atmospheric column energy source. Solving the Poisson equation with a prescribed NEI field yields the large-scale divergent atmospheric energy transport implied by that energy-budget forcing. This approach allows χ, and thus Pacific EFPM variability, to be decomposed into contributions from radiative fluxes and turbulent surface fluxes, used in decomposition analysis.
For full nei field: nei = (tsr + ttr) - (slhf + sshf + ssr + str)
To calculate radiative nei: set nei = (tsr + ttr) - (ssr + str)
To calculate turbulent nei: set nei = - (slhf + sshf)
These codes are also used in Figure 7 to calculate regression plots of the full, radiative, and turbulent net energy input onto the Pacific EFPM index (full script can be found in the figure folder). Output turbulent EFPM, radiative EFPM, and total EFPM files are used in Figure S7; the full script can be found in the figure folder.
Derived datasets:
detrend_ERA5_EFP_uh_vh_total.nc
Coordinates:
-
number: int64 8B ...
-
lat: (lat) float64 4kB -70.0 -69.75 -69.5 -69.25 ... 69.5 69.75 70.0
-
year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
-
lon: (lon) float64 12kB -180.0 -179.8 -179.5 ... 179.2 179.5 179.8
Data variables:
-
Nei_total (long_name: total net energy input, units: W m-2)
-
S_total: (long_name: prescribed source field for total controlled inversion, units: W m-2
-
efp_total (long_name: energy flux potential, units: W)
-
uh_total: (long_name: divergent zonal energy transport, units: W m-1)
-
vh_total: (long_name: divergent meridional energy transport, units: W m-1)
detrend_ERA5_EFP_uh_vh_rad.nc
Coordinates:
-
number: int64 8B ...
-
lat: (lat) float64 4kB -70.0 -69.75 -69.5 -69.25 ... 69.5 69.75 70.0
-
year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
-
lon: (lon) float64 12kB -180.0 -179.8 -179.5 ... 179.2 179.5 179.8
Data variables:
-
nei_rad (long_name: radiative net energy input, units: W m-2)
-
S_rad: (long_name: prescribed source field for radiative controlled inversion, units: W m-2
-
efp_rad (long_name: energy flux potential, units: W)
-
uh_rad: (long_name: divergent zonal energy transport, units: W m-1)
-
vh_rad: (long_name: divergent meridional energy transport, units: W m-1)
detrend_ERA5_EFP_uh_vh_turb.nc
Coordinates:
-
number: int64 8B ...
-
lat: (lat) float64 4kB -70.0 -69.75 -69.5 -69.25 ... 69.5 69.75 70.0
-
year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
-
lon: (lon) float64 12kB -180.0 -179.8 -179.5 ... 179.2 179.5 179.8
Data variables:
-
nei_turb (long_name:turbulent net energy input, units: W m-2)
-
S_turb: (long_name: prescribed source field for turbulent controlled inversion, units: W m-2
-
efp_turb (long_name: energy flux potential, units: W)
-
uh_turb: (long_name: divergent zonal energy transport, units: W m-1)
-
vh_turb: (long_name: divergent meridional energy transport, units: W m-1)
detrend_total_smoothed_EFPM.nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variables:
- EFPM: (long_name: Energy Flux Prime Meridian, units: degrees_east)
detrend_rad_smoothed_EFPM.nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variables:
- EFPM: (long_name: Energy Flux Prime Meridian, units: degrees_east)
detrend_turb_smoothed_EFPM.nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variables:
- EFPM: (long_name: Energy Flux Prime Meridian, units: degrees_east)
Script - regional decomposition: To assess the regional contributions to Pacific EFPM shifts, we repeated the decomposition using three basins, Pacific Ocean(150˚E – 80˚W), Indian Ocean + Maritime Continent(30˚E – 150˚E), and Atlantic + Africa + South America(80˚W – 30˚E), using basin-restricted NEI fields constructed with a 20° longitudinal taper that smoothly blends full NEI anomalies within each basin with climatological NEI outside. We specifically use 150˚E as the boundary between the Indian Ocean + Maritime continent sector and the Pacific sector, as the climatological Pacific EFPM is located around 150˚E. The output regional contribution files are used in Figure S8; the full script can be found in the figure folder.
Derived datasets:
pacific_EFP_from_NEI_20degTaper_detrended.nc
Coordinates:
-
longitude: (longitude) float64 12kB -180.0 -179.8 -179.5 ... 179.5 179.8
-
latitude: (latitude) float64 4kB -70.0 -69.75 -69.5 ... 69.5 69.75 70.0
-
year: (year) int64 344B 1979 1980 1981 1982 ... 2018 2019 2020 2021
Data variables:
-
source_nei (long_name: Prescribed NEI source used for inversion (pacific), units: W m -2)
-
efp: (long_name: Energy flux potential from prescribed NEI (pacific), units: W)
-
uh: (long_name: divergent component of zonal energy transport, units: W m -1)
-
vh: long_name: divergent component of meridional energy transport, units: W m -1)
indian_mc_EFP_from_NEI_20degTaper_detrended.nc
Coordinates:
-
longitude: (longitude) float64 12kB -180.0 -179.8 -179.5 ... 179.5 179.8
-
latitude: (latitude) float64 4kB -70.0 -69.75 -69.5 ... 69.5 69.75 70.0
-
year: (year) int64 344B 1979 1980 1981 1982 ... 2018 2019 2020 2021
Data variables:
-
source_nei (long_name: Prescribed NEI source used for inversion (indian+mc), units: W m -2)
-
efp: (long_name: Energy flux potential from prescribed NEI (indian+mc), units: W)
-
uh: (long_name: divergent component of zonal energy transport, units: W m -1)
-
vh: long_name: divergent component of meridional energy transport, units: W m -1)
atl_afr_EFP_from_NEI_20degTaper_detrended.nc
Coordinates:
-
longitude: (longitude) float64 12kB -180.0 -179.8 -179.5 ... 179.5 179.8
-
latitude: (latitude) float64 4kB -70.0 -69.75 -69.5 ... 69.5 69.75 70.0
-
year: (year) int64 344B 1979 1980 1981 1982 ... 2018 2019 2020 2021
Data variables:
-
source_nei (long_name: Prescribed NEI source used for inversion (atl+afr), units: W m -2)
-
efp: (long_name: Energy flux potential from prescribed NEI (atl+afr), units: W)
-
uh: (long_name: divergent component of zonal energy transport, units: W m -1)
-
vh: long_name: divergent component of meridional energy transport, units: W m -1)
detrend_pacific_smoothed_EFPM.nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variables:
- EFPM: (long_name: Energy Flux Prime Meridian, units: degrees_east)
detrend_indian_mc_smoothed_EFPM.nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variables:
- EFPM: (long_name: Energy Flux Prime Meridian, units: degrees_east)
detrend_atl_afr_smoothed_EFPM.nc
Coordinates:
- year: (year) int64 344B 1979 1980 1981 1982 1983 ... 2018 2019 2020 2021
Data variables:
- EFPM: (long_name: Energy Flux Prime Meridian, units: degrees_east)
Pacific EFPM residual
Script - EFPM residual: To remove the ENSO component from the Pacific EPFM index, we first performed an empirical orthogonal function (EOF) analysis on annual ERA5 surface air temperature (t₂m) anomalies over the tropical Pacific (10° S–10° N, 120° E–80° W) for 1979–2021. The anomalies were computed from July-June annual means to match the annual definition adopted in this study. The first two leading EOF modes, representing the canonical and central-Pacific (Modoki) components of ENSO, were extracted from the area-weighted anomaly field. Following Takahashi et al. (2011), these two modes were linearly combined into orthogonal indices C and E, which together describe the full nonlinear evolution of ENSO. The annual Pacific EFPM index was then regressed against the corresponding C and E indices using a multiple linear regression model EFPM=aC+bE+intercept+ε, where the residual term ( ε ) represents the ENSO-removed component. The resulting ENSO-independent Pacific EFPM residual retains interannual and decadal variations unrelated to ENSO. The output residual index file is used in Figures 8, 9, and S9. Full scripts for plotting can be found in the figure folder.
Derived datasets:
PC12_annual.txt
Format
-
Plain text, space-separated
-
Three columns with headers
Columns
-
Year: integer year corresponding to the July–June annual mean (e.g., 1979 represents July 1979 – June 1980) -
PC1: first principal component time series -
PC2: second principal component time series
Units
- Dimensionless (standardized EOF amplitudes)
EFPM_resid.txt
Format
-
Plain text (CSV-style), comma-separated
-
Two columns with header
Columns
-
Year: integer year corresponding to the July–June annual mean (e.g., 1979 represents July 1979 – June 1980) -
EFPM_longitude: longitude (in degrees east) of the ENSO-removed EFPM position
Units
EFPM_longitude: degrees east (°E)
Access information
The code used the data from these sources:
- Hersbach, H., Bell, B., Berrisford, P., Biavati, G., Horányi, A., Muñoz Sabater, J., Nicolas, J., Peubey, C., Radu, R., Rozum, I., Schepers, D., Simmons, A., Soci, C., Dee, D., Thépaut, J-N. (2023): ERA5 monthly averaged data on single levels from 1940 to present. Copernicus Climate Change Service (C3S) Climate Data Store (CDS), DOI: 10.24381/cds.f17050d7
- Mayer, J., Mayer, M., Haimberger, L., 2021b: Mass-consistent atmospheric energy and moisture budget monthly data from 1979 to present derived from ERA5 reanalysis. Copernicus Climate Change Service (C3S) Climate Data Store (CDS). DOI: 10.24381/cds.c2451f6b
