简体   繁体   English

绘制 NetCDF 文件时出现 Cartopy 问题

[英]Cartopy problem when plotting NetCDF file

I'm trying to display some data with cartopy.我正在尝试使用 cartopy 显示一些数据。 I read the NetCDF file with xarray and tried to plot it with the non-rotated coordinates available:我用 xarray 读取了 NetCDF 文件,并尝试使用可用的非旋转坐标来 plot 它:

import xarray as xr
import matplotlib.pyplot as plt
import cartopy.crs as ccrs

dset = xr.open_dataset("tas_EUR-11_IPSL-IPSL-CM5A-MR_rcp85_r1i1p1_GERICS-REMO2015_v1_mon_201101-202012.nc")
tas = dset['tas']

fig = plt.figure(figsize=[12,5])

ax = fig.add_subplot(111, projection=ccrs.PlateCarree())

dset.isel(time=0)['tas'].plot(ax=ax, transform=ccrs.PlateCarree(), x='lon', y='lat', 
add_colorbar=False)

ax.coastlines()
ax.set_global()
plt.show()

The problem is I obtain the following plot:问题是我得到以下 plot:

picture图片

Any idea why?知道为什么吗?

It would be nice if the sample data could be uploaded (if the data is too large, you can output only one time/one level).如果能上传样本数据就好了(如果数据太大,可以output一次/一级)。 I wonder if the grid of your data is non-rectangular, and the xarray's plot method may not support the non-rectangular grids very well.我想知道你的数据的网格是不是非矩形的,xarray 的 plot 方法可能不能很好地支持非矩形网格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM