Is there a more elegant way than this to get a tuple of the shape of some dimensions of an xarray dataset?
tuple(dict(ds[['X', 'Y']].dims).values())
For an xarray.Dataset
, you can do this:
tuple(ds.dims[d] for d in ['X', 'Y'])
This has the advantage of not subsetting the dataset or relying on the dimensions to be coordinates as well.