pyPDAF.PDAF.eofcovar

pyPDAF.PDAF.eofcovar()

EOF analysis of an ensemble of state vectors by singular value decomposition.

Typically, this function is used with pyPDAF.PDAF.sampleens() to generate an ensemble of a chosen size (up to the number of EOFs plus one).

Here, the function performs a singular value decomposition of the ensemble anomaly of the input matrix, which is usually an ensemble formed by state vectors at multiple time steps. The singular values and corresponding singular vectors can be used to construct an error covariance matrix. This can be used as the initial error covariance for the initial ensemble.

A multivariate scaling can be performed to ensure that all fields in the state vectors have unit variance.

It can be useful to store more EOFs than one finally might want to use to have the flexibility to cary the ensemble size.

See also PDAF webpage

Parameters:
  • dim_fields (ndarray[tuple[nfields], np.intc]) –

    Size of each model field. This argument is effective only when do_mv = 1. Each model field, e.g., sea surface temperature, or 3D sea salinity, can be 2D or 3D with different number of grid points. Each element of the array specifies the size of each model field.

    The array dimension nfields is the number of model fields in state vector. For example, if the state vector contains temperature and humidity, nfields=2. This variable is effective only when do_mv = 1.

  • offsets (ndarray[tuple[nfields], np.intc]) –

    Starting position of each field. This variable is effective only when do_mv = 1. For example, if the state vector contains temperature and humidity, this array specifies the first index of the physical field in the state vector. Following Fortran notation, the offset values start from 1.

    The array dimension nfields is the number of model fields in state vector. For example, if the state vector contains temperature and humidity, nfields=2. This variable is effective only when do_mv = 1.

  • remove_mstate (int) –

    Switch for only computing EOF of the ensemble anomaly.

    This option can be used if states are not centred on 0, i.e., anomaly values.
    1. do nothing

    2. remove the mean of states over nstates dimension before EOF computation

  • do_mv (int) –

    Switch for multivariate scaling
    1. do nothing

    2. Each model field are scaled by its standard deviation such that each model field has unit standard deviation. This option makes use of nfields, dim_fields and offsets arguments.

  • states (ndarray[tuple[dim_state, nstates], np.float64]) –

    An ensemble of state vectors. This argument should ideally be the anomalies of an ensemble, and each member is from a different model time. However, one can set remove_mstate = 1 if this is not an ensemble anomaly.

    The 1st-th dimension dim_state is the dimension of state vector. The 2nd-th dimension nstates is the number of state vectors, typically number of different time steps, or number of ensemble members.

  • meanstate (ndarray[tuple[dim_state], np.float64]) –

    Mean state The returned value equlas to the input unless remove_mstate=1

    The array dimension dim_state is the dimension of state vector.

  • verbose (int) – Verbosity flag

Returns:

  • states (ndarray[tuple[dim_state, nstates], np.float64]) – An ensemble of state vectors. This argument should ideally be the anomalies of an ensemble, and each member is from a different model time. However, one can set remove_mstate = 1 if this is not an ensemble anomaly.

    The 1st-th dimension dim_state is the dimension of state vector. The 2nd-th dimension nstates is the number of state vectors, typically number of different time steps, or number of ensemble members.

  • stddev (ndarray[tuple[nfields], np.float64]) – Standard deviation of each model field in states. If do_mv = 1, stddev should be 1.0.

    The array dimension nfields is the number of model fields in state vector. For example, if the state vector contains temperature and humidity, nfields=2. This variable is effective only when do_mv = 1.

  • svals (ndarray[tuple[nstates], np.float64]) – Singular values of states scaled by \(\frac{1}{\sqrt{nstates-1}}\).

    The array dimension nstates is the number of state vectors, typically number of different time steps, or number of ensemble members.

  • svec (ndarray[tuple[dim_state, nstates], np.float64]) – Singular vectors of states

    The 1st-th dimension dim_state is the dimension of state vector. The 2nd-th dimension nstates is the number of state vectors, typically number of different time steps, or number of ensemble members.

  • meanstate (ndarray[tuple[dim_state], np.float64]) – Mean state The returned value equlas to the input unless remove_mstate=1

    The array dimension dim_state is the dimension of state vector.

  • status (int) – Status flag