我试图使用xarray和matplotlib从netcdf文件中绘制季节平均值。我得到的是纬度和经度轴的图,但没有国家边界线。如何获取地块上的国家边界线
import xarray as xr
import matplotlib as mpl
import matplotlib.pyplot as plt
fname='/home/atmosphere/data/outputs/2010.nc' #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ds=xr.open_mfdataset(fname)
varlist=list(ds.variables)
imr=ds.sel(lat=slice(0,35),lon=slice(60,100)) #subsetting overthe region
imrbt=imr['temp'] #making into a data array
ds['time.season']
seasonal=imrbt.groupby('time.season').mean(dim='time')
seasonal.plot.imshow(col='season',robust=True)
正如@Bart提到的,您必须使用
cartopy
来解决这个问题:要以更高分辨率添加国家边界,您必须使用cartopy功能:
相关问题 更多 >
编程相关推荐