Eof
Docstrings for the Eof class
3 minute read
Objects
compute_eofs()
compute_hilbert_eofs()
_compute()
This is file deals with empirical orthogonal functions.
compute_eofs()
def compute_eofs(variable, full_matrices=False, time_dim_name=t_dim):
Compute some numbers is a helper method.
Computes the Empirical Orthogonal Functions (EOFs) of a variable (time series)
that has 3 dimensions where one is time, i.e. (x,y,time)
Returns the set of EOF modes, the associated temporal projections and the
variance explained by each mode as DataArrays within an xarray Dataset.
All-NaN time series, such as those at land points, are handled and ignored;
however, isolated NaNs within a time series, i.e. missing data point, must
be filled before calling the function.
The variable will be de-meaned in time before the EOFs are computed, normalisation
should be carried out before calling the function if desired. The returned EOFs and
temporal projections are not scaled or normalised.
Parameters
----------
variable : (xarray.DataArray), 3-dimensional variable of size (I,J,T),
containing I*J time series
full_matrices : (boolean, default False) if false computes only first K EOFs
where K=min(I*J,T), where T is total number of time points. Setting to True
could demand significant memory.
time_dim_name : (string, default 't_dim') the name of the time dimension.
Returns
-------
dataset : xarray Dataset, containing the EOFs, temporal projections and
variance explained as xarray DataArrays. The relevent coordinates
from the original data variable are also included
compute_hilbert_eofs()
def compute_hilbert_eofs(variable, full_matrices=False, time_dim_name=t_dim):
Compute with hilbert is a helper method.
Computes the complex Hilbert Empirical Orthogonal Functions (HEOFs) of a
variable (time series) that has 3 dimensions where one is time, i.e. (x,y,time).
See https://doi.org/10.1002/joc.1499
Returns the set of HEOF amplitude and phase modes, the associated temporal
projection amplitudes and phases and the variance explained by each mode
as DataArrays within an xarray Dataset.
All-NaN time series, such as those at land points, are handled and ignored;
however, isolated NaNs within a time series, i.e. missing data point, must
be filled before calling the function.
The variable will be de-meaned in time before the EOFs are computed, normalisation
should be carried out before calling the function if desired. The returned EOFs and
temporal projections are not scaled or normalised.
Parameters
----------
variable : (xarray.DataArray), 3-dimensional variable of size (I,J,T),
containing I*J time series
full_matrices : (boolean, default False) if false computes only first K EOFs
where K=min(I*J,T), where T is total number of time points.
time_dim_name : (string, default 't_dim') the name of the time dimension.
Returns
-------
dataset : xarray Dataset, containing the EOF amplitudes and phases,
temporal projection amplitude and phases and the variance explained
as xarray DataArrays. The relevent coordinates
from the original data variable are also in the dataset.
_compute()
def _compute(signal, full_matrices, active_ind, number_points):
Private compute method is a helper method.
Compute eofs, projections and variance explained using a Singular Value Decomposition
Parameters
----------
signal : (array) the signal
full_matrices : (boolean) whether to return a full or abbreviated SVD
active_ind : (array) indices of points with non-null signal
number_points : (int) number of points in original data set
Returns
-------
EOFs : (array) the EOFs in 2d form
projections : (array) the projection of the EOFs
variance_explained : (array) variance explained by each mode
mode_count : (int) number of modes computed
Feedback
Was this page helpful?
Glad to hear it!
Sorry to hear that. Please tell us how we can improve.
Last modified November 23, 2022: Updated docstrings from coast repo. (9daee18)