I have a fairly large xr.Dataset with about 20 Data variables. I am only interested in keeping two of them. I see xr.Dataset.drop with drop variables for a Dataset.
I'm looking for syntax to keep variables. I tried f['hs','t01'] and got
Traceback (most recent call last): File "/nethome/rxb826/local/bin/miniconda3/lib/python3.6/site-packages/xarray/core/dataset.py", line 662, in _construct_dataarray variable = self._variables[name] KeyError: ('hs', 't01')
If there isn't simply syntax I could have a look at developing xr.Dataset.keep
I can also clunky manually create the Dataset as
ds = xr.Dataset({'hs': f['hs'], 't01': f['t01']})