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
dsxarray.DataSet object

The data set from which a subset of variables is to be extracted.

variableListstring or list of strings

The names of the variables to be extracted.

Returns
dsxarray.DataSet object

A copy of the original data set with only the variables in variableList.

Raises
ValueError

If the resulting data set is empty.