登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 iui 于 2022-11-18 17:58 编辑
satpy是一个处理气象遥感数据的一个python库,用于读取和处理气象遥感数据并将其写入各种图像和数据文件格式,具体介绍详见官方网站,https://satpy.readthedocs.io/en/latest/overview.html。
satpy在2022.11.11号更新到最新版本(0.38.0),加入了读取GHI数据的功能,详见github,https://github.com/pytroll/satpy/blob/main/CHANGELOG.md。 风云四号B星上搭载的快速成像仪(GHI),数据时间分辨率最高达一分钟,空间分辨率最高达250m,可以下载从2022年6月1号-至今的数据(包括一级数据和一些大气产品),具体介绍详见官方网站,http://satellite.nsmc.org.cn/PortalSite/Data/Satellite.aspx。 下面分享一个使用satpy处理FY4B卫星GHI数据的小程序,结果如图所示。 如有错误,请指正,谢谢。
- import cartopy.crs as ccrs
- import matplotlib.pyplot as plt
- import scipy.io as sio
- import datetime
- from datetime import timedelta
- import matplotlib as mpl
- import os, glob
- from satpy.scene import Scene
- mpl.rc('font', family='Times new roman', size=16, weight='light')
- lonmin, latmin, lonmax, latmax = 115, 38, 118, 42
- extent = [lonmin, lonmax, latmin, latmax]
- chp = sio.loadmat('D:/data/prvbound.mat')#地图文件
- ir_channel = 'C01'
- path = r'D:\data\250M\202206'
- for index, filename in enumerate(os.listdir(path)):
- l1 = os.path.join(path, filename)
- filenames = glob.glob(l1)
- scn = Scene(reader="ghi_l1", filenames=filenames)
- scn.load([ir_channel])
- crop_scn = scn.crop(ll_bbox=(lonmin, latmin, lonmax, latmax))
- sat_w_tb_vis = crop_scn[ir_channel].values
- area_def = crop_scn[ir_channel].attrs['area']
- crs = area_def.to_cartopy_crs()
- proj = ccrs.PlateCarree()
- fig, ax = plt.subplots(figsize=[12, 9.6], subplot_kw={'projection': proj})
- ax.plot(chp['long'], chp['lat'], 'yellow', lw=0.3)
- ax.set_extent(extent, crs=proj)
- img = plt.imshow(sat_w_tb_vis, origin='upper', cmap=plt.cm.binary_r, extent=crs.bounds, transform=crs)
- gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, alpha=0)
- gl.xlabels_top = False # 关闭顶端的经纬度标签
- gl.ylabels_right = False # 关闭右侧的经纬度标签
- # 转换世界时-北京时
- utc_time = filename[44:58]
- t_utc = datetime.datetime.strptime(utc_time, '%Y%m%d%H%M%S')
- t_bj = t_utc + timedelta(hours=8)
- ax.set_title('Channel01 ' + str(t_bj))
- plt.savefig('D:/pic/satpy/c01-' + utc_time + '.png')
复制代码
|