xarray dataset select according to data variable code example
Example: how to select variables in a dataset using xarray
import xarray as xr
ds = xr.open_dataset(file_name.nc)
selection | syntax | returns
--------------------------------------------------------------
single variable | ds[var_name] | DataArray
--------------------------------------------------------------
single variable | ds[[var_name]] | Dataset
--------------------------------------------------------------
multiple variable | ds[[var_name1, var_name2...]] | Dataset