- 积分
- 2576
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-4-3
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
左侧是用下面代码画的,右图是micaps截图,对流位置偏北,咋解决呢(数据文件太大上传不了又咋办呢(累了
- from satpy import Scene
- from satpy import available_readers
- from glob import glob
- import matplotlib.pyplot as plt
- import cartopy.crs as ccrs
- import numpy as np
- import os, glob
- import datetime
- from datetime import timedelta
- import cartopy.io.shapereader as shpreader
- # file = 'F:\\FY4A\\FY4A-_AGRI--_N_DISK_1047E_L1-_FDI-_MULT_NOM_20200517070000_20200517071459_0500M_V0001.HDF'
- path = r'F:/file1/'
- for index, filename in enumerate(os.listdir(path)):
- l1 = os.path.join(path, filename)
- filenames = glob.glob(l1)
- scn = Scene(filenames = filenames, reader = 'agri_fy4a_l1')
- scn.available_dataset_names()
- channel='C12'
- scn.load([channel])
- xmin,xmax,ymin,ymax=100,140,30,50
- scn2=scn.crop(ll_bbox=(xmin,ymin,xmax,ymax))
- # scn2.show(channel)
- fig=plt.figure(figsize=(12, 10), dpi = 600)
- area_def = scn2[channel].attrs['area']
- crs = area_def.to_cartopy_crs()
- datacrs=ccrs.PlateCarree()
- ax=plt.axes(projection = datacrs)# 添加地理特征
- # ax.coastlines(color='red', linewidth = 0.6)
- coastlines = "shp\\ne_50m_coastline.shp" #预先准备好的50m海岸线地图
- adm2_shapes = list(shpreader.Reader(coastlines).geometries()) #读取地图文件信息
- ax.add_geometries(adm2_shapes, ccrs.PlateCarree(), edgecolor='red', linewidth = 0.6, facecolor='none')
- ax.gridlines(crs=ccrs.PlateCarree(),draw_labels = {"bottom":"x","left":"y"},linestyle='--',alpha=0.5)# 显示图像
- img=ax.imshow(scn2[channel],extent = [xmin,xmax,ymin,ymax],
- origin='upper',cmap='Greys_r',transform=datacrs)
- cb=fig.colorbar(img,ax=ax,shrink=0.5,location="right",pad=0.02)
- ax.set_extent([xmin,xmax,ymin,ymax], crs=datacrs)
- cb.ax.tick_params(labelsize=8)
- # cb.set_label(label='Reflectance (%)', fontsize = 8)# 添加标题
- 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('Channel12 ' + str(t_bj))
- # filename="F:\\FY4A_visC02_"+utc_time+".png"
- # plt.savefig(filename,dpi=600,bbox_inches='tight')
- # plt.close()
复制代码
|
|