- 积分
- 9318
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-7-28
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
numpy读取数据
proplot绘图
- """
- Created on Wed Nov 10 19:05:06 2021
- @author: Fu Ya-Nan
- """
- import numpy as np
- import proplot as pplt
- import cartopy.crs as ccrs
- import cartopy.feature as cfeat
- from cartopy.io.shapereader import Reader
- ntime = 2
- nlon = 4948
- nlat = 1649
- fnm = r'F:/cmorph/CMORPH_V1.0_ADJ_8km-30min_2019063023'
- with open(fnm, 'rb') as f:
- prerate = np.fromfile(f, dtype=np.float32)
- prerate = np.reshape(prerate, (ntime, nlat, nlon))
- preci = prerate[0, :, :]*0.5
- preci[preci<0.0] = 0.0
- lonstart = 0.036378335
- londiff = 0.072756669
- latstart = -59.963614
- latdiff = 0.072771377
- lon = np.arange(nlon)*londiff+lonstart
- lat = np.arange(nlat)*latdiff+latstart
- fig = pplt.figure(refwidth = 5.0)
- ax = fig.subplots(proj = 'cyl')
- cf = ax.contourf(lon[1305:1718], lat[962:1237], preci[962:1237, 1305:1718])
- ax.colorbar(cf)
- ax.format(lonlim = (95, 125), latlim = (10, 30), lonlines = 5, latlines = 5, lonlabels = 'b', latlabels = 'l')
- provinces = cfeat.ShapelyFeature( Reader(r'F:/ngcc/bou2_4m/bou2_4l.shp').geometries(), ccrs.PlateCarree(), edgecolor='black', facecolor='none', )
- river = cfeat.ShapelyFeature( Reader(r'F:/Chinamap-master/cnmap/rivers.shp').geometries(), ccrs.PlateCarree(), edgecolor='lightblue', facecolor='none', )
- ax.add_feature(provinces, linewidth=0.5, zorder=2)
- ax.add_feature(river, linewidth=1.0, zorder=2)
- fig.format(lefttitle = 'CMORPH_20190630_23:00-23:30')
复制代码
|
|