- 积分
- 137
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-3-2
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cmaps
import numpy as np
import cartopy.feature as cfeature
import cartopy.io.shapereader as shpreader
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
import cartopy.feature as cfeature
import metpy.calc
rh_2m_cal = metpy.calc.relative_humidity_from_dewpoint(skt,d2m)
rh_2m_cal[rh_2m_cal>1]=1
rh_2m_cal = rh_2m_cal*100
lon_2d, lat_2d = np.meshgrid(lon_1d, lat_1d)
fig = plt.figure(figsize=(15, 12))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent([30, 140,0,60])
contours = ax.contourf(lon_2d, lat_2d,skt.to('degC'), levels=range(-50,50),
transform=ccrs.PlateCarree(),cmap=cmaps.NCV_bright)
ax.stock_img()
province = shpreader.Reader('Province_9.shp')
ax.add_geometries(province.geometries(), crs=ccrs.PlateCarree(), linewidths=0.5,edgecolor='k',facecolor='none')
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.BORDERS,edgecolor='gray')
ax.add_feature(cfeature.LAKES, alpha=0.5)
gl = ax.gridlines(draw_labels=True, linewidth=1, color='k', alpha=0.5)
gl.xlabels_top = False #关闭顶端标签
gl.ylabels_right = False #关闭右侧标签
gl.xformatter = LONGITUDE_FORMATTER #x轴设为经度格式
gl.yformatter = LATITUDE_FORMATTER #y轴设为纬度格式
cbar = fig.colorbar(contours,shrink=0.8)
cbar.set_label('Temperature(℃)',fontsize=15)
cbar.set_ticks(np.arange(-40,46,5))
ax.set_title('Average surface temperature valid at 2020-01(UTC)',fontsize=15)
plt.show()
读取shp文件是出现如下错误:ValueError: Incomplete shapefile definition in 'Province_9.shp'.
求助
|
|