grid_process.ds_utils#
Module with general utility functions that operate on xarray.Dataset
Attributes#
Functions#
|
Transform a dataset containing model data and one or several data |
|
Cast back each data variable in the output dataset to the original dtype |
Module Contents#
- logger#
- ds_to_da(ds: xarray.Dataset) tuple[xarray.DataArray, dict[collections.abc.Hashable, dict[collections.abc.Hashable, Any]]][source]#
Transform a dataset containing model data and one or several data variables to a dataarray with the variables stacked as a new dimension. The function also returns the attributes of the data variables for further use.
- Parameters:
ds (xarray.Dataset) – contain one or more variables
- Returns:
da (xarray.DataArray) – contains the data variables from the input dataset stacked in a new variable dimension
vars_attrs (dictionary) – contains the attributes of each data variables in the input dataset.
See also