add_svd_to_dataset

glotaran.io.prepare_dataset.add_svd_to_dataset(dataset: xr.Dataset, name: str = 'data', lsv_dim: Hashable = 'time', rsv_dim: Hashable = 'spectral', data_array: xr.DataArray | None = None) None[source]

Add the SVD of a dataset inplace as Data variables to the dataset.

The SVD is only computed if it doesn’t already exist on the dataset.

Parameters:
  • dataset (xr.Dataset) – Dataset the SVD values should be added to.

  • name (str) – Key to access the datarray inside of the dataset, by default “data”

  • lsv_dim (Hashable) – Name of the dimension for the left singular value, by default “time”

  • rsv_dim (Hashable) – Name of the dimension for the right singular value, by default “spectral”

  • data_array (xr.DataArray | None) – Dataarray to calculate the SVD for, when provided the data extraction from the dataset will be skipped, by default None