API reference#
This page provides an auto-generated summary of mesmers’ API.
Top-level functions#
|
Set options for mesmer in a controlled context. |
Get options for mesmer. |
Statistical functions#
Linear regression#
Ordinary least squares Linear Regression for xr.DataArray objects. |
|
|
initialize LinearRegression class using parameters |
|
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 and potentially calculate the median over ensemble members and scenarios |
|
fit an auto regression and potentially calculate the mean over ensemble members and scenarios |
|
Select the order of an autoregressive process |
|
fit an auto regression |
|
fit a cyclo-stationary auto-regressive process of lag one (AR(1)) on monthly data. |
|
draw time series of an auto regression process |
|
draw time series of an auto regression process with spatially-correlated innovations |
|
draw time series of a cyclo-stationary auto-regressive process of lag one (AR(1)) using individual parameters for each month including spatially-correlated innovations. |
Harmonic Model#
|
fit harmonic model i.e. a Fourier Series to every gridcell using BIC score to select the order and least squares to fit the coefficients for each order. |
|
construct a Fourier Series from yearly predictors with fitted coeffs. |
Power Transformer#
|
|
|
function defining the covariate function to calculate lambda depending on the local yearly values. |
|
function that relates fitted coefficients and the yearly predictor to the lambdas. |
|
estimate the optimal coefficients for the parameters \(\lambda\) for each gridcell, to normalize monthly residuals conditional on yearly predictor. |
|
transform monthly_residuals following Yeo-Johnson transformer with parameters \(\lambda\), fit with |
|
apply the inverse power transformation using the fitted lambdas. |
|
Use a constant for lambda. |
|
Use logistic function to calculate lambda depending on the local yearly values. |
Localized covariance#
|
adjust localized empirical covariance matrix for autoregressive process of order one |
|
determine localized empirical covariance by cross validation |
determine localized empirical covariance by cross validation for each month. |
Smoothing#
|
LOWESS (Locally Weighted Scatterplot Smoothing) for xarray objects |
Gaspari-Cohn correlation matrix#
|
Gaspari-Cohn correlation matrices for a range of localisation radii |
|
smooth, exponentially decaying Gaspari-Cohn correlation function |
Conditional distribution#
Define covariance structure of conditional distribution#
|
|
|
Evaluates the parameters for the provided predictors and coefficients |
Fit conditional distribution#
|
|
|
Find a first guess for all coefficients of a conditional distribution |
|
fit conditional distribution over all gridpoints. |
|
Compute scores for fit coefficients. |
The coefficients of this conditional distribution. |
|
|
read coefficients from a netCDF file with default solver options |
|
save coefficients dataset to a netCDF file |
|
Transform conditional distribution#
|
|
|
Probability integral transform data given coefficients for the expression of a conditional distribution. |
Data handling#
Example and test data#
|
path of the cmip6_ng example data |
Grid manipulation#
|
wrap array with longitude to [-180..180) |
|
wrap array with longitude to [0..360) |
|
Stack a regular lat-lon grid to a 1D (unstructured) grid |
|
unstack an 1D grid to a regular lat-lon grid and align with original coords |
|
unstack an 1D grid to a regular lat-lon grid but do not align |
|
align an unstacked lat-lon grid with its original coords |
Masking regions#
|
mask out ocean using fractional overlap |
|
mask out ocean |
|
mask out ocean |
Weighted operations: calculate global mean#
|
calculate global weighted mean |
|
area weights based on the cosine of the latitude |
|
weighted mean - convenience function which ignores data_vars missing dims |
|
Create a DataTree isomorphic to |
|
generate inverse data-density weights |
DataTree heplers#
|
prepare data for statistical functions |
|
prepare predictors, target, and weights for statistical functions |
|
Merge the datasets of each node of isomorphic DataTree objects together. |
|
Take a |
|
Applies a function to every dataset in one or more DataTree objects with the same structure (ie.., that are isomorphic), returning new trees which store the results. |
Geospatial#
|
exact great circle distance based on WSG 84 |
Anomalies#
|
subtract mean over the reference period |
Resampling#
|
Upsample yearly data to monthly resolution by repeating yearly values. |
Emulator functions#
Volcanic influence#
|
estimate volcanic influence on temperature residuals using aerosol optical depth observations as proxy |
|
superimpose volcanic influence on smooth temperature anomalies using aerosol optical depth observations as proxy |
load stratospheric aerosol optical depth data - a proxy for volcanic activity |