API reference#

This page provides an auto-generated summary of mesmers’ API.

Statistical functions#

Linear regression#


Ordinary least squares Linear Regression for xr.DataArray objects.

fit(predictors, target, dim[, weights, ...])

Fit a linear model

predict(predictors[, exclude])

Predict using the linear model.

residuals(predictors, target)

Calculate the residuals of the fitted linear model

to_netcdf(filename, **kwargs)

save params to a netCDF file

from_netcdf(filename, **kwargs)

read params from a netCDF file

Auto regression#

_select_ar_order_scen_ens(*objs, dim, ...[, ic])

Select the order of an autoregressive process and potentially calculate the median over ensemble members and scenarios

_fit_auto_regression_scen_ens(*objs, dim, ...)

fit an auto regression and potentially calculate the mean over ensemble members and scenarios

select_ar_order(data, dim, maxlag[, ic])

Select the order of an autoregressive process

fit_auto_regression(data, dim, lags)

fit an auto regression

draw_auto_regression_uncorrelated(ar_params, ...)

draw time series of an auto regression process

draw_auto_regression_correlated(ar_params, ...)

draw time series of an auto regression process with spatially-correlated innovations

Localized covariance#

adjust_covariance_ar1(covariance, ar_coefs)

adjust localized empirical covariance matrix for autoregressive process of order one

find_localized_empirical_covariance(data, ...)

determine localized empirical covariance by cross validation


lowess(data, dim, *[, combine_dim, n_steps, ...])

LOWESS (Locally Weighted Scatterplot Smoothing) for xarray objects

Gaspari-Cohn correlation matrix#

gaspari_cohn_correlation_matrices(geodist, ...)

Gaspari-Cohn correlation matrices for a range of localisation radii


smooth, exponentially decaying Gaspari-Cohn correlation function

Data handling#

Grid manipulation#

wrap_to_180(obj[, lon_name])

wrap array with longitude to [-180..180)

wrap_to_360(obj[, lon_name])

wrap array with longitude to [0..360)

stack_lat_lon(data, *[, x_dim, y_dim, ...])

Stack a regular lat-lon grid to a 1D (unstructured) grid

unstack_lat_lon_and_align(data, coords_orig, *)

unstack an 1D grid to a regular lat-lon grid and align with original coords

unstack_lat_lon(data, *[, x_dim, y_dim, ...])

unstack an 1D grid to a regular lat-lon grid but do not align

align_to_coords(data, coords_orig)

align an unstacked lat-lon grid with its original coords

Masking regions#

mask_ocean_fraction(data, threshold, *[, ...])

mask out ocean using fractional overlap

mask_ocean(data, *[, x_coords, y_coords])

mask out ocean

mask_antarctica(data, *[, y_coords])

mask out ocean

mask_3D_frac_approx(regions, lon, lat, **kwargs)

3D mask of the fractional overlap of a set of regions for the given lat/ lon grid

Weighted operations: calculate global mean#

global_mean(data[, weights, x_dim, y_dim])

calculate global weighted mean


area weights based on the cosine of the latitude

weighted_mean(data, weights[, dims])

weighted mean - convenience function which ignores data_vars missing dims


geodist_exact(lon, lat[, equal_dim_suffixes])

exact great circle distance based on WSG 84

Emulator functions#

Volcanic influence#

fit_volcanic_influence(tas_residuals, ...[, ...])

estimate volcanic influence on temperature residuals using aerosol optical depth observations as proxy

superimpose_volcanic_influence(...[, dim, ...])

superimpose volcanic influence on smooth temperature anomalies using aerosol optical depth observations as proxy