API Reference
APIs
Below is a list of Application Programming Interfaces (APIs) available in pcmdi_metrics (> v3.6.1).
Custom calendars
|
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
|
Open input file (netCDF, or xml generated by cdscan) |
Date
|
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
|
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
Example usages of the following plotting functions 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
|
Generate a uniform grid for given latitude/longitude ranges and resolution |
|
Regrid the dataset to a given grid. |
Region handling
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
|
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
|
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
|
Sort a list of strings in natural order. |
|
Fill in a template string with keyword values. |
Create a nested defaultdict with infinite depth. |