clear_data_vars_from_dataset

HSTB.kluster.xarray_helpers.clear_data_vars_from_dataset(dataset, datavars)

Some code to handle dropping data variables from xarray Datasets in different containers. We use lists of Datasets, dicts of Datasets and individual Datasets in different places. Here we can just pass in whatever, drop the variable or list of variables, and get the Dataset back.

Parameters
  • dataset (Union[list, dict, Dataset]) – xarray Dataset, list, or dict of xarray Datasets

  • datavars (Union[list, str]) – str or list, variables we wish to drop from the xarray Dataset

Returns

original Dataset(s) with dropped variables

Return type

Union[list, dict, xr.Dataset]