How to subset data using multidimensional coordinates using python xarray?

夙愿已清 提交于 2019-12-06 11:56:35

This is a perfect use-case for where with drop=True. Something like the following should work:

ds.where((-125 < ds.XLON) & (ds.XLON < -115)
         & (49 < ds.XLAT) & (ds.XLAT < 55), drop=True)

where should work regardless, but one other concern with your dataset is that your spatial coordinates (XLON and XLAT) include "Time" as a dimension. Do these variables really vary over time? If not, you may want to adjust them to remove the time dimension.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!