pcmdi_metrics.qbo.compute_qbo_mjo_metrics

pcmdi_metrics.qbo.compute_qbo_mjo_metrics(ds, ds2, varname, varname2, start, end, taper_to_mean=True, model='model', exp=None, member=None, debug=False)[source]

Compute QBO-MJO metrics from already-opened xarray Datasets.

This is the pure-computation entry point. It performs no file I/O, writes no output files, and produces no plots. Suitable for use in Jupyter notebooks, pipelines, and unit tests.

ds and ds2 are assumed to already be on the desired grid, with varname already reduced to a single vertical level if applicable – any file loading, level selection, and regridding is the caller’s responsibility. See process_qbo_mjo_metrics for a file-path-based wrapper that handles that before calling here.

Parameters:
  • ds (xr.Dataset) – Monthly zonal wind dataset containing varname on a (time, lat, lon) grid.

  • ds2 (xr.Dataset) – Daily OLR dataset containing varname2 on a (time, lat, lon) grid.

  • varname (str) – Zonal wind variable name in ds.

  • varname2 (str) – OLR variable name in ds2.

  • start (str) – Start of the time subset, "YYYY-MM".

  • end (str) – End of the time subset, "YYYY-MM".

  • taper_to_mean (bool, optional) – Passed through to the Kelvin filter’s time tapering. Default is True.

  • model (str, optional) – Model name, used only as a key in the returned output dict. Default is "model".

  • exp (str or None, optional) – Experiment name (kept for signature parity with process_qbo_mjo_metrics; not used in the computation). Default is None.

  • member (str or None, optional) – Ensemble member name, used only as a key in the returned output dict. Default is None.

  • debug (bool, optional) – If True, print additional diagnostics and populate extra fields (window, mjo_olr_detrended, mjo_olr_tapered) in the olr_region diagnostic Dataset. Default is False.

Returns:

  • output (dict) – {model: {member: {"mjo_activity": float, "mjo_activity_diff": float, "qbo_east_years": list, "qbo_west_years": list}}}.

  • diagnostics (dict) – Intermediate xarray objects useful for plotting/saving:

    • std: standard deviation of the smoothed QBO index

    • u_index: area-averaged U50 anomaly time series

    • u_index_smoothed: 3-month running mean of u_index

    • u_index_smoothed_djf: DJF-mean of u_index_smoothed

    • olr_region: OLR Dataset with mjo_olr and the mjo_olr_stdmap* diagnostic fields attached

    • olr_std_map: DJF standard deviation map of MJO-filtered OLR

    • olr_std_map_phase: {"east": ..., "west": ...} std maps partitioned by QBO phase

    • olr_std_map_diff: east-minus-west difference of olr_std_map_phase