API Reference

This page provides an auto-generated summary of esmtools’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.


from esmtools.carbon import ...

Functions related to analyzing ocean (and perhaps terrestrial) biogeochemistry.

co2_sol(t, s) Compute CO2 solubility per the equation used in CESM.
schmidt(t) Computes the dimensionless Schmidt number.
temp_decomp_takahashi(ds[, time_dim, …]) Decompose surface pCO2 into thermal and non-thermal components.
potential_pco2(t_insitu, pco2_insitu) Calculate potential pCO2 in the interior ocean.
spco2_sensitivity(ds) Compute sensitivity of surface pCO2 to changes in driver variables.
spco2_decomposition_index(ds_terms, index[, …]) Decompose oceanic surface pco2 in a first order Taylor-expansion.
spco2_decomposition(ds_terms[, detrend, …]) Decompose oceanic surface pco2 in a first order Taylor-expansion.
calculate_compatible_emissions(…) Calculate compatible emissions.
get_iam_emissions() Download IAM emissions from PIK website.
plot_compatible_emissions(…[, …]) Plot combatible emissions.

Composite Analysis

from esmtools.composite import ...

Functions pertaining to composite analysis. Composite analysis takes the mean view of some field (e.g., sea surface temperature) when some climate index (e.g., El Nino Southern Oscillation) is in its negative or positive mode.

composite_analysis(field, index[, …]) Create composite maps based on some variable’s response to a climate index.

Grid Tools

from esmtools.grid import ...

Functions related to climate model grids.

convert_lon(ds[, coord]) Converts longitude grid from -180to180 to 0to360 and vice versa.


from esmtools.physics import ...

Functions related to physics/dynamics.

stress_to_speed(x, y) This converts ocean wind stress to wind speed at 10m over the ocean so that one can use the native ocean grid rather than trying to interpolate between ocean and atmosphere grids.


from esmtools.spatial import ...

Functions related to spatial analysis.

find_indices(xgrid, ygrid, xpoint, ypoint) Returns the i, j index for a latitude/longitude point on a grid.
extract_region(ds, xgrid, ygrid, coords[, …]) Extract a subset of some larger spatial data.


from esmtools.stats import ...

Statistical functions. A portion directly wrap functions from climpred.

standardize(ds[, dim]) Standardize Dataset/DataArray
nanmean(ds[, dim]) Compute mean NaNs and suppress warning from numpy
cos_weight(da[, lat_coord, lon_coord, …]) Area-weights data on a regular (e.g.
area_weight(da[, area_coord]) Returns an area-weighted time series from the input xarray dataarray.
smooth_series(da, dim, length[, center]) Returns a smoothed version of the input timeseries.
fit_poly(ds, order[, dim]) Returns the fitted polynomial line of order N
linear_regression(da[, dim, interpolate_na, …]) Computes the least-squares linear regression of an xr.DataArray x against another xr.DataArray y.
corr(x, y[, dim, lead, return_p]) Computes the Pearson product-momment coefficient of linear correlation.
rm_poly(da, order[, dim]) Returns xarray object with nth-order fit removed from every time series.
rm_trend(da[, dim]) Calls rm_poly with an order 1 argument.
autocorr(ds[, lag, dim, return_p]) Calculated lagged correlation of a xr.Dataset.
ACF(ds[, dim, nlags]) Compute the ACF of a time series to a specific lag.
ttest_ind_from_stats(mean1, std1, nobs1, …) Parallelize scipy.stats.ttest_ind_from_stats.


from esmtools.temporal import ...

Functions related to time.

to_annual(ds[, calendar, how, dim]) Resample sub-annual temporal resolution to annual resolution with weighting.