Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有比这更优雅的方法来获取xarray数据集某些维度的形状的元组?
tuple(dict(ds[['X', 'Y']].dims).values())
对于xarray.Dataset,您可以这样做:
xarray.Dataset
tuple(ds.dims[d] for d in ['X', 'Y'])
这样做的好处是不会对数据集进行子集化,也不会将维度作为坐标。