mpas_analysis.shared.mpas_xarray.mpas_xarray.subset_variables¶
-
mpas_analysis.shared.mpas_xarray.mpas_xarray.
subset_variables
(ds, variableList)[source]¶ Given a data set and a list of variable names, returns a new data set that contains only variables with those names.
- Parameters
ds (
xarray.DataSet
object) – The data set from which a subset of variables is to be extracted.variableList (string or list of strings) – The names of the variables to be extracted.
- Returns
ds (
xarray.DataSet
object) – A copy of the original data set with only the variables in variableList.- Raises
ValueError – If the resulting data set is empty.