geocat.comp.eofunc_ts

geocat.comp.eofunc_ts(data: Iterable, evec, **kwargs) → <MagicMock id='140459842819600'>

Calculates the time series of the amplitudes associated with each eigenvalue in an EOF. :param data: An Iterable convertible to numpy.ndarray in which the rightmost dimension is the number of

observations. Generally, this is the time dimension. If your rightmost dimension is not time, then pass time_dim as an extra options.

Parameters
  • evec – An Iterable convertible to numpy.ndarray containing the EOFs calculated using eofunc.

  • **kwargs

    extra options controlling the behavior of the function. Currently the following are supported: - jopt: a string that indicates whether to use the covariance matrix or the correlation

    matrix. The default is to use the covariance matrix.

    • ’’time_dim``: an integer defining the time dimension. it must be between 0 and data.ndim - 1 or it

      could be -1 indicating the last dimension. The default value is -1.

    • missing_value: defines the missing_value. The default is np.nan.

    • meta: If set to True and the input array is an Xarray, the metadata from the input array will be

      copied to the output array; default is False.

Returns: A two-dimensional array dimensioned by the number of eigenvalues selected in eofunc by the size of the

time dimension of data. Will contain the following attribute: - ts_mean: an array of the same size and type as evec containing the means removed from data as part

of the calculation.

Examples

  • Passing a xarray:

>>> # Openning a data set:
... ds = xr.open_dataset("dataset.nc")
>>> # Extracting SST (Sea Surface temperature)
... sst = ds.sst
>>> evec = eofunc(sst, 5)
>>> ts = eofunc(sst, evec)
  • Passing a numpy array:

>>> # Openning a data set:
... ds = xr.open_dataset("dataset.nc")
>>> # Extracting SST (Sea Surface temperature) as Numpy Array
... sst = ds.sst.data
>>> evec = eofunc(sst, 5)
>>> ts = eofunc(sst, evec.data)
  • Transferring the attributes from input to the output:

>>> # Openning a data set:
... ds = xr.open_dataset("dataset.nc")
>>> # Extracting SST (Sea Surface temperature)
... sst = ds.sst
>>> evec = eofunc(sst, 5)
>>> ts = eofunc(sst, evec, meta=True)
  • Defining the time dimension:

>>> # Openning a data set:
... ds = xr.open_dataset("dataset.nc")
>>> # Extracting SST (Sea Surface temperature)
... sst = ds.sst
>>> evec = eofunc(sst, 5, time_dim=0)
>>> ts = eofunc(sst, evec, time_dim=0)