| 
 
	积分267贡献 精华在线时间 小时注册时间2011-8-27最后登录1970-1-1 
 | 
 
| 
本帖最后由 pixi 于 2017-10-20 12:13 编辑
x
登录后查看更多精彩内容~您需要 登录 才可以下载或查看,没有帐号?立即注册 
  
 参照Awx的格式说明,自己写了段代码处理云量产品
 
 但是出来的图错位了,左边的一块被移到了右边,没想明白,求助。复制代码from struct import *
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
from math import *   
file=r'E:\work\metplot\data\sat\cta\CTA_MLT_OTG_20170917_1030_FY2E.AWX'
f=open(file,'rb')
#一级头信息共40 byte
name,=unpack('12s',f.read(12))
name=name.decode()
byte_seq,first_head_len,second_head_len,fulfill_len,rec_len,head_record_num,product_data_record_num,product_type,compression,format_instruct,quality=unpack('9h8sh',f.read(28))
format_instruct=format_instruct.decode()
#二级头信息共80 byte
sat_name,=unpack('8s',f.read(8))
para,para_byte,base_value,scalor,valid_time=unpack('5h',f.read(10))
begin_year,begin_mon,begin_day,begin_hour,begin_min,end_year,end_mon,end_day,end_hour,end_min=unpack('10h',f.read(20))
upper_left_lat,upper_left_lon,lower_right_lat,lower_right_lon,grid_unit,x_int,y_int,x_grids,y_grids=unpack('9h',f.read(18))
f.read(24)
grid_num=x_grids*y_grids
format=str(grid_num)+'b'
data_field=unpack(format,f.read(grid_num))
data=np.array(data_field).reshape(x_grids,y_grids)
img=Image.fromarray(data)
img.show()
另外读到的文件名后面带\x00,怎样把\x00去掉?(b'FY2E\x00\x00\x00\x00')
 
 
 | 
 
自己画的图   
meteoinfo出的图   |