- 积分
- 442
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2022-12-3
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 WOT 于 2023-4-17 11:16 编辑
我用的是ERA数据,数据时间为1961-2020年7~8月u、v、z数据,高度为1000-500hpa,想画1961-1965年7月的500hpa位势高度场和风场的图像.这个程序没报错,但是没有我要的数据填色图和线条,请各位老师帮我看看哪里需要改动
#风场图像
import os
import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from cartopy.io.shapereader import Reader
import warnings; warnings.filterwarnings('ignore')
##data_read
df1 = nc.Dataset(r'E:/GrADS/dataERA/Uwnd.nc')
df2 = nc.Dataset(r'E:/GrADS/dataERA/Vwnd.nc')
df3 = nc.Dataset(r'E:/GrADS/dataERA/Geopotential.nc')
## coordinate_info
lat = df2['latitude'][0:5:2]
lon = df2['longitude'][:]
lev = df2['level'][0]
times = df2['time'][0:5:2]
lon2d, lat2d = np.meshgrid(lon, lat)
#1961.7~1963.7 500hpa
u7 = df1['u'][0:5:2,0,:,:]
v7 = df2['v'][0:5:2,0,:,:]
h7 = df3['z'][0:5:2,0,:,:]
U7 = np.mean(u7,axis=1)
V7 = np.mean(v7,axis=1)
H7 = np.mean(h7,axis=1)
###plot
fig = plt.figure(figsize=(12,8))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent([20, 150, 0, 70], crs=ccrs.PlateCarree())
ax.coastlines()
SHP = r'E:\python\shp'
projection = ccrs.PlateCarree()
# China boundary
ax.add_geometries(Reader(os.path.join(SHP, 'PRO.shp')).geometries(),
ccrs.PlateCarree(),facecolor='none',edgecolor='r', linewidth=1.5)
ax.coastlines(resolution='50m', linewidth=0.3, color='black')
ax.gridlines(draw_labels=True, linewidth=0.5, color='gray',
xlocs=range(20,150,10), ylocs=range(0,70,10))
cnplot = ax.contourf(lon2d,
lat2d,
H7,
#levels=np.array(5000,5880,80),
extend='max',
cmap='Oranges',
transform=ccrs.PlateCarree()
)
cvf = ax.streamplot(lon2d,
lat2d,
U7,V7,
density=[1,5],
transform=ccrs.PlateCarree()
)
ax.set_title('1961', fontsize=15, fontweight='bold')
#plt.savefig('E:/Water vapor flux differnce at 500hPa between 1992-2020 and 1961-1985 (Jul-Aug).pdf', bbox_inches='tight', dpi=200)
plt.show()
|
-
|