【发布时间】:2021-05-05 19:09:34
【问题描述】:
我想绘制一个字典条目,其中包含 xy 坐标 (lat-lon) 上的 lat,on 坐标。变量如下所示:
<class 'method'>
<bound method Mapping.values of <xarray.Dataset>
Dimensions: (lat: 96, lon: 144)
Coordinates:
lev_p int32 200
Dimensions without coordinates: lat, on
Data variables:
V (lat, lon) float32 dask.array<chunksize=(96, 144), meta=np.ndarray>>
我想绘制 V,作为纬度和经度的轮廓,但是当我尝试绘制它时,出现以下错误:
TypeError: cannot directly convert an xarray.Dataset into a numpy array. Instead, create an xarray.DataArray first, either with indexing on the Dataset or by invoking the to_array() method.
我尝试使用 .to_array 以及使用 map(float,variable) 将字典值转换为数组,但没有成功。 我不知道发生了什么。对此有何建议或帮助? 谢谢
【问题讨论】:
标签: python dataset netcdf python-xarray