API reference#
This page provides an auto-generated summary of mesmers’ API.
Top-level functions#
Statistical functions#
Linear regression#
Ordinary least squares Linear Regression for xr.DataArray objects. |
|
|
Fit a linear model |
|
Predict using the linear model. |
|
Calculate the residuals of the fitted linear model |
|
save params to a netCDF file |
|
read params from a netCDF file |
Auto regression#
|
Select the order of an autoregressive process - xarray wrapper |
|
fit an auto regression - xarray wrapper |
Draw time series of an auto regression process with possibly spatially-correlated innovations |
Localized covariance#
|
adjust localized empirical covariance matrix for autoregressive process of order one |
|
determine localized empirical covariance by cross validation |
Smoothing#
|
LOWESS (Locally Weighted Scatterplot Smoothing) for xarray objects |
Computation#
|
exact great circle distance based on WSG 84 |
|
smooth, exponentially decaying Gaspari-Cohn correlation function |
Data manipulation#
|
Stack a regular lat-lon grid to a 1D (unstructured) grid |
|
unstack an 1D grid to a regular lat-lon grid and align with orignal coords |
|
unstack an 1D grid to a regular lat-lon grid but do not align |
|
align an unstacked lat-lon grid with its orignal coords |
|
mask out ocean using fractional overlap |
|
mask out ocean |
|
mask out ocean |
|
|
|
Calculate the area-weighted global mean |
Legacy functions#
Train mesmer#
|
Derive global trend (emissions + volcanoes) parameters from specified ensemble type with specified method. |
|
Derive global variability parameters for a specified method. |
|
Derive local trends (i.e., forced response) parameters for given ESM for given set of targets and predictors. |
|
Derive local variability (i.e., natural variabiliy) parameters. |
Create emulations#
|
Create global trend (emissions + volcanoes) emulations for specified ensemble type and method. |
|
Create global variablity emulations for specified method. |
|
Create local trends (i.e., forced response) emulations for given parameter set and predictors. |
|
Create local variablity emulations. |
|
Merge global trend and global variability emulations of the same scenarios. |
|
Merge local trends and local variability temperature emulations of the same scenarios and targets. |
|
Make climate realisations based on pre-calculated MESMER parameters |
|
define seeds for drawing emulations |
Individual methods and utils#
Train mesmer#
|
Derive AR parameters of global variability under the assumption that gv does not depend on the scenario. |
|
Derive smooth global trend of variable from single ESM ic ensemble with LOWESS smoother. |
|
Derive global trend (emissions + volcanoes) parameters from single ESM ic ensemble by adding volcanic spikes to LOWESS trend. |
|
Derive parameters for AR(1) process with spatially-correlated innovations. |
|
Find suitable localization radius for empirical covariance matrix and derive localized empirical cov matrix. |
|
derive scenario weights such that each has equal weight, i.e., 1 / number of samples (= nr_runs * nr_ts) |
|
Create single array of predictors, and single array of targets |
Create emulations#
|
Draw global variablity emulations from an AR process. |
|
Create local trends with OLS with grid-point-specific predictors |
|
Create local variablity emulations with AR(1) process with spatially-correlated innovations. |
|
Create local variablity emulations with OLS. |
IO#
Load constant files#
|
Loads or creates (if not available yet) distance matrix and Gaspari-Cohn correlation matrix. |
|
Load constant files. |
Load output#
|
Load saved MESMER output (parameters or emulations). |
Load observations#
|
Load observations which you previously downloaded. |
|
Load spatially infilled tblend observations. |
|
Load observed global stratospheric aerosol optical depth time series. |
Save mesmer bundle#
|
Save all the information required to draw MESMER emulations to disk |
Utils#
|
Convert dictionary to array. |
|
Separate historical and future time periods into separate keys in dictionary. |
|
Extract all land grid points and area weights in regions and in land-sea mask for given threshold. |
|
Extract selected time period. |