FY4B卫星L2级产品掌握和python处理 FY4B二级产品处理出图

废话不多说,展示二级产品CTT为例:

抱歉没空了解FY4B产品情况了,直接看代码

# CTT色标配置
bounds_CTT = [180, 200, 220, 240, 260, 280, 300, 320] # 根据你的数据设定
colors_CTT = [
 (0, 0, 139/255),
 (10/255, 0, 245/255),
 (0, 164/255, 235/255),
 (0, 246/255, 192/255),
 (89/255, 255/255, 5/255),
 (255/255, 122/255, 0),
 (255/255, 68/255, 0),
 (155/255, 14/255, 0)
 ]
def get_fy4b_l2_png(filePaths, pngPath):
 try:
 file_type = filePaths.split(".")[-1]
 dataset = nc.Dataset(filePaths, 'r')
 time = dataset.date_created
 fyTime = datetime.strptime(time, '%Y-%m-%dT%H:%M:%SZ').strftime('%Y-%m-%d %H:%M:%S')
 timeStr = fyTime.replace(' ', '_').replace(':', '')
 file_name = os.path.basename(filePaths)
 type = file_name.split('-')[4].replace('_', '')
 if type == 'QPE':
 data = dataset.variables['Precipitation'][:]
 else:
 data = dataset.variables[type][:]
 # 经纬度32°N-42°N,104°E-125°E
 # 设置经纬度网格,并通过坐标转换转为CTT数据中的行列号来读取数据
 lat = np.arange(3, 55, 0.1)
 lon = np.arange(60, 137, 0.1)
 # 将经纬度转为格点,变为[lon lat]形式,转换为[l c],目标输出每个经纬度格点(行列号)的CTT数据,维度CTT(lat,lon)=(90,120)
 lon, lat = np.meshgrid(lon, lat)
 line, column = latlontolinecolumn(lat, lon, "4000M")
 l = line[:, :, np.newaxis]
 c = column[:, :, np.newaxis]
 lc = np.concatenate((l, c), axis=2) # (90*120*2)
 sichun = [[] for i in range(520)]
 i = 0
 for point_l in lc:
 # for point_c in point_l:
 # CTT_sichun[i].append(CTT[round(point_c[0])][round(point_c[1])])
 # i+=1
 for point_c in point_l:
 # 添加有效性检查,确保行列号在合理范围内
 if 0 
作者:七颗糖很甜原文地址:https://blog.csdn.net/weixin_45863084/article/details/140494798

%s 个评论

要回复文章请先登录注册