解析
from datetime import * import time import calendar import json import numpy as np from struct import * import binascii import netCDF4 file = open(r"D:/radarDataTest/Z_QPF_20140831203600.F030.bin", "rb") data = file.read(); print(len(data)) file.close() # file = open(r"D:/radarDataTest/Z_QPF_20140831203600.F030.bin", "rb") length = 0 zonName,dataName,flag,version, = unpack("12s38s8s8s", file.read(12+38+8+8)) zonName = zonName.decode("gbk").rstrip('\x00') dataName = dataName.decode("gbk").rstrip('\x00') flag = flag.decode("gbk").rstrip('\x00') version = version.decode("gbk").rstrip('\x00') length = length + 12+38+8+8 # print(zonName) print("数据说明: " + dataName) print("文件标志: " + flag) print("数据版本号: " + version) # year,month,day,hour,minute,interval, = unpack("HHHHHH", file.read(2+2+2+2+2+2)) print("时间: "+str(year)+"-"+str(month)+"-"+str(day)+" "+str(hour)+":"+str(minute)) print("时段长: "+str(interval)) length = length + 2+2+2+2+2+2 # XNumGrids,YNumGrids,ZNumGrids, = unpack("HHH", file.read(2+2+2)) print("X: " + str(XNumGrids)+" Y: "+str(YNumGrids)+" Z:"+str(ZNumGrids)) length = length + 2+2+2 # RadarCount, = unpack("i", file.read(4)) print("拼图雷达数: " + str(RadarCount)) length = length + 4 # StartLon,StartLat,CenterLon,CenterLat,XReso,YReso, = unpack("ffffff", file.read(4+4+4+4+4+4)) print("开始经度: "+str(StartLon)+" 开始纬度:"+str(StartLat)+" 中心经度:"+str(CenterLon)+" 中心纬度:"+str(CenterLat)) print("经度方向分辨率:"+str(XReso)+" 纬度方向分辨率:"+str(YReso)) length = length + 4+4+4+4+4+4 ZhighGrids=[] for i in range(0, 40): ZhighGrid, = unpack("f", file.read(4)) ZhighGrids.append(ZhighGrid) print("垂直方向的高度:"+str(ZhighGrids)) length = length + 40*4 # RadarStationNames=[] for i in range(0, 20): RadarStationName, = unpack("16s", file.read(16)) RadarStationName = RadarStationName.decode("gbk") RadarStationNames.append(RadarStationName.rstrip('\x00')) print("相关站点名称:"+str(RadarStationNames)) length = length + 20*16 # RadarLongitudes=[] for i in range(0, 20): RadarLongitude, = unpack("f", file.read(4)) RadarLongitudes.append(RadarLongitude) print("相关站点所在经度:"+str(RadarLongitudes)) length = length + 20*4 # RadarLatitudes=[] for i in range(0, 20): RadarLatitude, = unpack("f", file.read(4)) RadarLatitudes.append(RadarLatitude) print("相关站点所在纬度:"+str(RadarLatitudes)) length = length + 20*4 # RadarAltitudes=[] for i in range(0, 20): RadarAltitude, = unpack("f", file.read(4)) RadarAltitudes.append(RadarAltitu