API Reference
APIs
Unless specified, the following Application Programming Interfaces (APIs) are available in pcmdi_metrics (> v3.6.1) or higher.
Analysis & Diagnostics
PMP is currently expanding its public APIs for diagnostics and metrics. This effort is intended to make more of PMP’s capabilities available through a cleaner, more flexible and accessible for users and developers. As the API surface grows, additional diagnostics and metric calculations will be exposed in a way that supports both programmatic use and integration into workflows, while maintaining consistency with the package’s existing design and documentation conventions.
Note
variability_mode.eof_classificationandsea_ice.calc_iiee_annual_cycleAPIs are available inpcmdi_metricsversionv4.1and later.mjo.compute_mjo_ewr_from_datasetAPI is available inpcmdi_metricsversionv4.1.1and later.variability_mode,qbo, andhadley_cellAPIs are available in versionv4.2or later.effective_resolutionAPIs are available in versionv4.2.2or later.
Atmospheric Circulation & Dynamics
Effective Resolution Diagnostics:
Compute effective-resolution metrics from an already-opened Dataset. |
|
|
Compute effective resolution from a single 2D scalar field. |
Compute effective-resolution metrics from input file paths. |
Spectral Analysis (Standalone):
Compute kinetic energy or power spectra without running the full effective resolution diagnostic. Useful for turbulence analysis, model evaluation, or custom spectral studies.
Rotational and divergent KE spectra for a single 2-D wind field. |
|
KE spectra for every time step at one pressure level, optionally averaged. |
|
Compute power spectrum of a 2D scalar field via spherical harmonics. |
Other Diagnostics:
|
Calculate Hadley cell meridional stream function and edge positions. |
|
Compute QBO-MJO metrics from already-opened xarray Datasets. |
Tropical Variability
|
Compute the MJO east-west power ratio from an open xarray Dataset. |
Extratropical Variability Modes
|
Compute North Atlantic Oscillation (NAO) diagnostics and metrics. |
|
Compute Northern Annular Mode (NAM) diagnostics and metrics. |
|
Compute Southern Annular Mode (SAM) diagnostics and metrics. |
|
Compute Pacific North American Pattern (PNA) diagnostics and metrics. |
|
Compute North Pacific Oscillation (NPO) diagnostics and metrics. |
|
Compute Pacific-South American Pattern 1 (PSA1) diagnostics and metrics. |
|
Compute Pacific-South American Pattern 2 (PSA2) diagnostics and metrics. |
|
Compute Pacific Decadal Oscillation (PDO) diagnostics and metrics. |
|
Compute North Pacific Gyre Oscillation (NPGO) diagnostics and metrics. |
|
Compute Atlantic Multidecadal Oscillation (AMO) diagnostics and metrics. |
Classify model EOFs as East Atlantic (EA) or Scandinavian (SCA) patterns. |
Cryosphere
|
Compute the monthly climatological annual cycle of Integrated Ice-Edge Error (IIEE) between observational and model sea ice concentration datasets. |
Custom calendars
Functions for computing seasonal averages and departures with custom calendar definitions.
|
Calculates the average of a user defined season in each year. |
|
Calculate the departure from a reference seasonal climatology for each season in a given year. |
|
Replace the 'YYYYMM-YYYYMM' pattern in a filename with a specified replacement. |
Data load
Load climate model and observational datasets using xCDAT.
|
Open input file (netCDF, or xml generated by cdscan) |
Date
Utilities for date string formatting, parsing, and finding overlapping time periods.
|
Convert a date object to a string in 'YYYY-MM-DD' format. |
|
Extract year, month, and day from a dataset's time dimension. |
|
Find the overlapping period between given dates and a dataset's time range. |
Land-sea mask
Create and apply land-sea masks to datasets for ocean-only or land-only analysis.
|
Generate a land-sea mask (1 for land, 0 for sea) for a given xarray Dataset or DataArray. |
|
Apply a land-sea mask to a given DataArray or Dataset. |
|
Apply an ocean mask to a given DataArray or Dataset. |
Graphics
Plotting functions for model evaluation and intercomparison. Example usages are available in the demo notebooks.
|
Create a parallel coordinate plot for visualizing multi-dimensional data. |
|
Create a portrait plot for visualizing 2D data arrays. |
|
Create a Taylor diagram. |
Grid and regrid
Functions for creating target grids and regridding datasets to different spatial resolutions.
|
Generate a uniform grid for given latitude/longitude ranges and resolution |
|
Regrid the dataset to a given grid. |
Region handling
Tools for defining, loading, and subsetting spatial regions from global datasets.
Load predefined geographic region specifications for climate data analysis. |
|
|
Subset a dataset or data array based on a specified region. |
|
Return data masked from a feature in the input file. |
Retrieve data from xarray Dataset
Helper functions for extracting coordinates, axes, and metadata from xarray Datasets.
|
Get grid information |
|
Retrieve coordinate key names from the dataset or data array. |
|
Retrieve data variable names from the dataset or data array. |
|
Extract latitude coordinate data. |
Extract latitude bounds data. |
|
Get the key for the latitude dimension. |
|
|
Extract longitude coordinate data. |
Extract longitude bounds data. |
|
Get the key for the longitude dimension. |
|
|
Extract time coordinate data. |
Extract time bounds data. |
|
Get the key for the time bounds. |
|
|
Get the key for the time dimension. |
|
Select a subset of the given xarray dataset based on specified latitude, longitude, and time ranges. |
Quality control (QC) and repair
Functions for checking and repairing time axes in climate datasets.
|
Check if the time axis in an xarray dataset follows a correct daily sequence, considering all CFTime calendars. |
|
Check if the time axis of a dataset follows a correct monthly sequence. |
|
Regenerate the time axis and bounds for an xarray Dataset. |
Miscellaneous tools
General utility functions for file system operations and template string formatting.
|
Sort a list of strings in natural order. |
|
Fill in a template string with keyword values. |
Create a nested defaultdict with infinite depth. |
Viewer
Generate interactive HTML output viewer for multi-model metric results. Available in pcmdi_metrics (> v3.9.1) or higher.
Writes out bokeh layout objects as HTML files and creates base gallery style HTML file with links to each summary metric page based on mip, exp, and metrics. |